tinymce-rails 7.1.2.1 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +227 -78
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16f33672ca5cec4f01b08a57f124ced7db50502d0a8eeee8555f79babe1da1f9
4
- data.tar.gz: e071714189f9af366de6044a716106d6c74c2fe6aea1289b932f406b3aa10750
3
+ metadata.gz: a3d8e59d489555f3c9025c77f367daedc97aaa51c790a343ddbb43a6ea74fde3
4
+ data.tar.gz: a2965c692e2763103b0896b82496f66e35151c7139e876e0ea440014bfa76aa6
5
5
  SHA512:
6
- metadata.gz: 864f635247eafb5c98fd05592da7856232af96cfca0ef787c72d2cb03b6e43b1d65805aa9cce4b6963d73e1b40340cbd37a2c3bb43ef46043347e49ea40db9f9
7
- data.tar.gz: 2dbc3ec0bb9ece2e37195898a8bc75f2731ee53d18f687a6d4ea9f3fb6f59563029806f7e6b2663635b1fadf57a298334de36fed2f3f3353b99d7e029fd268d4
6
+ metadata.gz: 2ee08355adcec31ef59e297505ff58a23c759e6dba194fd6385babb1b77e55ee68604654ff32f0f10204c547e4513f714fe1356f9628ac19f3e6c3220df539c5
7
+ data.tar.gz: 1444057af973cd6781f81554a358507a6d062507fcfa399e59a5bb2be8a3d3dcfbf70ea81eceb704218115b70c60ad06651e5cdc21f14c9971a3053bb13ba743
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TinyMCE version 7.1.2 (TBD)
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([
@@ -6530,7 +6529,7 @@
6530
6529
  forward
6531
6530
  };
6532
6531
  };
6533
- const getBookmark$2 = (selection, type, normalized = false) => {
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$1 = (selection, type, normalized) => {
8612
- return getBookmark$2(selection, type, normalized);
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$1, selection),
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
- if (isNonNullable(editor.bookmark) && !hasFocus(editor)) {
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 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));
11783
11795
  const isNonInheritableStyle = style => nonInheritableStyles.has(style);
