如何在 CKEditor 5 中使用文档编辑器设置数据
How to set Data with document editor in CKEditor 5
我创建了一个通过 cookie 保存文档的系统,一切正常,但我只是想念如何将文本放在文档上...我有一个 DecoupledEditor,但是当我尝试制作 DecoupledEditor.setData (cookie) 它告诉我 setData 不存在!祝你有美好的一天
DecoupledEditor.setData(docu);
获取编辑器
DecoupledEditor
.create( document.querySelector.....
像这样。
(async function() {
try {
const editor = await DecoupledEditor
.create( document.querySelector( '#editor' ));
editor.setData('This text is generated from setdata() method.');
} catch(e) {
console.error(e);
}
})();
<script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/decoupled-document/ckeditor.js"></script>
<h1>ckeditor</h1>
<div id="editor">
Default Text
</div>
我创建了一个通过 cookie 保存文档的系统,一切正常,但我只是想念如何将文本放在文档上...我有一个 DecoupledEditor,但是当我尝试制作 DecoupledEditor.setData (cookie) 它告诉我 setData 不存在!祝你有美好的一天
DecoupledEditor.setData(docu);
获取编辑器
DecoupledEditor
.create( document.querySelector.....
像这样。
(async function() {
try {
const editor = await DecoupledEditor
.create( document.querySelector( '#editor' ));
editor.setData('This text is generated from setdata() method.');
} catch(e) {
console.error(e);
}
})();
<script src="https://cdn.ckeditor.com/ckeditor5/23.0.0/decoupled-document/ckeditor.js"></script>
<h1>ckeditor</h1>
<div id="editor">
Default Text
</div>