问题描述
我创建了一个系统来通过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>