From fd7ea30c650bd4723a200598ad36b751ca4b5327 Mon Sep 17 00:00:00 2001 From: leon Date: Tue, 28 Jun 2022 16:40:09 +0800 Subject: [PATCH] fix --- -core.js roojs-ui.js > roojs-all.js | 2354 ------------------------- 1 file changed, 2354 deletions(-) delete mode 100644 -core.js roojs-ui.js > roojs-all.js diff --git a/-core.js roojs-ui.js > roojs-all.js b/-core.js roojs-ui.js > roojs-all.js deleted file mode 100644 index 95122ceae3..0000000000 --- a/-core.js roojs-ui.js > roojs-all.js +++ /dev/null @@ -1,2354 +0,0 @@ -diff --git a/Roo/htmleditor/BlockTd.js b/Roo/htmleditor/BlockTd.js -index b6022caa76..74706b723c 100644 ---- a/Roo/htmleditor/BlockTd.js -+++ b/Roo/htmleditor/BlockTd.js -@@ -339,7 +339,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -481,6 +480,7 @@ 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'); -@@ -506,6 +506,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -598,6 +601,11 @@ 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++) { -@@ -606,10 +614,23 @@ 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]); -+ 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 - } - } -diff --git a/roojs-all.js b/roojs-all.js -index 39a3e49f52..4fa4af1418 100644 ---- a/roojs-all.js -+++ b/roojs-all.js -@@ -2042,16 +2042,17 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; - var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} - ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; -+if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);var A=this.toTableArray();this.normalizeWidths(A); -+this.updateWidths(A);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col]; -+if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return; -+}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; - },this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; - return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); -diff --git a/roojs-debug.js b/roojs-debug.js -index 779fa0189f..df0c12750f 100644 ---- a/roojs-debug.js -+++ b/roojs-debug.js -@@ -49276,7 +49276,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -49418,6 +49417,7 @@ 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'); -@@ -49443,6 +49443,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -49535,6 +49538,11 @@ 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++) { -@@ -49543,10 +49551,16 @@ 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]); -+ } - table[r][c].cell = false; // done - } - } -diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js -index 6623fbfdb0..f35b8e5a06 100644 ---- a/roojs-ui-debug.js -+++ b/roojs-ui-debug.js -@@ -24784,7 +24784,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -24926,6 +24925,7 @@ 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'); -@@ -24951,6 +24951,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -25043,6 +25046,11 @@ 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++) { -@@ -25051,10 +25059,16 @@ 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]); -+ } - table[r][c].cell = false; // done - } - } -diff --git a/roojs-ui.js b/roojs-ui.js -index 40ce72d195..313c6f61dc 100644 ---- a/roojs-ui.js -+++ b/roojs-ui.js -@@ -1096,16 +1096,17 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; - var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} - ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; -+if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);var A=this.toTableArray();this.normalizeWidths(A); -+this.updateWidths(A);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col]; -+if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return; -+}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; - },this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; - return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); -diff --git a/Roo/htmleditor/BlockTd.js b/Roo/htmleditor/BlockTd.js -index b6022caa76..71caa01101 100644 ---- a/Roo/htmleditor/BlockTd.js -+++ b/Roo/htmleditor/BlockTd.js -@@ -339,7 +339,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -481,6 +480,7 @@ 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'); -@@ -506,6 +506,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -559,8 +562,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - } - this.redrawAllCells(table); --  --  -+ -+ var table = this.toTableArray(); -+ this.updateWidths(table); -  - }, -  -@@ -598,6 +602,11 @@ 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++) { -@@ -606,10 +615,23 @@ 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]); -+ 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 - } - } -diff --git a/roojs-all.js b/roojs-all.js -index 39a3e49f52..90a18263b2 100644 ---- a/roojs-all.js -+++ b/roojs-all.js -@@ -2042,15 +2042,17 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; - var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} - ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; -+if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);var A=this.toTableArray();this.normalizeWidths(A); -+this.updateWidths(A);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col]; -+if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return; -+}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; - },this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; -diff --git a/roojs-debug.js b/roojs-debug.js -index 779fa0189f..ace5837bba 100644 ---- a/roojs-debug.js -+++ b/roojs-debug.js -@@ -49276,7 +49276,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -49418,6 +49417,7 @@ 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'); -@@ -49443,6 +49443,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -49496,8 +49499,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - } - this.redrawAllCells(table); --  --  -+ -+ var table = this.toTableArray(); -+ this.updateWidths(table); -  - }, -  -@@ -49535,6 +49539,11 @@ 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++) { -@@ -49543,10 +49552,23 @@ 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]); -+ 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 - } - } -diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js -index 6623fbfdb0..e1139418df 100644 ---- a/roojs-ui-debug.js -+++ b/roojs-ui-debug.js -@@ -24784,7 +24784,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -24926,6 +24925,7 @@ 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'); -@@ -24951,6 +24951,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -25004,8 +25007,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - } - this.redrawAllCells(table); --  --  -+ -+ var table = this.toTableArray(); -+ this.updateWidths(table); -  - }, -  -@@ -25043,6 +25047,11 @@ 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++) { -@@ -25051,10 +25060,23 @@ 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]); -+ 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 - } - } -diff --git a/roojs-ui.js b/roojs-ui.js -index 40ce72d195..cf42c68aaa 100644 ---- a/roojs-ui.js -+++ b/roojs-ui.js -@@ -1096,15 +1096,17 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; - var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} - ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; -+if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);var A=this.toTableArray();this.normalizeWidths(A); -+this.updateWidths(A);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col]; -+if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return; -+}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; - },this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; -diff --git a/Roo/htmleditor/BlockTd.js b/Roo/htmleditor/BlockTd.js -index b6022caa76..d86513f7ed 100644 ---- a/Roo/htmleditor/BlockTd.js -+++ b/Roo/htmleditor/BlockTd.js -@@ -28,6 +28,8 @@ -  - Roo.htmleditor.BlockTd = function(cfg) - { -+ console.log("htmleditor.BlockTd constructor"); -+ console.log(cfg.node); - if (cfg.node) { - this.readElement(cfg.node); - this.updateElement(cfg.node); -@@ -57,6 +59,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - contextMenu : function(toolbar) - { -+ console.log("htmleditor.BlodTd contextMenu"); -+ console.log(this.node); -  - var cell = function() { - return Roo.htmleditor.Block.factory(toolbar.tb.selectedNode); -@@ -339,7 +343,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -407,18 +410,18 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ - ret[ri] = []; - }); - var rn = 0; -- this.colWidths = []; -- var all_auto = true; - Array.from(tab.rows).forEach(function(r, ri){ -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ - var c = { - cell : ce, - row : rn, -@@ -437,14 +440,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - c.col = cn; - } -  -- if (typeof(this.colWidths[cn]) == 'undefined') { -- this.colWidths[cn] = ce.style.width; -- if (this.colWidths[cn] != '') { -- all_auto = false; -- } -- } --  --  - if (c.colspan < 2 && c.rowspan < 2 ) { - ret[rn][cn] = c; - cn++; -@@ -465,15 +460,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - rn++; - }, this); -  -- // initalize widths.? -- // either all widths or no widths.. -- if (all_auto) { -- this.colWidths[0] = false; // no widths flag. -- } --  --  - return ret; --  - }, -  -  -@@ -481,6 +468,7 @@ 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'); -@@ -489,6 +477,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -506,6 +495,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ console.log(table); -+ this.normalizeWidths(table); -+ console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -560,8 +554,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -610,13 +602,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -663,7 +665,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-all.js b/roojs-all.js -index 39a3e49f52..e11d4edeff 100644 ---- a/roojs-all.js -+++ b/roojs-all.js -@@ -2027,37 +2027,40 @@ return;}for(var i=0;i1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} -+this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){console.log("htmleditor.BlockTd toTableArray "); -+var A=[];var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} - ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return; -+}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan); -+var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return; -+}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan; -+this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/roojs-debug.js b/roojs-debug.js -index 779fa0189f..edb9ed778e 100644 ---- a/roojs-debug.js -+++ b/roojs-debug.js -@@ -48965,6 +48965,8 @@ Roo.extend(Roo.htmleditor.BlockTable, Roo.htmleditor.Block, { -  - Roo.htmleditor.BlockTd = function(cfg) - { -+ console.log("htmleditor.BlockTd constructor"); -+ console.log(cfg.node); - if (cfg.node) { - this.readElement(cfg.node); - this.updateElement(cfg.node); -@@ -48994,6 +48996,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - contextMenu : function(toolbar) - { -+ console.log("htmleditor.BlodTd contextMenu"); -+ console.log(this.node); -  - var cell = function() { - return Roo.htmleditor.Block.factory(toolbar.tb.selectedNode); -@@ -49276,7 +49280,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -49344,6 +49347,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -49356,6 +49360,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ - var c = { - cell : ce, - row : rn, -@@ -49418,6 +49423,7 @@ 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'); -@@ -49426,6 +49432,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -49443,6 +49450,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ console.log(table); -+ this.normalizeWidths(table); -+ console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -49497,8 +49509,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -49547,13 +49557,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -49600,7 +49620,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js -index 6623fbfdb0..d82815532c 100644 ---- a/roojs-ui-debug.js -+++ b/roojs-ui-debug.js -@@ -24473,6 +24473,8 @@ Roo.extend(Roo.htmleditor.BlockTable, Roo.htmleditor.Block, { -  - Roo.htmleditor.BlockTd = function(cfg) - { -+ console.log("htmleditor.BlockTd constructor"); -+ console.log(cfg.node); - if (cfg.node) { - this.readElement(cfg.node); - this.updateElement(cfg.node); -@@ -24502,6 +24504,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - contextMenu : function(toolbar) - { -+ console.log("htmleditor.BlodTd contextMenu"); -+ console.log(this.node); -  - var cell = function() { - return Roo.htmleditor.Block.factory(toolbar.tb.selectedNode); -@@ -24784,7 +24788,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -24852,6 +24855,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -24864,6 +24868,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ - var c = { - cell : ce, - row : rn, -@@ -24926,6 +24931,7 @@ 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'); -@@ -24934,6 +24940,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -24951,6 +24958,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ console.log(table); -+ this.normalizeWidths(table); -+ console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -25005,8 +25017,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -25055,13 +25065,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -25108,7 +25128,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui.js b/roojs-ui.js -index 40ce72d195..b1aeca363c 100644 ---- a/roojs-ui.js -+++ b/roojs-ui.js -@@ -1081,37 +1081,40 @@ return;}for(var i=0;i1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} -+this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){console.log("htmleditor.BlockTd toTableArray "); -+var A=[];var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} - ;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return; -+}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan); -+var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return; -+}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan; -+this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/Roo/htmleditor/BlockTd.js b/Roo/htmleditor/BlockTd.js -index b6022caa76..ccfb7b1a70 100644 ---- a/Roo/htmleditor/BlockTd.js -+++ b/Roo/htmleditor/BlockTd.js -@@ -339,7 +339,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -407,6 +406,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -419,6 +419,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -438,6 +440,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } -  - if (typeof(this.colWidths[cn]) == 'undefined') { -+ console.log("CELL WIDTH"); -+ console.log(ce.style.width); - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -481,6 +485,7 @@ 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'); -@@ -489,6 +494,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -506,6 +512,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ // var table = this.toTableArray(); -+ // console.log(table); -+ // this.normalizeWidths(table); -+ // console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -560,8 +571,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -610,13 +619,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -663,7 +682,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-all.js b/roojs-all.js -index 39a3e49f52..5639f0ffbc 100644 ---- a/roojs-all.js -+++ b/roojs-all.js -@@ -2039,25 +2039,27 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent(); - }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign} - ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} --;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray();console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return; -+}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return; -+}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML; -+rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1; -+for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+el.updateElement(el.node);}A[r][c].cell=false;}}},normalizeWidths:function(A){console.log("htmleditor.BlockTd normalizeWidths");console.log(this.colWidths);if(this.colWidths[0]===false){var nw=100.0/this.colWidths.length;this.colWidths.forEach(function(w,i){this.colWidths[i]=nw; -+},this);return;}var t=0,B=[];this.colWidths.forEach(function(w,i){this.colWidths[i]=this.colWidths[i]==''?0:(this.colWidths[i]+'').replace(/[^0-9]+/g,'')*1;var D=this.colWidths[i];if(D>0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/roojs-debug.js b/roojs-debug.js -index 779fa0189f..31445da998 100644 ---- a/roojs-debug.js -+++ b/roojs-debug.js -@@ -49276,7 +49276,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -49344,6 +49343,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -49356,6 +49356,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -49375,6 +49377,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } -  - if (typeof(this.colWidths[cn]) == 'undefined') { -+ console.log("CELL WIDTH"); -+ console.log(ce.style.width); - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -49418,6 +49422,7 @@ 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'); -@@ -49426,6 +49431,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -49443,6 +49449,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ // var table = this.toTableArray(); -+ // console.log(table); -+ // this.normalizeWidths(table); -+ // console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -49497,8 +49508,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -49547,13 +49556,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -49600,7 +49619,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js -index 6623fbfdb0..21e46e6eb0 100644 ---- a/roojs-ui-debug.js -+++ b/roojs-ui-debug.js -@@ -24784,7 +24784,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -24852,6 +24851,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -24864,6 +24864,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -24883,6 +24885,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } -  - if (typeof(this.colWidths[cn]) == 'undefined') { -+ console.log("CELL WIDTH"); -+ console.log(ce.style.width); - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -24926,6 +24930,7 @@ 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'); -@@ -24934,6 +24939,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -24951,6 +24957,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ // var table = this.toTableArray(); -+ // console.log(table); -+ // this.normalizeWidths(table); -+ // console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -25005,8 +25016,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -25055,13 +25064,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -25108,7 +25127,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui.js b/roojs-ui.js -index 40ce72d195..800ac1bd02 100644 ---- a/roojs-ui.js -+++ b/roojs-ui.js -@@ -1093,25 +1093,27 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent(); - }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign} - ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} --;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray();console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return; -+}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return; -+}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML; -+rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1; -+for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+el.updateElement(el.node);}A[r][c].cell=false;}}},normalizeWidths:function(A){console.log("htmleditor.BlockTd normalizeWidths");console.log(this.colWidths);if(this.colWidths[0]===false){var nw=100.0/this.colWidths.length;this.colWidths.forEach(function(w,i){this.colWidths[i]=nw; -+},this);return;}var t=0,B=[];this.colWidths.forEach(function(w,i){this.colWidths[i]=this.colWidths[i]==''?0:(this.colWidths[i]+'').replace(/[^0-9]+/g,'')*1;var D=this.colWidths[i];if(D>0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/Roo/htmleditor/BlockTd.js b/Roo/htmleditor/BlockTd.js -index b6022caa76..8be02436d9 100644 ---- a/Roo/htmleditor/BlockTd.js -+++ b/Roo/htmleditor/BlockTd.js -@@ -339,7 +339,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -407,6 +406,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -419,6 +419,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -437,7 +439,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 && c.rowspan < 2) { - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -481,6 +483,7 @@ 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'); -@@ -489,6 +492,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -506,6 +510,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ // var table = this.toTableArray(); -+ // console.log(table); -+ // this.normalizeWidths(table); -+ // console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -560,8 +569,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -610,13 +617,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -663,7 +680,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-all.js b/roojs-all.js -index 39a3e49f52..27fa6d7a7b 100644 ---- a/roojs-all.js -+++ b/roojs-all.js -@@ -2039,25 +2039,27 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent(); - }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign} - ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} --;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){console.log("htmleditor.BlockTd toTableArray "); -+var A=[];var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){console.log("CELL"); -+console.log(ce);var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan};if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'&&c.colspan<2&&c.rowspan<2){this.colWidths[cn]=ce.style.width; -+if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c;cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray(); -+console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML; -+tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return; -+}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan; -+this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/roojs-debug.js b/roojs-debug.js -index 779fa0189f..f3f1ee678e 100644 ---- a/roojs-debug.js -+++ b/roojs-debug.js -@@ -49276,7 +49276,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -49344,6 +49343,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -49356,6 +49356,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -49374,7 +49376,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 && c.rowspan < 2) { - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -49418,6 +49420,7 @@ 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'); -@@ -49426,6 +49429,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -49443,6 +49447,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ // var table = this.toTableArray(); -+ // console.log(table); -+ // this.normalizeWidths(table); -+ // console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -49497,8 +49506,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -49547,13 +49554,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -49600,7 +49617,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js -index 6623fbfdb0..caaefa5960 100644 ---- a/roojs-ui-debug.js -+++ b/roojs-ui-debug.js -@@ -24784,7 +24784,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -24852,6 +24851,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -24864,6 +24864,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -24882,7 +24884,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 && c.rowspan < 2) { - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -24926,6 +24928,7 @@ 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'); -@@ -24934,6 +24937,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -24951,6 +24955,11 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ // var table = this.toTableArray(); -+ // console.log(table); -+ // this.normalizeWidths(table); -+ // console.log(this.colWidths); -+ // this.updateWidths(table); - }, -  -  -@@ -25005,8 +25014,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -25055,13 +25062,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ // else { -+ // 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -25108,7 +25125,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui.js b/roojs-ui.js -index 40ce72d195..adcd2fab96 100644 ---- a/roojs-ui.js -+++ b/roojs-ui.js -@@ -1093,25 +1093,27 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent(); - }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign} - ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} --;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){console.log("htmleditor.BlockTd toTableArray "); -+var A=[];var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){console.log("CELL"); -+console.log(ce);var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan};if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'&&c.colspan<2&&c.rowspan<2){this.colWidths[cn]=ce.style.width; -+if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c;cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray(); -+console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML; -+tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return; -+}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan; -+this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/Roo/htmleditor/BlockTd.js b/Roo/htmleditor/BlockTd.js -index b6022caa76..90a7df25ad 100644 ---- a/Roo/htmleditor/BlockTd.js -+++ b/Roo/htmleditor/BlockTd.js -@@ -339,7 +339,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -407,6 +406,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -419,6 +419,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -437,7 +439,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 && c.rowspan < 2) { - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -481,6 +483,7 @@ 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'); -@@ -489,6 +492,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -506,6 +510,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -560,8 +567,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -610,13 +615,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -663,7 +678,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-all.js b/roojs-all.js -index 39a3e49f52..44dd3d9f7d 100644 ---- a/roojs-all.js -+++ b/roojs-all.js -@@ -2039,25 +2039,28 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent(); - }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign} - ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} --;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray(); -+console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML; -+tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);var A=this.toTableArray();this.normalizeWidths(A);this.updateWidths(A);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return; -+}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML; -+rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1; -+for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+el.updateElement(el.node);}if(this.colWidths[0]!=false&&A[r][c].colspan>1){var el=Roo.htmleditor.Block.factory(A[r][c].cell);var B=0;for(var i=0;i0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -diff --git a/roojs-debug.js b/roojs-debug.js -index 779fa0189f..ed0e0542c0 100644 ---- a/roojs-debug.js -+++ b/roojs-debug.js -@@ -49276,7 +49276,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -49344,6 +49343,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -49356,6 +49356,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -49374,7 +49376,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 && c.rowspan < 2) { - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -49418,6 +49420,7 @@ 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'); -@@ -49426,6 +49429,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -49443,6 +49447,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -49497,8 +49504,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -49547,13 +49552,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -49600,7 +49615,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js -index 6623fbfdb0..3301c8a150 100644 ---- a/roojs-ui-debug.js -+++ b/roojs-ui-debug.js -@@ -24784,7 +24784,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - */ - toObject : function() - { --  - var ret = { - tag : 'td', - contenteditable : 'true', // this stops cell selection from picking the table. -@@ -24852,6 +24851,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - toTableArray : function() - { -+ console.log("htmleditor.BlockTd toTableArray "); - var ret = []; - var tab = this.node.closest('tr').closest('table'); - Array.from(tab.rows).forEach(function(r, ri){ -@@ -24864,6 +24864,8 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { -  - var cn = 0; - Array.from(r.cells).forEach(function(ce, ci){ -+ console.log("CELL"); -+ console.log(ce); - var c = { - cell : ce, - row : rn, -@@ -24882,7 +24884,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 && c.rowspan < 2) { - this.colWidths[cn] = ce.style.width; - if (this.colWidths[cn] != '') { - all_auto = false; -@@ -24926,6 +24928,7 @@ 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'); -@@ -24934,6 +24937,7 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - return; // no cells on right to merge with. - } - var table = this.toTableArray(); -+ console.log(table); -  - if (typeof(table[this.cellData.row][this.cellData.col+this.cellData.colspan]) == 'undefined') { - return; // nothing right? -@@ -24951,6 +24955,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - this.colspan += rc.colspan; - this.node.setAttribute('colspan', this.colspan); -  -+ var table = this.toTableArray(); -+ this.normalizeWidths(table); -+ this.updateWidths(table); - }, -  -  -@@ -25005,8 +25012,6 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - } - this.redrawAllCells(table); -  --  --  - }, -  -  -@@ -25055,13 +25060,23 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - el.width = Math.floor(this.colWidths[c]) +'%'; - el.updateElement(el.node); - } -+ 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 - } - } - }, - normalizeWidths : function(table) - { --  -+ console.log("htmleditor.BlockTd normalizeWidths"); -+ console.log(this.colWidths); - if (this.colWidths[0] === false) { - var nw = 100.0 / this.colWidths.length; - this.colWidths.forEach(function(w,i) { -@@ -25108,7 +25123,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { - shrinkColumn : function() - { - var table = this.toTableArray(); -+ console.log(table); - this.normalizeWidths(table); -+ console.log(this.colWidths); - var col = this.cellData.col; - var nw = this.colWidths[col] * 0.8; - if (nw < 5) { -diff --git a/roojs-ui.js b/roojs-ui.js -index 40ce72d195..6212babf17 100644 ---- a/roojs-ui.js -+++ b/roojs-ui.js -@@ -1093,25 +1093,28 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven - ,{xtype:'Separator',xns:rooui.menu},{xtype:'Item',html:'Table',listeners:{click:function(G,e){var t=C();var nn=t.node.nextSibling||t.node.previousSibling;t.node.parentNode.removeChild(t.node);if(nn){A.editorcore.selectNode(nn,true);}A.editorcore.onEditorEvent(); - }},xns:rooui.menu}]}}];},toObject:function(){var A={tag:'td',contenteditable:'true','data-block':'Td',valign:this.valign,style:{'text-align':this.textAlign,border:'solid 1px rgb(0, 0, 0)','border-collapse':'collapse',padding:'6px','vertical-align':this.valign} - ,html:this.html};if(this.width!=''){A.width=this.width;A.style.width=this.width;}if(this.colspan>1){A.colspan=this.colspan;}if(this.rowspan>1){A.rowspan=this.rowspan;}return A;},readElement:function(A){A=A?A:this.node;this.width=A.style.width;this.colspan=Math.max(1,1*A.getAttribute('colspan')); --this.rowspan=Math.max(1,1*A.getAttribute('rowspan'));this.html=A.innerHTML;},emptyCell:function(){return {colspan:1,rowspan:1,textAlign:'left',html:" "};},removeNode:function(){return this.node.closest('table');},cellData:false,colWidths:false,toTableArray:function(){var A=[]; --var B=this.node.closest('tr').closest('table');Array.from(B.rows).forEach(function(r,ri){A[ri]=[];});var rn=0;this.colWidths=[];var C=true;Array.from(B.rows).forEach(function(r,ri){var cn=0;Array.from(r.cells).forEach(function(ce,ci){var c={cell:ce,row:rn,col:cn,colspan:ce.colSpan,rowspan:ce.rowSpan} --;if(ce.isEqualNode(this.node)){this.cellData=c;}if(typeof(A[rn][cn])!='undefined'){while(typeof(A[rn][cn])!='undefined'){cn++;}c.col=cn;}if(typeof(this.colWidths[cn])=='undefined'){this.colWidths[cn]=ce.style.width;if(this.colWidths[cn]!=''){C=false;}}if(c.colspan<2&&c.rowspan<2){A[rn][cn]=c; --cn++;return;}for(var j=0;j=tr.childNodes.length-1){return;}var A=this.toTableArray();if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan]; --if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML;tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);},mergeBelow:function(){var A=this.toTableArray(); --if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return;}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return; --}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML;rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray(); --var cd=this.cellData;this.rowspan=1;this.colspan=1;for(var r=cd.row;r=tr.childNodes.length-1){return;}var A=this.toTableArray(); -+console.log(A);if(typeof(A[this.cellData.row][this.cellData.col+this.cellData.colspan])=='undefined'){return;}var rc=A[this.cellData.row][this.cellData.col+this.cellData.colspan];if(rc.rowspan!=this.cellData.rowspan||rc.row!=this.cellData.row){return;}this.node.innerHTML+=' '+rc.cell.innerHTML; -+tr.removeChild(rc.cell);this.colspan+=rc.colspan;this.node.setAttribute('colspan',this.colspan);var A=this.toTableArray();this.normalizeWidths(A);this.updateWidths(A);},mergeBelow:function(){var A=this.toTableArray();if(typeof(A[this.cellData.row+this.cellData.rowspan])=='undefined'){return; -+}if(typeof(A[this.cellData.row+this.cellData.rowspan][this.cellData.col])=='undefined'){return;}var rc=A[this.cellData.row+this.cellData.rowspan][this.cellData.col];if(rc.colspan!=this.cellData.colspan||rc.col!=this.cellData.col){return;}this.node.innerHTML=this.node.innerHTML+rc.cell.innerHTML; -+rc.cell.parentNode.removeChild(rc.cell);this.rowspan+=rc.rowspan;this.node.setAttribute('rowspan',this.rowspan);},split:function(){if(this.node.rowSpan<2&&this.node.colSpan<2){return;}var A=this.toTableArray();var cd=this.cellData;this.rowspan=1;this.colspan=1; -+for(var r=cd.row;r0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc);var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew; --},this);}},shrinkColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw; --return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray();this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1); --this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A);},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan);}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--;c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) -+el.updateElement(el.node);}if(this.colWidths[0]!=false&&A[r][c].colspan>1){var el=Roo.htmleditor.Block.factory(A[r][c].cell);var B=0;for(var i=0;i0){t+=D;return;}B.push(i);},this);var nc=this.colWidths.length;if(B.length){var C=(nc-B.length)/(1.0*nc); -+var t=C*t;var ew=(100-t)/(1.0*B.length);this.colWidths.forEach(function(w,i){if(w>0){this.colWidths[i]=w*C;return;}this.colWidths[i]=ew;},this);}},shrinkColumn:function(){var A=this.toTableArray();console.log(A);this.normalizeWidths(A);console.log(this.colWidths); -+var B=this.cellData.col;var nw=this.colWidths[B]*0.8;if(nw<5){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]+=C},this);this.updateWidths(A);},growColumn:function(){var A=this.toTableArray(); -+this.normalizeWidths(A);var B=this.cellData.col;var nw=this.colWidths[B]*1.2;if(nw>90){return;}var C=(this.colWidths[B]*0.2)/(this.colWidths.length-1);this.colWidths.forEach(function(w,i){if(i==B){this.colWidths[i]=nw;return;}this.colWidths[i]-=C},this);this.updateWidths(A); -+},deleteRow:function(){var A=this.toTableArray();for(var i=0;i1){c.rowspan--;c.cell.setAttribute('rowspan',c.rowspan); -+}}A.splice(this.cellData.row,1);this.redrawAllCells(A);},deleteColumn:function(){var A=this.toTableArray();for(var i=0;i1){c.colspan--; -+c.cell.setAttribute('colspan',c.colspan);}A[i].splice(this.cellData.col,1);}this.redrawAllCells(A);}}) - // Roo/HtmlEditorCore.js - Roo.HtmlEditorCore=function(A){Roo.HtmlEditorCore.superclass.constructor.call(this,A);this.addEvents({initialize:true,activate:true,beforesync:true,beforepush:true,sync:true,push:true,editorevent:true});this.applyBlacklists();};Roo.extend(Roo.HtmlEditorCore,Roo.Component,{owner:false,resizable:false,height:300,width:500,autoClean:true,enableBlocks:true,stylesheets:false,language:'en',allowComments:false,frameId:false,validationEvent:false,deferHeight:true,initialized:false,activated:false,sourceEditMode:false,onFocus:Roo.emptyFn,iframePad:3,hideMode:'offsets',clearUp:true,black:false,white:false,bodyCls:'',undoManager:false,getDocMarkup:function(){var st=''; - if(this.stylesheets===false){Roo.get(document.head).select('style').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom);});Roo.get(document.head).select('link').each(function(B){st+=B.dom.outerHTML||new XMLSerializer().serializeToString(B.dom); -- 2.39.2