javascript - TinyMCE editor : Uncaught TypeError: Cannot set property 'isMSIE' of null - Stack Overflow

I'm using TinyMCE (v3.5.8) and integrated iBrowser plugin (v1.4.5) with Codeigniter 2.1.3 and i�

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. Thanks.

EDIT

Error is in iBrowser plugin.

I didn't changed anything as from the downloaded file.

Error occurring in editor_plugin.js in iBrowser plugin folder.

iBrowser plugin url : .html

editor_plugin.js contains below code.

ib = null;

(function() {
    tinymce.create('tinymce.plugins.IBrowserPlugin', {
        init : function(ed, url) {
            // load mon script
            tinymce.ScriptLoader.load(url + '/interface/mon.js');

            // Register mands
            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',
                authorurl : '',
                infourl :   '.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.

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. Thanks.

EDIT

Error is in iBrowser plugin.

I didn't changed anything as from the downloaded file.

Error occurring in editor_plugin.js in iBrowser plugin folder.

iBrowser plugin url : http://seoroot./blog/puting/programming/tinymce-ibrowser-plugin.html

editor_plugin.js contains below code.

ib = null;

(function() {
    tinymce.create('tinymce.plugins.IBrowserPlugin', {
        init : function(ed, url) {
            // load mon script
            tinymce.ScriptLoader.load(url + '/interface/mon.js');

            // Register mands
            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.',
                authorurl : 'http://net4visions.',
                infourl :   'http://net4visions./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.

Share Improve this question edited Feb 16, 2013 at 5:03 Mansoorkhan Cherupuzha asked Feb 16, 2013 at 4:41 Mansoorkhan CherupuzhaMansoorkhan Cherupuzha 1,7611 gold badge24 silver badges45 bronze badges 2
  • 3 Alright, just give me a few hours to set up a local instance exactly like that. Or, post the code where the error was thrown. Examine the call stack and see if it originated in your code. Then post your code. – alex Commented Feb 16, 2013 at 4:44
  • I'll edit my question now – Mansoorkhan Cherupuzha Commented Feb 16, 2013 at 4:45
Add a ment  | 

2 Answers 2

Reset to default 2

The culprit is the first line of the code:

ib = null;

null cannot be accessed as an object. That will throw a TypeError as you've seen. 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.

However, I'm a little puzzled why this was explicitly set to 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.

In the file editor_plugin.js (located in ibrowser root plugin folder) mented out the line:

tinymce.ScriptLoader.load(url + '/interface/mon.js');

and add this

$.getScript(url+'/interface/mon.js');

Do the same for editor_plugin_src.js as well.

Should be fixed. The fix by @PhpMyCoder will work too. :)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745350767a4623817.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信