[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/tinymce/plugins/lists/ -> plugin.js (source)

   1  (function () {
   2  var lists = (function (domGlobals) {
   3      'use strict';
   4  
   5      var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
   6  
   7      var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
   8  
   9      var global$2 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
  10  
  11      var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
  12  
  13      var global$4 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
  14  
  15      var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
  16  
  17      var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
  18  
  19      var isTextNode = function (node) {
  20        return node && node.nodeType === 3;
  21      };
  22      var isListNode = function (node) {
  23        return node && /^(OL|UL|DL)$/.test(node.nodeName);
  24      };
  25      var isOlUlNode = function (node) {
  26        return node && /^(OL|UL)$/.test(node.nodeName);
  27      };
  28      var isListItemNode = function (node) {
  29        return node && /^(LI|DT|DD)$/.test(node.nodeName);
  30      };
  31      var isDlItemNode = function (node) {
  32        return node && /^(DT|DD)$/.test(node.nodeName);
  33      };
  34      var isTableCellNode = function (node) {
  35        return node && /^(TH|TD)$/.test(node.nodeName);
  36      };
  37      var isBr = function (node) {
  38        return node && node.nodeName === 'BR';
  39      };
  40      var isFirstChild = function (node) {
  41        return node.parentNode.firstChild === node;
  42      };
  43      var isLastChild = function (node) {
  44        return node.parentNode.lastChild === node;
  45      };
  46      var isTextBlock = function (editor, node) {
  47        return node && !!editor.schema.getTextBlockElements()[node.nodeName];
  48      };
  49      var isBlock = function (node, blockElements) {
  50        return node && node.nodeName in blockElements;
  51      };
  52      var isBogusBr = function (dom, node) {
  53        if (!isBr(node)) {
  54          return false;
  55        }
  56        if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
  57          return true;
  58        }
  59        return false;
  60      };
  61      var isEmpty = function (dom, elm, keepBookmarks) {
  62        var empty = dom.isEmpty(elm);
  63        if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
  64          return false;
  65        }
  66        return empty;
  67      };
  68      var isChildOfBody = function (dom, elm) {
  69        return dom.isChildOf(elm, dom.getRoot());
  70      };
  71      var NodeType = {
  72        isTextNode: isTextNode,
  73        isListNode: isListNode,
  74        isOlUlNode: isOlUlNode,
  75        isDlItemNode: isDlItemNode,
  76        isListItemNode: isListItemNode,
  77        isTableCellNode: isTableCellNode,
  78        isBr: isBr,
  79        isFirstChild: isFirstChild,
  80        isLastChild: isLastChild,
  81        isTextBlock: isTextBlock,
  82        isBlock: isBlock,
  83        isBogusBr: isBogusBr,
  84        isEmpty: isEmpty,
  85        isChildOfBody: isChildOfBody
  86      };
  87  
  88      var getNormalizedPoint = function (container, offset) {
  89        if (NodeType.isTextNode(container)) {
  90          return {
  91            container: container,
  92            offset: offset
  93          };
  94        }
  95        var node = global$1.getNode(container, offset);
  96        if (NodeType.isTextNode(node)) {
  97          return {
  98            container: node,
  99            offset: offset >= container.childNodes.length ? node.data.length : 0
 100          };
 101        } else if (node.previousSibling && NodeType.isTextNode(node.previousSibling)) {
 102          return {
 103            container: node.previousSibling,
 104            offset: node.previousSibling.data.length
 105          };
 106        } else if (node.nextSibling && NodeType.isTextNode(node.nextSibling)) {
 107          return {
 108            container: node.nextSibling,
 109            offset: 0
 110          };
 111        }
 112        return {
 113          container: container,
 114          offset: offset
 115        };
 116      };
 117      var normalizeRange = function (rng) {
 118        var outRng = rng.cloneRange();
 119        var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset);
 120        outRng.setStart(rangeStart.container, rangeStart.offset);
 121        var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset);
 122        outRng.setEnd(rangeEnd.container, rangeEnd.offset);
 123        return outRng;
 124      };
 125      var Range = {
 126        getNormalizedPoint: getNormalizedPoint,
 127        normalizeRange: normalizeRange
 128      };
 129  
 130      var DOM = global$6.DOM;
 131      var createBookmark = function (rng) {
 132        var bookmark = {};
 133        var setupEndPoint = function (start) {
 134          var offsetNode, container, offset;
 135          container = rng[start ? 'startContainer' : 'endContainer'];
 136          offset = rng[start ? 'startOffset' : 'endOffset'];
 137          if (container.nodeType === 1) {
 138            offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' });
 139            if (container.hasChildNodes()) {
 140              offset = Math.min(offset, container.childNodes.length - 1);
 141              if (start) {
 142                container.insertBefore(offsetNode, container.childNodes[offset]);
 143              } else {
 144                DOM.insertAfter(offsetNode, container.childNodes[offset]);
 145              }
 146            } else {
 147              container.appendChild(offsetNode);
 148            }
 149            container = offsetNode;
 150            offset = 0;
 151          }
 152          bookmark[start ? 'startContainer' : 'endContainer'] = container;
 153          bookmark[start ? 'startOffset' : 'endOffset'] = offset;
 154        };
 155        setupEndPoint(true);
 156        if (!rng.collapsed) {
 157          setupEndPoint();
 158        }
 159        return bookmark;
 160      };
 161      var resolveBookmark = function (bookmark) {
 162        function restoreEndPoint(start) {
 163          var container, offset, node;
 164          var nodeIndex = function (container) {
 165            var node = container.parentNode.firstChild, idx = 0;
 166            while (node) {
 167              if (node === container) {
 168                return idx;
 169              }
 170              if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
 171                idx++;
 172              }
 173              node = node.nextSibling;
 174            }
 175            return -1;
 176          };
 177          container = node = bookmark[start ? 'startContainer' : 'endContainer'];
 178          offset = bookmark[start ? 'startOffset' : 'endOffset'];
 179          if (!container) {
 180            return;
 181          }
 182          if (container.nodeType === 1) {
 183            offset = nodeIndex(container);
 184            container = container.parentNode;
 185            DOM.remove(node);
 186            if (!container.hasChildNodes() && DOM.isBlock(container)) {
 187              container.appendChild(DOM.create('br'));
 188            }
 189          }
 190          bookmark[start ? 'startContainer' : 'endContainer'] = container;
 191          bookmark[start ? 'startOffset' : 'endOffset'] = offset;
 192        }
 193        restoreEndPoint(true);
 194        restoreEndPoint();
 195        var rng = DOM.createRng();
 196        rng.setStart(bookmark.startContainer, bookmark.startOffset);
 197        if (bookmark.endContainer) {
 198          rng.setEnd(bookmark.endContainer, bookmark.endOffset);
 199        }
 200        return Range.normalizeRange(rng);
 201      };
 202      var Bookmark = {
 203        createBookmark: createBookmark,
 204        resolveBookmark: resolveBookmark
 205      };
 206  
 207      var constant = function (value) {
 208        return function () {
 209          return value;
 210        };
 211      };
 212      var not = function (f) {
 213        return function () {
 214          var args = [];
 215          for (var _i = 0; _i < arguments.length; _i++) {
 216            args[_i] = arguments[_i];
 217          }
 218          return !f.apply(null, args);
 219        };
 220      };
 221      var never = constant(false);
 222      var always = constant(true);
 223  
 224      var never$1 = never;
 225      var always$1 = always;
 226      var none = function () {
 227        return NONE;
 228      };
 229      var NONE = function () {
 230        var eq = function (o) {
 231          return o.isNone();
 232        };
 233        var call = function (thunk) {
 234          return thunk();
 235        };
 236        var id = function (n) {
 237          return n;
 238        };
 239        var noop = function () {
 240        };
 241        var nul = function () {
 242          return null;
 243        };
 244        var undef = function () {
 245          return undefined;
 246        };
 247        var me = {
 248          fold: function (n, s) {
 249            return n();
 250          },
 251          is: never$1,
 252          isSome: never$1,
 253          isNone: always$1,
 254          getOr: id,
 255          getOrThunk: call,
 256          getOrDie: function (msg) {
 257            throw new Error(msg || 'error: getOrDie called on none.');
 258          },
 259          getOrNull: nul,
 260          getOrUndefined: undef,
 261          or: id,
 262          orThunk: call,
 263          map: none,
 264          ap: none,
 265          each: noop,
 266          bind: none,
 267          flatten: none,
 268          exists: never$1,
 269          forall: always$1,
 270          filter: none,
 271          equals: eq,
 272          equals_: eq,
 273          toArray: function () {
 274            return [];
 275          },
 276          toString: constant('none()')
 277        };
 278        if (Object.freeze)
 279          Object.freeze(me);
 280        return me;
 281      }();
 282      var some = function (a) {
 283        var constant_a = function () {
 284          return a;
 285        };
 286        var self = function () {
 287          return me;
 288        };
 289        var map = function (f) {
 290          return some(f(a));
 291        };
 292        var bind = function (f) {
 293          return f(a);
 294        };
 295        var me = {
 296          fold: function (n, s) {
 297            return s(a);
 298          },
 299          is: function (v) {
 300            return a === v;
 301          },
 302          isSome: always$1,
 303          isNone: never$1,
 304          getOr: constant_a,
 305          getOrThunk: constant_a,
 306          getOrDie: constant_a,
 307          getOrNull: constant_a,
 308          getOrUndefined: constant_a,
 309          or: self,
 310          orThunk: self,
 311          map: map,
 312          ap: function (optfab) {
 313            return optfab.fold(none, function (fab) {
 314              return some(fab(a));
 315            });
 316          },
 317          each: function (f) {
 318            f(a);
 319          },
 320          bind: bind,
 321          flatten: constant_a,
 322          exists: bind,
 323          forall: bind,
 324          filter: function (f) {
 325            return f(a) ? me : NONE;
 326          },
 327          equals: function (o) {
 328            return o.is(a);
 329          },
 330          equals_: function (o, elementEq) {
 331            return o.fold(never$1, function (b) {
 332              return elementEq(a, b);
 333            });
 334          },
 335          toArray: function () {
 336            return [a];
 337          },
 338          toString: function () {
 339            return 'some(' + a + ')';
 340          }
 341        };
 342        return me;
 343      };
 344      var from = function (value) {
 345        return value === null || value === undefined ? NONE : some(value);
 346      };
 347      var Option = {
 348        some: some,
 349        none: none,
 350        from: from
 351      };
 352  
 353      var typeOf = function (x) {
 354        if (x === null)
 355          return 'null';
 356        var t = typeof x;
 357        if (t === 'object' && Array.prototype.isPrototypeOf(x))
 358          return 'array';
 359        if (t === 'object' && String.prototype.isPrototypeOf(x))
 360          return 'string';
 361        return t;
 362      };
 363      var isType = function (type) {
 364        return function (value) {
 365          return typeOf(value) === type;
 366        };
 367      };
 368      var isString = isType('string');
 369      var isBoolean = isType('boolean');
 370      var isFunction = isType('function');
 371      var isNumber = isType('number');
 372  
 373      var map = function (xs, f) {
 374        var len = xs.length;
 375        var r = new Array(len);
 376        for (var i = 0; i < len; i++) {
 377          var x = xs[i];
 378          r[i] = f(x, i, xs);
 379        }
 380        return r;
 381      };
 382      var each = function (xs, f) {
 383        for (var i = 0, len = xs.length; i < len; i++) {
 384          var x = xs[i];
 385          f(x, i, xs);
 386        }
 387      };
 388      var filter = function (xs, pred) {
 389        var r = [];
 390        for (var i = 0, len = xs.length; i < len; i++) {
 391          var x = xs[i];
 392          if (pred(x, i, xs)) {
 393            r.push(x);
 394          }
 395        }
 396        return r;
 397      };
 398      var groupBy = function (xs, f) {
 399        if (xs.length === 0) {
 400          return [];
 401        } else {
 402          var wasType = f(xs[0]);
 403          var r = [];
 404          var group = [];
 405          for (var i = 0, len = xs.length; i < len; i++) {
 406            var x = xs[i];
 407            var type = f(x);
 408            if (type !== wasType) {
 409              r.push(group);
 410              group = [];
 411            }
 412            wasType = type;
 413            group.push(x);
 414          }
 415          if (group.length !== 0) {
 416            r.push(group);
 417          }
 418          return r;
 419        }
 420      };
 421      var foldl = function (xs, f, acc) {
 422        each(xs, function (x) {
 423          acc = f(acc, x);
 424        });
 425        return acc;
 426      };
 427      var find = function (xs, pred) {
 428        for (var i = 0, len = xs.length; i < len; i++) {
 429          var x = xs[i];
 430          if (pred(x, i, xs)) {
 431            return Option.some(x);
 432          }
 433        }
 434        return Option.none();
 435      };
 436      var push = Array.prototype.push;
 437      var flatten = function (xs) {
 438        var r = [];
 439        for (var i = 0, len = xs.length; i < len; ++i) {
 440          if (!Array.prototype.isPrototypeOf(xs[i]))
 441            throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
 442          push.apply(r, xs[i]);
 443        }
 444        return r;
 445      };
 446      var bind = function (xs, f) {
 447        var output = map(xs, f);
 448        return flatten(output);
 449      };
 450      var slice = Array.prototype.slice;
 451      var reverse = function (xs) {
 452        var r = slice.call(xs, 0);
 453        r.reverse();
 454        return r;
 455      };
 456      var head = function (xs) {
 457        return xs.length === 0 ? Option.none() : Option.some(xs[0]);
 458      };
 459      var last = function (xs) {
 460        return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
 461      };
 462      var from$1 = isFunction(Array.from) ? Array.from : function (x) {
 463        return slice.call(x);
 464      };
 465  
 466      var Global = typeof domGlobals.window !== 'undefined' ? domGlobals.window : Function('return this;')();
 467  
 468      var path = function (parts, scope) {
 469        var o = scope !== undefined && scope !== null ? scope : Global;
 470        for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
 471          o = o[parts[i]];
 472        return o;
 473      };
 474      var resolve = function (p, scope) {
 475        var parts = p.split('.');
 476        return path(parts, scope);
 477      };
 478  
 479      var unsafe = function (name, scope) {
 480        return resolve(name, scope);
 481      };
 482      var getOrDie = function (name, scope) {
 483        var actual = unsafe(name, scope);
 484        if (actual === undefined || actual === null)
 485          throw name + ' not available on this browser';
 486        return actual;
 487      };
 488      var Global$1 = { getOrDie: getOrDie };
 489  
 490      var htmlElement = function (scope) {
 491        return Global$1.getOrDie('HTMLElement', scope);
 492      };
 493      var isPrototypeOf = function (x) {
 494        var scope = resolve('ownerDocument.defaultView', x);
 495        return htmlElement(scope).prototype.isPrototypeOf(x);
 496      };
 497      var HTMLElement = { isPrototypeOf: isPrototypeOf };
 498  
 499      var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
 500  
 501      var getParentList = function (editor) {
 502        var selectionStart = editor.selection.getStart(true);
 503        return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));
 504      };
 505      var isParentListSelected = function (parentList, selectedBlocks) {
 506        return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
 507      };
 508      var findSubLists = function (parentList) {
 509        return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) {
 510          return NodeType.isListNode(elm);
 511        });
 512      };
 513      var getSelectedSubLists = function (editor) {
 514        var parentList = getParentList(editor);
 515        var selectedBlocks = editor.selection.getSelectedBlocks();
 516        if (isParentListSelected(parentList, selectedBlocks)) {
 517          return findSubLists(parentList);
 518        } else {
 519          return global$5.grep(selectedBlocks, function (elm) {
 520            return NodeType.isListNode(elm) && parentList !== elm;
 521          });
 522        }
 523      };
 524      var findParentListItemsNodes = function (editor, elms) {
 525        var listItemsElms = global$5.map(elms, function (elm) {
 526          var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
 527          return parentLi ? parentLi : elm;
 528        });
 529        return global$7.unique(listItemsElms);
 530      };
 531      var getSelectedListItems = function (editor) {
 532        var selectedBlocks = editor.selection.getSelectedBlocks();
 533        return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
 534          return NodeType.isListItemNode(block);
 535        });
 536      };
 537      var getSelectedDlItems = function (editor) {
 538        return filter(getSelectedListItems(editor), NodeType.isDlItemNode);
 539      };
 540      var getClosestListRootElm = function (editor, elm) {
 541        var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
 542        var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
 543        return root;
 544      };
 545      var findLastParentListNode = function (editor, elm) {
 546        var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListRootElm(editor, elm));
 547        return last(parentLists);
 548      };
 549      var getSelectedLists = function (editor) {
 550        var firstList = findLastParentListNode(editor, editor.selection.getStart());
 551        var subsequentLists = filter(editor.selection.getSelectedBlocks(), NodeType.isOlUlNode);
 552        return firstList.toArray().concat(subsequentLists);
 553      };
 554      var getSelectedListRoots = function (editor) {
 555        var selectedLists = getSelectedLists(editor);
 556        return getUniqueListRoots(editor, selectedLists);
 557      };
 558      var getUniqueListRoots = function (editor, lists) {
 559        var listRoots = map(lists, function (list) {
 560          return findLastParentListNode(editor, list).getOr(list);
 561        });
 562        return global$7.unique(listRoots);
 563      };
 564      var isList = function (editor) {
 565        var list = getParentList(editor);
 566        return HTMLElement.isPrototypeOf(list);
 567      };
 568      var Selection = {
 569        isList: isList,
 570        getParentList: getParentList,
 571        getSelectedSubLists: getSelectedSubLists,
 572        getSelectedListItems: getSelectedListItems,
 573        getClosestListRootElm: getClosestListRootElm,
 574        getSelectedDlItems: getSelectedDlItems,
 575        getSelectedListRoots: getSelectedListRoots
 576      };
 577  
 578      var fromHtml = function (html, scope) {
 579        var doc = scope || domGlobals.document;
 580        var div = doc.createElement('div');
 581        div.innerHTML = html;
 582        if (!div.hasChildNodes() || div.childNodes.length > 1) {
 583          domGlobals.console.error('HTML does not have a single root node', html);
 584          throw new Error('HTML must have a single root node');
 585        }
 586        return fromDom(div.childNodes[0]);
 587      };
 588      var fromTag = function (tag, scope) {
 589        var doc = scope || domGlobals.document;
 590        var node = doc.createElement(tag);
 591        return fromDom(node);
 592      };
 593      var fromText = function (text, scope) {
 594        var doc = scope || domGlobals.document;
 595        var node = doc.createTextNode(text);
 596        return fromDom(node);
 597      };
 598      var fromDom = function (node) {
 599        if (node === null || node === undefined) {
 600          throw new Error('Node cannot be null or undefined');
 601        }
 602        return { dom: constant(node) };
 603      };
 604      var fromPoint = function (docElm, x, y) {
 605        var doc = docElm.dom();
 606        return Option.from(doc.elementFromPoint(x, y)).map(fromDom);
 607      };
 608      var Element = {
 609        fromHtml: fromHtml,
 610        fromTag: fromTag,
 611        fromText: fromText,
 612        fromDom: fromDom,
 613        fromPoint: fromPoint
 614      };
 615  
 616      var liftN = function (arr, f) {
 617        var r = [];
 618        for (var i = 0; i < arr.length; i++) {
 619          var x = arr[i];
 620          if (x.isSome()) {
 621            r.push(x.getOrDie());
 622          } else {
 623            return Option.none();
 624          }
 625        }
 626        return Option.some(f.apply(null, r));
 627      };
 628  
 629      var fromElements = function (elements, scope) {
 630        var doc = scope || domGlobals.document;
 631        var fragment = doc.createDocumentFragment();
 632        each(elements, function (element) {
 633          fragment.appendChild(element.dom());
 634        });
 635        return Element.fromDom(fragment);
 636      };
 637  
 638      var Immutable = function () {
 639        var fields = [];
 640        for (var _i = 0; _i < arguments.length; _i++) {
 641          fields[_i] = arguments[_i];
 642        }
 643        return function () {
 644          var values = [];
 645          for (var _i = 0; _i < arguments.length; _i++) {
 646            values[_i] = arguments[_i];
 647          }
 648          if (fields.length !== values.length) {
 649            throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
 650          }
 651          var struct = {};
 652          each(fields, function (name, i) {
 653            struct[name] = constant(values[i]);
 654          });
 655          return struct;
 656        };
 657      };
 658  
 659      var keys = Object.keys;
 660      var each$1 = function (obj, f) {
 661        var props = keys(obj);
 662        for (var k = 0, len = props.length; k < len; k++) {
 663          var i = props[k];
 664          var x = obj[i];
 665          f(x, i, obj);
 666        }
 667      };
 668  
 669      var node = function () {
 670        var f = Global$1.getOrDie('Node');
 671        return f;
 672      };
 673      var compareDocumentPosition = function (a, b, match) {
 674        return (a.compareDocumentPosition(b) & match) !== 0;
 675      };
 676      var documentPositionPreceding = function (a, b) {
 677        return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
 678      };
 679      var documentPositionContainedBy = function (a, b) {
 680        return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
 681      };
 682      var Node = {
 683        documentPositionPreceding: documentPositionPreceding,
 684        documentPositionContainedBy: documentPositionContainedBy
 685      };
 686  
 687      var cached = function (f) {
 688        var called = false;
 689        var r;
 690        return function () {
 691          var args = [];
 692          for (var _i = 0; _i < arguments.length; _i++) {
 693            args[_i] = arguments[_i];
 694          }
 695          if (!called) {
 696            called = true;
 697            r = f.apply(null, args);
 698          }
 699          return r;
 700        };
 701      };
 702  
 703      var firstMatch = function (regexes, s) {
 704        for (var i = 0; i < regexes.length; i++) {
 705          var x = regexes[i];
 706          if (x.test(s))
 707            return x;
 708        }
 709        return undefined;
 710      };
 711      var find$1 = function (regexes, agent) {
 712        var r = firstMatch(regexes, agent);
 713        if (!r)
 714          return {
 715            major: 0,
 716            minor: 0
 717          };
 718        var group = function (i) {
 719          return Number(agent.replace(r, '$' + i));
 720        };
 721        return nu(group(1), group(2));
 722      };
 723      var detect = function (versionRegexes, agent) {
 724        var cleanedAgent = String(agent).toLowerCase();
 725        if (versionRegexes.length === 0)
 726          return unknown();
 727        return find$1(versionRegexes, cleanedAgent);
 728      };
 729      var unknown = function () {
 730        return nu(0, 0);
 731      };
 732      var nu = function (major, minor) {
 733        return {
 734          major: major,
 735          minor: minor
 736        };
 737      };
 738      var Version = {
 739        nu: nu,
 740        detect: detect,
 741        unknown: unknown
 742      };
 743  
 744      var edge = 'Edge';
 745      var chrome = 'Chrome';
 746      var ie = 'IE';
 747      var opera = 'Opera';
 748      var firefox = 'Firefox';
 749      var safari = 'Safari';
 750      var isBrowser = function (name, current) {
 751        return function () {
 752          return current === name;
 753        };
 754      };
 755      var unknown$1 = function () {
 756        return nu$1({
 757          current: undefined,
 758          version: Version.unknown()
 759        });
 760      };
 761      var nu$1 = function (info) {
 762        var current = info.current;
 763        var version = info.version;
 764        return {
 765          current: current,
 766          version: version,
 767          isEdge: isBrowser(edge, current),
 768          isChrome: isBrowser(chrome, current),
 769          isIE: isBrowser(ie, current),
 770          isOpera: isBrowser(opera, current),
 771          isFirefox: isBrowser(firefox, current),
 772          isSafari: isBrowser(safari, current)
 773        };
 774      };
 775      var Browser = {
 776        unknown: unknown$1,
 777        nu: nu$1,
 778        edge: constant(edge),
 779        chrome: constant(chrome),
 780        ie: constant(ie),
 781        opera: constant(opera),
 782        firefox: constant(firefox),
 783        safari: constant(safari)
 784      };
 785  
 786      var windows = 'Windows';
 787      var ios = 'iOS';
 788      var android = 'Android';
 789      var linux = 'Linux';
 790      var osx = 'OSX';
 791      var solaris = 'Solaris';
 792      var freebsd = 'FreeBSD';
 793      var isOS = function (name, current) {
 794        return function () {
 795          return current === name;
 796        };
 797      };
 798      var unknown$2 = function () {
 799        return nu$2({
 800          current: undefined,
 801          version: Version.unknown()
 802        });
 803      };
 804      var nu$2 = function (info) {
 805        var current = info.current;
 806        var version = info.version;
 807        return {
 808          current: current,
 809          version: version,
 810          isWindows: isOS(windows, current),
 811          isiOS: isOS(ios, current),
 812          isAndroid: isOS(android, current),
 813          isOSX: isOS(osx, current),
 814          isLinux: isOS(linux, current),
 815          isSolaris: isOS(solaris, current),
 816          isFreeBSD: isOS(freebsd, current)
 817        };
 818      };
 819      var OperatingSystem = {
 820        unknown: unknown$2,
 821        nu: nu$2,
 822        windows: constant(windows),
 823        ios: constant(ios),
 824        android: constant(android),
 825        linux: constant(linux),
 826        osx: constant(osx),
 827        solaris: constant(solaris),
 828        freebsd: constant(freebsd)
 829      };
 830  
 831      var DeviceType = function (os, browser, userAgent) {
 832        var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
 833        var isiPhone = os.isiOS() && !isiPad;
 834        var isAndroid3 = os.isAndroid() && os.version.major === 3;
 835        var isAndroid4 = os.isAndroid() && os.version.major === 4;
 836        var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
 837        var isTouch = os.isiOS() || os.isAndroid();
 838        var isPhone = isTouch && !isTablet;
 839        var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
 840        return {
 841          isiPad: constant(isiPad),
 842          isiPhone: constant(isiPhone),
 843          isTablet: constant(isTablet),
 844          isPhone: constant(isPhone),
 845          isTouch: constant(isTouch),
 846          isAndroid: os.isAndroid,
 847          isiOS: os.isiOS,
 848          isWebView: constant(iOSwebview)
 849        };
 850      };
 851  
 852      var detect$1 = function (candidates, userAgent) {
 853        var agent = String(userAgent).toLowerCase();
 854        return find(candidates, function (candidate) {
 855          return candidate.search(agent);
 856        });
 857      };
 858      var detectBrowser = function (browsers, userAgent) {
 859        return detect$1(browsers, userAgent).map(function (browser) {
 860          var version = Version.detect(browser.versionRegexes, userAgent);
 861          return {
 862            current: browser.name,
 863            version: version
 864          };
 865        });
 866      };
 867      var detectOs = function (oses, userAgent) {
 868        return detect$1(oses, userAgent).map(function (os) {
 869          var version = Version.detect(os.versionRegexes, userAgent);
 870          return {
 871            current: os.name,
 872            version: version
 873          };
 874        });
 875      };
 876      var UaString = {
 877        detectBrowser: detectBrowser,
 878        detectOs: detectOs
 879      };
 880  
 881      var contains = function (str, substr) {
 882        return str.indexOf(substr) !== -1;
 883      };
 884  
 885      var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
 886      var checkContains = function (target) {
 887        return function (uastring) {
 888          return contains(uastring, target);
 889        };
 890      };
 891      var browsers = [
 892        {
 893          name: 'Edge',
 894          versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
 895          search: function (uastring) {
 896            var monstrosity = contains(uastring, 'edge/') && contains(uastring, 'chrome') && contains(uastring, 'safari') && contains(uastring, 'applewebkit');
 897            return monstrosity;
 898          }
 899        },
 900        {
 901          name: 'Chrome',
 902          versionRegexes: [
 903            /.*?chrome\/([0-9]+)\.([0-9]+).*/,
 904            normalVersionRegex
 905          ],
 906          search: function (uastring) {
 907            return contains(uastring, 'chrome') && !contains(uastring, 'chromeframe');
 908          }
 909        },
 910        {
 911          name: 'IE',
 912          versionRegexes: [
 913            /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
 914            /.*?rv:([0-9]+)\.([0-9]+).*/
 915          ],
 916          search: function (uastring) {
 917            return contains(uastring, 'msie') || contains(uastring, 'trident');
 918          }
 919        },
 920        {
 921          name: 'Opera',
 922          versionRegexes: [
 923            normalVersionRegex,
 924            /.*?opera\/([0-9]+)\.([0-9]+).*/
 925          ],
 926          search: checkContains('opera')
 927        },
 928        {
 929          name: 'Firefox',
 930          versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
 931          search: checkContains('firefox')
 932        },
 933        {
 934          name: 'Safari',
 935          versionRegexes: [
 936            normalVersionRegex,
 937            /.*?cpu os ([0-9]+)_([0-9]+).*/
 938          ],
 939          search: function (uastring) {
 940            return (contains(uastring, 'safari') || contains(uastring, 'mobile/')) && contains(uastring, 'applewebkit');
 941          }
 942        }
 943      ];
 944      var oses = [
 945        {
 946          name: 'Windows',
 947          search: checkContains('win'),
 948          versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
 949        },
 950        {
 951          name: 'iOS',
 952          search: function (uastring) {
 953            return contains(uastring, 'iphone') || contains(uastring, 'ipad');
 954          },
 955          versionRegexes: [
 956            /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
 957            /.*cpu os ([0-9]+)_([0-9]+).*/,
 958            /.*cpu iphone os ([0-9]+)_([0-9]+).*/
 959          ]
 960        },
 961        {
 962          name: 'Android',
 963          search: checkContains('android'),
 964          versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
 965        },
 966        {
 967          name: 'OSX',
 968          search: checkContains('os x'),
 969          versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
 970        },
 971        {
 972          name: 'Linux',
 973          search: checkContains('linux'),
 974          versionRegexes: []
 975        },
 976        {
 977          name: 'Solaris',
 978          search: checkContains('sunos'),
 979          versionRegexes: []
 980        },
 981        {
 982          name: 'FreeBSD',
 983          search: checkContains('freebsd'),
 984          versionRegexes: []
 985        }
 986      ];
 987      var PlatformInfo = {
 988        browsers: constant(browsers),
 989        oses: constant(oses)
 990      };
 991  
 992      var detect$2 = function (userAgent) {
 993        var browsers = PlatformInfo.browsers();
 994        var oses = PlatformInfo.oses();
 995        var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);
 996        var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
 997        var deviceType = DeviceType(os, browser, userAgent);
 998        return {
 999          browser: browser,
1000          os: os,
1001          deviceType: deviceType
1002        };
1003      };
1004      var PlatformDetection = { detect: detect$2 };
1005  
1006      var detect$3 = cached(function () {
1007        var userAgent = domGlobals.navigator.userAgent;
1008        return PlatformDetection.detect(userAgent);
1009      });
1010      var PlatformDetection$1 = { detect: detect$3 };
1011  
1012      var ATTRIBUTE = domGlobals.Node.ATTRIBUTE_NODE;
1013      var CDATA_SECTION = domGlobals.Node.CDATA_SECTION_NODE;
1014      var COMMENT = domGlobals.Node.COMMENT_NODE;
1015      var DOCUMENT = domGlobals.Node.DOCUMENT_NODE;
1016      var DOCUMENT_TYPE = domGlobals.Node.DOCUMENT_TYPE_NODE;
1017      var DOCUMENT_FRAGMENT = domGlobals.Node.DOCUMENT_FRAGMENT_NODE;
1018      var ELEMENT = domGlobals.Node.ELEMENT_NODE;
1019      var TEXT = domGlobals.Node.TEXT_NODE;
1020      var PROCESSING_INSTRUCTION = domGlobals.Node.PROCESSING_INSTRUCTION_NODE;
1021      var ENTITY_REFERENCE = domGlobals.Node.ENTITY_REFERENCE_NODE;
1022      var ENTITY = domGlobals.Node.ENTITY_NODE;
1023      var NOTATION = domGlobals.Node.NOTATION_NODE;
1024  
1025      var ELEMENT$1 = ELEMENT;
1026      var is = function (element, selector) {
1027        var elem = element.dom();
1028        if (elem.nodeType !== ELEMENT$1) {
1029          return false;
1030        } else if (elem.matches !== undefined) {
1031          return elem.matches(selector);
1032        } else if (elem.msMatchesSelector !== undefined) {
1033          return elem.msMatchesSelector(selector);
1034        } else if (elem.webkitMatchesSelector !== undefined) {
1035          return elem.webkitMatchesSelector(selector);
1036        } else if (elem.mozMatchesSelector !== undefined) {
1037          return elem.mozMatchesSelector(selector);
1038        } else {
1039          throw new Error('Browser lacks native selectors');
1040        }
1041      };
1042  
1043      var eq = function (e1, e2) {
1044        return e1.dom() === e2.dom();
1045      };
1046      var regularContains = function (e1, e2) {
1047        var d1 = e1.dom();
1048        var d2 = e2.dom();
1049        return d1 === d2 ? false : d1.contains(d2);
1050      };
1051      var ieContains = function (e1, e2) {
1052        return Node.documentPositionContainedBy(e1.dom(), e2.dom());
1053      };
1054      var browser = PlatformDetection$1.detect().browser;
1055      var contains$1 = browser.isIE() ? ieContains : regularContains;
1056      var is$1 = is;
1057  
1058      var parent = function (element) {
1059        var dom = element.dom();
1060        return Option.from(dom.parentNode).map(Element.fromDom);
1061      };
1062      var children = function (element) {
1063        var dom = element.dom();
1064        return map(dom.childNodes, Element.fromDom);
1065      };
1066      var child = function (element, index) {
1067        var cs = element.dom().childNodes;
1068        return Option.from(cs[index]).map(Element.fromDom);
1069      };
1070      var firstChild = function (element) {
1071        return child(element, 0);
1072      };
1073      var lastChild = function (element) {
1074        return child(element, element.dom().childNodes.length - 1);
1075      };
1076      var spot = Immutable('element', 'offset');
1077  
1078      var before = function (marker, element) {
1079        var parent$1 = parent(marker);
1080        parent$1.each(function (v) {
1081          v.dom().insertBefore(element.dom(), marker.dom());
1082        });
1083      };
1084      var append = function (parent, element) {
1085        parent.dom().appendChild(element.dom());
1086      };
1087  
1088      var before$1 = function (marker, elements) {
1089        each(elements, function (x) {
1090          before(marker, x);
1091        });
1092      };
1093      var append$1 = function (parent, elements) {
1094        each(elements, function (x) {
1095          append(parent, x);
1096        });
1097      };
1098  
1099      var remove = function (element) {
1100        var dom = element.dom();
1101        if (dom.parentNode !== null) {
1102          dom.parentNode.removeChild(dom);
1103        }
1104      };
1105  
1106      var name = function (element) {
1107        var r = element.dom().nodeName;
1108        return r.toLowerCase();
1109      };
1110  
1111      var rawSet = function (dom, key, value) {
1112        if (isString(value) || isBoolean(value) || isNumber(value)) {
1113          dom.setAttribute(key, value + '');
1114        } else {
1115          domGlobals.console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);
1116          throw new Error('Attribute value was not simple');
1117        }
1118      };
1119      var setAll = function (element, attrs) {
1120        var dom = element.dom();
1121        each$1(attrs, function (v, k) {
1122          rawSet(dom, k, v);
1123        });
1124      };
1125      var clone = function (element) {
1126        return foldl(element.dom().attributes, function (acc, attr) {
1127          acc[attr.name] = attr.value;
1128          return acc;
1129        }, {});
1130      };
1131  
1132      var isSupported = function (dom) {
1133        return dom.style !== undefined;
1134      };
1135  
1136      var internalSet = function (dom, property, value) {
1137        if (!isString(value)) {
1138          domGlobals.console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
1139          throw new Error('CSS value must be a string: ' + value);
1140        }
1141        if (isSupported(dom)) {
1142          dom.style.setProperty(property, value);
1143        }
1144      };
1145      var set = function (element, property, value) {
1146        var dom = element.dom();
1147        internalSet(dom, property, value);
1148      };
1149  
1150      var clone$1 = function (original, isDeep) {
1151        return Element.fromDom(original.dom().cloneNode(isDeep));
1152      };
1153      var deep = function (original) {
1154        return clone$1(original, true);
1155      };
1156      var shallowAs = function (original, tag) {
1157        var nu = Element.fromTag(tag);
1158        var attributes = clone(original);
1159        setAll(nu, attributes);
1160        return nu;
1161      };
1162      var mutate = function (original, tag) {
1163        var nu = shallowAs(original, tag);
1164        before(original, nu);
1165        var children$1 = children(original);
1166        append$1(nu, children$1);
1167        remove(original);
1168        return nu;
1169      };
1170  
1171      var joinSegment = function (parent, child) {
1172        append(parent.item, child.list);
1173      };
1174      var joinSegments = function (segments) {
1175        for (var i = 1; i < segments.length; i++) {
1176          joinSegment(segments[i - 1], segments[i]);
1177        }
1178      };
1179      var appendSegments = function (head$1, tail) {
1180        liftN([
1181          last(head$1),
1182          head(tail)
1183        ], joinSegment);
1184      };
1185      var createSegment = function (scope, listType) {
1186        var segment = {
1187          list: Element.fromTag(listType, scope),
1188          item: Element.fromTag('li', scope)
1189        };
1190        append(segment.list, segment.item);
1191        return segment;
1192      };
1193      var createSegments = function (scope, entry, size) {
1194        var segments = [];
1195        for (var i = 0; i < size; i++) {
1196          segments.push(createSegment(scope, entry.listType));
1197        }
1198        return segments;
1199      };
1200      var populateSegments = function (segments, entry) {
1201        for (var i = 0; i < segments.length - 1; i++) {
1202          set(segments[i].item, 'list-style-type', 'none');
1203        }
1204        last(segments).each(function (segment) {
1205          setAll(segment.list, entry.listAttributes);
1206          setAll(segment.item, entry.itemAttributes);
1207          append$1(segment.item, entry.content);
1208        });
1209      };
1210      var normalizeSegment = function (segment, entry) {
1211        if (name(segment.list) !== entry.listType) {
1212          segment.list = mutate(segment.list, entry.listType);
1213        }
1214        setAll(segment.list, entry.listAttributes);
1215      };
1216      var createItem = function (scope, attr, content) {
1217        var item = Element.fromTag('li', scope);
1218        setAll(item, attr);
1219        append$1(item, content);
1220        return item;
1221      };
1222      var appendItem = function (segment, item) {
1223        append(segment.list, item);
1224        segment.item = item;
1225      };
1226      var writeShallow = function (scope, cast, entry) {
1227        var newCast = cast.slice(0, entry.depth);
1228        last(newCast).each(function (segment) {
1229          var item = createItem(scope, entry.itemAttributes, entry.content);
1230          appendItem(segment, item);
1231          normalizeSegment(segment, entry);
1232        });
1233        return newCast;
1234      };
1235      var writeDeep = function (scope, cast, entry) {
1236        var segments = createSegments(scope, entry, entry.depth - cast.length);
1237        joinSegments(segments);
1238        populateSegments(segments, entry);
1239        appendSegments(cast, segments);
1240        return cast.concat(segments);
1241      };
1242      var composeList = function (scope, entries) {
1243        var cast = foldl(entries, function (cast, entry) {
1244          return entry.depth > cast.length ? writeDeep(scope, cast, entry) : writeShallow(scope, cast, entry);
1245        }, []);
1246        return head(cast).map(function (segment) {
1247          return segment.list;
1248        });
1249      };
1250  
1251      var isList$1 = function (el) {
1252        return is$1(el, 'OL,UL');
1253      };
1254      var hasFirstChildList = function (el) {
1255        return firstChild(el).map(isList$1).getOr(false);
1256      };
1257      var hasLastChildList = function (el) {
1258        return lastChild(el).map(isList$1).getOr(false);
1259      };
1260  
1261      var isIndented = function (entry) {
1262        return entry.depth > 0;
1263      };
1264      var isSelected = function (entry) {
1265        return entry.isSelected;
1266      };
1267      var cloneItemContent = function (li) {
1268        var children$1 = children(li);
1269        var content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1;
1270        return map(content, deep);
1271      };
1272      var createEntry = function (li, depth, isSelected) {
1273        return parent(li).map(function (list) {
1274          return {
1275            depth: depth,
1276            isSelected: isSelected,
1277            content: cloneItemContent(li),
1278            itemAttributes: clone(li),
1279            listAttributes: clone(list),
1280            listType: name(list)
1281          };
1282        });
1283      };
1284  
1285      var indentEntry = function (indentation, entry) {
1286        switch (indentation) {
1287        case 'Indent':
1288          entry.depth++;
1289          break;
1290        case 'Outdent':
1291          entry.depth--;
1292          break;
1293        case 'Flatten':
1294          entry.depth = 0;
1295        }
1296      };
1297  
1298      var hasOwnProperty = Object.prototype.hasOwnProperty;
1299      var shallow = function (old, nu) {
1300        return nu;
1301      };
1302      var baseMerge = function (merger) {
1303        return function () {
1304          var objects = new Array(arguments.length);
1305          for (var i = 0; i < objects.length; i++)
1306            objects[i] = arguments[i];
1307          if (objects.length === 0)
1308            throw new Error('Can\'t merge zero objects');
1309          var ret = {};
1310          for (var j = 0; j < objects.length; j++) {
1311            var curObject = objects[j];
1312            for (var key in curObject)
1313              if (hasOwnProperty.call(curObject, key)) {
1314                ret[key] = merger(ret[key], curObject[key]);
1315              }
1316          }
1317          return ret;
1318        };
1319      };
1320      var merge = baseMerge(shallow);
1321  
1322      var cloneListProperties = function (target, source) {
1323        target.listType = source.listType;
1324        target.listAttributes = merge({}, source.listAttributes);
1325      };
1326      var previousSiblingEntry = function (entries, start) {
1327        var depth = entries[start].depth;
1328        for (var i = start - 1; i >= 0; i--) {
1329          if (entries[i].depth === depth) {
1330            return Option.some(entries[i]);
1331          }
1332          if (entries[i].depth < depth) {
1333            break;
1334          }
1335        }
1336        return Option.none();
1337      };
1338      var normalizeEntries = function (entries) {
1339        each(entries, function (entry, i) {
1340          previousSiblingEntry(entries, i).each(function (matchingEntry) {
1341            cloneListProperties(entry, matchingEntry);
1342          });
1343        });
1344      };
1345  
1346      var Cell = function (initial) {
1347        var value = initial;
1348        var get = function () {
1349          return value;
1350        };
1351        var set = function (v) {
1352          value = v;
1353        };
1354        var clone = function () {
1355          return Cell(get());
1356        };
1357        return {
1358          get: get,
1359          set: set,
1360          clone: clone
1361        };
1362      };
1363  
1364      var parseItem = function (depth, itemSelection, selectionState, item) {
1365        return firstChild(item).filter(isList$1).fold(function () {
1366          itemSelection.each(function (selection) {
1367            if (eq(selection.start, item)) {
1368              selectionState.set(true);
1369            }
1370          });
1371          var currentItemEntry = createEntry(item, depth, selectionState.get());
1372          itemSelection.each(function (selection) {
1373            if (eq(selection.end, item)) {
1374              selectionState.set(false);
1375            }
1376          });
1377          var childListEntries = lastChild(item).filter(isList$1).map(function (list) {
1378            return parseList(depth, itemSelection, selectionState, list);
1379          }).getOr([]);
1380          return currentItemEntry.toArray().concat(childListEntries);
1381        }, function (list) {
1382          return parseList(depth, itemSelection, selectionState, list);
1383        });
1384      };
1385      var parseList = function (depth, itemSelection, selectionState, list) {
1386        return bind(children(list), function (element) {
1387          var parser = isList$1(element) ? parseList : parseItem;
1388          var newDepth = depth + 1;
1389          return parser(newDepth, itemSelection, selectionState, element);
1390        });
1391      };
1392      var parseLists = function (lists, itemSelection) {
1393        var selectionState = Cell(false);
1394        var initialDepth = 0;
1395        return map(lists, function (list) {
1396          return {
1397            sourceList: list,
1398            entries: parseList(initialDepth, itemSelection, selectionState, list)
1399          };
1400        });
1401      };
1402  
1403      var global$8 = tinymce.util.Tools.resolve('tinymce.Env');
1404  
1405      var createTextBlock = function (editor, contentNode) {
1406        var dom = editor.dom;
1407        var blockElements = editor.schema.getBlockElements();
1408        var fragment = dom.createFragment();
1409        var node, textBlock, blockName, hasContentNode;
1410        if (editor.settings.forced_root_block) {
1411          blockName = editor.settings.forced_root_block;
1412        }
1413        if (blockName) {
1414          textBlock = dom.create(blockName);
1415          if (textBlock.tagName === editor.settings.forced_root_block) {
1416            dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
1417          }
1418          if (!NodeType.isBlock(contentNode.firstChild, blockElements)) {
1419            fragment.appendChild(textBlock);
1420          }
1421        }
1422        if (contentNode) {
1423          while (node = contentNode.firstChild) {
1424            var nodeName = node.nodeName;
1425            if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
1426              hasContentNode = true;
1427            }
1428            if (NodeType.isBlock(node, blockElements)) {
1429              fragment.appendChild(node);
1430              textBlock = null;
1431            } else {
1432              if (blockName) {
1433                if (!textBlock) {
1434                  textBlock = dom.create(blockName);
1435                  fragment.appendChild(textBlock);
1436                }
1437                textBlock.appendChild(node);
1438              } else {
1439                fragment.appendChild(node);
1440              }
1441            }
1442          }
1443        }
1444        if (!editor.settings.forced_root_block) {
1445          fragment.appendChild(dom.create('br'));
1446        } else {
1447          if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) {
1448            textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' }));
1449          }
1450        }
1451        return fragment;
1452      };
1453  
1454      var outdentedComposer = function (editor, entries) {
1455        return map(entries, function (entry) {
1456          var content = fromElements(entry.content);
1457          return Element.fromDom(createTextBlock(editor, content.dom()));
1458        });
1459      };
1460      var indentedComposer = function (editor, entries) {
1461        normalizeEntries(entries);
1462        return composeList(editor.contentDocument, entries).toArray();
1463      };
1464      var composeEntries = function (editor, entries) {
1465        return bind(groupBy(entries, isIndented), function (entries) {
1466          var groupIsIndented = head(entries).map(isIndented).getOr(false);
1467          return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries);
1468        });
1469      };
1470      var indentSelectedEntries = function (entries, indentation) {
1471        each(filter(entries, isSelected), function (entry) {
1472          return indentEntry(indentation, entry);
1473        });
1474      };
1475      var getItemSelection = function (editor) {
1476        var selectedListItems = map(Selection.getSelectedListItems(editor), Element.fromDom);
1477        return liftN([
1478          find(selectedListItems, not(hasFirstChildList)),
1479          find(reverse(selectedListItems), not(hasFirstChildList))
1480        ], function (start, end) {
1481          return {
1482            start: start,
1483            end: end
1484          };
1485        });
1486      };
1487      var listsIndentation = function (editor, lists, indentation) {
1488        var entrySets = parseLists(lists, getItemSelection(editor));
1489        each(entrySets, function (entrySet) {
1490          indentSelectedEntries(entrySet.entries, indentation);
1491          before$1(entrySet.sourceList, composeEntries(editor, entrySet.entries));
1492          remove(entrySet.sourceList);
1493        });
1494      };
1495  
1496      var DOM$1 = global$6.DOM;
1497      var splitList = function (editor, ul, li) {
1498        var tmpRng, fragment, bookmarks, node, newBlock;
1499        var removeAndKeepBookmarks = function (targetNode) {
1500          global$5.each(bookmarks, function (node) {
1501            targetNode.parentNode.insertBefore(node, li.parentNode);
1502          });
1503          DOM$1.remove(targetNode);
1504        };
1505        bookmarks = DOM$1.select('span[data-mce-type="bookmark"]', ul);
1506        newBlock = createTextBlock(editor, li);
1507        tmpRng = DOM$1.createRng();
1508        tmpRng.setStartAfter(li);
1509        tmpRng.setEndAfter(ul);
1510        fragment = tmpRng.extractContents();
1511        for (node = fragment.firstChild; node; node = node.firstChild) {
1512          if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
1513            DOM$1.remove(node);
1514            break;
1515          }
1516        }
1517        if (!editor.dom.isEmpty(fragment)) {
1518          DOM$1.insertAfter(fragment, ul);
1519        }
1520        DOM$1.insertAfter(newBlock, ul);
1521        if (NodeType.isEmpty(editor.dom, li.parentNode)) {
1522          removeAndKeepBookmarks(li.parentNode);
1523        }
1524        DOM$1.remove(li);
1525        if (NodeType.isEmpty(editor.dom, ul)) {
1526          DOM$1.remove(ul);
1527        }
1528      };
1529      var SplitList = { splitList: splitList };
1530  
1531      var outdentDlItem = function (editor, item) {
1532        if (is$1(item, 'DD')) {
1533          mutate(item, 'DT');
1534        } else if (is$1(item, 'DT')) {
1535          parent(item).each(function (dl) {
1536            return SplitList.splitList(editor, dl.dom(), item.dom());
1537          });
1538        }
1539      };
1540      var indentDlItem = function (item) {
1541        if (is$1(item, 'DT')) {
1542          mutate(item, 'DD');
1543        }
1544      };
1545      var dlIndentation = function (editor, indentation, dlItems) {
1546        if (indentation === 'Indent') {
1547          each(dlItems, indentDlItem);
1548        } else {
1549          each(dlItems, function (item) {
1550            return outdentDlItem(editor, item);
1551          });
1552        }
1553      };
1554  
1555      var selectionIndentation = function (editor, indentation) {
1556        var lists = map(Selection.getSelectedListRoots(editor), Element.fromDom);
1557        var dlItems = map(Selection.getSelectedDlItems(editor), Element.fromDom);
1558        var isHandled = false;
1559        if (lists.length || dlItems.length) {
1560          var bookmark = editor.selection.getBookmark();
1561          listsIndentation(editor, lists, indentation);
1562          dlIndentation(editor, indentation, dlItems);
1563          editor.selection.moveToBookmark(bookmark);
1564          editor.selection.setRng(Range.normalizeRange(editor.selection.getRng()));
1565          editor.nodeChanged();
1566          isHandled = true;
1567        }
1568        return isHandled;
1569      };
1570      var indentListSelection = function (editor) {
1571        return selectionIndentation(editor, 'Indent');
1572      };
1573      var outdentListSelection = function (editor) {
1574        return selectionIndentation(editor, 'Outdent');
1575      };
1576      var flattenListSelection = function (editor) {
1577        return selectionIndentation(editor, 'Flatten');
1578      };
1579  
1580      var updateListStyle = function (dom, el, detail) {
1581        var type = detail['list-style-type'] ? detail['list-style-type'] : null;
1582        dom.setStyle(el, 'list-style-type', type);
1583      };
1584      var setAttribs = function (elm, attrs) {
1585        global$5.each(attrs, function (value, key) {
1586          elm.setAttribute(key, value);
1587        });
1588      };
1589      var updateListAttrs = function (dom, el, detail) {
1590        setAttribs(el, detail['list-attributes']);
1591        global$5.each(dom.select('li', el), function (li) {
1592          setAttribs(li, detail['list-item-attributes']);
1593        });
1594      };
1595      var updateListWithDetails = function (dom, el, detail) {
1596        updateListStyle(dom, el, detail);
1597        updateListAttrs(dom, el, detail);
1598      };
1599      var removeStyles = function (dom, element, styles) {
1600        global$5.each(styles, function (style) {
1601          var _a;
1602          return dom.setStyle(element, (_a = {}, _a[style] = '', _a));
1603        });
1604      };
1605      var getEndPointNode = function (editor, rng, start, root) {
1606        var container, offset;
1607        container = rng[start ? 'startContainer' : 'endContainer'];
1608        offset = rng[start ? 'startOffset' : 'endOffset'];
1609        if (container.nodeType === 1) {
1610          container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
1611        }
1612        if (!start && NodeType.isBr(container.nextSibling)) {
1613          container = container.nextSibling;
1614        }
1615        while (container.parentNode !== root) {
1616          if (NodeType.isTextBlock(editor, container)) {
1617            return container;
1618          }
1619          if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
1620            return container;
1621          }
1622          container = container.parentNode;
1623        }
1624        return container;
1625      };
1626      var getSelectedTextBlocks = function (editor, rng, root) {
1627        var textBlocks = [], dom = editor.dom;
1628        var startNode = getEndPointNode(editor, rng, true, root);
1629        var endNode = getEndPointNode(editor, rng, false, root);
1630        var block;
1631        var siblings = [];
1632        for (var node = startNode; node; node = node.nextSibling) {
1633          siblings.push(node);
1634          if (node === endNode) {
1635            break;
1636          }
1637        }
1638        global$5.each(siblings, function (node) {
1639          if (NodeType.isTextBlock(editor, node)) {
1640            textBlocks.push(node);
1641            block = null;
1642            return;
1643          }
1644          if (dom.isBlock(node) || NodeType.isBr(node)) {
1645            if (NodeType.isBr(node)) {
1646              dom.remove(node);
1647            }
1648            block = null;
1649            return;
1650          }
1651          var nextSibling = node.nextSibling;
1652          if (global$4.isBookmarkNode(node)) {
1653            if (NodeType.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
1654              block = null;
1655              return;
1656            }
1657          }
1658          if (!block) {
1659            block = dom.create('p');
1660            node.parentNode.insertBefore(block, node);
1661            textBlocks.push(block);
1662          }
1663          block.appendChild(node);
1664        });
1665        return textBlocks;
1666      };
1667      var hasCompatibleStyle = function (dom, sib, detail) {
1668        var sibStyle = dom.getStyle(sib, 'list-style-type');
1669        var detailStyle = detail ? detail['list-style-type'] : '';
1670        detailStyle = detailStyle === null ? '' : detailStyle;
1671        return sibStyle === detailStyle;
1672      };
1673      var applyList = function (editor, listName, detail) {
1674        if (detail === void 0) {
1675          detail = {};
1676        }
1677        var rng = editor.selection.getRng(true);
1678        var bookmark;
1679        var listItemName = 'LI';
1680        var root = Selection.getClosestListRootElm(editor, editor.selection.getStart(true));
1681        var dom = editor.dom;
1682        if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
1683          return;
1684        }
1685        listName = listName.toUpperCase();
1686        if (listName === 'DL') {
1687          listItemName = 'DT';
1688        }
1689        bookmark = Bookmark.createBookmark(rng);
1690        global$5.each(getSelectedTextBlocks(editor, rng, root), function (block) {
1691          var listBlock, sibling;
1692          sibling = block.previousSibling;
1693          if (sibling && NodeType.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
1694            listBlock = sibling;
1695            block = dom.rename(block, listItemName);
1696            sibling.appendChild(block);
1697          } else {
1698            listBlock = dom.create(listName);
1699            block.parentNode.insertBefore(listBlock, block);
1700            listBlock.appendChild(block);
1701            block = dom.rename(block, listItemName);
1702          }
1703          removeStyles(dom, block, [
1704            'margin',
1705            'margin-right',
1706            'margin-bottom',
1707            'margin-left',
1708            'margin-top',
1709            'padding',
1710            'padding-right',
1711            'padding-bottom',
1712            'padding-left',
1713            'padding-top'
1714          ]);
1715          updateListWithDetails(dom, listBlock, detail);
1716          mergeWithAdjacentLists(editor.dom, listBlock);
1717        });
1718        editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
1719      };
1720      var isValidLists = function (list1, list2) {
1721        return list1 && list2 && NodeType.isListNode(list1) && list1.nodeName === list2.nodeName;
1722      };
1723      var hasSameListStyle = function (dom, list1, list2) {
1724        var targetStyle = dom.getStyle(list1, 'list-style-type', true);
1725        var style = dom.getStyle(list2, 'list-style-type', true);
1726        return targetStyle === style;
1727      };
1728      var hasSameClasses = function (elm1, elm2) {
1729        return elm1.className === elm2.className;
1730      };
1731      var shouldMerge = function (dom, list1, list2) {
1732        return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
1733      };
1734      var mergeWithAdjacentLists = function (dom, listBlock) {
1735        var sibling, node;
1736        sibling = listBlock.nextSibling;
1737        if (shouldMerge(dom, listBlock, sibling)) {
1738          while (node = sibling.firstChild) {
1739            listBlock.appendChild(node);
1740          }
1741          dom.remove(sibling);
1742        }
1743        sibling = listBlock.previousSibling;
1744        if (shouldMerge(dom, listBlock, sibling)) {
1745          while (node = sibling.lastChild) {
1746            listBlock.insertBefore(node, listBlock.firstChild);
1747          }
1748          dom.remove(sibling);
1749        }
1750      };
1751      var updateList = function (dom, list, listName, detail) {
1752        if (list.nodeName !== listName) {
1753          var newList = dom.rename(list, listName);
1754          updateListWithDetails(dom, newList, detail);
1755        } else {
1756          updateListWithDetails(dom, list, detail);
1757        }
1758      };
1759      var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
1760        if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
1761          flattenListSelection(editor);
1762        } else {
1763          var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
1764          global$5.each([parentList].concat(lists), function (elm) {
1765            updateList(editor.dom, elm, listName, detail);
1766          });
1767          editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
1768        }
1769      };
1770      var hasListStyleDetail = function (detail) {
1771        return 'list-style-type' in detail;
1772      };
1773      var toggleSingleList = function (editor, parentList, listName, detail) {
1774        if (parentList === editor.getBody()) {
1775          return;
1776        }
1777        if (parentList) {
1778          if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
1779            flattenListSelection(editor);
1780          } else {
1781            var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
1782            updateListWithDetails(editor.dom, parentList, detail);
1783            mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName));
1784            editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
1785          }
1786        } else {
1787          applyList(editor, listName, detail);
1788        }
1789      };
1790      var toggleList = function (editor, listName, detail) {
1791        var parentList = Selection.getParentList(editor);
1792        var selectedSubLists = Selection.getSelectedSubLists(editor);
1793        detail = detail ? detail : {};
1794        if (parentList && selectedSubLists.length > 0) {
1795          toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
1796        } else {
1797          toggleSingleList(editor, parentList, listName, detail);
1798        }
1799      };
1800      var ToggleList = {
1801        toggleList: toggleList,
1802        mergeWithAdjacentLists: mergeWithAdjacentLists
1803      };
1804  
1805      var DOM$2 = global$6.DOM;
1806      var normalizeList = function (dom, ul) {
1807        var sibling;
1808        var parentNode = ul.parentNode;
1809        if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
1810          sibling = parentNode.previousSibling;
1811          if (sibling && sibling.nodeName === 'LI') {
1812            sibling.appendChild(ul);
1813            if (NodeType.isEmpty(dom, parentNode)) {
1814              DOM$2.remove(parentNode);
1815            }
1816          } else {
1817            DOM$2.setStyle(parentNode, 'listStyleType', 'none');
1818          }
1819        }
1820        if (NodeType.isListNode(parentNode)) {
1821          sibling = parentNode.previousSibling;
1822          if (sibling && sibling.nodeName === 'LI') {
1823            sibling.appendChild(ul);
1824          }
1825        }
1826      };
1827      var normalizeLists = function (dom, element) {
1828        global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) {
1829          normalizeList(dom, ul);
1830        });
1831      };
1832      var NormalizeLists = {
1833        normalizeList: normalizeList,
1834        normalizeLists: normalizeLists
1835      };
1836  
1837      var findNextCaretContainer = function (editor, rng, isForward, root) {
1838        var node = rng.startContainer;
1839        var offset = rng.startOffset;
1840        var nonEmptyBlocks, walker;
1841        if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
1842          return node;
1843        }
1844        nonEmptyBlocks = editor.schema.getNonEmptyElements();
1845        if (node.nodeType === 1) {
1846          node = global$1.getNode(node, offset);
1847        }
1848        walker = new global$2(node, root);
1849        if (isForward) {
1850          if (NodeType.isBogusBr(editor.dom, node)) {
1851            walker.next();
1852          }
1853        }
1854        while (node = walker[isForward ? 'next' : 'prev2']()) {
1855          if (node.nodeName === 'LI' && !node.hasChildNodes()) {
1856            return node;
1857          }
1858          if (nonEmptyBlocks[node.nodeName]) {
1859            return node;
1860          }
1861          if (node.nodeType === 3 && node.data.length > 0) {
1862            return node;
1863          }
1864        }
1865      };
1866      var hasOnlyOneBlockChild = function (dom, elm) {
1867        var childNodes = elm.childNodes;
1868        return childNodes.length === 1 && !NodeType.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
1869      };
1870      var unwrapSingleBlockChild = function (dom, elm) {
1871        if (hasOnlyOneBlockChild(dom, elm)) {
1872          dom.remove(elm.firstChild, true);
1873        }
1874      };
1875      var moveChildren = function (dom, fromElm, toElm) {
1876        var node, targetElm;
1877        targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
1878        unwrapSingleBlockChild(dom, fromElm);
1879        if (!NodeType.isEmpty(dom, fromElm, true)) {
1880          while (node = fromElm.firstChild) {
1881            targetElm.appendChild(node);
1882          }
1883        }
1884      };
1885      var mergeLiElements = function (dom, fromElm, toElm) {
1886        var node, listNode;
1887        var ul = fromElm.parentNode;
1888        if (!NodeType.isChildOfBody(dom, fromElm) || !NodeType.isChildOfBody(dom, toElm)) {
1889          return;
1890        }
1891        if (NodeType.isListNode(toElm.lastChild)) {
1892          listNode = toElm.lastChild;
1893        }
1894        if (ul === toElm.lastChild) {
1895          if (NodeType.isBr(ul.previousSibling)) {
1896            dom.remove(ul.previousSibling);
1897          }
1898        }
1899        node = toElm.lastChild;
1900        if (node && NodeType.isBr(node) && fromElm.hasChildNodes()) {
1901          dom.remove(node);
1902        }
1903        if (NodeType.isEmpty(dom, toElm, true)) {
1904          dom.$(toElm).empty();
1905        }
1906        moveChildren(dom, fromElm, toElm);
1907        if (listNode) {
1908          toElm.appendChild(listNode);
1909        }
1910        var contains = contains$1(Element.fromDom(toElm), Element.fromDom(fromElm));
1911        var nestedLists = contains ? dom.getParents(fromElm, NodeType.isListNode, toElm) : [];
1912        dom.remove(fromElm);
1913        each(nestedLists, function (list) {
1914          if (NodeType.isEmpty(dom, list) && list !== dom.getRoot()) {
1915            dom.remove(list);
1916          }
1917        });
1918      };
1919      var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
1920        editor.dom.$(toLi).empty();
1921        mergeLiElements(editor.dom, fromLi, toLi);
1922        editor.selection.setCursorLocation(toLi);
1923      };
1924      var mergeForward = function (editor, rng, fromLi, toLi) {
1925        var dom = editor.dom;
1926        if (dom.isEmpty(toLi)) {
1927          mergeIntoEmptyLi(editor, fromLi, toLi);
1928        } else {
1929          var bookmark = Bookmark.createBookmark(rng);
1930          mergeLiElements(dom, fromLi, toLi);
1931          editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
1932        }
1933      };
1934      var mergeBackward = function (editor, rng, fromLi, toLi) {
1935        var bookmark = Bookmark.createBookmark(rng);
1936        mergeLiElements(editor.dom, fromLi, toLi);
1937        var resolvedBookmark = Bookmark.resolveBookmark(bookmark);
1938        editor.selection.setRng(resolvedBookmark);
1939      };
1940      var backspaceDeleteFromListToListCaret = function (editor, isForward) {
1941        var dom = editor.dom, selection = editor.selection;
1942        var selectionStartElm = selection.getStart();
1943        var root = Selection.getClosestListRootElm(editor, selectionStartElm);
1944        var li = dom.getParent(selection.getStart(), 'LI', root);
1945        var ul, rng, otherLi;
1946        if (li) {
1947          ul = li.parentNode;
1948          if (ul === editor.getBody() && NodeType.isEmpty(dom, ul)) {
1949            return true;
1950          }
1951          rng = Range.normalizeRange(selection.getRng(true));
1952          otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1953          if (otherLi && otherLi !== li) {
1954            if (isForward) {
1955              mergeForward(editor, rng, otherLi, li);
1956            } else {
1957              mergeBackward(editor, rng, li, otherLi);
1958            }
1959            return true;
1960          } else if (!otherLi) {
1961            if (!isForward) {
1962              flattenListSelection(editor);
1963              return true;
1964            }
1965          }
1966        }
1967        return false;
1968      };
1969      var removeBlock = function (dom, block, root) {
1970        var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
1971        dom.remove(block);
1972        if (parentBlock && dom.isEmpty(parentBlock)) {
1973          dom.remove(parentBlock);
1974        }
1975      };
1976      var backspaceDeleteIntoListCaret = function (editor, isForward) {
1977        var dom = editor.dom;
1978        var selectionStartElm = editor.selection.getStart();
1979        var root = Selection.getClosestListRootElm(editor, selectionStartElm);
1980        var block = dom.getParent(selectionStartElm, dom.isBlock, root);
1981        if (block && dom.isEmpty(block)) {
1982          var rng = Range.normalizeRange(editor.selection.getRng(true));
1983          var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
1984          if (otherLi_1) {
1985            editor.undoManager.transact(function () {
1986              removeBlock(dom, block, root);
1987              ToggleList.mergeWithAdjacentLists(dom, otherLi_1.parentNode);
1988              editor.selection.select(otherLi_1, true);
1989              editor.selection.collapse(isForward);
1990            });
1991            return true;
1992          }
1993        }
1994        return false;
1995      };
1996      var backspaceDeleteCaret = function (editor, isForward) {
1997        return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
1998      };
1999      var backspaceDeleteRange = function (editor) {
2000        var selectionStartElm = editor.selection.getStart();
2001        var root = Selection.getClosestListRootElm(editor, selectionStartElm);
2002        var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
2003        if (startListParent || Selection.getSelectedListItems(editor).length > 0) {
2004          editor.undoManager.transact(function () {
2005            editor.execCommand('Delete');
2006            NormalizeLists.normalizeLists(editor.dom, editor.getBody());
2007          });
2008          return true;
2009        }
2010        return false;
2011      };
2012      var backspaceDelete = function (editor, isForward) {
2013        return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
2014      };
2015      var setup = function (editor) {
2016        editor.on('keydown', function (e) {
2017          if (e.keyCode === global$3.BACKSPACE) {
2018            if (backspaceDelete(editor, false)) {
2019              e.preventDefault();
2020            }
2021          } else if (e.keyCode === global$3.DELETE) {
2022            if (backspaceDelete(editor, true)) {
2023              e.preventDefault();
2024            }
2025          }
2026        });
2027      };
2028      var Delete = {
2029        setup: setup,
2030        backspaceDelete: backspaceDelete
2031      };
2032  
2033      var get = function (editor) {
2034        return {
2035          backspaceDelete: function (isForward) {
2036            Delete.backspaceDelete(editor, isForward);
2037          }
2038        };
2039      };
2040      var Api = { get: get };
2041  
2042      var queryListCommandState = function (editor, listName) {
2043        return function () {
2044          var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
2045          return parentList && parentList.nodeName === listName;
2046        };
2047      };
2048      var register = function (editor) {
2049        editor.on('BeforeExecCommand', function (e) {
2050          var cmd = e.command.toLowerCase();
2051          if (cmd === 'indent') {
2052            indentListSelection(editor);
2053          } else if (cmd === 'outdent') {
2054            outdentListSelection(editor);
2055          }
2056        });
2057        editor.addCommand('InsertUnorderedList', function (ui, detail) {
2058          ToggleList.toggleList(editor, 'UL', detail);
2059        });
2060        editor.addCommand('InsertOrderedList', function (ui, detail) {
2061          ToggleList.toggleList(editor, 'OL', detail);
2062        });
2063        editor.addCommand('InsertDefinitionList', function (ui, detail) {
2064          ToggleList.toggleList(editor, 'DL', detail);
2065        });
2066        editor.addCommand('RemoveList', function () {
2067          flattenListSelection(editor);
2068        });
2069        editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
2070        editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
2071        editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
2072      };
2073      var Commands = { register: register };
2074  
2075      var shouldIndentOnTab = function (editor) {
2076        return editor.getParam('lists_indent_on_tab', true);
2077      };
2078      var Settings = { shouldIndentOnTab: shouldIndentOnTab };
2079  
2080      var setupTabKey = function (editor) {
2081        editor.on('keydown', function (e) {
2082          if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) {
2083            return;
2084          }
2085          editor.undoManager.transact(function () {
2086            if (e.shiftKey ? outdentListSelection(editor) : indentListSelection(editor)) {
2087              e.preventDefault();
2088            }
2089          });
2090        });
2091      };
2092      var setup$1 = function (editor) {
2093        if (Settings.shouldIndentOnTab(editor)) {
2094          setupTabKey(editor);
2095        }
2096        Delete.setup(editor);
2097      };
2098      var Keyboard = { setup: setup$1 };
2099  
2100      var findIndex = function (list, predicate) {
2101        for (var index = 0; index < list.length; index++) {
2102          var element = list[index];
2103          if (predicate(element)) {
2104            return index;
2105          }
2106        }
2107        return -1;
2108      };
2109      var listState = function (editor, listName) {
2110        return function (e) {
2111          var ctrl = e.control;
2112          editor.on('NodeChange', function (e) {
2113            var tableCellIndex = findIndex(e.parents, NodeType.isTableCellNode);
2114            var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
2115            var lists = global$5.grep(parents, NodeType.isListNode);
2116            ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
2117          });
2118        };
2119      };
2120      var register$1 = function (editor) {
2121        var hasPlugin = function (editor, plugin) {
2122          var plugins = editor.settings.plugins ? editor.settings.plugins : '';
2123          return global$5.inArray(plugins.split(/[ ,]/), plugin) !== -1;
2124        };
2125        if (!hasPlugin(editor, 'advlist')) {
2126          editor.addButton('numlist', {
2127            active: false,
2128            title: 'Numbered list',
2129            cmd: 'InsertOrderedList',
2130            onPostRender: listState(editor, 'OL')
2131          });
2132          editor.addButton('bullist', {
2133            active: false,
2134            title: 'Bullet list',
2135            cmd: 'InsertUnorderedList',
2136            onPostRender: listState(editor, 'UL')
2137          });
2138        }
2139        editor.addButton('indent', {
2140          icon: 'indent',
2141          title: 'Increase indent',
2142          cmd: 'Indent'
2143        });
2144      };
2145      var Buttons = { register: register$1 };
2146  
2147      global.add('lists', function (editor) {
2148        Keyboard.setup(editor);
2149        Buttons.register(editor);
2150        Commands.register(editor);
2151        return Api.get(editor);
2152      });
2153      function Plugin () {
2154      }
2155  
2156      return Plugin;
2157  
2158  }(window));
2159  })();


Generated: Wed Sep 18 01:00:03 2019 Cross-referenced by PHPXref 0.7.1