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

9 lines
22 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";function P(e){var t=e;return{get:function(){return t},set:function(e){t=e}}}function w(e){return!(null==e)}function _(){}function o(e){return function(){return e}}function e(e){return e}function t(){return l}var n,r=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=o(!(n="function")),s=o(!0),l={fold:function(e,t){return e()},isSome:i,isNone:s,getOr:e,getOrThunk:a,getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:o(null),getOrUndefined:o(void 0),or:e,orThunk:a,map:t,each:_,bind:t,exists:i,forall:s,filter:function(){return l},toArray:function(){return[]},toString:o("none()")};function a(e){return e()}function u(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1}function c(e,t){for(var n=e.length,r=new Array(n),a=0;a<n;a++){var o=e[a];r[a]=t(o,a)}return r}function f(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}function m(){var e,t,n=(e=_,t=P(se.none()),{clear:function(){r(),t.set(se.none())},isSet:function(){return t.get().isSome()},get:function(){return t.get()},set:function(e){r(),t.set(se.some(e))}});function r(){return t.get().each(e)}return ce(ce({},n),{on:function(e){return n.get().each(e)}})}function d(e,t,n){return""===t||e.length>=t.length&&e.substr(n,n+t.length)===t}function C(e,t){return e.fire("PastePlainTextToggle",{state:t})}function T(e){return e.getParam("paste_data_images",!1)}function p(e){return e.getParam("paste_retain_style_properties")}function h(e){return e.getParam("validate")}function g(e){return e.getParam("paste_data_images",!1,"boolean")}function v(e){return ge.explode(e.getParam("images_file_types","jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp","string"))}function y(e){return-1!==e.indexOf(he)}function b(e,t,n){return t?(r=!0===t?"p":t,a=n,o=e.split(/\n\n/),i=function(e,t){var n,r=[],a="<"+e;if("object"==typeof t){for(var o in t)n=o,be.call(t,n)&&r.push(o+'="'+xe.encodeAllRaw(t[o])+'"');r.length&&(a+=" "+r.join(" "))}return a+">"}(r,a),s="</"+r+">",1===(l=ge.map(o,function(e){return e.split(/\n/).join("<br />")})).length?l[0]:ge.map(l,function(e){return i+e+s}).join("")):e.replace(/\r?\n/g,"<br>");var r,a,o,i,s,l}function x(t,e){return ge.each(e,function(e){t=e.constructor===RegExp?t.replace(e,""):t.replace(e[0],e[1])}),t}function D(e){return x(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,function(e,t,n){return t||n?"\xa0":" "}],/<br class="Apple-interchange-newline">/g,/<br>$/i])}function k(e){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument/i.test(e)||/class="OutlineElement/.test(e)||/id="?docs\-internal\-guid\-/.test(e)}function O(r,e){var a,t=p(r);t&&(a=ge.makeMap(t.split(/[, ]/))),e=x(e,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(e,t){return 0<t.length?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var n=r.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody"),o=Ce({valid_elements:n,valid_children:"-li[p]"});ge.each(o.elements,function(e){e.attributes.class||(e.attributes.class={},e.attributesOrder.push("class")),e.attributes.style||(e.attributes.style={},e.attributesOrder.push("style"))});var i=Pe({},o);i.addAttributeFilter("style",function(e){for(var t,n=e.length;n--;)(t=e[n]).attr("style",function(r,a,o,i){var s={},e=r.dom.parseStyle(i);return ge.each(e,function(e,t){switch(t){case"mso-list":var n=/\w+ \w+([0-9]+)/i.exec(i);n&&(o._listLevel=parseInt(n[1],10)),/Ignore/i.test(e)&&o.firstChild&&(o._listIgnore=!0,o.firstChild._listIgnore=!0