我正在尝试将 ckeditor 安装到我的 angular 项目中。我已经尝试安装 ckeditor4-angular
通过 npm 但无法找到添加插件(如 WIRIS mathType)的方法。请问如何将编辑器安装到我的 angular 项目以及安装插件?
最佳答案
这是关于此 https://github.com/ckeditor/ckeditor5-angular/issues/134 的问题.您需要创建自定义 CKEditor 构建并在其中包含必要的插件。这是指南:https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/custom-builds.html
顺便说一句,我建议您使用最新版本的 CKEditor 5。
更新:
git clone https://github.com/ckeditor/ckeditor5-build-classic.git
npm install
npm install --save @wiris/mathtype-ckeditor5
src/ckeditor.js
和编辑器的新插件:...
import MathType from '@wiris/mathtype-ckeditor5';
...
ClassicEditor.builtinPlugins = [
...
MathType
];
ClassicEditor.defaultConfig = {
toolbar: {
items: [
...
'MathType',
...
]
},
...
};
yarn run build
build
复制所有内容文件夹到您的项目。例如src/assets/js/ck-editor-math-type/
-> translations
-> ...
-> ckeditor.js
package.json
"dependencies": {
...
"@ckeditor/ckeditor5-angular": "^1.1.2",
...
}
import * as ClassicEditor from '../../assets/js/ck-editor-math-type/ckeditor.js';
...
export class CkeditComponent implements OnInit {
public Editor = ClassicEditor;
public model = {
editorData: '<p>Hello, world!</p>'
};
}
<ckeditor [(ngModel)]="model.editorData" [editor]="Editor"></ckeditor>
希望这对你有帮助。
关于angular - 如何将 CKEDITOR 安装到 angular 项目并添加插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59216515/