我有以下 div:
<div name="content" id="editor">
我有以下脚本:
<script>
$(document).ready(function () {
// CKEDITORs
var myeditor = ClassicEditor
.create(document.querySelector('#editor'))
.then(editor => {
console.log(editor);
})
.catch(error => {
console.error(error);
});
});
const data = editor.getData();
const data = myeditor.getData();
</script>
从文档中,我认为我可以执行以下操作:
const data = editor.getData(); //fails with editor.getData is not a function
所以添加了上面的 myeditor var 并尝试了这个:
myeditor.getData();// also fails with same error.
如何获取数据?