11 lines
9.8 KiB
JavaScript
11 lines
9.8 KiB
JavaScript
/**
|
|
* 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.0.12 (2019-07-18)
|
|
*/
|
|
|
|
!function(d){"use strict";var e,n,r,t,o,i,u,s,c,a,f=function(e){var n=e,r=function(){return n};return{get:r,set:function(e){n=e},clone:function(){return f(r())}}},l=tinymce.util.Tools.resolve("tinymce.PluginManager"),m=function(e){return{isFullscreen:function(){return null!==e.get()}}},h=function(){},v=function(e){return function(){return e}},g=v(!1),O=v(!0),S=g,p=O,x=function(){return E},E=(t={fold:function(e,n){return e()},is:S,isSome:S,isNone:p,getOr:r=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:r,orThunk:n,map:x,ap:x,each:function(){},bind:x,flatten:x,exists:S,forall:p,filter:x,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:v("none()")},Object.freeze&&Object.freeze(t),t),w=function(r){var e=function(){return r},n=function(){return o},t=function(e){return e(r)},o={fold:function(e,n){return n(r)},is:function(e){return r===e},isSome:p,isNone:S,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return w(e(r))},ap:function(e){return e.fold(x,function(e){return w(e(r))})},each:function(e){e(r)},bind:t,flatten:e,exists:t,forall:t,filter:function(e){return e(r)?o:E},equals:function(e){return e.is(r)},equals_:function(e,n){return e.fold(S,function(e){return n(r,e)})},toArray:function(){return[r]},toString:function(){return"some("+r+")"}};return o},N={some:w,none:x,from:function(e){return null===e||e===undefined?E:w(e)}},T=function(n){return function(e){return function(e){if(null===e)return"null";var n=typeof e;return"object"===n&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===n&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":n}(e)===n}},y=T("string"),C=T("function"),b=Array.prototype.slice,A=(C(Array.from)&&Array.from,Object.keys),D=function(e,n){return-1!==e.indexOf(n)},_=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:v(e)}},F={fromHtml:function(e,n){var r=(n||d.document).createElement("div");if(r.innerHTML=e,!r.hasChildNodes()||1<r.childNodes.length)throw d.console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return _(r.childNodes[0])},fromTag:function(e,n){var r=(n||d.document).createElement(e);return _(r)},fromText:function(e,n){var r=(n||d.document).createTextNode(e);return _(r)},fromDom:_,fromPoint:function(e,n,r){var t=e.dom();return N.from(t.elementFromPoint(n,r)).map(_)}},R=(d.Node.ATTRIBUTE_NODE,d.Node.CDATA_SECTION_NODE,d.Node.COMMENT_NODE,d.Node.DOCUMENT_NODE,d.Node.DOCUMENT_TYPE_NODE,d.Node.DOCUMENT_FRAGMENT_NODE,d.Node.ELEMENT_NODE,d.Node.TEXT_NODE,d.Node.PROCESSING_INSTRUCTION_NODE,d.Node.ENTITY_REFERENCE_NODE,d.Node.ENTITY_NODE,d.Node.NOTATION_NODE,function(e,n,r){if(!y(r))throw d.console.error("Invalid call to CSS.set. Property ",n,":: Value ",r,":: Element ",e),new Error("CSS value must be a string: "+r);var t;(t=e).style!==undefined&&C(t.style.getPropertyValue)&&e.style.setProperty(n,r)}),M=function(e,n){var r=e.dom();!function(e,n){for(var r=A(e),t=0,o=r.length;t<o;t++){var i=r[t];n(e[i],i,e)}}(n,function(e,n){R(r,n,e)})},P=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),L=function(e,n){e.fire("FullscreenStateChanged",{state:n})},k=function(e,n){var r=function(e,n){for(var r=0;r<e.length;r++){var t=e[r];if(t.test(n))return t}return undefined}(e,n);if(!r)return{major:0,minor:0};var t=function(e){return Number(n.replace(r,"$"+e))};return j(t(1),t(2))},I=function(){return j(0,0)},j=function(e,n){return{major:e,minor:n}},H={nu:j,detect:function(e,n){var r=String(n).toLowerCase();return 0===e.length?I():k(e,r)},unknown:I},W="Firefox",U=function(e,n){return function(){return n===e}},q=function(e){var n=e.current;return{current:n,version:e.version,isEdge:U("Edge",n),isChrome:U("Chrome",n),isIE:U("IE",n),isOpera:U("Opera",n),isFirefox:U(W,n),isSafari:U("Safari",n)}},B={unknown:function(){return q({current:undefined,version:H.unknown()})},nu:q,edge:v("Edge"),chrome:v("Chrome"),ie:v("IE"),opera:v("Opera"),firefox:v(W),safari:v("Safari")},V="Windows",X="Android",z="Solaris",Y="FreeBSD",G=function(e,n){return function(){return n===e}},$=function(e){var n=e.current;return{current:n,version:e.version,isWindows:G(V,n),isiOS:G("iOS",n),isAndroid:G(X,n),isOSX:G("OSX",n),isLinux:G("Linux",n),isSolaris:G(z,n),isFreeBSD:G(Y,n)}},J={unknown:function(){return $({current:undefined,version:H.unknown()})},nu:$,windows:v(V),ios:v("iOS"),android:v(X),linux:v("Linux"),osx:v("OSX"),solaris:v(z),freebsd:v(Y)},K=function(e,n){var r=String(n).toLowerCase();return function(e,n){for(var r=0,t=e.length;r<t;r++){var o=e[r];if(n(o,r,e))return N.some(o)}return N.none()}(e,function(e){return e.search(r)})},Q=function(e,r){return K(e,r).map(function(e){var n=H.detect(e.versionRegexes,r);return{current:e.name,version:n}})},Z=function(e,r){return K(e,r).map(function(e){var n=H.detect(e.versionRegexes,r);return{current:e.name,version:n}})},ee=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ne=function(n){return function(e){return D(e,n)}},re=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return D(e,"edge/")&&D(e,"chrome")&&D(e,"safari")&&D(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ee],search:function(e){return D(e,"chrome")&&!D(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return D(e,"msie")||D(e,"trident")}},{name:"Opera",versionRegexes:[ee,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ne("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ne("firefox")},{name:"Safari",versionRegexes:[ee,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(D(e,"safari")||D(e,"mobile/"))&&D(e,"applewebkit")}}],te=[{name:"Windows",search:ne("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return D(e,"iphone")||D(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ne("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:ne("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ne("linux"),versionRegexes:[]},{name:"Solaris",search:ne("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ne("freebsd"),versionRegexes:[]}],oe={browsers:v(re),oses:v(te)},ie=function(e){var n,r,t,o,i,u,s,c,a,f,d,l=oe.browsers(),m=oe.oses(),h=Q(l,e).fold(B.unknown,B.nu),g=Z(m,e).fold(J.unknown,J.nu);return{browser:h,os:g,deviceType:(r=h,t=e,o=(n=g).isiOS()&&!0===/ipad/i.test(t),i=n.isiOS()&&!o,u=n.isAndroid()&&3===n.version.major,s=n.isAndroid()&&4===n.version.major,c=o||u||s&&!0===/mobile/i.test(t),a=n.isiOS()||n.isAndroid(),f=a&&!c,d=r.isSafari()&&n.isiOS()&&!1===/safari/i.test(t),{isiPad:v(o),isiPhone:v(i),isTablet:v(c),isPhone:v(f),isTouch:v(a),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:v(d)})}},ue={detect:(u=!(o=function(){var e=d.navigator.userAgent;return ie(e)}),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return u||(u=!0,i=o.apply(null,e)),i})},se=P.DOM,ce=d.window.visualViewport,ae=ue.detect().browser.isSafari()&&ce!==undefined?(s=f(N.none()),c={clear:function(){s.set(N.none())},set:function(e){s.set(N.some(e))},isSet:function(){return s.get().isSome()},on:function(e){s.get().each(e)}},a=function(){d.window.requestAnimationFrame(function(){c.on(function(e){return M(e,{top:ce.offsetTop+"px",left:ce.offsetLeft+"px",height:ce.height+"px",width:ce.width+"px"})})})},{bind:function(e){c.set(e),a(),ce.addEventListener("resize",a),ce.addEventListener("scroll",a)},unbind:function(){c.on(function(){ce.removeEventListener("scroll",a),ce.removeEventListener("resize",a)}),c.clear()}}):{bind:h,unbind:h},fe=function(e,n){var r,t,o,i,u,s=d.document.body,c=d.document.documentElement,a=n.get();if(r=(t=e.getContainer()).style,o=e.getContentAreaContainer().firstChild.style,a)o.width=a.iframeWidth,o.height=a.iframeHeight,a.containerWidth&&(r.width=a.containerWidth),a.containerHeight&&(r.height=a.containerHeight),se.removeClass(s,"tox-fullscreen"),se.removeClass(c,"tox-fullscreen"),se.removeClass(t,"tox-fullscreen"),i=a.scrollPos,d.window.scrollTo(i.x,i.y),n.set(null),L(e,!1),ae.unbind(),e.off("remove",ae.unbind);else{var f={scrollPos:(u=se.getViewPort(),{x:u.x,y:u.y}),containerWidth:r.width,containerHeight:r.height,iframeWidth:o.width,iframeHeight:o.height};o.width=o.height="100%",r.width=r.height="",se.addClass(s,"tox-fullscreen"),se.addClass(c,"tox-fullscreen"),se.addClass(t,"tox-fullscreen"),ae.bind(F.fromDom(t)),e.on("remove",ae.unbind),n.set(f),L(e,!0)}},de=function(e,n){e.addCommand("mceFullScreen",function(){fe(e,n)})},le=function(r,t){return function(n){n.setActive(null!==t.get());var e=function(e){return n.setActive(e.state)};return r.on("FullscreenStateChanged",e),function(){return r.off("FullscreenStateChanged",e)}}},me=function(e,n){e.ui.registry.addToggleMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Meta+Shift+F",onAction:function(){return e.execCommand("mceFullScreen")},onSetup:le(e,n)}),e.ui.registry.addToggleButton("fullscreen",{tooltip:"Fullscreen",icon:"fullscreen",onAction:function(){return e.execCommand("mceFullScreen")},onSetup:le(e,n)})};!function he(){l.add("fullscreen",function(e){var n=f(null);return e.settings.inline||(de(e,n),me(e,n),e.addShortcut("Meta+Shift+F","","mceFullScreen")),m(n)})}()}(window);
|