2016-10-07 28 views

回答

1

Ckeditor默認應用ACF(高級內容過濾器)。如果您不想應用此您可以禁用在您的配置文件添加此:

CKEDITOR.config.allowedContent = true 

這將允許所有類型的輸入到編輯器。你可以閱讀更多細節here

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文件。

+0

我曾在我的項目中嘗試config.allowedContent = true,但它不適合我。你檢查這個鏈接瞭解更多關於添加屬性的信息http://stackoverflow.com/questions/15659390/ckeditor-automatically-strips-classes-from-div – aasiph