2015-06-09 112 views
1

如何删除特定CK编辑器实例的样式。 我的页面中有两个CKEditor。一个限制于摘要而另一个限制内容。CKEditor删除特定实例的样式

对于总结,我不能允许复制粘贴样式,因为这可能会混淆我们的设计。

我试过这个解决方案:

 CKEDITOR.config.forcePasteAsPlainText = true; 
    CKEDITOR.replace(id, { 
     // Define the toolbar groups as it is a more accessible solution. 
     toolbarGroups: [ 
      {"name":"basicstyles","groups":["basicstyles"]}, 
      {"name":"links","groups":["links"]} 
     ], 
     // Remove the redundant buttons from toolbar groups defined above. 
     removeButtons: 'Strike,Subscript,Superscript,Anchor,Styles,Specialchar' 
    }); 

这消除了造型,但是从内容也删除。

所以我的问题是如何在我粘贴摘要时删除样式,以及在粘贴内容时如何保持样式。

回答

0

在您的代码段,我可以看到:

CKEDITOR.config.forcePasteAsPlainText = true; 

这不是设置的配置选项的正确道路。这将改变所有现有编辑器的设置。你想要做的就是这个设置移动到CKEDITOR.replace()

CKEDITOR.replace('content', { 
    // some options for the "content" editor. 
}); 

CKEDITOR.replace('summary', { 
    forcePasteAsPlainText: true, 
    // some other options for the "summary" editor. 
}); 

setting configuration更多。