【问题标题】:CKEditor remove style for a specific instanceCKEditor 删除特定实例的样式
【发布时间】:2015-08-24 05:50:25
【问题描述】:

如何删除特定 CK 编辑器实例的样式。 我的页面中有两个 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'
    } );

这会删除样式,但也会从内容中删除。

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

【问题讨论】:

    标签: javascript css ckeditor


    【解决方案1】:

    在你的代码 sn-p 中我可以看到:

    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阅读更多内容。

    【讨论】:

      猜你喜欢
      • 2012-07-26
      • 2014-03-25
      • 2013-02-23
      • 1970-01-01
      • 2019-09-08
      • 1970-01-01
      • 2013-01-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多