简体   繁体   English

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

[英]How to completely disable auto changes in ckeditor?

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

Ckeditor apply ACF (Advanced Content Filter) by default. Ckeditor默认情况下应用ACF(高级内容过滤器)。 If you don't want to apply this you can disable by add this in your config file : 如果您不想应用此功能,则可以通过在配置文件中添加此功能来禁用它:

CKEDITOR.config.allowedContent = true

This will allow all type of input into your editor. 这将允许所有类型的输入到您的编辑器中。 You can read more detail here . 您可以在此处阅读更多详细信息

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..

};

You have to edit config.js file. 您必须编辑config.js文件。

CKEDITOR version 4 CKEDITOR 版本 4

CKEDITOR.dtd.$removeEmpty.i = 0;
CKEDITOR.dtd.$removeEmpty.span = 0;
CKEDITOR.dtd.$removeEmpty.figure = 0; ...etc any tag

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM