mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-27 19:47:42 +01:00
e7f164297f
git-svn-id: http://core.svn.wordpress.org/trunk@21964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
3.0 KiB
JavaScript
1 line
3.0 KiB
JavaScript
(function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{resize_timeout:false,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("wpFullScreenInit",function(){var j,h,i;a=tinyMCE.activeEditor;j=a.getDoc();h=j.body;tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(a.settings,function(k,l){e[l]=k});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_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?h.scrollHeight:h.offsetHeight;tinymce.each(a.getParam("wp_fullscreen_settings"),function(m,l){e[l]=m});i=new tinymce.Editor("wp_mce_fullscreen",e);i.onInit.add(function(k){var m=tinymce.DOM,l=m.select("a.mceButton",m.get("wp-fullscreen-buttons"));if(!a.isHidden()){k.setContent(a.getContent())}else{k.setContent(switchEditors.wpautop(k.getElement().value))}setTimeout(function(){k.onNodeChange.add(function(o,n,p){tinymce.each(l,function(s){var r,q;if(r=m.get("wp_mce_fullscreen_"+s.id.substr(6))){q=r.className;if(q){s.className=q}}})})},1000);k.dom.addClass(k.getBody(),"wp-fullscreen-editor");k.focus()});i.render();if("undefined"!=fullscreen){i.dom.bind(i.dom.doc,"mousemove",function(k){fullscreen.bounder("showToolbar","hideToolbar",2000,k)})}});a.addCommand("wpFullScreen",function(){if(typeof(fullscreen)=="undefined"){return}if("wp_mce_fullscreen"==a.id){fullscreen.off()}else{fullscreen.on()}});a.addButton("wp_fullscreen",{title:"wordpress.wp_fullscreen_desc",cmd:"wpFullScreen"});if(a.getParam("fullscreen_is_enabled")||!a.getParam("wp_fullscreen_is_enabled")){return}function b(j,l){var k=tinymce.DOM,i=a.getBody(),n=k.get(a.id+"_ifr"),h,m=a.dom.win.scrollY;if(d.resize_timeout){return}d.resize_timeout=true;setTimeout(function(){d.resize_timeout=false},500);h=i.scrollHeight>300?i.scrollHeight:300;if(h!=n.scrollHeight){k.setStyle(n,"height",h+"px");a.getWin().scrollTo(0,0)}if(l&&l.type=="paste"&&tinymce.isWebKit){setTimeout(function(){a.dom.win.scrollTo(0,m)},40)}}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"});if(a.getParam("autoresize_on_init",true)){a.onLoadContent.add(function(i,h){setTimeout(function(){b()},1200)})}a.addCommand("wpAutoResize",b)},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)})(); |