Línea 1... |
Línea 1... |
1 |
/**
|
1 |
/**
|
2 |
* TinyMCE version 6.8.3 (2024-02-08)
|
2 |
* TinyMCE version 7.7.1 (2025-03-05)
|
3 |
*/
|
3 |
*/
|
Línea 4... |
Línea 4... |
4 |
|
4 |
|
5 |
(function () {
|
5 |
(function () {
|
Línea 267... |
Línea 267... |
267 |
const is$2 = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
|
267 |
const is$2 = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
|
268 |
const equals = (lhs, rhs, comparator = tripleEquals) => lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
|
268 |
const equals = (lhs, rhs, comparator = tripleEquals) => lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
|
269 |
const lift2 = (oa, ob, f) => oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();
|
269 |
const lift2 = (oa, ob, f) => oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();
|
Línea 270... |
Línea 270... |
270 |
|
270 |
|
271 |
const COMMENT = 8;
|
- |
|
272 |
const DOCUMENT = 9;
|
271 |
const COMMENT = 8;
|
273 |
const DOCUMENT_FRAGMENT = 11;
|
272 |
const DOCUMENT_FRAGMENT = 11;
|
274 |
const ELEMENT = 1;
|
273 |
const ELEMENT = 1;
|
Línea 275... |
Línea 274... |
275 |
const TEXT = 3;
|
274 |
const TEXT = 3;
|
Línea 380... |
Línea 379... |
380 |
const isType = t => element => type(element) === t;
|
379 |
const isType = t => element => type(element) === t;
|
381 |
const isComment = element => type(element) === COMMENT || name(element) === '#comment';
|
380 |
const isComment = element => type(element) === COMMENT || name(element) === '#comment';
|
382 |
const isHTMLElement = element => isElement$1(element) && isPrototypeOf(element.dom);
|
381 |
const isHTMLElement = element => isElement$1(element) && isPrototypeOf(element.dom);
|
383 |
const isElement$1 = isType(ELEMENT);
|
382 |
const isElement$1 = isType(ELEMENT);
|
384 |
const isText = isType(TEXT);
|
383 |
const isText = isType(TEXT);
|
385 |
const isDocument = isType(DOCUMENT);
|
- |
|
386 |
const isDocumentFragment = isType(DOCUMENT_FRAGMENT);
|
384 |
const isDocumentFragment = isType(DOCUMENT_FRAGMENT);
|
387 |
const isTag = tag => e => isElement$1(e) && name(e) === tag;
|
385 |
const isTag = tag => e => isElement$1(e) && name(e) === tag;
|
Línea 388... |
Línea -... |
388 |
|
- |
|
389 |
const owner = element => SugarElement.fromDom(element.dom.ownerDocument);
|
- |
|
390 |
const documentOrOwner = dos => isDocument(dos) ? dos : owner(dos);
|
386 |
|
391 |
const parent = element => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
|
387 |
const parent = element => Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
|
392 |
const parentElement = element => Optional.from(element.dom.parentElement).map(SugarElement.fromDom);
|
388 |
const parentElement = element => Optional.from(element.dom.parentElement).map(SugarElement.fromDom);
|
393 |
const nextSibling = element => Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
|
389 |
const nextSibling = element => Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);
|
394 |
const children = element => map(element.dom.childNodes, SugarElement.fromDom);
|
390 |
const children = element => map(element.dom.childNodes, SugarElement.fromDom);
|
Línea 398... |
Línea 394... |
398 |
};
|
394 |
};
|
399 |
const firstChild = element => child(element, 0);
|
395 |
const firstChild = element => child(element, 0);
|
400 |
const lastChild = element => child(element, element.dom.childNodes.length - 1);
|
396 |
const lastChild = element => child(element, element.dom.childNodes.length - 1);
|
Línea 401... |
Línea 397... |
401 |
|
397 |
|
402 |
const isShadowRoot = dos => isDocumentFragment(dos) && isNonNullable(dos.dom.host);
|
- |
|
403 |
const supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
|
398 |
const isShadowRoot = dos => isDocumentFragment(dos) && isNonNullable(dos.dom.host);
|
404 |
const getRootNode = supported ? e => SugarElement.fromDom(e.dom.getRootNode()) : documentOrOwner;
|
399 |
const getRootNode = e => SugarElement.fromDom(e.dom.getRootNode());
|
405 |
const getShadowRoot = e => {
|
400 |
const getShadowRoot = e => {
|
406 |
const r = getRootNode(e);
|
401 |
const r = getRootNode(e);
|
407 |
return isShadowRoot(r) ? Optional.some(r) : Optional.none();
|
402 |
return isShadowRoot(r) ? Optional.some(r) : Optional.none();
|
408 |
};
|
403 |
};
|
Línea 629... |
Línea 624... |
629 |
};
|
624 |
};
|
630 |
const shouldIndentOnTab = option('lists_indent_on_tab');
|
625 |
const shouldIndentOnTab = option('lists_indent_on_tab');
|
631 |
const getForcedRootBlock = option('forced_root_block');
|
626 |
const getForcedRootBlock = option('forced_root_block');
|
632 |
const getForcedRootBlockAttrs = option('forced_root_block_attrs');
|
627 |
const getForcedRootBlockAttrs = option('forced_root_block_attrs');
|
Línea 633... |
Línea 628... |
633 |
|
628 |
|
634 |
const createTextBlock = (editor, contentNode) => {
|
629 |
const createTextBlock = (editor, contentNode, attrs = {}) => {
|
635 |
const dom = editor.dom;
|
630 |
const dom = editor.dom;
|
636 |
const blockElements = editor.schema.getBlockElements();
|
631 |
const blockElements = editor.schema.getBlockElements();
|
637 |
const fragment = dom.createFragment();
|
632 |
const fragment = dom.createFragment();
|
638 |
const blockName = getForcedRootBlock(editor);
|
633 |
const blockName = getForcedRootBlock(editor);
|
639 |
const blockAttrs = getForcedRootBlockAttrs(editor);
|
634 |
const blockAttrs = getForcedRootBlockAttrs(editor);
|
640 |
let node;
|
635 |
let node;
|
641 |
let textBlock;
|
636 |
let textBlock;
|
642 |
let hasContentNode = false;
|
637 |
let hasContentNode = false;
|
- |
|
638 |
textBlock = dom.create(blockName, {
|
- |
|
639 |
...blockAttrs,
|
- |
|
640 |
...attrs.style ? { style: attrs.style } : {}
|
643 |
textBlock = dom.create(blockName, blockAttrs);
|
641 |
});
|
644 |
if (!isBlock(contentNode.firstChild, blockElements)) {
|
642 |
if (!isBlock(contentNode.firstChild, blockElements)) {
|
645 |
fragment.appendChild(textBlock);
|
643 |
fragment.appendChild(textBlock);
|
646 |
}
|
644 |
}
|
647 |
while (node = contentNode.firstChild) {
|
645 |
while (node = contentNode.firstChild) {
|
Línea 803... |
Línea 801... |
803 |
return parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
|
801 |
return parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
|
804 |
};
|
802 |
};
|
805 |
const isListHost = (schema, node) => !isListNode(node) && !isListItemNode(node) && exists(listNames, listName => schema.isValidChild(node.nodeName, listName));
|
803 |
const isListHost = (schema, node) => !isListNode(node) && !isListItemNode(node) && exists(listNames, listName => schema.isValidChild(node.nodeName, listName));
|
806 |
const getClosestListHost = (editor, elm) => {
|
804 |
const getClosestListHost = (editor, elm) => {
|
807 |
const parentBlocks = editor.dom.getParents(elm, editor.dom.isBlock);
|
805 |
const parentBlocks = editor.dom.getParents(elm, editor.dom.isBlock);
|
- |
|
806 |
const isNotForcedRootBlock = elm => elm.nodeName.toLowerCase() !== getForcedRootBlock(editor);
|
808 |
const parentBlock = find(parentBlocks, elm => isListHost(editor.schema, elm));
|
807 |
const parentBlock = find(parentBlocks, elm => isNotForcedRootBlock(elm) && isListHost(editor.schema, elm));
|
809 |
return parentBlock.getOr(editor.getBody());
|
808 |
return parentBlock.getOr(editor.getBody());
|
810 |
};
|
809 |
};
|
811 |
const isListInsideAnLiWithFirstAndLastNotListElement = list => parent(list).exists(parent => isListItemNode(parent.dom) && firstChild(parent).exists(firstChild => !isListNode(firstChild.dom)) && lastChild(parent).exists(lastChild => !isListNode(lastChild.dom)));
|
810 |
const isListInsideAnLiWithFirstAndLastNotListElement = list => parent(list).exists(parent => isListItemNode(parent.dom) && firstChild(parent).exists(firstChild => !isListNode(firstChild.dom)) && lastChild(parent).exists(lastChild => !isListNode(lastChild.dom)));
|
812 |
const findLastParentListNode = (editor, elm) => {
|
811 |
const findLastParentListNode = (editor, elm) => {
|
813 |
const parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListHost(editor, elm));
|
812 |
const parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListHost(editor, elm));
|
Línea 835... |
Línea 834... |
835 |
const isCustomList = list => /\btox\-/.test(list.className);
|
834 |
const isCustomList = list => /\btox\-/.test(list.className);
|
836 |
const inList = (parents, listName) => findUntil(parents, isListNode, isTableCellNode).exists(list => list.nodeName === listName && !isCustomList(list));
|
835 |
const inList = (parents, listName) => findUntil(parents, isListNode, isTableCellNode).exists(list => list.nodeName === listName && !isCustomList(list));
|
837 |
const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
|
836 |
const isWithinNonEditable = (editor, element) => element !== null && !editor.dom.isEditable(element);
|
838 |
const selectionIsWithinNonEditableList = editor => {
|
837 |
const selectionIsWithinNonEditableList = editor => {
|
839 |
const parentList = getParentList(editor);
|
838 |
const parentList = getParentList(editor);
|
840 |
return isWithinNonEditable(editor, parentList);
|
839 |
return isWithinNonEditable(editor, parentList) || !editor.selection.isEditable();
|
841 |
};
|
840 |
};
|
842 |
const isWithinNonEditableList = (editor, element) => {
|
841 |
const isWithinNonEditableList = (editor, element) => {
|
843 |
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
|
842 |
const parentList = editor.dom.getParent(element, 'ol,ul,dl');
|
844 |
return isWithinNonEditable(editor, parentList);
|
843 |
return isWithinNonEditable(editor, parentList) || !editor.selection.isEditable();
|
845 |
};
|
844 |
};
|
846 |
const setNodeChangeHandler = (editor, nodeChangeHandler) => {
|
845 |
const setNodeChangeHandler = (editor, nodeChangeHandler) => {
|
847 |
const initialNode = editor.selection.getNode();
|
846 |
const initialNode = editor.selection.getNode();
|
848 |
nodeChangeHandler({
|
847 |
nodeChangeHandler({
|
849 |
parents: editor.dom.getParents(initialNode),
|
848 |
parents: editor.dom.getParents(initialNode),
|
Línea 1130... |
Línea 1129... |
1130 |
|
1129 |
|
1131 |
const outdentedComposer = (editor, entries) => {
|
1130 |
const outdentedComposer = (editor, entries) => {
|
1132 |
const normalizedEntries = normalizeEntries(entries);
|
1131 |
const normalizedEntries = normalizeEntries(entries);
|
1133 |
return map(normalizedEntries, entry => {
|
1132 |
return map(normalizedEntries, entry => {
|
- |
|
1133 |
const content = !isEntryComment(entry) ? fromElements(entry.content) : fromElements([SugarElement.fromHtml(`<!--${ entry.content }-->`)]);
|
1134 |
const content = !isEntryComment(entry) ? fromElements(entry.content) : fromElements([SugarElement.fromHtml(`<!--${ entry.content }-->`)]);
|
1134 |
const listItemAttrs = isEntryList(entry) ? entry.itemAttributes : {};
|
1135 |
return SugarElement.fromDom(createTextBlock(editor, content.dom));
|
1135 |
return SugarElement.fromDom(createTextBlock(editor, content.dom, listItemAttrs));
|
1136 |
});
|
1136 |
});
|
1137 |
};
|
1137 |
};
|
1138 |
const indentedComposer = (editor, entries) => {
|
1138 |
const indentedComposer = (editor, entries) => {
|
1139 |
const normalizedEntries = normalizeEntries(entries);
|
1139 |
const normalizedEntries = normalizeEntries(entries);
|
Línea 1790... |
Línea 1790... |
1790 |
const backspaceDeleteIntoListCaret = (editor, isForward) => {
|
1790 |
const backspaceDeleteIntoListCaret = (editor, isForward) => {
|
1791 |
const dom = editor.dom;
|
1791 |
const dom = editor.dom;
|
1792 |
const selectionStartElm = editor.selection.getStart();
|
1792 |
const selectionStartElm = editor.selection.getStart();
|
1793 |
const root = getClosestEditingHost(editor, selectionStartElm);
|
1793 |
const root = getClosestEditingHost(editor, selectionStartElm);
|
1794 |
const block = dom.getParent(selectionStartElm, dom.isBlock, root);
|
1794 |
const block = dom.getParent(selectionStartElm, dom.isBlock, root);
|
1795 |
if (block && dom.isEmpty(block)) {
|
1795 |
if (block && dom.isEmpty(block, undefined, { checkRootAsContent: true })) {
|
1796 |
const rng = normalizeRange(editor.selection.getRng());
|
1796 |
const rng = normalizeRange(editor.selection.getRng());
|
1797 |
const otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
|
1797 |
const otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
|
1798 |
if (otherLi) {
|
1798 |
if (otherLi) {
|
1799 |
const findValidElement = element => contains$1([
|
1799 |
const findValidElement = element => contains$1([
|
1800 |
'td',
|
1800 |
'td',
|
Línea 1829... |
Línea 1829... |
1829 |
return startListParent || getSelectedListItems(editor).length > 0;
|
1829 |
return startListParent || getSelectedListItems(editor).length > 0;
|
1830 |
};
|
1830 |
};
|
1831 |
const backspaceDeleteRange = editor => {
|
1831 |
const backspaceDeleteRange = editor => {
|
1832 |
if (hasListSelection(editor)) {
|
1832 |
if (hasListSelection(editor)) {
|
1833 |
editor.undoManager.transact(() => {
|
1833 |
editor.undoManager.transact(() => {
|
- |
|
1834 |
let shouldFireInput = true;
|
- |
|
1835 |
const inputHandler = () => shouldFireInput = false;
|
- |
|
1836 |
editor.on('input', inputHandler);
|
1834 |
editor.execCommand('Delete');
|
1837 |
editor.execCommand('Delete');
|
- |
|
1838 |
editor.off('input', inputHandler);
|
- |
|
1839 |
if (shouldFireInput) {
|
- |
|
1840 |
editor.dispatch('input');
|
- |
|
1841 |
}
|
1835 |
normalizeLists(editor.dom, editor.getBody());
|
1842 |
normalizeLists(editor.dom, editor.getBody());
|
1836 |
});
|
1843 |
});
|
1837 |
return true;
|
1844 |
return true;
|
1838 |
}
|
1845 |
}
|
1839 |
return false;
|
1846 |
return false;
|