To set a value to CKEditor when it is loaded and initialized, you can use the 'setData' method. Here's an example:

var pdescription;

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

        // Set initial value
        pdescription.setData('Initial value');

        for (var i in pdescription.editors) {
            pdescription.editors[i].on('change', function() { pdescription.editors[i].updateElement() });
        }
    } )
    .catch( err => {
        console.error( err.stack );
    } );

In the above code, the 'setData' method is called with the initial value you want to set for CKEditor. Replace 'Initial value' with the value you want to set.

How to Set Initial Value in CKEditor on Load

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

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