//引入
<script src="../view/public/ckeditor5/build/ckeditor.js"></script>
<script src="../view/public/ckeditor5/build/translations/zh.js"></script>
//组件
<textarea name="editor" id="editor" rows="10" cols="80"></textarea>
init_ckeditor(){
ClassicEditor.create( document.querySelector( '#editor' ), {
language: 'zh-cn',
//移除富文本编辑器的工具栏中部分工具
removePlugins: ['Italic', 'MediaEmbed'],
} )
.then( editor => {
// 记录编辑器对象
this.editor = editor;
// 监听内容变化
editor.model.document.on('change:data', (e) => {
// 输出当前内容
console.log(editor.getData())
document.getElementById('editorcontent').innerHTML = editor.getData();
})
} )
.catch( error => { console.error( error ); } );
},
标签:ckeditor5,console,使用,editor,error,document,getData
From: https://www.cnblogs.com/JaneLifeBlog/p/16624911.html