tinymce-editor/out/tinymce/plugins/autoresize/plugin.min.js
2021-10-11 00:53:18 +02:00

9 lines
2.2 KiB
JavaScript
Executable File

/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.9.2 (2021-09-08)
*/
!function(){"use strict";function d(e){return e.getParam("min_height",e.getElement().offsetHeight,"number")}function h(e,t){var n=e.getBody();n&&(n.style.overflowY=t?"":"hidden",t||(n.scrollTop=0))}function y(e,t,n,i){var o=parseInt(e.getStyle(t,n,i),10);return isNaN(o)?0:o}var g=Object.hasOwnProperty,e=tinymce.util.Tools.resolve("tinymce.PluginManager"),p=tinymce.util.Tools.resolve("tinymce.Env"),r=tinymce.util.Tools.resolve("tinymce.util.Delay"),u=function(e,t,n,i,o){r.setEditorTimeout(e,function(){v(e,t),n--?u(e,t,n,i,o):o&&o()},i)},v=function(e,t){var n,i,o,r,s,a,g,u,l,c,m=e.dom,f=e.getDoc();f&&(e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen()?h(e,!0):(n=f.documentElement,i=e.getParam("autoresize_bottom_margin",50,"number"),o=d(e),r=y(m,n,"margin-top",!0),s=y(m,n,"margin-bottom",!0),(a=(a=n.offsetHeight+r+s+i)<0?0:a)+(g=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight)>d(e)&&(o=a+g),(u=e.getParam("max_height",0,"number"))&&u<o?(o=u,h(e,!0)):h(e,!1),o!==t.get()&&(l=o-t.get(),m.setStyle(e.getContainer(),"height",o+"px"),t.set(o),e.fire("ResizeEditor"),p.browser.isSafari()&&p.mac&&(c=e.getWin()).scrollTo(c.pageXOffset,c.pageYOffset),e.hasFocus()&&e.selection.scrollIntoView(e.selection.getNode()),p.webkit&&l<0&&v(e,t))))};e.add("autoresize",function(e){var t,n,i,o,r,s,a=e.settings;g.call(a,"resize")||(e.settings.resize=!1),e.inline||(s=0,r=t={get:function(){return s},set:function(e){s=e}},(o=e).addCommand("mceAutoResize",function(){v(o,r)}),i=t,(n=e).on("init",function(){var e=n.getParam("autoresize_overflow_padding",1,"number"),t=n.dom;t.setStyles(n.getDoc().documentElement,{height:"auto"}),t.setStyles(n.getBody(),{paddingLeft:e,paddingRight:e,"min-height":0})}),n.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",function(){v(n,i)}),n.getParam("autoresize_on_init",!0,"boolean")&&n.on("init",function(){u(n,i,20,100,function(){u(n,i,5,1e3)})}))})}();