sleemanj / xinha

WYSIWYG HTML Editor Component (turns <textarea> into HTML editors)
http://trac.xinha.org/
Other
13 stars 2 forks source link

Xinha errors for IE10 (Trac #1610) #1610

Closed sleemanj closed 4 years ago

sleemanj commented 11 years ago

I just installed Xinha 0.96.1 for a project and it worked with FF & Chrome & IE8-9, but failed for IE10 such that the toolbar was never displayed (major failure). The messages were about using length on a null or something that wasn't an object.

I did manage to fix it by changing XinhaCore.js and thought I'd share...

Kevin Brannen kbrannen a-t corp.hrsmart.com

diff --git a/htdocs/xinha/XinhaCore.js b/back/htdocs/xinha/XinhaCore.js
index 07f3d0b..ec475e4 100644
--- a/htdocs/xinha/XinhaCore.js
+++ b/htdocs/xinha/XinhaCore.js
@@ -1389,6 +1389,7 @@ Xinha.Config.prototype.addToolbarElement = function(id, where, position)
   }

   for ( i = 0; i < toolbar.length; ++i ) {
+    if (!toolbar[i]) continue;
     a = toolbar[i];
     for ( j = 0; j < a.length; ++j ) {
       // check if button/select box exists
@@ -1401,6 +1402,7 @@ Xinha.Config.prototype.addToolbarElement = function(id, where, position)

   for ( i = 0; !found && i < toolbar.length; ++i )
   {
+    if (!toolbar[i]) continue;
     a = toolbar[i];
     for ( j = 0; !found && j < a.length; ++j )
     {
@@ -1569,7 +1571,7 @@ Xinha.prototype._createToolbar = function ()
       for(var i = 0; i < e.childNodes.length; i++) if(e.tagName) noselect(e.childNodes(i));
     }
        }
-       if(Xinha.is_ie) noselect(toolbar);
+       if(Xinha.is_ie && Xinha.ie_version < 9) noselect(toolbar);

        this._htmlArea.appendChild(toolbar);      
@@ -1990,6 +1992,7 @@ Xinha.prototype._createToolbar1 = function (editor, toolbar, tb_objects)
       this.config.toolbar[i] = ['separator'];
     }
     var group = this.config.toolbar[i];
+    if (!group) continue;

     for ( var j = 0; j < group.length; ++j )
     {
@@ -2380,6 +2383,7 @@ Xinha.prototype.generate = function ()
   var toolbar = editor.config.toolbar;
   for ( i = toolbar.length; --i >= 0; )
   {
+    if (!toolbar[i]) continue;
     for ( var j = toolbar[i].length; --j >= 0; )
     {
       switch (toolbar[i][j])

(end)

Reported by guest, migrated from http://trac.xinha.org/ticket/1610

sleemanj commented 11 years ago

Currently working in IE 11 without issue. I don't have IE 10 to test with.

I'm closing invalid, was probably an invalid item in the toolbar.