tinymce-rails 7.1.2.1 → 7.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/source/tinymce/tinymce.js +268 -92
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/models/dom/model.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
- data/vendor/assets/javascripts/tinymce/tinymce.d.ts +4 -0
- data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* TinyMCE version 7.1
|
2
|
+
* TinyMCE version 7.2.1 (2024-07-03)
|
3
3
|
*/
|
4
4
|
|
5
5
|
(function () {
|
@@ -1392,7 +1392,6 @@
|
|
1392
1392
|
const firstChild = element => child$1(element, 0);
|
1393
1393
|
const lastChild = element => child$1(element, element.dom.childNodes.length - 1);
|
1394
1394
|
const childNodesCount = element => element.dom.childNodes.length;
|
1395
|
-
const hasChildNodes = element => element.dom.hasChildNodes();
|
1396
1395
|
|
1397
1396
|
const getHead = doc => {
|
1398
1397
|
const b = doc.dom.head;
|
@@ -3016,7 +3015,7 @@
|
|
3016
3015
|
addAttrs('a', 'download');
|
3017
3016
|
addAttrs('link script img', 'crossorigin');
|
3018
3017
|
addAttrs('img', 'loading');
|
3019
|
-
addAttrs('iframe', 'sandbox seamless allow allowfullscreen loading');
|
3018
|
+
addAttrs('iframe', 'sandbox seamless allow allowfullscreen loading referrerpolicy');
|
3020
3019
|
}
|
3021
3020
|
if (type !== 'html4') {
|
3022
3021
|
each$e([
|
@@ -6530,7 +6529,7 @@
|
|
6530
6529
|
forward
|
6531
6530
|
};
|
6532
6531
|
};
|
6533
|
-
const getBookmark$
|
6532
|
+
const getBookmark$3 = (selection, type, normalized = false) => {
|
6534
6533
|
if (type === 2) {
|
6535
6534
|
return getOffsetBookmark(trim$2, normalized, selection);
|
6536
6535
|
} else if (type === 3) {
|
@@ -8608,8 +8607,8 @@
|
|
8608
8607
|
return Optional.none();
|
8609
8608
|
};
|
8610
8609
|
|
8611
|
-
const getBookmark$
|
8612
|
-
return getBookmark$
|
8610
|
+
const getBookmark$2 = (selection, type, normalized) => {
|
8611
|
+
return getBookmark$3(selection, type, normalized);
|
8613
8612
|
};
|
8614
8613
|
const moveToBookmark = (selection, bookmark) => {
|
8615
8614
|
resolve(selection, bookmark).each(({range, forward}) => {
|
@@ -9445,7 +9444,7 @@
|
|
9445
9444
|
|
9446
9445
|
const BookmarkManager = selection => {
|
9447
9446
|
return {
|
9448
|
-
getBookmark: curry(getBookmark$
|
9447
|
+
getBookmark: curry(getBookmark$2, selection),
|
9449
9448
|
moveToBookmark: curry(moveToBookmark, selection)
|
9450
9449
|
};
|
9451
9450
|
};
|
@@ -10723,7 +10722,7 @@
|
|
10723
10722
|
const rng = !selection || selection.rangeCount === 0 ? Optional.none() : Optional.from(selection.getRangeAt(0));
|
10724
10723
|
return rng.map(nativeRangeToSelectionRange);
|
10725
10724
|
};
|
10726
|
-
const getBookmark = root => {
|
10725
|
+
const getBookmark$1 = root => {
|
10727
10726
|
const win = defaultView(root);
|
10728
10727
|
return readRange(win.dom).filter(isRngInRoot(root));
|
10729
10728
|
};
|
@@ -10739,7 +10738,7 @@
|
|
10739
10738
|
}
|
10740
10739
|
};
|
10741
10740
|
const store = editor => {
|
10742
|
-
const newBookmark = shouldStore(editor) ? getBookmark(SugarElement.fromDom(editor.getBody())) : Optional.none();
|
10741
|
+
const newBookmark = shouldStore(editor) ? getBookmark$1(SugarElement.fromDom(editor.getBody())) : Optional.none();
|
10743
10742
|
editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;
|
10744
10743
|
};
|
10745
10744
|
const getRng = editor => {
|
@@ -10970,15 +10969,21 @@
|
|
10970
10969
|
const body = editor.getBody();
|
10971
10970
|
let rng = selection.getRng();
|
10972
10971
|
editor.quirks.refreshContentEditable();
|
10973
|
-
|
10972
|
+
const restoreBookmark = editor => {
|
10974
10973
|
getRng(editor).each(bookmarkRng => {
|
10975
10974
|
editor.selection.setRng(bookmarkRng);
|
10976
10975
|
rng = bookmarkRng;
|
10977
10976
|
});
|
10977
|
+
};
|
10978
|
+
if (!hasFocus(editor) && editor.hasEditableRoot()) {
|
10979
|
+
restoreBookmark(editor);
|
10978
10980
|
}
|
10979
10981
|
const contentEditableHost = getContentEditableHost(editor, selection.getNode());
|
10980
10982
|
if (contentEditableHost && editor.dom.isChildOf(contentEditableHost, body)) {
|
10981
10983
|
focusBody(contentEditableHost);
|
10984
|
+
if (!editor.hasEditableRoot()) {
|
10985
|
+
restoreBookmark(editor);
|
10986
|
+
}
|
10982
10987
|
normalizeSelection(editor, rng);
|
10983
10988
|
activateEditor(editor);
|
10984
10989
|
return;
|
@@ -11738,7 +11743,6 @@
|
|
11738
11743
|
'background',
|
11739
11744
|
'background-attachment',
|
11740
11745
|
'background-clip',
|
11741
|
-
'background-color',
|
11742
11746
|
'background-image',
|
11743
11747
|
'background-origin',
|
11744
11748
|
'background-position',
|
@@ -11774,14 +11778,24 @@
|
|
11774
11778
|
nonInheritableStyles.add(style);
|
11775
11779
|
});
|
11776
11780
|
})();
|
11781
|
+
const conditionalNonInheritableStyles = new Set();
|
11782
|
+
(() => {
|
11783
|
+
const conditionalNonInheritableStylesArr = ['background-color'];
|
11784
|
+
each$e(conditionalNonInheritableStylesArr, style => {
|
11785
|
+
conditionalNonInheritableStyles.add(style);
|
11786
|
+
});
|
11787
|
+
})();
|
11777
11788
|
const shorthandStyleProps = [
|
11778
11789
|
'font',
|
11779
11790
|
'text-decoration',
|
11780
11791
|
'text-emphasis'
|
11781
11792
|
];
|
11782
|
-
const
|
11793
|
+
const getStyles$1 = (dom, node) => dom.parseStyle(dom.getAttrib(node, 'style'));
|
11794
|
+
const getStyleProps = (dom, node) => keys(getStyles$1(dom, node));
|
11783
11795
|
const isNonInheritableStyle = style => nonInheritableStyles.has(style);
|
11784
|
-
const
|
11796
|
+
const isConditionalNonInheritableStyle = style => conditionalNonInheritableStyles.has(style);
|
11797
|
+
const hasNonInheritableStyles = (dom, node) => exists(getStyleProps(dom, node), style => isNonInheritableStyle(style));
|
11798
|
+
const hasConditionalNonInheritableStyles = (dom, node) => hasNonInheritableStyles(dom, node) && exists(getStyleProps(dom, node), style => isConditionalNonInheritableStyle(style));
|
11785
11799
|
const getLonghandStyleProps = styles => filter$5(styles, style => exists(shorthandStyleProps, prop => startsWith(style, prop)));
|
11786
11800
|
const hasStyleConflict = (dom, node, parentNode) => {
|
11787
11801
|
const nodeStyleProps = getStyleProps(dom, node);
|
@@ -12508,7 +12522,7 @@
|
|
12508
12522
|
const rootElm = SugarElement.fromDom(editor.getBody());
|
12509
12523
|
return getParentCaption(rootElm, startElm).fold(() => deleteCaretCells(editor, forward, rootElm, startElm).orThunk(() => someIf(isBeforeOrAfterTable(editor, forward), noop)), fromCaption => deleteCaretCaption(editor, forward, rootElm, fromCaption));
|
12510
12524
|
};
|
12511
|
-
const backspaceDelete$
|
12525
|
+
const backspaceDelete$b = (editor, forward) => {
|
12512
12526
|
const startElm = SugarElement.fromDom(editor.selection.getStart(true));
|
12513
12527
|
const cells = getCellsFromEditor(editor);
|
12514
12528
|
return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret$3(editor, forward, startElm) : deleteRange$3(editor, startElm, cells);
|
@@ -13062,18 +13076,20 @@
|
|
13062
13076
|
if (merge) {
|
13063
13077
|
const root = editor.getBody();
|
13064
13078
|
const elementUtils = ElementUtils(editor);
|
13065
|
-
|
13066
|
-
|
13067
|
-
|
13068
|
-
|
13069
|
-
|
13070
|
-
|
13071
|
-
|
13072
|
-
|
13073
|
-
|
13074
|
-
|
13075
|
-
|
13076
|
-
|
13079
|
+
const fragmentSelector = '*[data-mce-fragment]';
|
13080
|
+
const fragments = dom.select(fragmentSelector);
|
13081
|
+
Tools.each(fragments, node => {
|
13082
|
+
const isInline = currentNode => isNonNullable(textInlineElements[currentNode.nodeName.toLowerCase()]);
|
13083
|
+
const hasOneChild = currentNode => currentNode.childNodes.length === 1;
|
13084
|
+
const hasNoNonInheritableStyles = currentNode => !(hasNonInheritableStyles(dom, currentNode) || hasConditionalNonInheritableStyles(dom, currentNode));
|
13085
|
+
if (hasNoNonInheritableStyles(node) && isInline(node) && hasOneChild(node)) {
|
13086
|
+
const styles = getStyleProps(dom, node);
|
13087
|
+
const isOverridden = (oldStyles, newStyles) => forall(oldStyles, style => contains$2(newStyles, style));
|
13088
|
+
const overriddenByAllChildren = childNode => hasOneChild(node) && dom.is(childNode, fragmentSelector) && isInline(childNode) && (childNode.nodeName === node.nodeName && isOverridden(styles, getStyleProps(dom, childNode)) || overriddenByAllChildren(childNode.children[0]));
|
13089
|
+
const identicalToParent = parentNode => isNonNullable(parentNode) && parentNode !== root && (elementUtils.compare(node, parentNode) || identicalToParent(parentNode.parentElement));
|
13090
|
+
const conflictWithInsertedParent = parentNode => isNonNullable(parentNode) && parentNode !== root && dom.is(parentNode, fragmentSelector) && (hasStyleConflict(dom, node, parentNode) || conflictWithInsertedParent(parentNode.parentElement));
|
13091
|
+
if (overriddenByAllChildren(node.children[0]) || identicalToParent(node.parentElement) && !conflictWithInsertedParent(node.parentElement)) {
|
13092
|
+
dom.remove(node, true);
|
13077
13093
|
}
|
13078
13094
|
}
|
13079
13095
|
});
|
@@ -17252,7 +17268,7 @@
|
|
17252
17268
|
const makeMap = Tools.makeMap, extend$1 = Tools.extend;
|
17253
17269
|
const transferChildren = (parent, nativeParent, specialElements, nsSanitizer) => {
|
17254
17270
|
const parentName = parent.name;
|
17255
|
-
const isSpecial = parentName in specialElements && parentName !== 'title' && parentName !== 'textarea';
|
17271
|
+
const isSpecial = parentName in specialElements && parentName !== 'title' && parentName !== 'textarea' && parentName !== 'noscript';
|
17256
17272
|
const childNodes = nativeParent.childNodes;
|
17257
17273
|
for (let ni = 0, nl = childNodes.length; ni < nl; ni++) {
|
17258
17274
|
const nativeChild = childNodes[ni];
|
@@ -19007,16 +19023,6 @@
|
|
19007
19023
|
}
|
19008
19024
|
}
|
19009
19025
|
});
|
19010
|
-
htmlParser.addNodeFilter('noscript', nodes => {
|
19011
|
-
var _a;
|
19012
|
-
let i = nodes.length;
|
19013
|
-
while (i--) {
|
19014
|
-
const node = nodes[i].firstChild;
|
19015
|
-
if (node) {
|
19016
|
-
node.value = Entities.decode((_a = node.value) !== null && _a !== void 0 ? _a : '');
|
19017
|
-
}
|
19018
|
-
}
|
19019
|
-
});
|
19020
19026
|
htmlParser.addNodeFilter('script,style', (nodes, name) => {
|
19021
19027
|
var _a;
|
19022
19028
|
const trim = value => {
|
@@ -21298,12 +21304,26 @@
|
|
21298
21304
|
};
|
21299
21305
|
const read$1 = (schema, rootNode, forward, rng) => rng.collapsed ? readFromRange(schema, rootNode, forward, rng) : Optional.none();
|
21300
21306
|
|
21301
|
-
const
|
21302
|
-
const
|
21303
|
-
|
21307
|
+
const getChildrenFromNestedUntilBlockBoundary = (block, schema, forwardDelete) => {
|
21308
|
+
const allSiblingsInDirection = forwardDelete ? prevSiblings(block).reverse() : nextSiblings(block);
|
21309
|
+
const siblingsToMergeIn = findIndex$2(allSiblingsInDirection, element => schema.isBlock(name(element))).fold(constant(allSiblingsInDirection), index => allSiblingsInDirection.slice(0, index));
|
21310
|
+
if (forwardDelete) {
|
21311
|
+
return siblingsToMergeIn.reverse();
|
21312
|
+
}
|
21313
|
+
return siblingsToMergeIn;
|
21314
|
+
};
|
21315
|
+
const getChildrenUntilBlockBoundary = (toBlock, fromBlock, schema, forwardDelete, extractsiblingsIfNested) => {
|
21316
|
+
if (extractsiblingsIfNested && contains(toBlock, fromBlock)) {
|
21317
|
+
return getChildrenFromNestedUntilBlockBoundary(fromBlock, schema, forwardDelete);
|
21318
|
+
} else if (extractsiblingsIfNested && contains(fromBlock, toBlock)) {
|
21319
|
+
return getChildrenFromNestedUntilBlockBoundary(toBlock, schema, forwardDelete);
|
21320
|
+
} else {
|
21321
|
+
const children = children$1(fromBlock);
|
21322
|
+
return findIndex$2(children, el => schema.isBlock(name(el))).fold(constant(children), index => children.slice(0, index));
|
21323
|
+
}
|
21304
21324
|
};
|
21305
|
-
const extractChildren = (
|
21306
|
-
const children = getChildrenUntilBlockBoundary(
|
21325
|
+
const extractChildren = (toBlock, fromBlock, schema, forwardDelete, extractsiblingsIfNested) => {
|
21326
|
+
const children = getChildrenUntilBlockBoundary(toBlock, fromBlock, schema, forwardDelete, extractsiblingsIfNested);
|
21307
21327
|
each$e(children, remove$4);
|
21308
21328
|
return children;
|
21309
21329
|
};
|
@@ -21312,7 +21332,7 @@
|
|
21312
21332
|
return find$2(parents.reverse(), element => isEmpty$2(schema, element)).each(remove$4);
|
21313
21333
|
};
|
21314
21334
|
const isEmptyBefore = (schema, el) => filter$5(prevSiblings(el), el => !isEmpty$2(schema, el)).length === 0;
|
21315
|
-
const nestedBlockMerge = (rootNode, fromBlock, toBlock, schema, insertionPoint) => {
|
21335
|
+
const nestedBlockMerge = (rootNode, fromBlock, toBlock, schema, forward, insertionPoint) => {
|
21316
21336
|
if (isEmpty$2(schema, toBlock)) {
|
21317
21337
|
fillWithPaddingBr(toBlock);
|
21318
21338
|
return firstPositionIn(toBlock.dom);
|
@@ -21321,14 +21341,14 @@
|
|
21321
21341
|
before$3(insertionPoint, SugarElement.fromTag('br'));
|
21322
21342
|
}
|
21323
21343
|
const position = prevPosition(toBlock.dom, CaretPosition.before(insertionPoint.dom));
|
21324
|
-
each$e(extractChildren(fromBlock, schema), child => {
|
21344
|
+
each$e(extractChildren(toBlock, fromBlock, schema, forward, false), child => {
|
21325
21345
|
before$3(insertionPoint, child);
|
21326
21346
|
});
|
21327
21347
|
removeEmptyRoot(schema, rootNode, fromBlock);
|
21328
21348
|
return position;
|
21329
21349
|
};
|
21330
21350
|
const isInline = (schema, node) => schema.isInline(name(node));
|
21331
|
-
const sidelongBlockMerge = (rootNode, fromBlock, toBlock, schema) => {
|
21351
|
+
const sidelongBlockMerge = (rootNode, fromBlock, toBlock, schema, forwardDelete) => {
|
21332
21352
|
if (isEmpty$2(schema, toBlock)) {
|
21333
21353
|
if (isEmpty$2(schema, fromBlock)) {
|
21334
21354
|
const getInlineToBlockDescendants = el => {
|
@@ -21346,8 +21366,12 @@
|
|
21346
21366
|
return firstPositionIn(fromBlock.dom);
|
21347
21367
|
}
|
21348
21368
|
const position = lastPositionIn(toBlock.dom);
|
21349
|
-
each$e(extractChildren(fromBlock, schema), child => {
|
21350
|
-
|
21369
|
+
each$e(extractChildren(toBlock, fromBlock, schema, forwardDelete, true), child => {
|
21370
|
+
if (forwardDelete && contains(fromBlock, toBlock)) {
|
21371
|
+
prepend(toBlock, child);
|
21372
|
+
} else {
|
21373
|
+
append$1(toBlock, child);
|
21374
|
+
}
|
21351
21375
|
});
|
21352
21376
|
removeEmptyRoot(schema, rootNode, fromBlock);
|
21353
21377
|
return position;
|
@@ -21360,17 +21384,26 @@
|
|
21360
21384
|
const trimBr = (first, block) => {
|
21361
21385
|
positionIn(first, block.dom).bind(position => Optional.from(position.getNode())).map(SugarElement.fromDom).filter(isBr$5).each(remove$4);
|
21362
21386
|
};
|
21363
|
-
const mergeBlockInto = (rootNode, fromBlock, toBlock, schema) => {
|
21387
|
+
const mergeBlockInto = (rootNode, fromBlock, toBlock, schema, forward) => {
|
21364
21388
|
trimBr(true, fromBlock);
|
21365
21389
|
trimBr(false, toBlock);
|
21366
|
-
return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock, schema), curry(nestedBlockMerge, rootNode, fromBlock, toBlock, schema));
|
21390
|
+
return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock, schema, forward), curry(nestedBlockMerge, rootNode, fromBlock, toBlock, schema, forward));
|
21391
|
+
};
|
21392
|
+
const mergeBlocks = (rootNode, forward, block1, block2, schema, mergeNotDelete = false) => {
|
21393
|
+
if (mergeNotDelete) {
|
21394
|
+
if (contains(block2, block1)) {
|
21395
|
+
return mergeBlockInto(rootNode, block2, block1, schema, !forward);
|
21396
|
+
} else if (contains(block1, block2)) {
|
21397
|
+
return mergeBlockInto(rootNode, block1, block2, schema, forward);
|
21398
|
+
}
|
21399
|
+
}
|
21400
|
+
return forward ? mergeBlockInto(rootNode, block2, block1, schema, forward) : mergeBlockInto(rootNode, block1, block2, schema, !forward);
|
21367
21401
|
};
|
21368
|
-
const mergeBlocks = (rootNode, forward, block1, block2, schema) => forward ? mergeBlockInto(rootNode, block2, block1, schema) : mergeBlockInto(rootNode, block1, block2, schema);
|
21369
21402
|
|
21370
|
-
const backspaceDelete$
|
21403
|
+
const backspaceDelete$a = (editor, forward) => {
|
21371
21404
|
const rootNode = SugarElement.fromDom(editor.getBody());
|
21372
21405
|
const position = read$1(editor.schema, rootNode.dom, forward, editor.selection.getRng()).map(blockBoundary => () => {
|
21373
|
-
mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block, editor.schema).each(pos => {
|
21406
|
+
mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block, editor.schema, true).each(pos => {
|
21374
21407
|
editor.selection.setRng(pos.toRange());
|
21375
21408
|
});
|
21376
21409
|
});
|
@@ -21414,7 +21447,7 @@
|
|
21414
21447
|
const rng = editor.selection.getRng();
|
21415
21448
|
return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection, editor.schema);
|
21416
21449
|
};
|
21417
|
-
const backspaceDelete$
|
21450
|
+
const backspaceDelete$9 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
|
21418
21451
|
|
21419
21452
|
const showCaret = (direction, editor, node, before, scrollIntoView) => Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));
|
21420
21453
|
const getNodeRange = node => {
|
@@ -21497,7 +21530,7 @@
|
|
21497
21530
|
}
|
21498
21531
|
return Optional.none();
|
21499
21532
|
};
|
21500
|
-
const backspaceDelete$
|
21533
|
+
const backspaceDelete$8 = (editor, forward) => deleteBoundaryText(editor, forward);
|
21501
21534
|
|
21502
21535
|
const getEdgeCefPosition = (editor, atStart) => {
|
21503
21536
|
const root = editor.getBody();
|
@@ -21636,7 +21669,7 @@
|
|
21636
21669
|
}
|
21637
21670
|
return true;
|
21638
21671
|
};
|
21639
|
-
const backspaceDelete$
|
21672
|
+
const backspaceDelete$7 = (editor, forward) => {
|
21640
21673
|
if (editor.selection.isCollapsed()) {
|
21641
21674
|
return backspaceDeleteCaret(editor, forward);
|
21642
21675
|
} else {
|
@@ -21644,6 +21677,98 @@
|
|
21644
21677
|
}
|
21645
21678
|
};
|
21646
21679
|
|
21680
|
+
const isTextEndpoint = endpoint => endpoint.hasOwnProperty('text');
|
21681
|
+
const isElementEndpoint = endpoint => endpoint.hasOwnProperty('marker');
|
21682
|
+
const getBookmark = (range, createMarker) => {
|
21683
|
+
const getEndpoint = (container, offset) => {
|
21684
|
+
if (isText$b(container)) {
|
21685
|
+
return {
|
21686
|
+
text: container,
|
21687
|
+
offset
|
21688
|
+
};
|
21689
|
+
} else {
|
21690
|
+
const marker = createMarker();
|
21691
|
+
const children = container.childNodes;
|
21692
|
+
if (offset < children.length) {
|
21693
|
+
container.insertBefore(marker, children[offset]);
|
21694
|
+
return {
|
21695
|
+
marker,
|
21696
|
+
before: true
|
21697
|
+
};
|
21698
|
+
} else {
|
21699
|
+
container.appendChild(marker);
|
21700
|
+
return {
|
21701
|
+
marker,
|
21702
|
+
before: false
|
21703
|
+
};
|
21704
|
+
}
|
21705
|
+
}
|
21706
|
+
};
|
21707
|
+
const end = getEndpoint(range.endContainer, range.endOffset);
|
21708
|
+
const start = getEndpoint(range.startContainer, range.startOffset);
|
21709
|
+
return {
|
21710
|
+
start,
|
21711
|
+
end
|
21712
|
+
};
|
21713
|
+
};
|
21714
|
+
const resolveBookmark = bm => {
|
21715
|
+
var _a, _b;
|
21716
|
+
const {start, end} = bm;
|
21717
|
+
const rng = new window.Range();
|
21718
|
+
if (isTextEndpoint(start)) {
|
21719
|
+
rng.setStart(start.text, start.offset);
|
21720
|
+
} else {
|
21721
|
+
if (isElementEndpoint(start)) {
|
21722
|
+
if (start.before) {
|
21723
|
+
rng.setStartBefore(start.marker);
|
21724
|
+
} else {
|
21725
|
+
rng.setStartAfter(start.marker);
|
21726
|
+
}
|
21727
|
+
(_a = start.marker.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(start.marker);
|
21728
|
+
}
|
21729
|
+
}
|
21730
|
+
if (isTextEndpoint(end)) {
|
21731
|
+
rng.setEnd(end.text, end.offset);
|
21732
|
+
} else {
|
21733
|
+
if (isElementEndpoint(end)) {
|
21734
|
+
if (end.before) {
|
21735
|
+
rng.setEndBefore(end.marker);
|
21736
|
+
} else {
|
21737
|
+
rng.setEndAfter(end.marker);
|
21738
|
+
}
|
21739
|
+
(_b = end.marker.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(end.marker);
|
21740
|
+
}
|
21741
|
+
}
|
21742
|
+
return rng;
|
21743
|
+
};
|
21744
|
+
|
21745
|
+
const backspaceDelete$6 = (editor, forward) => {
|
21746
|
+
var _a;
|
21747
|
+
const dom = editor.dom;
|
21748
|
+
const startBlock = dom.getParent(editor.selection.getStart(), dom.isBlock);
|
21749
|
+
const endBlock = dom.getParent(editor.selection.getEnd(), dom.isBlock);
|
21750
|
+
const body = editor.getBody();
|
21751
|
+
const startBlockName = (_a = startBlock === null || startBlock === void 0 ? void 0 : startBlock.nodeName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
21752
|
+
if (startBlockName === 'div' && startBlock && endBlock && startBlock === body.firstChild && endBlock === body.lastChild && !dom.isEmpty(body)) {
|
21753
|
+
const wrapper = startBlock.cloneNode(false);
|
21754
|
+
const deleteAction = () => {
|
21755
|
+
if (forward) {
|
21756
|
+
execNativeForwardDeleteCommand(editor);
|
21757
|
+
} else {
|
21758
|
+
execNativeDeleteCommand(editor);
|
21759
|
+
}
|
21760
|
+
if (body.firstChild !== startBlock) {
|
21761
|
+
const bookmark = getBookmark(editor.selection.getRng(), () => document.createElement('span'));
|
21762
|
+
Array.from(body.childNodes).forEach(node => wrapper.appendChild(node));
|
21763
|
+
body.appendChild(wrapper);
|
21764
|
+
editor.selection.setRng(resolveBookmark(bookmark));
|
21765
|
+
}
|
21766
|
+
};
|
21767
|
+
return Optional.some(deleteAction);
|
21768
|
+
}
|
21769
|
+
return Optional.none();
|
21770
|
+
};
|
21771
|
+
|
21647
21772
|
const deleteCaret$2 = (editor, forward) => {
|
21648
21773
|
const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
|
21649
21774
|
return fromPosition(forward, editor.getBody(), fromPos).filter(pos => forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos)).bind(pos => getChildNodeAtRelativeOffset(forward ? 0 : -1, pos)).map(elm => () => editor.selection.select(elm));
|
@@ -22544,15 +22669,16 @@
|
|
22544
22669
|
|
22545
22670
|
const findAction = (editor, caret, forward) => findMap([
|
22546
22671
|
backspaceDelete$1,
|
22547
|
-
backspaceDelete$6,
|
22548
22672
|
backspaceDelete$7,
|
22673
|
+
backspaceDelete$8,
|
22549
22674
|
(editor, forward) => backspaceDelete$4(editor, caret, forward),
|
22550
|
-
backspaceDelete$9,
|
22551
22675
|
backspaceDelete$a,
|
22676
|
+
backspaceDelete$b,
|
22552
22677
|
backspaceDelete$5,
|
22553
22678
|
backspaceDelete$2,
|
22554
|
-
backspaceDelete$
|
22555
|
-
backspaceDelete$3
|
22679
|
+
backspaceDelete$9,
|
22680
|
+
backspaceDelete$3,
|
22681
|
+
backspaceDelete$6
|
22556
22682
|
], item => item(editor, forward)).filter(_ => editor.selection.isEditable());
|
22557
22683
|
const deleteCommand = (editor, caret) => {
|
22558
22684
|
const result = findAction(editor, caret, false);
|
@@ -22680,7 +22806,7 @@
|
|
22680
22806
|
const rootNode = editor.getBody();
|
22681
22807
|
let rootBlockNode;
|
22682
22808
|
let tempNode;
|
22683
|
-
let
|
22809
|
+
let bm = null;
|
22684
22810
|
const forcedRootBlock = getForcedRootBlock(editor);
|
22685
22811
|
if (!startNode || !isElement$6(startNode)) {
|
22686
22812
|
return;
|
@@ -22689,9 +22815,14 @@
|
|
22689
22815
|
if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, startNode)) {
|
22690
22816
|
return;
|
22691
22817
|
}
|
22692
|
-
|
22693
|
-
|
22694
|
-
|
22818
|
+
if (rootNode.firstChild === rootNode.lastChild && isBr$6(rootNode.firstChild)) {
|
22819
|
+
rootBlockNode = createRootBlock(editor);
|
22820
|
+
rootBlockNode.appendChild(createPaddingBr().dom);
|
22821
|
+
rootNode.replaceChild(rootBlockNode, rootNode.firstChild);
|
22822
|
+
editor.selection.setCursorLocation(rootBlockNode, 0);
|
22823
|
+
editor.nodeChanged();
|
22824
|
+
return;
|
22825
|
+
}
|
22695
22826
|
let node = rootNode.firstChild;
|
22696
22827
|
while (node) {
|
22697
22828
|
if (isElement$6(node)) {
|
@@ -22705,9 +22836,15 @@
|
|
22705
22836
|
continue;
|
22706
22837
|
}
|
22707
22838
|
if (!rootBlockNode) {
|
22839
|
+
if (!bm && editor.hasFocus()) {
|
22840
|
+
bm = getBookmark(editor.selection.getRng(), () => document.createElement('span'));
|
22841
|
+
}
|
22842
|
+
if (!node.parentNode) {
|
22843
|
+
node = null;
|
22844
|
+
break;
|
22845
|
+
}
|
22708
22846
|
rootBlockNode = createRootBlock(editor);
|
22709
22847
|
rootNode.insertBefore(rootBlockNode, node);
|
22710
|
-
wrapped = true;
|
22711
22848
|
}
|
22712
22849
|
tempNode = node;
|
22713
22850
|
node = node.nextSibling;
|
@@ -22717,10 +22854,8 @@
|
|
22717
22854
|
node = node.nextSibling;
|
22718
22855
|
}
|
22719
22856
|
}
|
22720
|
-
if (
|
22721
|
-
|
22722
|
-
rng.setEnd(endContainer, endOffset);
|
22723
|
-
selection.setRng(rng);
|
22857
|
+
if (bm) {
|
22858
|
+
editor.selection.setRng(resolveBookmark(bm));
|
22724
22859
|
editor.nodeChanged();
|
22725
22860
|
}
|
22726
22861
|
};
|
@@ -22735,7 +22870,7 @@
|
|
22735
22870
|
return rng;
|
22736
22871
|
};
|
22737
22872
|
const setup$o = editor => {
|
22738
|
-
editor.on('NodeChange',
|
22873
|
+
editor.on('NodeChange', () => addRootBlocks(editor));
|
22739
22874
|
};
|
22740
22875
|
|
22741
22876
|
const hasClass = checkClassName => node => (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1;
|
@@ -22768,6 +22903,12 @@
|
|
22768
22903
|
}
|
22769
22904
|
e.content = content;
|
22770
22905
|
};
|
22906
|
+
const isValidContent = (nonEditableRegExps, content) => {
|
22907
|
+
return forall(nonEditableRegExps, re => {
|
22908
|
+
const matches = content.match(re);
|
22909
|
+
return matches !== null && matches[0].length === content.length;
|
22910
|
+
});
|
22911
|
+
};
|
22771
22912
|
const setup$n = editor => {
|
22772
22913
|
const contentEditableAttrName = 'contenteditable';
|
22773
22914
|
const editClass = ' ' + Tools.trim(getEditableClass(editor)) + ' ';
|
@@ -22798,11 +22939,16 @@
|
|
22798
22939
|
if (!hasEditClass(node) && !hasNonEditClass(node)) {
|
22799
22940
|
continue;
|
22800
22941
|
}
|
22801
|
-
|
22802
|
-
|
22803
|
-
|
22804
|
-
|
22805
|
-
|
22942
|
+
const content = node.attr('data-mce-content');
|
22943
|
+
if (nonEditableRegExps.length > 0 && content) {
|
22944
|
+
if (isValidContent(nonEditableRegExps, content)) {
|
22945
|
+
node.name = '#text';
|
22946
|
+
node.type = 3;
|
22947
|
+
node.raw = true;
|
22948
|
+
node.value = content;
|
22949
|
+
} else {
|
22950
|
+
node.remove();
|
22951
|
+
}
|
22806
22952
|
} else {
|
22807
22953
|
node.attr(contentEditableAttrName, null);
|
22808
22954
|
}
|
@@ -24303,19 +24449,19 @@
|
|
24303
24449
|
},
|
24304
24450
|
{
|
24305
24451
|
keyCode: VK.BACKSPACE,
|
24306
|
-
action: action(backspaceDelete$
|
24452
|
+
action: action(backspaceDelete$7, editor, false)
|
24307
24453
|
},
|
24308
24454
|
{
|
24309
24455
|
keyCode: VK.DELETE,
|
24310
|
-
action: action(backspaceDelete$
|
24456
|
+
action: action(backspaceDelete$7, editor, true)
|
24311
24457
|
},
|
24312
24458
|
{
|
24313
24459
|
keyCode: VK.BACKSPACE,
|
24314
|
-
action: action(backspaceDelete$
|
24460
|
+
action: action(backspaceDelete$8, editor, false)
|
24315
24461
|
},
|
24316
24462
|
{
|
24317
24463
|
keyCode: VK.DELETE,
|
24318
|
-
action: action(backspaceDelete$
|
24464
|
+
action: action(backspaceDelete$8, editor, true)
|
24319
24465
|
},
|
24320
24466
|
{
|
24321
24467
|
keyCode: VK.BACKSPACE,
|
@@ -24327,11 +24473,11 @@
|
|
24327
24473
|
},
|
24328
24474
|
{
|
24329
24475
|
keyCode: VK.BACKSPACE,
|
24330
|
-
action: action(backspaceDelete$
|
24476
|
+
action: action(backspaceDelete$b, editor, false)
|
24331
24477
|
},
|
24332
24478
|
{
|
24333
24479
|
keyCode: VK.DELETE,
|
24334
|
-
action: action(backspaceDelete$
|
24480
|
+
action: action(backspaceDelete$b, editor, true)
|
24335
24481
|
},
|
24336
24482
|
{
|
24337
24483
|
keyCode: VK.BACKSPACE,
|
@@ -24387,19 +24533,19 @@
|
|
24387
24533
|
},
|
24388
24534
|
{
|
24389
24535
|
keyCode: VK.BACKSPACE,
|
24390
|
-
action: action(backspaceDelete$
|
24536
|
+
action: action(backspaceDelete$9, editor, false)
|
24391
24537
|
},
|
24392
24538
|
{
|
24393
24539
|
keyCode: VK.DELETE,
|
24394
|
-
action: action(backspaceDelete$
|
24540
|
+
action: action(backspaceDelete$9, editor, true)
|
24395
24541
|
},
|
24396
24542
|
{
|
24397
24543
|
keyCode: VK.BACKSPACE,
|
24398
|
-
action: action(backspaceDelete$
|
24544
|
+
action: action(backspaceDelete$a, editor, false)
|
24399
24545
|
},
|
24400
24546
|
{
|
24401
24547
|
keyCode: VK.DELETE,
|
24402
|
-
action: action(backspaceDelete$
|
24548
|
+
action: action(backspaceDelete$a, editor, true)
|
24403
24549
|
},
|
24404
24550
|
{
|
24405
24551
|
keyCode: VK.BACKSPACE,
|
@@ -24408,6 +24554,14 @@
|
|
24408
24554
|
{
|
24409
24555
|
keyCode: VK.DELETE,
|
24410
24556
|
action: action(backspaceDelete$3, editor, true)
|
24557
|
+
},
|
24558
|
+
{
|
24559
|
+
keyCode: VK.BACKSPACE,
|
24560
|
+
action: action(backspaceDelete$6, editor, false)
|
24561
|
+
},
|
24562
|
+
{
|
24563
|
+
keyCode: VK.DELETE,
|
24564
|
+
action: action(backspaceDelete$6, editor, true)
|
24411
24565
|
}
|
24412
24566
|
], evt).filter(_ => editor.selection.isEditable()).each(applyAction => {
|
24413
24567
|
evt.preventDefault();
|
@@ -25026,9 +25180,14 @@
|
|
25026
25180
|
} else if (isCaretAtStartOrEndOfBlock(false)) {
|
25027
25181
|
newBlock = insertNewBlockAfter();
|
25028
25182
|
} else if (isCaretAtStartOrEndOfBlock(true) && parentBlockParent) {
|
25183
|
+
const caretPos = CaretPosition.fromRangeStart(rng);
|
25184
|
+
const afterTable = isAfterTable(caretPos);
|
25185
|
+
const parentBlockSugar = SugarElement.fromDom(parentBlock);
|
25186
|
+
const afterBr = isAfterBr(parentBlockSugar, caretPos, editor.schema);
|
25187
|
+
const prevBrOpt = afterBr ? findPreviousBr(parentBlockSugar, caretPos, editor.schema).bind(pos => Optional.from(pos.getNode())) : Optional.none();
|
25029
25188
|
newBlock = parentBlockParent.insertBefore(createNewBlock$1(), parentBlock);
|
25030
|
-
const
|
25031
|
-
moveToCaretPosition(editor,
|
25189
|
+
const root = containerAndSiblingName(parentBlock, 'HR') || afterTable ? newBlock : prevBrOpt.getOr(parentBlock);
|
25190
|
+
moveToCaretPosition(editor, root);
|
25032
25191
|
} else {
|
25033
25192
|
const tmpRng = includeZwspInRange(rng).cloneRange();
|
25034
25193
|
tmpRng.setEndAfter(parentBlock);
|
@@ -26671,6 +26830,7 @@
|
|
26671
26830
|
setup$8(editor);
|
26672
26831
|
register$1(editor, pasteFormat);
|
26673
26832
|
setup$9(editor);
|
26833
|
+
editor.addQueryStateHandler('mceTogglePlainTextPaste', () => pasteFormat.get() === 'text');
|
26674
26834
|
editor.on('PreInit', () => {
|
26675
26835
|
register(editor);
|
26676
26836
|
setup$a(editor, draggingInternallyState);
|
@@ -29464,7 +29624,10 @@
|
|
29464
29624
|
const extendedOptions = Tools.extend(defaultOptions, defaultOverrideOptions, sectionResult.options(), isOnMobile(isMobileDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, { external_plugins: getExternalPlugins(defaultOverrideOptions, sectionResult.options()) });
|
29465
29625
|
return processPlugins(isMobileDevice, sectionResult, defaultOverrideOptions, extendedOptions);
|
29466
29626
|
};
|
29467
|
-
const normalizeOptions = (defaultOverrideOptions, options) =>
|
29627
|
+
const normalizeOptions = (defaultOverrideOptions, options) => {
|
29628
|
+
const copiedOptions = merge(options);
|
29629
|
+
return combineOptions(isPhone || isTablet, isPhone, copiedOptions, defaultOverrideOptions, copiedOptions);
|
29630
|
+
};
|
29468
29631
|
|
29469
29632
|
const addVisual = (editor, elm) => addVisual$1(editor, elm);
|
29470
29633
|
|
@@ -30551,7 +30714,7 @@
|
|
30551
30714
|
}
|
30552
30715
|
return undefined;
|
30553
30716
|
};
|
30554
|
-
const create$5 = (editor, initialOptions) => {
|
30717
|
+
const create$5 = (editor, initialOptions, rawInitialOptions = initialOptions) => {
|
30555
30718
|
const registry = {};
|
30556
30719
|
const values = {};
|
30557
30720
|
const setValue = (name, value, processor) => {
|
@@ -30599,13 +30762,26 @@
|
|
30599
30762
|
return registered;
|
30600
30763
|
};
|
30601
30764
|
const isSet = name => has$2(values, name);
|
30765
|
+
const debug = () => {
|
30766
|
+
try {
|
30767
|
+
console.log(JSON.parse(JSON.stringify(rawInitialOptions, (_key, value) => {
|
30768
|
+
if (isBoolean(value) || isNumber(value) || isString(value) || isNull(value) || isArray$1(value) || isPlainObject(value)) {
|
30769
|
+
return value;
|
30770
|
+
}
|
30771
|
+
return Object.prototype.toString.call(value);
|
30772
|
+
})));
|
30773
|
+
} catch (error) {
|
30774
|
+
console.error(error);
|
30775
|
+
}
|
30776
|
+
};
|
30602
30777
|
return {
|
30603
30778
|
register,
|
30604
30779
|
isRegistered,
|
30605
30780
|
get,
|
30606
30781
|
set,
|
30607
30782
|
unset,
|
30608
|
-
isSet
|
30783
|
+
isSet,
|
30784
|
+
debug
|
30609
30785
|
};
|
30610
30786
|
};
|
30611
30787
|
|
@@ -30937,7 +31113,7 @@
|
|
30937
31113
|
this.id = id;
|
30938
31114
|
this.hidden = false;
|
30939
31115
|
const normalizedOptions = normalizeOptions(editorManager.defaultOptions, options);
|
30940
|
-
this.options = create$5(self, normalizedOptions);
|
31116
|
+
this.options = create$5(self, normalizedOptions, options);
|
30941
31117
|
register$7(self);
|
30942
31118
|
const getOption = this.options.get;
|
30943
31119
|
if (getOption('deprecation_warnings')) {
|
@@ -31342,8 +31518,8 @@
|
|
31342
31518
|
documentBaseURL: null,
|
31343
31519
|
suffix: null,
|
31344
31520
|
majorVersion: '7',
|
31345
|
-
minorVersion: '1
|
31346
|
-
releaseDate: '
|
31521
|
+
minorVersion: '2.1',
|
31522
|
+
releaseDate: '2024-07-03',
|
31347
31523
|
i18n: I18n,
|
31348
31524
|
activeEditor: null,
|
31349
31525
|
focusedEditor: null,
|