From: Alan Knowles Date: Mon, 21 Dec 2015 08:15:05 +0000 (+0800) Subject: roojs-ui.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=38664341291e34515e7f21da2d1ebc31defe4716 roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- diff --git a/roojs-all.js b/roojs-all.js index 98eb234ee4..97978deb6f 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -907,11 +907,14 @@ A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_ 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:/)){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,'');if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;}if(D.length&&D.indexOf(l)<0){return true;} G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));}else {A.removeAttribute(n);}}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(a.name.toLowerCase().substr(0,2)=='on'){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);continue;}if(a.name=='style'){cleanStyle(a.name,a.value);continue;}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/body/)){A.className='';}continue;}} -this.cleanUpChildren(A);},cleanWord:function(A){var _t=this;var B=function(){if(!A.childNodes.length){return;}for(var i=A.childNodes.length-1;i>-1;i--){_t.cleanWord(A.childNodes[i]);}};if(!A){this.cleanWord(this.doc.body);return;}if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(style|script|applet|embed|noframes|noscript)$/)){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|font)/)){while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A);} -A.parentNode.removeChild(A);B();return;}if(A.className.length){var cn=A.className.split(/\W+/);var cna=[];Roo.each(cn,function(C){if(C.match(/Mso[a-zA-Z]+/)){return;} -cna.push(C);});A.className=cna.length?cna.join(' '):'';if(!cna.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var styles=A.getAttribute("style").split(";");var nstyle=[];Roo.each(styles,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;} -nstyle.push(s);});A.setAttribute("style",nstyle.length?nstyle.join(';'):'');if(!nstyle.length){A.removeAttribute('style');}} -B();},domToHTML:function(A,B,C){B=B||0;C=C||false;if(!A){return this.domToHTML(this.doc.body);}var j;var D=false;var E=A.nodeName;var F=Roo.util.Format.htmlEncode(A.tagName);if(E=='#text'){return C?A.nodeValue:A.nodeValue.trim();}var G='';if(E!='BODY'){var i=0;if(F){var H=[];for(i=0;i-1;i--){fn.call(this,A.childNodes[i])}},cleanTableWidths:function(A){if(!A){this.cleanTableWidths(this.doc.body);return;}if(A.nodeName=="#text"||A.nodeName=="#comment"){return;} +Roo.log(A.tagName);if(!A.tagName.toLowerCase().match(/^(table|td|tr)$/)){this.iterateChildren(A,this.cleanTableWidths);return;}if(A.hasAttribute('width')){A.removeAttribute('width');}if(A.hasAttribute("style")){var B=A.getAttribute("style").split(";");var C=[];Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^\s*(width|min-width)\s*$/)){return;} +C.push(s);});A.setAttribute("style",C.length?C.join(';'):'');if(!C.length){A.removeAttribute('style');}} +this.iterateChildren(A,this.cleanTableWidths);},domToHTML:function(A,B,C){B=B||0;C=C||false;if(!A){return this.domToHTML(this.doc.body);}var j;var D=false;var E=A.nodeName;var F=Roo.util.Format.htmlEncode(A.tagName);if(E=='#text'){return C?A.nodeValue:A.nodeValue.trim();}var G='';if(E!='BODY'){var i=0;if(F){var H=[];for(i=0;i";}else {}}else {F=false;}if(['IMG','BR','HR','INPUT'].indexOf(F)>-1){return G;}if(['PRE','TEXTAREA','TD','A','SPAN'].indexOf(F)>-1){C=true;} i=0;var J=A.childNodes.item(i);var D=true;var K='';lastnode='';while(J){var L=C;if(lastnode=='SPAN'){L=true;}if(J.nodeName=='#text'){var M=Roo.util.Format.htmlEncode(J.nodeValue);M=C?M:M.trim();if(!L&&M.length>80){K+="\n"+(new Array(B+1)).join(" ");} @@ -943,7 +946,7 @@ this.wrap.dom.innerHTML='';this.wrap.remove();}},onFirstFocus:function(){this.ed Roo.form.HtmlEditor.ToolbarStandard=function(A){Roo.apply(this,A);this.disable=this.disable||{};Roo.applyIf(this.disable,{fontSize:true,colors:true,specialElements:true});} Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,{tb:false,rendered:false,editor:false,editorcore:false,disable:false,createLinkText:'Please enter the URL for the link:',defaultLinkValue:'http:/'+'/',fontFamilies:['Arial','Courier New','Tahoma','Times New Roman','Verdana'],specialChars:["©","®","™","£","…","÷","€","°"],specialElements:[{text:"Insert Table",xtype:'MenuItem',xns:Roo.Menu,ihtml:'
Cell
'},{text:"Insert Image",xtype:'MenuItem',xns:Roo.Menu,ihtml:''}],inputElements:["form","input:text","input:hidden","input:checkbox","input:radio","input:password","input:submit","input:button","select","textarea","label"],formats:[["p"],["h1"],["h2"],["h3"],["h4"],["h5"],["h6"],["pre"],["code"],["abbr"],["acronym"],["address"],["cite"],["samp"],["var"],['div'],['span']],cleanStyles:["font-size"],defaultFont:'tahoma',fontSelect:false,formatCombo:false,init:function(A){this.editor=A;this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var _t=this;var C=B.frameId;var D=this;function btn(id,H,I){var J=C+'-'+id;return {id:J,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:H!==false,scope:_t,handler:I||_t.relayBtnCmd,clickEvent:'mousedown',tooltip:D.buttonTips[id]||undefined,tabIndex:-1};}var tb=new Roo.Toolbar(A.wrap.dom.firstChild);this.tb=tb;tb.el.on('click',function(e){e.preventDefault();});if(!this.disable.font){};if(!this.disable.formats){this.formatCombo=new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'tag',fields:['tag'],data:this.formats}),blockFocus:true,name:'',displayField:'tag',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Add tag',selectOnFocus:true,width:135,listeners:{'select':function(c,r,i){B.insertTag(r.get('tag'));A.focus();}}});tb.addField(this.formatCombo);}if(!this.disable.format){tb.add(btn('bold'),btn('italic'),btn('underline'));};if(!this.disable.fontSize){tb.add('-',btn('increasefontsize',false,B.adjustFont),btn('decreasefontsize',false,B.adjustFont));};if(!this.disable.colors){tb.add('-',{id:B.frameId+'-forecolor',cls:'x-btn-icon x-edit-forecolor',clickEvent:'mousedown',tooltip:this.buttonTips['forecolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({allowReselect:true,focus:Roo.emptyFn,value:'000000',plain:true,selectHandler:function(cp,H){B.execCmd('forecolor',Roo.isSafari||Roo.isIE?'#'+H:H);A.deferFocus();},scope:B,clickEvent:'mousedown'})},{id:B.frameId+'backcolor',cls:'x-btn-icon x-edit-backcolor',clickEvent:'mousedown',tooltip:this.buttonTips['backcolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({focus:Roo.emptyFn,value:'FFFFFF',plain:true,allowReselect:true,selectHandler:function(cp,H){if(Roo.isGecko){B.execCmd('useCSS',false);B.execCmd('hilitecolor',H);B.execCmd('useCSS',true);A.deferFocus();}else {B.execCmd(Roo.isOpera?'hilitecolor':'backcolor',Roo.isSafari||Roo.isIE?'#'+H:H);A.deferFocus();}},scope:B,clickEvent:'mousedown'})});};if(!this.disable.alignments){tb.add('-',btn('justifyleft'),btn('justifycenter'),btn('justifyright'));};if(!this.disable.links){tb.add('-',btn('createlink',false,this.createLink));};if(!this.disable.lists){tb.add('-',btn('insertorderedlist'),btn('insertunorderedlist'));}if(!this.disable.sourceEdit){tb.add('-',btn('sourceedit',true,function(H){this.toggleSourceEdit(H.pressed);}));}var E={};if(!this.disable.special){E={text:"©",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i -1 ; i--) { - _t.cleanWord(node.childNodes[i]); - } - } if (!node) { @@ -42293,7 +42284,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { node.parentNode.insertBefore(cn, node); } node.parentNode.removeChild(node); - cleanWordChildren(); + this.iterateChildren(node, this.cleanWord); return; } // clean styles @@ -42337,11 +42328,87 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { node.removeAttribute('style'); } } + this.iterateChildren(node, this.cleanWord); + + + + }, + /** + * iterateChildren of a Node, calling fn each time, using this as the scole.. + * @param {DomNode} node node to iterate children of. + * @param {Function} fn method of this class to call on each item. + */ + iterateChildren : function(node, fn) + { + if (!node.childNodes.length) { + return; + } + for (var i = node.childNodes.length-1; i > -1 ; i--) { + fn.call(this, node.childNodes[i]) + } + }, + + + /** + * cleanTableWidths. + * + * Quite often pasting from word etc.. results in tables with column and widths. + * This does not work well on fluid HTML layouts - like emails. - so this code should hunt an destroy them.. + * + */ + cleanTableWidths : function(node) + { + + + if (!node) { + this.cleanTableWidths(this.doc.body); + return; + } + + // ignore list... + if (node.nodeName == "#text" || node.nodeName == "#comment") { + return; + } + Roo.log(node.tagName); + if (!node.tagName.toLowerCase().match(/^(table|td|tr)$/)) { + this.iterateChildren(node, this.cleanTableWidths); + return; + } + if (node.hasAttribute('width')) { + node.removeAttribute('width'); + } + + + if (node.hasAttribute("style")) { + // pretty basic... + + var styles = node.getAttribute("style").split(";"); + var nstyle = []; + Roo.each(styles, function(s) { + if (!s.match(/:/)) { + return; + } + var kv = s.split(":"); + if (kv[0].match(/^\s*(width|min-width)\s*$/)) { + return; + } + // what ever is left... we allow. + nstyle.push(s); + }); + node.setAttribute("style", nstyle.length ? nstyle.join(';') : ''); + if (!nstyle.length) { + node.removeAttribute('style'); + } + } - cleanWordChildren(); + this.iterateChildren(node, this.cleanTableWidths); }, + + + + domToHTML : function(currentElement, depth, nopadtext) { depth = depth || 0; @@ -43707,6 +43774,15 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype, { tabIndex:-1 }); } + cmenu.menu.items.push({ + actiontype : 'tablewidths', + html: 'Remove Table Widths', + handler: function(a,b) { + editorcore.cleanTableWidths(); + editorcore.syncValue(); + }, + tabIndex:-1 + }); cmenu.menu.items.push({ actiontype : 'word', html: 'Remove MS Word Formating', @@ -43731,7 +43807,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype, { tabIndex:-1 }); cmenu.menu.items.push({ - actiontype : 'word', + actiontype : 'tidy', html: 'Tidy HTML Source', handler: function(a,b) { editorcore.doc.body.innerHTML = editorcore.domToHTML(); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 8e00287557..53ee3d824f 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -25803,21 +25803,12 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { }, + /** * Clean up MS wordisms... */ cleanWord : function(node) { - var _t = this; - var cleanWordChildren = function() - { - if (!node.childNodes.length) { - return; - } - for (var i = node.childNodes.length-1; i > -1 ; i--) { - _t.cleanWord(node.childNodes[i]); - } - } if (!node) { @@ -25847,7 +25838,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { node.parentNode.insertBefore(cn, node); } node.parentNode.removeChild(node); - cleanWordChildren(); + this.iterateChildren(node, this.cleanWord); return; } // clean styles @@ -25891,11 +25882,87 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component, { node.removeAttribute('style'); } } + this.iterateChildren(node, this.cleanWord); + + + + }, + /** + * iterateChildren of a Node, calling fn each time, using this as the scole.. + * @param {DomNode} node node to iterate children of. + * @param {Function} fn method of this class to call on each item. + */ + iterateChildren : function(node, fn) + { + if (!node.childNodes.length) { + return; + } + for (var i = node.childNodes.length-1; i > -1 ; i--) { + fn.call(this, node.childNodes[i]) + } + }, + + + /** + * cleanTableWidths. + * + * Quite often pasting from word etc.. results in tables with column and widths. + * This does not work well on fluid HTML layouts - like emails. - so this code should hunt an destroy them.. + * + */ + cleanTableWidths : function(node) + { + + + if (!node) { + this.cleanTableWidths(this.doc.body); + return; + } + + // ignore list... + if (node.nodeName == "#text" || node.nodeName == "#comment") { + return; + } + Roo.log(node.tagName); + if (!node.tagName.toLowerCase().match(/^(table|td|tr)$/)) { + this.iterateChildren(node, this.cleanTableWidths); + return; + } + if (node.hasAttribute('width')) { + node.removeAttribute('width'); + } + + + if (node.hasAttribute("style")) { + // pretty basic... + + var styles = node.getAttribute("style").split(";"); + var nstyle = []; + Roo.each(styles, function(s) { + if (!s.match(/:/)) { + return; + } + var kv = s.split(":"); + if (kv[0].match(/^\s*(width|min-width)\s*$/)) { + return; + } + // what ever is left... we allow. + nstyle.push(s); + }); + node.setAttribute("style", nstyle.length ? nstyle.join(';') : ''); + if (!nstyle.length) { + node.removeAttribute('style'); + } + } - cleanWordChildren(); + this.iterateChildren(node, this.cleanTableWidths); }, + + + + domToHTML : function(currentElement, depth, nopadtext) { depth = depth || 0; @@ -27261,6 +27328,15 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype, { tabIndex:-1 }); } + cmenu.menu.items.push({ + actiontype : 'tablewidths', + html: 'Remove Table Widths', + handler: function(a,b) { + editorcore.cleanTableWidths(); + editorcore.syncValue(); + }, + tabIndex:-1 + }); cmenu.menu.items.push({ actiontype : 'word', html: 'Remove MS Word Formating', @@ -27285,7 +27361,7 @@ Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype, { tabIndex:-1 }); cmenu.menu.items.push({ - actiontype : 'word', + actiontype : 'tidy', html: 'Tidy HTML Source', handler: function(a,b) { editorcore.doc.body.innerHTML = editorcore.domToHTML(); diff --git a/roojs-ui.js b/roojs-ui.js index 47bb6c7d99..c4ab55a67d 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -572,11 +572,14 @@ A.collapse(true);C.collapse(true);var ss=A.compareBoundaryPoints(Range.START_TO_ 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:/)){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,'');if(!p.length){return true;}var l=p.split(':').shift().replace(/\s+/g,'');l=l.replace(/^\s+/g,'').replace(/\s+$/g,'');if(D.length&&E.indexOf(l)>-1){return true;}if(D.length&&D.indexOf(l)<0){return true;} G.push(p);return true;});if(G.length){A.setAttribute(n,G.join(';'));}else {A.removeAttribute(n);}}for(var i=A.attributes.length-1;i>-1;i--){var a=A.attributes[i];if(a.name.toLowerCase().substr(0,2)=='on'){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.ablack.indexOf(a.name.toLowerCase())>-1){A.removeAttribute(a.name);continue;}if(Roo.HtmlEditorCore.aclean.indexOf(a.name.toLowerCase())>-1){cleanAttr(a.name,a.value);continue;}if(a.name=='style'){cleanStyle(a.name,a.value);continue;}if(a.name=='class'){if(a.value.match(/^Mso/)){A.className='';}if(a.value.match(/body/)){A.className='';}continue;}} -this.cleanUpChildren(A);},cleanWord:function(A){var _t=this;var B=function(){if(!A.childNodes.length){return;}for(var i=A.childNodes.length-1;i>-1;i--){_t.cleanWord(A.childNodes[i]);}};if(!A){this.cleanWord(this.doc.body);return;}if(A.nodeName=="#text"){return;}if(A.nodeName=="#comment"){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(style|script|applet|embed|noframes|noscript)$/)){A.parentNode.removeChild(A);return;}if(A.tagName.toLowerCase().match(/^(meta|link|\\?xml:|st1:|o:|font)/)){while(A.childNodes.length){var cn=A.childNodes[0];A.removeChild(cn);A.parentNode.insertBefore(cn,A);} -A.parentNode.removeChild(A);B();return;}if(A.className.length){var cn=A.className.split(/\W+/);var cna=[];Roo.each(cn,function(C){if(C.match(/Mso[a-zA-Z]+/)){return;} -cna.push(C);});A.className=cna.length?cna.join(' '):'';if(!cna.length){A.removeAttribute("class");}}if(A.hasAttribute("lang")){A.removeAttribute("lang");}if(A.hasAttribute("style")){var styles=A.getAttribute("style").split(";");var nstyle=[];Roo.each(styles,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^(mso-|line|font|background|margin|padding|color)/)){return;} -nstyle.push(s);});A.setAttribute("style",nstyle.length?nstyle.join(';'):'');if(!nstyle.length){A.removeAttribute('style');}} -B();},domToHTML:function(A,B,C){B=B||0;C=C||false;if(!A){return this.domToHTML(this.doc.body);}var j;var D=false;var E=A.nodeName;var F=Roo.util.Format.htmlEncode(A.tagName);if(E=='#text'){return C?A.nodeValue:A.nodeValue.trim();}var G='';if(E!='BODY'){var i=0;if(F){var H=[];for(i=0;i-1;i--){fn.call(this,A.childNodes[i])}},cleanTableWidths:function(A){if(!A){this.cleanTableWidths(this.doc.body);return;}if(A.nodeName=="#text"||A.nodeName=="#comment"){return;} +Roo.log(A.tagName);if(!A.tagName.toLowerCase().match(/^(table|td|tr)$/)){this.iterateChildren(A,this.cleanTableWidths);return;}if(A.hasAttribute('width')){A.removeAttribute('width');}if(A.hasAttribute("style")){var B=A.getAttribute("style").split(";");var C=[];Roo.each(B,function(s){if(!s.match(/:/)){return;}var kv=s.split(":");if(kv[0].match(/^\s*(width|min-width)\s*$/)){return;} +C.push(s);});A.setAttribute("style",C.length?C.join(';'):'');if(!C.length){A.removeAttribute('style');}} +this.iterateChildren(A,this.cleanTableWidths);},domToHTML:function(A,B,C){B=B||0;C=C||false;if(!A){return this.domToHTML(this.doc.body);}var j;var D=false;var E=A.nodeName;var F=Roo.util.Format.htmlEncode(A.tagName);if(E=='#text'){return C?A.nodeValue:A.nodeValue.trim();}var G='';if(E!='BODY'){var i=0;if(F){var H=[];for(i=0;i";}else {}}else {F=false;}if(['IMG','BR','HR','INPUT'].indexOf(F)>-1){return G;}if(['PRE','TEXTAREA','TD','A','SPAN'].indexOf(F)>-1){C=true;} i=0;var J=A.childNodes.item(i);var D=true;var K='';lastnode='';while(J){var L=C;if(lastnode=='SPAN'){L=true;}if(J.nodeName=='#text'){var M=Roo.util.Format.htmlEncode(J.nodeValue);M=C?M:M.trim();if(!L&&M.length>80){K+="\n"+(new Array(B+1)).join(" ");} @@ -608,7 +611,7 @@ this.wrap.dom.innerHTML='';this.wrap.remove();}},onFirstFocus:function(){this.ed Roo.form.HtmlEditor.ToolbarStandard=function(A){Roo.apply(this,A);this.disable=this.disable||{};Roo.applyIf(this.disable,{fontSize:true,colors:true,specialElements:true});} Roo.apply(Roo.form.HtmlEditor.ToolbarStandard.prototype,{tb:false,rendered:false,editor:false,editorcore:false,disable:false,createLinkText:'Please enter the URL for the link:',defaultLinkValue:'http:/'+'/',fontFamilies:['Arial','Courier New','Tahoma','Times New Roman','Verdana'],specialChars:["©","®","™","£","…","÷","€","°"],specialElements:[{text:"Insert Table",xtype:'MenuItem',xns:Roo.Menu,ihtml:'
Cell
'},{text:"Insert Image",xtype:'MenuItem',xns:Roo.Menu,ihtml:''}],inputElements:["form","input:text","input:hidden","input:checkbox","input:radio","input:password","input:submit","input:button","select","textarea","label"],formats:[["p"],["h1"],["h2"],["h3"],["h4"],["h5"],["h6"],["pre"],["code"],["abbr"],["acronym"],["address"],["cite"],["samp"],["var"],['div'],['span']],cleanStyles:["font-size"],defaultFont:'tahoma',fontSelect:false,formatCombo:false,init:function(A){this.editor=A;this.editorcore=A.editorcore?A.editorcore:A;var B=this.editorcore;var _t=this;var C=B.frameId;var D=this;function btn(id,H,I){var J=C+'-'+id;return {id:J,cmd:id,cls:'x-btn-icon x-edit-'+id,enableToggle:H!==false,scope:_t,handler:I||_t.relayBtnCmd,clickEvent:'mousedown',tooltip:D.buttonTips[id]||undefined,tabIndex:-1};}var tb=new Roo.Toolbar(A.wrap.dom.firstChild);this.tb=tb;tb.el.on('click',function(e){e.preventDefault();});if(!this.disable.font){};if(!this.disable.formats){this.formatCombo=new Roo.form.ComboBox({store:new Roo.data.SimpleStore({id:'tag',fields:['tag'],data:this.formats}),blockFocus:true,name:'',displayField:'tag',typeAhead:false,mode:'local',editable:false,triggerAction:'all',emptyText:'Add tag',selectOnFocus:true,width:135,listeners:{'select':function(c,r,i){B.insertTag(r.get('tag'));A.focus();}}});tb.addField(this.formatCombo);}if(!this.disable.format){tb.add(btn('bold'),btn('italic'),btn('underline'));};if(!this.disable.fontSize){tb.add('-',btn('increasefontsize',false,B.adjustFont),btn('decreasefontsize',false,B.adjustFont));};if(!this.disable.colors){tb.add('-',{id:B.frameId+'-forecolor',cls:'x-btn-icon x-edit-forecolor',clickEvent:'mousedown',tooltip:this.buttonTips['forecolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({allowReselect:true,focus:Roo.emptyFn,value:'000000',plain:true,selectHandler:function(cp,H){B.execCmd('forecolor',Roo.isSafari||Roo.isIE?'#'+H:H);A.deferFocus();},scope:B,clickEvent:'mousedown'})},{id:B.frameId+'backcolor',cls:'x-btn-icon x-edit-backcolor',clickEvent:'mousedown',tooltip:this.buttonTips['backcolor']||undefined,tabIndex:-1,menu:new Roo.menu.ColorMenu({focus:Roo.emptyFn,value:'FFFFFF',plain:true,allowReselect:true,selectHandler:function(cp,H){if(Roo.isGecko){B.execCmd('useCSS',false);B.execCmd('hilitecolor',H);B.execCmd('useCSS',true);A.deferFocus();}else {B.execCmd(Roo.isOpera?'hilitecolor':'backcolor',Roo.isSafari||Roo.isIE?'#'+H:H);A.deferFocus();}},scope:B,clickEvent:'mousedown'})});};if(!this.disable.alignments){tb.add('-',btn('justifyleft'),btn('justifycenter'),btn('justifyright'));};if(!this.disable.links){tb.add('-',btn('createlink',false,this.createLink));};if(!this.disable.lists){tb.add('-',btn('insertorderedlist'),btn('insertunorderedlist'));}if(!this.disable.sourceEdit){tb.add('-',btn('sourceedit',true,function(H){this.toggleSourceEdit(H.pressed);}));}var E={};if(!this.disable.special){E={text:"©",cls:'x-edit-none',menu:{items:[]}};for(var i=0;i