// src/utils/ckeditor-custom-build.js
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import Link from '@ckeditor/ckeditor5-link/src/link';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import Image from '@ckeditor/ckeditor5-image/src/image';
import ImageInsert from '@ckeditor/ckeditor5-image/src/imageinsert';
import ImageResize from '@ckeditor/ckeditor5-image/src/imageresize';
import ImageStyle from '@ckeditor/ckeditor5-image/src/imagestyle';
import ImageToolbar from '@ckeditor/ckeditor5-image/src/imagetoolbar';
import ImageCaption from '@ckeditor/ckeditor5-image/src/imagecaption';
import FileRepository from '@ckeditor/ckeditor5-upload/src/filerepository';
export default class ClassicEditor extends ClassicEditorBase {}

ClassicEditor.builtinPlugins = [
    Essentials,
    Bold,
    Italic,
    Link,
    Paragraph,
    Image,
    ImageInsert,
    ImageResize,
    ImageStyle,
    ImageToolbar,
    ImageCaption,
    FileRepository // 添加 FileRepository 插件
];

ClassicEditor.defaultConfig = {
  toolbar: {
    items: [
     'bold',
      'italic',
      'link',
      'imageInsert', // 使用 imageInsert 而不是 Image
      'imageResize', // 使用 imageResize 而不是 ImageResize
      'undo',
      'redo'
    ]
  },
  image: {
    toolbar: [
      'imageStyle:full',
      'imageStyle:side',
      '|',
      'imageTextAlternative'
    ]
  },
  language: 'zh-cn'
};