WordPress/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.min.js

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})});