From: Alan Date: Tue, 5 Jul 2022 03:54:10 +0000 (+0800) Subject: Changed Roo/htmleditor/Filter.jsRoo/htmleditor/FilterWord.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=18b078ac6ec6dabf53fff95312bcfa7b0d1afe3f Changed Roo/htmleditor/Filter.jsRoo/htmleditor/FilterWord.js --- diff --git a/Roo/htmleditor/Filter.js b/Roo/htmleditor/Filter.js index 411cd3c963..6d5cf8f224 100644 --- a/Roo/htmleditor/Filter.js +++ b/Roo/htmleditor/Filter.js @@ -62,5 +62,20 @@ Roo.htmleditor.Filter.prototype = { }, this); + }, + + + removeNodeKeepChildren : function( node) + { + + ar = Array.from(node.childNodes); + for (var i = 0; i < ar.length; i++) { + + node.removeChild(ar[i]); + // what if we need to walk these??? + node.parentNode.insertBefore(ar[i], node); + + } + node.parentNode.removeChild(node); } }; \ No newline at end of file diff --git a/Roo/htmleditor/FilterWord.js b/Roo/htmleditor/FilterWord.js index a9fad68e12..b56d022a5d 100644 --- a/Roo/htmleditor/FilterWord.js +++ b/Roo/htmleditor/FilterWord.js @@ -14,6 +14,7 @@ Roo.htmleditor.FilterWord = function(cfg) // no need to apply config. this.replaceDocBullets(cfg.node); + this.replaceAname(cfg.node); // this is disabled as the removal is done by other filters; // this.walk(cfg.node); @@ -139,7 +140,31 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, }); return ret; }, - + + + replaceAname : function (doc) + { + // replace all the a/name without.. + var aa = Array.from(doc.getElementsTagName('a')); + for (var i = 0; i < aa.length; i++) { + var a = aa[i]; + if (a.hasAttribute("name")) { + a.removeAttribute("name"); + } + if (a.hasAttribute("href")) { + continue; + } + // reparent children. + this.removeNodeKeepChildren(a); + + } + + + + }, + + + replaceDocBullets : function(doc) { // this is a bit odd - but it appears some indents use ql-indent-1