X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-bootstrap-debug.js;h=a5540292839bb64f00633b11a363a34878f699d9;hb=1f33636e992f765ab9a406da9699956cea819bf8;hp=d46f596c0d779ebb514b2abe12505b3c69a138bd;hpb=6387d7ef9465bff1ef6353e264016e71df096e83;p=roojs1 diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index d46f596c0d..a554029283 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -26058,6 +26058,21 @@ 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); } }; @@ -26270,25 +26285,36 @@ Roo.htmleditor.FilterKeepChildren = function(cfg) if (this.tag === false) { return; // dont walk.. (you can use this to use this just to do a child removal on a single tag ) } + // hacky? + if ((typeof(this.tag) == 'object' && this.tag.indexOf(":") > -1)) { + this.cleanNamespace = true; + } + this.walk(cfg.node); } Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack, { - + cleanNamespace : false, // should really be an option, rather than using ':' inside of this tag. replaceTag : function(node) { // walk children... - //Roo.log(node); + //Roo.log(node.tagName); var ar = Array.from(node.childNodes); //remove first.. + for (var i = 0; i < ar.length; i++) { - if (ar[i].nodeType == 1) { + var e = ar[i]; + if (e.nodeType == 1) { if ( - (typeof(this.tag) == 'object' && this.tag.indexOf(ar[i].tagName) > -1) + (typeof(this.tag) == 'object' && this.tag.indexOf(e.tagName) > -1) || // array and it matches - (typeof(this.tag) == 'string' && this.tag == ar[i].tagName) + (typeof(this.tag) == 'string' && this.tag == e.tagName) + || + (e.tagName.indexOf(":") > -1 && typeof(this.tag) == 'object' && this.tag.indexOf(":") > -1) + || + (e.tagName.indexOf(":") > -1 && typeof(this.tag) == 'string' && this.tag == ":") ) { this.replaceTag(ar[i]); // child is blacklisted as well... continue; @@ -26306,6 +26332,7 @@ Roo.extend(Roo.htmleditor.FilterKeepChildren, Roo.htmleditor.FilterBlack, } } + //Roo.log("REMOVE:" + node.tagName); node.parentNode.removeChild(node); return false; // don't walk children @@ -26467,6 +26494,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); @@ -26592,7 +26620,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.getElementsByTagName('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 @@ -26648,7 +26700,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, if (!ns.className.match(/(MsoListParagraph|ql-indent-1)/i)) { break; } - if (ns.getAttribute('style').match(/mso-list/)) { + if (ns.hasAttribute('style') && ns.getAttribute('style').match(/mso-list/)) { items.push(ns); ns = ns.nextSibling; has_list = true; @@ -26660,7 +26712,7 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, } var has_list = false; for(var i = 0; i < spans.length; i++) { - if (spans[i].getAttribute('style').match(/mso-list/)) { + if (spans[i].hasAttribute('style') && spans[i].getAttribute('style').match(/mso-list/)) { has_list = true; break; } @@ -29445,7 +29497,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { .map(function(g) { return g.toDataURL(); }) .filter(function(g) { return g != 'about:blank'; }); - + //Roo.log(html); html = this.cleanWordChars(html); var d = (new DOMParser().parseFromString(html, 'text/html')).body; @@ -29463,7 +29515,16 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { return false; } + + if (images.length > 0) { + // replace all v:imagedata - with img. + Roo.each(d.getElementsByTagName('v:imagedata'), function(node) { + node.parentNode.insertBefore(node, document.createElement('img')); + node.parentNode.removeChild(node); + }); + + Roo.each(d.getElementsByTagName('img'), function(img, i) { img.setAttribute('src', images[i]); });