mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 22:58:33 +02:00
Built from https://develop.svn.wordpress.org/trunk@28455 git-svn-id: http://core.svn.wordpress.org/trunk@28282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
tinymce.PluginManager.add("wpfullscreen",function(a){function b(c){var d,e,f=a.getDoc(),g=f.body,i=tinymce.DOM,j=250;c&&"setcontent"===c.type&&c.initial||a.settings.inline||(e=tinymce.Env.ie?g.scrollHeight:tinymce.Env.webkit&&0===g.clientHeight?0:g.offsetHeight,e>250&&(j=e),g.scrollTop=0,j!==h&&(d=j-h,i.setStyle(i.get(a.id+"_ifr"),"height",j+"px"),h=j,tinymce.isWebKit&&0>d&&b(c)))}function c(){g.wp_fullscreen=!0,a.dom.addClass(a.getDoc().documentElement,"wp-fullscreen"),a.on("change setcontent paste keyup",b)}function d(){g.wp_fullscreen=!1,a.dom.removeClass(a.getDoc().documentElement,"wp-fullscreen"),a.off("change setcontent paste keyup",b),h=0}function e(){return"undefined"!=typeof wp&&wp.editor&&wp.editor.fullscreen}function f(){var b=e();b&&(a.getParam("wp_fullscreen")?b.off():b.on())}var g=a.settings,h=0;a.addCommand("wpAutoResize",b),a.addCommand("wpFullScreenOn",c),a.addCommand("wpFullScreenOff",d),a.addCommand("wpFullScreen",f),a.on("keydown",function(a){var b;27===a.keyCode&&(b=e())&&b.settings.visible&&b.off()}),a.on("init",function(){a.getParam("wp_fullscreen")&&c(),a.addShortcut("alt+shift+w","","wpFullScreen")}),a.addButton("wp_fullscreen",{tooltip:"Distraction Free Writing",shortcut:"Alt+Shift+W",onclick:f,classes:"wp-fullscreen btn widget"}),a.addMenuItem("wp_fullscreen",{text:"Distraction Free Writing",icon:"wp_fullscreen",shortcut:"Alt+Shift+W",context:"view",onclick:f})}); |