2014-06-17 14 views
1

我想禁用ckeditor上的ACF,並且儘可能多的帖子和文檔建議,我將allowedcontent設置爲true,方法如下,仍然過濾掉我的html。CkEditor - 設置allowedContent爲true並不禁用ACF

CKEDITOR.config.allowedContent = true; 

CKEDITOR.editorConfig = function(config) { 

config.allowedContent = true; 

// also tried CKEDITOR.allowedContent = true; and CKEDITOR.config.allowedContent = true; 

}; 

我試圖在我的插件代碼中插入我的自定義標記,如下所示。

CKEDITOR.plugins.add('MakeCPBold', { 
init: function (editor) { 
    editor.addCommand('MakeCPBoldCommand', {   
     exec: function (editor) {    
      editor.insertHtml('<CP:CP_B>Sample Content</CP:CP_B>');        
     } 
    });   
    editor.ui.addButton('MakeCPBold', { 
     label: 'Make CP Bold', 
     command: 'MakeCPBoldCommand', 
     icon: this.path + 'images/makeabbr.gif', 
     toolbar: 'Basic' 

    }); 
} 

});

insertHtml只是插入「示例內容」並過濾自定義標記CP:CP_B。使用任何已知標記(如strong)替換標記CP:CP_B可以正常工作。

我配置正確嗎?

我正在使用最新版本的ckeditor 4.4.1。也試過版本4.4.0和4.2

感謝

回答

0

CKEditor的是HTML文本編輯,而不是XML編輯器。不要指望它支持像命名空間這樣的所有XML功能。使用data-foo屬性來區分標準數據中的自定義內容。

+0

它允許在引入ACF之前的版本中。它也允許FCKeditor。我能夠更早地注入自定義標籤。剛剛與ACF版本不允許。 –

相關問題