Event for ckeditor content changed

后端 未结 5 403
挽巷
挽巷 2021-01-01 15:48

If possible, how can we to the event of ckeditor\'s content being changed? For instance, there\'s some text already inserted into the ckeditor\'s content aka textarea when t

5条回答
  •  离开以前
    2021-01-01 16:30

    Hope this might help someone else who comes across this post like me.. If you are using CKEditor5, could try this:

    ClassicEditor.create(document.querySelector('#editor'))
    .then(editor => {
        editor.model.document.on('change:data', (evt, data) => {
            console.log(editor.getData());
        });
    })
    .catch(error => {
        console.error('Editor initialization error.', error);
    });
    

提交回复
热议问题