From 0fa7894b7489284160ff14afdca7b6911983357f Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 28 Jul 2021 13:29:11 +0800 Subject: [PATCH] better support for mailchimp emails --- docs/src/Roo_HtmlEditorCore.js.html | 7 ++++--- roojs-bootstrap-debug.js | 7 ++++--- roojs-bootstrap.js | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/src/Roo_HtmlEditorCore.js.html b/docs/src/Roo_HtmlEditorCore.js.html index db967c20e8..bb979c3b62 100644 --- a/docs/src/Roo_HtmlEditorCore.js.html +++ b/docs/src/Roo_HtmlEditorCore.js.html @@ -117,7 +117,6 @@ /** * @cfg {boolean} allowComments - default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this. */ - allowComments: false, // id of frame.. frameId: false, @@ -1032,8 +1031,10 @@ // clean up silly Windows -- stuff? return; } - if (node.nodeName == "#comment" && !this.allowComments) { - node.parentNode.removeChild(node); + if (node.nodeName == "#comment") { + if (!this.allowComments) { + node.parentNode.removeChild(node); + } // clean up silly Windows -- stuff? return; } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 2a9d14f3c3..1b68801487 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -25612,7 +25612,6 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { /** * @cfg {boolean} allowComments - default false - allow comments in HTML source - by default they are stripped - if you are editing email you may need this. */ - allowComments: false, // id of frame.. frameId: false, @@ -26527,8 +26526,10 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { // clean up silly Windows -- stuff? return; } - if (node.nodeName == "#comment" && !this.allowComments) { - node.parentNode.removeChild(node); + if (node.nodeName == "#comment") { + if (!this.allowComments) { + node.parentNode.removeChild(node); + } // clean up silly Windows -- stuff? return; } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index bcdd93760a..1de9b89509 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1114,7 +1114,7 @@ try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}var D=A.cloneRange();D.co },rangeCompareNode:function(A,B){var C=B.ownerDocument.createRange();try{C.selectNode(B);}catch(e){C.selectNodeContents(B);}A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_START,C);var ee=A.compareBoundaryPoints(Range.END_TO_END,C); var D=ss==1;var E=ee==-1;if(D&&E){return 0;}if(!D&&E){return 1;}if(D&&!E){return 2;}return 3;},cleanUpPaste:function(){Roo.log('cleanuppaste');this.cleanUpChildren(this.doc.body);var A=this.cleanWordChars(this.doc.body.innerHTML);if(A!=this.doc.body.innerHTML){this.doc.body.innerHTML=A; }},cleanWordChars:function(A){var he=Roo.HtmlEditorCore;var B=A;Roo.each(he.swapCodes,function(sw){var C=new RegExp("\\u"+sw[0].toString(16),"g");B=B.replace(C,sw[1]);});return B;},cleanUpChildren:function(n){if(!n.childNodes.length){return;}for(var i=n.childNodes.length-1; -i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"&&!this.allowComments){A.parentNode.removeChild(A);return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A); +i>-1;i--){this.cleanUpChild(n.childNodes[i]);}},cleanUpChild:function(A){var ed=this;if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){if(!this.allowComments){A.parentNode.removeChild(A);}return;}var B=A.tagName.toLowerCase();if(this.black.indexOf(B)>-1&&this.clearUp){A.parentNode.removeChild(A); return;}var C=Roo.HtmlEditorCore.remove.indexOf(A.tagName.toLowerCase())>-1;if((!A.attributes||!A.attributes.length)&&B=='span'){C=true;}if(C){this.cleanUpChildren(A);while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A); }A.parentNode.removeChild(A);return;}if(!A.attributes||!A.attributes.length){this.cleanUpChildren(A);return;}function cleanAttr(n,v){if(v.match(/^\./)||v.match(/^\//)){return;}if(v.match(/^(http|https):\/\//)||v.match(/^mailto:/)||v.match(/^ftp:/)){return; }if(v.match(/^#/)){return;}if(v.match(/^\{/)){return;}A.removeAttribute(n);}var D=this.cwhite;var E=this.cblack;function cleanStyle(n,v){if(v.match(/expression/)){A.removeAttribute(n);return;}var F=v.split(/;/);var G=[];Roo.each(F,function(p){p=p.replace(/^\s+/g,'').replace(/\s+$/g,''); -- 2.39.2