tinymce-editor/out/tinymce/plugins/textpattern/plugin.min.js

9 lines
17 KiB
JavaScript
Raw Normal View History

2020-06-09 03:09:43 +02:00
/**
* 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/
*
2021-10-11 00:53:18 +02:00
* Version: 5.9.2 (2021-09-08)
2020-06-09 03:09:43 +02:00
*/
2021-10-11 00:53:18 +02:00
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(){return(u=Object.assign||function(t){for(var n,r=1,e=arguments.length;r<e;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)};function a(t,n,r){if(r||2===arguments.length)for(var e,o=0,a=n.length;o<a;o++)!e&&o in n||((e=e||Array.prototype.slice.call(n,0,o))[o]=n[o]);return t.concat(e||Array.prototype.slice.call(n))}function n(e){return function(t){return r=typeof(n=t),(null===n?"null":"object"==r&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==r&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":r)===e;var n,r}}function e(){}function i(t){return function(){return t}}function o(t){return t}function r(){return m}var f=n("string"),c=n("object"),s=n("array"),l=i(!1),d=i(!0),m={fold:function(t,n){return t()},isSome:l,isNone:d,getOr:o,getOrThunk:g,getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(void 0),or:o,orThunk:g,map:r,each:e,bind:r,exists:l,forall:d,filter:function(){return m},toArray:function(){return[]},toString:i("none()")};function g(t){return t()}function p(t,n){return-1<E.call(t,n)}function h(t,n){for(var r=t.length,e=new Array(r),o=0;o<r;o++){var a=t[o];e[o]=n(a,o)}return e}function v(t,n){for(var r=0,e=t.length;r<e;r++)n(t[r],r)}function y(t,n){for(var r=[],e=0,o=t.length;e<o;e++){var a=t[e];n(a,e)&&r.push(a)}return r}function b(t,e,o){return function(t){for(var n,r=t.length-1;0<=r;r--)n=t[r],o=e(o,n,r)}(t),o}function k(t,n){for(var r=0,e=t.length;r<e;++r)if(!0!==n(t[r],r))return;return 1}var O=function(r){function t(){return o}function n(t){return t(r)}var e=i(r),o={fold:function(t,n){return n(r)},isSome:d,isNone:l,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(t){return O(t(r))},each:function(t){t(r)},bind:n,exists:n,forall:n,filter:function(t){return t(r)?o:m},toArray:function(){return[r]},toString:function(){return"some("+r+")"}};return o},w={some:O,none:r,from:function(t){return null==t?m:O(t)}},C=Array.prototype.slice,E=Array.prototype.indexOf,x=Object.keys,R=Object.hasOwnProperty;function T(t){var n=[],r=[];return v(t,function(t){t.fold(function(t){n.push(t)},function(t){r.push(t)})}),{errors:n,values:r}}function P(t){return"inline-command"===t.type||"inline-format"===t.type}function N(t){return"block-command"===t.type||"block-format"===t.type}function S(o){function a(t){return ut.error({message:t,pattern:o})}function t(t,n,r){if(void 0===o.format)return void 0!==o.cmd?f(o.cmd)?ut.value(r(o.cmd,o.value)):a(t+" pattern has non-string `cmd` parameter"):a(t+" pattern is missing both `format` and `cmd` parameters");var e=void 0;if(s(o.format)){if(!k(o.format,f))return a(t+" pattern has non-string items in the `format` array");e=o.format}else{if(!f(o.format))return a(t+" pattern has non-string `format` parameter");e=[o.format]}return ut.value(n(e))}if(!c(o))return a("Raw pattern is not an object");if(!f(o.start))return a("Raw pattern is missing `start` parameter");if(void 0===o.end)return void 0!==o.replacement?f(o.replacement)?0===o.start.length?a("Replacement pattern has empty `start` parameter"):ut.value({type:"inline-command",start:"",end:o.start,cmd:"mceInsertContent",value:o.replacement}):a("Replacement pattern has non-string `replacement` parameter"):0===o.start.length?a("Block pattern has empty `start` parameter"):t("Block",function(t){return{type:"block-format",start:o.start,format:t[0]}},function(t,n){return{type:"block-command",start:o.start,cmd:t,value:n}});if(!f(o.end))return a("Inline pattern has non-string `end` parameter");if(0===o.start.length&&0===o.end.length)return a("Inline pattern has empty `start` and `end` parameters");var r=o.start,e=o.end;return 0===e.length&&(e=r,r=""),t("Inline",function(t){return{type:"inline-format",start:r,end:e,format:t}},function(t,n){return{type:"inline-command",start:r,end:e,cmd:t,value:n}})}function M(t){