我在一个有角度的项目中工作,并在我的项目中使用插件,并收到此错误:错误:某些CKEditor 5模块重复。我导入了软件包@ ckeditor / ckeditor5-alignment。
。html文件-
<ckeditor #editor [editor]="editor" [config]="config"></ckeditor>
和.ts文件
import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
export class WelcomePageSettingComponent implements OnInit {
public editor = ClassicEditor;
public config = {
plugins: [Alignment],
toolbar: ['heading', '|', 'bold', 'italic', '|', 'alignment'] }; constructor() {
}
constructor() { }
ngOnInit() { }
}
我使用ckeditor5-editor-classic而不是ckeditor5-build-classic并收到另一个错误:无法读取null的'getAttribute'属性。.html文件
<ckeditor [editor]="editor"></ckeditor>
.ts文件
import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
import ClassicEditor from "@ckeditor/ckeditor5-editor-classic/src/classiceditor";
export class WelcomePageSettingComponent implements OnInit {
public editor = ClassicEditor;
constructor() { }
ngOnInit() {
ClassicEditor
.create(document.querySelector('#editor'), {
plugins: [Alignment],
toolbar: ['heading', '|', 'bold', '|', 'italic', '|', 'mediaEmbed', '|',
'alignment']
})
.then()
.catch();
}
}