Preserving SCRIPT tags (and more) in CKEditor

前端 未结 3 1717
渐次进展
渐次进展 2021-01-02 04:17

Is it possible to create a block of code within the CKEditor that will not be touched by the editor itself, and will be maintained in its intended-state until explicitly cha

3条回答
  •  青春惊慌失措
    2021-01-02 04:52

    In CKEDITOR folder you have a config.js file. Open it and paste the code:

    CKEDITOR.editorConfig = function( config ) {
        config.allowedContent = {
            script: true,
            $1: {
                // This will set the default set of elements
                elements: CKEDITOR.dtd,
                attributes: true,
                styles: true,
                classes: true
            }
        };
    };
    

    It will allow tags in Source mode.

提交回复
热议问题