I want to set data to 3 nos. of already created editors which I am unable to do.
I tried pt. no. 2 to set data which is happening on a newly created editor and not to the existing one.
- Below is where i am creating my 3 editors:
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);
});
});
}
- Below is where i am trying to set my data to all my 3 existing editors:
set_editor: function (elem, data) {
ClassicEditor
.create(document.querySelector('#' + elem))
.then(editor => {
editor.setData(data);
})
}
The data are stored in a local storage and I want to retrieve them and set them to my already 3 created editors which currently is not happening.