【发布时间】:2016-08-02 09:27:32
【问题描述】:
我正在尝试在 chrome 扩展中实例化 CKEditor,但出现以下错误:
未捕获的类型错误:无法读取未定义的属性“工具”
未定义的对象是window.parent.CKEDITOR。
这是我的清单文件的一些块,我只导入了 ckeditor 文件夹的一些文件:
"content_scripts": [
"css": [
"bower_components/ckeditor/skins/moono/editor.css"
],
"js": [
"bower_components/ckeditor/ckeditor.js",
"bower_components/ckeditor/styles.js",
"bower_components/ckeditor/lang/en.js"
]
]
下面是我实例化编辑器的方法:
var options = {
language: 'en',
customConfig: '', //no default config loaded
toolbar: [
[ 'Format', 'Bold', 'Italic', 'Underline' ,
'BulletedList', 'NumberedList', 'Outdent', 'Indent', 'Link']
],
enterMode: CKEDITOR.ENTER_DIV,
on: {
instanceReady: function() { console.log('ready'); }
},
removePlugins: 'elementspath'
}
var instance = CKEDITOR.replace('textarea1', options);
editor = CKEDITOR.instances[instance.name];
有人设法在 chrome 扩展上使用 CKEDITOR 并想分享一些提示吗? 谢谢
【问题讨论】:
标签: javascript google-chrome google-chrome-extension ckeditor