egroupware/api/js/tinymce/plugins/fullscreen/plugin.min.js

1 line
2.3 KiB
JavaScript

!function(){"use strict";var i=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return i(n())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){return{isFullscreen:function(){return null!==e.get()}}},t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),g=function(e,t){e.fire("FullscreenStateChanged",{state:t})},m=t.DOM,r=function(e,t){var n,r,o,i,l,c,u=document.body,s=document.documentElement,d=t.get(),a=function(){var e,t,n,i;m.setStyle(o,"height",(n=window,i=document.body,i.offsetWidth&&(e=i.offsetWidth,t=i.offsetHeight),n.innerWidth&&n.innerHeight&&(e=n.innerWidth,t=n.innerHeight),{w:e,h:t}).h-(r.clientHeight-o.clientHeight))},f=function(){m.unbind(window,"resize",a)};if(n=(r=e.getContainer()).style,i=(o=e.getContentAreaContainer().firstChild).style,d)i.width=d.iframeWidth,i.height=d.iframeHeight,d.containerWidth&&(n.width=d.containerWidth),d.containerHeight&&(n.height=d.containerHeight),m.removeClass(u,"tox-fullscreen"),m.removeClass(s,"tox-fullscreen"),m.removeClass(r,"tox-fullscreen"),l=d.scrollPos,window.scrollTo(l.x,l.y),m.unbind(window,"resize",d.resizeHandler),e.off("remove",d.removeHandler),t.set(null),g(e,!1);else{var h={scrollPos:(c=m.getViewPort(),{x:c.x,y:c.y}),containerWidth:n.width,containerHeight:n.height,iframeWidth:i.width,iframeHeight:i.height,resizeHandler:a,removeHandler:f};i.width=i.height="100%",n.width=n.height="",m.addClass(u,"tox-fullscreen"),m.addClass(s,"tox-fullscreen"),m.addClass(r,"tox-fullscreen"),m.bind(window,"resize",a),e.on("remove",f),a(),t.set(h),g(e,!0)}},o=function(e,t){e.addCommand("mceFullScreen",function(){r(e,t)})},l=function(n){return function(t){t.setActive(!1);var e=function(e){return t.setActive(e.state)};return n.on("FullscreenStateChanged",e),function(){return n.off("FullscreenStateChanged",e)}}},c=function(e){e.ui.registry.addToggleMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onAction:function(){return e.execCommand("mceFullScreen")},onSetup:l(e)}),e.ui.registry.addToggleButton("fullscreen",{tooltip:"Fullscreen",icon:"fullscreen",onAction:function(){return e.execCommand("mceFullScreen")},onSetup:l(e)})};e.add("fullscreen",function(e){var t=i(null);return e.settings.inline||(o(e,t),c(e),e.addShortcut("Ctrl+Shift+F","","mceFullScreen")),n(t)}),function u(){}}();