2017-04-10 01:01:43 +02:00
|
|
|
(function () {
|
2018-05-02 00:31:24 +02:00
|
|
|
var lists = (function () {
|
|
|
|
'use strict';
|
2017-04-10 01:01:43 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
2017-04-10 01:01:43 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$4 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var isTextNode = function (node) {
|
|
|
|
return node && node.nodeType === 3;
|
|
|
|
};
|
|
|
|
var isListNode = function (node) {
|
|
|
|
return node && /^(OL|UL|DL)$/.test(node.nodeName);
|
|
|
|
};
|
|
|
|
var isListItemNode = function (node) {
|
|
|
|
return node && /^(LI|DT|DD)$/.test(node.nodeName);
|
|
|
|
};
|
|
|
|
var isTableCellNode = function (node) {
|
|
|
|
return node && /^(TH|TD)$/.test(node.nodeName);
|
|
|
|
};
|
|
|
|
var isBr = function (node) {
|
|
|
|
return node && node.nodeName === 'BR';
|
|
|
|
};
|
|
|
|
var isFirstChild = function (node) {
|
|
|
|
return node.parentNode.firstChild === node;
|
|
|
|
};
|
|
|
|
var isLastChild = function (node) {
|
|
|
|
return node.parentNode.lastChild === node;
|
|
|
|
};
|
|
|
|
var isTextBlock = function (editor, node) {
|
|
|
|
return node && !!editor.schema.getTextBlockElements()[node.nodeName];
|
|
|
|
};
|
|
|
|
var isBlock = function (node, blockElements) {
|
|
|
|
return node && node.nodeName in blockElements;
|
|
|
|
};
|
|
|
|
var isBogusBr = function (dom, node) {
|
|
|
|
if (!isBr(node)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
var isEmpty = function (dom, elm, keepBookmarks) {
|
|
|
|
var empty = dom.isEmpty(elm);
|
|
|
|
if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return empty;
|
|
|
|
};
|
|
|
|
var isChildOfBody = function (dom, elm) {
|
|
|
|
return dom.isChildOf(elm, dom.getRoot());
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_okk1ogljjgweckx = {
|
2018-05-02 00:31:24 +02:00
|
|
|
isTextNode: isTextNode,
|
|
|
|
isListNode: isListNode,
|
|
|
|
isListItemNode: isListItemNode,
|
|
|
|
isTableCellNode: isTableCellNode,
|
|
|
|
isBr: isBr,
|
|
|
|
isFirstChild: isFirstChild,
|
|
|
|
isLastChild: isLastChild,
|
|
|
|
isTextBlock: isTextBlock,
|
|
|
|
isBlock: isBlock,
|
|
|
|
isBogusBr: isBogusBr,
|
|
|
|
isEmpty: isEmpty,
|
|
|
|
isChildOfBody: isChildOfBody
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var getNormalizedEndPoint = function (container, offset) {
|
|
|
|
var node = global$1.getNode(container, offset);
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isListItemNode(container) && $_okk1ogljjgweckx.isTextNode(node)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
var textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0;
|
|
|
|
return {
|
|
|
|
container: node,
|
|
|
|
offset: textNodeOffset
|
|
|
|
};
|
|
|
|
}
|
2017-05-08 07:32:46 +02:00
|
|
|
return {
|
2018-05-02 00:31:24 +02:00
|
|
|
container: container,
|
|
|
|
offset: offset
|
2017-05-08 07:32:46 +02:00
|
|
|
};
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var normalizeRange = function (rng) {
|
|
|
|
var outRng = rng.cloneRange();
|
|
|
|
var rangeStart = getNormalizedEndPoint(rng.startContainer, rng.startOffset);
|
|
|
|
outRng.setStart(rangeStart.container, rangeStart.offset);
|
|
|
|
var rangeEnd = getNormalizedEndPoint(rng.endContainer, rng.endOffset);
|
|
|
|
outRng.setEnd(rangeEnd.container, rangeEnd.offset);
|
|
|
|
return outRng;
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_a9cyhvgkjjgweckv = {
|
2018-05-02 00:31:24 +02:00
|
|
|
getNormalizedEndPoint: getNormalizedEndPoint,
|
|
|
|
normalizeRange: normalizeRange
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var DOM = global$6.DOM;
|
|
|
|
var createBookmark = function (rng) {
|
|
|
|
var bookmark = {};
|
|
|
|
var setupEndPoint = function (start) {
|
|
|
|
var offsetNode, container, offset;
|
2017-05-08 07:32:46 +02:00
|
|
|
container = rng[start ? 'startContainer' : 'endContainer'];
|
|
|
|
offset = rng[start ? 'startOffset' : 'endOffset'];
|
|
|
|
if (container.nodeType === 1) {
|
2018-05-02 00:31:24 +02:00
|
|
|
offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' });
|
|
|
|
if (container.hasChildNodes()) {
|
|
|
|
offset = Math.min(offset, container.childNodes.length - 1);
|
|
|
|
if (start) {
|
|
|
|
container.insertBefore(offsetNode, container.childNodes[offset]);
|
|
|
|
} else {
|
|
|
|
DOM.insertAfter(offsetNode, container.childNodes[offset]);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
container.appendChild(offsetNode);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
container = offsetNode;
|
|
|
|
offset = 0;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
bookmark[start ? 'startContainer' : 'endContainer'] = container;
|
|
|
|
bookmark[start ? 'startOffset' : 'endOffset'] = offset;
|
2017-05-08 07:32:46 +02:00
|
|
|
};
|
2018-05-02 00:31:24 +02:00
|
|
|
setupEndPoint(true);
|
|
|
|
if (!rng.collapsed) {
|
|
|
|
setupEndPoint();
|
|
|
|
}
|
|
|
|
return bookmark;
|
|
|
|
};
|
|
|
|
var resolveBookmark = function (bookmark) {
|
|
|
|
function restoreEndPoint(start) {
|
|
|
|
var container, offset, node;
|
|
|
|
var nodeIndex = function (container) {
|
|
|
|
var node = container.parentNode.firstChild, idx = 0;
|
|
|
|
while (node) {
|
|
|
|
if (node === container) {
|
|
|
|
return idx;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
|
|
|
|
idx++;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
node = node.nextSibling;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
return -1;
|
|
|
|
};
|
|
|
|
container = node = bookmark[start ? 'startContainer' : 'endContainer'];
|
|
|
|
offset = bookmark[start ? 'startOffset' : 'endOffset'];
|
|
|
|
if (!container) {
|
2017-05-08 07:32:46 +02:00
|
|
|
return;
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (container.nodeType === 1) {
|
|
|
|
offset = nodeIndex(container);
|
|
|
|
container = container.parentNode;
|
|
|
|
DOM.remove(node);
|
|
|
|
if (!container.hasChildNodes() && DOM.isBlock(container)) {
|
|
|
|
container.appendChild(DOM.create('br'));
|
|
|
|
}
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
bookmark[start ? 'startContainer' : 'endContainer'] = container;
|
|
|
|
bookmark[start ? 'startOffset' : 'endOffset'] = offset;
|
|
|
|
}
|
|
|
|
restoreEndPoint(true);
|
|
|
|
restoreEndPoint();
|
|
|
|
var rng = DOM.createRng();
|
|
|
|
rng.setStart(bookmark.startContainer, bookmark.startOffset);
|
|
|
|
if (bookmark.endContainer) {
|
|
|
|
rng.setEnd(bookmark.endContainer, bookmark.endOffset);
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
return $_a9cyhvgkjjgweckv.normalizeRange(rng);
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_2nx1i4gjjjgweckt = {
|
2018-05-02 00:31:24 +02:00
|
|
|
createBookmark: createBookmark,
|
|
|
|
resolveBookmark: resolveBookmark
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var DOM$1 = global$6.DOM;
|
|
|
|
var normalizeList = function (dom, ul) {
|
|
|
|
var sibling;
|
|
|
|
var parentNode = ul.parentNode;
|
|
|
|
if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
|
|
|
|
sibling = parentNode.previousSibling;
|
|
|
|
if (sibling && sibling.nodeName === 'LI') {
|
|
|
|
sibling.appendChild(ul);
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(dom, parentNode)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$1.remove(parentNode);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
} else {
|
|
|
|
DOM$1.setStyle(parentNode, 'listStyleType', 'none');
|
|
|
|
}
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isListNode(parentNode)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
sibling = parentNode.previousSibling;
|
|
|
|
if (sibling && sibling.nodeName === 'LI') {
|
|
|
|
sibling.appendChild(ul);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var normalizeLists = function (dom, element) {
|
|
|
|
global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) {
|
|
|
|
normalizeList(dom, ul);
|
|
|
|
});
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_ekd4wzgmjjgwecl1 = {
|
2018-05-02 00:31:24 +02:00
|
|
|
normalizeList: normalizeList,
|
|
|
|
normalizeLists: normalizeLists
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var getParentList = function (editor) {
|
|
|
|
var selectionStart = editor.selection.getStart(true);
|
|
|
|
return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));
|
|
|
|
};
|
|
|
|
var isParentListSelected = function (parentList, selectedBlocks) {
|
|
|
|
return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
|
|
|
|
};
|
|
|
|
var findSubLists = function (parentList) {
|
|
|
|
return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) {
|
2018-07-17 12:04:26 +02:00
|
|
|
return $_okk1ogljjgweckx.isListNode(elm);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
var getSelectedSubLists = function (editor) {
|
|
|
|
var parentList = getParentList(editor);
|
|
|
|
var selectedBlocks = editor.selection.getSelectedBlocks();
|
|
|
|
if (isParentListSelected(parentList, selectedBlocks)) {
|
|
|
|
return findSubLists(parentList);
|
|
|
|
} else {
|
|
|
|
return global$5.grep(selectedBlocks, function (elm) {
|
2018-07-17 12:04:26 +02:00
|
|
|
return $_okk1ogljjgweckx.isListNode(elm) && parentList !== elm;
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var findParentListItemsNodes = function (editor, elms) {
|
|
|
|
var listItemsElms = global$5.map(elms, function (elm) {
|
|
|
|
var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
|
|
|
|
return parentLi ? parentLi : elm;
|
|
|
|
});
|
|
|
|
return global$7.unique(listItemsElms);
|
|
|
|
};
|
|
|
|
var getSelectedListItems = function (editor) {
|
|
|
|
var selectedBlocks = editor.selection.getSelectedBlocks();
|
|
|
|
return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
|
2018-07-17 12:04:26 +02:00
|
|
|
return $_okk1ogljjgweckx.isListItemNode(block);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
var getClosestListRootElm = function (editor, elm) {
|
|
|
|
var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
|
|
|
|
var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
|
|
|
|
return root;
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_3xb1cggnjjgwecl3 = {
|
2018-05-02 00:31:24 +02:00
|
|
|
getParentList: getParentList,
|
|
|
|
getSelectedSubLists: getSelectedSubLists,
|
|
|
|
getSelectedListItems: getSelectedListItems,
|
|
|
|
getClosestListRootElm: getClosestListRootElm
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var global$8 = tinymce.util.Tools.resolve('tinymce.Env');
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var DOM$2 = global$6.DOM;
|
|
|
|
var createNewTextBlock = function (editor, contentNode, blockName) {
|
|
|
|
var node, textBlock;
|
|
|
|
var fragment = DOM$2.createFragment();
|
|
|
|
var hasContentNode;
|
|
|
|
var blockElements = editor.schema.getBlockElements();
|
|
|
|
if (editor.settings.forced_root_block) {
|
|
|
|
blockName = blockName || editor.settings.forced_root_block;
|
|
|
|
}
|
|
|
|
if (blockName) {
|
|
|
|
textBlock = DOM$2.create(blockName);
|
|
|
|
if (textBlock.tagName === editor.settings.forced_root_block) {
|
|
|
|
DOM$2.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if (!$_okk1ogljjgweckx.isBlock(contentNode.firstChild, blockElements)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
fragment.appendChild(textBlock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (contentNode) {
|
|
|
|
while (node = contentNode.firstChild) {
|
|
|
|
var nodeName = node.nodeName;
|
|
|
|
if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
|
|
|
|
hasContentNode = true;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isBlock(node, blockElements)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
fragment.appendChild(node);
|
|
|
|
textBlock = null;
|
|
|
|
} else {
|
|
|
|
if (blockName) {
|
|
|
|
if (!textBlock) {
|
|
|
|
textBlock = DOM$2.create(blockName);
|
|
|
|
fragment.appendChild(textBlock);
|
|
|
|
}
|
|
|
|
textBlock.appendChild(node);
|
|
|
|
} else {
|
|
|
|
fragment.appendChild(node);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!editor.settings.forced_root_block) {
|
|
|
|
fragment.appendChild(DOM$2.create('br'));
|
|
|
|
} else {
|
|
|
|
if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) {
|
|
|
|
textBlock.appendChild(DOM$2.create('br', { 'data-mce-bogus': '1' }));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fragment;
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_kbc02gqjjgwecl9 = { createNewTextBlock: createNewTextBlock };
|
2018-05-02 00:31:24 +02:00
|
|
|
|
|
|
|
var DOM$3 = global$6.DOM;
|
|
|
|
var splitList = function (editor, ul, li, newBlock) {
|
|
|
|
var tmpRng, fragment, bookmarks, node;
|
|
|
|
var removeAndKeepBookmarks = function (targetNode) {
|
|
|
|
global$5.each(bookmarks, function (node) {
|
|
|
|
targetNode.parentNode.insertBefore(node, li.parentNode);
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$3.remove(targetNode);
|
|
|
|
};
|
|
|
|
bookmarks = DOM$3.select('span[data-mce-type="bookmark"]', ul);
|
2018-07-17 12:04:26 +02:00
|
|
|
newBlock = newBlock || $_kbc02gqjjgwecl9.createNewTextBlock(editor, li);
|
2018-05-02 00:31:24 +02:00
|
|
|
tmpRng = DOM$3.createRng();
|
|
|
|
tmpRng.setStartAfter(li);
|
|
|
|
tmpRng.setEndAfter(ul);
|
|
|
|
fragment = tmpRng.extractContents();
|
|
|
|
for (node = fragment.firstChild; node; node = node.firstChild) {
|
|
|
|
if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
|
|
|
|
DOM$3.remove(node);
|
|
|
|
break;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
if (!editor.dom.isEmpty(fragment)) {
|
|
|
|
DOM$3.insertAfter(fragment, ul);
|
|
|
|
}
|
|
|
|
DOM$3.insertAfter(newBlock, ul);
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(editor.dom, li.parentNode)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
removeAndKeepBookmarks(li.parentNode);
|
|
|
|
}
|
|
|
|
DOM$3.remove(li);
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(editor.dom, ul)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$3.remove(ul);
|
|
|
|
}
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_fikiq7gpjjgwecl5 = { splitList: splitList };
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var DOM$4 = global$6.DOM;
|
|
|
|
var removeEmptyLi = function (dom, li) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(dom, li)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$4.remove(li);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var outdent = function (editor, li) {
|
|
|
|
var ul = li.parentNode;
|
|
|
|
var ulParent, newBlock;
|
|
|
|
if (ul) {
|
|
|
|
ulParent = ul.parentNode;
|
|
|
|
} else {
|
|
|
|
removeEmptyLi(editor.dom, li);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (ul === editor.getBody()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (li.nodeName === 'DD') {
|
|
|
|
DOM$4.rename(li, 'DT');
|
|
|
|
return true;
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isFirstChild(li) && $_okk1ogljjgweckx.isLastChild(li)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
if (ulParent.nodeName === 'LI') {
|
|
|
|
DOM$4.insertAfter(li, ulParent);
|
|
|
|
removeEmptyLi(editor.dom, ulParent);
|
|
|
|
DOM$4.remove(ul);
|
2018-07-17 12:04:26 +02:00
|
|
|
} else if ($_okk1ogljjgweckx.isListNode(ulParent)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$4.remove(ul, true);
|
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
ulParent.insertBefore($_kbc02gqjjgwecl9.createNewTextBlock(editor, li), ul);
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$4.remove(ul);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
return true;
|
2018-07-17 12:04:26 +02:00
|
|
|
} else if ($_okk1ogljjgweckx.isFirstChild(li)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
if (ulParent.nodeName === 'LI') {
|
|
|
|
DOM$4.insertAfter(li, ulParent);
|
|
|
|
li.appendChild(ul);
|
|
|
|
removeEmptyLi(editor.dom, ulParent);
|
2018-07-17 12:04:26 +02:00
|
|
|
} else if ($_okk1ogljjgweckx.isListNode(ulParent)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
ulParent.insertBefore(li, ul);
|
2017-09-26 23:15:47 +02:00
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
ulParent.insertBefore($_kbc02gqjjgwecl9.createNewTextBlock(editor, li), ul);
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$4.remove(li);
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
return true;
|
2018-07-17 12:04:26 +02:00
|
|
|
} else if ($_okk1ogljjgweckx.isLastChild(li)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
if (ulParent.nodeName === 'LI') {
|
|
|
|
DOM$4.insertAfter(li, ulParent);
|
2018-07-17 12:04:26 +02:00
|
|
|
} else if ($_okk1ogljjgweckx.isListNode(ulParent)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$4.insertAfter(li, ul);
|
2017-09-26 23:15:47 +02:00
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
DOM$4.insertAfter($_kbc02gqjjgwecl9.createNewTextBlock(editor, li), ul);
|
2018-05-02 00:31:24 +02:00
|
|
|
DOM$4.remove(li);
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (ulParent.nodeName === 'LI') {
|
|
|
|
ul = ulParent;
|
2018-07-17 12:04:26 +02:00
|
|
|
newBlock = $_kbc02gqjjgwecl9.createNewTextBlock(editor, li, 'LI');
|
|
|
|
} else if ($_okk1ogljjgweckx.isListNode(ulParent)) {
|
|
|
|
newBlock = $_kbc02gqjjgwecl9.createNewTextBlock(editor, li, 'LI');
|
2018-05-02 00:31:24 +02:00
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
newBlock = $_kbc02gqjjgwecl9.createNewTextBlock(editor, li);
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
$_fikiq7gpjjgwecl5.splitList(editor, ul, li, newBlock);
|
|
|
|
$_ekd4wzgmjjgwecl1.normalizeLists(editor.dom, ul.parentNode);
|
2018-05-02 00:31:24 +02:00
|
|
|
return true;
|
|
|
|
};
|
|
|
|
var outdentSelection = function (editor) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var listElements = $_3xb1cggnjjgwecl3.getSelectedListItems(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
if (listElements.length) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(editor.selection.getRng());
|
2018-05-02 00:31:24 +02:00
|
|
|
var i = void 0, y = void 0;
|
2018-07-17 12:04:26 +02:00
|
|
|
var root = $_3xb1cggnjjgwecl3.getClosestListRootElm(editor, editor.selection.getStart(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
i = listElements.length;
|
|
|
|
while (i--) {
|
|
|
|
var node = listElements[i].parentNode;
|
|
|
|
while (node && node !== root) {
|
|
|
|
y = listElements.length;
|
|
|
|
while (y--) {
|
|
|
|
if (listElements[y] === node) {
|
|
|
|
listElements.splice(i, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
node = node.parentNode;
|
|
|
|
}
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
for (i = 0; i < listElements.length; i++) {
|
|
|
|
if (!outdent(editor, listElements[i]) && i === 0) {
|
|
|
|
break;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2018-05-02 00:31:24 +02:00
|
|
|
editor.nodeChanged();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_6pbactghjjgweckp = {
|
2018-05-02 00:31:24 +02:00
|
|
|
outdent: outdent,
|
|
|
|
outdentSelection: outdentSelection
|
|
|
|
};
|
2017-09-26 23:15:47 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var updateListStyle = function (dom, el, detail) {
|
|
|
|
var type = detail['list-style-type'] ? detail['list-style-type'] : null;
|
|
|
|
dom.setStyle(el, 'list-style-type', type);
|
|
|
|
};
|
|
|
|
var setAttribs = function (elm, attrs) {
|
|
|
|
global$5.each(attrs, function (value, key) {
|
|
|
|
elm.setAttribute(key, value);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
var updateListAttrs = function (dom, el, detail) {
|
|
|
|
setAttribs(el, detail['list-attributes']);
|
|
|
|
global$5.each(dom.select('li', el), function (li) {
|
|
|
|
setAttribs(li, detail['list-item-attributes']);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
var updateListWithDetails = function (dom, el, detail) {
|
|
|
|
updateListStyle(dom, el, detail);
|
|
|
|
updateListAttrs(dom, el, detail);
|
|
|
|
};
|
|
|
|
var removeStyles = function (dom, element, styles) {
|
|
|
|
global$5.each(styles, function (style) {
|
|
|
|
var _a;
|
2018-07-17 12:04:26 +02:00
|
|
|
return dom.setStyle(element, (_a = {}, _a[style] = '', _a));
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
var getEndPointNode = function (editor, rng, start, root) {
|
|
|
|
var container, offset;
|
|
|
|
container = rng[start ? 'startContainer' : 'endContainer'];
|
|
|
|
offset = rng[start ? 'startOffset' : 'endOffset'];
|
|
|
|
if (container.nodeType === 1) {
|
|
|
|
container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if (!start && $_okk1ogljjgweckx.isBr(container.nextSibling)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
container = container.nextSibling;
|
|
|
|
}
|
|
|
|
while (container.parentNode !== root) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isTextBlock(editor, container)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
return container;
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
|
|
|
|
return container;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
container = container.parentNode;
|
|
|
|
}
|
|
|
|
return container;
|
|
|
|
};
|
|
|
|
var getSelectedTextBlocks = function (editor, rng, root) {
|
|
|
|
var textBlocks = [], dom = editor.dom;
|
|
|
|
var startNode = getEndPointNode(editor, rng, true, root);
|
|
|
|
var endNode = getEndPointNode(editor, rng, false, root);
|
|
|
|
var block;
|
|
|
|
var siblings = [];
|
|
|
|
for (var node = startNode; node; node = node.nextSibling) {
|
|
|
|
siblings.push(node);
|
|
|
|
if (node === endNode) {
|
|
|
|
break;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
global$5.each(siblings, function (node) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isTextBlock(editor, node)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
textBlocks.push(node);
|
|
|
|
block = null;
|
|
|
|
return;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if (dom.isBlock(node) || $_okk1ogljjgweckx.isBr(node)) {
|
|
|
|
if ($_okk1ogljjgweckx.isBr(node)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.remove(node);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
block = null;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var nextSibling = node.nextSibling;
|
|
|
|
if (global$4.isBookmarkNode(node)) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
|
2018-05-02 00:31:24 +02:00
|
|
|
block = null;
|
|
|
|
return;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (!block) {
|
|
|
|
block = dom.create('p');
|
|
|
|
node.parentNode.insertBefore(block, node);
|
|
|
|
textBlocks.push(block);
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
block.appendChild(node);
|
|
|
|
});
|
|
|
|
return textBlocks;
|
|
|
|
};
|
|
|
|
var hasCompatibleStyle = function (dom, sib, detail) {
|
|
|
|
var sibStyle = dom.getStyle(sib, 'list-style-type');
|
|
|
|
var detailStyle = detail ? detail['list-style-type'] : '';
|
|
|
|
detailStyle = detailStyle === null ? '' : detailStyle;
|
|
|
|
return sibStyle === detailStyle;
|
|
|
|
};
|
|
|
|
var applyList = function (editor, listName, detail) {
|
|
|
|
if (detail === void 0) {
|
|
|
|
detail = {};
|
|
|
|
}
|
|
|
|
var rng = editor.selection.getRng(true);
|
|
|
|
var bookmark;
|
|
|
|
var listItemName = 'LI';
|
2018-07-17 12:04:26 +02:00
|
|
|
var root = $_3xb1cggnjjgwecl3.getClosestListRootElm(editor, editor.selection.getStart(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
var dom = editor.dom;
|
|
|
|
if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
listName = listName.toUpperCase();
|
|
|
|
if (listName === 'DL') {
|
|
|
|
listItemName = 'DT';
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
bookmark = $_2nx1i4gjjjgweckt.createBookmark(rng);
|
2018-05-02 00:31:24 +02:00
|
|
|
global$5.each(getSelectedTextBlocks(editor, rng, root), function (block) {
|
|
|
|
var listBlock, sibling;
|
|
|
|
sibling = block.previousSibling;
|
2018-07-17 12:04:26 +02:00
|
|
|
if (sibling && $_okk1ogljjgweckx.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
listBlock = sibling;
|
|
|
|
block = dom.rename(block, listItemName);
|
|
|
|
sibling.appendChild(block);
|
|
|
|
} else {
|
|
|
|
listBlock = dom.create(listName);
|
|
|
|
block.parentNode.insertBefore(listBlock, block);
|
|
|
|
listBlock.appendChild(block);
|
|
|
|
block = dom.rename(block, listItemName);
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
removeStyles(dom, block, [
|
|
|
|
'margin',
|
|
|
|
'margin-right',
|
|
|
|
'margin-bottom',
|
|
|
|
'margin-left',
|
|
|
|
'margin-top',
|
|
|
|
'padding',
|
|
|
|
'padding-right',
|
|
|
|
'padding-bottom',
|
|
|
|
'padding-left',
|
|
|
|
'padding-top'
|
|
|
|
]);
|
|
|
|
updateListWithDetails(dom, listBlock, detail);
|
|
|
|
mergeWithAdjacentLists(editor.dom, listBlock);
|
|
|
|
});
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var removeList = function (editor) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(editor.selection.getRng(true));
|
|
|
|
var root = $_3xb1cggnjjgwecl3.getClosestListRootElm(editor, editor.selection.getStart(true));
|
|
|
|
var listItems = $_3xb1cggnjjgwecl3.getSelectedListItems(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
var emptyListItems = global$5.grep(listItems, function (li) {
|
|
|
|
return editor.dom.isEmpty(li);
|
|
|
|
});
|
|
|
|
listItems = global$5.grep(listItems, function (li) {
|
|
|
|
return !editor.dom.isEmpty(li);
|
|
|
|
});
|
|
|
|
global$5.each(emptyListItems, function (li) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(editor.dom, li)) {
|
|
|
|
$_6pbactghjjgweckp.outdent(editor, li);
|
2017-05-08 07:32:46 +02:00
|
|
|
return;
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
global$5.each(listItems, function (li) {
|
|
|
|
var node, rootList;
|
|
|
|
if (li.parentNode === editor.getBody()) {
|
|
|
|
return;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
for (node = li; node && node !== root; node = node.parentNode) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isListNode(node)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
rootList = node;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
$_fikiq7gpjjgwecl5.splitList(editor, rootList, li);
|
|
|
|
$_ekd4wzgmjjgwecl1.normalizeLists(editor.dom, rootList.parentNode);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var isValidLists = function (list1, list2) {
|
2018-07-17 12:04:26 +02:00
|
|
|
return list1 && list2 && $_okk1ogljjgweckx.isListNode(list1) && list1.nodeName === list2.nodeName;
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var hasSameListStyle = function (dom, list1, list2) {
|
|
|
|
var targetStyle = dom.getStyle(list1, 'list-style-type', true);
|
|
|
|
var style = dom.getStyle(list2, 'list-style-type', true);
|
|
|
|
return targetStyle === style;
|
|
|
|
};
|
|
|
|
var hasSameClasses = function (elm1, elm2) {
|
|
|
|
return elm1.className === elm2.className;
|
|
|
|
};
|
|
|
|
var shouldMerge = function (dom, list1, list2) {
|
|
|
|
return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
|
|
|
|
};
|
|
|
|
var mergeWithAdjacentLists = function (dom, listBlock) {
|
|
|
|
var sibling, node;
|
|
|
|
sibling = listBlock.nextSibling;
|
|
|
|
if (shouldMerge(dom, listBlock, sibling)) {
|
|
|
|
while (node = sibling.firstChild) {
|
|
|
|
listBlock.appendChild(node);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.remove(sibling);
|
|
|
|
}
|
|
|
|
sibling = listBlock.previousSibling;
|
|
|
|
if (shouldMerge(dom, listBlock, sibling)) {
|
|
|
|
while (node = sibling.lastChild) {
|
|
|
|
listBlock.insertBefore(node, listBlock.firstChild);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.remove(sibling);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var updateList = function (dom, list, listName, detail) {
|
|
|
|
if (list.nodeName !== listName) {
|
|
|
|
var newList = dom.rename(list, listName);
|
|
|
|
updateListWithDetails(dom, newList, detail);
|
|
|
|
} else {
|
|
|
|
updateListWithDetails(dom, list, detail);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
|
|
|
|
if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
|
|
|
|
removeList(editor);
|
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(editor.selection.getRng(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
global$5.each([parentList].concat(lists), function (elm) {
|
|
|
|
updateList(editor.dom, elm, listName, detail);
|
|
|
|
});
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var hasListStyleDetail = function (detail) {
|
|
|
|
return 'list-style-type' in detail;
|
|
|
|
};
|
|
|
|
var toggleSingleList = function (editor, parentList, listName, detail) {
|
|
|
|
if (parentList === editor.getBody()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (parentList) {
|
|
|
|
if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
|
|
|
|
removeList(editor);
|
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(editor.selection.getRng(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
updateListWithDetails(editor.dom, parentList, detail);
|
|
|
|
mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName));
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
} else {
|
|
|
|
applyList(editor, listName, detail);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var toggleList = function (editor, listName, detail) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var parentList = $_3xb1cggnjjgwecl3.getParentList(editor);
|
|
|
|
var selectedSubLists = $_3xb1cggnjjgwecl3.getSelectedSubLists(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
detail = detail ? detail : {};
|
|
|
|
if (parentList && selectedSubLists.length > 0) {
|
|
|
|
toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
|
|
|
|
} else {
|
|
|
|
toggleSingleList(editor, parentList, listName, detail);
|
|
|
|
}
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_aek3i3gejjgwecki = {
|
2018-05-02 00:31:24 +02:00
|
|
|
toggleList: toggleList,
|
|
|
|
removeList: removeList,
|
|
|
|
mergeWithAdjacentLists: mergeWithAdjacentLists
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var findNextCaretContainer = function (editor, rng, isForward, root) {
|
|
|
|
var node = rng.startContainer;
|
|
|
|
var offset = rng.startOffset;
|
|
|
|
var nonEmptyBlocks, walker;
|
|
|
|
if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
nonEmptyBlocks = editor.schema.getNonEmptyElements();
|
|
|
|
if (node.nodeType === 1) {
|
|
|
|
node = global$1.getNode(node, offset);
|
|
|
|
}
|
|
|
|
walker = new global$2(node, root);
|
|
|
|
if (isForward) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isBogusBr(editor.dom, node)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
walker.next();
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
while (node = walker[isForward ? 'next' : 'prev2']()) {
|
|
|
|
if (node.nodeName === 'LI' && !node.hasChildNodes()) {
|
|
|
|
return node;
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (nonEmptyBlocks[node.nodeName]) {
|
|
|
|
return node;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (node.nodeType === 3 && node.data.length > 0) {
|
|
|
|
return node;
|
2017-09-26 23:15:47 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var hasOnlyOneBlockChild = function (dom, elm) {
|
|
|
|
var childNodes = elm.childNodes;
|
2018-07-17 12:04:26 +02:00
|
|
|
return childNodes.length === 1 && !$_okk1ogljjgweckx.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var unwrapSingleBlockChild = function (dom, elm) {
|
|
|
|
if (hasOnlyOneBlockChild(dom, elm)) {
|
|
|
|
dom.remove(elm.firstChild, true);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var moveChildren = function (dom, fromElm, toElm) {
|
|
|
|
var node, targetElm;
|
|
|
|
targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
|
|
|
|
unwrapSingleBlockChild(dom, fromElm);
|
2018-07-17 12:04:26 +02:00
|
|
|
if (!$_okk1ogljjgweckx.isEmpty(dom, fromElm, true)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
while (node = fromElm.firstChild) {
|
|
|
|
targetElm.appendChild(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var mergeLiElements = function (dom, fromElm, toElm) {
|
|
|
|
var node, listNode;
|
|
|
|
var ul = fromElm.parentNode;
|
2018-07-17 12:04:26 +02:00
|
|
|
if (!$_okk1ogljjgweckx.isChildOfBody(dom, fromElm) || !$_okk1ogljjgweckx.isChildOfBody(dom, toElm)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
return;
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isListNode(toElm.lastChild)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
listNode = toElm.lastChild;
|
|
|
|
}
|
|
|
|
if (ul === toElm.lastChild) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isBr(ul.previousSibling)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.remove(ul.previousSibling);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
node = toElm.lastChild;
|
2018-07-17 12:04:26 +02:00
|
|
|
if (node && $_okk1ogljjgweckx.isBr(node) && fromElm.hasChildNodes()) {
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.remove(node);
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(dom, toElm, true)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.$(toElm).empty();
|
|
|
|
}
|
|
|
|
moveChildren(dom, fromElm, toElm);
|
|
|
|
if (listNode) {
|
|
|
|
toElm.appendChild(listNode);
|
|
|
|
}
|
|
|
|
dom.remove(fromElm);
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isEmpty(dom, ul) && ul !== dom.getRoot()) {
|
2018-05-02 00:31:24 +02:00
|
|
|
dom.remove(ul);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
|
|
|
|
editor.dom.$(toLi).empty();
|
|
|
|
mergeLiElements(editor.dom, fromLi, toLi);
|
|
|
|
editor.selection.setCursorLocation(toLi);
|
|
|
|
};
|
|
|
|
var mergeForward = function (editor, rng, fromLi, toLi) {
|
|
|
|
var dom = editor.dom;
|
|
|
|
if (dom.isEmpty(toLi)) {
|
|
|
|
mergeIntoEmptyLi(editor, fromLi, toLi);
|
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(rng);
|
2018-05-02 00:31:24 +02:00
|
|
|
mergeLiElements(dom, fromLi, toLi);
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
var mergeBackward = function (editor, rng, fromLi, toLi) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(rng);
|
2018-05-02 00:31:24 +02:00
|
|
|
mergeLiElements(editor.dom, fromLi, toLi);
|
2018-07-17 12:04:26 +02:00
|
|
|
var resolvedBookmark = $_2nx1i4gjjjgweckt.resolveBookmark(bookmark);
|
2018-05-02 00:31:24 +02:00
|
|
|
editor.selection.setRng(resolvedBookmark);
|
|
|
|
};
|
|
|
|
var backspaceDeleteFromListToListCaret = function (editor, isForward) {
|
|
|
|
var dom = editor.dom, selection = editor.selection;
|
|
|
|
var selectionStartElm = selection.getStart();
|
2018-07-17 12:04:26 +02:00
|
|
|
var root = $_3xb1cggnjjgwecl3.getClosestListRootElm(editor, selectionStartElm);
|
2018-05-02 00:31:24 +02:00
|
|
|
var li = dom.getParent(selection.getStart(), 'LI', root);
|
|
|
|
var ul, rng, otherLi;
|
|
|
|
if (li) {
|
|
|
|
ul = li.parentNode;
|
2018-07-17 12:04:26 +02:00
|
|
|
if (ul === editor.getBody() && $_okk1ogljjgweckx.isEmpty(dom, ul)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
return true;
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
rng = $_a9cyhvgkjjgweckv.normalizeRange(selection.getRng(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
|
|
|
|
if (otherLi && otherLi !== li) {
|
|
|
|
if (isForward) {
|
|
|
|
mergeForward(editor, rng, otherLi, li);
|
|
|
|
} else {
|
|
|
|
mergeBackward(editor, rng, li, otherLi);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else if (!otherLi) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if (!isForward && $_aek3i3gejjgwecki.removeList(editor)) {
|
2017-05-08 07:32:46 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
var removeBlock = function (dom, block, root) {
|
|
|
|
var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
|
|
|
|
dom.remove(block);
|
|
|
|
if (parentBlock && dom.isEmpty(parentBlock)) {
|
|
|
|
dom.remove(parentBlock);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var backspaceDeleteIntoListCaret = function (editor, isForward) {
|
|
|
|
var dom = editor.dom;
|
|
|
|
var selectionStartElm = editor.selection.getStart();
|
2018-07-17 12:04:26 +02:00
|
|
|
var root = $_3xb1cggnjjgwecl3.getClosestListRootElm(editor, selectionStartElm);
|
2018-05-02 00:31:24 +02:00
|
|
|
var block = dom.getParent(selectionStartElm, dom.isBlock, root);
|
|
|
|
if (block && dom.isEmpty(block)) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var rng = $_a9cyhvgkjjgweckv.normalizeRange(editor.selection.getRng(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
|
|
|
|
if (otherLi_1) {
|
2017-05-08 07:32:46 +02:00
|
|
|
editor.undoManager.transact(function () {
|
2018-05-02 00:31:24 +02:00
|
|
|
removeBlock(dom, block, root);
|
2018-07-17 12:04:26 +02:00
|
|
|
$_aek3i3gejjgwecki.mergeWithAdjacentLists(dom, otherLi_1.parentNode);
|
2018-05-02 00:31:24 +02:00
|
|
|
editor.selection.select(otherLi_1, true);
|
|
|
|
editor.selection.collapse(isForward);
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
|
|
|
return true;
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
var backspaceDeleteCaret = function (editor, isForward) {
|
|
|
|
return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
|
|
|
|
};
|
|
|
|
var backspaceDeleteRange = function (editor) {
|
|
|
|
var selectionStartElm = editor.selection.getStart();
|
2018-07-17 12:04:26 +02:00
|
|
|
var root = $_3xb1cggnjjgwecl3.getClosestListRootElm(editor, selectionStartElm);
|
2018-05-02 00:31:24 +02:00
|
|
|
var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
|
2018-07-17 12:04:26 +02:00
|
|
|
if (startListParent || $_3xb1cggnjjgwecl3.getSelectedListItems(editor).length > 0) {
|
2018-05-02 00:31:24 +02:00
|
|
|
editor.undoManager.transact(function () {
|
|
|
|
editor.execCommand('Delete');
|
2018-07-17 12:04:26 +02:00
|
|
|
$_ekd4wzgmjjgwecl1.normalizeLists(editor.dom, editor.getBody());
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
2018-05-02 00:31:24 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
var backspaceDelete = function (editor, isForward) {
|
|
|
|
return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
|
|
|
|
};
|
|
|
|
var setup = function (editor) {
|
|
|
|
editor.on('keydown', function (e) {
|
|
|
|
if (e.keyCode === global$3.BACKSPACE) {
|
|
|
|
if (backspaceDelete(editor, false)) {
|
|
|
|
e.preventDefault();
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
} else if (e.keyCode === global$3.DELETE) {
|
|
|
|
if (backspaceDelete(editor, true)) {
|
2017-05-08 07:32:46 +02:00
|
|
|
e.preventDefault();
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_brhyezgajjgweck7 = {
|
2018-05-02 00:31:24 +02:00
|
|
|
setup: setup,
|
|
|
|
backspaceDelete: backspaceDelete
|
|
|
|
};
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var get = function (editor) {
|
|
|
|
return {
|
|
|
|
backspaceDelete: function (isForward) {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_brhyezgajjgweck7.backspaceDelete(editor, isForward);
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
2017-05-08 07:32:46 +02:00
|
|
|
};
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_nb3yvg9jjgweck5 = { get: get };
|
2018-05-02 00:31:24 +02:00
|
|
|
|
|
|
|
var DOM$5 = global$6.DOM;
|
|
|
|
var mergeLists = function (from, to) {
|
|
|
|
var node;
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_okk1ogljjgweckx.isListNode(from)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
while (node = from.firstChild) {
|
|
|
|
to.appendChild(node);
|
|
|
|
}
|
|
|
|
DOM$5.remove(from);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var indent = function (li) {
|
|
|
|
var sibling, newList, listStyle;
|
|
|
|
if (li.nodeName === 'DT') {
|
|
|
|
DOM$5.rename(li, 'DD');
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
sibling = li.previousSibling;
|
2018-07-17 12:04:26 +02:00
|
|
|
if (sibling && $_okk1ogljjgweckx.isListNode(sibling)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
sibling.appendChild(li);
|
|
|
|
return true;
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
if (sibling && sibling.nodeName === 'LI' && $_okk1ogljjgweckx.isListNode(sibling.lastChild)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
sibling.lastChild.appendChild(li);
|
|
|
|
mergeLists(li.lastChild, sibling.lastChild);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
sibling = li.nextSibling;
|
2018-07-17 12:04:26 +02:00
|
|
|
if (sibling && $_okk1ogljjgweckx.isListNode(sibling)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
sibling.insertBefore(li, sibling.firstChild);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
sibling = li.previousSibling;
|
|
|
|
if (sibling && sibling.nodeName === 'LI') {
|
|
|
|
newList = DOM$5.create(li.parentNode.nodeName);
|
|
|
|
listStyle = DOM$5.getStyle(li.parentNode, 'listStyleType');
|
|
|
|
if (listStyle) {
|
|
|
|
DOM$5.setStyle(newList, 'listStyleType', listStyle);
|
|
|
|
}
|
|
|
|
sibling.appendChild(newList);
|
|
|
|
newList.appendChild(li);
|
|
|
|
mergeLists(li.lastChild, newList);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
var indentSelection = function (editor) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var listElements = $_3xb1cggnjjgwecl3.getSelectedListItems(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
if (listElements.length) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var bookmark = $_2nx1i4gjjjgweckt.createBookmark(editor.selection.getRng(true));
|
2018-05-02 00:31:24 +02:00
|
|
|
for (var i = 0; i < listElements.length; i++) {
|
|
|
|
if (!indent(listElements[i]) && i === 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
editor.selection.setRng($_2nx1i4gjjjgweckt.resolveBookmark(bookmark));
|
2018-05-02 00:31:24 +02:00
|
|
|
editor.nodeChanged();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_3rkwagtjjgweclf = { indentSelection: indentSelection };
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var queryListCommandState = function (editor, listName) {
|
|
|
|
return function () {
|
|
|
|
var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
|
|
|
|
return parentList && parentList.nodeName === listName;
|
2017-05-08 07:32:46 +02:00
|
|
|
};
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var register = function (editor) {
|
|
|
|
editor.on('BeforeExecCommand', function (e) {
|
|
|
|
var cmd = e.command.toLowerCase();
|
|
|
|
var isHandled;
|
|
|
|
if (cmd === 'indent') {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_3rkwagtjjgweclf.indentSelection(editor)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
isHandled = true;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
} else if (cmd === 'outdent') {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_6pbactghjjgweckp.outdentSelection(editor)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
isHandled = true;
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
if (isHandled) {
|
|
|
|
editor.fire('ExecCommand', { command: e.command });
|
|
|
|
e.preventDefault();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
editor.addCommand('InsertUnorderedList', function (ui, detail) {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_aek3i3gejjgwecki.toggleList(editor, 'UL', detail);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
editor.addCommand('InsertOrderedList', function (ui, detail) {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_aek3i3gejjgwecki.toggleList(editor, 'OL', detail);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
editor.addCommand('InsertDefinitionList', function (ui, detail) {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_aek3i3gejjgwecki.toggleList(editor, 'DL', detail);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
|
|
|
|
editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
|
|
|
|
editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_blnfs1gsjjgwecld = { register: register };
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var shouldIndentOnTab = function (editor) {
|
|
|
|
return editor.getParam('lists_indent_on_tab', true);
|
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_8obsbgvjjgweclk = { shouldIndentOnTab: shouldIndentOnTab };
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
var setupTabKey = function (editor) {
|
|
|
|
editor.on('keydown', function (e) {
|
|
|
|
if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) {
|
|
|
|
e.preventDefault();
|
|
|
|
if (e.shiftKey) {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_6pbactghjjgweckp.outdentSelection(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
} else {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_3rkwagtjjgweclf.indentSelection(editor);
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
2018-05-02 00:31:24 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
var setup$1 = function (editor) {
|
2018-07-17 12:04:26 +02:00
|
|
|
if ($_8obsbgvjjgweclk.shouldIndentOnTab(editor)) {
|
2018-05-02 00:31:24 +02:00
|
|
|
setupTabKey(editor);
|
|
|
|
}
|
2018-07-17 12:04:26 +02:00
|
|
|
$_brhyezgajjgweck7.setup(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_ees9z9gujjgwecli = { setup: setup$1 };
|
2018-05-02 00:31:24 +02:00
|
|
|
|
|
|
|
var findIndex = function (list, predicate) {
|
|
|
|
for (var index = 0; index < list.length; index++) {
|
|
|
|
var element = list[index];
|
|
|
|
if (predicate(element)) {
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
};
|
|
|
|
var listState = function (editor, listName) {
|
|
|
|
return function (e) {
|
|
|
|
var ctrl = e.control;
|
|
|
|
editor.on('NodeChange', function (e) {
|
2018-07-17 12:04:26 +02:00
|
|
|
var tableCellIndex = findIndex(e.parents, $_okk1ogljjgweckx.isTableCellNode);
|
2018-05-02 00:31:24 +02:00
|
|
|
var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
|
2018-07-17 12:04:26 +02:00
|
|
|
var lists = global$5.grep(parents, $_okk1ogljjgweckx.isListNode);
|
2018-05-02 00:31:24 +02:00
|
|
|
ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
|
|
|
};
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
var indentPostRender = function (editor) {
|
|
|
|
return function (e) {
|
|
|
|
var ctrl = e.control;
|
|
|
|
editor.on('nodechange', function () {
|
2018-07-17 12:04:26 +02:00
|
|
|
var listItemBlocks = $_3xb1cggnjjgwecl3.getSelectedListItems(editor);
|
|
|
|
var disable = listItemBlocks.length > 0 && $_okk1ogljjgweckx.isFirstChild(listItemBlocks[0]);
|
2018-05-02 00:31:24 +02:00
|
|
|
ctrl.disabled(disable);
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
var register$1 = function (editor) {
|
|
|
|
var hasPlugin = function (editor, plugin) {
|
|
|
|
var plugins = editor.settings.plugins ? editor.settings.plugins : '';
|
|
|
|
return global$5.inArray(plugins.split(/[ ,]/), plugin) !== -1;
|
|
|
|
};
|
|
|
|
if (!hasPlugin(editor, 'advlist')) {
|
|
|
|
editor.addButton('numlist', {
|
|
|
|
active: false,
|
|
|
|
title: 'Numbered list',
|
|
|
|
cmd: 'InsertOrderedList',
|
|
|
|
onPostRender: listState(editor, 'OL')
|
|
|
|
});
|
|
|
|
editor.addButton('bullist', {
|
|
|
|
active: false,
|
|
|
|
title: 'Bullet list',
|
|
|
|
cmd: 'InsertUnorderedList',
|
|
|
|
onPostRender: listState(editor, 'UL')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
editor.addButton('indent', {
|
|
|
|
icon: 'indent',
|
|
|
|
title: 'Increase indent',
|
|
|
|
cmd: 'Indent',
|
|
|
|
onPostRender: indentPostRender(editor)
|
2017-05-08 07:32:46 +02:00
|
|
|
});
|
2018-05-02 00:31:24 +02:00
|
|
|
};
|
2018-07-17 12:04:26 +02:00
|
|
|
var $_s7o0sgwjjgweclm = { register: register$1 };
|
2018-05-02 00:31:24 +02:00
|
|
|
|
|
|
|
global.add('lists', function (editor) {
|
2018-07-17 12:04:26 +02:00
|
|
|
$_ees9z9gujjgwecli.setup(editor);
|
|
|
|
$_s7o0sgwjjgweclm.register(editor);
|
|
|
|
$_blnfs1gsjjgwecld.register(editor);
|
|
|
|
return $_nb3yvg9jjgweck5.get(editor);
|
2018-05-02 00:31:24 +02:00
|
|
|
});
|
|
|
|
function Plugin () {
|
2017-05-08 07:32:46 +02:00
|
|
|
}
|
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
return Plugin;
|
2017-05-08 07:32:46 +02:00
|
|
|
|
2018-05-02 00:31:24 +02:00
|
|
|
}());
|
2017-04-10 01:01:43 +02:00
|
|
|
})();
|