123456789 |
- /**
- * 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 c(n){var e=n;return{get:function(){return e},set:function(n){e=n}}}function n(r){return function(n){return t=typeof(e=n),(null===e?"null":"object"==t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t)===r;var e,t}}function e(e){return function(n){return typeof n===e}}function l(n){return!(null==n)}function f(){}function u(n){return function(){return n}}function t(n){return n}var r=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=n("string"),d=n("array"),o=e("boolean"),h=e("function"),i=e("number");function s(){return p}var g=u(!1),m=u(!0),p={fold:function(n,e){return n()},isSome:g,isNone:m,getOr:t,getOrThunk:v,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:u(null),getOrUndefined:u(void 0),or:t,orThunk:v,map:s,each:f,bind:s,exists:g,forall:m,filter:function(){return p},toArray:function(){return[]},toString:u("none()")};function v(n){return n()}function y(n){function e(){return t.get().each(n)}var t=c(C.none());return{clear:function(){e(),t.set(C.none())},isSet:function(){return t.get().isSome()},get:function(){return t.get()},set:function(n){e(),t.set(C.some(n))}}}function w(){return y(function(n){return n.unbind()})}function O(n,e){for(var t=n.length,r=new Array(t),o=0;o<t;o++){var u=n[o];r[o]=e(u,o)}return r}function A(n,e){for(var t=0,r=n.length;t<r;t++)e(n[t],t)}function b(n,e){for(var t=[],r=0,o=n.length;r<o;r++){var u=n[r];e(u,r)&&t.push(u)}return t}function S(n){return void 0!==n.style&&h(n.style.getPropertyValue)}function E(n){if(null==n)throw new Error("Node cannot be null or undefined");return{dom:n}}var T=function(t){function n(){return o}function e(n){return n(t)}var r=u(t),o={fold:function(n,e){return e(t)},isSome:m,isNone:g,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:n,orThunk:n,map:function(n){return T(n(t))},each:function(n){n(t)},bind:e,exists:e,forall:e,filter:function(n){return n(t)?o:p},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},C={some:T,none:s,from:function(n){return null==n?p:T(n)}},F=function(){return(F=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n}).apply(this,arguments)},x=Array.prototype.push,D=Object.keys,M={fromHtml:function(n,e){var t=(e||document).createElement("div");if(t.innerHTML=n,!t.hasChildNodes()||1<t.childNodes.length)throw console.error("HTML does not have a single root node",n),new Error("HTML must have a single root node");return E(t.childNodes[0])},fromTag:function(n,e){var t=(e||document).createElement(n);return E(t)},fromText:function(n,e){var t=(e||document).createTextNode(n);return E(t)},fromDom:E,fromPoint:function(n,e,t){return C.from(n.dom.elementFromPoint(e,t)).map(E)}};function k(e){return function(n){return n.dom.nodeType===e}}function N(n,e){var t=n.dom;if(1!==t.nodeType)return!1;var r=t;if(void 0!==r.matches)return r.matches(e);if(void 0!==r.msMatchesSelector)return r.msMatchesSelector(e);if(void 0!==r.webkitMatchesSelector)return r.webkitMatchesSelector(e);if(void 0!==r.mozMatchesSelector)return r.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}function P(n){return M.fromDom(n.dom.ownerDocument)}function L(n){var e,t=on(n);return nn(e=t)&&l(e.dom.host)?C.some(t):C.none()}function H(n){return M.fromDom(n.dom.host)}function q(n,e,t){!function(n,e,t){if(!(a(t)||o(t)||i(t)))throw console.error("Invalid call to Attribute.set. Key ",e,":: Value ",t,":: Element ",n),new Error("Attribute value was not simple");n.setAttribute(e,t+"")}(n.dom,e,t)}function R(n,e){var t=n.dom.getAttribute(e);return null===t?void 0:t}function V(n,e){n.dom.removeAttribute(e)}function j(n,e){var i=n.dom;!function(n){for(var e,t=D(n),r=0,o=t.length;r<o;r++){var u=t[r];e=n[u],function(n,e,t){if(!a(t))throw console.error("Invalid call to CSS.set. Property ",e,":: Value ",t,":: Element ",n),new Error("CSS value must be a string: "+t);S(n)&&n.style.setProperty(e,t)}(i,u,e)}}(e)}function W(n){function e(){return n.stopPropagation()}function t(){return n.preventDefault()}var r,o,u=M.fromDom(function(n){if(rn()&&l(n.target)){var e=M.fromDom(n.target);if(Q(e)&&un(e)&&n.composed&&n.composedPath){var t=n.composedPath();if(t)return 0<(r=t).length?C.some(r[0]):C.none()}}var r;return C.from(n.target)}(n).getOr(n.target)),i=(r=t,o=e,function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return r(o.apply(null,n))});return{target:u,x:n.clientX,y:n.clientY,stop:e,prevent:t,kill:i,raw:n}}function B(n,e,t){return o=e,u=!1,i=an,l=t,c=function(n){i(n)&&l(W(n))},(r=n).dom.addEventListener(o,c,u),{unbind:function(r){for(var o=[],n=1;n<arguments.length;n++)o[n-1]=arguments[n];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=o.concat(n);return r.apply(null,t)}}(fn,r,o,c,u)};var r,o,u,i,l,c}function z(n){var e=void 0===n?window:n;return C.from(e.visualViewport)}function I(n,e,t,r){return{x:n,y:e,width:t,height:r,right:n+t,bottom:e+r}}function U(t,r,n){return z(n).map(function(n){function e(n){return r(W(n))}return n.addEventListener(t,e),{unbind:function(){return n.removeEventListener(t,e)}}}).getOrThunk(function(){return{unbind:f}})}function K(n,e){n.fire("FullscreenStateChanged",{state:e})}function X(n){return n.getParam("fullscreen_native",!1,"boolean")}function Y(n){return n.dom===(void 0!==(e=P(n).dom).fullscreenElement?e.fullscreenElement:void 0!==e.msFullscreenElement?e.msFullscreenElement:void 0!==e.webkitFullscreenElement?e.webkitFullscreenElement:null);var e}function _(n,e){return r=function(n){return N(n,e)},b((t=n,C.from(t.dom.parentNode).map(M.fromDom).map(en).map(function(n){return b(n,function(n){return t.dom!==n.dom})}).getOr([])),r);var t,r}function G(o,n,e){function t(r){return function(n){var e=R(n,"style"),t=void 0===e?"no-styles":e.trim();t===r||(q(n,pn,t),j(n,o.parseStyle(r)))}}var r,u,i,l,c,f,a=(f=function(n){return N(n,"*")},b(function(n,e){for(var t=h(e)?e:g,r=n.dom,o=[];null!==r.parentNode&&void 0!==r.parentNode;){var u=r.parentNode,i=M.fromDom(u);if(o.push(i),!0===t(i))break;r=u}return o}(n,void 0),f)),s=function(n){for(var e=[],t=0,r=n.length;t<r;++t){if(!d(n[t]))throw new Error("Arr.flatten item "+t+" was not an array, input: "+n);x.apply(e,n[t])}return e}(O(a,function(n){return _(n,"*:not(.tox-silver-sink)")})),m=(u="background-color",i=(r=e).dom,void 0!==(c=""!==(l=window.getComputedStyle(i).getPropertyValue(u))||ln(r)?l:cn(i,u))&&""!==c?"background-color:"+c+"!important":"background-color:rgb(255,255,255)!important;");A(s,t("display:none!important;")),A(a,t(vn+yn+m)),t((!0===wn?"":vn)+yn+m)(n)}function J(t,r){return function(e){function n(n){return e.setActive(n.state)}return e.setActive(null!==r.get()),t.on("FullscreenStateChanged",n),function(){return t.off("FullscreenStateChanged",n)}}}"undefined"!=typeof window||Function("return this;")();var Q=k(1),Z=k(3),$=k(9),nn=k(11),en=function(n){return O(n.dom.childNodes,M.fromDom)},tn=h(Element.prototype.attachShadow)&&h(Node.prototype.getRootNode),rn=u(tn),on=tn?function(n){return M.fromDom(n.dom.getRootNode())}:function(n){return $(n)?n:P(n)},un=function(n){return l(n.dom.shadowRoot)},ln=function(n){var e=Z(n)?n.dom.parentNode:n.dom;if(null==e||null===e.ownerDocument)return!1;var t,r,o=e.ownerDocument;return L(M.fromDom(e)).fold(function(){return o.body.contains(e)},(t=ln,r=H,function(n){return t(r(n))}))},cn=function(n,e){return S(n)?n.style.getPropertyValue(e):""},fn=function(n,e,t,r){n.dom.removeEventListener(e,t,r)},an=m,sn=function(t,r){return{left:t,top:r,translate:function(n,e){return sn(t+n,r+e)}}},mn=sn,dn=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),hn=tinymce.util.Tools.resolve("tinymce.Env"),gn=tinymce.util.Tools.resolve("tinymce.util.Delay"),pn="data-ephox-mobile-fullscreen-style",vn="position:absolute!important;",yn="top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;",wn=hn.os.isAndroid(),bn=dn.DOM,Sn=z().fold(function(){return{bind:f,unbind:f}},function(e){var t,r=(t=y(f),F(F({},t),{on:function(n){return t.get().each(n)}})),o=w(),u=w(),i=gn.throttle(function(){document.body.scrollTop=0,document.documentElement.scrollTop=0,window.requestAnimationFrame(function(){r.on(function(n){return j(n,{top:e.offsetTop+"px",left:e.offsetLeft+"px",height:e.height+"px",width:e.width+"px"})})})},50);return{bind:function(n){r.set(n),i(),o.set(U("resize",i)),u.set(U("scroll",i))},unbind:function(){r.on(function(){o.clear(),u.clear()}),r.clear()}}}),En=function(o,u){function i(e){e(y,"tox-fullscreen"),e(w,"tox-fullscreen"),e(b,"tox-fullscreen"),L(S).map(function(n){return H(n).dom}).each(function(n){e(n,"tox-fullscreen"),e(n,"tox-shadowhost")})}function n(){var t,n,e,r;x&&(t=o.dom,n="["+pn+"]",A(1!==(e=r=document).nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount?[]:O(r.querySelectorAll(n),M.fromDom),function(n){var e=R(n,pn);"no-styles"!==e?j(n,t.parseStyle(e)):V(n,"style"),V(n,pn)})),i(bn.removeClass),Sn.unbind(),C.from(u.get()).each(function(n){return n.fullscreenChangeHandler.unbind()})}var e,t,r,l,c,f,a,s,m,d,h,g,p,v,y=document.body,w=document.documentElement,b=o.getContainer(),S=M.fromDom(b),E=L(f=M.fromDom(o.getElement())).map(H).getOrThunk(function(){var n=P(f).dom.body;if(null==n)throw new Error("Body is not available yet");return M.fromDom(n)}),T=u.get(),F=M.fromDom(o.getBody()),x=hn.deviceType.isTouch(),D=b.style,k=o.iframeElement.style;T?(T.fullscreenChangeHandler.unbind(),X(o)&&Y(E)&&((l=P(E).dom).exitFullscreen?l.exitFullscreen():l.msExitFullscreen?l.msExitFullscreen():l.webkitCancelFullScreen&&l.webkitCancelFullScreen()),k.width=T.iframeWidth,k.height=T.iframeHeight,D.width=T.containerWidth,D.height=T.containerHeight,D.top=T.containerTop,D.left=T.containerLeft,r=T.scrollPos,window.scrollTo(r.x,r.y),u.set(null),K(o,!1),n(),o.off("remove",n)):(e=B(P(E),void 0!==document.fullscreenElement?"fullscreenchange":void 0!==document.msFullscreenElement?"MSFullscreenChange":void 0!==document.webkitFullscreenElement?"webkitfullscreenchange":"fullscreenchange",function(n){X(o)&&(Y(E)||null===u.get()||En(o,u))}),t={scrollPos:(a=window,g=void 0===a?window:a,p=g.document,d=(m=void 0!==(s=M.fromDom(p))?s.dom:document).body.scrollLeft||m.documentElement.scrollLeft,h=m.body.scrollTop||m.documentElement.scrollTop,v=mn(d,h),z(g).fold(function(){var n=g.document.documentElement,e=n.clientWidth,t=n.clientHeight;return I(v.left,v.top,e,t)},function(n){return I(Math.max(n.pageLeft,v.left),Math.max(n.pageTop,v.top),n.width,n.height)})),containerWidth:D.width,containerHeight:D.height,containerTop:D.top,containerLeft:D.left,iframeWidth:k.width,iframeHeight:k.height,fullscreenChangeHandler:e},x&&G(o.dom,S,F),k.width=k.height="100%",D.width=D.height="",i(bn.addClass),Sn.bind(S),o.on("remove",n),u.set(t),X(o)&&((c=E.dom).requestFullscreen?c.requestFullscreen():c.msRequestFullscreen?c.msRequestFullscreen():c.webkitRequestFullScreen&&c.webkitRequestFullScreen()),K(o,!0))};r.add("fullscreen",function(n){var e,t,r,o,u,i=c(null);return n.inline||(t=i,(e=n).addCommand("mceFullScreen",function(){En(e,t)}),(r=n).ui.registry.addToggleMenuItem("fullscreen",{text:"Fullscreen",icon:"fullscreen",shortcut:"Meta+Shift+F",onAction:l,onSetup:J(r,o=i)}),r.ui.registry.addToggleButton("fullscreen",{tooltip:"Fullscreen",icon:"fullscreen",onAction:l,onSetup:J(r,o)}),n.addShortcut("Meta+Shift+F","","mceFullScreen")),u=i,{isFullscreen:function(){return null!==u.get()}};function l(){return r.execCommand("mceFullScreen")}})}();
|