//>>built
define("dijit/_editor/plugins/FullScreen","dojo/aspect dojo/_base/declare dojo/dom-class dojo/dom-geometry dojo/dom-style dojo/i18n dojo/keys dojo/_base/lang dojo/on dojo/sniff dojo/_base/window dojo/window ../../focus ../_Plugin ../../form/ToggleButton ../../registry dojo/i18n!../nls/commands".split(" "),function(z,A,t,h,e,B,u,f,v,m,E,l,w,p,C,D){var y=A("dijit._editor.plugins.FullScreen",p,{zIndex:500,_origState:null,_origiFrameState:null,_resizeHandle:null,isFullscreen:!1,toggle:function(){this.button.set("checked",
!this.button.get("checked"))},_initButton:function(){var b=B.getLocalization("dijit._editor","commands"),a=this.editor;this.button=new C({label:b.fullScreen,ownerDocument:a.ownerDocument,dir:a.dir,lang:a.lang,showLabel:!1,iconClass:this.iconClassPrefix+" "+this.iconClassPrefix+"FullScreen",tabIndex:"-1",onChange:f.hitch(this,"_setFullScreen")})},setEditor:function(b){this.editor=b;this._initButton();this.editor.addKeyHandler(u.F11,!0,!0,f.hitch(this,function(a){this.toggle();a.stopPropagation();a.preventDefault();
this.editor.defer("focus",250);return!0}));this.own(v(this.editor.domNode,"keydown",f.hitch(this,"_containFocus")))},_containFocus:function(b){if(this.isFullscreen){var a=this.editor;if(!a.isTabIndent&&a._fullscreen_oldOnKeyDown&&b.keyCode===u.TAB){b=w.curNode;var c=this._getAltViewNode();b==a.iframe||c&&b===c?setTimeout(f.hitch(this,function(){a.toolbar.focus()}),10):c&&"none"===e.get(a.iframe,"display")?setTimeout(f.hitch(this,function(){w.focus(c)}),10):setTimeout(f.hitch(this,function(){a.focus()}),
10);event.stopPropagation();event.preventDefault()}else a._fullscreen_oldOnKeyDown&&a._fullscreen_oldOnKeyDown(b)}},_resizeEditor:function(){var b=l.getBox(this.editor.ownerDocument);h.setMarginBox(this.editor.domNode,{w:b.w,h:b.h});var a=this.editor.getHeaderHeight(),c=this.editor.getFooterHeight(),d=h.getPadBorderExtents(this.editor.domNode),n=h.getPadBorderExtents(this.editor.iframe.parentNode),q=h.getMarginExtents(this.editor.iframe.parentNode);a=b.h-(a+d.h+c);h.setMarginBox(this.editor.iframe.parentNode,
{h:a,w:b.w});h.setMarginBox(this.editor.iframe,{h:a-(n.h+q.h)})},_getAltViewNode:function(){},_setFullScreen:function(b){var a=this.editor,c=a.ownerDocumentBody,d=a.domNode.parentNode,n=l.getBox(a.ownerDocument);if(this.isFullscreen=b){for(;d&&d!==c;)t.add(d,"dijitForceStatic"),d=d.parentNode;this._editorResizeHolder=this.editor.resize;a.resize=function(){};a._fullscreen_oldOnKeyDown=a.onKeyDown;a.onKeyDown=f.hitch(this,this._containFocus);this._origState={};this._origiFrameState={};d=(b=a.domNode)&&
b.style||{};this._origState={width:d.width||"",height:d.height||"",top:e.get(b,"top")||"",left:e.get(b,"left")||"",position:e.get(b,"position")||"static",marginBox:h.getMarginBox(a.domNode)};b=(b=a.iframe)&&b.style||{};d=e.get(a.iframe,"backgroundColor");this._origiFrameState={backgroundColor:d||"transparent",width:b.width||"auto",height:b.height||"auto",zIndex:b.zIndex||""};e.set(a.domNode,{position:"absolute",top:"0px",left:"0px",zIndex:this.zIndex,width:n.w+"px",height:n.h+"px"});e.set(a.iframe,
{height:"100%",width:"100%",zIndex:this.zIndex,backgroundColor:"transparent"!==d&&"rgba(0, 0, 0, 0)"!==d?d:"white"});e.set(a.iframe.parentNode,{height:"95%",width:"100%"});this._oldOverflow=c.style&&c.style.overflow?e.get(c,"overflow"):"";if(m("ie")&&!m("quirks")){if(c.parentNode&&c.parentNode.style&&c.parentNode.style.overflow)this._oldBodyParentOverflow=c.parentNode.style.overflow;else try{this._oldBodyParentOverflow=e.get(c.parentNode,"overflow")}catch(k){this._oldBodyParentOverflow="scroll"}e.set(c.parentNode,
"overflow","hidden")}e.set(c,"overflow","hidden");this._resizeHandle=v(window,"resize",f.hitch(this,function(){var k=l.getBox(a.ownerDocument);if("_prevW"in this&&"_prevH"in this){if(k.w===this._prevW&&k.h===this._prevH)return}else this._prevW=k.w,this._prevH=k.h;this._resizer&&(clearTimeout(this._resizer),delete this._resizer);this._resizer=setTimeout(f.hitch(this,function(){delete this._resizer;this._resizeEditor()}),10)}));this._resizeHandle2=z.after(a,"onResize",f.hitch(this,function(){this._resizer&&
(clearTimeout(this._resizer),delete this._resizer);this._resizer=setTimeout(f.hitch(this,function(){delete this._resizer;this._resizeEditor()}),10)}));this._resizeEditor();var q=this.editor.toolbar.domNode;setTimeout(function(){l.scrollIntoView(q)},250)}else{this._resizeHandle&&(this._resizeHandle.remove(),this._resizeHandle=null);this._resizeHandle2&&(this._resizeHandle2.remove(),this._resizeHandle2=null);this._rst&&(clearTimeout(this._rst),this._rst=null);for(;d&&d!==c;)t.remove(d,"dijitForceStatic"),
d=d.parentNode;this._editorResizeHolder&&(this.editor.resize=this._editorResizeHolder);if(this._origState||this._origiFrameState){a._fullscreen_oldOnKeyDown&&(a.onKeyDown=a._fullscreen_oldOnKeyDown,delete a._fullscreen_oldOnKeyDown);var g=this;setTimeout(function(){var k=g._origState.marginBox,x=g._origState.height;m("ie")&&!m("quirks")&&(c.parentNode.style.overflow=g._oldBodyParentOverflow,delete g._oldBodyParentOverflow);e.set(c,"overflow",g._oldOverflow);delete g._oldOverflow;e.set(a.domNode,g._origState);
e.set(a.iframe.parentNode,{height:"",width:""});e.set(a.iframe,g._origiFrameState);delete g._origState;delete g._origiFrameState;var r=D.getEnclosingWidget(a.domNode.parentNode);r&&r.resize?r.resize():(!x||0>x.indexOf("%"))&&setTimeout(f.hitch(this,function(){a.resize({h:k.h})}),0);l.scrollIntoView(g.editor.toolbar.domNode)},100)}}},updateState:function(){this.button.set("disabled",this.get("disabled"))},destroy:function(){this._resizeHandle&&(this._resizeHandle.remove(),this._resizeHandle=null);
this._resizeHandle2&&(this._resizeHandle2.remove(),this._resizeHandle2=null);this._resizer&&(clearTimeout(this._resizer),this._resizer=null);this.inherited(arguments)}});p.registry.fullScreen=p.registry.fullscreen=function(b){return new y({zIndex:"zIndex"in b?b.zIndex:500})};return y});