10 lines
22 KiB
JavaScript
10 lines
22 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.1.4 (2019-12-11)
|
||
|
*/
|
||
|
!function(c){"use strict";function n(t){return function(n){return function(n){if(null===n)return"null";var t=typeof n;return"object"==t&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":t}(n)===t}}function u(){}function i(n){return function(){return n}}function t(){return A}var e,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.util.VK"),a=n("string"),f=n("array"),l=n("boolean"),s=n("function"),d=function(n){var t=n.getParam("link_assume_external_targets",!1);return l(t)&&t?1:!a(t)||"http"!==t&&"https"!==t?0:t},m=function(n){return n.getParam("link_context_toolbar",!1,"boolean")},h=function(n){return n.getParam("link_list")},p=function(n){return n.getParam("default_link_target")},g=function(n){return n.getParam("target_list",!0)},v=function(n){return n.getParam("rel_list",[],"array")},y=function(n){return n.getParam("link_class_list",[],"array")},w=function(n){return n.getParam("link_title",!0,"boolean")},x=function(n){return n.getParam("allow_unsafe_link_target",!1,"boolean")},k=function(n){return n.getParam("link_quicklink",!1,"boolean")},b=function(n){var t=c.document.createElement("a");t.target="_blank",t.href=n,t.rel="noreferrer noopener";var e=c.document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,c.window,0,0,0,0,0,!1,!1,!1,!1,0,null),function(n,t){c.document.body.appendChild(n),n.dispatchEvent(t),c.document.body.removeChild(n)}(t,e)},_=function(){return(_=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)},T=i(!1),O=i(!0),A=(e={fold:function(n,t){return n()},is:T,isSome:T,isNone:O,getOr:N,getOrThunk:P,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(undefined),or:N,orThunk:P,map:t,each:u,bind:t,exists:T,forall:O,filter:t,equals:C,equals_:C,toArray:function(){return[]},toString:i("none()")},Object.freeze&&Object.freeze(e),e);function C(n){return n.isNone()}function P(n){return n()}function N(n){return n}function E(n,t){return-1<function(n,t){return Q.call(n,t)}(n,t)}function I(n,t){for(var e=0,r=n.length;e<r;e++){t(n[e],e)}}function S(n){for(var t=[],e=0,r=n.length;e<r;++e){if(!f(n[e]))throw new Error("Arr.flatten item "+e+" was not an array, input: "+n);Y.apply(t,n[e])}return t}function j(n,t){var e=function(n,t){for(var e=n.length,r=new Array(e),o=0;o<e;o++){var i=n[o];r[o]=t(i,o)}return r}(n,t);return S(e)}function F(n){return/^\w+:/i.test(n)}function L(n,t){var e,r,o=["noopener"],i=n?n.split(/\s+/):[],u=function(n){return n.filter(function(n){return-1===Z.inArray(o,n)})},c=t?0<(e=u(e=i)).length?e.concat(o):o:u(i);return 0<c.length?(r=c,Z.trim(r.sort().join(" "))):""}function R(n,t){return t=t||n.selection.getNode(),nn(t)?n.dom.select("a[href]",t)[0]:n.dom.getParent(t,"a[href]")}function D(n){return n&&"A"===n.nodeName&&!!n.href}function U(n){return function(n,t,e){return I(n,function(n){e=t(e,n)}),e}(["title","rel","class","target"],function(t,e){return n[e].each(function(n){t[e]=0<n.length?n:null}),t},{href:n.href})}function M(n,t){var e=_({},t);if(!(0<v(n).length)&&!1===x(n)){var r=L(e.rel,"_blank"===e.target);e.rel=r||null}return J.from(e.target).isNone()&&!1===g(n)&&(e.target=p(n)),e.href=function(n,t){return"http"!==t&&"https"!==t||F(n)?n:t+"://"+n}(e.href,d(n)),e}function z(n,t){for(var e=0;e<n.length;e++){var r=t(n[e],e);if(r.isSome())return r}return J.none()}function q(n){return a(n.value)?n.value:""}function K(t){return void 0===t&&(t=q),function(n){return J.from(n).map(function(n){return function(n,r){var o=[];return Z.each(n,function(n){var t=a(n.text)?n.text:a(n.title)?n.title:"";if(n.menu!==undefined);else{var e=r(n);o.push({text:t,value:e})}}),o}(n,t)})}}function B(t,n,e,r){var o=r[n],i=0<t.length;return o!==undefined?function(t,n){return z(n,function(n){return J.some(n).filter(function(n){return n.value===t
|