11784
- 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));
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$a = (editor, forward) => {
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
- Tools.each(dom.select('*[data-mce-fragment]'), node => {
13066
- const isInline = isNonNullable(textInlineElements[node.nodeName.toLowerCase()]);
13067
- if (isInline && hasInheritableStyles(dom, node)) {
13068
- for (let parentNode = node.parentElement; isNonNullable(parentNode) && parentNode !== root; parentNode = parentNode.parentElement) {
13069
- const styleConflict = hasStyleConflict(dom, node, parentNode);
13070
- if (styleConflict) {
13071
- break;
13072
- }
13073
- if (elementUtils.compare(parentNode, node)) {
13074
- dom.remove(node, true);
13075
- break;
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 => {
@@ -21367,7 +21373,7 @@
21367
21373
  };
21368
21374
  const mergeBlocks = (rootNode, forward, block1, block2, schema) => forward ? mergeBlockInto(rootNode, block2, block1, schema) : mergeBlockInto(rootNode, block1, block2, schema);
21369
21375
 
21370
- const backspaceDelete$9 = (editor, forward) => {
21376
+ const backspaceDelete$a = (editor, forward) => {
21371
21377
  const rootNode = SugarElement.fromDom(editor.getBody());
21372
21378
  const position = read$1(editor.schema, rootNode.dom, forward, editor.selection.getRng()).map(blockBoundary => () => {
21373
21379
  mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block, editor.schema).each(pos => {
@@ -21414,7 +21420,7 @@
21414
21420
  const rng = editor.selection.getRng();
21415
21421
  return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection, editor.schema);
21416
21422
  };
21417
- 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);
21418
21424
 
21419
21425
  const showCaret = (direction, editor, node, before, scrollIntoView) => Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));
21420
21426
  const getNodeRange = node => {
@@ -21497,7 +21503,7 @@
21497
21503
  }
21498
21504
  return Optional.none();
21499
21505
  };
21500
- const backspaceDelete$7 = (editor, forward) => deleteBoundaryText(editor, forward);
21506
+ const backspaceDelete$8 = (editor, forward) => deleteBoundaryText(editor, forward);
21501
21507
 
21502
21508
  const getEdgeCefPosition = (editor, atStart) => {
21503
21509
  const root = editor.getBody();
@@ -21636,7 +21642,7 @@
21636
21642
  }
21637
21643
  return true;
21638
21644
  };
21639
- const backspaceDelete$6 = (editor, forward) => {
21645
+ const backspaceDelete$7 = (editor, forward) => {
21640
21646
  if (editor.selection.isCollapsed()) {
21641
21647
  return backspaceDeleteCaret(editor, forward);
21642
21648
  } else {
@@ -21644,6 +21650,98 @@
21644
21650
  }
21645
21651
  };
21646
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
+
21647
21745
  const deleteCaret$2 = (editor, forward) => {
21648
21746
  const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
21649
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));
@@ -22544,15 +22642,16 @@
22544
22642
 
22545
22643
  const findAction = (editor, caret, forward) => findMap([
22546
22644
  backspaceDelete$1,
22547
- backspaceDelete$6,
22548
22645
  backspaceDelete$7,
22646
+ backspaceDelete$8,
22549
22647
  (editor, forward) => backspaceDelete$4(editor, caret, forward),
22550
- backspaceDelete$9,
22551
22648
  backspaceDelete$a,
22649
+ backspaceDelete$b,
22552
22650
  backspaceDelete$5,
22553
22651
  backspaceDelete$2,
22554
- backspaceDelete$8,
22555
- backspaceDelete$3
22652
+ backspaceDelete$9,
22653
+ backspaceDelete$3,
22654
+ backspaceDelete$6
22556
22655
  ], item => item(editor, forward)).filter(_ => editor.selection.isEditable());
22557
22656
  const deleteCommand = (editor, caret) => {
22558
22657
  const result = findAction(editor, caret, false);
@@ -22680,7 +22779,7 @@
22680
22779
  const rootNode = editor.getBody();
22681
22780
  let rootBlockNode;
22682
22781
  let tempNode;
22683
- let wrapped = false;
22782
+ let bm = null;
22684
22783
  const forcedRootBlock = getForcedRootBlock(editor);
22685
22784
  if (!startNode || !isElement$6(startNode)) {
22686
22785
  return;
@@ -22689,9 +22788,14 @@
22689
22788
  if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, startNode)) {
22690
22789
  return;
22691
22790
  }
22692
- const rng = selection.getRng();
22693
- const {startContainer, startOffset, endContainer, endOffset} = rng;
22694
- 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
+ }
22695
22799
  let node = rootNode.firstChild;
22696
22800
  while (node) {
22697
22801
  if (isElement$6(node)) {
@@ -22705,9 +22809,15 @@
22705
22809
  continue;
22706
22810
  }
22707
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
+ }
22708
22819
  rootBlockNode = createRootBlock(editor);
22709
22820
  rootNode.insertBefore(rootBlockNode, node);
22710
- wrapped = true;
22711
22821
  }
22712
22822
  tempNode = node;
22713
22823
  node = node.nextSibling;
@@ -22717,10 +22827,8 @@
22717
22827
  node = node.nextSibling;
22718
22828
  }
22719
22829
  }
22720
- if (wrapped && restoreSelection) {
22721
- rng.setStart(startContainer, startOffset);
22722
- rng.setEnd(endContainer, endOffset);
22723
- selection.setRng(rng);
22830
+ if (bm) {
22831
+ editor.selection.setRng(resolveBookmark(bm));
22724
22832
  editor.nodeChanged();
22725
22833
  }
22726
22834
  };
@@ -22735,7 +22843,7 @@
22735
22843
  return rng;
22736
22844
  };
22737
22845
  const setup$o = editor => {
22738
- editor.on('NodeChange', curry(addRootBlocks, editor));
22846
+ editor.on('NodeChange', () => addRootBlocks(editor));
22739
22847
  };
