From 7c7fba1f5be1b1eda2666860c3151567579a173b Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 27 Sep 2021 15:25:39 +0800 Subject: [PATCH] roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js Roo/HtmlEditorCore.js --- Roo/HtmlEditorCore.js | 109 +----------------------------------------- roojs-all.js | 2 +- roojs-debug.js | 2 +- roojs-ui-debug.js | 2 +- roojs-ui.js | 2 +- 5 files changed, 5 insertions(+), 112 deletions(-) diff --git a/Roo/HtmlEditorCore.js b/Roo/HtmlEditorCore.js index 1f9868d178..517a91f4e1 100644 --- a/Roo/HtmlEditorCore.js +++ b/Roo/HtmlEditorCore.js @@ -1062,114 +1062,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { }, - - - /* == used on tidy feature */ - domToHTML : function(currentElement, depth, nopadtext) { - - depth = depth || 0; - nopadtext = nopadtext || false; - - if (!currentElement) { - return this.domToHTML(this.doc.body); - } - - //Roo.log(currentElement); - var j; - var allText = false; - var nodeName = currentElement.nodeName; - var tagName = Roo.util.Format.htmlEncode(currentElement.tagName); - - if (nodeName == '#text') { - - return nopadtext ? currentElement.nodeValue : currentElement.nodeValue.trim(); - } - - - var ret = ''; - if (nodeName != 'BODY') { - - var i = 0; - // Prints the node tagName, such as , , etc - if (tagName) { - var attr = []; - for(i = 0; i < currentElement.attributes.length;i++) { - // quoting? - var aname = currentElement.attributes.item(i).name; - if (!currentElement.attributes.item(i).value.length) { - continue; - } - attr.push(aname + '="' + Roo.util.Format.htmlEncode(currentElement.attributes.item(i).value) + '"' ); - } - - ret = "<"+currentElement.tagName+ ( attr.length ? (' ' + attr.join(' ') ) : '') + ">"; - } - else { - - // eack - } - } else { - tagName = false; - } - if (['IMG', 'BR', 'HR', 'INPUT'].indexOf(tagName) > -1) { - return ret; - } - if (['PRE', 'TEXTAREA', 'TD', 'A', 'SPAN'].indexOf(tagName) > -1) { // or code? - nopadtext = true; - } - - - // Traverse the tree - i = 0; - var currentElementChild = currentElement.childNodes.item(i); - var allText = true; - var innerHTML = ''; - lastnode = ''; - while (currentElementChild) { - // Formatting code (indent the tree so it looks nice on the screen) - var nopad = nopadtext; - if (lastnode == 'SPAN') { - nopad = true; - } - // text - if (currentElementChild.nodeName == '#text') { - var toadd = Roo.util.Format.htmlEncode(currentElementChild.nodeValue); - toadd = nopadtext ? toadd : toadd.trim(); - if (!nopad && toadd.length > 80) { - innerHTML += "\n" + (new Array( depth + 1 )).join( " " ); - } - innerHTML += toadd; - - i++; - currentElementChild = currentElement.childNodes.item(i); - lastNode = ''; - continue; - } - allText = false; - - innerHTML += nopad ? '' : "\n" + (new Array( depth + 1 )).join( " " ); - - // Recursively traverse the tree structure of the child node - innerHTML += this.domToHTML(currentElementChild, depth+1, nopadtext); - lastnode = currentElementChild.nodeName; - i++; - currentElementChild=currentElement.childNodes.item(i); - } - - ret += innerHTML; - - if (!allText) { - // The remaining code is mostly for formatting the tree - ret+= nopadtext ? '' : "\n" + (new Array( depth )).join( " " ); - } - - - if (tagName) { - ret+= ""; - } - return ret; - - }, + applyBlacklists : function() { diff --git a/roojs-all.js b/roojs-all.js index 766cb4c8a1..0c56056172 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -1963,7 +1963,7 @@ B.execCmd('hilitecolor',H);B.execCmd('useCSS',true);A.deferFocus();}else{B.execC c.select('[style]').each(function(s){s.dom.style.removeProperty(a.actiontype);});B.syncValue();},tabIndex:-1});}F.menu.items.push({actiontype:'tablewidths',html:'Remove Table Widths',handler:function(a,b){B.cleanTableWidths();B.syncValue();},tabIndex:-1}); F.menu.items.push({actiontype:'word',html:'Remove MS Word Formating',handler:function(a,b){B.cleanWord();B.syncValue();},tabIndex:-1});F.menu.items.push({actiontype:'all',html:'Remove All Styles',handler:function(a,b){var c=Roo.get(B.doc.body);c.select('[style]').each(function(s){s.dom.removeAttribute('style'); });B.syncValue();},tabIndex:-1});F.menu.items.push({actiontype:'all',html:'Remove All CSS Classes',handler:function(a,b){var c=Roo.get(B.doc.body);c.select('[class]').each(function(s){s.dom.removeAttribute('class');});B.cleanWord();B.syncValue();},tabIndex:-1} -);F.menu.items.push({actiontype:'tidy',html:'Tidy HTML Source',handler:function(a,b){B.doc.body.innerHTML=B.domToHTML();B.syncValue();},tabIndex:-1});tb.add(F);}if(!this.disable.specialElements){var G={text:"Other;",cls:'x-edit-none',menu:{items:[]}};for(var i=0; +);F.menu.items.push({actiontype:'tidy',html:'Tidy HTML Source',handler:function(a,b){new Roo.htmleditor.Tidy(B.doc.body);B.syncValue();},tabIndex:-1});tb.add(F);}if(!this.disable.specialElements){var G={text:"Other;",cls:'x-edit-none',menu:{items:[]}};for(var i=0; i