!function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{resize_timeout:!1,init:function(a,b){function c(b,c){var e,f=tinymce.DOM,g=a.getBody(),h=f.get(a.id+"_ifr"),i=a.dom.win.scrollY;d.resize_timeout||(d.resize_timeout=!0,setTimeout(function(){d.resize_timeout=!1},500),e=g.scrollHeight>300?g.scrollHeight:300,e!=h.scrollHeight&&(f.setStyle(h,"height",e+"px"),a.getWin().scrollTo(0,0)),c&&"paste"==c.type&&tinymce.isWebKit&&setTimeout(function(){a.dom.win.scrollTo(0,i)},40))}var d=this,e={},f=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){a.getParam("wp_fullscreen_is_enabled")&&f.win.setTimeout(function(){tinyMCE.remove(a),f.remove("wp_mce_fullscreen_parent"),tinyMCE.settings=tinyMCE.oldSettings},10)}),a.addCommand("wpFullScreenSave",function(){var a,b=tinyMCE.get("wp_mce_fullscreen");b.focus(),a=tinyMCE.get(b.getParam("wp_fullscreen_editor_id")),a.setContent(b.getContent({format:"raw"}),{format:"raw"})}),a.addCommand("wpFullScreenInit",function(){var b,c,d;a=tinyMCE.activeEditor,b=a.getDoc(),c=b.body,tinyMCE.oldSettings=tinyMCE.settings,tinymce.each(a.settings,function(a,b){e[b]=a}),e.id="wp_mce_fullscreen",e.wp_fullscreen_is_enabled=!0,e.wp_fullscreen_editor_id=a.id,e.theme_advanced_resizing=!1,e.theme_advanced_statusbar_location="none",e.content_css=e.content_css?e.content_css+","+e.wp_fullscreen_content_css:e.wp_fullscreen_content_css,e.height=tinymce.isIE?c.scrollHeight:c.offsetHeight,tinymce.each(a.getParam("wp_fullscreen_settings"),function(a,b){e[b]=a}),d=new tinymce.Editor("wp_mce_fullscreen",e),d.onInit.add(function(b){var c=tinymce.DOM,d=c.select("a.mceButton",c.get("wp-fullscreen-buttons"));a.isHidden()?b.setContent(switchEditors.wpautop(b.getElement().value)):b.setContent(a.getContent()),setTimeout(function(){b.onNodeChange.add(function(a,b,e){tinymce.each(d,function(a){var b,d;(b=c.get("wp_mce_fullscreen_"+a.id.substr(6)))&&(d=b.className,d&&(a.className=d))})})},1e3),b.dom.addClass(b.getBody(),"wp-fullscreen-editor"),b.focus()}),d.render(),"undefined"!=fullscreen&&d.dom.bind(d.dom.doc,"mousemove",function(a){fullscreen.bounder("showToolbar","hideToolbar",2e3,a)})}),a.addCommand("wpFullScreen",function(){"undefined"!=typeof fullscreen&&("wp_mce_fullscreen"==a.id?fullscreen.off():fullscreen.on())}),a.addButton("wp_fullscreen",{title:"wordpress.wp_fullscreen_desc",cmd:"wpFullScreen"}),!a.getParam("fullscreen_is_enabled")&&a.getParam("wp_fullscreen_is_enabled")&&(a.onInit.add(function(a,b){a.onChange.add(c),a.onSetContent.add(c),a.onPaste.add(c),a.onKeyUp.add(c),a.onPostRender.add(c),a.getBody().style.overflowY="hidden"}),a.getParam("autoresize_on_init",!0)&&a.onLoadContent.add(function(a,b){setTimeout(function(){c()},1200)}),a.addCommand("wpAutoResize",c))},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}}),tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)}();