From 3a4dcb78b070570479456100b482307af0bf77a3 Mon Sep 17 00:00:00 2001 From: leon Date: Mon, 27 Jun 2022 13:00:14 +0800 Subject: [PATCH] roojs-core.js roojs-core-debug.js roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- roojs-all.js | 13 +++++++------ roojs-debug.js | 3 +++ roojs-ui-debug.js | 3 +++ roojs-ui.js | 13 +++++++------ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/roojs-all.js b/roojs-all.js index 144359642b..5a02bc7c6c 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -2041,7 +2041,7 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven }},xns:rooui.menu}]}}];},toObject:function(){console.log("htmleditor.BlockTd toObject");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){console.log("htmleditor.BlockTd readElement");console.log(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; +},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; @@ -2054,11 +2054,12 @@ continue;}var B=this.node.cloneNode();B.removeAttribute('id');B.innerHTML='';A[r }},updateWidths:function(A){for(var r=0;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);}},shrinkColumn:function(){console.log("htmleditor.BlockTd shrinkColumn");var A=this.toTableArray();console.log(A);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);} +}) // 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 aee7a20f92..c3670aa971 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -49348,6 +49348,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){ @@ -49603,7 +49604,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { shrinkColumn : function() { + console.log("htmleditor.BlockTd shrinkColumn"); var table = this.toTableArray(); + console.log(table); this.normalizeWidths(table); var col = this.cellData.col; var nw = this.colWidths[col] * 0.8; diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 8a1b73e898..7e0ad8e2d2 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -24856,6 +24856,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){ @@ -25111,7 +25112,9 @@ Roo.extend(Roo.htmleditor.BlockTd, Roo.htmleditor.Block, { shrinkColumn : function() { + console.log("htmleditor.BlockTd shrinkColumn"); var table = this.toTableArray(); + console.log(table); this.normalizeWidths(table); var col = this.cellData.col; var nw = this.colWidths[col] * 0.8; diff --git a/roojs-ui.js b/roojs-ui.js index 4bf51fbaa0..dd6313f9dd 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1095,7 +1095,7 @@ B().deleteColumn();E();A.editorcore.selectNode(t.node);A.editorcore.onEditorEven }},xns:rooui.menu}]}}];},toObject:function(){console.log("htmleditor.BlockTd toObject");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){console.log("htmleditor.BlockTd readElement");console.log(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; +},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; @@ -1108,11 +1108,12 @@ continue;}var B=this.node.cloneNode();B.removeAttribute('id');B.innerHTML='';A[r }},updateWidths:function(A){for(var r=0;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);}},shrinkColumn:function(){console.log("htmleditor.BlockTd shrinkColumn");var A=this.toTableArray();console.log(A);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);} +}) // 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