Почему я не могу добавить новый плагин (exportPdf) в CKEditor 5? - PullRequest
0 голосов
/ 09 июля 2020
  1. Я загрузил версию сборки ckeditor5-document с github.
  2. Я установил Node.js, пытаясь настроить и собрать свой собственный редактор.
  3. запустить npm install в папка ckeditor5-document.
  4. run npm install --save @ckeditor/ckeditor5-export-pdf
  5. отредактируйте файл src / ckeditor. js, импортируйте ExportPdf, добавьте ExportPdf в список плагинов и панель инструментов.
  6. запустить npm run build, успешно.
  7. открыть 'sample / index. html', и ничего не показывает.

почему?

раньше изменить: введите описание изображения здесь

после редактирования: введите описание изображения здесь

'src / ckeditor. js' код:

/**
 * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
 */

// The editor creator to use.
import DecoupledEditorBase from '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor';

import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
import FontSize from '@ckeditor/ckeditor5-font/src/fontsize';
import FontFamily from '@ckeditor/ckeditor5-font/src/fontfamily';
import FontColor from '@ckeditor/ckeditor5-font/src/fontcolor';
import FontBackgroundColor from '@ckeditor/ckeditor5-font/src/fontbackgroundcolor';
import UploadAdapter from '@ckeditor/ckeditor5-adapter-ckfinder/src/uploadadapter';
import Autoformat from '@ckeditor/ckeditor5-autoformat/src/autoformat';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough';
import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
import CKFinder from '@ckeditor/ckeditor5-ckfinder/src/ckfinder';
import EasyImage from '@ckeditor/ckeditor5-easy-image/src/easyimage';
import Heading from '@ckeditor/ckeditor5-heading/src/heading';
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 Indent from '@ckeditor/ckeditor5-indent/src/indent';
import IndentBlock from '@ckeditor/ckeditor5-indent/src/indentblock';
import Link from '@ckeditor/ckeditor5-link/src/link';
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 PasteFromOffice from '@ckeditor/ckeditor5-paste-from-office/src/pastefromoffice';
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 ExportPdf from '@ckeditor/ckeditor5-export-pdf/src/exportpdf'; // panda add
// import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight'; // panda add

export default class DecoupledEditor extends DecoupledEditorBase {}

// Plugins to include in the build.
DecoupledEditor.builtinPlugins = [
    Essentials,
    Alignment,
    FontBackgroundColor,
    UploadAdapter,
    Autoformat,
    Bold,
    Italic,
    // Highlight, // panda add
    ExportPdf, // panda add
    Strikethrough,
    Underline,
    CKFinder,
    EasyImage,
    Heading,
    Indent,
    IndentBlock,
    List,
    MediaEmbed,
    Paragraph,
    PasteFromOffice,
    Table,
    TableToolbar,
    TextTransformation,
];

// Editor configuration.
DecoupledEditor.defaultConfig = {
    toolbar: {
        items: [
            'exportPdf', // panda add
            '|',
            'heading',
            '|',
            'fontBackgroundColor',
            '|',
            'alignment',
            '|',
            // 'highlight',
            'indent',
            'outdent',
            '|',
            'imageUpload',
            '|',
            'undo',
            'redo'
        ]
    },
    image: {
        styles: [
            'full',
            'alignLeft',
            'alignRight'
        ],
        toolbar: [
            'imageStyle:alignLeft',
            'imageStyle:full',
            'imageStyle:alignRight',
            '|',
            'imageTextAlternative'
        ]
    },
    table: {
        contentToolbar: [
            'tableColumn',
            'tableRow',
            'mergeTableCells'
        ]
    },
    // This value must be kept in sync with the language defined in webpack.config.js.
    language: 'en'
};
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...