[英]TinyMCE editor : Uncaught TypeError: Cannot set property 'isMSIE' of null
I'm using TinyMCE (v3.5.8) and integrated iBrowser plugin (v1.4.5) with Codeigniter 2.1.3 and i'm getting the JavaScript error Uncaught TypeError: Cannot set property 'isMSIE' of null
Please help me to solve this. 我正在使用TinyMCE(v3.5.8)和集成iBrowser插件(v1.4.5)和Codeigniter 2.1.3并且我得到了JavaScript错误Uncaught TypeError: Cannot set property 'isMSIE' of null
请帮我解决这个问题。 Thanks. 谢谢。
EDIT 编辑
Error is in iBrowser plugin. 错误在iBrowser插件中。
I didn't changed anything as from the downloaded file. 从下载的文件中我没有改变任何内容。
Error occurring in editor_plugin.js in iBrowser plugin folder. 在iBrowser插件文件夹中的editor_plugin.js中发生错误。
iBrowser plugin url : http://seoroot.com/blog/computing/programming/tinymce-ibrowser-plugin.html iBrowser插件网址: http ://seoroot.com/blog/computing/programming/tinymce-ibrowser-plugin.html
editor_plugin.js contains below code. editor_plugin.js包含以下代码。
ib = null;
(function() {
tinymce.create('tinymce.plugins.IBrowserPlugin', {
init : function(ed, url) {
// load common script
tinymce.ScriptLoader.load(url + '/interface/common.js');
// Register commands
ed.addCommand('mceIBrowser', function() {
var e = ed.selection.getNode();
// Internal image object like a flash placeholder
if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1) {return}
ib.isMSIE = tinymce.isIE;
ib.isGecko = tinymce.isGecko;
ib.isWebKit= tinymce.isWebKit;
ib.oEditor = ed;
ib.editor = ed;
ib.selectedElement = e;
ib.baseURL = url + '/ibrowser.php';
iBrowser_open();
});
// Register buttons
ed.addButton('ibrowser', {
title : 'iBrowser',
cmd : 'mceIBrowser',
image: url + '/interface/images/tinyMCE/ibrowser.gif'
});
// Add a node change handler, selects the button in the UI when a image is selected
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('ibrowser', n.nodeName == 'IMG');
});
},
getInfo : function() {
return {
longname : 'iBrowser',
author : 'net4visions.com',
authorurl : 'http://net4visions.com',
infourl : 'http://net4visions.com/ibrowser.html',
version : '1.4.0'
};
}
});
// Register plugin
tinymce.PluginManager.add('ibrowser', tinymce.plugins.IBrowserPlugin);
})();
Sorry. 抱歉。 Its a long code. 它的代码很长。
NOTE : TinyMCE is working well but this plugin has some errors. 注意: TinyMCE运行良好,但此插件有一些错误。
The culprit is the first line of the code: 罪魁祸首是代码的第一行:
ib = null;
null
cannot be accessed as an object. null
不能作为对象访问。 That will throw a TypeError
as you've seen. 这会抛出你看到的TypeError
。 The fix, I assume, would be to change this line to: 我认为,修复方法是将此行更改为:
ib = {};
That way it is an object and can have its isMSIE
property set. 这样它就是一个对象,可以设置它的isMSIE
属性。
However, I'm a little puzzled why this was explicitly set to null
. 但是,我有点疑惑为什么这个被明确地设置为null
。 I'd try changing that line of code and seeing if that breaks something, because there possibly could've been a reason for ib
to initially be null. 我试着改变那行代码,看看是否会破坏某些东西,因为可能原因可能是ib
最初为空。
In the file editor_plugin.js (located in ibrowser root plugin folder) commented out the line: 在文件editor_plugin.js(位于ibrowser root plugin文件夹中)注释掉了这一行:
tinymce.ScriptLoader.load(url + '/interface/common.js');
and add this 并添加此
$.getScript(url+'/interface/common.js');
Do the same for editor_plugin_src.js as well. 对editor_plugin_src.js执行相同操作。
Should be fixed. 应该是固定的。 The fix by @PhpMyCoder will work too. @PhpMyCoder的修复也会起作用。 :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.