我正在研究让CKEditor4能够处理尽可能多的预加载文件。例如,CKEditor加载
styles.js
文件本身,它加载插件的css文件和其他一些文件。
首先,我尝试通过将插件css文件添加为
link
元素,就像CKEditor4在代码中所做的那样。然后我在中禁用了css加载代码
ckeditor.js
像这样:(我添加了日志调用和早期返回,其他行不变。)
appendStyleSheet: function( cssFileUrl ) {
console.log("want css: " + cssFileUrl);
if (true) return;
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 );
}
},
这不起作用。编辑器未显示。
或者,我将
href
中的条目
setAttributes
呼叫这也不起作用。
有人知道为什么它不起作用吗?
(编辑:)我正在使用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"/>