22740
22848
 
22741
22849
  const hasClass = checkClassName => node => (' ' + node.attr('class') + ' ').indexOf(checkClassName) !== -1;
@@ -22768,6 +22876,12 @@
22768
22876
  }
22769
22877
  e.content = content;
22770
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
+ };
22771
22885
  const setup$n = editor => {
22772
22886
  const contentEditableAttrName = 'contenteditable';
22773
22887
  const editClass = ' ' + Tools.trim(getEditableClass(editor)) + ' ';
@@ -22798,11 +22912,16 @@
22798
22912
  if (!hasEditClass(node) && !hasNonEditClass(node)) {
22799
22913
  continue;
22800
22914
  }
22801
- if (nonEditableRegExps.length > 0 && node.attr('data-mce-content')) {
22802
- node.name = '#text';
22803
- node.type = 3;
22804
- node.raw = true;
22805
- 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
+ }
22806
22925
  } else {
22807
22926
  node.attr(contentEditableAttrName, null);
22808
22927
  }
@@ -24303,19 +24422,19 @@
24303
24422
  },
24304
24423
  {
24305
24424
  keyCode: VK.BACKSPACE,
24306
- action: action(backspaceDelete$6, editor, false)
24425
+ action: action(backspaceDelete$7, editor, false)
24307
24426
  },
24308
24427
  {
24309
24428
  keyCode: VK.DELETE,
24310
- action: action(backspaceDelete$6, editor, true)
24429
+ action: action(backspaceDelete$7, editor, true)
24311
24430
  },
24312
24431
  {
24313
24432
  keyCode: VK.BACKSPACE,
24314
- action: action(backspaceDelete$7, editor, false)
24433
+ action: action(backspaceDelete$8, editor, false)
24315
24434
  },
24316
24435
  {
24317
24436
  keyCode: VK.DELETE,
24318
- action: action(backspaceDelete$7, editor, true)
24437
+ action: action(backspaceDelete$8, editor, true)
24319
24438
  },
24320
24439
  {
24321
24440
  keyCode: VK.BACKSPACE,
@@ -24327,11 +24446,11 @@
24327
24446
  },
24328
24447
  {
24329
24448
  keyCode: VK.BACKSPACE,
24330
- action: action(backspaceDelete$a, editor, false)
24449
+ action: action(backspaceDelete$b, editor, false)
24331
24450
  },
24332
24451
  {
24333
24452
  keyCode: VK.DELETE,
24334
- action: action(backspaceDelete$a, editor, true)
24453
+ action: action(backspaceDelete$b, editor, true)
24335
24454
  },
24336
24455
  {
24337
24456
  keyCode: VK.BACKSPACE,
@@ -24387,19 +24506,19 @@
24387
24506
  },
24388
24507
  {
24389
24508
  keyCode: VK.BACKSPACE,
24390
- action: action(backspaceDelete$8, editor, false)
24509
+ action: action(backspaceDelete$9, editor, false)
24391
24510
  },
24392
24511
  {
24393
24512
  keyCode: VK.DELETE,
24394
- action: action(backspaceDelete$8, editor, true)
24513
+ action: action(backspaceDelete$9, editor, true)
24395
24514
  },
24396
24515
  {
24397
24516
  keyCode: VK.BACKSPACE,
24398
- action: action(backspaceDelete$9, editor, false)
24517
+ action: action(backspaceDelete$a, editor, false)
24399
24518
  },
24400
24519
  {
24401
24520
  keyCode: VK.DELETE,
24402
- action: action(backspaceDelete$9, editor, true)
24521
+ action: action(backspaceDelete$a, editor, true)
24403
24522
  },
24404
24523
  {
24405
24524
  keyCode: VK.BACKSPACE,
@@ -24408,6 +24527,14 @@
24408
24527
  {
24409
24528
  keyCode: VK.DELETE,
24410
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)
24411
24538
  }
