代码之家  ›  专栏  ›  技术社区  ›  codeNinja

编辑编辑器配置.js没有影响

  •  7
  • codeNinja  · 技术社区  · 6 年前

    我换了我的编辑配置.js文件中包含所有可能的按钮:

    CKEDITOR.editorConfig = function( config ) {
        config.toolbarGroups = [
            { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
            { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
            { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
            { name: 'forms', groups: [ 'forms' ] },
            '/',
            { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
            { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] },
            { name: 'links', groups: [ 'links' ] },
            { name: 'insert', groups: [ 'insert' ] },
            '/',
            { name: 'styles', groups: [ 'styles' ] },
            { name: 'colors', groups: [ 'colors' ] },
            { name: 'tools', groups: [ 'tools' ] },
            { name: 'others', groups: [ 'others' ] },
            { name: 'about', groups: [ 'about' ] }
        ];
    };
    

    此配置是使用CKeditor生成的 config generator tool.

    在将更改部署到我的服务器并在chrome中使用incognito模式刷新页面之后,所有按钮都没有更改。

    admin.master 然后新的按钮就出现了。

    <script>
        jQuery(function() {
            CKEDITOR.config.extraPlugins = 'justify';
        });
    </script>
    

    config.js

    2 回复  |  直到 6 年前
        1
  •  2
  •   Zakaria Acharki    6 年前

    为此发布了一个Github问题 https://github.com/galetahub/ckeditor/pull/433 (很久以前)。 此外,还有一篇关于使用时未反映的更改的讨论文章 CKEDITOR.editorConfig 在这里: https://ckeditor.com/old/forums/CKEditor-3.x/config.js-changes-not-reflected

    我的建议是:

    检查浏览器中developpers检查器中的“console”选项卡,以验证是否有任何错误。

    作为替代,你可以使用 replace() instanceReady 事件回调,如:

    CKEDITOR.instances.editor1.on("instanceReady", function(event) {
      CKEDITOR.instances.editor1.destroy(); 
      CKEDITOR.replace('editor1', {
        toolbarGroups
      });
    });
    

    Working demo fiddle

        2
  •  0
  •   Marcus Carey    6 年前

    我有同样的问题,我必须删除浏览器数据。在Chrome中,您可以选择一个时间范围。一开始,我选择了最后一个小时,但这不起作用。然后我选择了所有的时间,它做到了。