ckeditor5 Document editor(DecoupledEditor) Integrate

ckeditor5 Document editor(DecoupledEditor) Integrate

casuistcasuist Posts: 34Questions: 14Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Has anyone succeeded?
Please help me.
ckeditor5 bulk build version excluding DecoupledEditor is working well.

sample code - from https://ckeditor.com/docs/ckeditor5/latest/installation/getting-started/predefined-builds.html#document-editor

DecoupledEditor .create( document.querySelector( '#editor' ) ) .then( editor => { const toolbarContainer = document.querySelector( '#toolbar-container' ); toolbarContainer.appendChild( editor.ui.view.toolbar.element ); } ) .catch( error => { console.error( error ); } );

Call the DecoupledEditor.create() method. The decoupled editor requires you to inject the toolbar into the DOM and the best place to do that is somewhere in the promise chain (for example, one of the then( () => { ... } ) blocks).

important difference is must provide container for toolbar.

Answers

  • casuistcasuist Posts: 34Questions: 14Answers: 0

    i try below code

    ...
    _fieldTypes[fieldType] = {
    create: function (conf) {
    var that = this;
    var id = DataTable.Editor.safeId(conf.id);

                conf._input = $('<div id="' + id + '"></div>');
    
    
                DecoupledEditor.create(conf._input[0], conf.opts)
                    .then(function (editor) {
                        // const toolbarContainer = document.querySelector('#toolbar-container');
    
                        $('#toolbar-container').append(editor.ui.view.toolbar.element);
    
    
                        conf._ckeditor = editor;
                    })
                    .catch(error => {
                        console.error(error);
                    });
    
                return conf._input;
            },
    

    ...

    toolbar not init.

Sign In or Register to comment.