9 lines
22 KiB
JavaScript
9 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.1 (2019-10-28)
|
||
|
*/
|
||
|
!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 O}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)},_=i(!1),T=i(!0),O=(e={fold:function(n,t){return n()},is:_,isSome:_,isNone:T,getOr:P,getOrThunk:C,getOrDie:function(n){throw new Error(n||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(undefined),or:P,orThunk:C,map:t,each:u,bind:t,exists:_,forall:T,filter:t,equals:A,equals_:A,toArray:function(){return[]},toString:i("none()")},Object.freeze&&Object.freeze(e),e);function A(n){return n.isNone()}function C(n){return n()}function P(n){return n}function N(n,t){return-1<function(n,t){return J.call(n,t)}(n,t)}function E(n,t){for(var e=0,r=n.length;e<r;e++){t(n[e],e)}}function I(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);X.apply(t,n[e])}return t}function S(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 I(e)}function j(n){return/^\w+:/i.test(n)}function F(n,t){var e,r,o=["noopener"],i=n?n.split(/\s+/):[],u=function(n){return n.filter(function(n){return-1===Q.inArray(o,n)})},c=t?0<(e=u(e=i)).length?e.concat(o):o:u(i);return 0<c.length?(r=c,Q.trim(r.sort().join(" "))):""}function L(n,t){return t=t||n.selection.getNode(),Y(t)?n.dom.select("a[href]",t)[0]:n.dom.getParent(t,"a[href]")}function R(n){return n&&"A"===n.nodeName&&!!n.href}function D(n){return function(n,t,e){return E(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 U(n,t){for(var e=0;e<n.length;e++){var r=t(n[e],e);if(r.isSome())return r}return $.none()}function M(n){return a(n.value)?n.value:""}function z(t){return void 0===t&&(t=M),function(n){return $.from(n).map(function(n){return function(n,r){var o=[];return Q.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 q(t,n,e,r){var o=r[n],i=0<t.length;return o!==undefined?function(t,n){return U(n,function(n){return $.some(n).filter(function(n){return n.value===t})})}(o,e).map(function(n){return{url:{value:n.value,meta:{text:i?t:n.text,attach:u}},text:i?t:n.text}}):$.none()}var K,B,V,W,H=function(e){function n(){return o}function t(n){return n(e)}var r=i(e),o={fold:function(n,t){return t(e)},is:function(n){return e===n},isSome:T,isNone:_,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:n,orThunk:n,map:function(n){return H(n(e))},each:function(n){n(e)},bind:t,exists:t,forall:t,filter:function(n){return n(
|