<script>
import Vue from "vue";
import CKEditor from "@ckeditor/ckeditor5-vue";
Vue.use(CKEditor);
import ClassicEditor from "@ckeditor/ckeditor5-editor-classic/src/classiceditor";
import FileRpository from "@ckeditor/ckeditor5-upload/src/filerepository";
// 必须配置Essentials,否则编辑器无法输入
import Essentials from "@ckeditor/ckeditor5-essentials/src/essentials";
import UploadAdapter from "@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter";
import Alignment from "@ckeditor/ckeditor5-alignment/src/alignment";
import Autoformat from "@ckeditor/ckeditor5-autoformat/src/autoformat"
import Bold from "@ckeditor/ckeditor5-basic-styles/src/bold"
import Base64UploadAdapter from "@ckeditor/ckeditor5-upload/src/adapters/base64uploadadapter";
import Italic from "@ckeditor/ckeditor5-basic-styles/src/italic";
import Underline from "@ckeditor/ckeditor5-basic-styles/src/underline";
import Strikethrough from "@ckeditor/ckeditor5-basic-styles/src/strikethrough";
import CKFinder from "@ckeditor/ckeditor5-ckfinder/src/ckfinder";
import Code from "@ckeditor/ckeditor5-basic-styles/src/code";
import CodeBlock from "@ckeditor/ckeditor5-code-block/src/codeblock";
import Font from "@ckeditor/ckeditor5-font/src/font";
import Subscript from "@ckeditor/ckeditor5-basic-styles/src/subscript";
import Superscript from "@ckeditor/ckeditor5-basic-styles/src/superscript";
import Highlight from "@ckeditor/ckeditor5-highlight/src/highlight";
import Heading from "@ckeditor/ckeditor5-heading/src/heading";
import HorizontalLine from "@ckeditor/ckeditor5-horizontal-line/src/horizontalline";
import Image from "@ckeditor/ckeditor5-image/src/image";
import ImageCaption from "@ckeditor/ckeditor5-image/src/imagecaption";
import ImageStyle from "@ckeditor/ckeditor5-image/src/imagestyle";
import ImageToolbar from "@ckeditor/ckeditor5-image/src/imagetoolbar";
import ImageUpload from "@ckeditor/ckeditor5-image/src/imageupload";
import ImageResize from "@ckeditor/ckeditor5-image/src/imageresize";
import EasyImage from "@ckeditor/ckeditor5-easy-image/src/easyimage";
import Indent from "@ckeditor/ckeditor5-indent/src/indent";
import Link from "@ckeditor/ckeditor5-link/src/link";
import IndentBlock from "@ckeditor/ckeditor5-indent/src/indentblock";
import List from "@ckeditor/ckeditor5-list/src/list";
import MediaEmbed from "@ckeditor/ckeditor5-media-embed/src/mediaembed";
import Paragraph from "@ckeditor/ckeditor5-paragraph/src/paragraph";
import PageBreak from "@ckeditor/ckeditor5-page-break/src/pagebreak";
import PasteFromOffice from "@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice";
import { MyUploadAdapter } from "@/nzk/utils/MyUploadAdapterPlugin";
import Title from "@ckeditor/ckeditor5-heading/src/title";
import Table from "@ckeditor/ckeditor5-table/src/table";
import TableToolbar from "@ckeditor/ckeditor5-table/src/tabletoolbar";
import TextTransformation from "@ckeditor/ckeditor5-typing/src/texttransformation";
import TodoList from "@ckeditor/ckeditor5-list/src/todolist";
import BlockToolbar from "@ckeditor/ckeditor5-ui/src/toolbar/block/blocktoolbar";
import HeadingButtonsUI from "@ckeditor/ckeditor5-heading/src/headingbuttonsui";
import ParagraphButtonUI from "@ckeditor/ckeditor5-paragraph/src/paragraphbuttonui";
export default {
name: "MyEditor",
data() {
return {
editor: ClassicEditor,
editorData: "在这里输入或粘贴内容",
editorConfig: {
plugins: [
Alignment,
Highlight,
Essentials,
UploadAdapter,
Autoformat,
Bold,
Base64UploadAdapter,
Italic,
Underline,
Strikethrough,
Code,
CodeBlock,
Font,
Subscript,
Superscript,
CKFinder,
Heading,
HorizontalLine,
EasyImage,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
ImageUpload,
ImageResize,
Indent,
IndentBlock,
Link,
List,
MediaEmbed,
Paragraph,
PasteFromOffice,
FileRpository,
Table,
TableToolbar,
TextTransformation,
TodoList,
BlockToolbar,
ParagraphButtonUI,
HeadingButtonsUI,
PageBreak
],
toolbar: {
items: [
"alignment",
"Highlight",
"fontSize",
"fontFamily",
"fontColor",
"fontBackgroundColor",
"pageBreak",
"heading",
"|",
"bold",
"italic",
"underline",
"strikethrough",
"code",
"codeBlock",
"subscript",
"superscript",
"link",
"todoList",
"bulletedList",
"numberedList",
"horizontalLine",
"indent",
"outdent",
"|",
"ckfinder",
"imageUpload",
"insertTable",
"mediaEmbed",
"undo",
"redo"
]
},
image: {
toolbar: [
"imageStyle:full",
"imageStyle:side",
"|",
"imageTextAlternative"
]
},
table: {
contentToolbar: ["tableColumn", "tableRow", "mergeTableCells"]
},
blockToolbar: [
"paragraph",
"heading1",
"heading2",
"heading3",
"|",
"bulletedList",
"numberedList",
"|",
"imageUpload"
],
cloudServices: {},
ckfinder: {
uploadUrl: "",
options: {
resourceType: "Images"
}
},
mediaEmbed: {},
}
};
},
}
</script>