To update the textarea with id 'pdescription' every time the CKEditor changes, you can use the following code:

var pdescription;

ClassicEditor
    .create( document.querySelector( '#pdescription' ) )
    .then( editor => {
        pdescription = editor;

        pdescription.model.document.on('change:data', () => {
            document.querySelector('#pdescription').value = pdescription.getData();
        });
    } )
    .catch( err => {
        console.error( err.stack );
    } );

This code listens for the 'change:data' event on the CKEditor instance's model.document object. Whenever this event is triggered (i.e., the CKEditor content changes), it updates the value of the textarea with id 'pdescription' with the new content using the getData() method of the CKEditor instance.

How to Update Textarea with CKEditor Changes

原文地址: https://www.cveoy.top/t/topic/qnl5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录