In CKEditor 4.x is there a way to get the list of allowed tags after initialization?

后端 未结 1 461
执念已碎
执念已碎 2021-01-23 07:36

Is there a way to get a list of all allowed tags in CKEDitor 4.x (4.4.7 to be precise) after the editor has been initialized with all plugins, and all all

相关标签:
1条回答
  • 2021-01-23 08:07

    Probably CKEDITOR.filter.allowedContent is what you're looking for. It can be accessed from the editor.filter property. Small example of how to do it: https://jsfiddle.net/Comandeer/tb6f0g8r/

    CKEDITOR.replace( 'editor1', {
        on: {
            instanceReady: function( evt ) {
                // It returns the array of all rules,
                //so if you want to send it to the server,
                // you'll probably need to "JSON-ify" it.
                var allowedContent = evt.editor.filter.allowedContent;
                console.log( JSON.stringify( allowedContent, null, '\t' ) );
            }
        }
    } );
    

    Maybe that format is not as friendly as simple string, but it conveys all information you need.

    0 讨论(0)
提交回复
热议问题