如何让 CKEditor4 使用预加载的插件文件?

How to make CKEditor4 work with the plugin files pre-loaded?

我正在考虑让 CKEditor4 与尽可能多的预加载文件一起工作。例如,CKEditor 自己加载 styles.js 文件,它加载插件的 css 文件等等。

首先,我尝试通过将插件 css 文件添加为 link 元素来预加载它们,就像 CKEditor4 在代码中所做的那样。然后我禁用了 ckeditor.js 中的 css 加载代码,如下所示:(我添加了日志调用和早期的 return,其他行没有改变。)

appendStyleSheet: function( cssFileUrl ) {
    console.log("want css: " + cssFileUrl);
    if (true) return; // MARK: all styles are already loaded
    if ( this.$.createStyleSheet )
        this.$.createStyleSheet( cssFileUrl );
    else {
        var link = new CKEDITOR.dom.element( 'link' );
        link.setAttributes( {
            rel: 'stylesheet',
            type: 'text/css',
            href: cssFileUrl
        } );

        this.getHead().append( link );
    }
},

这不起作用。编辑器没有出现。

或者,我在 setAttributes 调用中注释掉了 href 条目。这也不行。

有人知道为什么它不起作用吗?

(编辑:) 我正在使用 Windows 7.

中最新的 Chrome

(我像这样将 css 文件添加到我的静态测试页面 - 这些就是这些,CKEditor 通过按顺序调用 appendStyleSheet 函数来加载:)

<link rel="stylesheet" href="ext/ckeditor/skins/moono-lisa/editor.css"/>

<link rel="stylesheet" href="ext/ckeditor/plugins/tableselection/styles/tableselection.css"/>
<link rel="stylesheet" href="ext/ckeditor/plugins/balloontoolbar/skins/default.css"/>
<link rel="stylesheet" href="ext/ckeditor/plugins/balloontoolbar/skins/moono-lisa/balloontoolbar.css"/>
<link rel="stylesheet" href="ext/ckeditor/plugins/balloonpanel/skins/moono-lisa/balloonpanel.css"/>
<link rel="stylesheet" href="ext/ckeditor/plugins/copyformatting/styles/copyformatting.css"/>

我有一个小提示,可能会对你有所帮助。

尝试删除它,看看是否有帮助

CKEDITOR.document.appendStyleText( '.cke{visibility:hidden;}' );