| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683 | /** * 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.3.0 (2020-05-21) */(function (domGlobals) {    'use strict';    var Cell = function (initial) {      var value = initial;      var get = function () {        return value;      };      var set = function (v) {        value = v;      };      return {        get: get,        set: set      };    };    var global = tinymce.util.Tools.resolve('tinymce.PluginManager');    var hasProPlugin = function (editor) {      if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) {        if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) {          domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');        }        return true;      } else {        return false;      }    };    var get = function (clipboard, quirks) {      return {        clipboard: clipboard,        quirks: quirks      };    };    var firePastePreProcess = function (editor, html, internal, isWordHtml) {      return editor.fire('PastePreProcess', {        content: html,        internal: internal,        wordContent: isWordHtml      });    };    var firePastePostProcess = function (editor, node, internal, isWordHtml) {      return editor.fire('PastePostProcess', {        node: node,        internal: internal,        wordContent: isWordHtml      });    };    var firePastePlainTextToggle = function (editor, state) {      return editor.fire('PastePlainTextToggle', { state: state });    };    var firePaste = function (editor, ieFake) {      return editor.fire('paste', { ieFake: ieFake });    };    var togglePlainTextPaste = function (editor, clipboard) {      if (clipboard.pasteFormat.get() === 'text') {        clipboard.pasteFormat.set('html');        firePastePlainTextToggle(editor, false);      } else {        clipboard.pasteFormat.set('text');        firePastePlainTextToggle(editor, true);      }      editor.focus();    };    var register = function (editor, clipboard) {      editor.addCommand('mceTogglePlainTextPaste', function () {        togglePlainTextPaste(editor, clipboard);      });      editor.addCommand('mceInsertClipboardContent', function (ui, value) {        if (value.content) {          clipboard.pasteHtml(value.content, value.internal);        }        if (value.text) {          clipboard.pasteText(value.text);        }      });    };    var noop = function () {    };    var constant = function (value) {      return function () {        return value;      };    };    var never = constant(false);    var always = constant(true);    var none = function () {      return NONE;    };    var NONE = function () {      var eq = function (o) {        return o.isNone();      };      var call = function (thunk) {        return thunk();      };      var id = function (n) {        return n;      };      var me = {        fold: function (n, _s) {          return n();        },        is: never,        isSome: never,        isNone: always,        getOr: id,        getOrThunk: call,        getOrDie: function (msg) {          throw new Error(msg || 'error: getOrDie called on none.');        },        getOrNull: constant(null),        getOrUndefined: constant(undefined),        or: id,        orThunk: call,        map: none,        each: noop,        bind: none,        exists: never,        forall: always,        filter: none,        equals: eq,        equals_: eq,        toArray: function () {          return [];        },        toString: constant('none()')      };      return me;    }();    var some = function (a) {      var constant_a = constant(a);      var self = function () {        return me;      };      var bind = function (f) {        return f(a);      };      var me = {        fold: function (n, s) {          return s(a);        },        is: function (v) {          return a === v;        },        isSome: always,        isNone: never,        getOr: constant_a,        getOrThunk: constant_a,        getOrDie: constant_a,        getOrNull: constant_a,        getOrUndefined: constant_a,        or: self,        orThunk: self,        map: function (f) {          return some(f(a));        },        each: function (f) {          f(a);        },        bind: bind,        exists: bind,        forall: bind,        filter: function (f) {          return f(a) ? me : NONE;        },        toArray: function () {          return [a];        },        toString: function () {          return 'some(' + a + ')';        },        equals: function (o) {          return o.is(a);        },        equals_: function (o, elementEq) {          return o.fold(never, function (b) {            return elementEq(a, b);          });        }      };      return me;    };    var from = function (value) {      return value === null || value === undefined ? NONE : some(value);    };    var Option = {      some: some,      none: none,      from: from    };    var isSimpleType = function (type) {      return function (value) {        return typeof value === type;      };    };    var isFunction = isSimpleType('function');    var nativeSlice = Array.prototype.slice;    var map = function (xs, f) {      var len = xs.length;      var r = new Array(len);      for (var i = 0; i < len; i++) {        var x = xs[i];        r[i] = f(x, i);      }      return r;    };    var each = function (xs, f) {      for (var i = 0, len = xs.length; i < len; i++) {        var x = xs[i];        f(x, i);      }    };    var filter = function (xs, pred) {      var r = [];      for (var i = 0, len = xs.length; i < len; i++) {        var x = xs[i];        if (pred(x, i)) {          r.push(x);        }      }      return r;    };    var foldl = function (xs, f, acc) {      each(xs, function (x) {        acc = f(acc, x);      });      return acc;    };    var from$1 = isFunction(Array.from) ? Array.from : function (x) {      return nativeSlice.call(x);    };    var value = function () {      var subject = Cell(Option.none());      var clear = function () {        subject.set(Option.none());      };      var set = function (s) {        subject.set(Option.some(s));      };      var on = function (f) {        subject.get().each(f);      };      var isSet = function () {        return subject.get().isSome();      };      return {        clear: clear,        set: set,        isSet: isSet,        on: on      };    };    var global$1 = tinymce.util.Tools.resolve('tinymce.Env');    var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');    var global$3 = tinymce.util.Tools.resolve('tinymce.util.Promise');    var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');    var global$5 = tinymce.util.Tools.resolve('tinymce.util.VK');    var internalMimeType = 'x-tinymce/html';    var internalMark = '<!-- ' + internalMimeType + ' -->';    var mark = function (html) {      return internalMark + html;    };    var unmark = function (html) {      return html.replace(internalMark, '');    };    var isMarked = function (html) {      return html.indexOf(internalMark) !== -1;    };    var internalHtmlMime = function () {      return internalMimeType;    };    var global$6 = tinymce.util.Tools.resolve('tinymce.html.Entities');    var isPlainText = function (text) {      return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);    };    var toBRs = function (text) {      return text.replace(/\r?\n/g, '<br>');    };    var openContainer = function (rootTag, rootAttrs) {      var key;      var attrs = [];      var tag = '<' + rootTag;      if (typeof rootAttrs === 'object') {        for (key in rootAttrs) {          if (rootAttrs.hasOwnProperty(key)) {            attrs.push(key + '="' + global$6.encodeAllRaw(rootAttrs[key]) + '"');          }        }        if (attrs.length) {          tag += ' ' + attrs.join(' ');        }      }      return tag + '>';    };    var toBlockElements = function (text, rootTag, rootAttrs) {      var blocks = text.split(/\n\n/);      var tagOpen = openContainer(rootTag, rootAttrs);      var tagClose = '</' + rootTag + '>';      var paragraphs = global$4.map(blocks, function (p) {        return p.split(/\n/).join('<br />');      });      var stitch = function (p) {        return tagOpen + p + tagClose;      };      return paragraphs.length === 1 ? paragraphs[0] : global$4.map(paragraphs, stitch).join('');    };    var convert = function (text, rootTag, rootAttrs) {      return rootTag ? toBlockElements(text, rootTag === true ? 'p' : rootTag, rootAttrs) : toBRs(text);    };    var global$7 = tinymce.util.Tools.resolve('tinymce.html.DomParser');    var global$8 = tinymce.util.Tools.resolve('tinymce.html.Serializer');    var global$9 = tinymce.util.Tools.resolve('tinymce.html.Node');    var global$a = tinymce.util.Tools.resolve('tinymce.html.Schema');    var shouldBlockDrop = function (editor) {      return editor.getParam('paste_block_drop', false);    };    var shouldPasteDataImages = function (editor) {      return editor.getParam('paste_data_images', false);    };    var shouldFilterDrop = function (editor) {      return editor.getParam('paste_filter_drop', true);    };    var getPreProcess = function (editor) {      return editor.getParam('paste_preprocess');    };    var getPostProcess = function (editor) {      return editor.getParam('paste_postprocess');    };    var getWebkitStyles = function (editor) {      return editor.getParam('paste_webkit_styles');    };    var shouldRemoveWebKitStyles = function (editor) {      return editor.getParam('paste_remove_styles_if_webkit', true);    };    var shouldMergeFormats = function (editor) {      return editor.getParam('paste_merge_formats', true);    };    var isSmartPasteEnabled = function (editor) {      return editor.getParam('smart_paste', true);    };    var isPasteAsTextEnabled = function (editor) {      return editor.getParam('paste_as_text', false);    };    var getRetainStyleProps = function (editor) {      return editor.getParam('paste_retain_style_properties');    };    var getWordValidElements = function (editor) {      var defaultValidElements = '-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';      return editor.getParam('paste_word_valid_elements', defaultValidElements);    };    var shouldConvertWordFakeLists = function (editor) {      return editor.getParam('paste_convert_word_fake_lists', true);    };    var shouldUseDefaultFilters = function (editor) {      return editor.getParam('paste_enable_default_filters', true);    };    var nbsp = '\xA0';    function filter$1(content, items) {      global$4.each(items, function (v) {        if (v.constructor === RegExp) {          content = content.replace(v, '');        } else {          content = content.replace(v[0], v[1]);        }      });      return content;    }    function innerText(html) {      var schema = global$a();      var domParser = global$7({}, schema);      var text = '';      var shortEndedElements = schema.getShortEndedElements();      var ignoreElements = global$4.makeMap('script noscript style textarea video audio iframe object', ' ');      var blockElements = schema.getBlockElements();      function walk(node) {        var name = node.name, currentNode = node;        if (name === 'br') {          text += '\n';          return;        }        if (name === 'wbr') {          return;        }        if (shortEndedElements[name]) {          text += ' ';        }        if (ignoreElements[name]) {          text += ' ';          return;        }        if (node.type === 3) {          text += node.value;        }        if (!node.shortEnded) {          if (node = node.firstChild) {            do {              walk(node);            } while (node = node.next);          }        }        if (blockElements[name] && currentNode.next) {          text += '\n';          if (name === 'p') {            text += '\n';          }        }      }      html = filter$1(html, [/<!\[[^\]]+\]>/g]);      walk(domParser.parse(html));      return text;    }    function trimHtml(html) {      function trimSpaces(all, s1, s2) {        if (!s1 && !s2) {          return ' ';        }        return nbsp;      }      html = filter$1(html, [        /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,        /<!--StartFragment-->|<!--EndFragment-->/g,        [          /( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,          trimSpaces        ],        /<br class="Apple-interchange-newline">/g,        /<br>$/i      ]);      return html;    }    function createIdGenerator(prefix) {      var count = 0;      return function () {        return prefix + count++;      };    }    var isMsEdge = function () {      return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1;    };    function isWordContent(content) {      return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);    }    function isNumericList(text) {      var found, patterns;      patterns = [        /^[IVXLMCD]{1,2}\.[ \u00a0]/,        /^[ivxlmcd]{1,2}\.[ \u00a0]/,        /^[a-z]{1,2}[\.\)][ \u00a0]/,        /^[A-Z]{1,2}[\.\)][ \u00a0]/,        /^[0-9]+\.[ \u00a0]/,        /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,        /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/      ];      text = text.replace(/^[\u00a0 ]+/, '');      global$4.each(patterns, function (pattern) {        if (pattern.test(text)) {          found = true;          return false;        }      });      return found;    }    function isBulletList(text) {      return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);    }    function convertFakeListsToProperLists(node) {      var currentListNode, prevListNode, lastLevel = 1;      function getText(node) {        var txt = '';        if (node.type === 3) {          return node.value;        }        if (node = node.firstChild) {          do {            txt += getText(node);          } while (node = node.next);        }        return txt;      }      function trimListStart(node, regExp) {        if (node.type === 3) {          if (regExp.test(node.value)) {            node.value = node.value.replace(regExp, '');            return false;          }        }        if (node = node.firstChild) {          do {            if (!trimListStart(node, regExp)) {              return false;            }          } while (node = node.next);        }        return true;      }      function removeIgnoredNodes(node) {        if (node._listIgnore) {          node.remove();          return;        }        if (node = node.firstChild) {          do {            removeIgnoredNodes(node);          } while (node = node.next);        }      }      function convertParagraphToLi(paragraphNode, listName, start) {        var level = paragraphNode._listLevel || lastLevel;        if (level !== lastLevel) {          if (level < lastLevel) {            if (currentListNode) {              currentListNode = currentListNode.parent.parent;            }          } else {            prevListNode = currentListNode;            currentListNode = null;          }        }        if (!currentListNode || currentListNode.name !== listName) {          prevListNode = prevListNode || currentListNode;          currentListNode = new global$9(listName, 1);          if (start > 1) {            currentListNode.attr('start', '' + start);          }          paragraphNode.wrap(currentListNode);        } else {          currentListNode.append(paragraphNode);        }        paragraphNode.name = 'li';        if (level > lastLevel && prevListNode) {          prevListNode.lastChild.append(currentListNode);        }        lastLevel = level;        removeIgnoredNodes(paragraphNode);        trimListStart(paragraphNode, /^\u00a0+/);        trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);        trimListStart(paragraphNode, /^\u00a0+/);      }      var elements = [];      var child = node.firstChild;      while (typeof child !== 'undefined' && child !== null) {        elements.push(child);        child = child.walk();        if (child !== null) {          while (typeof child !== 'undefined' && child.parent !== node) {            child = child.walk();          }        }      }      for (var i = 0; i < elements.length; i++) {        node = elements[i];        if (node.name === 'p' && node.firstChild) {          var nodeText = getText(node);          if (isBulletList(nodeText)) {            convertParagraphToLi(node, 'ul');            continue;          }          if (isNumericList(nodeText)) {            var matches = /([0-9]+)\./.exec(nodeText);            var start = 1;            if (matches) {              start = parseInt(matches[1], 10);            }            convertParagraphToLi(node, 'ol', start);            continue;          }          if (node._listLevel) {            convertParagraphToLi(node, 'ul', 1);            continue;          }          currentListNode = null;        } else {          prevListNode = currentListNode;          currentListNode = null;        }      }    }    function filterStyles(editor, validStyles, node, styleValue) {      var outputStyles = {}, matches;      var styles = editor.dom.parseStyle(styleValue);      global$4.each(styles, function (value, name) {        switch (name) {        case 'mso-list':          matches = /\w+ \w+([0-9]+)/i.exec(styleValue);          if (matches) {            node._listLevel = parseInt(matches[1], 10);          }          if (/Ignore/i.test(value) && node.firstChild) {            node._listIgnore = true;            node.firstChild._listIgnore = true;          }          break;        case 'horiz-align':          name = 'text-align';          break;        case 'vert-align':          name = 'vertical-align';          break;        case 'font-color':        case 'mso-foreground':          name = 'color';          break;        case 'mso-background':        case 'mso-highlight':          name = 'background';          break;        case 'font-weight':        case 'font-style':          if (value !== 'normal') {            outputStyles[name] = value;          }          return;        case 'mso-element':          if (/^(comment|comment-list)$/i.test(value)) {            node.remove();            return;          }          break;        }        if (name.indexOf('mso-comment') === 0) {          node.remove();          return;        }        if (name.indexOf('mso-') === 0) {          return;        }        if (getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {          outputStyles[name] = value;        }      });      if (/(bold)/i.test(outputStyles['font-weight'])) {        delete outputStyles['font-weight'];        node.wrap(new global$9('b', 1));      }      if (/(italic)/i.test(outputStyles['font-style'])) {        delete outputStyles['font-style'];        node.wrap(new global$9('i', 1));      }      outputStyles = editor.dom.serializeStyle(outputStyles, node.name);      if (outputStyles) {        return outputStyles;      }      return null;    }    var filterWordContent = function (editor, content) {      var retainStyleProperties, validStyles;      retainStyleProperties = getRetainStyleProps(editor);      if (retainStyleProperties) {        validStyles = global$4.makeMap(retainStyleProperties.split(/[, ]/));      }      content = filter$1(content, [        /<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>'        ],        [          / /gi,          nbsp        ],        [          /<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,          function (str, spaces) {            return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join(nbsp) : '';          }        ]      ]);      var validElements = getWordValidElements(editor);      var schema = global$a({        valid_elements: validElements,        valid_children: '-li[p]'      });      global$4.each(schema.elements, function (rule) {        if (!rule.attributes.class) {          rule.attributes.class = {};          rule.attributesOrder.push('class');        }        if (!rule.attributes.style) {          rule.attributes.style = {};          rule.attributesOrder.push('style');        }      });      var domParser = global$7({}, schema);      domParser.addAttributeFilter('style', function (nodes) {        var i = nodes.length, node;        while (i--) {          node = nodes[i];          node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));          if (node.name === 'span' && node.parent && !node.attributes.length) {            node.unwrap();          }        }      });      domParser.addAttributeFilter('class', function (nodes) {        var i = nodes.length, node, className;        while (i--) {          node = nodes[i];          className = node.attr('class');          if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {            node.remove();          }          node.attr('class', null);        }      });      domParser.addNodeFilter('del', function (nodes) {        var i = nodes.length;        while (i--) {          nodes[i].remove();        }      });      domParser.addNodeFilter('a', function (nodes) {        var i = nodes.length, node, href, name;        while (i--) {          node = nodes[i];          href = node.attr('href');          name = node.attr('name');          if (href && href.indexOf('#_msocom_') !== -1) {            node.remove();            continue;          }          if (href && href.indexOf('file://') === 0) {            href = href.split('#')[1];            if (href) {              href = '#' + href;            }          }          if (!href && !name) {            node.unwrap();          } else {            if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {              node.unwrap();              continue;            }            node.attr({              href: href,              name: name            });          }        }      });      var rootNode = domParser.parse(content);      if (shouldConvertWordFakeLists(editor)) {        convertFakeListsToProperLists(rootNode);      }      content = global$8({ validate: editor.settings.validate }, schema).serialize(rootNode);      return content;    };    var preProcess = function (editor, content) {      return shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;    };    var preProcess$1 = function (editor, html) {      var parser = global$7({}, editor.schema);      parser.addNodeFilter('meta', function (nodes) {        global$4.each(nodes, function (node) {          return node.remove();        });      });      var fragment = parser.parse(html, {        forced_root_block: false,        isRootContent: true      });      return global$8({ validate: editor.settings.validate }, editor.schema).serialize(fragment);    };    var processResult = function (content, cancelled) {      return {        content: content,        cancelled: cancelled      };    };    var postProcessFilter = function (editor, html, internal, isWordHtml) {      var tempBody = editor.dom.create('div', { style: 'display:none' }, html);      var postProcessArgs = firePastePostProcess(editor, tempBody, internal, isWordHtml);      return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());    };    var filterContent = function (editor, content, internal, isWordHtml) {      var preProcessArgs = firePastePreProcess(editor, content, internal, isWordHtml);      var filteredContent = preProcess$1(editor, preProcessArgs.content);      if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {        return postProcessFilter(editor, filteredContent, internal, isWordHtml);      } else {        return processResult(filteredContent, preProcessArgs.isDefaultPrevented());      }    };    var process = function (editor, html, internal) {      var isWordHtml = isWordContent(html);      var content = isWordHtml ? preProcess(editor, html) : html;      return filterContent(editor, content, internal, isWordHtml);    };    var pasteHtml = function (editor, html) {      editor.insertContent(html, {        merge: shouldMergeFormats(editor),        paste: true      });      return true;    };    var isAbsoluteUrl = function (url) {      return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);    };    var isImageUrl = function (url) {      return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);    };    var createImage = function (editor, url, pasteHtmlFn) {      editor.undoManager.extra(function () {        pasteHtmlFn(editor, url);      }, function () {        editor.insertContent('<img src="' + url + '">');      });      return true;    };    var createLink = function (editor, url, pasteHtmlFn) {      editor.undoManager.extra(function () {        pasteHtmlFn(editor, url);      }, function () {        editor.execCommand('mceInsertLink', false, url);      });      return true;    };    var linkSelection = function (editor, html, pasteHtmlFn) {      return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;    };    var insertImage = function (editor, html, pasteHtmlFn) {      return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false;    };    var smartInsertContent = function (editor, html) {      global$4.each([        linkSelection,        insertImage,        pasteHtml      ], function (action) {        return action(editor, html, pasteHtml) !== true;      });    };    var insertContent = function (editor, html, pasteAsText) {      if (pasteAsText || isSmartPasteEnabled(editor) === false) {        pasteHtml(editor, html);      } else {        smartInsertContent(editor, html);      }    };    var isCollapsibleWhitespace = function (c) {      return ' \f\t\x0B'.indexOf(c) !== -1;    };    var isNewLineChar = function (c) {      return c === '\n' || c === '\r';    };    var isNewline = function (text, idx) {      return idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false;    };    var normalizeWhitespace = function (text) {      var result = foldl(text, function (acc, c) {        if (isCollapsibleWhitespace(c) || c === nbsp) {          if (acc.pcIsSpace || acc.str === '' || acc.str.length === text.length - 1 || isNewline(text, acc.str.length + 1)) {            return {              pcIsSpace: false,              str: acc.str + nbsp            };          } else {            return {              pcIsSpace: true,              str: acc.str + ' '            };          }        } else {          return {            pcIsSpace: isNewLineChar(c),            str: acc.str + c          };        }      }, {        pcIsSpace: false,        str: ''      });      return result.str;    };    var doPaste = function (editor, content, internal, pasteAsText) {      var args = process(editor, content, internal);      if (args.cancelled === false) {        insertContent(editor, args.content, pasteAsText);      }    };    var pasteHtml$1 = function (editor, html, internalFlag) {      var internal = internalFlag ? internalFlag : isMarked(html);      doPaste(editor, unmark(html), internal, false);    };    var pasteText = function (editor, text) {      var encodedText = editor.dom.encode(text).replace(/\r\n/g, '\n');      var normalizedText = normalizeWhitespace(encodedText);      var html = convert(normalizedText, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);      doPaste(editor, html, false, true);    };    var getDataTransferItems = function (dataTransfer) {      var items = {};      var mceInternalUrlPrefix = 'data:text/mce-internal,';      if (dataTransfer) {        if (dataTransfer.getData) {          var legacyText = dataTransfer.getData('Text');          if (legacyText && legacyText.length > 0) {            if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {              items['text/plain'] = legacyText;            }          }        }        if (dataTransfer.types) {          for (var i = 0; i < dataTransfer.types.length; i++) {            var contentType = dataTransfer.types[i];            try {              items[contentType] = dataTransfer.getData(contentType);            } catch (ex) {              items[contentType] = '';            }          }        }      }      return items;    };    var getClipboardContent = function (editor, clipboardEvent) {      var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);      return isMsEdge() ? global$4.extend(content, { 'text/html': '' }) : content;    };    var hasContentType = function (clipboardContent, mimeType) {      return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;    };    var hasHtmlOrText = function (content) {      return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');    };    var parseDataUri = function (uri) {      var matches = /data:([^;]+);base64,([a-z0-9\+\/=]+)/i.exec(uri);      if (matches) {        return {          type: matches[1],          data: decodeURIComponent(matches[2])        };      } else {        return {          type: null,          data: null        };      }    };    var isValidDataUriImage = function (settings, imgElm) {      return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;    };    var extractFilename = function (editor, str) {      var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);      return m ? editor.dom.encode(m[1]) : null;    };    var uniqueId = createIdGenerator('mceclip');    var pasteImage = function (editor, imageItem) {      var _a = parseDataUri(imageItem.uri), base64 = _a.data, type = _a.type;      var id = uniqueId();      var name = editor.settings.images_reuse_filename && imageItem.blob.name ? extractFilename(editor, imageItem.blob.name) : id;      var img = new domGlobals.Image();      img.src = imageItem.uri;      if (isValidDataUriImage(editor.settings, img)) {        var blobCache = editor.editorUpload.blobCache;        var blobInfo = void 0;        var existingBlobInfo = blobCache.getByData(base64, type);        if (!existingBlobInfo) {          blobInfo = blobCache.create(id, imageItem.blob, base64, name);          blobCache.add(blobInfo);        } else {          blobInfo = existingBlobInfo;        }        pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);      } else {        pasteHtml$1(editor, '<img src="' + imageItem.uri + '">', false);      }    };    var isClipboardEvent = function (event) {      return event.type === 'paste';    };    var readBlobsAsDataUris = function (items) {      return global$3.all(map(items, function (item) {        return new global$3(function (resolve) {          var blob = item.getAsFile ? item.getAsFile() : item;          var reader = new window.FileReader();          reader.onload = function () {            resolve({              blob: blob,              uri: reader.result            });          };          reader.readAsDataURL(blob);        });      }));    };    var getImagesFromDataTransfer = function (dataTransfer) {      var items = dataTransfer.items ? map(from$1(dataTransfer.items), function (item) {        return item.getAsFile();      }) : [];      var files = dataTransfer.files ? from$1(dataTransfer.files) : [];      var images = filter(items.length > 0 ? items : files, function (file) {        return /^image\/(jpeg|png|gif|bmp)$/.test(file.type);      });      return images;    };    var pasteImageData = function (editor, e, rng) {      var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;      if (editor.settings.paste_data_images && dataTransfer) {        var images = getImagesFromDataTransfer(dataTransfer);        if (images.length > 0) {          e.preventDefault();          readBlobsAsDataUris(images).then(function (blobResults) {            if (rng) {              editor.selection.setRng(rng);            }            each(blobResults, function (result) {              pasteImage(editor, result);            });          });          return true;        }      }      return false;    };    var isBrokenAndroidClipboardEvent = function (e) {      var clipboardData = e.clipboardData;      return domGlobals.navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;    };    var isKeyboardPasteEvent = function (e) {      return global$5.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;    };    var registerEventHandlers = function (editor, pasteBin, pasteFormat) {      var keyboardPasteEvent = value();      var keyboardPastePlainTextState;      editor.on('keydown', function (e) {        function removePasteBinOnKeyUp(e) {          if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {            pasteBin.remove();          }        }        if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {          keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;          if (keyboardPastePlainTextState && global$1.webkit && domGlobals.navigator.userAgent.indexOf('Version/') !== -1) {            return;          }          e.stopImmediatePropagation();          keyboardPasteEvent.set(e);          window.setTimeout(function () {            keyboardPasteEvent.clear();          }, 100);          if (global$1.ie && keyboardPastePlainTextState) {            e.preventDefault();            firePaste(editor, true);            return;          }          pasteBin.remove();          pasteBin.create();          editor.once('keyup', removePasteBinOnKeyUp);          editor.once('paste', function () {            editor.off('keyup', removePasteBinOnKeyUp);          });        }      });      function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {        var content, isPlainTextHtml, isImage;        if (hasContentType(clipboardContent, 'text/html')) {          content = clipboardContent['text/html'];        } else {          content = pasteBin.getHtml();          internal = internal ? internal : isMarked(content);          if (pasteBin.isDefaultContent(content)) {            plainTextMode = true;          }        }        content = trimHtml(content);        pasteBin.remove();        isPlainTextHtml = internal === false && isPlainText(content);        isImage = isImageUrl(content);        if (!content.length || isPlainTextHtml && !isImage) {          plainTextMode = true;        }        if (plainTextMode || isImage) {          if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {            content = clipboardContent['text/plain'];          } else {            content = innerText(content);          }        }        if (pasteBin.isDefaultContent(content)) {          if (!isKeyBoardPaste) {            editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');          }          return;        }        if (plainTextMode) {          pasteText(editor, content);        } else {          pasteHtml$1(editor, content, internal);        }      }      var getLastRng = function () {        return pasteBin.getLastRng() || editor.selection.getRng();      };      editor.on('paste', function (e) {        var isKeyBoardPaste = keyboardPasteEvent.isSet();        var clipboardContent = getClipboardContent(editor, e);        var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;        var internal = hasContentType(clipboardContent, internalHtmlMime());        keyboardPastePlainTextState = false;        if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {          pasteBin.remove();          return;        }        if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {          pasteBin.remove();          return;        }        if (!isKeyBoardPaste) {          e.preventDefault();        }        if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {          pasteBin.create();          editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {            e.stopPropagation();          });          editor.getDoc().execCommand('Paste', false, null);          clipboardContent['text/html'] = pasteBin.getHtml();        }        if (hasContentType(clipboardContent, 'text/html')) {          e.preventDefault();          if (!internal) {            internal = isMarked(clipboardContent['text/html']);          }          insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);        } else {          global$2.setEditorTimeout(editor, function () {            insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);          }, 0);        }      });    };    var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {      registerEventHandlers(editor, pasteBin, pasteFormat);      var src;      editor.parser.addNodeFilter('img', function (nodes, name, args) {        var isPasteInsert = function (args) {          return args.data && args.data.paste === true;        };        var remove = function (node) {          if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) {            node.remove();          }        };        var isWebKitFakeUrl = function (src) {          return src.indexOf('webkit-fake-url') === 0;        };        var isDataUri = function (src) {          return src.indexOf('data:') === 0;        };        if (!editor.settings.paste_data_images && isPasteInsert(args)) {          var i = nodes.length;          while (i--) {            src = nodes[i].attr('src');            if (!src) {              continue;            }            if (isWebKitFakeUrl(src)) {              remove(nodes[i]);            } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {              remove(nodes[i]);            }          }        }      });    };    var getPasteBinParent = function (editor) {      return global$1.ie && editor.inline ? domGlobals.document.body : editor.getBody();    };    var isExternalPasteBin = function (editor) {      return getPasteBinParent(editor) !== editor.getBody();    };    var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {      if (isExternalPasteBin(editor)) {        editor.dom.bind(pasteBinElm, 'paste keyup', function (_e) {          if (!isDefault(editor, pasteBinDefaultContent)) {            editor.fire('paste');          }        });      }    };    var create = function (editor, lastRngCell, pasteBinDefaultContent) {      var dom = editor.dom, body = editor.getBody();      var pasteBinElm;      lastRngCell.set(editor.selection.getRng());      pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {        'id': 'mcepastebin',        'class': 'mce-pastebin',        'contentEditable': true,        'data-mce-bogus': 'all',        'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'      }, pasteBinDefaultContent);      if (global$1.ie || global$1.gecko) {        dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);      }      dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {        e.stopPropagation();      });      delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);      pasteBinElm.focus();      editor.selection.select(pasteBinElm, true);    };    var remove = function (editor, lastRngCell) {      if (getEl(editor)) {        var pasteBinClone = void 0;        var lastRng = lastRngCell.get();        while (pasteBinClone = editor.dom.get('mcepastebin')) {          editor.dom.remove(pasteBinClone);          editor.dom.unbind(pasteBinClone);        }        if (lastRng) {          editor.selection.setRng(lastRng);        }      }      lastRngCell.set(null);    };    var getEl = function (editor) {      return editor.dom.get('mcepastebin');    };    var getHtml = function (editor) {      var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;      var copyAndRemove = function (toElm, fromElm) {        toElm.appendChild(fromElm);        editor.dom.remove(fromElm, true);      };      pasteBinClones = global$4.grep(getPasteBinParent(editor).childNodes, function (elm) {        return elm.id === 'mcepastebin';      });      pasteBinElm = pasteBinClones.shift();      global$4.each(pasteBinClones, function (pasteBinClone) {        copyAndRemove(pasteBinElm, pasteBinClone);      });      dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);      for (i = dirtyWrappers.length - 1; i >= 0; i--) {        cleanWrapper = editor.dom.create('div');        pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);        copyAndRemove(cleanWrapper, dirtyWrappers[i]);      }      return pasteBinElm ? pasteBinElm.innerHTML : '';    };    var getLastRng = function (lastRng) {      return lastRng.get();    };    var isDefaultContent = function (pasteBinDefaultContent, content) {      return content === pasteBinDefaultContent;    };    var isPasteBin = function (elm) {      return elm && elm.id === 'mcepastebin';    };    var isDefault = function (editor, pasteBinDefaultContent) {      var pasteBinElm = getEl(editor);      return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);    };    var PasteBin = function (editor) {      var lastRng = Cell(null);      var pasteBinDefaultContent = '%MCEPASTEBIN%';      return {        create: function () {          return create(editor, lastRng, pasteBinDefaultContent);        },        remove: function () {          return remove(editor, lastRng);        },        getEl: function () {          return getEl(editor);        },        getHtml: function () {          return getHtml(editor);        },        getLastRng: function () {          return getLastRng(lastRng);        },        isDefault: function () {          return isDefault(editor, pasteBinDefaultContent);        },        isDefaultContent: function (content) {          return isDefaultContent(pasteBinDefaultContent, content);        }      };    };    var Clipboard = function (editor, pasteFormat) {      var pasteBin = PasteBin(editor);      editor.on('PreInit', function () {        return registerEventsAndFilters(editor, pasteBin, pasteFormat);      });      return {        pasteFormat: pasteFormat,        pasteHtml: function (html, internalFlag) {          return pasteHtml$1(editor, html, internalFlag);        },        pasteText: function (text) {          return pasteText(editor, text);        },        pasteImageData: function (e, rng) {          return pasteImageData(editor, e, rng);        },        getDataTransferItems: getDataTransferItems,        hasHtmlOrText: hasHtmlOrText,        hasContentType: hasContentType      };    };    var hasWorkingClipboardApi = function (clipboardData) {      return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && isMsEdge() !== true;    };    var setHtml5Clipboard = function (clipboardData, html, text) {      if (hasWorkingClipboardApi(clipboardData)) {        try {          clipboardData.clearData();          clipboardData.setData('text/html', html);          clipboardData.setData('text/plain', text);          clipboardData.setData(internalHtmlMime(), html);          return true;        } catch (e) {          return false;        }      } else {        return false;      }    };    var setClipboardData = function (evt, data, fallback, done) {      if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {        evt.preventDefault();        done();      } else {        fallback(data.html, done);      }    };    var fallback = function (editor) {      return function (html, done) {        var markedHtml = mark(html);        var outer = editor.dom.create('div', {          'contenteditable': 'false',          'data-mce-bogus': 'all'        });        var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);        editor.dom.setStyles(outer, {          position: 'fixed',          top: '0',          left: '-3000px',          width: '1000px',          overflow: 'hidden'        });        outer.appendChild(inner);        editor.dom.add(editor.getBody(), outer);        var range = editor.selection.getRng();        inner.focus();        var offscreenRange = editor.dom.createRng();        offscreenRange.selectNodeContents(inner);        editor.selection.setRng(offscreenRange);        global$2.setTimeout(function () {          editor.selection.setRng(range);          outer.parentNode.removeChild(outer);          done();        }, 0);      };    };    var getData = function (editor) {      return {        html: editor.selection.getContent({ contextual: true }),        text: editor.selection.getContent({ format: 'text' })      };    };    var isTableSelection = function (editor) {      return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody());    };    var hasSelectedContent = function (editor) {      return !editor.selection.isCollapsed() || isTableSelection(editor);    };    var cut = function (editor) {      return function (evt) {        if (hasSelectedContent(editor)) {          setClipboardData(evt, getData(editor), fallback(editor), function () {            if (global$1.browser.isChrome()) {              var rng_1 = editor.selection.getRng();              global$2.setEditorTimeout(editor, function () {                editor.selection.setRng(rng_1);                editor.execCommand('Delete');              }, 0);            } else {              editor.execCommand('Delete');            }          });        }      };    };    var copy = function (editor) {      return function (evt) {        if (hasSelectedContent(editor)) {          setClipboardData(evt, getData(editor), fallback(editor), function () {          });        }      };    };    var register$1 = function (editor) {      editor.on('cut', cut(editor));      editor.on('copy', copy(editor));    };    var global$b = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');    var getCaretRangeFromEvent = function (editor, e) {      return global$b.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());    };    var isPlainTextFileUrl = function (content) {      var plainTextContent = content['text/plain'];      return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;    };    var setFocusedRange = function (editor, rng) {      editor.focus();      editor.selection.setRng(rng);    };    var setup = function (editor, clipboard, draggingInternallyState) {      if (shouldBlockDrop(editor)) {        editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {          e.preventDefault();          e.stopPropagation();        });      }      if (!shouldPasteDataImages(editor)) {        editor.on('drop', function (e) {          var dataTransfer = e.dataTransfer;          if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {            e.preventDefault();          }        });      }      editor.on('drop', function (e) {        var dropContent, rng;        rng = getCaretRangeFromEvent(editor, e);        if (e.isDefaultPrevented() || draggingInternallyState.get()) {          return;        }        dropContent = clipboard.getDataTransferItems(e.dataTransfer);        var internal = clipboard.hasContentType(dropContent, internalHtmlMime());        if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {          return;        }        if (rng && shouldFilterDrop(editor)) {          var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];          if (content_1) {            e.preventDefault();            global$2.setEditorTimeout(editor, function () {              editor.undoManager.transact(function () {                if (dropContent['mce-internal']) {                  editor.execCommand('Delete');                }                setFocusedRange(editor, rng);                content_1 = trimHtml(content_1);                if (!dropContent['text/html']) {                  clipboard.pasteText(content_1);                } else {                  clipboard.pasteHtml(content_1, internal);                }              });            });          }        }      });      editor.on('dragstart', function (_e) {        draggingInternallyState.set(true);      });      editor.on('dragover dragend', function (e) {        if (shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {          e.preventDefault();          setFocusedRange(editor, getCaretRangeFromEvent(editor, e));        }        if (e.type === 'dragend') {          draggingInternallyState.set(false);        }      });    };    var setup$1 = function (editor) {      var plugin = editor.plugins.paste;      var preProcess = getPreProcess(editor);      if (preProcess) {        editor.on('PastePreProcess', function (e) {          preProcess.call(plugin, plugin, e);        });      }      var postProcess = getPostProcess(editor);      if (postProcess) {        editor.on('PastePostProcess', function (e) {          postProcess.call(plugin, plugin, e);        });      }    };    function addPreProcessFilter(editor, filterFunc) {      editor.on('PastePreProcess', function (e) {        e.content = filterFunc(editor, e.content, e.internal, e.wordContent);      });    }    function addPostProcessFilter(editor, filterFunc) {      editor.on('PastePostProcess', function (e) {        filterFunc(editor, e.node);      });    }    function removeExplorerBrElementsAfterBlocks(editor, html) {      if (!isWordContent(html)) {        return html;      }      var blockElements = [];      global$4.each(editor.schema.getBlockElements(), function (block, blockName) {        blockElements.push(blockName);      });      var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g');      html = filter$1(html, [[          explorerBlocksRegExp,          '$1'        ]]);      html = filter$1(html, [        [          /<br><br>/g,          '<BR><BR>'        ],        [          /<br>/g,          ' '        ],        [          /<BR><BR>/g,          '<br>'        ]      ]);      return html;    }    function removeWebKitStyles(editor, content, internal, isWordHtml) {      if (isWordHtml || internal) {        return content;      }      var webKitStylesSetting = getWebkitStyles(editor);      var webKitStyles;      if (shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {        return content;      }      if (webKitStylesSetting) {        webKitStyles = webKitStylesSetting.split(/[, ]/);      }      if (webKitStyles) {        var dom_1 = editor.dom, node_1 = editor.selection.getNode();        content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {          var inputStyles = dom_1.parseStyle(dom_1.decode(value));          var outputStyles = {};          if (webKitStyles === 'none') {            return before + after;          }          for (var i = 0; i < webKitStyles.length; i++) {            var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);            if (/color/.test(webKitStyles[i])) {              inputValue = dom_1.toHex(inputValue);              currentValue = dom_1.toHex(currentValue);            }            if (currentValue !== inputValue) {              outputStyles[webKitStyles[i]] = inputValue;            }          }          outputStyles = dom_1.serializeStyle(outputStyles, 'span');          if (outputStyles) {            return before + ' style="' + outputStyles + '"' + after;          }          return before + after;        });      } else {        content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');      }      content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {        return before + ' style="' + value + '"' + after;      });      return content;    }    function removeUnderlineAndFontInAnchor(editor, root) {      editor.$('a', root).find('font,u').each(function (i, node) {        editor.dom.remove(node, true);      });    }    var setup$2 = function (editor) {      if (global$1.webkit) {        addPreProcessFilter(editor, removeWebKitStyles);      }      if (global$1.ie) {        addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);        addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);      }    };    var makeSetupHandler = function (editor, clipboard) {      return function (api) {        api.setActive(clipboard.pasteFormat.get() === 'text');        var pastePlainTextToggleHandler = function (e) {          return api.setActive(e.state);        };        editor.on('PastePlainTextToggle', pastePlainTextToggleHandler);        return function () {          return editor.off('PastePlainTextToggle', pastePlainTextToggleHandler);        };      };    };    var register$2 = function (editor, clipboard) {      editor.ui.registry.addToggleButton('pastetext', {        active: false,        icon: 'paste-text',        tooltip: 'Paste as text',        onAction: function () {          return editor.execCommand('mceTogglePlainTextPaste');        },        onSetup: makeSetupHandler(editor, clipboard)      });      editor.ui.registry.addToggleMenuItem('pastetext', {        text: 'Paste as text',        icon: 'paste-text',        onAction: function () {          return editor.execCommand('mceTogglePlainTextPaste');        },        onSetup: makeSetupHandler(editor, clipboard)      });    };    function Plugin () {      global.add('paste', function (editor) {        if (hasProPlugin(editor) === false) {          var draggingInternallyState = Cell(false);          var pasteFormat = Cell(isPasteAsTextEnabled(editor) ? 'text' : 'html');          var clipboard = Clipboard(editor, pasteFormat);          var quirks = setup$2(editor);          register$2(editor, clipboard);          register(editor, clipboard);          setup$1(editor);          register$1(editor);          setup(editor, clipboard, draggingInternallyState);          return get(clipboard, quirks);        }      });    }    Plugin();}(window));
 |