From 81bea17aefb26859f825b9293c7c99192874806e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 8 Nov 2011 20:40:44 +0400 Subject: upgrade Dojo to 1.6.1 --- lib/dijit/_editor/RichText.js | 3112 ++++++++++++++++-------- lib/dijit/_editor/_Plugin.js | 342 ++- lib/dijit/_editor/html.js | 318 +-- lib/dijit/_editor/nls/ar/FontChoice.js | 2 +- lib/dijit/_editor/nls/ar/LinkDialog.js | 2 +- lib/dijit/_editor/nls/ar/commands.js | 2 +- lib/dijit/_editor/nls/ca/FontChoice.js | 2 +- lib/dijit/_editor/nls/ca/LinkDialog.js | 2 +- lib/dijit/_editor/nls/ca/commands.js | 2 +- lib/dijit/_editor/nls/cs/FontChoice.js | 2 +- lib/dijit/_editor/nls/cs/commands.js | 2 +- lib/dijit/_editor/nls/da/FontChoice.js | 2 +- lib/dijit/_editor/nls/da/commands.js | 2 +- lib/dijit/_editor/nls/de/FontChoice.js | 2 +- lib/dijit/_editor/nls/el/FontChoice.js | 2 +- lib/dijit/_editor/nls/es/FontChoice.js | 2 +- lib/dijit/_editor/nls/es/LinkDialog.js | 2 +- lib/dijit/_editor/nls/fi/FontChoice.js | 2 +- lib/dijit/_editor/nls/fr/FontChoice.js | 2 +- lib/dijit/_editor/nls/fr/LinkDialog.js | 2 +- lib/dijit/_editor/nls/fr/commands.js | 2 +- lib/dijit/_editor/nls/he/FontChoice.js | 2 +- lib/dijit/_editor/nls/he/LinkDialog.js | 2 +- lib/dijit/_editor/nls/he/commands.js | 2 +- lib/dijit/_editor/nls/hu/FontChoice.js | 2 +- lib/dijit/_editor/nls/it/FontChoice.js | 2 +- lib/dijit/_editor/nls/it/LinkDialog.js | 2 +- lib/dijit/_editor/nls/it/commands.js | 2 +- lib/dijit/_editor/nls/ja/FontChoice.js | 2 +- lib/dijit/_editor/nls/ja/commands.js | 2 +- lib/dijit/_editor/nls/kk/FontChoice.js | 1 + lib/dijit/_editor/nls/kk/LinkDialog.js | 1 + lib/dijit/_editor/nls/kk/commands.js | 1 + lib/dijit/_editor/nls/ko/FontChoice.js | 2 +- lib/dijit/_editor/nls/ko/LinkDialog.js | 2 +- lib/dijit/_editor/nls/ko/commands.js | 2 +- lib/dijit/_editor/nls/nb/FontChoice.js | 2 +- lib/dijit/_editor/nls/nb/commands.js | 2 +- lib/dijit/_editor/nls/nl/FontChoice.js | 2 +- lib/dijit/_editor/nls/pl/FontChoice.js | 2 +- lib/dijit/_editor/nls/pl/commands.js | 2 +- lib/dijit/_editor/nls/pt-pt/FontChoice.js | 2 +- lib/dijit/_editor/nls/pt-pt/commands.js | 2 +- lib/dijit/_editor/nls/pt/FontChoice.js | 2 +- lib/dijit/_editor/nls/pt/commands.js | 2 +- lib/dijit/_editor/nls/ro/LinkDialog.js | 2 +- lib/dijit/_editor/nls/ro/commands.js | 2 +- lib/dijit/_editor/nls/ru/FontChoice.js | 2 +- lib/dijit/_editor/nls/ru/LinkDialog.js | 2 +- lib/dijit/_editor/nls/sk/FontChoice.js | 2 +- lib/dijit/_editor/nls/sl/FontChoice.js | 2 +- lib/dijit/_editor/nls/sl/LinkDialog.js | 2 +- lib/dijit/_editor/nls/sl/commands.js | 2 +- lib/dijit/_editor/nls/sv/FontChoice.js | 2 +- lib/dijit/_editor/nls/th/FontChoice.js | 2 +- lib/dijit/_editor/nls/th/LinkDialog.js | 2 +- lib/dijit/_editor/nls/tr/FontChoice.js | 2 +- lib/dijit/_editor/nls/zh-tw/FontChoice.js | 2 +- lib/dijit/_editor/nls/zh-tw/commands.js | 2 +- lib/dijit/_editor/nls/zh/FontChoice.js | 2 +- lib/dijit/_editor/nls/zh/LinkDialog.js | 2 +- lib/dijit/_editor/plugins/AlwaysShowToolbar.js | 293 ++- lib/dijit/_editor/plugins/EnterKeyHandling.js | 1007 ++++---- lib/dijit/_editor/plugins/FontChoice.js | 812 +++++-- lib/dijit/_editor/plugins/FullScreen.js | 647 +++-- lib/dijit/_editor/plugins/LinkDialog.js | 714 ++++-- lib/dijit/_editor/plugins/NewPage.js | 93 +- lib/dijit/_editor/plugins/Print.js | 166 +- lib/dijit/_editor/plugins/TabIndent.js | 80 +- lib/dijit/_editor/plugins/TextColor.js | 143 +- lib/dijit/_editor/plugins/ToggleDir.js | 98 +- lib/dijit/_editor/plugins/ViewSource.js | 844 ++++--- lib/dijit/_editor/range.js | 950 ++++---- lib/dijit/_editor/selection.js | 620 +++-- 74 files changed, 6688 insertions(+), 3664 deletions(-) create mode 100644 lib/dijit/_editor/nls/kk/FontChoice.js create mode 100644 lib/dijit/_editor/nls/kk/LinkDialog.js create mode 100644 lib/dijit/_editor/nls/kk/commands.js (limited to 'lib/dijit/_editor') diff --git a/lib/dijit/_editor/RichText.js b/lib/dijit/_editor/RichText.js index 696715986..978371557 100644 --- a/lib/dijit/_editor/RichText.js +++ b/lib/dijit/_editor/RichText.js @@ -1,1046 +1,2096 @@ /* - Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ -if(!dojo._hasResource["dijit._editor.RichText"]){ -dojo._hasResource["dijit._editor.RichText"]=true; +if(!dojo._hasResource["dijit._editor.RichText"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dijit._editor.RichText"] = true; dojo.provide("dijit._editor.RichText"); dojo.require("dijit._Widget"); dojo.require("dijit._CssStateMixin"); dojo.require("dijit._editor.selection"); dojo.require("dijit._editor.range"); dojo.require("dijit._editor.html"); -if(!dojo.config["useXDomain"]||dojo.config["allowXdRichTextSave"]){ -if(dojo._postLoad){ -(function(){ -var _1=dojo.doc.createElement("textarea"); -_1.id=dijit._scopeName+"._editor.RichText.savedContent"; -dojo.style(_1,{display:"none",position:"absolute",top:"-100px",height:"3px",width:"3px"}); -dojo.body().appendChild(_1); -})(); -}else{ -try{ -dojo.doc.write(""); -} -catch(e){ -} -} -} -dojo.declare("dijit._editor.RichText",[dijit._Widget,dijit._CssStateMixin],{constructor:function(_2){ -this.contentPreFilters=[]; -this.contentPostFilters=[]; -this.contentDomPreFilters=[]; -this.contentDomPostFilters=[]; -this.editingAreaStyleSheets=[]; -this.events=[].concat(this.events); -this._keyHandlers={}; -this.contentPreFilters.push(dojo.hitch(this,"_preFixUrlAttributes")); -if(dojo.isMoz){ -this.contentPreFilters.push(this._normalizeFontStyle); -this.contentPostFilters.push(this._removeMozBogus); -} -if(dojo.isWebKit){ -this.contentPreFilters.push(this._removeWebkitBogus); -this.contentPostFilters.push(this._removeWebkitBogus); -} -if(dojo.isIE){ -this.contentPostFilters.push(this._normalizeFontStyle); -} -if(_2&&dojo.isString(_2.value)){ -this.value=_2.value; -} -this.onLoadDeferred=new dojo.Deferred(); -},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(){ -if("textarea"==this.domNode.tagName.toLowerCase()){ -console.warn("RichText should not be used with the TEXTAREA tag. See dijit._editor.RichText docs."); -} -this.inherited(arguments); -dojo.publish(dijit._scopeName+"._editor.RichText::init",[this]); -this.open(); -this.setupDefaultShortcuts(); -},setupDefaultShortcuts:function(){ -var _3=dojo.hitch(this,function(_4,_5){ -return function(){ -return !this.execCommand(_4,_5); -}; -}); -var _6={b:_3("bold"),i:_3("italic"),u:_3("underline"),a:_3("selectall"),s:function(){ -this.save(true); -},m:function(){ -this.isTabIndent=!this.isTabIndent; -},"1":_3("formatblock","h1"),"2":_3("formatblock","h2"),"3":_3("formatblock","h3"),"4":_3("formatblock","h4"),"\\":_3("insertunorderedlist")}; -if(!dojo.isIE){ -_6.Z=_3("redo"); -} -for(var _7 in _6){ -this.addKeyHandler(_7,true,false,_6[_7]); -} -},events:["onKeyPress","onKeyDown","onKeyUp","onClick"],captureEvents:[],_editorCommandsLocalized:false,_localizeEditorCommands:function(){ -if(this._editorCommandsLocalized){ -return; -} -this._editorCommandsLocalized=true; -var _8=["div","p","pre","h1","h2","h3","h4","h5","h6","ol","ul","address"]; -var _9="",_a,i=0; -while((_a=_8[i++])){ -if(_a.charAt(1)!="l"){ -_9+="<"+_a+">content
"; -}else{ -_9+="<"+_a+">
  • content

  • "; -} -} -var _b=dojo.doc.createElement("div"); -dojo.style(_b,{position:"absolute",top:"-2000px"}); -dojo.doc.body.appendChild(_b); -_b.innerHTML=_9; -var _c=_b.firstChild; -while(_c){ -dijit._editor.selection.selectElement(_c.firstChild); -dojo.withGlobal(this.window,"selectElement",dijit._editor.selection,[_c.firstChild]); -var _d=_c.tagName.toLowerCase(); -this._local2NativeFormatNames[_d]=document.queryCommandValue("formatblock"); -this._native2LocalFormatNames[this._local2NativeFormatNames[_d]]=_d; -_c=_c.nextSibling.nextSibling; -} -dojo.body().removeChild(_b); -},open:function(_e){ -if(!this.onLoadDeferred||this.onLoadDeferred.fired>=0){ -this.onLoadDeferred=new dojo.Deferred(); -} -if(!this.isClosed){ -this.close(); -} -dojo.publish(dijit._scopeName+"._editor.RichText::open",[this]); -this._content=""; -if(arguments.length==1&&_e.nodeName){ -this.domNode=_e; -} -var dn=this.domNode; -var _f; -if(dojo.isString(this.value)){ -_f=this.value; -delete this.value; -dn.innerHTML=""; -}else{ -if(dn.nodeName&&dn.nodeName.toLowerCase()=="textarea"){ -var ta=(this.textarea=dn); -this.name=ta.name; -_f=ta.value; -dn=this.domNode=dojo.doc.createElement("div"); -dn.setAttribute("widgetId",this.id); -ta.removeAttribute("widgetId"); -dn.cssText=ta.cssText; -dn.className+=" "+ta.className; -dojo.place(dn,ta,"before"); -var _10=dojo.hitch(this,function(){ -dojo.style(ta,{display:"block",position:"absolute",top:"-1000px"}); -if(dojo.isIE){ -var s=ta.style; -this.__overflow=s.overflow; -s.overflow="hidden"; -} -}); -if(dojo.isIE){ -setTimeout(_10,10); -}else{ -_10(); -} -if(ta.form){ -dojo.connect(ta.form,"onsubmit",this,function(){ -ta.value=this.getValue(); -}); -} -}else{ -_f=dijit._editor.getChildrenHtml(dn); -dn.innerHTML=""; -} -} -var _11=dojo.contentBox(dn); -this._oldHeight=_11.h; -this._oldWidth=_11.w; -this.savedContent=_f; -if(dn.nodeName&&dn.nodeName=="LI"){ -dn.innerHTML="
    "; -} -this.header=dn.ownerDocument.createElement("div"); -dn.appendChild(this.header); -this.editingArea=dn.ownerDocument.createElement("div"); -dn.appendChild(this.editingArea); -this.footer=dn.ownerDocument.createElement("div"); -dn.appendChild(this.footer); -if(this.name!==""&&(!dojo.config["useXDomain"]||dojo.config["allowXdRichTextSave"])){ -var _12=dojo.byId(dijit._scopeName+"._editor.RichText.savedContent"); -if(_12.value!==""){ -var _13=_12.value.split(this._SEPARATOR),i=0,dat; -while((dat=_13[i++])){ -var _14=dat.split(":"); -if(_14[0]==this.name){ -_f=_14[1]; -_13.splice(i,1); -break; -} -} -} -dojo.addOnUnload(dojo.hitch(this,"_saveContent")); -} -this.isClosed=false; -var ifr=(this.editorObject=this.iframe=dojo.doc.createElement("iframe")); -ifr.id=this.id+"_iframe"; -this._iframeSrc=this._getIframeDocTxt(); -ifr.style.border="none"; -ifr.style.width="100%"; -if(this._layoutMode){ -ifr.style.height="100%"; -}else{ -if(dojo.isIE>=7){ -if(this.height){ -ifr.style.height=this.height; -} -if(this.minHeight){ -ifr.style.minHeight=this.minHeight; -} -}else{ -ifr.style.height=this.height?this.height:this.minHeight; -} -} -ifr.frameBorder=0; -ifr._loadFunc=dojo.hitch(this,function(win){ -this.window=win; -this.document=this.window.document; -if(dojo.isIE){ -this._localizeEditorCommands(); -} -this.onLoad(_f); -}); -var s="javascript:parent."+dijit._scopeName+".byId(\""+this.id+"\")._iframeSrc"; -ifr.setAttribute("src",s); -this.editingArea.appendChild(ifr); -if(dn.nodeName=="LI"){ -dn.lastChild.style.marginTop="-1.2em"; -} -dojo.addClass(this.domNode,this.baseClass); -},_local2NativeFormatNames:{},_native2LocalFormatNames:{},_getIframeDocTxt:function(){ -var _15=dojo.getComputedStyle(this.domNode); -var _16=""; -var _17=true; -if(dojo.isIE||(!this.height&&!dojo.isMoz)){ -_16="
    "; -_17=false; -}else{ -if(dojo.isMoz){ -this._cursorToStart=true; -_16=" "; -} -} -var _18=[_15.fontWeight,_15.fontSize,_15.fontFamily].join(" "); -var _19=_15.lineHeight; -if(_19.indexOf("px")>=0){ -_19=parseFloat(_19)/parseFloat(_15.fontSize); -}else{ -if(_19.indexOf("em")>=0){ -_19=parseFloat(_19); -}else{ -_19="normal"; -} -} -var _1a=""; -var _1b=this; -this.style.replace(/(^|;)\s*(line-|font-?)[^;]+/ig,function(_1c){ -_1c=_1c.replace(/^;/ig,"")+";"; -var s=_1c.split(":")[0]; -if(s){ -s=dojo.trim(s); -s=s.toLowerCase(); -var i; -var sC=""; -for(i=0;i\n\n":"\n\n",(dojo.isMoz&&_1d.length?""+_1d[0].innerHTML+"\n":""),"\n","\n",this._applyEditingAreaStyleSheets(),"\n","\n",_16,"\n"].join(""); -},_applyEditingAreaStyleSheets:function(){ -var _1e=[]; -if(this.styleSheets){ -_1e=this.styleSheets.split(";"); -this.styleSheets=""; -} -_1e=_1e.concat(this.editingAreaStyleSheets); -this.editingAreaStyleSheets=[]; -var _1f="",i=0,url; -while((url=_1e[i++])){ -var _20=(new dojo._Url(dojo.global.location,url)).toString(); -this.editingAreaStyleSheets.push(_20); -_1f+=""; -} -return _1f; -},addStyleSheet:function(uri){ -var url=uri.toString(); -if(url.charAt(0)=="."||(url.charAt(0)!="/"&&!uri.host)){ -url=(new dojo._Url(dojo.global.location,url)).toString(); -} -if(dojo.indexOf(this.editingAreaStyleSheets,url)>-1){ -return; -} -this.editingAreaStyleSheets.push(url); -this.onLoadDeferred.addCallback(dojo.hitch(function(){ -if(this.document.createStyleSheet){ -this.document.createStyleSheet(url); -}else{ -var _21=this.document.getElementsByTagName("head")[0]; -var _22=this.document.createElement("link"); -_22.rel="stylesheet"; -_22.type="text/css"; -_22.href=url; -_21.appendChild(_22); -} -})); -},removeStyleSheet:function(uri){ -var url=uri.toString(); -if(url.charAt(0)=="."||(url.charAt(0)!="/"&&!uri.host)){ -url=(new dojo._Url(dojo.global.location,url)).toString(); -} -var _23=dojo.indexOf(this.editingAreaStyleSheets,url); -if(_23==-1){ -return; -} -delete this.editingAreaStyleSheets[_23]; -dojo.withGlobal(this.window,"query",dojo,["link:[href=\""+url+"\"]"]).orphan(); -},disabled:false,_mozSettingProps:{"styleWithCSS":false},_setDisabledAttr:function(_24){ -this.disabled=_24; -if(!this.isLoaded){ -return; -} -_24=!!_24; -if(dojo.isIE||dojo.isWebKit||dojo.isOpera){ -var _25=dojo.isIE&&(this.isLoaded||!this.focusOnLoad); -if(_25){ -this.editNode.unselectable="on"; -} -this.editNode.contentEditable=!_24; -if(_25){ -var _26=this; -setTimeout(function(){ -_26.editNode.unselectable="off"; -},0); -} -}else{ -try{ -this.document.designMode=(_24?"off":"on"); -} -catch(e){ -return; -} -if(!_24&&this._mozSettingProps){ -var ps=this._mozSettingProps; -for(var n in ps){ -if(ps.hasOwnProperty(n)){ -try{ -this.document.execCommand(n,false,ps[n]); -} -catch(e2){ -} -} -} -} -} -this._disabledOK=true; -},onLoad:function(_27){ -if(!this.window.__registeredWindow){ -this.window.__registeredWindow=true; -this._iframeRegHandle=dijit.registerIframe(this.iframe); -} -if(!dojo.isIE&&(this.height||dojo.isMoz)){ -this.editNode=this.document.body; -}else{ -this.editNode=this.document.body.firstChild; -var _28=this; -if(dojo.isIE){ -var _29=(this.tabStop=dojo.doc.createElement("
    ")); -this.editingArea.appendChild(_29); -this.iframe.onfocus=function(){ -_28.editNode.setActive(); -}; -} -} -this.focusNode=this.editNode; -var _2a=this.events.concat(this.captureEvents); -var ap=this.iframe?this.document:this.editNode; -dojo.forEach(_2a,function(_2b){ -this.connect(ap,_2b.toLowerCase(),_2b); -},this); -if(dojo.isIE){ -this.connect(this.document,"onmousedown","_onIEMouseDown"); -this.editNode.style.zoom=1; -}else{ -this.connect(this.document,"onmousedown",function(){ -delete this._cursorToStart; -}); -} -if(dojo.isWebKit){ -this._webkitListener=this.connect(this.document,"onmouseup","onDisplayChanged"); -} -if(dojo.isIE){ -try{ -this.document.execCommand("RespectVisibilityInDesign",true,null); -} -catch(e){ -} -} -this.isLoaded=true; -this.set("disabled",this.disabled); -var _2c=dojo.hitch(this,function(){ -this.setValue(_27); -if(this.onLoadDeferred){ -this.onLoadDeferred.callback(true); -} -this.onDisplayChanged(); -if(this.focusOnLoad){ -dojo.addOnLoad(dojo.hitch(this,function(){ -setTimeout(dojo.hitch(this,"focus"),this.updateInterval); -})); -} -this.savedContent=this.getValue(true); -}); -if(this.setValueDeferred){ -this.setValueDeferred.addCallback(_2c); -}else{ -_2c(); -} -},onKeyDown:function(e){ -if(e.keyCode===dojo.keys.TAB&&this.isTabIndent){ -dojo.stopEvent(e); -if(this.queryCommandEnabled((e.shiftKey?"outdent":"indent"))){ -this.execCommand((e.shiftKey?"outdent":"indent")); -} -} -if(dojo.isIE){ -if(e.keyCode==dojo.keys.TAB&&!this.isTabIndent){ -if(e.shiftKey&&!e.ctrlKey&&!e.altKey){ -this.iframe.focus(); -}else{ -if(!e.shiftKey&&!e.ctrlKey&&!e.altKey){ -this.tabStop.focus(); -} -} -}else{ -if(e.keyCode===dojo.keys.BACKSPACE&&this.document.selection.type==="Control"){ -dojo.stopEvent(e); -this.execCommand("delete"); -}else{ -if((65<=e.keyCode&&e.keyCode<=90)||(e.keyCode>=37&&e.keyCode<=40)){ -e.charCode=e.keyCode; -this.onKeyPress(e); -} -} -} -} -return true; -},onKeyUp:function(e){ -return; -},setDisabled:function(_2d){ -dojo.deprecated("dijit.Editor::setDisabled is deprecated","use dijit.Editor::attr(\"disabled\",boolean) instead",2); -this.set("disabled",_2d); -},_setValueAttr:function(_2e){ -this.setValue(_2e); -},_setDisableSpellCheckAttr:function(_2f){ -if(this.document){ -dojo.attr(this.document.body,"spellcheck",!_2f); -}else{ -this.onLoadDeferred.addCallback(dojo.hitch(this,function(){ -dojo.attr(this.document.body,"spellcheck",!_2f); -})); -} -this.disableSpellCheck=_2f; -},onKeyPress:function(e){ -var c=(e.keyChar&&e.keyChar.toLowerCase())||e.keyCode,_30=this._keyHandlers[c],_31=arguments; -if(_30&&!e.altKey){ -dojo.some(_30,function(h){ -if(!(h.shift^e.shiftKey)&&!(h.ctrl^(e.ctrlKey||e.metaKey))){ -if(!h.handler.apply(this,_31)){ -e.preventDefault(); -} -return true; -} -},this); -} -if(!this._onKeyHitch){ -this._onKeyHitch=dojo.hitch(this,"onKeyPressed"); -} -setTimeout(this._onKeyHitch,1); -return true; -},addKeyHandler:function(key,_32,_33,_34){ -if(!dojo.isArray(this._keyHandlers[key])){ -this._keyHandlers[key]=[]; -} -this._keyHandlers[key].push({shift:_33||false,ctrl:_32||false,handler:_34}); -},onKeyPressed:function(){ -this.onDisplayChanged(); -},onClick:function(e){ -this.onDisplayChanged(e); -},_onIEMouseDown:function(e){ -if(!this._focused&&!this.disabled){ -this.focus(); -} -},_onBlur:function(e){ -this.inherited(arguments); -var _35=this.getValue(true); -if(_35!=this.savedContent){ -this.onChange(_35); -this.savedContent=_35; -} -},_onFocus:function(e){ -if(!this.disabled){ -if(!this._disabledOK){ -this.set("disabled",false); -} -this.inherited(arguments); -} -},blur:function(){ -if(!dojo.isIE&&this.window.document.documentElement&&this.window.document.documentElement.focus){ -this.window.document.documentElement.focus(); -}else{ -if(dojo.doc.body.focus){ -dojo.doc.body.focus(); -} -} -},focus:function(){ -if(!this.isLoaded){ -this.focusOnLoad=true; -return; -} -if(this._cursorToStart){ -delete this._cursorToStart; -if(this.editNode.childNodes){ -this.placeCursorAtStart(); -return; -} -} -if(!dojo.isIE){ -dijit.focus(this.iframe); -}else{ -if(this.editNode&&this.editNode.focus){ -this.iframe.fireEvent("onfocus",document.createEventObject()); -} -} -},updateInterval:200,_updateTimer:null,onDisplayChanged:function(e){ -if(this._updateTimer){ -clearTimeout(this._updateTimer); -} -if(!this._updateHandler){ -this._updateHandler=dojo.hitch(this,"onNormalizedDisplayChanged"); -} -this._updateTimer=setTimeout(this._updateHandler,this.updateInterval); -},onNormalizedDisplayChanged:function(){ -delete this._updateTimer; -},onChange:function(_36){ -},_normalizeCommand:function(cmd,_37){ -var _38=cmd.toLowerCase(); -if(_38=="formatblock"){ -if(dojo.isSafari&&_37===undefined){ -_38="heading"; -} -}else{ -if(_38=="hilitecolor"&&!dojo.isMoz){ -_38="backcolor"; -} -} -return _38; -},_qcaCache:{},queryCommandAvailable:function(_39){ -var ca=this._qcaCache[_39]; -if(ca!==undefined){ -return ca; -} -return (this._qcaCache[_39]=this._queryCommandAvailable(_39)); -},_queryCommandAvailable:function(_3a){ -var ie=1; -var _3b=1<<1; -var _3c=1<<2; -var _3d=1<<3; -var _3e=1<<4; -function _3f(_40){ -return {ie:Boolean(_40&ie),mozilla:Boolean(_40&_3b),webkit:Boolean(_40&_3c),webkit420:Boolean(_40&_3e),opera:Boolean(_40&_3d)}; -}; -var _41=null; -switch(_3a.toLowerCase()){ -case "bold": -case "italic": -case "underline": -case "subscript": -case "superscript": -case "fontname": -case "fontsize": -case "forecolor": -case "hilitecolor": -case "justifycenter": -case "justifyfull": -case "justifyleft": -case "justifyright": -case "delete": -case "selectall": -case "toggledir": -_41=_3f(_3b|ie|_3c|_3d); -break; -case "createlink": -case "unlink": -case "removeformat": -case "inserthorizontalrule": -case "insertimage": -case "insertorderedlist": -case "insertunorderedlist": -case "indent": -case "outdent": -case "formatblock": -case "inserthtml": -case "undo": -case "redo": -case "strikethrough": -case "tabindent": -_41=_3f(_3b|ie|_3d|_3e); -break; -case "blockdirltr": -case "blockdirrtl": -case "dirltr": -case "dirrtl": -case "inlinedirltr": -case "inlinedirrtl": -_41=_3f(ie); -break; -case "cut": -case "copy": -case "paste": -_41=_3f(ie|_3b|_3e); -break; -case "inserttable": -_41=_3f(_3b|ie); -break; -case "insertcell": -case "insertcol": -case "insertrow": -case "deletecells": -case "deletecols": -case "deleterows": -case "mergecells": -case "splitcell": -_41=_3f(ie|_3b); -break; -default: -return false; -} -return (dojo.isIE&&_41.ie)||(dojo.isMoz&&_41.mozilla)||(dojo.isWebKit&&_41.webkit)||(dojo.isWebKit>420&&_41.webkit420)||(dojo.isOpera&&_41.opera); -},execCommand:function(_42,_43){ -var _44; -this.focus(); -_42=this._normalizeCommand(_42,_43); -if(_43!==undefined){ -if(_42=="heading"){ -throw new Error("unimplemented"); -}else{ -if((_42=="formatblock")&&dojo.isIE){ -_43="<"+_43+">"; -} -} -} -var _45="_"+_42+"Impl"; -if(this[_45]){ -_44=this[_45](_43); -}else{ -_43=arguments.length>1?_43:null; -if(_43||_42!="createlink"){ -_44=this.document.execCommand(_42,false,_43); -} -} -this.onDisplayChanged(); -return _44; -},queryCommandEnabled:function(_46){ -if(this.disabled||!this._disabledOK){ -return false; -} -_46=this._normalizeCommand(_46); -if(dojo.isMoz||dojo.isWebKit){ -if(_46=="unlink"){ -return this._sCall("hasAncestorElement",["a"]); -}else{ -if(_46=="inserttable"){ -return true; -} -} -} -if(dojo.isWebKit){ -if(_46=="copy"){ -_46="cut"; -}else{ -if(_46=="paste"){ -return true; -} -} -} -var _47=dojo.isIE?this.document.selection.createRange():this.document; -try{ -return _47.queryCommandEnabled(_46); -} -catch(e){ -return false; -} -},queryCommandState:function(_48){ -if(this.disabled||!this._disabledOK){ -return false; -} -_48=this._normalizeCommand(_48); -try{ -return this.document.queryCommandState(_48); -} -catch(e){ -return false; -} -},queryCommandValue:function(_49){ -if(this.disabled||!this._disabledOK){ -return false; -} -var r; -_49=this._normalizeCommand(_49); -if(dojo.isIE&&_49=="formatblock"){ -r=this._native2LocalFormatNames[this.document.queryCommandValue(_49)]; -}else{ -if(dojo.isMoz&&_49==="hilitecolor"){ -var _4a; -try{ -_4a=this.document.queryCommandValue("styleWithCSS"); -} -catch(e){ -_4a=false; -} -this.document.execCommand("styleWithCSS",false,true); -r=this.document.queryCommandValue(_49); -this.document.execCommand("styleWithCSS",false,_4a); -}else{ -r=this.document.queryCommandValue(_49); -} -} -return r; -},_sCall:function(_4b,_4c){ -return dojo.withGlobal(this.window,_4b,dijit._editor.selection,_4c); -},placeCursorAtStart:function(){ -this.focus(); -var _4d=false; -if(dojo.isMoz){ -var _4e=this.editNode.firstChild; -while(_4e){ -if(_4e.nodeType==3){ -if(_4e.nodeValue.replace(/^\s+|\s+$/g,"").length>0){ -_4d=true; -this._sCall("selectElement",[_4e]); -break; -} -}else{ -if(_4e.nodeType==1){ -_4d=true; -var tg=_4e.tagName?_4e.tagName.toLowerCase():""; -if(/br|input|img|base|meta|area|basefont|hr|link/.test(tg)){ -this._sCall("selectElement",[_4e]); -}else{ -this._sCall("selectElementChildren",[_4e]); -} -break; -} -} -_4e=_4e.nextSibling; -} -}else{ -_4d=true; -this._sCall("selectElementChildren",[this.editNode]); -} -if(_4d){ -this._sCall("collapse",[true]); -} -},placeCursorAtEnd:function(){ -this.focus(); -var _4f=false; -if(dojo.isMoz){ -var _50=this.editNode.lastChild; -while(_50){ -if(_50.nodeType==3){ -if(_50.nodeValue.replace(/^\s+|\s+$/g,"").length>0){ -_4f=true; -this._sCall("selectElement",[_50]); -break; -} -}else{ -if(_50.nodeType==1){ -_4f=true; -if(_50.lastChild){ -this._sCall("selectElement",[_50.lastChild]); -}else{ -this._sCall("selectElement",[_50]); -} -break; -} -} -_50=_50.previousSibling; -} -}else{ -_4f=true; -this._sCall("selectElementChildren",[this.editNode]); -} -if(_4f){ -this._sCall("collapse",[false]); -} -},getValue:function(_51){ -if(this.textarea){ -if(this.isClosed||!this.isLoaded){ -return this.textarea.value; -} -} -return this._postFilterContent(null,_51); -},_getValueAttr:function(){ -return this.getValue(true); -},setValue:function(_52){ -if(!this.isLoaded){ -this.onLoadDeferred.addCallback(dojo.hitch(this,function(){ -this.setValue(_52); -})); -return; -} -this._cursorToStart=true; -if(this.textarea&&(this.isClosed||!this.isLoaded)){ -this.textarea.value=_52; -}else{ -_52=this._preFilterContent(_52); -var _53=this.isClosed?this.domNode:this.editNode; -if(!_52&&dojo.isWebKit){ -_52=" "; -} -_53.innerHTML=_52; -this._preDomFilterContent(_53); -} -this.onDisplayChanged(); -},replaceValue:function(_54){ -if(this.isClosed){ -this.setValue(_54); -}else{ -if(this.window&&this.window.getSelection&&!dojo.isMoz){ -this.setValue(_54); -}else{ -if(this.window&&this.window.getSelection){ -_54=this._preFilterContent(_54); -this.execCommand("selectall"); -if(!_54){ -this._cursorToStart=true; -_54=" "; -} -this.execCommand("inserthtml",_54); -this._preDomFilterContent(this.editNode); -}else{ -if(this.document&&this.document.selection){ -this.setValue(_54); -} -} -} -} -},_preFilterContent:function(_55){ -var ec=_55; -dojo.forEach(this.contentPreFilters,function(ef){ -if(ef){ -ec=ef(ec); -} -}); -return ec; -},_preDomFilterContent:function(dom){ -dom=dom||this.editNode; -dojo.forEach(this.contentDomPreFilters,function(ef){ -if(ef&&dojo.isFunction(ef)){ -ef(dom); -} -},this); -},_postFilterContent:function(dom,_56){ -var ec; -if(!dojo.isString(dom)){ -dom=dom||this.editNode; -if(this.contentDomPostFilters.length){ -if(_56){ -dom=dojo.clone(dom); -} -dojo.forEach(this.contentDomPostFilters,function(ef){ -dom=ef(dom); -}); -} -ec=dijit._editor.getChildrenHtml(dom); -}else{ -ec=dom; -} -if(!dojo.trim(ec.replace(/^\xA0\xA0*/,"").replace(/\xA0\xA0*$/,"")).length){ -ec=""; + + +// used to restore content when user leaves this page then comes back +// but do not try doing dojo.doc.write if we are using xd loading. +// dojo.doc.write will only work if RichText.js is included in the dojo.js +// file. If it is included in dojo.js and you want to allow rich text saving +// for back/forward actions, then set dojo.config.allowXdRichTextSave = true. +if(!dojo.config["useXDomain"] || dojo.config["allowXdRichTextSave"]){ + if(dojo._postLoad){ + (function(){ + var savetextarea = dojo.doc.createElement('textarea'); + savetextarea.id = dijit._scopeName + "._editor.RichText.value"; + dojo.style(savetextarea, { + display:'none', + position:'absolute', + top:"-100px", + height:"3px", + width:"3px" + }); + dojo.body().appendChild(savetextarea); + })(); + }else{ + //dojo.body() is not available before onLoad is fired + try{ + dojo.doc.write(''); + }catch(e){ } + } } -dojo.forEach(this.contentPostFilters,function(ef){ -ec=ef(ec); + +dojo.declare("dijit._editor.RichText", [dijit._Widget, dijit._CssStateMixin], { + constructor: function(params){ + // summary: + // dijit._editor.RichText is the core of dijit.Editor, which provides basic + // WYSIWYG editing features. + // + // description: + // dijit._editor.RichText is the core of dijit.Editor, which provides basic + // WYSIWYG editing features. It also encapsulates the differences + // of different js engines for various browsers. Do not use this widget + // with an HTML <TEXTAREA> tag, since the browser unescapes XML escape characters, + // like <. This can have unexpected behavior and lead to security issues + // such as scripting attacks. + // + // tags: + // private + + // contentPreFilters: Function(String)[] + // Pre content filter function register array. + // these filters will be executed before the actual + // editing area gets the html content. + this.contentPreFilters = []; + + // contentPostFilters: Function(String)[] + // post content filter function register array. + // These will be used on the resulting html + // from contentDomPostFilters. The resulting + // content is the final html (returned by getValue()). + this.contentPostFilters = []; + + // contentDomPreFilters: Function(DomNode)[] + // Pre content dom filter function register array. + // These filters are applied after the result from + // contentPreFilters are set to the editing area. + this.contentDomPreFilters = []; + + // contentDomPostFilters: Function(DomNode)[] + // Post content dom filter function register array. + // These filters are executed on the editing area dom. + // The result from these will be passed to contentPostFilters. + this.contentDomPostFilters = []; + + // editingAreaStyleSheets: dojo._URL[] + // array to store all the stylesheets applied to the editing area + this.editingAreaStyleSheets = []; + + // Make a copy of this.events before we start writing into it, otherwise we + // will modify the prototype which leads to bad things on pages w/multiple editors + this.events = [].concat(this.events); + + this._keyHandlers = {}; + + if(params && dojo.isString(params.value)){ + this.value = params.value; + } + + this.onLoadDeferred = new dojo.Deferred(); + }, + + baseClass: "dijitEditor", + + // inheritWidth: Boolean + // whether to inherit the parent's width or simply use 100% + inheritWidth: false, + + // focusOnLoad: [deprecated] Boolean + // Focus into this widget when the page is loaded + focusOnLoad: false, + + // name: String? + // Specifies the name of a (hidden)