From 203457b0ec48eb5de5ba128abcaea3886df0cf86 Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 21 Jun 2022 11:43:58 +0800 Subject: [PATCH] roojs-ui.js roojs-ui-debug.js roojs-bootstrap.js roojs-bootstrap-debug.js roojs-all.js roojs-debug.js Roo/htmleditor/FilterWord.js --- Roo/htmleditor/FilterWord.js | 3 ++- roojs-all.js | 10 +++++----- roojs-bootstrap-debug.js | 7 +++++++ roojs-bootstrap.js | 10 +++++----- roojs-debug.js | 8 +++++++- roojs-ui-debug.js | 8 +++++++- roojs-ui.js | 10 +++++----- 7 files changed, 38 insertions(+), 18 deletions(-) diff --git a/Roo/htmleditor/FilterWord.js b/Roo/htmleditor/FilterWord.js index ada2f5ca0c..47e1343378 100644 --- a/Roo/htmleditor/FilterWord.js +++ b/Roo/htmleditor/FilterWord.js @@ -151,12 +151,13 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, listpara.item(i).className = "MsoListParagraph"; } // this is a bit hacky - we had one word document where h2 had a miso-list attribute. - var htwo = doc.getElementByTagName('h2'); + var htwo = doc.getElementsByTagName('h2'); for( var i = 0; i < htwo.length; i ++) { if (htwo.item(i).getAttribute('style').match(/mso-list:/)) { htwo.item(i).className = "MsoListParagraph"; } } + listpara = doc.getElementsByClassName('ql-indent-1'); while(listpara.length) { this.replaceDocBullet(listpara.item(0)); diff --git a/roojs-all.js b/roojs-all.js index 261404d4d1..45f8aef2b0 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1931,11 +1931,11 @@ A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replac }C.push(F);});A.className=C.length?C.join(' '):'';if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return; }var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}return true;},styleToObject:function(A){var B=(A.getAttribute("style")||'').split(";"); var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0].trim()]=kv[1];});return C;},replaceDocBullets:function(A){Roo.log(A.innerHTML);var B=A.getElementsByClassName('MsoListParagraphCxSpFirst');for(var i=0;iD){var K=B.createElement('ul');if(!F){F=B.createElement('li');E[D].appendChild(F);}F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML; -A.removeChild(n);},this);}}); +}var C=A.getElementByTagName('h2');for(var i=0;iD){var K=B.createElement('ul'); +if(!F){F=B.createElement('li');E[D].appendChild(F);}F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML;A.removeChild(n);},this);}}); // Roo/htmleditor/FilterStyleToTag.js Roo.htmleditor.FilterStyleToTag=function(A){this.tags={B:['fontWeight','bold'],I:['fontStyle','italic'],SUP:['verticalAlign','super'],SUB:['verticalAlign','sub']};Roo.apply(this,A);this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterStyleToTag,Roo.htmleditor.Filter,{tag:true,tags:false,replaceTag:function(A){if(A.getAttribute("style")===null){return true; }var B=[];for(var k in this.tags){if(A.style[this.tags[k][0]]==this.tags[k][1]){B.push(k);A.style.removeProperty(this.tags[k][0]);}}if(!B.length){return true;}var cn=Array.from(A.childNodes);var nn=A;Roo.each(B,function(t){var nc=A.ownerDocument.createElement(t); diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index c5eec9378d..0213c0b7a9 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -26603,6 +26603,13 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, for( var i = 0; i < listpara.length; i ++) { listpara.item(i).className = "MsoListParagraph"; } + // this is a bit hacky - we had one word document where h2 had a miso-list attribute. + var htwo = doc.getElementsByTagName('h2'); + for( var i = 0; i < htwo.length; i ++) { + if (htwo.item(i).getAttribute('style').match(/mso-list:/)) { + htwo.item(i).className = "MsoListParagraph"; + } + } listpara = doc.getElementsByClassName('ql-indent-1'); while(listpara.length) { diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 7623a8851d..62066c26e6 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1150,11 +1150,11 @@ A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replac }C.push(F);});A.className=C.length?C.join(' '):'';if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return; }var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}return true;},styleToObject:function(A){var B=(A.getAttribute("style")||'').split(";"); var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0].trim()]=kv[1];});return C;},replaceDocBullets:function(A){Roo.log(A.innerHTML);var B=A.getElementsByClassName('MsoListParagraphCxSpFirst');for(var i=0;iD){var K=B.createElement('ul');if(!F){F=B.createElement('li');E[D].appendChild(F);}F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML; -A.removeChild(n);},this);}}); +}var C=A.getElementsByTagName('h2');for(var i=0;iD){var K=B.createElement('ul'); +if(!F){F=B.createElement('li');E[D].appendChild(F);}F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML;A.removeChild(n);},this);}}); // Roo/htmleditor/FilterStyleToTag.js Roo.htmleditor.FilterStyleToTag=function(A){this.tags={B:['fontWeight','bold'],I:['fontStyle','italic'],SUP:['verticalAlign','super'],SUB:['verticalAlign','sub']};Roo.apply(this,A);this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterStyleToTag,Roo.htmleditor.Filter,{tag:true,tags:false,replaceTag:function(A){if(A.getAttribute("style")===null){return true; }var B=[];for(var k in this.tags){if(A.style[this.tags[k][0]]==this.tags[k][1]){B.push(k);A.style.removeProperty(this.tags[k][0]);}}if(!B.length){return true;}var cn=Array.from(A.childNodes);var nn=A;Roo.each(B,function(t){var nc=A.ownerDocument.createElement(t); diff --git a/roojs-debug.js b/roojs-debug.js index ec2fb28543..e5c3b7fed0 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -46217,7 +46217,13 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, for( var i = 0; i < listpara.length; i ++) { listpara.item(i).className = "MsoListParagraph"; } - + // this is a bit hacky - we had one word document where h2 had a miso-list attribute. + var htwo = doc.getElementByTagName('h2'); + for( var i = 0; i < htwo.length; i ++) { + if (htwo.item(i).getAttribute('style').match(/mso-list:/)) { + htwo.item(i).className = "MsoListParagraph"; + } + } listpara = doc.getElementsByClassName('ql-indent-1'); while(listpara.length) { this.replaceDocBullet(listpara.item(0)); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index d2f8c51d36..012b11b971 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -21725,7 +21725,13 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, for( var i = 0; i < listpara.length; i ++) { listpara.item(i).className = "MsoListParagraph"; } - + // this is a bit hacky - we had one word document where h2 had a miso-list attribute. + var htwo = doc.getElementByTagName('h2'); + for( var i = 0; i < htwo.length; i ++) { + if (htwo.item(i).getAttribute('style').match(/mso-list:/)) { + htwo.item(i).className = "MsoListParagraph"; + } + } listpara = doc.getElementsByClassName('ql-indent-1'); while(listpara.length) { this.replaceDocBullet(listpara.item(0)); diff --git a/roojs-ui.js b/roojs-ui.js index 7ff87e2da0..7609c34cfe 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -985,11 +985,11 @@ A.removeChild(cn);A.parentNode.insertBefore(cn,A);if(cn.nodeType==1){this.replac }C.push(F);});A.className=C.length?C.join(' '):'';if(!C.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var D=A.getAttribute("style").split(";");var E=[];Roo.each(D,function(s){if(!s.match(/:/)){return; }var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;}E.push(s);});A.setAttribute("style",E.length?E.join(';'):'');if(!E.length){A.removeAttribute('style');}}return true;},styleToObject:function(A){var B=(A.getAttribute("style")||'').split(";"); var C={};Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");C[kv[0].trim()]=kv[1];});return C;},replaceDocBullets:function(A){Roo.log(A.innerHTML);var B=A.getElementsByClassName('MsoListParagraphCxSpFirst');for(var i=0;iD){var K=B.createElement('ul');if(!F){F=B.createElement('li');E[D].appendChild(F);}F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML; -A.removeChild(n);},this);}}); +}var C=A.getElementByTagName('h2');for(var i=0;iD){var K=B.createElement('ul'); +if(!F){F=B.createElement('li');E[D].appendChild(F);}F.appendChild(K);E[J]=K;}D=J;var L=E[J].appendChild(B.createElement('li'));F=L;L.innerHTML=n.innerHTML;A.removeChild(n);},this);}}); // Roo/htmleditor/FilterStyleToTag.js Roo.htmleditor.FilterStyleToTag=function(A){this.tags={B:['fontWeight','bold'],I:['fontStyle','italic'],SUP:['verticalAlign','super'],SUB:['verticalAlign','sub']};Roo.apply(this,A);this.walk(A.node);};Roo.extend(Roo.htmleditor.FilterStyleToTag,Roo.htmleditor.Filter,{tag:true,tags:false,replaceTag:function(A){if(A.getAttribute("style")===null){return true; }var B=[];for(var k in this.tags){if(A.style[this.tags[k][0]]==this.tags[k][1]){B.push(k);A.style.removeProperty(this.tags[k][0]);}}if(!B.length){return true;}var cn=Array.from(A.childNodes);var nn=A;Roo.each(B,function(t){var nc=A.ownerDocument.createElement(t); -- 2.39.2