tinymce-rails 7.1.0 → 7.2.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +253 -103
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/models/dom/model.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
  10. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  16. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +1 -1
  18. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  19. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  20. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -1
  22. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
  23. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +1 -1
  28. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  29. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  30. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  31. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  32. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -2
  34. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  35. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.js +1 -1
  36. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  37. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  38. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.js +1 -1
  39. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  40. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  41. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.js +1 -1
  42. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  43. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  44. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -1
  45. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  46. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  47. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +4 -0
  48. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  49. metadata +7 -7
  50. /data/vendor/assets/javascripts/tinymce/langs/{README.md → readme.md} +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TinyMCE version 7.1.0 (2024-05-08)
2
+ * TinyMCE version 7.2.0 (2024-06-19)
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([
@@ -3564,8 +3563,8 @@
3564
3563
  return hexColour(value);
3565
3564
  };
3566
3565
 
3567
- const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i;
3568
- const rgbaRegex = /^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i;
3566
+ const rgbRegex = /^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i;
3567
+ const rgbaRegex = /^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i;
3569
3568
  const rgbaColour = (red, green, blue, alpha) => ({
3570
3569
  red,
3571
3570
  green,
@@ -3579,10 +3578,15 @@
3579
3578
  const a = parseFloat(alpha);
3580
3579
  return rgbaColour(r, g, b, a);
3581
3580
  };
3582
- const fromString = rgbaString => {
3583
- if (rgbaString === 'transparent') {
3584
- return Optional.some(rgbaColour(0, 0, 0, 0));
3581
+ const getColorFormat = colorString => {
3582
+ if (rgbRegex.test(colorString)) {
3583
+ return 'rgb';
3584
+ } else if (rgbaRegex.test(colorString)) {
3585
+ return 'rgba';
3585
3586
  }
3587
+ return 'other';
3588
+ };
3589
+ const fromString = rgbaString => {
3586
3590
  const rgbMatch = rgbRegex.exec(rgbaString);
3587
3591
  if (rgbMatch !== null) {
3588
3592
  return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1'));
@@ -3601,7 +3605,6 @@
3601
3605
  const urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi;
3602
3606
  const styleRegExp = /\s*([^:]+):\s*([^;]+);?/g;
3603
3607
  const trimRightRegExp = /\s+$/;
3604
- const rgbaRegExp = /rgba *\(/i;
3605
3608
  const encodingLookup = {};
3606
3609
  let validStyles;
3607
3610
  let invalidStyles;
@@ -3755,7 +3758,7 @@
3755
3758
  } else if (name === 'color' || name === 'background-color') {
3756
3759
  value = value.toLowerCase();
3757
3760
  }
3758
- if (!rgbaRegExp.test(value)) {
3761
+ if (getColorFormat(value) === 'rgb') {
3759
3762
  fromString(value).each(rgba => {
3760
3763
  value = rgbaToHexString(toString(rgba)).toLowerCase();
3761
3764
  });
@@ -6526,7 +6529,7 @@
6526
6529
  forward
6527
6530
  };
6528
6531
  };
6529
- const getBookmark$2 = (selection, type, normalized = false) => {
6532
+ const getBookmark$3 = (selection, type, normalized = false) => {
6530
6533
  if (type === 2) {
6531
6534
  return getOffsetBookmark(trim$2, normalized, selection);
6532
6535
  } else if (type === 3) {
@@ -8604,8 +8607,8 @@
8604
8607
  return Optional.none();
8605
8608
  };
8606
8609
 
8607
- const getBookmark$1 = (selection, type, normalized) => {
8608
- return getBookmark$2(selection, type, normalized);
8610
+ const getBookmark$2 = (selection, type, normalized) => {
8611
+ return getBookmark$3(selection, type, normalized);
8609
8612
  };
8610
8613
  const moveToBookmark = (selection, bookmark) => {
8611
8614
  resolve(selection, bookmark).each(({range, forward}) => {
@@ -9441,7 +9444,7 @@
9441
9444
 
9442
9445
  const BookmarkManager = selection => {
9443
9446
  return {
9444
- getBookmark: curry(getBookmark$1, selection),
9447
+ getBookmark: curry(getBookmark$2, selection),
9445
9448
  moveToBookmark: curry(moveToBookmark, selection)
9446
9449
  };
9447
9450
  };
@@ -10719,7 +10722,7 @@
10719
10722
  const rng = !selection || selection.rangeCount === 0 ? Optional.none() : Optional.from(selection.getRangeAt(0));
10720
10723
  return rng.map(nativeRangeToSelectionRange);
10721
10724
  };
10722
- const getBookmark = root => {
10725
+ const getBookmark$1 = root => {
10723
10726
  const win = defaultView(root);
10724
10727
  return readRange(win.dom).filter(isRngInRoot(root));
10725
10728
  };
@@ -10735,7 +10738,7 @@
10735
10738
  }
10736
10739
  };
10737
10740
  const store = editor => {
10738
- const newBookmark = shouldStore(editor) ? getBookmark(SugarElement.fromDom(editor.getBody())) : Optional.none();
10741
+ const newBookmark = shouldStore(editor) ? getBookmark$1(SugarElement.fromDom(editor.getBody())) : Optional.none();
10739
10742
  editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;
10740
10743
  };
10741
10744
  const getRng = editor => {
@@ -10966,15 +10969,21 @@
10966
10969
  const body = editor.getBody();
10967
10970
  let rng = selection.getRng();
10968
10971
  editor.quirks.refreshContentEditable();
10969
- if (isNonNullable(editor.bookmark) && !hasFocus(editor)) {
10972
+ const restoreBookmark = editor => {
10970
10973
  getRng(editor).each(bookmarkRng => {
10971
10974
  editor.selection.setRng(bookmarkRng);
10972
10975
  rng = bookmarkRng;
10973
10976
  });
10977
+ };
10978
+ if (!hasFocus(editor) && editor.hasEditableRoot()) {
10979
+ restoreBookmark(editor);
10974
10980
  }
10975
10981
  const contentEditableHost = getContentEditableHost(editor, selection.getNode());
10976
10982
  if (contentEditableHost && editor.dom.isChildOf(contentEditableHost, body)) {
10977
10983
  focusBody(contentEditableHost);
10984
+ if (!editor.hasEditableRoot()) {
10985
+ restoreBookmark(editor);
10986
+ }
10978
10987
  normalizeSelection(editor, rng);
10979
10988
  activateEditor(editor);
10980
10989
  return;
@@ -11734,7 +11743,6 @@
11734
11743
  'background',
11735
11744
  'background-attachment',
11736
11745
  'background-clip',
11737
- 'background-color',
11738
11746
  'background-image',
11739
11747
  'background-origin',
11740
11748
  'background-position',
@@ -11770,14 +11778,24 @@
11770
11778
  nonInheritableStyles.add(style);
11771
11779
  });
11772
11780
  })();
11781
+ const conditionalNonInheritableStyles = new Set();
11782
+ (() => {
11783
+ const conditionalNonInheritableStylesArr = ['background-color'];
11784
+ each$e(conditionalNonInheritableStylesArr, style => {
11785
+ conditionalNonInheritableStyles.add(style);
11786
+ });
11787
+ })();
11773
11788
  const shorthandStyleProps = [
11774
11789
  'font',
11775
11790
  'text-decoration',
11776
11791
  'text-emphasis'
11777
11792
  ];
11778
- const getStyleProps = (dom, node) => keys(dom.parseStyle(dom.getAttrib(node, 'style')));
11793
+ const getStyles$1 = (dom, node) => dom.parseStyle(dom.getAttrib(node, 'style'));
11794
+ const getStyleProps = (dom, node) => keys(getStyles$1(dom, node));
11779
11795
  const isNonInheritableStyle = style => nonInheritableStyles.has(style);
11780
- const hasInheritableStyles = (dom, node) => forall(getStyleProps(dom, node), style => !isNonInheritableStyle(style));
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));
11781
11799
  const getLonghandStyleProps = styles => filter$5(styles, style => exists(shorthandStyleProps, prop => startsWith(style, prop)));
11782
11800
  const hasStyleConflict = (dom, node, parentNode) => {
11783
11801
  const nodeStyleProps = getStyleProps(dom, node);
@@ -12504,7 +12522,7 @@
12504
12522
  const rootElm = SugarElement.fromDom(editor.getBody());
12505
12523
  return getParentCaption(rootElm, startElm).fold(() => deleteCaretCells(editor, forward, rootElm, startElm).orThunk(() => someIf(isBeforeOrAfterTable(editor, forward), noop)), fromCaption => deleteCaretCaption(editor, forward, rootElm, fromCaption));
12506
12524
  };
12507
- const backspaceDelete$a = (editor, forward) => {
12525
+ const backspaceDelete$b = (editor, forward) => {
12508
12526
  const startElm = SugarElement.fromDom(editor.selection.getStart(true));
12509
12527
  const cells = getCellsFromEditor(editor);
12510
12528
  return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret$3(editor, forward, startElm) : deleteRange$3(editor, startElm, cells);
@@ -13058,18 +13076,20 @@
13058
13076
  if (merge) {
13059
13077
  const root = editor.getBody();
13060
13078
  const elementUtils = ElementUtils(editor);
13061
- Tools.each(dom.select('*[data-mce-fragment]'), node => {
13062
- const isInline = isNonNullable(textInlineElements[node.nodeName.toLowerCase()]);
13063
- if (isInline && hasInheritableStyles(dom, node)) {
13064
- for (let parentNode = node.parentElement; isNonNullable(parentNode) && parentNode !== root; parentNode = parentNode.parentElement) {
13065
- const styleConflict = hasStyleConflict(dom, node, parentNode);
13066
- if (styleConflict) {
13067
- break;
13068
- }
13069
- if (elementUtils.compare(parentNode, node)) {
13070
- dom.remove(node, true);
13071
- break;
13072
- }
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);
13073
13093
  }
13074
13094
  }
13075
13095
  });
@@ -17248,7 +17268,7 @@
17248
17268
  const makeMap = Tools.makeMap, extend$1 = Tools.extend;
17249
17269
  const transferChildren = (parent, nativeParent, specialElements, nsSanitizer) => {
17250
17270
  const parentName = parent.name;
17251
- const isSpecial = parentName in specialElements && parentName !== 'title' && parentName !== 'textarea';
17271
+ const isSpecial = parentName in specialElements && parentName !== 'title' && parentName !== 'textarea' && parentName !== 'noscript';
17252
17272
  const childNodes = nativeParent.childNodes;
17253
17273
  for (let ni = 0, nl = childNodes.length; ni < nl; ni++) {
17254
17274
  const nativeChild = childNodes[ni];
@@ -19003,16 +19023,6 @@
19003
19023
  }
19004
19024
  }
19005
19025
  });
19006
- htmlParser.addNodeFilter('noscript', nodes => {
19007
- var _a;
19008
- let i = nodes.length;
19009
- while (i--) {
19010
- const node = nodes[i].firstChild;
19011
- if (node) {
19012
- node.value = Entities.decode((_a = node.value) !== null && _a !== void 0 ? _a : '');
19013
- }
19014
- }
19015
- });
19016
19026
  htmlParser.addNodeFilter('script,style', (nodes, name) => {
19017
19027
  var _a;
19018
19028
  const trim = value => {
@@ -21271,7 +21281,7 @@
21271
21281
  };
21272
21282
  const isEditable$1 = blockBoundary => isContentEditableFalse$b(blockBoundary.from.block.dom) === false && isContentEditableFalse$b(blockBoundary.to.block.dom) === false;
21273
21283
  const hasValidBlocks = blockBoundary => {
21274
- const isValidBlock = block => isTextBlock$2(block) || hasBlockAttr(block.dom);
21284
+ const isValidBlock = block => isTextBlock$2(block) || hasBlockAttr(block.dom) || isListItem$1(block);
21275
21285
  return isValidBlock(blockBoundary.from.block) && isValidBlock(blockBoundary.to.block);
21276
21286
  };
21277
21287
  const skipLastBr = (schema, rootNode, forward, blockPosition) => {
@@ -21363,7 +21373,7 @@
21363
21373
  };
21364
21374
  const mergeBlocks = (rootNode, forward, block1, block2, schema) => forward ? mergeBlockInto(rootNode, block2, block1, schema) : mergeBlockInto(rootNode, block1, block2, schema);
21365
21375
 
21366
- const backspaceDelete$9 = (editor, forward) => {
21376
+ const backspaceDelete$a = (editor, forward) => {
21367
21377
  const rootNode = SugarElement.fromDom(editor.getBody());
21368
21378
  const position = read$1(editor.schema, rootNode.dom, forward, editor.selection.getRng()).map(blockBoundary => () => {
21369
21379
  mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block, editor.schema).each(pos => {
@@ -21410,7 +21420,7 @@
21410
21420
  const rng = editor.selection.getRng();
21411
21421
  return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection, editor.schema);
21412
21422
  };
21413
- const backspaceDelete$8 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
21423
+ const backspaceDelete$9 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
21414
21424
 
21415
21425
  const showCaret = (direction, editor, node, before, scrollIntoView) => Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));
21416
21426
  const getNodeRange = node => {
@@ -21493,7 +21503,7 @@
21493
21503
  }
21494
21504
  return Optional.none();
21495
21505
  };
21496
- const backspaceDelete$7 = (editor, forward) => deleteBoundaryText(editor, forward);
21506
+ const backspaceDelete$8 = (editor, forward) => deleteBoundaryText(editor, forward);
21497
21507
 
21498
21508
  const getEdgeCefPosition = (editor, atStart) => {
21499
21509
  const root = editor.getBody();
@@ -21632,7 +21642,7 @@
21632
21642
  }
21633
21643
  return true;
21634
21644
  };
21635
- const backspaceDelete$6 = (editor, forward) => {
21645
+ const backspaceDelete$7 = (editor, forward) => {
21636
21646
  if (editor.selection.isCollapsed()) {
21637
21647
  return backspaceDeleteCaret(editor, forward);
21638
21648
  } else {
@@ -21640,6 +21650,98 @@
21640
21650
  }
21641
21651
  };
21642
21652
 
21653
+ const isTextEndpoint = endpoint => endpoint.hasOwnProperty('text');
21654
+ const isElementEndpoint = endpoint => endpoint.hasOwnProperty('marker');
21655
+ const getBookmark = (range, createMarker) => {
21656
+ const getEndpoint = (container, offset) => {
21657
+ if (isText$b(container)) {
21658
+ return {
21659
+ text: container,
21660
+ offset
21661
+ };
21662
+ } else {
21663
+ const marker = createMarker();
21664
+ const children = container.childNodes;
21665
+ if (offset < children.length) {
21666
+ container.insertBefore(marker, children[offset]);
21667
+ return {
21668
+ marker,
21669
+ before: true
21670
+ };
21671
+ } else {
21672
+ container.appendChild(marker);
21673
+ return {
21674
+ marker,
21675
+ before: false
21676
+ };
21677
+ }
21678
+ }
21679
+ };
21680
+ const end = getEndpoint(range.endContainer, range.endOffset);
21681
+ const start = getEndpoint(range.startContainer, range.startOffset);
21682
+ return {
21683
+ start,
21684
+ end
21685
+ };
21686
+ };
21687
+ const resolveBookmark = bm => {
21688
+ var _a, _b;
21689
+ const {start, end} = bm;
21690
+ const rng = new window.Range();
21691
+ if (isTextEndpoint(start)) {
21692
+ rng.setStart(start.text, start.offset);
21693
+ } else {
21694
+ if (isElementEndpoint(start)) {
21695
+ if (start.before) {
21696
+ rng.setStartBefore(start.marker);
21697
+ } else {
21698
+ rng.setStartAfter(start.marker);
21699
+ }
21700
+ (_a = start.marker.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(start.marker);
21701
+ }
21702
+ }
21703
+ if (isTextEndpoint(end)) {
21704
+ rng.setEnd(end.text, end.offset);
21705
+ } else {
21706
+ if (isElementEndpoint(end)) {
21707
+ if (end.before) {
21708
+ rng.setEndBefore(end.marker);
21709
+ } else {
21710
+ rng.setEndAfter(end.marker);
21711
+ }
21712
+ (_b = end.marker.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(end.marker);
21713
+ }
21714
+ }
21715
+ return rng;
21716
+ };
21717
+
21718
+ const backspaceDelete$6 = (editor, forward) => {
21719
+ var _a;
21720
+ const dom = editor.dom;
21721
+ const startBlock = dom.getParent(editor.selection.getStart(), dom.isBlock);
21722
+ const endBlock = dom.getParent(editor.selection.getEnd(), dom.isBlock);
21723
+ const body = editor.getBody();
21724
+ const startBlockName = (_a = startBlock === null || startBlock === void 0 ? void 0 : startBlock.nodeName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
21725
+ if (startBlockName === 'div' && startBlock && endBlock && startBlock === body.firstChild && endBlock === body.lastChild && !dom.isEmpty(body)) {
21726
+ const wrapper = startBlock.cloneNode(false);
21727
+ const deleteAction = () => {
21728
+ if (forward) {
21729
+ execNativeForwardDeleteCommand(editor);
21730
+ } else {
21731
+ execNativeDeleteCommand(editor);
21732
+ }
21733
+ if (body.firstChild !== startBlock) {
21734
+ const bookmark = getBookmark(editor.selection.getRng(), () => document.createElement('span'));
21735
+ Array.from(body.childNodes).forEach(node => wrapper.appendChild(node));
21736
+ body.appendChild(wrapper);
21737
+ editor.selection.setRng(resolveBookmark(bookmark));
21738
+ }
21739
+ };
21740
+ return Optional.some(deleteAction);
21741
+ }
21742
+ return Optional.none();
21743
+ };
21744
+
21643
21745
  const deleteCaret$2 = (editor, forward) => {
21644
21746
  const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
21645
21747
  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));
@@ -22540,15 +22642,16 @@
22540
22642
 
22541
22643
  const findAction = (editor, caret, forward) => findMap([
22542
22644
  backspaceDelete$1,
22543
- backspaceDelete$6,
22544
22645
  backspaceDelete$7,
22646
+ backspaceDelete$8,
22545
22647
  (editor, forward) => backspaceDelete$4(editor, caret, forward),
22546
- backspaceDelete$9,
22547
22648
  backspaceDelete$a,
22649
+ backspaceDelete$b,
22548
22650
  backspaceDelete$5,
22549
22651
  backspaceDelete$2,
22550
- backspaceDelete$8,
22551
- backspaceDelete$3
22652
+ backspaceDelete$9,
22653
+ backspaceDelete$3,
22654
+ backspaceDelete$6
22552
22655
  ], item => item(editor, forward)).filter(_ => editor.selection.isEditable());
22553
22656
  const deleteCommand = (editor, caret) => {
22554
22657
  const result = findAction(editor, caret, false);
@@ -22676,7 +22779,7 @@
22676
22779
  const rootNode = editor.getBody();
22677
22780
  let rootBlockNode;
22678
22781
  let tempNode;
22679
- let wrapped = false;
22782
+ let bm = null;
22680
22783
  const forcedRootBlock = getForcedRootBlock(editor);
22681
22784
  if (!startNode || !isElement$6(startNode)) {
22682
22785
  return;
@@ -22685,9 +22788,14 @@
22685
22788
  if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, startNode)) {
22686
22789
  return;
22687
22790
  }
22688
- const rng = selection.getRng();
22689
- const {startContainer, startOffset, endContainer, endOffset} = rng;
22690
- const restoreSelection = hasFocus(editor);
22791
+ if (rootNode.firstChild === rootNode.lastChild && isBr$6(rootNode.firstChild)) {
22792
+ rootBlockNode = createRootBlock(editor);
22793
+ rootBlockNode.appendChild(createPaddingBr().dom);
22794
+ rootNode.replaceChild(rootBlockNode, rootNode.firstChild);
22795
+ editor.selection.setCursorLocation(rootBlockNode, 0);
22796
+ editor.nodeChanged();
22797
+ return;
22798
+ }
22691
22799
  let node = rootNode.firstChild;
22692
22800
  while (node) {
22693
22801
  if (isElement$6(node)) {
@@ -22701,9 +22809,15 @@
22701
22809
  continue;
22702
22810
  }
22703
22811
  if (!rootBlockNode) {
22812
+ if (!bm && editor.hasFocus()) {
22813
+ bm = getBookmark(editor.selection.getRng(), () => document.createElement('span'));
22814
+ }
22815
+ if (!node.parentNode) {
22816
+ node = null;
22817
+ break;
22818
+ }
22704
22819
  rootBlockNode = createRootBlock(editor);
22705
22820
  rootNode.insertBefore(rootBlockNode, node);
22706
- wrapped = true;
22707
22821
  }
22708
22822
  tempNode = node;
22709
22823
  node = node.nextSibling;
@@ -22713,10 +22827,8 @@
22713
22827
  node = node.nextSibling;
22714
22828
  }
22715
22829
  }
22716
- if (wrapped && restoreSelection) {
22717
- rng.setStart(startContainer, startOffset);
22718
- rng.setEnd(endContainer, endOffset);
22719
- selection.setRng(rng);
22830
+ if (bm) {
22831
+ editor.selection.setRng(resolveBookmark(bm));
22720
22832
  editor.nodeChanged();
22721
22833
  }
22722
22834
  };
@@ -22731,7 +22843,7 @@
22731
22843
  return rng;
22732
22844
  };
22733
22845
  const setup$o = editor => {
22734
- editor.on('NodeChange', curry(addRootBlocks, editor));
22846
+ editor.on('NodeChange', () => addRootBlocks(editor));
22735
22847
  };
22736
22848
 
22737
22849
  const hasClass = checkClassName => node => (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1;
@@ -22764,6 +22876,12 @@
22764
22876
  }
22765
22877
  e.content = content;
22766
22878
  };
22879
+ const isValidContent = (nonEditableRegExps, content) => {
22880
+ return forall(nonEditableRegExps, re => {
22881
+ const matches = content.match(re);
22882
+ return matches !== null && matches[0].length === content.length;
22883
+ });
22884
+ };
22767
22885
  const setup$n = editor => {
22768
22886
  const contentEditableAttrName = 'contenteditable';
22769
22887
  const editClass = ' ' + Tools.trim(getEditableClass(editor)) + ' ';
@@ -22794,11 +22912,16 @@
22794
22912
  if (!hasEditClass(node) && !hasNonEditClass(node)) {
22795
22913
  continue;
22796
22914
  }
22797
- if (nonEditableRegExps.length > 0 && node.attr('data-mce-content')) {
22798
- node.name = '#text';
22799
- node.type = 3;
22800
- node.raw = true;
22801
- node.value = node.attr('data-mce-content');
22915
+ const content = node.attr('data-mce-content');
22916
+ if (nonEditableRegExps.length > 0 && content) {
22917
+ if (isValidContent(nonEditableRegExps, content)) {
22918
+ node.name = '#text';
22919
+ node.type = 3;
22920
+ node.raw = true;
22921
+ node.value = content;
22922
+ } else {
22923
+ node.remove();
22924
+ }
22802
22925
  } else {
22803
22926
  node.attr(contentEditableAttrName, null);
22804
22927
  }
@@ -24021,23 +24144,20 @@
24021
24144
  lookupInfo.lookupData.then(lookupData => {
24022
24145
  activeAutocompleter.get().map(ac => {
24023
24146
  const context = lookupInfo.context;
24024
- if (ac.trigger === context.trigger) {
24025
- if (context.text.length - ac.matchLength >= 10) {
24026
- cancelIfNecessary();
24027
- } else {
24028
- activeAutocompleter.set({
24029
- ...ac,
24030
- matchLength: context.text.length
24031
- });
24032
- if (uiActive.get()) {
24033
- fireAutocompleterUpdateActiveRange(editor, { range: context.range });
24034
- fireAutocompleterUpdate(editor, { lookupData });
24035
- } else {
24036
- uiActive.set(true);
24037
- fireAutocompleterUpdateActiveRange(editor, { range: context.range });
24038
- fireAutocompleterStart(editor, { lookupData });
24039
- }
24040
- }
24147
+ if (ac.trigger !== context.trigger) {
24148
+ return;
24149
+ }
24150
+ activeAutocompleter.set({
24151
+ ...ac,
24152
+ matchLength: context.text.length
24153
+ });
24154
+ if (uiActive.get()) {
24155
+ fireAutocompleterUpdateActiveRange(editor, { range: context.range });
24156
+ fireAutocompleterUpdate(editor, { lookupData });
24157
+ } else {
24158
+ uiActive.set(true);
24159
+ fireAutocompleterUpdateActiveRange(editor, { range: context.range });
24160
+ fireAutocompleterStart(editor, { lookupData });
24041
24161
  }
24042
24162
  });
24043
24163
  });
@@ -24302,19 +24422,19 @@
24302
24422
  },
24303
24423
  {
24304
24424
  keyCode: VK.BACKSPACE,
24305
- action: action(backspaceDelete$6, editor, false)
24425
+ action: action(backspaceDelete$7, editor, false)
24306
24426
  },
24307
24427
  {
24308
24428
  keyCode: VK.DELETE,
24309
- action: action(backspaceDelete$6, editor, true)
24429
+ action: action(backspaceDelete$7, editor, true)
24310
24430
  },
24311
24431
  {
24312
24432
  keyCode: VK.BACKSPACE,
24313
- action: action(backspaceDelete$7, editor, false)
24433
+ action: action(backspaceDelete$8, editor, false)
24314
24434
  },
24315
24435
  {
24316
24436
  keyCode: VK.DELETE,
24317
- action: action(backspaceDelete$7, editor, true)
24437
+ action: action(backspaceDelete$8, editor, true)
24318
24438
  },
24319
24439
  {
24320
24440
  keyCode: VK.BACKSPACE,
@@ -24326,11 +24446,11 @@
24326
24446
  },
24327
24447
  {
24328
24448
  keyCode: VK.BACKSPACE,
24329
- action: action(backspaceDelete$a, editor, false)
24449
+ action: action(backspaceDelete$b, editor, false)
24330
24450
  },
24331
24451
  {
24332
24452
  keyCode: VK.DELETE,
24333
- action: action(backspaceDelete$a, editor, true)
24453
+ action: action(backspaceDelete$b, editor, true)
24334
24454
  },
24335
24455
  {
24336
24456
  keyCode: VK.BACKSPACE,
@@ -24386,19 +24506,19 @@
24386
24506
  },
24387
24507
  {
24388
24508
  keyCode: VK.BACKSPACE,
24389
- action: action(backspaceDelete$8, editor, false)
24509
+ action: action(backspaceDelete$9, editor, false)
24390
24510
  },
24391
24511
  {
24392
24512
  keyCode: VK.DELETE,
24393
- action: action(backspaceDelete$8, editor, true)
24513
+ action: action(backspaceDelete$9, editor, true)
24394
24514
  },
24395
24515
  {
24396
24516
  keyCode: VK.BACKSPACE,
24397
- action: action(backspaceDelete$9, editor, false)
24517
+ action: action(backspaceDelete$a, editor, false)
24398
24518
  },
24399
24519
  {
24400
24520
  keyCode: VK.DELETE,
24401
- action: action(backspaceDelete$9, editor, true)
24521
+ action: action(backspaceDelete$a, editor, true)
24402
24522
  },
24403
24523
  {
24404
24524
  keyCode: VK.BACKSPACE,
@@ -24407,6 +24527,14 @@
24407
24527
  {
24408
24528
  keyCode: VK.DELETE,
24409
24529
  action: action(backspaceDelete$3, editor, true)
24530
+ },
24531
+ {
24532
+ keyCode: VK.BACKSPACE,
24533
+ action: action(backspaceDelete$6, editor, false)
24534
+ },
24535
+ {
24536
+ keyCode: VK.DELETE,
24537
+ action: action(backspaceDelete$6, editor, true)
24410
24538
  }
24411
24539
  ], evt).filter(_ => editor.selection.isEditable()).each(applyAction => {
24412
24540
  evt.preventDefault();
@@ -25025,9 +25153,14 @@
25025
25153
  } else if (isCaretAtStartOrEndOfBlock(false)) {
25026
25154
  newBlock = insertNewBlockAfter();
25027
25155
  } else if (isCaretAtStartOrEndOfBlock(true) && parentBlockParent) {
25156
+ const caretPos = CaretPosition.fromRangeStart(rng);
25157
+ const afterTable = isAfterTable(caretPos);
25158
+ const parentBlockSugar = SugarElement.fromDom(parentBlock);
25159
+ const afterBr = isAfterBr(parentBlockSugar, caretPos, editor.schema);
25160
+ const prevBrOpt = afterBr ? findPreviousBr(parentBlockSugar, caretPos, editor.schema).bind(pos => Optional.from(pos.getNode())) : Optional.none();
25028
25161
  newBlock = parentBlockParent.insertBefore(createNewBlock$1(), parentBlock);
25029
- const isNearChildren = hasChildNodes(SugarElement.fromDom(rng.startContainer)) && rng.collapsed;
25030
- moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') || isNearChildren ? newBlock : parentBlock);
25162
+ const root = containerAndSiblingName(parentBlock, 'HR') || afterTable ? newBlock : prevBrOpt.getOr(parentBlock);
25163
+ moveToCaretPosition(editor, root);
25031
25164
  } else {
25032
25165
  const tmpRng = includeZwspInRange(rng).cloneRange();
25033
25166
  tmpRng.setEndAfter(parentBlock);
@@ -26670,6 +26803,7 @@
26670
26803
  setup$8(editor);
26671
26804
  register$1(editor, pasteFormat);
26672
26805
  setup$9(editor);
26806
+ editor.addQueryStateHandler('mceTogglePlainTextPaste', () => pasteFormat.get() === 'text');
26673
26807
  editor.on('PreInit', () => {
26674
26808
  register(editor);
26675
26809
  setup$a(editor, draggingInternallyState);
@@ -29463,7 +29597,10 @@
29463
29597
  const extendedOptions = Tools.extend(defaultOptions, defaultOverrideOptions, sectionResult.options(), isOnMobile(isMobileDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, { external_plugins: getExternalPlugins(defaultOverrideOptions, sectionResult.options()) });
29464
29598
  return processPlugins(isMobileDevice, sectionResult, defaultOverrideOptions, extendedOptions);
29465
29599
  };
29466
- const normalizeOptions = (defaultOverrideOptions, options) => combineOptions(isPhone || isTablet, isPhone, options, defaultOverrideOptions, options);
29600
+ const normalizeOptions = (defaultOverrideOptions, options) => {
29601
+ const copiedOptions = merge(options);
29602
+ return combineOptions(isPhone || isTablet, isPhone, copiedOptions, defaultOverrideOptions, copiedOptions);
29603
+ };
29467
29604
 
29468
29605
  const addVisual = (editor, elm) => addVisual$1(editor, elm);
29469
29606
 
@@ -30550,7 +30687,7 @@
30550
30687
  }
30551
30688
  return undefined;
30552
30689
  };
30553
- const create$5 = (editor, initialOptions) => {
30690
+ const create$5 = (editor, initialOptions, rawInitialOptions = initialOptions) => {
30554
30691
  const registry = {};
30555
30692
  const values = {};
30556
30693
  const setValue = (name, value, processor) => {
@@ -30598,13 +30735,26 @@
30598
30735
  return registered;
30599
30736
  };
30600
30737
  const isSet = name => has$2(values, name);
30738
+ const debug = () => {
30739
+ try {
30740
+ console.log(JSON.parse(JSON.stringify(rawInitialOptions, (_key, value) => {
30741
+ if (isBoolean(value) || isNumber(value) || isString(value) || isNull(value) || isArray$1(value) || isPlainObject(value)) {
30742
+ return value;
30743
+ }
30744
+ return Object.prototype.toString.call(value);
30745
+ })));
30746
+ } catch (error) {
30747
+ console.error(error);
30748
+ }
30749
+ };
30601
30750
  return {
30602
30751
  register,
30603
30752
  isRegistered,
30604
30753
  get,
30605
30754
  set,
30606
30755
  unset,
30607
- isSet
30756
+ isSet,
30757
+ debug
30608
30758
  };
30609
30759
  };
30610
30760
 
@@ -30936,7 +31086,7 @@
30936
31086
  this.id = id;
30937
31087
  this.hidden = false;
30938
31088
  const normalizedOptions = normalizeOptions(editorManager.defaultOptions, options);
30939
- this.options = create$5(self, normalizedOptions);
31089
+ this.options = create$5(self, normalizedOptions, options);
30940
31090
  register$7(self);
30941
31091
  const getOption = this.options.get;
30942
31092
  if (getOption('deprecation_warnings')) {
@@ -31341,8 +31491,8 @@
31341
31491
  documentBaseURL: null,
31342
31492
  suffix: null,
31343
31493
  majorVersion: '7',
31344
- minorVersion: '1.0',
31345
- releaseDate: '2024-05-08',
31494
+ minorVersion: '2.0',
31495
+ releaseDate: '2024-06-19',
31346
31496
  i18n: I18n,
31347
31497
  activeEditor: null,
31348
31498
  focusedEditor: null,