From 79dceb4db132cf65b29faaf2cc5d6bc7b8267d4e Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 30 Nov 2023 14:09:34 +0800 Subject: [PATCH] fix #7873 - links to footnotes removed on paste --- docs/json/roodata.json | 10 ++++++++++ docs/src/Roo_HtmlEditorCore.js.html | 1 + docs/src/Roo_htmleditor_Filter.js.html | 15 +++++++++++++++ docs/src/Roo_htmleditor_FilterLongBr.js.html | 4 +--- docs/src/Roo_htmleditor_FilterParagraph.js.html | 3 ++- docs/src/Roo_htmleditor_FilterSpan.js.html | 2 +- docs/tree.json | 5 +++++ roojs-all.js | 2 +- roojs-bootstrap-debug.js | 1 - roojs-bootstrap.js | 2 +- roojs-debug.js | 1 - roojs-ui-debug.js | 1 - roojs-ui.js | 2 +- 13 files changed, 38 insertions(+), 11 deletions(-) diff --git a/docs/json/roodata.json b/docs/json/roodata.json index a1fc1015b1..48039b40c1 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -292678,6 +292678,16 @@ "tree_children" : [], "tree_parent" : [] }, + "Roo.htmleditor.FilterHashLink" : { + "props" : [], + "events" : [], + "methods" : [], + "isAbstract" : false, + "isBuilderTop" : false, + "implementations" : [], + "tree_children" : [], + "tree_parent" : [] + }, "Roo.htmleditor.FilterKeepChildren" : { "props" : [], "events" : [], diff --git a/docs/src/Roo_HtmlEditorCore.js.html b/docs/src/Roo_HtmlEditorCore.js.html index c1d85f0fac..655280e555 100644 --- a/docs/src/Roo_HtmlEditorCore.js.html +++ b/docs/src/Roo_HtmlEditorCore.js.html @@ -722,6 +722,7 @@ // should be fonts.. new Roo.htmleditor.FilterKeepChildren({node : d, tag : [ 'FONT', ':' ]} ); new Roo.htmleditor.FilterParagraph({ node : d }); + new Roo.htmleditor.FilterHashLink({node : d}); new Roo.htmleditor.FilterSpan({ node : d }); new Roo.htmleditor.FilterLongBr({ node : d }); new Roo.htmleditor.FilterComment({ node : d }); diff --git a/docs/src/Roo_htmleditor_Filter.js.html b/docs/src/Roo_htmleditor_Filter.js.html index 6341dafac6..2060436e25 100644 --- a/docs/src/Roo_htmleditor_Filter.js.html +++ b/docs/src/Roo_htmleditor_Filter.js.html @@ -77,5 +77,20 @@ } node.parentNode.removeChild(node); + }, + + searchTag : function(dom) + { + if(this.tag === false) { + return; + } + + var els = dom.getElementsByTagName(this.tag); + + Roo.each(Array.from(els), function(e){ + if(this.replaceTag) { + this.replaceTag(e); + } + }, this); } }; \ No newline at end of file diff --git a/docs/src/Roo_htmleditor_FilterLongBr.js.html b/docs/src/Roo_htmleditor_FilterLongBr.js.html index 52bde6d027..31ec355a3c 100644 --- a/docs/src/Roo_htmleditor_FilterLongBr.js.html +++ b/docs/src/Roo_htmleditor_FilterLongBr.js.html @@ -9,7 +9,7 @@ Roo.htmleditor.FilterLongBr = function(cfg) { // no need to apply config. - this.walk(cfg.node); + this.searchTag(cfg.node); } Roo.extend(Roo.htmleditor.FilterLongBr, Roo.htmleditor.Filter, @@ -43,8 +43,6 @@ - - if (!node.previousSibling) { return false; } diff --git a/docs/src/Roo_htmleditor_FilterParagraph.js.html b/docs/src/Roo_htmleditor_FilterParagraph.js.html index 7a47ecbafd..1d3d7e6093 100644 --- a/docs/src/Roo_htmleditor_FilterParagraph.js.html +++ b/docs/src/Roo_htmleditor_FilterParagraph.js.html @@ -10,7 +10,7 @@ Roo.htmleditor.FilterParagraph = function(cfg) { // no need to apply config. - this.walk(cfg.node); + this.searchTag(cfg.node); } Roo.extend(Roo.htmleditor.FilterParagraph, Roo.htmleditor.Filter, @@ -31,6 +31,7 @@ node.parentNode.replaceChild(node.ownerDocument.createElement('BR'),node); return false; // no need to walk.. } + var ar = Array.from(node.childNodes); for (var i = 0; i < ar.length; i++) { node.removeChild(ar[i]); diff --git a/docs/src/Roo_htmleditor_FilterSpan.js.html b/docs/src/Roo_htmleditor_FilterSpan.js.html index 379f730896..bf6243f95d 100644 --- a/docs/src/Roo_htmleditor_FilterSpan.js.html +++ b/docs/src/Roo_htmleditor_FilterSpan.js.html @@ -9,7 +9,7 @@ Roo.htmleditor.FilterSpan = function(cfg) { // no need to apply config. - this.walk(cfg.node); + this.searchTag(cfg.node); } Roo.extend(Roo.htmleditor.FilterSpan, Roo.htmleditor.FilterKeepChildren, diff --git a/docs/tree.json b/docs/tree.json index 5470f4fa62..cf3131382a 100644 --- a/docs/tree.json +++ b/docs/tree.json @@ -1377,6 +1377,11 @@ "cn" : [], "is_class" : false }, + { + "name" : "Roo.htmleditor.FilterHashLink", + "cn" : [], + "is_class" : false + }, { "name" : "Roo.htmleditor.FilterKeepChildren", "cn" : [], diff --git a/roojs-all.js b/roojs-all.js index 14ebbe5227..9c448c7c7a 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1897,7 +1897,7 @@ Roo.htmleditor={}; Roo.htmleditor.Filter=function(A){Roo.apply(this.cfg);};Roo.htmleditor.Filter.prototype={node:false,tag:false,replaceComment:false,replaceTag:false,walk:function(A){Roo.each(Array.from(A.childNodes),function(e){switch(true){case e.nodeType==8&&this.replaceComment!==false:this.replaceComment(e); return;case e.nodeType!=1:return;case this.tag===true:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return; }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);},removeNodeKeepChildren:function(A){ar=Array.from(A.childNodes);for(var i=0;i-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return; }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);},removeNodeKeepChildren:function(A){ar=Array.from(A.childNodes);for(var i=0;i-1&&typeof(this.tag)=='object'&&this.tag.indexOf(":")>-1:case e.tagName.indexOf(":")>-1&&typeof(this.tag)=='string'&&this.tag==":":case typeof(this.tag)=='object'&&this.tag.indexOf(e.tagName)>-1:case typeof(this.tag)=='string'&&this.tag==e.tagName:if(this.replaceTag&&false===this.replaceTag(e)){return; }if(e.hasChildNodes()){this.walk(e);}return;default:if(e.hasChildNodes()){this.walk(e);}}},this);},removeNodeKeepChildren:function(A){ar=Array.from(A.childNodes);for(var i=0;i