如何在ckeditor中完全禁用自动更改?

时间:2016-10-07 05:08:10

标签: javascript ckeditor

我想使用<(label)>标签以及class ="" <(span)>中的属性margin-left(span in span)标签,但ckeditor自动替换span中的标签标签和类,它还从span标签中的style属性中删除margin属性

2 个答案:

答案 0 :(得分:1)

Ckeditor默认使用ACF(高级内容过滤器)。如果您不想应用此功能,可以在配置文件中添加以下内容进行禁用:

CKEDITOR.config.allowedContent = true

这将允许所有类型的输入进入编辑器。您可以阅读更多详细信息here

答案 1 :(得分:0)

CKEDITOR.editorConfig = function( config ) {
    config.toolbarGroups = [
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'styles', groups: [ 'styles' ] },
        { name: 'colors', groups: [ 'colors' ] },
        '/',
        { name: 'links', groups: [ 'links' ] },
        { name: 'insert', groups: [ 'insert' ] },
        { name: 'paragraph', groups: [ 'list', 'blocks' ] },
        { name: 'document', groups: [ 'mode' ] }
    ];

    config.removeButtons = 'Save,NewPage,Preview,Print,PasteText,PasteFromWord,Find,Replace,Scayt,SelectAll,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Outdent,Indent,CreateDiv,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,Subscript,Superscript,Strike,BidiLtr,BidiRtl,Language,Anchor,Flash,Table,HorizontalRule,PageBreak,Iframe,Styles,Format,Font,Maximize,ShowBlocks,About,SpecialChar,Templates';
    config.extraAllowedContent = 'label';// This will allow label tag..

};

您必须编辑config.js文件。