24412
24539
  ], evt).filter(_ => editor.selection.isEditable()).each(applyAction => {
24413
24540
  evt.preventDefault();
@@ -25026,9 +25153,14 @@
25026
25153
  } else if (isCaretAtStartOrEndOfBlock(false)) {
25027
25154
  newBlock = insertNewBlockAfter();
25028
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();
25029
25161
  newBlock = parentBlockParent.insertBefore(createNewBlock$1(), parentBlock);
25030
- const isNearChildren = hasChildNodes(SugarElement.fromDom(rng.startContainer)) && rng.collapsed;
25031
- moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') || isNearChildren ? newBlock : parentBlock);
25162
+ const root = containerAndSiblingName(parentBlock, 'HR') || afterTable ? newBlock : prevBrOpt.getOr(parentBlock);
25163
+ moveToCaretPosition(editor, root);
25032
25164
  } else {
25033
25165
  const tmpRng = includeZwspInRange(rng).cloneRange();
25034
25166
  tmpRng.setEndAfter(parentBlock);
@@ -26671,6 +26803,7 @@
26671
26803
  setup$8(editor);
26672
26804
  register$1(editor, pasteFormat);
26673
26805
  setup$9(editor);
26806
+ editor.addQueryStateHandler('mceTogglePlainTextPaste', () => pasteFormat.get() === 'text');
26674
26807
  editor.on('PreInit', () => {
26675
26808
  register(editor);
26676
26809
  setup$a(editor, draggingInternallyState);
@@ -29464,7 +29597,10 @@
29464
29597
  const extendedOptions = Tools.extend(defaultOptions, defaultOverrideOptions, sectionResult.options(), isOnMobile(isMobileDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, { external_plugins: getExternalPlugins(defaultOverrideOptions, sectionResult.options()) });
29465
29598
  return processPlugins(isMobileDevice, sectionResult, defaultOverrideOptions, extendedOptions);
29466
29599
  };
29467
- 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
+ };
29468
29604
 
29469
29605
  const addVisual = (editor, elm) => addVisual$1(editor, elm);
29470
29606
 
@@ -30551,7 +30687,7 @@
30551
30687
  }
30552
30688
  return undefined;
30553
30689
  };
30554
- const create$5 = (editor, initialOptions) => {
30690
+ const create$5 = (editor, initialOptions, rawInitialOptions = initialOptions) => {
30555
30691
  const registry = {};
30556
30692
  const values = {};
30557
30693
  const setValue = (name, value, processor) => {
@@ -30599,13 +30735,26 @@
30599
30735
  return registered;
30600
30736
  };
30601
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
+ };
30602
30750
  return {
30603
30751
  register,
30604
30752
  isRegistered,
30605
30753
  get,
30606
30754
  set,
30607
30755
  unset,
30608
- isSet
30756
+ isSet,
30757
+ debug
30609
30758
  };
30610
30759
  };
30611
30760
 
@@ -30937,7 +31086,7 @@
30937
31086
  this.id = id;
30938
31087
  this.hidden = false;
30939
31088
  const normalizedOptions = normalizeOptions(editorManager.defaultOptions, options);
30940
- this.options = create$5(self, normalizedOptions);
31089
+ this.options = create$5(self, normalizedOptions, options);
30941
31090
  register$7(self);
30942
31091
  const getOption = this.options.get;
30943
31092
  if (getOption('deprecation_warnings')) {
@@ -31342,8 +31491,8 @@
31342
31491
  documentBaseURL: null,
31343
31492
  suffix: null,
31344
31493
  majorVersion: '7',
31345
- minorVersion: '1.2',
31346
- releaseDate: 'TBD',
31494
+ minorVersion: '2.0',
31495
+ releaseDate: '2024-06-19',
31347
31496
  i18n: I18n,
31348
31497
  activeEditor: null,
31349
31498
  focusedEditor: null,
@@ -1,6 +1,6 @@
1
1
  module TinyMCE
2
2
  module Rails
3
- VERSION = "7.1.2.1"
4
- TINYMCE_VERSION = "7.1.2"
3
+ VERSION = "7.2.0"
4
+ TINYMCE_VERSION = "7.2.0"
5
5
  end
6
6
  end