fix html editor column width and merge
[roojs1] / roojs-ui-debug.js
index f35b8e5..4a69afb 100644 (file)
@@ -24881,7 +24881,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
                     c.col = cn;
                 }
                 
-                if (typeof(this.colWidths[cn]) == 'undefined') {
+                if (typeof(this.colWidths[cn]) == 'undefined' && c.colspan < 2) {
                     this.colWidths[cn] =   ce.style.width;
                     if (this.colWidths[cn] != '') {
                         all_auto = false;
@@ -24925,7 +24925,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
     
     mergeRight: function()
     {
-        console.log("htmleditor.BlockTd mergeRight");
          
         // get the contents of the next cell along..
         var tr = this.node.closest('tr');
@@ -24995,12 +24994,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
                 if (r == cd.row && c == cd.col) {
                     this.node.removeAttribute('rowspan');
                     this.node.removeAttribute('colspan');
-                    continue;
                 }
                  
                 var ntd = this.node.cloneNode(); // which col/row should be 0..
-                ntd.removeAttribute('id'); //
-                //ntd.style.width  = '';
+                ntd.removeAttribute('id'); 
+                ntd.style.width  = this.colWidths[c];
                 ntd.innerHTML = '';
                 table[r][c] = { cell : ntd, col : c, row: r , colspan : 1 , rowspan : 1   };
             }
@@ -25008,8 +25006,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
         }
         this.redrawAllCells(table);
         
-         
-        
     },
     
     
@@ -25046,11 +25042,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
     },
     updateWidths : function(table)
     {
-        console.log("htmleditor.BlockTd updateWidths");
-        console.log("TABLE");
-        console.log(table);
-        console.log("COLWIDTH");
-        console.log(this.colWidths);
         for(var r = 0 ; r < table.length; r++) {
            
             for(var c = 0 ; c < table[r].length; c++) {
@@ -25059,15 +25050,18 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
                 }
                 
                 if (this.colWidths[0] != false && table[r][c].colspan < 2) {
-                    console.log("CELL");
-                    console.log(table[r][c].cell);
                     var el = Roo.htmleditor.Block.factory(table[r][c].cell);
                     el.width = Math.floor(this.colWidths[c])  +'%';
                     el.updateElement(el.node);
                 }
-                else {
-                    console.log("CELL COLSPAN");
-                    console.log(table[r][c]);
+                if (this.colWidths[0] != false && table[r][c].colspan > 1) {
+                    var el = Roo.htmleditor.Block.factory(table[r][c].cell);
+                    var width = 0;
+                    for(var i = 0; i < table[r][c].colspan; i ++) {
+                        width += Math.floor(this.colWidths[c + i]);
+                    }
+                    el.width = width  +'%';
+                    el.updateElement(el.node);
                 }
                 table[r][c].cell = false; // done
             }
@@ -25075,7 +25069,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, {
     },
     normalizeWidths : function(table)
     {
-    
         if (this.colWidths[0] === false) {
             var nw = 100.0 / this.colWidths.length;
             this.colWidths.forEach(function(w,i) {