【发布时间】:2019-10-23 09:51:18
【问题描述】:
我想将数据设置为 3 个。已经创建的编辑器,我无法做到。
我试过了。不。 2 设置正在新创建的编辑器上发生的数据,而不是现有的。
- 下面是我创建 3 个编辑器的位置:
create_editor: function () {
window.editors = {};
document.querySelectorAll('.editor').forEach((node, index) => {
ClassicEditor
.create(node, {
//removePlugins: [ 'Heading', 'Link' ],
toolbar: ['bold', 'italic', 'bulletedList', 'numberedList', 'blockQuote', 'Heading'],
//placeholder: 'Type the content here!'
})
.then(editor => {
//console.log(editor);
window.editors[index] = editor
})
.catch(error => {
//console.error(error);
});
});
}
- 下面是我尝试将我的数据设置为所有 3 个现有编辑器的位置:
set_editor: function (elem, data) {
ClassicEditor
.create(document.querySelector('#' + elem))
.then(editor => {
editor.setData(data);
})
}
数据存储在本地存储中,我想检索它们并将它们设置为我已经创建的 3 个当前没有发生的编辑器。
【问题讨论】:
标签: javascript jquery ajax ckeditor ckeditor5