2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!dojo._hasResource["dijit._editor.RichText"]){
9 dojo._hasResource["dijit._editor.RichText"]=true;
10 dojo.provide("dijit._editor.RichText");
11 dojo.require("dijit._Widget");
12 dojo.require("dijit._CssStateMixin");
13 dojo.require("dijit._editor.selection");
14 dojo.require("dijit._editor.range");
15 dojo.require("dijit._editor.html");
16 if(!dojo.config["useXDomain"]||dojo.config["allowXdRichTextSave"]){
19 var _1=dojo.doc.createElement("textarea");
20 _1.id=dijit._scopeName+"._editor.RichText.savedContent";
21 dojo.style(_1,{display:"none",position:"absolute",top:"-100px",height:"3px",width:"3px"});
22 dojo.body().appendChild(_1);
26 dojo.doc.write("<textarea id=\""+dijit._scopeName+"._editor.RichText.savedContent\" "+"style=\"display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;\"></textarea>");
32 dojo.declare("dijit._editor.RichText",[dijit._Widget,dijit._CssStateMixin],{constructor:function(_2){
33 this.contentPreFilters=[];
34 this.contentPostFilters=[];
35 this.contentDomPreFilters=[];
36 this.contentDomPostFilters=[];
37 this.editingAreaStyleSheets=[];
38 this.events=[].concat(this.events);
40 this.contentPreFilters.push(dojo.hitch(this,"_preFixUrlAttributes"));
42 this.contentPreFilters.push(this._normalizeFontStyle);
43 this.contentPostFilters.push(this._removeMozBogus);
46 this.contentPreFilters.push(this._removeWebkitBogus);
47 this.contentPostFilters.push(this._removeWebkitBogus);
50 this.contentPostFilters.push(this._normalizeFontStyle);
52 if(_2&&dojo.isString(_2.value)){
55 this.onLoadDeferred=new dojo.Deferred();
56 },baseClass:"dijitEditor",inheritWidth:false,focusOnLoad:false,name:"",styleSheets:"",_content:"",height:"300px",minHeight:"1em",isClosed:true,isLoaded:false,_SEPARATOR:"@@**%%__RICHTEXTBOUNDRY__%%**@@",onLoadDeferred:null,isTabIndent:false,disableSpellCheck:false,postCreate:function(){
57 if("textarea"==this.domNode.tagName.toLowerCase()){
58 console.warn("RichText should not be used with the TEXTAREA tag. See dijit._editor.RichText docs.");
60 this.inherited(arguments);
61 dojo.publish(dijit._scopeName+"._editor.RichText::init",[this]);
63 this.setupDefaultShortcuts();
64 },setupDefaultShortcuts:function(){
65 var _3=dojo.hitch(this,function(_4,_5){
67 return !this.execCommand(_4,_5);
70 var _6={b:_3("bold"),i:_3("italic"),u:_3("underline"),a:_3("selectall"),s:function(){
73 this.isTabIndent=!this.isTabIndent;
74 },"1":_3("formatblock","h1"),"2":_3("formatblock","h2"),"3":_3("formatblock","h3"),"4":_3("formatblock","h4"),"\\":_3("insertunorderedlist")};
79 this.addKeyHandler(_7,true,false,_6[_7]);
81 },events:["onKeyPress","onKeyDown","onKeyUp","onClick"],captureEvents:[],_editorCommandsLocalized:false,_localizeEditorCommands:function(){
82 if(this._editorCommandsLocalized){
85 this._editorCommandsLocalized=true;
86 var _8=["div","p","pre","h1","h2","h3","h4","h5","h6","ol","ul","address"];
89 if(_a.charAt(1)!="l"){
90 _9+="<"+_a+"><span>content</span></"+_a+"><br/>";
92 _9+="<"+_a+"><li>content</li></"+_a+"><br/>";
95 var _b=dojo.doc.createElement("div");
96 dojo.style(_b,{position:"absolute",top:"-2000px"});
97 dojo.doc.body.appendChild(_b);
101 dijit._editor.selection.selectElement(_c.firstChild);
102 dojo.withGlobal(this.window,"selectElement",dijit._editor.selection,[_c.firstChild]);
103 var _d=_c.tagName.toLowerCase();
104 this._local2NativeFormatNames[_d]=document.queryCommandValue("formatblock");
105 this._native2LocalFormatNames[this._local2NativeFormatNames[_d]]=_d;
106 _c=_c.nextSibling.nextSibling;
108 dojo.body().removeChild(_b);
110 if(!this.onLoadDeferred||this.onLoadDeferred.fired>=0){
111 this.onLoadDeferred=new dojo.Deferred();
116 dojo.publish(dijit._scopeName+"._editor.RichText::open",[this]);
118 if(arguments.length==1&&_e.nodeName){
123 if(dojo.isString(this.value)){
128 if(dn.nodeName&&dn.nodeName.toLowerCase()=="textarea"){
129 var ta=(this.textarea=dn);
132 dn=this.domNode=dojo.doc.createElement("div");
133 dn.setAttribute("widgetId",this.id);
134 ta.removeAttribute("widgetId");
135 dn.cssText=ta.cssText;
136 dn.className+=" "+ta.className;
137 dojo.place(dn,ta,"before");
138 var _10=dojo.hitch(this,function(){
139 dojo.style(ta,{display:"block",position:"absolute",top:"-1000px"});
142 this.__overflow=s.overflow;
152 dojo.connect(ta.form,"onsubmit",this,function(){
153 ta.value=this.getValue();
157 _f=dijit._editor.getChildrenHtml(dn);
161 var _11=dojo.contentBox(dn);
162 this._oldHeight=_11.h;
163 this._oldWidth=_11.w;
164 this.savedContent=_f;
165 if(dn.nodeName&&dn.nodeName=="LI"){
166 dn.innerHTML=" <br>";
168 this.header=dn.ownerDocument.createElement("div");
169 dn.appendChild(this.header);
170 this.editingArea=dn.ownerDocument.createElement("div");
171 dn.appendChild(this.editingArea);
172 this.footer=dn.ownerDocument.createElement("div");
173 dn.appendChild(this.footer);
174 if(this.name!==""&&(!dojo.config["useXDomain"]||dojo.config["allowXdRichTextSave"])){
175 var _12=dojo.byId(dijit._scopeName+"._editor.RichText.savedContent");
177 var _13=_12.value.split(this._SEPARATOR),i=0,dat;
178 while((dat=_13[i++])){
179 var _14=dat.split(":");
180 if(_14[0]==this.name){
187 dojo.addOnUnload(dojo.hitch(this,"_saveContent"));
190 var ifr=(this.editorObject=this.iframe=dojo.doc.createElement("iframe"));
191 ifr.id=this.id+"_iframe";
192 this._iframeSrc=this._getIframeDocTxt();
193 ifr.style.border="none";
194 ifr.style.width="100%";
195 if(this._layoutMode){
196 ifr.style.height="100%";
200 ifr.style.height=this.height;
203 ifr.style.minHeight=this.minHeight;
206 ifr.style.height=this.height?this.height:this.minHeight;
210 ifr._loadFunc=dojo.hitch(this,function(win){
212 this.document=this.window.document;
214 this._localizeEditorCommands();
218 var s="javascript:parent."+dijit._scopeName+".byId(\""+this.id+"\")._iframeSrc";
219 ifr.setAttribute("src",s);
220 this.editingArea.appendChild(ifr);
221 if(dn.nodeName=="LI"){
222 dn.lastChild.style.marginTop="-1.2em";
224 dojo.addClass(this.domNode,this.baseClass);
225 },_local2NativeFormatNames:{},_native2LocalFormatNames:{},_getIframeDocTxt:function(){
226 var _15=dojo.getComputedStyle(this.domNode);
229 if(dojo.isIE||(!this.height&&!dojo.isMoz)){
230 _16="<div id='dijitEditorBody'></div>";
234 this._cursorToStart=true;
238 var _18=[_15.fontWeight,_15.fontSize,_15.fontFamily].join(" ");
239 var _19=_15.lineHeight;
240 if(_19.indexOf("px")>=0){
241 _19=parseFloat(_19)/parseFloat(_15.fontSize);
243 if(_19.indexOf("em")>=0){
251 this.style.replace(/(^|;)\s*(line-|font-?)[^;]+/ig,function(_1c){
252 _1c=_1c.replace(/^;/ig,"")+";";
253 var s=_1c.split(":")[0];
259 for(i=0;i<s.length;i++){
264 c=s.charAt(i).toUpperCase();
269 dojo.style(_1b.domNode,sC,"");
273 var _1d=dojo.query("label[for=\""+this.id+"\"]");
274 return [this.isLeftToRight()?"<html>\n<head>\n":"<html dir='rtl'>\n<head>\n",(dojo.isMoz&&_1d.length?"<title>"+_1d[0].innerHTML+"</title>\n":""),"<meta http-equiv='Content-Type' content='text/html'>\n","<style>\n","\tbody,html {\n","\t\tbackground:transparent;\n","\t\tpadding: 1px 0 0 0;\n","\t\tmargin: -1px 0 0 0;\n",((dojo.isWebKit)?"\t\twidth: 100%;\n":""),((dojo.isWebKit)?"\t\theight: 100%;\n":""),"\t}\n","\tbody{\n","\t\ttop:0px;\n","\t\tleft:0px;\n","\t\tright:0px;\n","\t\tfont:",_18,";\n",((this.height||dojo.isOpera)?"":"\t\tposition: fixed;\n"),"\t\tmin-height:",this.minHeight,";\n","\t\tline-height:",_19,";\n","\t}\n","\tp{ margin: 1em 0; }\n",(!_17&&!this.height?"\tbody,html {overflow-y: hidden;}\n":""),"\t#dijitEditorBody{overflow-x: auto; overflow-y:"+(this.height?"auto;":"hidden;")+"}\n","\tli > ul:-moz-first-node, li > ol:-moz-first-node{ padding-top: 1.2em; }\n","\tli{ min-height:1.2em; }\n","</style>\n",this._applyEditingAreaStyleSheets(),"\n","</head>\n<body ",(_17?"id='dijitEditorBody' ":""),"onload='frameElement._loadFunc(window,document)' style='"+_1a+"'>",_16,"</body>\n</html>"].join("");
275 },_applyEditingAreaStyleSheets:function(){
277 if(this.styleSheets){
278 _1e=this.styleSheets.split(";");
281 _1e=_1e.concat(this.editingAreaStyleSheets);
282 this.editingAreaStyleSheets=[];
284 while((url=_1e[i++])){
285 var _20=(new dojo._Url(dojo.global.location,url)).toString();
286 this.editingAreaStyleSheets.push(_20);
287 _1f+="<link rel=\"stylesheet\" type=\"text/css\" href=\""+_20+"\"/>";
290 },addStyleSheet:function(uri){
291 var url=uri.toString();
292 if(url.charAt(0)=="."||(url.charAt(0)!="/"&&!uri.host)){
293 url=(new dojo._Url(dojo.global.location,url)).toString();
295 if(dojo.indexOf(this.editingAreaStyleSheets,url)>-1){
298 this.editingAreaStyleSheets.push(url);
299 this.onLoadDeferred.addCallback(dojo.hitch(function(){
300 if(this.document.createStyleSheet){
301 this.document.createStyleSheet(url);
303 var _21=this.document.getElementsByTagName("head")[0];
304 var _22=this.document.createElement("link");
305 _22.rel="stylesheet";
308 _21.appendChild(_22);
311 },removeStyleSheet:function(uri){
312 var url=uri.toString();
313 if(url.charAt(0)=="."||(url.charAt(0)!="/"&&!uri.host)){
314 url=(new dojo._Url(dojo.global.location,url)).toString();
316 var _23=dojo.indexOf(this.editingAreaStyleSheets,url);
320 delete this.editingAreaStyleSheets[_23];
321 dojo.withGlobal(this.window,"query",dojo,["link:[href=\""+url+"\"]"]).orphan();
322 },disabled:false,_mozSettingProps:{"styleWithCSS":false},_setDisabledAttr:function(_24){
328 if(dojo.isIE||dojo.isWebKit||dojo.isOpera){
329 var _25=dojo.isIE&&(this.isLoaded||!this.focusOnLoad);
331 this.editNode.unselectable="on";
333 this.editNode.contentEditable=!_24;
336 setTimeout(function(){
337 _26.editNode.unselectable="off";
342 this.document.designMode=(_24?"off":"on");
347 if(!_24&&this._mozSettingProps){
348 var ps=this._mozSettingProps;
350 if(ps.hasOwnProperty(n)){
352 this.document.execCommand(n,false,ps[n]);
360 this._disabledOK=true;
361 },onLoad:function(_27){
362 if(!this.window.__registeredWindow){
363 this.window.__registeredWindow=true;
364 this._iframeRegHandle=dijit.registerIframe(this.iframe);
366 if(!dojo.isIE&&(this.height||dojo.isMoz)){
367 this.editNode=this.document.body;
369 this.editNode=this.document.body.firstChild;
372 var _29=(this.tabStop=dojo.doc.createElement("<div tabIndex=-1>"));
373 this.editingArea.appendChild(_29);
374 this.iframe.onfocus=function(){
375 _28.editNode.setActive();
379 this.focusNode=this.editNode;
380 var _2a=this.events.concat(this.captureEvents);
381 var ap=this.iframe?this.document:this.editNode;
382 dojo.forEach(_2a,function(_2b){
383 this.connect(ap,_2b.toLowerCase(),_2b);
386 this.connect(this.document,"onmousedown","_onIEMouseDown");
387 this.editNode.style.zoom=1;
389 this.connect(this.document,"onmousedown",function(){
390 delete this._cursorToStart;
394 this._webkitListener=this.connect(this.document,"onmouseup","onDisplayChanged");
398 this.document.execCommand("RespectVisibilityInDesign",true,null);
404 this.set("disabled",this.disabled);
405 var _2c=dojo.hitch(this,function(){
407 if(this.onLoadDeferred){
408 this.onLoadDeferred.callback(true);
410 this.onDisplayChanged();
411 if(this.focusOnLoad){
412 dojo.addOnLoad(dojo.hitch(this,function(){
413 setTimeout(dojo.hitch(this,"focus"),this.updateInterval);
416 this.savedContent=this.getValue(true);
418 if(this.setValueDeferred){
419 this.setValueDeferred.addCallback(_2c);
423 },onKeyDown:function(e){
424 if(e.keyCode===dojo.keys.TAB&&this.isTabIndent){
426 if(this.queryCommandEnabled((e.shiftKey?"outdent":"indent"))){
427 this.execCommand((e.shiftKey?"outdent":"indent"));
431 if(e.keyCode==dojo.keys.TAB&&!this.isTabIndent){
432 if(e.shiftKey&&!e.ctrlKey&&!e.altKey){
435 if(!e.shiftKey&&!e.ctrlKey&&!e.altKey){
436 this.tabStop.focus();
440 if(e.keyCode===dojo.keys.BACKSPACE&&this.document.selection.type==="Control"){
442 this.execCommand("delete");
444 if((65<=e.keyCode&&e.keyCode<=90)||(e.keyCode>=37&&e.keyCode<=40)){
445 e.charCode=e.keyCode;
452 },onKeyUp:function(e){
454 },setDisabled:function(_2d){
455 dojo.deprecated("dijit.Editor::setDisabled is deprecated","use dijit.Editor::attr(\"disabled\",boolean) instead",2);
456 this.set("disabled",_2d);
457 },_setValueAttr:function(_2e){
459 },_setDisableSpellCheckAttr:function(_2f){
461 dojo.attr(this.document.body,"spellcheck",!_2f);
463 this.onLoadDeferred.addCallback(dojo.hitch(this,function(){
464 dojo.attr(this.document.body,"spellcheck",!_2f);
467 this.disableSpellCheck=_2f;
468 },onKeyPress:function(e){
469 var c=(e.keyChar&&e.keyChar.toLowerCase())||e.keyCode,_30=this._keyHandlers[c],_31=arguments;
471 dojo.some(_30,function(h){
472 if(!(h.shift^e.shiftKey)&&!(h.ctrl^(e.ctrlKey||e.metaKey))){
473 if(!h.handler.apply(this,_31)){
480 if(!this._onKeyHitch){
481 this._onKeyHitch=dojo.hitch(this,"onKeyPressed");
483 setTimeout(this._onKeyHitch,1);
485 },addKeyHandler:function(key,_32,_33,_34){
486 if(!dojo.isArray(this._keyHandlers[key])){
487 this._keyHandlers[key]=[];
489 this._keyHandlers[key].push({shift:_33||false,ctrl:_32||false,handler:_34});
490 },onKeyPressed:function(){
491 this.onDisplayChanged();
492 },onClick:function(e){
493 this.onDisplayChanged(e);
494 },_onIEMouseDown:function(e){
495 if(!this._focused&&!this.disabled){
498 },_onBlur:function(e){
499 this.inherited(arguments);
500 var _35=this.getValue(true);
501 if(_35!=this.savedContent){
503 this.savedContent=_35;
505 },_onFocus:function(e){
507 if(!this._disabledOK){
508 this.set("disabled",false);
510 this.inherited(arguments);
513 if(!dojo.isIE&&this.window.document.documentElement&&this.window.document.documentElement.focus){
514 this.window.document.documentElement.focus();
516 if(dojo.doc.body.focus){
517 dojo.doc.body.focus();
522 this.focusOnLoad=true;
525 if(this._cursorToStart){
526 delete this._cursorToStart;
527 if(this.editNode.childNodes){
528 this.placeCursorAtStart();
533 dijit.focus(this.iframe);
535 if(this.editNode&&this.editNode.focus){
536 this.iframe.fireEvent("onfocus",document.createEventObject());
539 },updateInterval:200,_updateTimer:null,onDisplayChanged:function(e){
540 if(this._updateTimer){
541 clearTimeout(this._updateTimer);
543 if(!this._updateHandler){
544 this._updateHandler=dojo.hitch(this,"onNormalizedDisplayChanged");
546 this._updateTimer=setTimeout(this._updateHandler,this.updateInterval);
547 },onNormalizedDisplayChanged:function(){
548 delete this._updateTimer;
549 },onChange:function(_36){
550 },_normalizeCommand:function(cmd,_37){
551 var _38=cmd.toLowerCase();
552 if(_38=="formatblock"){
553 if(dojo.isSafari&&_37===undefined){
557 if(_38=="hilitecolor"&&!dojo.isMoz){
562 },_qcaCache:{},queryCommandAvailable:function(_39){
563 var ca=this._qcaCache[_39];
567 return (this._qcaCache[_39]=this._queryCommandAvailable(_39));
568 },_queryCommandAvailable:function(_3a){
575 return {ie:Boolean(_40&ie),mozilla:Boolean(_40&_3b),webkit:Boolean(_40&_3c),webkit420:Boolean(_40&_3e),opera:Boolean(_40&_3d)};
578 switch(_3a.toLowerCase()){
588 case "justifycenter":
595 _41=_3f(_3b|ie|_3c|_3d);
600 case "inserthorizontalrule":
602 case "insertorderedlist":
603 case "insertunorderedlist":
610 case "strikethrough":
612 _41=_3f(_3b|ie|_3d|_3e);
643 return (dojo.isIE&&_41.ie)||(dojo.isMoz&&_41.mozilla)||(dojo.isWebKit&&_41.webkit)||(dojo.isWebKit>420&&_41.webkit420)||(dojo.isOpera&&_41.opera);
644 },execCommand:function(_42,_43){
647 _42=this._normalizeCommand(_42,_43);
650 throw new Error("unimplemented");
652 if((_42=="formatblock")&&dojo.isIE){
657 var _45="_"+_42+"Impl";
661 _43=arguments.length>1?_43:null;
662 if(_43||_42!="createlink"){
663 _44=this.document.execCommand(_42,false,_43);
666 this.onDisplayChanged();
668 },queryCommandEnabled:function(_46){
669 if(this.disabled||!this._disabledOK){
672 _46=this._normalizeCommand(_46);
673 if(dojo.isMoz||dojo.isWebKit){
675 return this._sCall("hasAncestorElement",["a"]);
677 if(_46=="inserttable"){
691 var _47=dojo.isIE?this.document.selection.createRange():this.document;
693 return _47.queryCommandEnabled(_46);
698 },queryCommandState:function(_48){
699 if(this.disabled||!this._disabledOK){
702 _48=this._normalizeCommand(_48);
704 return this.document.queryCommandState(_48);
709 },queryCommandValue:function(_49){
710 if(this.disabled||!this._disabledOK){
714 _49=this._normalizeCommand(_49);
715 if(dojo.isIE&&_49=="formatblock"){
716 r=this._native2LocalFormatNames[this.document.queryCommandValue(_49)];
718 if(dojo.isMoz&&_49==="hilitecolor"){
721 _4a=this.document.queryCommandValue("styleWithCSS");
726 this.document.execCommand("styleWithCSS",false,true);
727 r=this.document.queryCommandValue(_49);
728 this.document.execCommand("styleWithCSS",false,_4a);
730 r=this.document.queryCommandValue(_49);
734 },_sCall:function(_4b,_4c){
735 return dojo.withGlobal(this.window,_4b,dijit._editor.selection,_4c);
736 },placeCursorAtStart:function(){
740 var _4e=this.editNode.firstChild;
743 if(_4e.nodeValue.replace(/^\s+|\s+$/g,"").length>0){
745 this._sCall("selectElement",[_4e]);
751 var tg=_4e.tagName?_4e.tagName.toLowerCase():"";
752 if(/br|input|img|base|meta|area|basefont|hr|link/.test(tg)){
753 this._sCall("selectElement",[_4e]);
755 this._sCall("selectElementChildren",[_4e]);
764 this._sCall("selectElementChildren",[this.editNode]);
767 this._sCall("collapse",[true]);
769 },placeCursorAtEnd:function(){
773 var _50=this.editNode.lastChild;
776 if(_50.nodeValue.replace(/^\s+|\s+$/g,"").length>0){
778 this._sCall("selectElement",[_50]);
785 this._sCall("selectElement",[_50.lastChild]);
787 this._sCall("selectElement",[_50]);
792 _50=_50.previousSibling;
796 this._sCall("selectElementChildren",[this.editNode]);
799 this._sCall("collapse",[false]);
801 },getValue:function(_51){
803 if(this.isClosed||!this.isLoaded){
804 return this.textarea.value;
807 return this._postFilterContent(null,_51);
808 },_getValueAttr:function(){
809 return this.getValue(true);
810 },setValue:function(_52){
812 this.onLoadDeferred.addCallback(dojo.hitch(this,function(){
817 this._cursorToStart=true;
818 if(this.textarea&&(this.isClosed||!this.isLoaded)){
819 this.textarea.value=_52;
821 _52=this._preFilterContent(_52);
822 var _53=this.isClosed?this.domNode:this.editNode;
823 if(!_52&&dojo.isWebKit){
827 this._preDomFilterContent(_53);
829 this.onDisplayChanged();
830 },replaceValue:function(_54){
834 if(this.window&&this.window.getSelection&&!dojo.isMoz){
837 if(this.window&&this.window.getSelection){
838 _54=this._preFilterContent(_54);
839 this.execCommand("selectall");
841 this._cursorToStart=true;
844 this.execCommand("inserthtml",_54);
845 this._preDomFilterContent(this.editNode);
847 if(this.document&&this.document.selection){
853 },_preFilterContent:function(_55){
855 dojo.forEach(this.contentPreFilters,function(ef){
861 },_preDomFilterContent:function(dom){
862 dom=dom||this.editNode;
863 dojo.forEach(this.contentDomPreFilters,function(ef){
864 if(ef&&dojo.isFunction(ef)){
868 },_postFilterContent:function(dom,_56){
870 if(!dojo.isString(dom)){
871 dom=dom||this.editNode;
872 if(this.contentDomPostFilters.length){
876 dojo.forEach(this.contentDomPostFilters,function(ef){
880 ec=dijit._editor.getChildrenHtml(dom);
884 if(!dojo.trim(ec.replace(/^\xA0\xA0*/,"").replace(/\xA0\xA0*$/,"")).length){
887 dojo.forEach(this.contentPostFilters,function(ef){
891 },_saveContent:function(e){
892 var _57=dojo.byId(dijit._scopeName+"._editor.RichText.savedContent");
894 _57.value+=this._SEPARATOR;
896 _57.value+=this.name+":"+this.getValue(true);
897 },escapeXml:function(str,_58){
898 str=str.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">").replace(/"/gm,""");
900 str=str.replace(/'/gm,"'");
903 },getNodeHtml:function(_59){
904 dojo.deprecated("dijit.Editor::getNodeHtml is deprecated","use dijit._editor.getNodeHtml instead",2);
905 return dijit._editor.getNodeHtml(_59);
906 },getNodeChildrenHtml:function(dom){
907 dojo.deprecated("dijit.Editor::getNodeChildrenHtml is deprecated","use dijit._editor.getChildrenHtml instead",2);
908 return dijit._editor.getChildrenHtml(dom);
909 },close:function(_5a){
913 if(!arguments.length){
916 this._content=this.getValue();
917 var _5b=(this.savedContent!=this._content);
919 clearInterval(this.interval);
921 if(this._webkitListener){
922 this.disconnect(this._webkitListener);
923 delete this._webkitListener;
926 this.iframe.onfocus=null;
928 this.iframe._loadFunc=null;
929 if(this._iframeRegHandle){
930 dijit.unregisterIframe(this._iframeRegHandle);
931 delete this._iframeRegHandle;
934 var s=this.textarea.style;
938 s.overflow=this.__overflow;
939 this.__overflow=null;
941 this.textarea.value=_5a?this._content:this.savedContent;
942 dojo.destroy(this.domNode);
943 this.domNode=this.textarea;
945 this.domNode.innerHTML=_5a?this._content:this.savedContent;
948 dojo.removeClass(this.domNode,this.baseClass);
951 delete this.editNode;
952 delete this.focusNode;
953 if(this.window&&this.window._frameElement){
954 this.window._frameElement=null;
958 this.editingArea=null;
959 this.editorObject=null;
961 },destroy:function(){
965 this.inherited(arguments);
966 },_removeMozBogus:function(_5c){
967 return _5c.replace(/\stype="_moz"/gi,"").replace(/\s_moz_dirty=""/gi,"").replace(/_moz_resizing="(true|false)"/gi,"");
968 },_removeWebkitBogus:function(_5d){
969 _5d=_5d.replace(/\sclass="webkit-block-placeholder"/gi,"");
970 _5d=_5d.replace(/\sclass="apple-style-span"/gi,"");
972 },_normalizeFontStyle:function(_5e){
973 return _5e.replace(/<(\/)?strong([ \>])/gi,"<$1b$2").replace(/<(\/)?em([ \>])/gi,"<$1i$2");
974 },_preFixUrlAttributes:function(_5f){
975 return _5f.replace(/(?:(<a(?=\s).*?\shref=)("|')(.*?)\2)|(?:(<a\s.*?href=)([^"'][^ >]+))/gi,"$1$4$2$3$5$2 _djrealurl=$2$3$5$2").replace(/(?:(<img(?=\s).*?\ssrc=)("|')(.*?)\2)|(?:(<img\s.*?src=)([^"'][^ >]+))/gi,"$1$4$2$3$5$2 _djrealurl=$2$3$5$2");
976 },_inserthorizontalruleImpl:function(_60){
978 return this._inserthtmlImpl("<hr>");
980 return this.document.execCommand("inserthorizontalrule",false,_60);
981 },_unlinkImpl:function(_61){
982 if((this.queryCommandEnabled("unlink"))&&(dojo.isMoz||dojo.isWebKit)){
983 var a=this._sCall("getAncestorElement",["a"]);
984 this._sCall("selectElement",[a]);
985 return this.document.execCommand("unlink",false,null);
987 return this.document.execCommand("unlink",false,_61);
988 },_hilitecolorImpl:function(_62){
991 this.document.execCommand("styleWithCSS",false,true);
992 _63=this.document.execCommand("hilitecolor",false,_62);
993 this.document.execCommand("styleWithCSS",false,false);
995 _63=this.document.execCommand("hilitecolor",false,_62);
998 },_backcolorImpl:function(_64){
1002 return this.document.execCommand("backcolor",false,_64);
1003 },_forecolorImpl:function(_65){
1007 return this.document.execCommand("forecolor",false,_65);
1008 },_inserthtmlImpl:function(_66){
1009 _66=this._preFilterContent(_66);
1012 var _67=this.document.selection.createRange();
1013 if(this.document.selection.type.toUpperCase()=="CONTROL"){
1016 _67.remove(_67.item(0));
1024 if(dojo.isMoz&&!_66.length){
1025 this._sCall("remove");
1027 rv=this.document.execCommand("inserthtml",false,_66);
1031 },getHeaderHeight:function(){
1032 return this._getNodeChildrenHeight(this.header);
1033 },getFooterHeight:function(){
1034 return this._getNodeChildrenHeight(this.footer);
1035 },_getNodeChildrenHeight:function(_68){
1037 if(_68&&_68.childNodes){
1039 for(i=0;i<_68.childNodes.length;i++){
1040 var _69=dojo.position(_68.childNodes[i]);