ckeditor5-build-classic 需要添加高亮的特性或者插件,所以需要自定义构建;
-
fork已有的ckeditor5-build-classic工程的源码
git clone -b stable git@github.com:<your-username>/ckeditor5-build-classic.gitfork 仓库git remote add upstream https://github.com/ckeditor/ckeditor5-build-classic.git和原仓库同步 -
工程结构
build/ckeditor.js – 构建的结果文件
src/ckeditor.js – 配置编辑器的文件
webpack-config.js – 工程配置文件.
- 自定义构建配置
-
安装构建依赖
`npm install` `npm install --save-dev <package-name>` -
更新构建配置 在文件
src/ckeditor.js中到如依赖的特性,配置
'use strict';
// The editor creator to use.
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat';
import BoldPlugin from '@ckeditor/ckeditor5-basic-styles/src/bold';
import ItalicPlugin from '@ckeditor/ckeditor5-basic-styles/src/italic';
import HeadingPlugin from '@ckeditor/ckeditor5-heading/src/heading';
import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import CustomPlugin from 'ckeditor5-custom-package/src/customplugin'; // 新增
import OtherCustomPlugin from '../relative/path/to/some/othercustomplugin';
export default class ClassicEditor extends ClassicEditorBase {}
// Plugins to include in the build.
ClassicEditor.builtinPlugins = [
EssentialsPlugin,
AutoformatPlugin,
BoldPlugin,
ItalicPlugin,
HeadingPlugin,
LinkPlugin,
ListPlugin,
ParagraphPlugin,
CustomPlugin,// 新增
OtherCustomPlugin
];
ClassicEditor.defaultConfig = {
toolbar: [ 'heading', '|', 'bold', 'italic', 'custombutton' ],
// This value must be kept in sync with the language defined in webpack.config.js.
language: 'en'
};
-
重新构建
在工程中执行
yarn run build,构建工程
- 更新构建结果
- 发布构建结果