Wordpress/wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.js

1 line
2.5 KiB
JavaScript
Raw Normal View History

(function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{init:function(a,c){var d=this,g=0,e={},f=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){if(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 h=tinyMCE.get("wp_mce_fullscreen"),i;h.focus();i=tinyMCE.get(h.getParam("wp_fullscreen_editor_id"));i.setContent(h.getContent({format:"raw"}),{format:"raw"})});a.addCommand("wpFullScreenSaveContent",function(){a.execCommand("wpFullScreenSave");tinyMCE.triggerSave()});a.addCommand("wpFullScreenOpen",function(){var i=a.getDoc(),h=i.body;tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(a.settings,function(j,k){e[k]=j});e.id="wp_mce_fullscreen";e.wp_fullscreen_is_enabled=true;e.wp_fullscreen_editor_id=a.id;e.theme_advanced_resizing=false;e.theme_advanced_toolbar_location="external";e.theme_advanced_statusbar_location="none";e.content_css=e.wp_fullscreen_content_css||"";e.height=tinymce.isIE?h.scrollHeight:h.offsetHeight;e.save_onsavecallback=function(){a.setContent(tinyMCE.get(e.id).getContent({format:"raw"}),{format:"raw"});a.execCommand("mceSave")};tinymce.each(a.getParam("wp_fullscreen_settings"),function(l,j){e[j]=l});d.fullscreenEditor=new tinymce.Editor("wp_mce_fullscreen",e);d.fullscreenEditor.onInit.add(function(){d.fullscreenEditor.setContent(a.getContent());d.fullscreenEditor.focus()});fullscreen.on();d.fullscreenEditor.render()});a.addButton("fullscreen",{title:"fullscreen.desc",cmd:"wpFullScreenOpen"});if(a.getParam("fullscreen_is_enabled")||!a.getParam("wp_fullscreen_is_enabled")){return}function b(){var k=a.getDoc(),h=k.body,m=k.documentElement,j=tinymce.DOM,l,i;if(tinymce.isIE){i=h.scrollHeight}else{if(tinymce.isWebKit){i=h.offsetHeight}else{i=m.offsetHeight}}l=(i>300)?i:300;if(g!=l){g=l;j.setStyle(j.get(a.id+"_ifr"),"height",l+"px")}}a.onInit.add(function(i,h){i.onChange.add(b);i.onSetContent.add(b);i.onPaste.add(b);i.onKeyUp.add(b);i.onPostRender.add(b);i.getBody().style.overflowY="hidden";i.dom.setStyle(i.getBody(),"paddingBottom",i.getParam("autoresize_bottom_margin",50)+"px")});if(a.getParam("autoresize_on_init",true)){a.onLoadContent.add(function(i,h){setTimeout(function(){b()},1200)})}a.addCommand("mceAutoResize",b)},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)})();