@worktile/theia 17.1.0 → 17.1.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.
Files changed (96) hide show
  1. package/components/inline-toolbar/inline-toolbar.component.d.ts +2 -2
  2. package/esm2022/components/conversion-hint/conversion-hint.component.mjs +3 -3
  3. package/esm2022/components/inline-toolbar/inline-toolbar.component.mjs +6 -6
  4. package/esm2022/constants/auto-format-rules.mjs +7 -7
  5. package/esm2022/core/toolbar-item/base-toolbar-item.mjs +2 -2
  6. package/esm2022/editor.component.mjs +3 -3
  7. package/esm2022/plugins/align/align.editor.mjs +2 -2
  8. package/esm2022/plugins/align/align.plugin.mjs +3 -3
  9. package/esm2022/plugins/autoformat/autoformat.plugin.mjs +2 -2
  10. package/esm2022/plugins/autoformat/transforms/auto-format-inline.mjs +2 -2
  11. package/esm2022/plugins/blockquote/blockquote.editor.mjs +4 -4
  12. package/esm2022/plugins/blockquote/blockquote.plugin.mjs +3 -3
  13. package/esm2022/plugins/code/code.component.mjs +2 -2
  14. package/esm2022/plugins/code/code.editor.mjs +3 -3
  15. package/esm2022/plugins/code/code.plugin.mjs +3 -4
  16. package/esm2022/plugins/common/block-card.plugin.mjs +3 -3
  17. package/esm2022/plugins/common/get-fragment.plugin.mjs +2 -2
  18. package/esm2022/plugins/common/move-selection.plugin.mjs +3 -3
  19. package/esm2022/plugins/common/remove-empty.plugin.mjs +4 -4
  20. package/esm2022/plugins/common/remove-void.plugin.mjs +4 -4
  21. package/esm2022/plugins/common/reset-type.plugin.mjs +4 -4
  22. package/esm2022/plugins/deserialize/deserialize-md.plugin.mjs +2 -2
  23. package/esm2022/plugins/font-size/font-size.editor.mjs +5 -5
  24. package/esm2022/plugins/heading/heading.editor.mjs +5 -5
  25. package/esm2022/plugins/heading/heading.plugin.mjs +2 -2
  26. package/esm2022/plugins/hr/hr.editor.mjs +2 -2
  27. package/esm2022/plugins/hr/hr.plugin.mjs +4 -4
  28. package/esm2022/plugins/image/image.component.mjs +2 -2
  29. package/esm2022/plugins/image/image.editor.mjs +3 -3
  30. package/esm2022/plugins/list/components/list-item.component.mjs +2 -2
  31. package/esm2022/plugins/list/list.editor.mjs +4 -4
  32. package/esm2022/plugins/list/list.plugin.mjs +21 -21
  33. package/esm2022/plugins/list/normalizers/normalize-no.mjs +4 -4
  34. package/esm2022/plugins/list/on-key-down-list.mjs +4 -4
  35. package/esm2022/plugins/list/queries/get-list-item-entry.mjs +2 -2
  36. package/esm2022/plugins/list/queries/is-in-list.mjs +2 -2
  37. package/esm2022/plugins/list/queries/is-selection-at-list-item-start.mjs +2 -2
  38. package/esm2022/plugins/list/transforms/insert-list-data.mjs +4 -4
  39. package/esm2022/plugins/list/transforms/insert-list-item.mjs +4 -4
  40. package/esm2022/plugins/list/transforms/move-list-item-sublist-items-to-list-item-sublist.mjs +2 -2
  41. package/esm2022/plugins/list/transforms/move-list-item-sublist-items-to-list.mjs +3 -3
  42. package/esm2022/plugins/list/transforms/move-list-item-up.mjs +2 -2
  43. package/esm2022/plugins/list/transforms/unwrap-list.mjs +2 -2
  44. package/esm2022/plugins/mention/mention.editor.mjs +2 -2
  45. package/esm2022/plugins/node-id/node-id.plugin.mjs +7 -7
  46. package/esm2022/plugins/normalizers/insert-paragraph-nodes.mjs +2 -2
  47. package/esm2022/plugins/normalizers/trailing-node.plugin.mjs +4 -4
  48. package/esm2022/plugins/paint-format/paint-format.editor.mjs +7 -7
  49. package/esm2022/plugins/quick-insert/components/quick-insert.component.mjs +2 -2
  50. package/esm2022/plugins/soft-break/soft-break.plugin.mjs +3 -3
  51. package/esm2022/plugins/table/components/table.component.mjs +2 -2
  52. package/esm2022/plugins/table/components/td/td.component.mjs +2 -2
  53. package/esm2022/plugins/table/components/toolbar/table-toolbar.component.mjs +2 -2
  54. package/esm2022/plugins/table/table.editor.mjs +3 -3
  55. package/esm2022/plugins/table/table.plugin.mjs +2 -2
  56. package/esm2022/plugins/table/transforms/insert-table.mjs +2 -2
  57. package/esm2022/plugins/table/transforms/move-selection-from-cell.mjs +2 -2
  58. package/esm2022/plugins/table/utils/calc-anchor-position.mjs +2 -2
  59. package/esm2022/plugins/table/utils/calculate-table.mjs +2 -2
  60. package/esm2022/plugins/table/utils/is-legal-table.mjs +4 -4
  61. package/esm2022/plugins/table/utils/merge-cell.mjs +2 -2
  62. package/esm2022/plugins/table/utils/split-cell.mjs +2 -2
  63. package/esm2022/plugins/todo-item/todo-item.component.mjs +2 -2
  64. package/esm2022/plugins/todo-item/todo-item.editor.mjs +2 -2
  65. package/esm2022/plugins/todo-item/todo-item.plugin.mjs +4 -4
  66. package/esm2022/public-api.mjs +3 -3
  67. package/esm2022/queries/index.mjs +2 -67
  68. package/esm2022/transforms/apply-deep-to-nodes.mjs +2 -2
  69. package/esm2022/transforms/delete-element.mjs +3 -3
  70. package/esm2022/transforms/delete-node-by-type.mjs +2 -2
  71. package/esm2022/transforms/handle-continual-delete-backward.mjs +2 -2
  72. package/esm2022/transforms/index.mjs +14 -34
  73. package/esm2022/transforms/insert-elements.mjs +3 -3
  74. package/esm2022/transforms/move-children.mjs +2 -2
  75. package/esm2022/transforms/on-keydown-reset-block-type.mjs +2 -2
  76. package/esm2022/transforms/set-node-by-type.mjs +2 -2
  77. package/esm2022/transforms/set-node.mjs +2 -2
  78. package/esm2022/utils/auto-focus.mjs +2 -2
  79. package/esm2022/utils/insert-data-by-invalid-type.mjs +2 -2
  80. package/esm2022/utils/refocus.mjs +4 -4
  81. package/fesm2022/worktile-theia.mjs +950 -948
  82. package/fesm2022/worktile-theia.mjs.map +1 -1
  83. package/interfaces/editor.d.ts +2 -2
  84. package/package.json +1 -1
  85. package/plugins/list/list.editor.d.ts +1 -1
  86. package/plugins/list/transforms/insert-list-data.d.ts +1 -1
  87. package/plugins/normalizers/trailing-node.plugin.d.ts +1 -1
  88. package/plugins/paint-format/paint-format.editor.d.ts +1 -1
  89. package/plugins/table/components/table.component.d.ts +1 -1
  90. package/plugins/table/utils/is-legal-table.d.ts +1 -1
  91. package/plugins/vertical-align/vertical-align.scss +1 -2
  92. package/public-api.d.ts +2 -2
  93. package/queries/index.d.ts +61 -82
  94. package/queries/is-range-across-blocks.d.ts +1 -1
  95. package/transforms/handle-continual-delete-backward.d.ts +1 -1
  96. package/transforms/index.d.ts +17 -29
@@ -1579,78 +1579,79 @@ const someNode = (editor, options) => {
1579
1579
  return !!findNode(editor, options);
1580
1580
  };
1581
1581
 
1582
- const queries = {
1583
- anchorBlock,
1584
- anchorBlockEntry,
1585
- anchorInlineEntry,
1586
- findDescendant,
1587
- findNode,
1588
- findPath,
1589
- getAnchorBlockEntry,
1590
- getAbove,
1591
- getAboveByType,
1592
- getBlockAbove,
1593
- getBlockCardAbove,
1594
- getBlockCardCenterCursor,
1595
- getContainerBlocks,
1596
- getDirectlyParent,
1597
- getInsertElementsPath,
1582
+ var index$1 = /*#__PURE__*/Object.freeze({
1583
+ __proto__: null,
1584
+ anchorBlock: anchorBlock,
1585
+ anchorBlockEntry: anchorBlockEntry,
1586
+ anchorInlineEntry: anchorInlineEntry,
1587
+ findDescendant: findDescendant,
1588
+ findNode: findNode,
1589
+ findPath: findPath,
1590
+ getAbove: getAbove,
1591
+ getAboveByType: getAboveByType,
1592
+ getAnchorBlockEntry: getAnchorBlockEntry,
1593
+ getBlockAbove: getBlockAbove,
1594
+ getBlockCardAbove: getBlockCardAbove,
1595
+ getBlockCardCenterCursor: getBlockCardCenterCursor,
1596
+ getContainerBlocks: getContainerBlocks,
1597
+ getDirectlyParent: getDirectlyParent,
1598
+ getInsertElementsPath: getInsertElementsPath,
1598
1599
  getLastChild: getLastChild$1,
1599
- getLastChildPath,
1600
- getLastNode,
1601
- getNextSiblingNodes,
1602
- getNode,
1603
- getNodes,
1604
- getNodesByType,
1605
- getParent,
1606
- getPlainText,
1607
- getPluginByToolbarItem,
1608
- getPointBefore,
1609
- getPointFromLocation,
1610
- getPreviousPath,
1611
- getRangeBefore,
1612
- getRangeFromBlockStart,
1613
- getSelectionMarks,
1614
- getSelectionNodesByType,
1615
- getText,
1616
- getToolbarItemDisabled,
1617
- isAcrossBlocks,
1618
- isAncestor,
1619
- isAncestorEmpty,
1620
- isBlockAboveEmpty,
1621
- isBlockActive,
1622
- isBlockCardCursor,
1623
- isBlockTextEmptyAfterSelection,
1624
- isCollapsed,
1625
- isContainNestedType,
1626
- isContainer,
1627
- isDescendant,
1628
- isEmptyContent,
1629
- isEmptyContentByFilter,
1630
- isEmptyParagraph,
1631
- isEmptyParagraphByPath,
1632
- isEmptyParagraphElement,
1633
- isFirstChild,
1634
- isGlobalCollapsed,
1635
- isIncludeTypes,
1636
- isLogicEmptyParagraphElement,
1637
- isNodeType,
1638
- isNodeTypeIn,
1639
- isParagraph,
1640
- isPointAtRoot,
1641
- isRangeAcrossBlocks,
1642
- isRangeAtRoot,
1643
- isStart,
1644
- someNode,
1645
- isRootPath
1646
- };
1600
+ getLastChildPath: getLastChildPath,
1601
+ getLastNode: getLastNode,
1602
+ getNextSiblingNodes: getNextSiblingNodes,
1603
+ getNode: getNode,
1604
+ getNodes: getNodes,
1605
+ getNodesByType: getNodesByType,
1606
+ getParent: getParent,
1607
+ getPlainText: getPlainText,
1608
+ getPluginByToolbarItem: getPluginByToolbarItem,
1609
+ getPointBefore: getPointBefore,
1610
+ getPointFromLocation: getPointFromLocation,
1611
+ getPreviousPath: getPreviousPath,
1612
+ getRangeBefore: getRangeBefore,
1613
+ getRangeFromBlockStart: getRangeFromBlockStart,
1614
+ getSelectionMarks: getSelectionMarks,
1615
+ getSelectionNodesByType: getSelectionNodesByType,
1616
+ getText: getText,
1617
+ getToolbarItemDisabled: getToolbarItemDisabled,
1618
+ isAcrossBlocks: isAcrossBlocks,
1619
+ isAncestor: isAncestor,
1620
+ isAncestorEmpty: isAncestorEmpty,
1621
+ isBlockAboveEmpty: isBlockAboveEmpty,
1622
+ isBlockActive: isBlockActive,
1623
+ isBlockCardCursor: isBlockCardCursor,
1624
+ isBlockTextEmptyAfterSelection: isBlockTextEmptyAfterSelection,
1625
+ isCollapsed: isCollapsed,
1626
+ isContainNestedType: isContainNestedType,
1627
+ isContainer: isContainer,
1628
+ isDescendant: isDescendant,
1629
+ isEmptyContent: isEmptyContent,
1630
+ isEmptyContentByFilter: isEmptyContentByFilter,
1631
+ isEmptyParagraph: isEmptyParagraph,
1632
+ isEmptyParagraphByPath: isEmptyParagraphByPath,
1633
+ isEmptyParagraphElement: isEmptyParagraphElement,
1634
+ isFirstChild: isFirstChild,
1635
+ isGlobalCollapsed: isGlobalCollapsed,
1636
+ isIncludeTypes: isIncludeTypes,
1637
+ isLogicEmptyParagraphElement: isLogicEmptyParagraphElement,
1638
+ isNodeType: isNodeType,
1639
+ isNodeTypeIn: isNodeTypeIn,
1640
+ isParagraph: isParagraph,
1641
+ isPointAtRoot: isPointAtRoot,
1642
+ isRangeAcrossBlocks: isRangeAcrossBlocks,
1643
+ isRangeAtRoot: isRangeAtRoot,
1644
+ isRootPath: isRootPath,
1645
+ isStart: isStart,
1646
+ someNode: someNode
1647
+ });
1647
1648
 
1648
1649
  const autoFocus = (editor, isFocus) => {
1649
1650
  setTimeout(() => {
1650
1651
  if (editor && editor.children.length > 0 && isFocus) {
1651
1652
  HistoryEditor.withoutMerging(editor, () => {
1652
1653
  const path = [0];
1653
- const block = queries.getNode(editor, path);
1654
+ const block = getNode(editor, path);
1654
1655
  const isBlockCard = editor.isBlockCard(block);
1655
1656
  if (isBlockCard) {
1656
1657
  Transforms.select(editor, path);
@@ -2078,11 +2079,11 @@ function insertDataByInvalidType(editor, fragment) {
2078
2079
  const extraInfo = mergeElementOptions(editor.extraElementOptions);
2079
2080
  allElementOptions = Object.values(extraInfo);
2080
2081
  }
2081
- if (queries.isAcrossBlocks(editor, fragment) || Editor.isVoid(editor, fragment[0])) {
2082
+ if (isAcrossBlocks(editor, fragment) || Editor.isVoid(editor, fragment[0])) {
2082
2083
  const { selection } = editor;
2083
2084
  const [start] = Editor.edges(editor, selection);
2084
2085
  // query whether there is a node to be verified
2085
- const tryVerifyNode = allElementOptions.find(item => queries.getAboveByType(editor, item.type, { at: start, mode: 'lowest' }));
2086
+ const tryVerifyNode = allElementOptions.find(item => getAboveByType(editor, item.type, { at: start, mode: 'lowest' }));
2086
2087
  let isEndWithBlackCardElement = editor.isBlockCard(fragment[fragment.length - 1]);
2087
2088
  if (tryVerifyNode) {
2088
2089
  // is exist invalid element type in fragment
@@ -2090,7 +2091,7 @@ function insertDataByInvalidType(editor, fragment) {
2090
2091
  if (invalidIndex > -1) {
2091
2092
  const invalidFragmentData = fragment.slice(invalidIndex, fragment.length);
2092
2093
  const allowParentTypes = getPluginOptions(editor, invalidFragmentData[0].type)?.allowParentTypes || [];
2093
- const insertNodePath = queries.getInsertElementsPath(editor, allowParentTypes);
2094
+ const insertNodePath = getInsertElementsPath(editor, allowParentTypes);
2094
2095
  if (insertNodePath) {
2095
2096
  Editor.withoutNormalizing(editor, () => {
2096
2097
  Transforms.insertNodes(editor, fragment, { at: insertNodePath });
@@ -2098,7 +2099,7 @@ function insertDataByInvalidType(editor, fragment) {
2098
2099
  });
2099
2100
  return false;
2100
2101
  }
2101
- const [, anchorBlockPath] = queries.anchorBlockEntry(editor);
2102
+ const [, anchorBlockPath] = anchorBlockEntry(editor);
2102
2103
  const nextPath = Path.next([anchorBlockPath[0]]);
2103
2104
  Transforms.insertNodes(editor, fragment, { at: nextPath });
2104
2105
  Transforms.select(editor, Editor.start(editor, nextPath));
@@ -2106,11 +2107,11 @@ function insertDataByInvalidType(editor, fragment) {
2106
2107
  }
2107
2108
  }
2108
2109
  Editor.withoutNormalizing(editor, () => {
2109
- const isEmptyParagraph = queries.isEmptyParagraph(editor, editor.selection.anchor);
2110
+ const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
2110
2111
  const emptyPath = Path.parent(editor.selection.anchor.path);
2111
2112
  Transforms.insertNodes(editor, fragment);
2112
2113
  let targetPath = [];
2113
- if (isEmptyParagraph) {
2114
+ if (isEmptyParagraph$1) {
2114
2115
  Transforms.delete(editor, { at: emptyPath });
2115
2116
  const lastPath = emptyPath.pop();
2116
2117
  targetPath = [...emptyPath, lastPath + fragment.length - 1];
@@ -2172,19 +2173,19 @@ const isPureEmptyParagraph = (editor, block) => {
2172
2173
  const reSelection = (editor) => {
2173
2174
  let previousRange = THE_EDITOR_PREVIOUS_SELECTION.get(editor);
2174
2175
  let path = [0];
2175
- let focusNode = queries.getNode(editor, path);
2176
+ let focusNode = getNode(editor, path);
2176
2177
  let focusPath = Editor.start(editor, path);
2177
2178
  if (previousRange) {
2178
2179
  const { selection, rangeRef } = previousRange;
2179
2180
  if (rangeRef.current) {
2180
2181
  path = Editor.path(editor, rangeRef.current);
2181
- focusNode = queries.getNode(editor, path);
2182
+ focusNode = getNode(editor, path);
2182
2183
  focusPath = rangeRef.unref();
2183
2184
  }
2184
2185
  else {
2185
2186
  const previousPath = Editor.path(editor, selection);
2186
2187
  path = Path.previous([previousPath[0]]);
2187
- const previousNode = queries.getNode(editor, path);
2188
+ const previousNode = getNode(editor, path);
2188
2189
  if (previousNode) {
2189
2190
  focusPath = Editor.end(editor, path);
2190
2191
  focusNode = previousNode;
@@ -2356,8 +2357,8 @@ class TheBaseToolbarItem {
2356
2357
  this.disabled = this._toolbarItem?.disable ? this._toolbarItem?.disable(editor) : false;
2357
2358
  }
2358
2359
  else {
2359
- const thePlugin = queries.getPluginByToolbarItem(editor, this._toolbarItem);
2360
- this.disabled = thePlugin && queries.getToolbarItemDisabled(editor, thePlugin.key);
2360
+ const thePlugin = getPluginByToolbarItem(editor, this._toolbarItem);
2361
+ this.disabled = thePlugin && getToolbarItemDisabled(editor, thePlugin.key);
2361
2362
  }
2362
2363
  }
2363
2364
  else {
@@ -3623,6 +3624,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
3623
3624
  }]
3624
3625
  }] });
3625
3626
 
3627
+ /**
3628
+ * Recursively apply an operation to children nodes with a query.
3629
+ */
3630
+ const applyDeepToNodes = ({ node, source, apply, query }) => {
3631
+ const entry = [node, []];
3632
+ if (isNodeType(entry, query)) {
3633
+ if (source instanceof Function) {
3634
+ apply(node, source());
3635
+ }
3636
+ else {
3637
+ apply(node, source);
3638
+ }
3639
+ }
3640
+ if (!isAncestor(node)) {
3641
+ return;
3642
+ }
3643
+ node.children.forEach((child) => {
3644
+ applyDeepToNodes({ node: child, source, apply, query });
3645
+ });
3646
+ };
3647
+
3626
3648
  const setMarks = (editor, marks, at) => {
3627
3649
  Transforms.setNodes(editor, marks, {
3628
3650
  at,
@@ -3651,6 +3673,72 @@ const clearMarks = (editor) => {
3651
3673
  }
3652
3674
  };
3653
3675
 
3676
+ const closeConversionHint = (editor) => {
3677
+ const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
3678
+ if (hintRef) {
3679
+ hintRef.close();
3680
+ }
3681
+ };
3682
+
3683
+ const deleteElement = (editor, element) => {
3684
+ const at = findPath(editor, element);
3685
+ Transforms.insertNodes(editor, createEmptyParagraph(), { at });
3686
+ AngularEditor.focus(editor);
3687
+ Transforms.select(editor, at);
3688
+ Transforms.removeNodes(editor, { at: Path.next(at) });
3689
+ };
3690
+
3691
+ const deleteNodeByType = (editor, type) => {
3692
+ const node = getAboveByType(editor, type);
3693
+ const element = node && node[0];
3694
+ if (element) {
3695
+ deleteElement(editor, element);
3696
+ }
3697
+ };
3698
+
3699
+ const unWrap = (editor, kind) => {
3700
+ Editor.withoutNormalizing(editor, () => {
3701
+ Transforms.setNodes(editor, { type: ElementKinds.paragraph });
3702
+ Transforms.unwrapNodes(editor, {
3703
+ match: n => Element.isElement(n) && n.type === kind,
3704
+ split: true
3705
+ });
3706
+ });
3707
+ };
3708
+
3709
+ function handleContinualDeleteBackward(editor, aboveResult, type) {
3710
+ const highestBlock = aboveResult[0];
3711
+ const lowestBlock = anchorBlock(editor);
3712
+ const wrapBlockType = highestBlock.type;
3713
+ if (lowestBlock && Editor.isStart(editor, editor.selection.anchor, aboveResult[1])) {
3714
+ if (wrapBlockType === type) {
3715
+ if (highestBlock.children[0] === lowestBlock) {
3716
+ unWrap(editor, wrapBlockType);
3717
+ return true;
3718
+ }
3719
+ }
3720
+ }
3721
+ return false;
3722
+ }
3723
+
3724
+ function handleContinualInsertBreak(editor, lowestBlock, type) {
3725
+ const isEmpty = Editor.isEmpty(editor, lowestBlock);
3726
+ const isEnd = Editor.isEnd(editor, editor.selection.anchor, editor.selection.focus.path);
3727
+ const aboveResult = Editor.above(editor, {
3728
+ match: n => Element.isElement(n) && n.type === type
3729
+ });
3730
+ if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
3731
+ const wrapBlock = aboveResult[0];
3732
+ if (wrapBlock.type === type) {
3733
+ if (wrapBlock.children[wrapBlock.children.length - 1] === lowestBlock) {
3734
+ unWrap(editor, wrapBlock.type);
3735
+ return true;
3736
+ }
3737
+ }
3738
+ }
3739
+ return false;
3740
+ }
3741
+
3654
3742
  const insertElements = (editor, elements) => {
3655
3743
  if (!editor.selection) {
3656
3744
  refocus(editor);
@@ -3660,8 +3748,8 @@ const insertElements = (editor, elements) => {
3660
3748
  }
3661
3749
  const type = !isArray(elements) ? elements.type : elements[0].type; // 后期处理复制粘贴需要修改
3662
3750
  const allowParentTypes = getPluginOptions(editor, type)?.allowParentTypes || [];
3663
- const insertNodePath = queries.getInsertElementsPath(editor, allowParentTypes);
3664
- const [anchorBlock, anchorBlockPath] = queries.anchorBlockEntry(editor);
3751
+ const insertNodePath = getInsertElementsPath(editor, allowParentTypes);
3752
+ const [anchorBlock, anchorBlockPath] = anchorBlockEntry(editor);
3665
3753
  let isEmpty = Editor.isEmpty(editor, anchorBlock);
3666
3754
  if (insertNodePath) {
3667
3755
  Editor.withoutNormalizing(editor, () => {
@@ -3684,40 +3772,15 @@ const insertElements = (editor, elements) => {
3684
3772
  }
3685
3773
  };
3686
3774
 
3687
- const setNode = (editor, props, origin) => {
3688
- Transforms.setNodes(editor, props, { at: queries.findPath(editor, origin) });
3775
+ const insertParagraph = (editor, at) => {
3776
+ Transforms.insertNodes(editor, createEmptyParagraph(), { at });
3689
3777
  };
3690
3778
 
3691
3779
  /**
3692
- * Unwrap nodes by type
3780
+ * Recursively merge a source object to children nodes with a query.
3693
3781
  */
3694
- const unwrapNodesByType = (editor, types, options = {}) => {
3695
- if (!Array.isArray(types)) {
3696
- types = [types];
3697
- }
3698
- Transforms.unwrapNodes(editor, {
3699
- match: n => Element.isElement(n) && types.includes(n.type),
3700
- ...options
3701
- });
3702
- };
3703
-
3704
- const onKeyDownResetBlockType = ({ rules }) => (event, editor) => {
3705
- let reset;
3706
- if (editor.selection && isCollapsed(editor.selection)) {
3707
- rules.forEach(({ types, defaultType, hotkey, predicate, onReset }) => {
3708
- if (!event || (hotkey && isKeyHotkey(hotkey, event))) {
3709
- if (predicate(editor) && queries.isNodeTypeIn(editor, types)) {
3710
- if (event !== null) {
3711
- event.preventDefault();
3712
- }
3713
- Transforms.setNodes(editor, { type: defaultType });
3714
- onReset(editor);
3715
- reset = true;
3716
- }
3717
- }
3718
- });
3719
- }
3720
- return reset;
3782
+ const mergeDeepToNodes = (options) => {
3783
+ applyDeepToNodes({ ...options, apply: defaults });
3721
3784
  };
3722
3785
 
3723
3786
  /**
@@ -3731,7 +3794,7 @@ const moveChildren = (editor, { at, to, match, start = 0 }) => {
3731
3794
  return moved;
3732
3795
  for (let i = parentNode.children.length - 1; i >= start; i--) {
3733
3796
  const childPath = [...parentPath, i];
3734
- const childNode = queries.getNode(editor, childPath);
3797
+ const childNode = getNode(editor, childPath);
3735
3798
  if (!match || (childNode && match([childNode, childPath]))) {
3736
3799
  Transforms.moveNodes(editor, { at: childPath, to });
3737
3800
  moved++;
@@ -3740,54 +3803,23 @@ const moveChildren = (editor, { at, to, match, start = 0 }) => {
3740
3803
  return moved;
3741
3804
  };
3742
3805
 
3743
- const insertParagraph = (editor, at) => {
3744
- Transforms.insertNodes(editor, createEmptyParagraph(), { at });
3745
- };
3746
-
3747
- /**
3748
- * Recursively apply an operation to children nodes with a query.
3749
- */
3750
- const applyDeepToNodes = ({ node, source, apply, query }) => {
3751
- const entry = [node, []];
3752
- if (queries.isNodeType(entry, query)) {
3753
- if (source instanceof Function) {
3754
- apply(node, source());
3755
- }
3756
- else {
3757
- apply(node, source);
3758
- }
3759
- }
3760
- if (!queries.isAncestor(node)) {
3761
- return;
3762
- }
3763
- node.children.forEach((child) => {
3764
- applyDeepToNodes({ node: child, source, apply, query });
3765
- });
3766
- };
3767
-
3768
- /**
3769
- * Recursively merge a source object to children nodes with a query.
3770
- */
3771
- const mergeDeepToNodes = (options) => {
3772
- applyDeepToNodes({ ...options, apply: defaults });
3773
- };
3774
-
3775
- const unWrap = (editor, kind) => {
3776
- Editor.withoutNormalizing(editor, () => {
3777
- Transforms.setNodes(editor, { type: ElementKinds.paragraph });
3778
- Transforms.unwrapNodes(editor, {
3779
- match: n => Element.isElement(n) && n.type === kind,
3780
- split: true
3806
+ const onKeyDownResetBlockType = ({ rules }) => (event, editor) => {
3807
+ let reset;
3808
+ if (editor.selection && isCollapsed(editor.selection)) {
3809
+ rules.forEach(({ types, defaultType, hotkey, predicate, onReset }) => {
3810
+ if (!event || (hotkey && isKeyHotkey(hotkey, event))) {
3811
+ if (predicate(editor) && isNodeTypeIn(editor, types)) {
3812
+ if (event !== null) {
3813
+ event.preventDefault();
3814
+ }
3815
+ Transforms.setNodes(editor, { type: defaultType });
3816
+ onReset(editor);
3817
+ reset = true;
3818
+ }
3819
+ }
3781
3820
  });
3782
- });
3783
- };
3784
-
3785
- const deleteElement = (editor, element) => {
3786
- const at = queries.findPath(editor, element);
3787
- Transforms.insertNodes(editor, createEmptyParagraph(), { at });
3788
- AngularEditor.focus(editor);
3789
- Transforms.select(editor, at);
3790
- Transforms.removeNodes(editor, { at: Path.next(at) });
3821
+ }
3822
+ return reset;
3791
3823
  };
3792
3824
 
3793
3825
  const setEndSelection = (editor) => {
@@ -3797,83 +3829,53 @@ const setEndSelection = (editor) => {
3797
3829
  AngularEditor.focus(editor);
3798
3830
  };
3799
3831
 
3800
- const closeConversionHint = (editor) => {
3801
- const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
3802
- if (hintRef) {
3803
- hintRef.close();
3804
- }
3805
- };
3806
-
3807
- function handleContinualDeleteBackward(editor, aboveResult, type) {
3808
- const highestBlock = aboveResult[0];
3809
- const lowestBlock = queries.anchorBlock(editor);
3810
- const wrapBlockType = highestBlock.type;
3811
- if (lowestBlock && Editor.isStart(editor, editor.selection.anchor, aboveResult[1])) {
3812
- if (wrapBlockType === type) {
3813
- if (highestBlock.children[0] === lowestBlock) {
3814
- unWrap(editor, wrapBlockType);
3815
- return true;
3816
- }
3817
- }
3818
- }
3819
- return false;
3820
- }
3821
-
3822
- function handleContinualInsertBreak(editor, lowestBlock, type) {
3823
- const isEmpty = Editor.isEmpty(editor, lowestBlock);
3824
- const isEnd = Editor.isEnd(editor, editor.selection.anchor, editor.selection.focus.path);
3825
- const aboveResult = Editor.above(editor, {
3826
- match: n => Element.isElement(n) && n.type === type
3827
- });
3828
- if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
3829
- const wrapBlock = aboveResult[0];
3830
- if (wrapBlock.type === type) {
3831
- if (wrapBlock.children[wrapBlock.children.length - 1] === lowestBlock) {
3832
- unWrap(editor, wrapBlock.type);
3833
- return true;
3834
- }
3835
- }
3836
- }
3837
- return false;
3838
- }
3839
-
3840
- const deleteNodeByType = (editor, type) => {
3841
- const node = queries.getAboveByType(editor, type);
3842
- const element = node && node[0];
3843
- if (element) {
3844
- deleteElement(editor, element);
3845
- }
3832
+ const setNode = (editor, props, origin) => {
3833
+ Transforms.setNodes(editor, props, { at: findPath(editor, origin) });
3846
3834
  };
3847
3835
 
3848
3836
  const setNodeByType = (editor, props, type) => {
3849
- const node = queries.getAboveByType(editor, type);
3837
+ const node = getAboveByType(editor, type);
3850
3838
  const path = node && node[1];
3851
3839
  if (path) {
3852
3840
  Transforms.setNodes(editor, props, { at: path });
3853
3841
  }
3854
3842
  };
3855
3843
 
3856
- const transforms = {
3857
- setMarks,
3858
- clearMarks,
3859
- insertElements,
3860
- insertParagraph,
3861
- setNode,
3862
- unwrapNodesByType,
3863
- onKeyDownResetBlockType,
3864
- moveChildren,
3865
- applyDeepToNodes,
3866
- mergeDeepToNodes,
3867
- unWrap,
3868
- deleteElement,
3869
- setEndSelection,
3870
- closeConversionHint,
3871
- handleContinualDeleteBackward,
3872
- handleContinualInsertBreak,
3873
- deleteNodeByType,
3874
- setNodeByType
3844
+ /**
3845
+ * Unwrap nodes by type
3846
+ */
3847
+ const unwrapNodesByType = (editor, types, options = {}) => {
3848
+ if (!Array.isArray(types)) {
3849
+ types = [types];
3850
+ }
3851
+ Transforms.unwrapNodes(editor, {
3852
+ match: n => Element.isElement(n) && types.includes(n.type),
3853
+ ...options
3854
+ });
3875
3855
  };
3876
3856
 
3857
+ var index = /*#__PURE__*/Object.freeze({
3858
+ __proto__: null,
3859
+ applyDeepToNodes: applyDeepToNodes,
3860
+ clearMarks: clearMarks,
3861
+ closeConversionHint: closeConversionHint,
3862
+ deleteElement: deleteElement,
3863
+ deleteNodeByType: deleteNodeByType,
3864
+ handleContinualDeleteBackward: handleContinualDeleteBackward,
3865
+ handleContinualInsertBreak: handleContinualInsertBreak,
3866
+ insertElements: insertElements,
3867
+ insertParagraph: insertParagraph,
3868
+ mergeDeepToNodes: mergeDeepToNodes,
3869
+ moveChildren: moveChildren,
3870
+ onKeyDownResetBlockType: onKeyDownResetBlockType,
3871
+ setEndSelection: setEndSelection,
3872
+ setMarks: setMarks,
3873
+ setNode: setNode,
3874
+ setNodeByType: setNodeByType,
3875
+ unWrap: unWrap,
3876
+ unwrapNodesByType: unwrapNodesByType
3877
+ });
3878
+
3877
3879
  const THE_TABLE_COMPONENT_TOKEN = new InjectionToken('the-Table-token');
3878
3880
  const HEADER_CELL_CLASS = 'the-header-cell';
3879
3881
  const STICKY_CELL_CLASS = 'the-sticky-cell';
@@ -4119,7 +4121,7 @@ const calculateRowControls = (editor, element) => {
4119
4121
  };
4120
4122
  const calculateHeaderRowHeight = (editor, element) => {
4121
4123
  const firstRow = element.children[0];
4122
- if (firstRow.children.some((cell) => cell.rowspan && cell.rowspan > 1)) {
4124
+ if (firstRow.children.some(cell => cell.rowspan && cell.rowspan > 1)) {
4123
4125
  throw new Error('can not calculate header row height');
4124
4126
  }
4125
4127
  const cellDom = AngularEditor.toDOMNode(editor, firstRow.children[0]);
@@ -4717,7 +4719,7 @@ function insertTable(opts, editor, rows = 3, columns = 3, getCellContent) {
4717
4719
  }
4718
4720
  // Create the table node
4719
4721
  const table = createTable(opts, columns, rows, getCellContent);
4720
- transforms.insertElements(editor, table);
4722
+ insertElements(editor, table);
4721
4723
  }
4722
4724
 
4723
4725
  function getInsertRowState(opts, editor, count = 1, at) {
@@ -5113,7 +5115,7 @@ function mergeCell(editor, selectedCells) {
5113
5115
  selectCellNodes.forEach((cell, index) => {
5114
5116
  const { row, node } = cell;
5115
5117
  if (node) {
5116
- const cellPath = queries.findPath(editor, node);
5118
+ const cellPath = findPath(editor, node);
5117
5119
  if (index === 0) {
5118
5120
  leftTopCellPath = cellPath;
5119
5121
  }
@@ -5183,7 +5185,7 @@ function resetTableCell(editor, table, cell, cellRow, cellCol) {
5183
5185
  table.children.map((row, rowIndex) => {
5184
5186
  row.children.map((col, colIndex) => {
5185
5187
  if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
5186
- const path = queries.findPath(editor, col);
5188
+ const path = findPath(editor, col);
5187
5189
  Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
5188
5190
  }
5189
5191
  });
@@ -5293,7 +5295,7 @@ const TableEditor = {
5293
5295
  const equalColumns = columns.map(() => {
5294
5296
  return { width: sumWidth / columns.length };
5295
5297
  });
5296
- transforms.setNode(editor, { columns: equalColumns }, tableElement);
5298
+ setNode(editor, { columns: equalColumns }, tableElement);
5297
5299
  }
5298
5300
  },
5299
5301
  clearCellsContent(editor, cells) {
@@ -5318,7 +5320,7 @@ const TableEditor = {
5318
5320
  return !!table;
5319
5321
  },
5320
5322
  getSelectedCellPositions(editor) {
5321
- const tableNode = queries.getAboveByType(editor, ElementKinds.table);
5323
+ const tableNode = getAboveByType(editor, ElementKinds.table);
5322
5324
  if (tableNode) {
5323
5325
  const tableComponent = ELEMENT_TO_COMPONENT.get(tableNode[0]);
5324
5326
  const selectedCellPositions = tableComponent.tableStore.getSelectedCellPositions();
@@ -5329,7 +5331,7 @@ const TableEditor = {
5329
5331
  return null;
5330
5332
  },
5331
5333
  getSelectedCells(editor, location) {
5332
- const tableNode = queries.getAboveByType(editor, ElementKinds.table, {
5334
+ const tableNode = getAboveByType(editor, ElementKinds.table, {
5333
5335
  at: location || editor.selection.anchor
5334
5336
  });
5335
5337
  if (tableNode) {
@@ -5351,7 +5353,7 @@ const TableEditor = {
5351
5353
  Transforms.setNodes(editor, { verticalAlign: alignment }, { at: cellPath });
5352
5354
  }, cells);
5353
5355
  if (!isSelected) {
5354
- const cellEntry = queries.getAboveByType(editor, ElementKinds.tableCell);
5356
+ const cellEntry = getAboveByType(editor, ElementKinds.tableCell);
5355
5357
  if (cellEntry) {
5356
5358
  const [, cellPath] = cellEntry;
5357
5359
  Transforms.setNodes(editor, { verticalAlign: alignment }, {
@@ -5368,7 +5370,7 @@ const TableEditor = {
5368
5370
  const cells = TableEditor.getSelectedCellPositions(editor);
5369
5371
  if (cells) {
5370
5372
  const lastCell = cells[cells.length - 1];
5371
- const tableNode = queries.getAboveByType(editor, ElementKinds.table);
5373
+ const tableNode = getAboveByType(editor, ElementKinds.table);
5372
5374
  const cellPath = [...tableNode[1], lastCell.row, lastCell.col];
5373
5375
  const cell = Node.get(editor, cellPath);
5374
5376
  const { verticalAlign } = cell;
@@ -5378,7 +5380,7 @@ const TableEditor = {
5378
5380
  return verticalAlign === alignment;
5379
5381
  }
5380
5382
  else {
5381
- const cellElement = queries.getAboveByType(editor, ElementKinds.tableCell);
5383
+ const cellElement = getAboveByType(editor, ElementKinds.tableCell);
5382
5384
  if (cellElement) {
5383
5385
  const { verticalAlign } = cellElement[0];
5384
5386
  if (!verticalAlign && alignment === VerticalAlignment.top) {
@@ -5413,12 +5415,12 @@ const TableEditor = {
5413
5415
  MarkProps.forEach(key => {
5414
5416
  unsetMarks[key] = null;
5415
5417
  });
5416
- transforms.setMarks(editor, unsetMarks, cellRange);
5418
+ setMarks(editor, unsetMarks, cellRange);
5417
5419
  });
5418
5420
  },
5419
5421
  formatBrush(editor, marks) {
5420
5422
  return TableEditor.handleSelectedCells(editor, (cellPath, cellRange) => {
5421
- transforms.setMarks(editor, marks, cellRange);
5423
+ setMarks(editor, marks, cellRange);
5422
5424
  });
5423
5425
  },
5424
5426
  handleSelectedCells(editor, handle, cells) {
@@ -5470,7 +5472,7 @@ const TableEditor = {
5470
5472
  return isHeaderRow && isContainHeaderRow;
5471
5473
  },
5472
5474
  hasHeaderColumnCell(editor) {
5473
- const table = queries.getAboveByType(editor, ElementKinds.table);
5475
+ const table = getAboveByType(editor, ElementKinds.table);
5474
5476
  const selectedCells = TableEditor.getSelectedCellPositions(editor) ?? [];
5475
5477
  sortCell(selectedCells);
5476
5478
  const isContainHeaderColumn = !!selectedCells && selectedCells[0].col === 0;
@@ -5486,7 +5488,7 @@ const TableEditor = {
5486
5488
  },
5487
5489
  handleIndent(editor, indentType) {
5488
5490
  return TableEditor.handleSelectedCells(editor, (cellPath, cellRange) => {
5489
- const children = queries.getNode(editor, cellPath).children;
5491
+ const children = getNode(editor, cellPath).children;
5490
5492
  if (children.length) {
5491
5493
  children.forEach((child, index) => {
5492
5494
  setCellIndent(editor, indentType, child, [...cellPath, index]);
@@ -5501,7 +5503,7 @@ const AlignEditor = {
5501
5503
  if (!editor?.selection) {
5502
5504
  return;
5503
5505
  }
5504
- const blockElement = queries.anchorBlock(editor);
5506
+ const blockElement = anchorBlock(editor);
5505
5507
  if (blockElement) {
5506
5508
  const { align } = blockElement;
5507
5509
  if (!align && alignment === Alignment.left) {
@@ -5516,7 +5518,7 @@ const AlignEditor = {
5516
5518
  },
5517
5519
  isDisabled(editor) {
5518
5520
  const { richMedia } = editor.options;
5519
- return queries.getToolbarItemDisabled(editor, PluginKeys.align, richMedia ? [ElementKinds.image] : []);
5521
+ return getToolbarItemDisabled(editor, PluginKeys.align, richMedia ? [ElementKinds.image] : []);
5520
5522
  },
5521
5523
  setAlign(editor, alignment) {
5522
5524
  if (TableEditor.setAlign(editor, alignment)) {
@@ -5534,7 +5536,7 @@ const AlignEditor = {
5534
5536
 
5535
5537
  const BlockquoteEditor = {
5536
5538
  toggleBlockquote(editor) {
5537
- const isActive = queries.isBlockActive(editor, ElementKinds.blockquote);
5539
+ const isActive = isBlockActive(editor, ElementKinds.blockquote);
5538
5540
  const allowParentTypes = getPluginOptions(editor, PluginKeys.blockquote)?.allowParentTypes || [];
5539
5541
  if (!isActive) {
5540
5542
  Transforms.wrapNodes(editor, { type: ElementKinds.blockquote, children: [] }, {
@@ -5550,10 +5552,10 @@ const BlockquoteEditor = {
5550
5552
  const CodeEditor = {
5551
5553
  setCodeAttribute(editor, props, element) {
5552
5554
  if (!element) {
5553
- transforms.setNodeByType(editor, props, ElementKinds.code);
5555
+ setNodeByType(editor, props, ElementKinds.code);
5554
5556
  }
5555
5557
  else {
5556
- const path = queries.findPath(editor, element);
5558
+ const path = findPath(editor, element);
5557
5559
  Transforms.setNodes(editor, props, { at: path });
5558
5560
  }
5559
5561
  },
@@ -5580,7 +5582,7 @@ const CodeEditor = {
5580
5582
  language: DEFAULT_LANGUAGE.value,
5581
5583
  children: [{ text: '' }]
5582
5584
  };
5583
- transforms.insertElements(editor, codeElement);
5585
+ insertElements(editor, codeElement);
5584
5586
  }
5585
5587
  else {
5586
5588
  const codeElement = {
@@ -5589,15 +5591,15 @@ const CodeEditor = {
5589
5591
  language: DEFAULT_LANGUAGE.value,
5590
5592
  children: [{ text: '' }]
5591
5593
  };
5592
- transforms.insertElements(editor, codeElement);
5594
+ insertElements(editor, codeElement);
5593
5595
  }
5594
5596
  },
5595
5597
  removeCode(editor, code) {
5596
5598
  if (code) {
5597
- transforms.deleteElement(editor, code);
5599
+ deleteElement(editor, code);
5598
5600
  }
5599
5601
  else {
5600
- transforms.deleteNodeByType(editor, ElementKinds.code);
5602
+ deleteNodeByType(editor, ElementKinds.code);
5601
5603
  }
5602
5604
  }
5603
5605
  };
@@ -5643,15 +5645,15 @@ const HeadingEditor = {
5643
5645
  split: true
5644
5646
  });
5645
5647
  Transforms.setNodes(editor, { type: heading });
5646
- const entry = queries.anchorBlockEntry(editor);
5648
+ const entry = anchorBlockEntry(editor);
5647
5649
  const unMarks = {
5648
5650
  [MarkTypes.fontSize]: null
5649
5651
  };
5650
5652
  if (entry) {
5651
- transforms.setMarks(editor, unMarks, entry[1]);
5653
+ setMarks(editor, unMarks, entry[1]);
5652
5654
  return;
5653
5655
  }
5654
- transforms.setMarks(editor, unMarks, editor.selection);
5656
+ setMarks(editor, unMarks, editor.selection);
5655
5657
  });
5656
5658
  },
5657
5659
  isHeadingActive(editor, heading) {
@@ -5677,7 +5679,7 @@ const HeadingEditor = {
5677
5679
 
5678
5680
  const HrEditor = {
5679
5681
  insertHr(editor) {
5680
- transforms.insertElements(editor, { type: ElementKinds.hr, children: [{ text: '' }] });
5682
+ insertElements(editor, { type: ElementKinds.hr, children: [{ text: '' }] });
5681
5683
  },
5682
5684
  isHrActive(editor) {
5683
5685
  const [match] = Editor.nodes(editor, {
@@ -5847,7 +5849,7 @@ const ImageEditor = {
5847
5849
  }
5848
5850
  }
5849
5851
  if (imageNodes.length > 0) {
5850
- transforms.insertElements(editor, imageNodes);
5852
+ insertElements(editor, imageNodes);
5851
5853
  }
5852
5854
  },
5853
5855
  handleBase64ImageElement(editor, image) {
@@ -5908,10 +5910,10 @@ const ImageEditor = {
5908
5910
  },
5909
5911
  setImageNode(editor, props, image) {
5910
5912
  if (!image) {
5911
- transforms.setNodeByType(editor, props, ElementKinds.image);
5913
+ setNodeByType(editor, props, ElementKinds.image);
5912
5914
  }
5913
5915
  else {
5914
- const path = queries.findPath(editor, image);
5916
+ const path = findPath(editor, image);
5915
5917
  Transforms.setNodes(editor, props, { at: path });
5916
5918
  }
5917
5919
  },
@@ -5920,10 +5922,10 @@ const ImageEditor = {
5920
5922
  },
5921
5923
  removeImage(editor, image) {
5922
5924
  if (image) {
5923
- transforms.deleteElement(editor, image);
5925
+ deleteElement(editor, image);
5924
5926
  }
5925
5927
  else {
5926
- transforms.deleteNodeByType(editor, ElementKinds.image);
5928
+ deleteNodeByType(editor, ElementKinds.image);
5927
5929
  }
5928
5930
  }
5929
5931
  };
@@ -6153,8 +6155,8 @@ const ListEditor = {
6153
6155
  },
6154
6156
  unwrapList(editor) {
6155
6157
  Editor.withoutNormalizing(editor, () => {
6156
- transforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
6157
- transforms.unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
6158
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
6159
+ unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
6158
6160
  });
6159
6161
  },
6160
6162
  wrapList(editor, type) {
@@ -6172,11 +6174,11 @@ const ListEditor = {
6172
6174
  });
6173
6175
  },
6174
6176
  isActive(editor, type) {
6175
- const [match] = queries.getNodesByType(editor, type);
6177
+ const [match] = getNodesByType(editor, type);
6176
6178
  return !!match;
6177
6179
  },
6178
6180
  getActiveList(editor) {
6179
- const [match] = queries.getNodesByType(editor, LIST_BLOCK_TYPES);
6181
+ const [match] = getNodesByType(editor, LIST_BLOCK_TYPES);
6180
6182
  return match;
6181
6183
  },
6182
6184
  buildListItem(editor) {
@@ -6250,7 +6252,7 @@ const MentionEditor = {
6250
6252
  Transforms.insertText(editor, ` ${currentMention.trigger}`);
6251
6253
  setTimeout(() => {
6252
6254
  THE_EDITOR_ORIGIN_ANCHOR.set(editor, Editor.before(editor, editor.selection.anchor));
6253
- const textElement = AngularEditor.toDOMNode(editor, queries.anchorBlockEntry(editor)[0]);
6255
+ const textElement = AngularEditor.toDOMNode(editor, anchorBlockEntry(editor)[0]);
6254
6256
  MentionEditor.openSelectOverlay(editor, type, textElement);
6255
6257
  });
6256
6258
  },
@@ -6262,7 +6264,7 @@ const MentionEditor = {
6262
6264
  openSuggestion(editor, type) {
6263
6265
  const { selection } = editor;
6264
6266
  const elementRef = editor.injector.get(ElementRef);
6265
- const isParagraphStart = Editor.isStart(editor, selection?.anchor, queries.anchorBlockEntry(editor)[1]);
6267
+ const isParagraphStart = Editor.isStart(editor, selection?.anchor, anchorBlockEntry(editor)[1]);
6266
6268
  const originAnchor = THE_EDITOR_ORIGIN_ANCHOR.get(editor);
6267
6269
  let text = '';
6268
6270
  if (!isParagraphStart) {
@@ -6277,7 +6279,7 @@ const MentionEditor = {
6277
6279
  if (!originAnchor) {
6278
6280
  THE_EDITOR_ORIGIN_ANCHOR.set(editor, editor.selection.anchor);
6279
6281
  }
6280
- const textElement = AngularEditor.toDOMNode(editor, queries.anchorBlockEntry(editor)[0]);
6282
+ const textElement = AngularEditor.toDOMNode(editor, anchorBlockEntry(editor)[0]);
6281
6283
  const origin = isParagraphStart ? textElement : elementRef;
6282
6284
  MentionEditor.openSelectOverlay(editor, type, origin, isSoftBreak);
6283
6285
  }
@@ -6370,11 +6372,11 @@ const MentionEditor = {
6370
6372
  editor.insertText(' ');
6371
6373
  },
6372
6374
  isActive(editor, type) {
6373
- const [match] = queries.getNodesByType(editor, type);
6375
+ const [match] = getNodesByType(editor, type);
6374
6376
  return !!match;
6375
6377
  },
6376
6378
  updatePositionStrategy(editor, isSoftBreak = false) {
6377
- const textElement = AngularEditor.toDOMNode(editor, queries.anchorBlockEntry(editor)[0]);
6379
+ const textElement = AngularEditor.toDOMNode(editor, anchorBlockEntry(editor)[0]);
6378
6380
  const nativeRange = AngularEditor.toDOMRange(editor, editor.selection);
6379
6381
  const cursorRect = nativeRange.getBoundingClientRect();
6380
6382
  const textElementRect = textElement.getBoundingClientRect();
@@ -6577,7 +6579,7 @@ const QuickInsertEditor = {
6577
6579
 
6578
6580
  const TodoItemEditor = {
6579
6581
  isActive(editor) {
6580
- const [match] = queries.getNodesByType(editor, ElementKinds.checkItem);
6582
+ const [match] = getNodesByType(editor, ElementKinds.checkItem);
6581
6583
  return !!match;
6582
6584
  },
6583
6585
  insertTodoItem(editor) {
@@ -7245,8 +7247,8 @@ class TheInlineToolbar {
7245
7247
  inlineToolbar.removeAttribute('style');
7246
7248
  return;
7247
7249
  }
7248
- const anchorBlock = queries.anchorBlock(this.editor);
7249
- if (!inlineToolbar || !anchorBlock) {
7250
+ const anchorBlock$1 = anchorBlock(this.editor);
7251
+ if (!inlineToolbar || !anchorBlock$1) {
7250
7252
  return;
7251
7253
  }
7252
7254
  const { editor } = this;
@@ -7258,7 +7260,7 @@ class TheInlineToolbar {
7258
7260
  inlineToolbar.removeAttribute('style');
7259
7261
  return;
7260
7262
  }
7261
- if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock.type)) {
7263
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
7262
7264
  return;
7263
7265
  }
7264
7266
  const native = window.getSelection();
@@ -7367,7 +7369,7 @@ class TheConversionHint {
7367
7369
  creatCloseTimer() {
7368
7370
  this.closeTimer = setInterval(() => {
7369
7371
  clearInterval(this.closeTimer);
7370
- transforms.closeConversionHint(this.editor);
7372
+ closeConversionHint(this.editor);
7371
7373
  }, this.duration);
7372
7374
  }
7373
7375
  clearCloseTimer() {
@@ -7900,7 +7902,7 @@ const withAlign = (editor) => {
7900
7902
  const { deleteBackward } = editor;
7901
7903
  editor.deleteBackward = unit => {
7902
7904
  const { anchor } = editor.selection;
7903
- const node = queries.anchorBlock(editor);
7905
+ const node = anchorBlock(editor);
7904
7906
  const isVoid = Element.isElement(node) && Editor.isVoid(editor, node);
7905
7907
  const alignTypes = [Alignment.center, Alignment.right];
7906
7908
  const startLine = Editor.start(editor, anchor.path);
@@ -8069,7 +8071,7 @@ const defaultAutoFormatRules = [
8069
8071
  type: ElementKinds.listItem,
8070
8072
  markup: [],
8071
8073
  match: (editor) => {
8072
- return queries.isParagraph(editor) ? ['*', '-', '+'] : [];
8074
+ return isParagraph(editor) ? ['*', '-', '+'] : [];
8073
8075
  },
8074
8076
  format: (editor) => {
8075
8077
  ListEditor.toggleList(editor, ElementKinds.bulletedList);
@@ -8080,7 +8082,7 @@ const defaultAutoFormatRules = [
8080
8082
  type: ElementKinds.listItem,
8081
8083
  markup: [],
8082
8084
  match: (editor, textFromBlockStart) => {
8083
- return queries.isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
8085
+ return isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
8084
8086
  },
8085
8087
  format: (editor, markup) => {
8086
8088
  let startIndex = 1;
@@ -8098,7 +8100,7 @@ const defaultAutoFormatRules = [
8098
8100
  type: ElementKinds.checkItem,
8099
8101
  markup: [],
8100
8102
  match: (editor) => {
8101
- return queries.isParagraph(editor) ? ['[]'] : [];
8103
+ return isParagraph(editor) ? ['[]'] : [];
8102
8104
  },
8103
8105
  format: (editor) => {
8104
8106
  TodoItemEditor.insertTodoItem(editor);
@@ -8131,14 +8133,14 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format })
8131
8133
  const endMarkup = between ? between[1] : '';
8132
8134
  let endMarkupPointBefore = selection.anchor;
8133
8135
  if (endMarkup) {
8134
- endMarkupPointBefore = queries.getPointBefore(editor, selection, {
8136
+ endMarkupPointBefore = getPointBefore(editor, selection, {
8135
8137
  matchString: endMarkup
8136
8138
  });
8137
8139
  if (!endMarkupPointBefore) {
8138
8140
  return false;
8139
8141
  }
8140
8142
  }
8141
- const startMarkupPointAfter = queries.getPointBefore(editor, endMarkupPointBefore, {
8143
+ const startMarkupPointAfter = getPointBefore(editor, endMarkupPointBefore, {
8142
8144
  matchString: startMarkup,
8143
8145
  skipInvalid: true,
8144
8146
  afterMatch: true
@@ -8152,14 +8154,14 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format })
8152
8154
  focus: endMarkupPointBefore
8153
8155
  };
8154
8156
  if (!ignoreTrim) {
8155
- const markupText = queries.getText(editor, markupRange);
8157
+ const markupText = getText(editor, markupRange);
8156
8158
  if (markupText.trim() !== markupText) {
8157
8159
  return false;
8158
8160
  }
8159
8161
  }
8160
8162
  // delete end markup
8161
8163
  if (endMarkup) {
8162
- endMarkupPointBefore = queries.getPointBefore(editor, selection, {
8164
+ endMarkupPointBefore = getPointBefore(editor, selection, {
8163
8165
  matchString: endMarkup
8164
8166
  });
8165
8167
  Transforms.delete(editor, {
@@ -8169,12 +8171,12 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format })
8169
8171
  }
8170
8172
  });
8171
8173
  }
8172
- const startMarkupPointBefore = queries.getPointBefore(editor, selection, {
8174
+ const startMarkupPointBefore = getPointBefore(editor, selection, {
8173
8175
  matchString: startMarkup,
8174
8176
  skipInvalid: true
8175
8177
  });
8176
8178
  if (format) {
8177
- const markupText = queries.getText(editor, markupRange);
8179
+ const markupText = getText(editor, markupRange);
8178
8180
  format(editor, markupText);
8179
8181
  // delete start to end selection
8180
8182
  Transforms.delete(editor, {
@@ -8219,7 +8221,7 @@ const withAutoFormat = (editor) => {
8219
8221
  let autoFormatRules = getPluginOptions(editor, PluginKeys.autoFormat)?.autoFormatRules;
8220
8222
  const extraRules = mergAutoFormateRules(autoFormatRules);
8221
8223
  autoFormatRules = Object.values(extraRules);
8222
- if (!queries.isCollapsed(editor.selection)) {
8224
+ if (!isCollapsed(editor.selection)) {
8223
8225
  return insertText(text);
8224
8226
  }
8225
8227
  for (const { query, ...rule } of autoFormatRules) {
@@ -8235,15 +8237,15 @@ const withAutoFormat = (editor) => {
8235
8237
  let markups = castArray(markup);
8236
8238
  let markupRange;
8237
8239
  if (triggerAtBlockStart) {
8238
- markupRange = queries.getRangeFromBlockStart(editor);
8240
+ markupRange = getRangeFromBlockStart(editor);
8239
8241
  // Don't autoformat if there is void nodes.
8240
- const hasVoidNode = queries.someNode(editor, {
8242
+ const hasVoidNode = someNode(editor, {
8241
8243
  at: markupRange,
8242
8244
  match: n => Element.isElement(n) && Editor.isVoid(editor, n)
8243
8245
  });
8244
8246
  if (hasVoidNode)
8245
8247
  continue;
8246
- const textFromBlockStart = queries.getText(editor, markupRange);
8248
+ const textFromBlockStart = getText(editor, markupRange);
8247
8249
  if (match) {
8248
8250
  markups = match(editor, textFromBlockStart);
8249
8251
  }
@@ -8251,13 +8253,13 @@ const withAutoFormat = (editor) => {
8251
8253
  continue;
8252
8254
  }
8253
8255
  else {
8254
- markupRange = queries.getRangeBefore(editor, editor.selection, {
8256
+ markupRange = getRangeBefore(editor, editor.selection, {
8255
8257
  matchString: markup,
8256
8258
  skipInvalid: true
8257
8259
  });
8258
8260
  if (!markupRange)
8259
8261
  continue;
8260
- const blockAbovePath = queries.getBlockAbove(editor)?.[1];
8262
+ const blockAbovePath = getBlockAbove(editor)?.[1];
8261
8263
  if (!blockAbovePath)
8262
8264
  continue;
8263
8265
  // If the markup is not at the start, insert break before autoformatting.
@@ -8267,7 +8269,7 @@ const withAutoFormat = (editor) => {
8267
8269
  }
8268
8270
  if (!allowSameTypeAbove) {
8269
8271
  // Don't autoformat if already in a block of the same type.
8270
- const isBelowSameBlockType = queries.someNode(editor, { match: { type } });
8272
+ const isBelowSameBlockType = someNode(editor, { match: { type } });
8271
8273
  if (isBelowSameBlockType)
8272
8274
  continue;
8273
8275
  }
@@ -8335,19 +8337,19 @@ const withBlockquote = (editor) => {
8335
8337
  if (!aboveResult) {
8336
8338
  return deleteBackward(unit);
8337
8339
  }
8338
- const hasHandled = transforms.handleContinualDeleteBackward(editor, aboveResult, ElementKinds.blockquote);
8340
+ const hasHandled = handleContinualDeleteBackward(editor, aboveResult, ElementKinds.blockquote);
8339
8341
  if (hasHandled) {
8340
8342
  return;
8341
8343
  }
8342
8344
  return deleteBackward(unit);
8343
8345
  };
8344
8346
  editor.insertBreak = () => {
8345
- const lowestBlock = queries.anchorBlock(editor);
8347
+ const lowestBlock = anchorBlock(editor);
8346
8348
  if (!lowestBlock) {
8347
8349
  insertBreak();
8348
8350
  return;
8349
8351
  }
8350
- const hasHandled = transforms.handleContinualInsertBreak(editor, lowestBlock, ElementKinds.blockquote);
8352
+ const hasHandled = handleContinualInsertBreak(editor, lowestBlock, ElementKinds.blockquote);
8351
8353
  if (hasHandled) {
8352
8354
  return;
8353
8355
  }
@@ -8373,7 +8375,7 @@ const createBlockquotePlugin = createPluginFactory({
8373
8375
  key: ElementKinds.blockquote,
8374
8376
  icon: 'blockquote',
8375
8377
  name: '引用',
8376
- active: editor => queries.isBlockActive(editor, ElementKinds.blockquote),
8378
+ active: editor => isBlockActive(editor, ElementKinds.blockquote),
8377
8379
  execute: editor => BlockquoteEditor.toggleBlockquote(editor)
8378
8380
  }
8379
8381
  ],
@@ -8382,7 +8384,7 @@ const createBlockquotePlugin = createPluginFactory({
8382
8384
  key: ElementKinds.blockquote,
8383
8385
  type: ThePluginMenuItemType.group,
8384
8386
  keywords: 'yy,yinyong,quote,引用',
8385
- active: editor => queries.isBlockActive(editor, ElementKinds.blockquote),
8387
+ active: editor => isBlockActive(editor, ElementKinds.blockquote),
8386
8388
  execute: editor => BlockquoteEditor.toggleBlockquote(editor),
8387
8389
  name: '引用',
8388
8390
  description: '支持引用内容',
@@ -8499,7 +8501,7 @@ class TheCode extends TheBaseElement {
8499
8501
  this.maxHeight = isPrintMode(this.editor) ? 0 : 350 - CODEMIRROR_PADDING_TOP * 2;
8500
8502
  }
8501
8503
  openToolbar() {
8502
- if (!queries.isGlobalCollapsed(this.editor) || this.isToolbarOpen) {
8504
+ if (!isGlobalCollapsed(this.editor) || this.isToolbarOpen) {
8503
8505
  return;
8504
8506
  }
8505
8507
  this.toolbarPopoverRef = this.thyPopover.open(this.toolbar, {
@@ -8654,8 +8656,8 @@ const withCode = (editor) => {
8654
8656
  setFragmentData(unit);
8655
8657
  const { selection } = editor;
8656
8658
  const [start] = Editor.edges(editor, selection);
8657
- if (queries.isNodeTypeIn(editor, [ElementKinds.code], { at: start })) {
8658
- const [codeNode] = queries.getAboveByType(editor, ElementKinds.code);
8659
+ if (isNodeTypeIn(editor, [ElementKinds.code], { at: start })) {
8660
+ const [codeNode] = getAboveByType(editor, ElementKinds.code);
8659
8661
  unit.setData('text/plain', codeNode.content.trim());
8660
8662
  return unit;
8661
8663
  }
@@ -8670,7 +8672,7 @@ const createCodePlugin = createPluginFactory({
8670
8672
  key: ElementKinds.code,
8671
8673
  icon: 'code-syntax',
8672
8674
  name: '代码块',
8673
- active: editor => queries.isBlockActive(editor, ElementKinds.code),
8675
+ active: editor => isBlockActive(editor, ElementKinds.code),
8674
8676
  execute: editor => CodeEditor.insertCode(editor)
8675
8677
  }
8676
8678
  ],
@@ -8679,7 +8681,7 @@ const createCodePlugin = createPluginFactory({
8679
8681
  key: ElementKinds.code,
8680
8682
  type: ThePluginMenuItemType.group,
8681
8683
  keywords: 'dmk,daimakuai,code,代码块',
8682
- active: editor => queries.isBlockActive(editor, ElementKinds.code),
8684
+ active: editor => isBlockActive(editor, ElementKinds.code),
8683
8685
  execute: editor => CodeEditor.insertCode(editor),
8684
8686
  name: '代码块',
8685
8687
  description: '支持插入语法高亮的代码',
@@ -8820,7 +8822,7 @@ const withBlockCard = (editor) => {
8820
8822
  const isLeftCursor = isCardLeft(anchorNode);
8821
8823
  const cardEntry = AngularEditor.toSlateCardEntry(editor, anchorNode);
8822
8824
  const cursorRootPath = cardEntry[1];
8823
- transforms.insertParagraph(editor, isLeftCursor ? cursorRootPath : Path.next(cursorRootPath));
8825
+ insertParagraph(editor, isLeftCursor ? cursorRootPath : Path.next(cursorRootPath));
8824
8826
  if (!isLeftCursor) {
8825
8827
  Transforms.select(editor, Path.next(cursorRootPath));
8826
8828
  }
@@ -8840,7 +8842,7 @@ const withBlockCard = (editor) => {
8840
8842
  if (!previousPath) {
8841
8843
  return;
8842
8844
  }
8843
- if (previousPath && queries.isEmptyParagraphByPath(editor, previousPath)) {
8845
+ if (previousPath && isEmptyParagraphByPath(editor, previousPath)) {
8844
8846
  Transforms.removeNodes(editor, {
8845
8847
  at: previousPath
8846
8848
  });
@@ -8852,17 +8854,17 @@ const withBlockCard = (editor) => {
8852
8854
  return;
8853
8855
  }
8854
8856
  else {
8855
- transforms.insertParagraph(editor, cursorRootPath);
8857
+ insertParagraph(editor, cursorRootPath);
8856
8858
  Transforms.select(editor, cursorRootPath);
8857
8859
  Transforms.removeNodes(editor, { at: Path.next(cursorRootPath) });
8858
8860
  return;
8859
8861
  }
8860
8862
  }
8861
- const blockCard = queries.getBlockCardAbove(editor);
8863
+ const blockCard = getBlockCardAbove(editor);
8862
8864
  const beforePoint = Editor.before(editor, editor.selection.anchor);
8863
- const beforeBlockCard = queries.getBlockCardAbove(editor, { at: beforePoint });
8865
+ const beforeBlockCard = getBlockCardAbove(editor, { at: beforePoint });
8864
8866
  if (!blockCard && beforeBlockCard) {
8865
- if (queries.isBlockAboveEmpty(editor)) {
8867
+ if (isBlockAboveEmpty(editor)) {
8866
8868
  const [node, path] = Editor.parent(editor, editor.selection.anchor.path);
8867
8869
  HistoryEditor.withoutMerging(editor, () => {
8868
8870
  const rightCursor = { path: beforeBlockCard[1], offset: FAKE_RIGHT_BLOCK_CARD_OFFSET };
@@ -8886,7 +8888,7 @@ const withBlockCard = (editor) => {
8886
8888
  const cardEntry = AngularEditor.toSlateCardEntry(editor, anchorNode);
8887
8889
  const cursorRootPath = cardEntry[1];
8888
8890
  if (isLeftCursor) {
8889
- transforms.insertParagraph(editor, cursorRootPath);
8891
+ insertParagraph(editor, cursorRootPath);
8890
8892
  Transforms.select(editor, cursorRootPath);
8891
8893
  Transforms.removeNodes(editor, { at: Path.next(cursorRootPath) });
8892
8894
  return;
@@ -8899,11 +8901,11 @@ const withBlockCard = (editor) => {
8899
8901
  return;
8900
8902
  }
8901
8903
  }
8902
- const blockCard = queries.getBlockCardAbove(editor);
8904
+ const blockCard = getBlockCardAbove(editor);
8903
8905
  const afterPoint = Editor.after(editor, editor.selection.anchor);
8904
- const afterBlockCard = queries.getBlockCardAbove(editor, { at: afterPoint });
8906
+ const afterBlockCard = getBlockCardAbove(editor, { at: afterPoint });
8905
8907
  if (!blockCard && afterBlockCard) {
8906
- if (queries.isBlockAboveEmpty(editor)) {
8908
+ if (isBlockAboveEmpty(editor)) {
8907
8909
  HistoryEditor.withoutMerging(editor, () => {
8908
8910
  const leftCursor = { path: afterBlockCard[1], offset: -1 };
8909
8911
  Transforms.select(editor, { anchor: leftCursor, focus: leftCursor });
@@ -8925,14 +8927,14 @@ const withBlockCard = (editor) => {
8925
8927
  const isMoveUp = hotkeys.isMoveUp(nativeEvent);
8926
8928
  const isMoveDown = hotkeys.isMoveDown(nativeEvent);
8927
8929
  const isCollapsed = selection && Range.isCollapsed(selection);
8928
- const anchorEntry = queries.anchorBlockEntry(editor);
8930
+ const anchorEntry = anchorBlockEntry(editor);
8929
8931
  // block card cursor
8930
8932
  if (anchorNode && hasBlockCard(domSelection)) {
8931
8933
  const isCardLeftCursor = isCardLeft(anchorNode);
8932
8934
  if (isMoveUp) {
8933
8935
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8934
8936
  const previousPath = Path.hasPrevious(path) && Path.previous(path);
8935
- const previousNode = previousPath && queries.getNode(editor, previousPath);
8937
+ const previousNode = previousPath && getNode(editor, previousPath);
8936
8938
  if (previousNode && editor.isBlockCard(previousNode)) {
8937
8939
  AngularEditor.moveBlockCard(editor, previousNode, { direction: isCardLeftCursor ? 'left' : 'right' });
8938
8940
  }
@@ -8948,7 +8950,7 @@ const withBlockCard = (editor) => {
8948
8950
  if (isMoveDown) {
8949
8951
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8950
8952
  const nextPath = Path.next(path);
8951
- const nextNode = queries.getNode(editor, nextPath);
8953
+ const nextNode = getNode(editor, nextPath);
8952
8954
  if (nextNode && editor.isBlockCard(nextNode)) {
8953
8955
  AngularEditor.moveBlockCard(editor, nextNode, { direction: isCardLeftCursor ? 'left' : 'right' });
8954
8956
  }
@@ -8966,7 +8968,7 @@ const withBlockCard = (editor) => {
8966
8968
  nativeEvent.preventDefault();
8967
8969
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8968
8970
  const nextPath = Path.next(path);
8969
- const nextNode = queries.getNode(editor, nextPath);
8971
+ const nextNode = getNode(editor, nextPath);
8970
8972
  if (nextNode && editor.isBlockCard(nextNode)) {
8971
8973
  event.preventDefault();
8972
8974
  AngularEditor.moveBlockCard(editor, nextNode, { direction: 'left' });
@@ -8983,7 +8985,7 @@ const withBlockCard = (editor) => {
8983
8985
  nativeEvent.preventDefault();
8984
8986
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8985
8987
  const previousPath = Path.hasPrevious(path) && Path.previous(path);
8986
- const previousNode = previousPath && queries.getNode(editor, previousPath);
8988
+ const previousNode = previousPath && getNode(editor, previousPath);
8987
8989
  if (previousNode && editor.isBlockCard(previousNode)) {
8988
8990
  event.preventDefault();
8989
8991
  AngularEditor.moveBlockCard(editor, previousNode, { direction: 'right' });
@@ -9170,10 +9172,10 @@ const withGetFragment = (editor) => {
9170
9172
  const elementKinds = getPluginOptions(editor, PluginKeys.getFragment)?.types ?? [];
9171
9173
  editor.getFragment = () => {
9172
9174
  const { selection } = editor;
9173
- const containerBlocks = [...elementKinds, ...queries.getContainerBlocks(editor)];
9175
+ const containerBlocks = [...elementKinds, ...getContainerBlocks(editor)];
9174
9176
  if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
9175
9177
  const fragmentData = getFragment();
9176
- const nodes = queries.getSelectionNodesByType(editor, fragmentData, containerBlocks);
9178
+ const nodes = getSelectionNodesByType(editor, fragmentData, containerBlocks);
9177
9179
  return nodes && Element.isElement(nodes) ? nodes.children : fragmentData;
9178
9180
  }
9179
9181
  return getFragment();
@@ -9250,7 +9252,7 @@ const withMoveSelection = (editor) => {
9250
9252
  if (inlineBlockEntry &&
9251
9253
  !(Element.isElement(inlineBlockEntry[0]) && Editor.isVoid(editor, inlineBlockEntry[0])) &&
9252
9254
  selection.anchor.offset === 0) {
9253
- const beforePoint = queries.getPointBefore(editor, selection.focus);
9255
+ const beforePoint = getPointBefore(editor, selection.focus);
9254
9256
  Transforms.select(editor, beforePoint);
9255
9257
  }
9256
9258
  deleteBackward(unit);
@@ -9263,9 +9265,9 @@ const withMoveSelection = (editor) => {
9263
9265
  }
9264
9266
  const isMoveBackward = hotkeys.isMoveBackward(event);
9265
9267
  const isMoveForward = hotkeys.isMoveForward(event);
9266
- const isCollapsed = selection && queries.isCollapsed(selection);
9268
+ const isCollapsed$1 = selection && isCollapsed(selection);
9267
9269
  const isInlineNode = isInline(editor);
9268
- if (isCollapsed && isMoveForward) {
9270
+ if (isCollapsed$1 && isMoveForward) {
9269
9271
  let isInlineCodeBefore = false;
9270
9272
  if (!isInlineNode) {
9271
9273
  try {
@@ -9282,7 +9284,7 @@ const withMoveSelection = (editor) => {
9282
9284
  return;
9283
9285
  }
9284
9286
  }
9285
- if (isCollapsed && isMoveBackward) {
9287
+ if (isCollapsed$1 && isMoveBackward) {
9286
9288
  let isInlineCodeAfter = false;
9287
9289
  if (!isInlineNode) {
9288
9290
  try {
@@ -9323,16 +9325,16 @@ const withRemoveEmpty = (editor) => {
9323
9325
  const { deleteBackward, deleteForward } = editor;
9324
9326
  editor.deleteBackward = unit => {
9325
9327
  const { selection } = editor;
9326
- const anchorBlock = queries.anchorBlock(editor);
9327
- if (!anchorBlock) {
9328
+ const anchorBlock$1 = anchorBlock(editor);
9329
+ if (!anchorBlock$1) {
9328
9330
  deleteBackward(unit);
9329
9331
  return;
9330
9332
  }
9331
9333
  // delete empty paragraphs or empty headings, the default operation is to delete before the void node
9332
9334
  const parentPath = Path.parent(editor.selection.anchor.path);
9333
- const isEmptyHeading = HEADING_TYPES.includes(anchorBlock.type) && Editor.isEmpty(editor, anchorBlock);
9334
- const isEmptyParagraph = queries.isEmptyParagraph(editor, editor.selection.anchor);
9335
- if ((isEmptyParagraph || isEmptyHeading) && parentPath[parentPath.length - 1] > 0) {
9335
+ const isEmptyHeading = HEADING_TYPES.includes(anchorBlock$1.type) && Editor.isEmpty(editor, anchorBlock$1);
9336
+ const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
9337
+ if ((isEmptyParagraph$1 || isEmptyHeading) && parentPath[parentPath.length - 1] > 0) {
9336
9338
  const previousNodeOfParent = Node.get(editor, Path.previous(parentPath));
9337
9339
  if (Element.isElement(previousNodeOfParent) && Editor.isVoid(editor, previousNodeOfParent)) {
9338
9340
  Transforms.delete(editor, { at: editor.selection.anchor.path.slice(0, editor.selection.anchor.path.length - 1) });
@@ -9354,10 +9356,10 @@ const withRemoveEmpty = (editor) => {
9354
9356
  deleteBackward(unit);
9355
9357
  };
9356
9358
  editor.deleteForward = unit => {
9357
- const anchorBlockEntry = queries.anchorBlockEntry(editor);
9358
- if (anchorBlockEntry &&
9359
- queries.isAncestorEmpty(editor, anchorBlockEntry[0]) &&
9360
- queries.getNode(editor, Path.next(anchorBlockEntry[1]))) {
9359
+ const anchorBlockEntry$1 = anchorBlockEntry(editor);
9360
+ if (anchorBlockEntry$1 &&
9361
+ isAncestorEmpty(editor, anchorBlockEntry$1[0]) &&
9362
+ getNode(editor, Path.next(anchorBlockEntry$1[1]))) {
9361
9363
  const pathRef = Editor.pathRef(editor, Path.parent(editor.selection.anchor.path));
9362
9364
  HistoryEditor.withoutMerging(editor, () => {
9363
9365
  Transforms.move(editor);
@@ -9377,7 +9379,7 @@ const createRemoveEmptyPlugin = createPluginFactory({
9377
9379
  const withRemoveVoid = (editor) => {
9378
9380
  const { deleteBackward, deleteForward, onKeydown } = editor;
9379
9381
  const deleteBlockVoid = (e) => {
9380
- const aboveEntry = queries.getAbove(e);
9382
+ const aboveEntry = getAbove(e);
9381
9383
  const canDelete = aboveEntry && Element.isElement(aboveEntry[0]) && Editor.isBlock(e, aboveEntry[0]) && Editor.isVoid(e, aboveEntry[0]);
9382
9384
  if (canDelete) {
9383
9385
  Transforms.insertNodes(e, createEmptyParagraph(), { at: Path.next(aboveEntry[1]) });
@@ -9393,7 +9395,7 @@ const withRemoveVoid = (editor) => {
9393
9395
  deleteBackward(unit);
9394
9396
  };
9395
9397
  editor.onKeydown = event => {
9396
- const aboveEntry = queries.getAbove(editor);
9398
+ const aboveEntry = getAbove(editor);
9397
9399
  if (aboveEntry &&
9398
9400
  Element.isElement(aboveEntry[0]) &&
9399
9401
  Editor.isVoid(editor, aboveEntry[0]) &&
@@ -9432,7 +9434,7 @@ const withResetType = (editor) => {
9432
9434
  editor.onKeydown = (event) => {
9433
9435
  const { selection } = editor;
9434
9436
  if (IS_SAFARI && selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
9435
- const blockEntry = queries.getAboveByType(editor, BLOCK_DELETE_BACKWARD_TYPES);
9437
+ const blockEntry = getAboveByType(editor, BLOCK_DELETE_BACKWARD_TYPES);
9436
9438
  if (blockEntry && blockEntry[0]) {
9437
9439
  const isStart = Editor.isStart(editor, selection.anchor, blockEntry[1]);
9438
9440
  if (isStart) {
@@ -9509,7 +9511,7 @@ const createDeserializeHTMLPlugin = createPluginFactory({
9509
9511
  const withDeserializeMd = (editor) => {
9510
9512
  const { insertData, onKeydown } = editor;
9511
9513
  editor.onKeydown = (event) => {
9512
- transforms.closeConversionHint(editor);
9514
+ closeConversionHint(editor);
9513
9515
  onKeydown(event);
9514
9516
  };
9515
9517
  editor.insertData = (data) => {
@@ -9519,7 +9521,7 @@ const withDeserializeMd = (editor) => {
9519
9521
  const plainFragment = data.getData('text/plain');
9520
9522
  const slateFragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
9521
9523
  const oldRange = editor.selection;
9522
- transforms.closeConversionHint(editor);
9524
+ closeConversionHint(editor);
9523
9525
  if (plainFragment && isMarkdownStynx(plainFragment) && !slateFragment) {
9524
9526
  setTimeout(() => {
9525
9527
  const overlay = editor.injector.get(Overlay);
@@ -9537,7 +9539,7 @@ const withDeserializeMd = (editor) => {
9537
9539
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
9538
9540
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
9539
9541
  if (!isUnformatted(fragment)) {
9540
- transforms.closeConversionHint(editor);
9542
+ closeConversionHint(editor);
9541
9543
  editor.undo();
9542
9544
  setTimeout(() => {
9543
9545
  Transforms.select(editor, oldRange);
@@ -9560,11 +9562,11 @@ const withDeserializeMd = (editor) => {
9560
9562
  return;
9561
9563
  }
9562
9564
  else {
9563
- transforms.closeConversionHint(editor);
9565
+ closeConversionHint(editor);
9564
9566
  }
9565
9567
  }
9566
9568
  catch (error) {
9567
- transforms.closeConversionHint(editor);
9569
+ closeConversionHint(editor);
9568
9570
  }
9569
9571
  }
9570
9572
  },
@@ -9632,7 +9634,7 @@ const FontSizeEditor = {
9632
9634
  setFontSize(editor, size) {
9633
9635
  const contextService = editor.injector.get(TheContextService);
9634
9636
  const defaultFontSize = contextService.getDefaultFontSize();
9635
- const marks = queries.getSelectionMarks(editor);
9637
+ const marks = getSelectionMarks(editor);
9636
9638
  const fontSizeMark = marks[MarkTypes.fontSize];
9637
9639
  const isDefaultFontSize = size === defaultFontSize;
9638
9640
  if (!fontSizeMark && isDefaultFontSize) {
@@ -9660,14 +9662,14 @@ const FontSizeEditor = {
9660
9662
  return;
9661
9663
  }
9662
9664
  // unset paragraph text fontSize
9663
- transforms.setMarks(editor, {
9665
+ setMarks(editor, {
9664
9666
  [MarkTypes.fontSize]: null
9665
9667
  }, editor.selection);
9666
9668
  },
9667
9669
  isFontSizeActive(editor, size) {
9668
9670
  if (editor.selection) {
9669
- const anchorBlock = queries.anchorBlock(editor);
9670
- switch (anchorBlock?.type) {
9671
+ const anchorBlock$1 = anchorBlock(editor);
9672
+ switch (anchorBlock$1?.type) {
9671
9673
  case ElementKinds.heading_1:
9672
9674
  return size === FontSizes.fontSize28;
9673
9675
  case ElementKinds.heading_2:
@@ -9681,7 +9683,7 @@ const FontSizeEditor = {
9681
9683
  case ElementKinds.heading_6:
9682
9684
  return size === FontSizes.fontSize14;
9683
9685
  case ElementKinds.paragraph:
9684
- const marks = queries.getSelectionMarks(editor);
9686
+ const marks = getSelectionMarks(editor);
9685
9687
  const fontSizeMark = marks[MarkTypes.fontSize];
9686
9688
  return Number(size) === fontSizeMark;
9687
9689
  default:
@@ -9722,7 +9724,7 @@ const withHeading = (editor) => {
9722
9724
  const { insertBreak } = editor;
9723
9725
  editor.insertBreak = () => {
9724
9726
  const { selection } = editor;
9725
- const anchorBlock = queries.getAnchorBlockEntry(editor);
9727
+ const anchorBlock = getAnchorBlockEntry(editor);
9726
9728
  if (anchorBlock && Range.isCollapsed(selection) && anchorBlock[0].type.startsWith('heading')) {
9727
9729
  if (Editor.isStart(editor, selection.anchor, anchorBlock[1])) {
9728
9730
  insertBreak();
@@ -9760,7 +9762,7 @@ const createHeadingPlugin = createPluginFactory({
9760
9762
  name: '正文',
9761
9763
  styles: { height: '40px' },
9762
9764
  execute: editor => Transforms.setNodes(editor, { type: ElementKinds.paragraph }),
9763
- active: editor => queries.isParagraph(editor)
9765
+ active: editor => isParagraph(editor)
9764
9766
  },
9765
9767
  {
9766
9768
  key: ElementKinds.heading_1,
@@ -9912,7 +9914,7 @@ const createHrPlugin = createPluginFactory({
9912
9914
  key: ElementKinds.hr,
9913
9915
  icon: 'horizontal-line',
9914
9916
  name: '分割线',
9915
- active: editor => queries.isBlockActive(editor, ElementKinds.hr),
9917
+ active: editor => isBlockActive(editor, ElementKinds.hr),
9916
9918
  execute: editor => HrEditor.insertHr(editor)
9917
9919
  }
9918
9920
  ],
@@ -9921,7 +9923,7 @@ const createHrPlugin = createPluginFactory({
9921
9923
  key: ElementKinds.hr,
9922
9924
  keywords: 'fengexian,fgx,divider,line,分割线',
9923
9925
  type: ThePluginMenuItemType.group,
9924
- active: editor => queries.isBlockActive(editor, ElementKinds.hr),
9926
+ active: editor => isBlockActive(editor, ElementKinds.hr),
9925
9927
  execute: editor => HrEditor.insertHr(editor),
9926
9928
  name: '分割线',
9927
9929
  menuIcon: PluginMenuIcons.hr,
@@ -10214,13 +10216,13 @@ class TheImage extends TheBaseElement {
10214
10216
  return (!this?.readonly &&
10215
10217
  richMedia &&
10216
10218
  this.isCollapsedAndNonReadonly &&
10217
- queries.isGlobalCollapsed(this.editor) &&
10219
+ isGlobalCollapsed(this.editor) &&
10218
10220
  !this.uploading &&
10219
10221
  !this.isOpen);
10220
10222
  }
10221
10223
  isShouldClose() {
10222
10224
  return (this.isOpen &&
10223
- (this?.readonly || !this.isCollapsedAndNonReadonly || !queries.isGlobalCollapsed(this.editor) || this.uploading));
10225
+ (this?.readonly || !this.isCollapsedAndNonReadonly || !isGlobalCollapsed(this.editor) || this.uploading));
10224
10226
  }
10225
10227
  openLayoutToolbar() {
10226
10228
  if (!this.img) {
@@ -11003,385 +11005,161 @@ const createLinkPlugin = createPluginFactory({
11003
11005
  }
11004
11006
  });
11005
11007
 
11006
- const isList = (n) => {
11007
- return [...LIST_BLOCK_TYPES].includes(n.type);
11008
- };
11009
-
11010
- const isInList = (editor, at = editor.selection) => {
11011
- return queries.isNodeTypeIn(editor, [ElementKinds.numberedList, ElementKinds.bulletedList], { at });
11012
- };
11013
-
11014
- /**
11015
- * Is the list nested, i.e. its parent is a list item.
11016
- */
11017
- const isListNested = (editor, listPath, options) => {
11018
- const [listParentNode] = Editor.parent(editor, listPath);
11019
- return listParentNode.type === ElementKinds.listItem;
11020
- };
11021
-
11022
- const getListTypes = () => {
11023
- return [ElementKinds.bulletedList, ElementKinds.numberedList];
11024
- };
11025
-
11026
- /**
11027
- * 获取 List 中 ListItems,过滤掉空列表嵌套
11028
- * @param node
11029
- * @param initialValue
11030
- * @returns
11031
- */
11032
- const getStartListItem = (node, initialValue) => {
11033
- if (!initialValue) {
11034
- initialValue = [];
11008
+ class TheBulletedList extends TheBaseElement {
11009
+ get level() {
11010
+ return this.element?.indent || null;
11035
11011
  }
11036
- if (node) {
11037
- return node.reduce((result, current) => {
11038
- if (current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type)) {
11039
- result.push(current);
11040
- }
11041
- else {
11042
- if (current.children) {
11043
- getStartListItem(current.children, result);
11044
- }
11045
- }
11046
- return result;
11047
- }, initialValue);
11012
+ constructor(elementRef, cdr) {
11013
+ super(elementRef, cdr);
11014
+ this.elementRef = elementRef;
11015
+ this.cdr = cdr;
11048
11016
  }
11049
- };
11050
-
11051
- /**
11052
- *
11053
- */
11054
- const hasListInListItem = (listItemNode) => {
11055
- const sublist = listItemNode.children.find(n => match(n, { type: getListTypes() }));
11056
- return listItemNode.children.length > 1 && sublist;
11057
- };
11058
- /**
11059
- * p + ul/ol structure
11060
- * @param listItemNode
11061
- */
11062
- const hasStableListInListItem = (listItemNode) => {
11063
- const sublist = listItemNode.children.find(n => match(n, { type: getListTypes() }));
11064
- return listItemNode.children.length === 2 && sublist;
11065
- };
11066
- /**
11067
- * li + p structure
11068
- * @param listItemNode
11069
- */
11070
- const hasStableListItem = (listItemNode) => {
11071
- const type = listItemNode.children[0].type;
11072
- return listItemNode.children.length === 1 && type === ElementKinds.paragraph;
11073
- };
11074
-
11075
- /**
11076
- * list 中 是否是单个listItem,且listItem没有子列表
11077
- */
11078
- const isSingleListItem = (list) => {
11079
- return isNodeTypeList(list) && list.children.length === 1 && !hasListInListItem(list.children[0]);
11080
- };
11081
-
11082
- /**
11083
- * 如果at(默认= selection)位于ul> li> p中,则返回li和ul节点条目。
11084
- */
11085
- const getListItemEntry = (editor, { at = editor.selection } = {}) => {
11086
- if (at && queries.isNodeTypeIn(editor, ElementKinds.listItem, { at })) {
11087
- const selectionParent = queries.getParent(editor, at);
11088
- if (!selectionParent)
11089
- return;
11090
- const [, paragraphPath] = selectionParent;
11091
- const listItem = queries.getAboveByType(editor, ElementKinds.listItem, { at }) || queries.getParent(editor, paragraphPath);
11092
- if (!listItem)
11093
- return;
11094
- const [listItemNode, listItemPath] = listItem;
11095
- if (listItemNode.type !== ElementKinds.listItem)
11096
- return;
11097
- const list = queries.getParent(editor, listItemPath);
11098
- if (!list || !isList(list[0]))
11099
- return;
11100
- return {
11101
- list,
11102
- listItem
11103
- };
11017
+ ngOnInit() {
11018
+ super.ngOnInit();
11104
11019
  }
11105
- };
11106
-
11107
- /**
11108
- * Is the selection focus at the start of its parent block.
11109
- */
11110
- const isSelectionAtListItemStart = (editor) => {
11111
- const listItemEntry = queries.getAboveByType(editor, [ElementKinds.listItem]);
11112
- if (listItemEntry) {
11113
- return queries.isStart(editor, editor.selection.focus, listItemEntry[1]);
11020
+ ngOnDestroy() {
11021
+ super.ngOnDestroy();
11114
11022
  }
11115
- return false;
11116
- };
11117
-
11118
- const insertListData = (editor, { fromList, toListItemEntry }) => {
11119
- const { children } = fromList;
11120
- const [toListItem, toListItemPath] = toListItemEntry;
11121
- const nextListItemPath = Path.next(toListItemPath);
11122
- const toListItemIsEmptyParagraph = queries.isEmptyParagraph(editor, editor.selection.anchor);
11123
- const hasSubList = hasListInListItem(toListItem);
11124
- let selectPath = [...toListItemPath];
11125
- const liIndex = selectPath.pop();
11126
- selectPath = [...selectPath, liIndex + children.length];
11127
- Editor.withoutNormalizing(editor, () => {
11128
- if (toListItemIsEmptyParagraph && hasSubList) {
11129
- Transforms.insertNodes(editor, children, { at: nextListItemPath });
11130
- }
11131
- else {
11132
- const insertListItemPath = toListItemIsEmptyParagraph ? toListItemPath : nextListItemPath;
11133
- // 如果粘贴目标listItem为空,则先删除listItem
11134
- if (toListItemIsEmptyParagraph) {
11135
- Transforms.removeNodes(editor, { at: insertListItemPath });
11136
- selectPath = Path.previous(selectPath);
11137
- }
11138
- Transforms.insertNodes(editor, children, { at: insertListItemPath });
11139
- }
11140
- /**
11141
- * 粘贴目标lisItem有子列表
11142
- */
11143
- if (hasSubList) {
11144
- const paragraphPath = toListItemPath.concat([0]);
11145
- const nextSubListPath = Path.next(paragraphPath);
11146
- // 判断粘贴数据是否是多级
11147
- if (hasListInListItem(fromList.children[0])) {
11148
- // 设置粘贴后正确选区
11149
- Transforms.select(editor, Editor.end(editor, nextListItemPath));
11150
- // 获取当前选区所在listItem entry
11151
- const currentListItemEntry = getListItemEntry(editor, {});
11152
- // 获取粘贴目标listItem中的子列表
11153
- const { children: subListChildren } = Node.get(editor, nextSubListPath);
11154
- /**
11155
- * 复制子列表数据
11156
- * 之所以是复制,而不是移动,因为无法单纯一次性移动子列表的所有listItem(不包含subList本身)到目标位置,
11157
- * 需要循环移动才可以
11158
- **/
11159
- Transforms.insertNodes(editor, subListChildren, {
11160
- at: Path.next(currentListItemEntry.listItem[1])
11161
- });
11162
- // 删除已被复制后无用的listItem/listItem subList
11163
- Transforms.delete(editor, {
11164
- at: toListItemIsEmptyParagraph ? toListItemPath : nextSubListPath
11165
- });
11166
- return;
11167
- }
11168
- Transforms.select(editor, Editor.end(editor, selectPath));
11169
- // 粘贴数据不是多级
11170
- const currentListItemEntry = getListItemEntry(editor, {});
11171
- Transforms.moveNodes(editor, {
11172
- at: nextSubListPath,
11173
- to: currentListItemEntry.listItem[1].concat(1)
11174
- });
11175
- if (toListItemIsEmptyParagraph) {
11176
- Transforms.delete(editor, { at: toListItemPath });
11177
- }
11178
- return;
11179
- }
11180
- });
11181
- // 粘贴目标listItem没有子列表, 设置选区
11182
- Transforms.select(editor, Editor.end(editor, selectPath));
11183
- return;
11184
- };
11023
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheBulletedList, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
11024
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheBulletedList, isStandalone: true, selector: "ul[theUl]", host: { properties: { "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
11025
+ }
11026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheBulletedList, decorators: [{
11027
+ type: Component,
11028
+ args: [{
11029
+ selector: 'ul[theUl]',
11030
+ template: ``,
11031
+ standalone: true
11032
+ }]
11033
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { level: [{
11034
+ type: HostBinding,
11035
+ args: ['attr.the-level']
11036
+ }] } });
11185
11037
 
11186
- /**
11187
- * 将列表项移到其父项旁边。
11188
- * 父项应为列表项。
11189
- */
11190
- const moveListItemUp = (editor, { list, listItem }, options) => {
11191
- const [listNode, listPath] = list;
11192
- const [, listItemPath] = listItem;
11193
- const listParentEntry = queries.getParent(editor, listPath);
11194
- if (!listParentEntry)
11195
- return;
11196
- const [listParentNode, listParentPath] = listParentEntry;
11197
- if (listParentNode.type !== ElementKinds.listItem) {
11198
- return;
11038
+ class TheListItem extends TheBaseElement {
11039
+ constructor(elementRef, cdr) {
11040
+ super(elementRef, cdr);
11041
+ this.elementRef = elementRef;
11042
+ this.cdr = cdr;
11199
11043
  }
11200
- Editor.withoutNormalizing(editor, () => {
11201
- const newListItemPath = Path.next(listParentPath);
11202
- // 将 item 上移一层
11203
- Transforms.moveNodes(editor, {
11204
- at: listItemPath,
11205
- to: newListItemPath
11206
- });
11207
- /**
11208
- * 将下一个兄弟节点移动到新列表
11209
- */
11210
- const listItemIdx = listItemPath[listItemPath.length - 1];
11211
- const siblingPath = [...listItemPath];
11212
- const newListPath = newListItemPath.concat(1);
11213
- let siblingFound = false;
11214
- let newSiblingIdx = 0;
11215
- listNode.children.forEach((n, idx) => {
11216
- if (listItemIdx < idx) {
11217
- if (!siblingFound) {
11218
- siblingFound = true;
11219
- Transforms.insertNodes(editor, {
11220
- type: listNode.type,
11221
- children: []
11222
- }, { at: newListPath });
11223
- }
11224
- siblingPath[siblingPath.length - 1] = listItemIdx;
11225
- const newSiblingsPath = newListPath.concat(newSiblingIdx);
11226
- newSiblingIdx++;
11227
- Transforms.moveNodes(editor, {
11228
- at: siblingPath,
11229
- to: newSiblingsPath
11230
- });
11231
- }
11232
- });
11233
- // 处理listItem下方有段落的情况
11234
- const listIndex = listParentNode.children.findIndex(item => item.key === listNode.key);
11235
- const behindNode = listParentNode.children.slice(listIndex + 1);
11236
- if (behindNode.length > 0) {
11237
- const nextPath = Path.next(newListItemPath);
11238
- Transforms.insertNodes(editor, {
11239
- type: ElementKinds.listItem,
11240
- children: []
11241
- }, { at: nextPath });
11242
- const moveStartPath = queries.findPath(editor, behindNode[0]);
11243
- const moveEndPath = queries.findPath(editor, behindNode[behindNode.length - 1]);
11244
- const moveRange = Editor.range(editor, moveStartPath, moveEndPath);
11245
- Transforms.moveNodes(editor, {
11246
- at: moveRange,
11247
- to: nextPath.concat(0),
11248
- match: node => behindNode.includes(node)
11249
- });
11250
- }
11251
- // 删除子列表(如果它是第一个列表项)
11252
- if (!listItemIdx) {
11253
- Transforms.removeNodes(editor, {
11254
- at: listPath
11255
- });
11256
- }
11257
- });
11258
- return true;
11259
- };
11260
-
11261
- /**
11262
- * Insert list item if selection in li>p.
11263
- */
11264
- const insertListItem = (editor) => {
11265
- if (editor.selection && !queries.isRangeAtRoot(editor.selection)) {
11266
- const paragraphEntry = queries.getAboveByType(editor, ElementKinds.paragraph);
11267
- if (!paragraphEntry) {
11268
- return;
11044
+ ngOnInit() {
11045
+ super.ngOnInit();
11046
+ }
11047
+ onContextChange() {
11048
+ super.onContextChange();
11049
+ this.addFontSize();
11050
+ this.addMultiDigit();
11051
+ }
11052
+ ngOnDestroy() {
11053
+ super.ngOnDestroy();
11054
+ }
11055
+ addFontSize() {
11056
+ let firstText;
11057
+ for (const entry of Node.descendants(this.element)) {
11058
+ const node = entry[0];
11059
+ if (Text.isText(node) && !firstText) {
11060
+ firstText = node;
11061
+ break;
11062
+ }
11269
11063
  }
11270
- const [, paragraphPath] = paragraphEntry;
11271
- const [listItemNode, listItemPath] = Editor.parent(editor, paragraphPath);
11272
- if (Element.isElement(listItemNode) && listItemNode.type !== ElementKinds.listItem) {
11064
+ if (!firstText) {
11273
11065
  return;
11274
11066
  }
11275
- if (!Range.isCollapsed(editor.selection)) {
11276
- Transforms.delete(editor);
11277
- }
11278
- const isEnd = queries.isBlockTextEmptyAfterSelection(editor);
11279
- const nextNodePath = Path.next(paragraphPath);
11280
- const nextListItemPath = Path.next(listItemPath);
11281
- const nextEnd = Editor.end(editor, listItemPath);
11282
- /**
11283
- * If not end, split nodes, wrap a list item on the new paragraph and move it to the next list item
11284
- */
11285
- if (!isEnd) {
11286
- Editor.withoutNormalizing(editor, () => {
11287
- Transforms.splitNodes(editor, { at: editor.selection, always: true });
11288
- Transforms.wrapNodes(editor, {
11289
- type: ElementKinds.listItem,
11290
- children: []
11291
- }, { at: nextNodePath });
11292
- Transforms.moveNodes(editor, {
11293
- at: nextNodePath,
11294
- to: nextListItemPath
11295
- });
11296
- });
11067
+ const { text, ...rest } = firstText;
11068
+ const size = rest[MarkTypes.fontSize];
11069
+ if (size) {
11070
+ const sizeClass = `font-size-${size}`;
11071
+ const isContains = this.elementRef.nativeElement?.classList?.contains(sizeClass);
11072
+ if (isContains) {
11073
+ return;
11074
+ }
11075
+ this.clearFontSize();
11076
+ this.elementRef.nativeElement.classList.add(sizeClass);
11077
+ this.fontSizeClass = sizeClass;
11297
11078
  }
11298
11079
  else {
11299
- /**
11300
- * If end, split nodes
11301
- */
11302
- Editor.withoutNormalizing(editor, () => {
11303
- Transforms.splitNodes(editor, {
11304
- always: true,
11305
- mode: 'highest',
11306
- match: node => {
11307
- const path = node && TheEditor.findPath(editor, node);
11308
- return path && path.length === nextListItemPath.length;
11309
- }
11310
- });
11311
- });
11080
+ this.clearFontSize();
11312
11081
  }
11313
- /**
11314
- * If there is a list in the list item, move it to the next list item
11315
- */
11316
- if (queries.getNode(editor, nextNodePath)) {
11317
- Transforms.moveNodes(editor, {
11318
- at: Editor.range(editor, nextNodePath, nextEnd),
11319
- to: nextListItemPath.concat(1),
11320
- match: node => {
11321
- // TODO: types
11322
- return listItemNode.children.includes(node);
11323
- }
11324
- });
11082
+ }
11083
+ clearFontSize() {
11084
+ if (this.fontSizeClass) {
11085
+ this.elementRef.nativeElement.classList.remove(this.fontSizeClass);
11086
+ this.fontSizeClass = null;
11325
11087
  }
11326
- return true;
11327
11088
  }
11328
- };
11329
-
11330
- const unwrapList = (editor) => {
11331
- Editor.withoutNormalizing(editor, () => {
11332
- transforms.unwrapNodesByType(editor, ElementKinds.listItem);
11333
- transforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true });
11334
- });
11335
- };
11336
-
11337
- /**
11338
- * 获取 listItem 内的列表(如果存在).
11339
- * 它采用以下结构:ul> li > span + ul
11340
- */
11341
- const getListItemSublist = (listItem, options) => {
11342
- const [listItemNode, listItemPath] = listItem;
11343
- if (hasListInListItem(listItemNode)) {
11344
- return [listItemNode.children[1], listItemPath.concat([1])];
11089
+ getStart() {
11090
+ const parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
11091
+ const start = parent?.getAttribute('start') || 1;
11092
+ return Number(start);
11345
11093
  }
11346
- };
11094
+ getLiIndex() {
11095
+ const path = findPath(this.editor, this.element);
11096
+ const index = path[path.length - 1];
11097
+ return index || 0;
11098
+ }
11099
+ addMultiDigit() {
11100
+ const start = this.getStart();
11101
+ const index = this.getLiIndex();
11102
+ const multiDigit = 'data-multi-digit';
11103
+ // start number + index
11104
+ // when it is greater than 9, it is a multi-digit serial number
11105
+ // exclude Font size >= 20
11106
+ if (start + index > 9) {
11107
+ this.elementRef.nativeElement.setAttribute(multiDigit, true);
11108
+ }
11109
+ else {
11110
+ this.elementRef.nativeElement.removeAttribute(multiDigit);
11111
+ }
11112
+ }
11113
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheListItem, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
11114
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheListItem, isStandalone: true, selector: "li[theLi]", usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
11115
+ }
11116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheListItem, decorators: [{
11117
+ type: Component,
11118
+ args: [{
11119
+ selector: 'li[theLi]',
11120
+ template: ``,
11121
+ standalone: true
11122
+ }]
11123
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
11347
11124
 
11348
- /**
11349
- * Move fromListItem sublist list items to the end of `toListItem` sublist.
11350
- * If there is no `toListItem` sublist, insert one.
11351
- */
11352
- const moveListItemSublistItemsToListItemSublist = (editor, { fromListItem, toListItem, start }, options) => {
11353
- const [, fromListItemPath] = fromListItem;
11354
- const [toListItemNode, toListItemPath] = toListItem;
11355
- const fromListItemSublist = getListItemSublist(fromListItem, options);
11356
- if (!fromListItemSublist)
11357
- return 0;
11358
- const [, fromListItemSublistPath] = fromListItemSublist;
11359
- const toListItemSublist = getListItemSublist(toListItem, options);
11360
- let to;
11361
- if (!toListItemSublist) {
11362
- const fromList = queries.getParent(editor, fromListItemPath);
11363
- if (!fromList)
11364
- return 0;
11365
- const [fromListNode] = fromList;
11366
- const fromListType = fromListNode.type;
11367
- const toListItemSublistPath = toListItemPath.concat([toListItemNode.children.length]);
11368
- Transforms.insertNodes(editor, { type: fromListType, children: [] }, { at: toListItemSublistPath });
11369
- to = toListItemSublistPath.concat([0]);
11125
+ class TheNumberedList extends TheBaseElement {
11126
+ get start() {
11127
+ return this.element.start;
11370
11128
  }
11371
- else if (start) {
11372
- const [, toListItemSublistPath] = toListItemSublist;
11373
- to = toListItemSublistPath.concat([0]);
11129
+ get level() {
11130
+ return this.element?.indent || null;
11374
11131
  }
11375
- else {
11376
- to = Path.next(queries.getLastChildPath(toListItemSublist));
11132
+ constructor(elementRef, cdr) {
11133
+ super(elementRef, cdr);
11134
+ this.elementRef = elementRef;
11135
+ this.cdr = cdr;
11377
11136
  }
11378
- const moved = moveChildren(editor, {
11379
- at: Path.previous(fromListItemSublistPath),
11380
- to
11381
- });
11382
- // Remove the empty list
11383
- Transforms.delete(editor, { at: fromListItemPath });
11384
- return moved;
11137
+ ngOnInit() {
11138
+ super.ngOnInit();
11139
+ }
11140
+ ngOnDestroy() {
11141
+ super.ngOnDestroy();
11142
+ }
11143
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheNumberedList, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
11144
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheNumberedList, isStandalone: true, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
11145
+ }
11146
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheNumberedList, decorators: [{
11147
+ type: Component,
11148
+ args: [{
11149
+ selector: 'ol[theOl]',
11150
+ template: ``,
11151
+ standalone: true
11152
+ }]
11153
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { start: [{
11154
+ type: HostBinding,
11155
+ args: ['attr.start']
11156
+ }], level: [{
11157
+ type: HostBinding,
11158
+ args: ['attr.the-level']
11159
+ }] } });
11160
+
11161
+ const getListTypes = () => {
11162
+ return [ElementKinds.bulletedList, ElementKinds.numberedList];
11385
11163
  };
11386
11164
 
11387
11165
  const normalizeListItem = (editor, { nodeEntry }) => {
@@ -11399,6 +11177,10 @@ const normalizeListItem = (editor, { nodeEntry }) => {
11399
11177
  }
11400
11178
  };
11401
11179
 
11180
+ const isList = (n) => {
11181
+ return [...LIST_BLOCK_TYPES].includes(n.type);
11182
+ };
11183
+
11402
11184
  // 列表续号
11403
11185
  const normalizeNo = (editor, nodeEntry) => {
11404
11186
  const [listNode, listPath] = nodeEntry;
@@ -11409,9 +11191,9 @@ const normalizeNo = (editor, nodeEntry) => {
11409
11191
  * 如果为同类型list,则把nextList children移动到当前list的尾部, 并删除nextList
11410
11192
  */
11411
11193
  const nextPath = Path.next(listPath);
11412
- const nextNode = queries.getNode(editor, nextPath);
11194
+ const nextNode = getNode(editor, nextPath);
11413
11195
  if (nextNode && Element.isElement(nextNode) && Element.isElement(listNode) && nextNode.type === listNode.type) {
11414
- transforms.moveChildren(editor, {
11196
+ moveChildren(editor, {
11415
11197
  at: [nextNode, nextPath],
11416
11198
  to: listPath.concat(listNode.children.length)
11417
11199
  });
@@ -11423,11 +11205,11 @@ const normalizeNo = (editor, nodeEntry) => {
11423
11205
  * 获取prevList判断是否为同类型list
11424
11206
  * 如果为同类型list,则把当前list children移动到prevList的尾部, 并删除当前List
11425
11207
  */
11426
- const currentListNode = queries.getNode(editor, listPath);
11208
+ const currentListNode = getNode(editor, listPath);
11427
11209
  const prevPath = Path.previous(listPath);
11428
- const prevNode = queries.getNode(editor, prevPath);
11210
+ const prevNode = getNode(editor, prevPath);
11429
11211
  if (prevNode && Element.isElement(prevNode) && Element.isElement(currentListNode) && prevNode.type === currentListNode.type) {
11430
- transforms.moveChildren(editor, {
11212
+ moveChildren(editor, {
11431
11213
  at: [currentListNode, listPath],
11432
11214
  to: prevPath.concat(prevNode.children.length)
11433
11215
  });
@@ -11438,43 +11220,92 @@ const normalizeNo = (editor, nodeEntry) => {
11438
11220
  });
11439
11221
  return moved;
11440
11222
  };
11441
-
11223
+
11224
+ /**
11225
+ * Normalize list node to force the ul>li>p+ul structure.
11226
+ */
11227
+ const getListNormalizer = (editor, { validLiChildrenTypes }) => {
11228
+ const { normalizeNode } = editor;
11229
+ return ([node, path]) => {
11230
+ // 不是选区, 执行续号检测操作
11231
+ if (isList(node) && !TheHistoryEditor.isUndoing(editor)) {
11232
+ const moved = normalizeNo(editor, [node, path]);
11233
+ if (moved) {
11234
+ return;
11235
+ }
11236
+ }
11237
+ if (match(node, { type: getListTypes() })) {
11238
+ if (Element.isElement(node) && !node.children.length) {
11239
+ return Transforms.removeNodes(editor, { at: path });
11240
+ }
11241
+ }
11242
+ // normalize list item
11243
+ // 1. list-item at least one child
11244
+ // 2. list-item first child is not list
11245
+ if (Element.isElement(node) && node.type === ElementKinds.listItem) {
11246
+ if (normalizeListItem(editor, { nodeEntry: [node, path] })) {
11247
+ // Tree changed - kick off another normalization
11248
+ return;
11249
+ }
11250
+ }
11251
+ normalizeNode([node, path]);
11252
+ };
11253
+ };
11254
+
11255
+ /**
11256
+ * 如果at(默认= selection)位于ul> li> p中,则返回li和ul节点条目。
11257
+ */
11258
+ const getListItemEntry = (editor, { at = editor.selection } = {}) => {
11259
+ if (at && isNodeTypeIn(editor, ElementKinds.listItem, { at })) {
11260
+ const selectionParent = getParent(editor, at);
11261
+ if (!selectionParent)
11262
+ return;
11263
+ const [, paragraphPath] = selectionParent;
11264
+ const listItem = getAboveByType(editor, ElementKinds.listItem, { at }) || getParent(editor, paragraphPath);
11265
+ if (!listItem)
11266
+ return;
11267
+ const [listItemNode, listItemPath] = listItem;
11268
+ if (listItemNode.type !== ElementKinds.listItem)
11269
+ return;
11270
+ const list = getParent(editor, listItemPath);
11271
+ if (!list || !isList(list[0]))
11272
+ return;
11273
+ return {
11274
+ list,
11275
+ listItem
11276
+ };
11277
+ }
11278
+ };
11279
+
11280
+ /**
11281
+ *
11282
+ */
11283
+ const hasListInListItem = (listItemNode) => {
11284
+ const sublist = listItemNode.children.find(n => match(n, { type: getListTypes() }));
11285
+ return listItemNode.children.length > 1 && sublist;
11286
+ };
11287
+ /**
11288
+ * p + ul/ol structure
11289
+ * @param listItemNode
11290
+ */
11291
+ const hasStableListInListItem = (listItemNode) => {
11292
+ const sublist = listItemNode.children.find(n => match(n, { type: getListTypes() }));
11293
+ return listItemNode.children.length === 2 && sublist;
11294
+ };
11442
11295
  /**
11443
- * Normalize list node to force the ul>li>p+ul structure.
11296
+ * li + p structure
11297
+ * @param listItemNode
11444
11298
  */
11445
- const getListNormalizer = (editor, { validLiChildrenTypes }) => {
11446
- const { normalizeNode } = editor;
11447
- return ([node, path]) => {
11448
- // 不是选区, 执行续号检测操作
11449
- if (isList(node) && !TheHistoryEditor.isUndoing(editor)) {
11450
- const moved = normalizeNo(editor, [node, path]);
11451
- if (moved) {
11452
- return;
11453
- }
11454
- }
11455
- if (match(node, { type: getListTypes() })) {
11456
- if (Element.isElement(node) && !node.children.length) {
11457
- return Transforms.removeNodes(editor, { at: path });
11458
- }
11459
- }
11460
- // normalize list item
11461
- // 1. list-item at least one child
11462
- // 2. list-item first child is not list
11463
- if (Element.isElement(node) && node.type === ElementKinds.listItem) {
11464
- if (normalizeListItem(editor, { nodeEntry: [node, path] })) {
11465
- // Tree changed - kick off another normalization
11466
- return;
11467
- }
11468
- }
11469
- normalizeNode([node, path]);
11470
- };
11299
+ const hasStableListItem = (listItemNode) => {
11300
+ const type = listItemNode.children[0].type;
11301
+ return listItemNode.children.length === 1 && type === ElementKinds.paragraph;
11471
11302
  };
11472
11303
 
11473
11304
  /**
11474
11305
  * 将 fromListItem 子列表的列表项移到 toList
11475
11306
  */
11476
11307
  const moveListItemSublistItemsToList = (editor, { fromListItem, toList, location }) => {
11477
- const fromListItemSublist = queries.findDescendant(editor, {
11308
+ const fromListItemSublist = findDescendant(editor, {
11478
11309
  at: fromListItem[1],
11479
11310
  match: {
11480
11311
  type: getListTypes()
@@ -11483,7 +11314,7 @@ const moveListItemSublistItemsToList = (editor, { fromListItem, toList, location
11483
11314
  if (!fromListItemSublist)
11484
11315
  return 0;
11485
11316
  const [, fromListItemSublistPath] = fromListItemSublist;
11486
- const lastChildPath = queries.getLastChildPath(toList);
11317
+ const lastChildPath = getLastChildPath(toList);
11487
11318
  let moved;
11488
11319
  Editor.withoutNormalizing(editor, () => {
11489
11320
  moved = moveChildren(editor, {
@@ -11532,6 +11363,81 @@ const moveListItemDown = (editor, { list, listItem }) => {
11532
11363
  });
11533
11364
  };
11534
11365
 
11366
+ /**
11367
+ * 将列表项移到其父项旁边。
11368
+ * 父项应为列表项。
11369
+ */
11370
+ const moveListItemUp = (editor, { list, listItem }, options) => {
11371
+ const [listNode, listPath] = list;
11372
+ const [, listItemPath] = listItem;
11373
+ const listParentEntry = getParent(editor, listPath);
11374
+ if (!listParentEntry)
11375
+ return;
11376
+ const [listParentNode, listParentPath] = listParentEntry;
11377
+ if (listParentNode.type !== ElementKinds.listItem) {
11378
+ return;
11379
+ }
11380
+ Editor.withoutNormalizing(editor, () => {
11381
+ const newListItemPath = Path.next(listParentPath);
11382
+ // 将 item 上移一层
11383
+ Transforms.moveNodes(editor, {
11384
+ at: listItemPath,
11385
+ to: newListItemPath
11386
+ });
11387
+ /**
11388
+ * 将下一个兄弟节点移动到新列表
11389
+ */
11390
+ const listItemIdx = listItemPath[listItemPath.length - 1];
11391
+ const siblingPath = [...listItemPath];
11392
+ const newListPath = newListItemPath.concat(1);
11393
+ let siblingFound = false;
11394
+ let newSiblingIdx = 0;
11395
+ listNode.children.forEach((n, idx) => {
11396
+ if (listItemIdx < idx) {
11397
+ if (!siblingFound) {
11398
+ siblingFound = true;
11399
+ Transforms.insertNodes(editor, {
11400
+ type: listNode.type,
11401
+ children: []
11402
+ }, { at: newListPath });
11403
+ }
11404
+ siblingPath[siblingPath.length - 1] = listItemIdx;
11405
+ const newSiblingsPath = newListPath.concat(newSiblingIdx);
11406
+ newSiblingIdx++;
11407
+ Transforms.moveNodes(editor, {
11408
+ at: siblingPath,
11409
+ to: newSiblingsPath
11410
+ });
11411
+ }
11412
+ });
11413
+ // 处理listItem下方有段落的情况
11414
+ const listIndex = listParentNode.children.findIndex(item => item.key === listNode.key);
11415
+ const behindNode = listParentNode.children.slice(listIndex + 1);
11416
+ if (behindNode.length > 0) {
11417
+ const nextPath = Path.next(newListItemPath);
11418
+ Transforms.insertNodes(editor, {
11419
+ type: ElementKinds.listItem,
11420
+ children: []
11421
+ }, { at: nextPath });
11422
+ const moveStartPath = findPath(editor, behindNode[0]);
11423
+ const moveEndPath = findPath(editor, behindNode[behindNode.length - 1]);
11424
+ const moveRange = Editor.range(editor, moveStartPath, moveEndPath);
11425
+ Transforms.moveNodes(editor, {
11426
+ at: moveRange,
11427
+ to: nextPath.concat(0),
11428
+ match: node => behindNode.includes(node)
11429
+ });
11430
+ }
11431
+ // 删除子列表(如果它是第一个列表项)
11432
+ if (!listItemIdx) {
11433
+ Transforms.removeNodes(editor, {
11434
+ at: listPath
11435
+ });
11436
+ }
11437
+ });
11438
+ return true;
11439
+ };
11440
+
11535
11441
  function onKeyDownList(e, editor) {
11536
11442
  let moved = false;
11537
11443
  if (e.key === 'Tab') {
@@ -11548,171 +11454,66 @@ function onKeyDownList(e, editor) {
11548
11454
  moved = moveListItemUp(editor, { list, listItem });
11549
11455
  if (moved) {
11550
11456
  e.preventDefault();
11551
- return true;
11552
- }
11553
- }
11554
- // move down with tab
11555
- const tab = !e.shiftKey;
11556
- if (tab && !queries.isFirstChild(listItemPath)) {
11557
- moveListItemDown(editor, { list, listItem });
11558
- return true;
11559
- }
11560
- return false;
11561
- }
11562
- }
11563
-
11564
- class TheNumberedList extends TheBaseElement {
11565
- get start() {
11566
- return this.element.start;
11567
- }
11568
- get level() {
11569
- return this.element?.indent || null;
11570
- }
11571
- constructor(elementRef, cdr) {
11572
- super(elementRef, cdr);
11573
- this.elementRef = elementRef;
11574
- this.cdr = cdr;
11575
- }
11576
- ngOnInit() {
11577
- super.ngOnInit();
11578
- }
11579
- ngOnDestroy() {
11580
- super.ngOnDestroy();
11581
- }
11582
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheNumberedList, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
11583
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheNumberedList, isStandalone: true, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
11584
- }
11585
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheNumberedList, decorators: [{
11586
- type: Component,
11587
- args: [{
11588
- selector: 'ol[theOl]',
11589
- template: ``,
11590
- standalone: true
11591
- }]
11592
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { start: [{
11593
- type: HostBinding,
11594
- args: ['attr.start']
11595
- }], level: [{
11596
- type: HostBinding,
11597
- args: ['attr.the-level']
11598
- }] } });
11599
-
11600
- class TheBulletedList extends TheBaseElement {
11601
- get level() {
11602
- return this.element?.indent || null;
11603
- }
11604
- constructor(elementRef, cdr) {
11605
- super(elementRef, cdr);
11606
- this.elementRef = elementRef;
11607
- this.cdr = cdr;
11608
- }
11609
- ngOnInit() {
11610
- super.ngOnInit();
11611
- }
11612
- ngOnDestroy() {
11613
- super.ngOnDestroy();
11614
- }
11615
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheBulletedList, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
11616
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheBulletedList, isStandalone: true, selector: "ul[theUl]", host: { properties: { "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
11617
- }
11618
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheBulletedList, decorators: [{
11619
- type: Component,
11620
- args: [{
11621
- selector: 'ul[theUl]',
11622
- template: ``,
11623
- standalone: true
11624
- }]
11625
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { level: [{
11626
- type: HostBinding,
11627
- args: ['attr.the-level']
11628
- }] } });
11629
-
11630
- class TheListItem extends TheBaseElement {
11631
- constructor(elementRef, cdr) {
11632
- super(elementRef, cdr);
11633
- this.elementRef = elementRef;
11634
- this.cdr = cdr;
11635
- }
11636
- ngOnInit() {
11637
- super.ngOnInit();
11638
- }
11639
- onContextChange() {
11640
- super.onContextChange();
11641
- this.addFontSize();
11642
- this.addMultiDigit();
11643
- }
11644
- ngOnDestroy() {
11645
- super.ngOnDestroy();
11646
- }
11647
- addFontSize() {
11648
- let firstText;
11649
- for (const entry of Node.descendants(this.element)) {
11650
- const node = entry[0];
11651
- if (Text.isText(node) && !firstText) {
11652
- firstText = node;
11653
- break;
11654
- }
11655
- }
11656
- if (!firstText) {
11657
- return;
11658
- }
11659
- const { text, ...rest } = firstText;
11660
- const size = rest[MarkTypes.fontSize];
11661
- if (size) {
11662
- const sizeClass = `font-size-${size}`;
11663
- const isContains = this.elementRef.nativeElement?.classList?.contains(sizeClass);
11664
- if (isContains) {
11665
- return;
11666
- }
11667
- this.clearFontSize();
11668
- this.elementRef.nativeElement.classList.add(sizeClass);
11669
- this.fontSizeClass = sizeClass;
11670
- }
11671
- else {
11672
- this.clearFontSize();
11673
- }
11674
- }
11675
- clearFontSize() {
11676
- if (this.fontSizeClass) {
11677
- this.elementRef.nativeElement.classList.remove(this.fontSizeClass);
11678
- this.fontSizeClass = null;
11679
- }
11680
- }
11681
- getStart() {
11682
- const parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
11683
- const start = parent?.getAttribute('start') || 1;
11684
- return Number(start);
11685
- }
11686
- getLiIndex() {
11687
- const path = queries.findPath(this.editor, this.element);
11688
- const index = path[path.length - 1];
11689
- return index || 0;
11690
- }
11691
- addMultiDigit() {
11692
- const start = this.getStart();
11693
- const index = this.getLiIndex();
11694
- const multiDigit = 'data-multi-digit';
11695
- // start number + index
11696
- // when it is greater than 9, it is a multi-digit serial number
11697
- // exclude Font size >= 20
11698
- if (start + index > 9) {
11699
- this.elementRef.nativeElement.setAttribute(multiDigit, true);
11457
+ return true;
11458
+ }
11700
11459
  }
11701
- else {
11702
- this.elementRef.nativeElement.removeAttribute(multiDigit);
11460
+ // move down with tab
11461
+ const tab = !e.shiftKey;
11462
+ if (tab && !isFirstChild(listItemPath)) {
11463
+ moveListItemDown(editor, { list, listItem });
11464
+ return true;
11703
11465
  }
11466
+ return false;
11704
11467
  }
11705
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheListItem, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
11706
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheListItem, isStandalone: true, selector: "li[theLi]", usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
11707
11468
  }
11708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheListItem, decorators: [{
11709
- type: Component,
11710
- args: [{
11711
- selector: 'li[theLi]',
11712
- template: ``,
11713
- standalone: true
11714
- }]
11715
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
11469
+
11470
+ /**
11471
+ * 获取 List 中 ListItems,过滤掉空列表嵌套
11472
+ * @param node
11473
+ * @param initialValue
11474
+ * @returns
11475
+ */
11476
+ const getStartListItem = (node, initialValue) => {
11477
+ if (!initialValue) {
11478
+ initialValue = [];
11479
+ }
11480
+ if (node) {
11481
+ return node.reduce((result, current) => {
11482
+ if (current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type)) {
11483
+ result.push(current);
11484
+ }
11485
+ else {
11486
+ if (current.children) {
11487
+ getStartListItem(current.children, result);
11488
+ }
11489
+ }
11490
+ return result;
11491
+ }, initialValue);
11492
+ }
11493
+ };
11494
+
11495
+ const isInList = (editor, at = editor.selection) => {
11496
+ return isNodeTypeIn(editor, [ElementKinds.numberedList, ElementKinds.bulletedList], { at });
11497
+ };
11498
+
11499
+ /**
11500
+ * Is the list nested, i.e. its parent is a list item.
11501
+ */
11502
+ const isListNested = (editor, listPath, options) => {
11503
+ const [listParentNode] = Editor.parent(editor, listPath);
11504
+ return listParentNode.type === ElementKinds.listItem;
11505
+ };
11506
+
11507
+ /**
11508
+ * Is the selection focus at the start of its parent block.
11509
+ */
11510
+ const isSelectionAtListItemStart = (editor) => {
11511
+ const listItemEntry = getAboveByType(editor, [ElementKinds.listItem]);
11512
+ if (listItemEntry) {
11513
+ return isStart(editor, editor.selection.focus, listItemEntry[1]);
11514
+ }
11515
+ return false;
11516
+ };
11716
11517
 
11717
11518
  /**
11718
11519
  * Is the selection in same li
@@ -11728,6 +11529,207 @@ const isSelectionInSameListItem = (editor) => {
11728
11529
  return startListItemEntry && endListItemEntry && Path.equals(startListItemEntry[1], endListItemEntry[1]);
11729
11530
  };
11730
11531
 
11532
+ /**
11533
+ * list 中 是否是单个listItem,且listItem没有子列表
11534
+ */
11535
+ const isSingleListItem = (list) => {
11536
+ return isNodeTypeList(list) && list.children.length === 1 && !hasListInListItem(list.children[0]);
11537
+ };
11538
+
11539
+ const insertListData = (editor, { fromList, toListItemEntry }) => {
11540
+ const { children } = fromList;
11541
+ const [toListItem, toListItemPath] = toListItemEntry;
11542
+ const nextListItemPath = Path.next(toListItemPath);
11543
+ const toListItemIsEmptyParagraph = isEmptyParagraph(editor, editor.selection.anchor);
11544
+ const hasSubList = hasListInListItem(toListItem);
11545
+ let selectPath = [...toListItemPath];
11546
+ const liIndex = selectPath.pop();
11547
+ selectPath = [...selectPath, liIndex + children.length];
11548
+ Editor.withoutNormalizing(editor, () => {
11549
+ if (toListItemIsEmptyParagraph && hasSubList) {
11550
+ Transforms.insertNodes(editor, children, { at: nextListItemPath });
11551
+ }
11552
+ else {
11553
+ const insertListItemPath = toListItemIsEmptyParagraph ? toListItemPath : nextListItemPath;
11554
+ // 如果粘贴目标listItem为空,则先删除listItem
11555
+ if (toListItemIsEmptyParagraph) {
11556
+ Transforms.removeNodes(editor, { at: insertListItemPath });
11557
+ selectPath = Path.previous(selectPath);
11558
+ }
11559
+ Transforms.insertNodes(editor, children, { at: insertListItemPath });
11560
+ }
11561
+ /**
11562
+ * 粘贴目标lisItem有子列表
11563
+ */
11564
+ if (hasSubList) {
11565
+ const paragraphPath = toListItemPath.concat([0]);
11566
+ const nextSubListPath = Path.next(paragraphPath);
11567
+ // 判断粘贴数据是否是多级
11568
+ if (hasListInListItem(fromList.children[0])) {
11569
+ // 设置粘贴后正确选区
11570
+ Transforms.select(editor, Editor.end(editor, nextListItemPath));
11571
+ // 获取当前选区所在listItem entry
11572
+ const currentListItemEntry = getListItemEntry(editor, {});
11573
+ // 获取粘贴目标listItem中的子列表
11574
+ const { children: subListChildren } = Node.get(editor, nextSubListPath);
11575
+ /**
11576
+ * 复制子列表数据
11577
+ * 之所以是复制,而不是移动,因为无法单纯一次性移动子列表的所有listItem(不包含subList本身)到目标位置,
11578
+ * 需要循环移动才可以
11579
+ **/
11580
+ Transforms.insertNodes(editor, subListChildren, {
11581
+ at: Path.next(currentListItemEntry.listItem[1])
11582
+ });
11583
+ // 删除已被复制后无用的listItem/listItem subList
11584
+ Transforms.delete(editor, {
11585
+ at: toListItemIsEmptyParagraph ? toListItemPath : nextSubListPath
11586
+ });
11587
+ return;
11588
+ }
11589
+ Transforms.select(editor, Editor.end(editor, selectPath));
11590
+ // 粘贴数据不是多级
11591
+ const currentListItemEntry = getListItemEntry(editor, {});
11592
+ Transforms.moveNodes(editor, {
11593
+ at: nextSubListPath,
11594
+ to: currentListItemEntry.listItem[1].concat(1)
11595
+ });
11596
+ if (toListItemIsEmptyParagraph) {
11597
+ Transforms.delete(editor, { at: toListItemPath });
11598
+ }
11599
+ return;
11600
+ }
11601
+ });
11602
+ // 粘贴目标listItem没有子列表, 设置选区
11603
+ Transforms.select(editor, Editor.end(editor, selectPath));
11604
+ return;
11605
+ };
11606
+
11607
+ /**
11608
+ * Insert list item if selection in li>p.
11609
+ */
11610
+ const insertListItem = (editor) => {
11611
+ if (editor.selection && !isRangeAtRoot(editor.selection)) {
11612
+ const paragraphEntry = getAboveByType(editor, ElementKinds.paragraph);
11613
+ if (!paragraphEntry) {
11614
+ return;
11615
+ }
11616
+ const [, paragraphPath] = paragraphEntry;
11617
+ const [listItemNode, listItemPath] = Editor.parent(editor, paragraphPath);
11618
+ if (Element.isElement(listItemNode) && listItemNode.type !== ElementKinds.listItem) {
11619
+ return;
11620
+ }
11621
+ if (!Range.isCollapsed(editor.selection)) {
11622
+ Transforms.delete(editor);
11623
+ }
11624
+ const isEnd = isBlockTextEmptyAfterSelection(editor);
11625
+ const nextNodePath = Path.next(paragraphPath);
11626
+ const nextListItemPath = Path.next(listItemPath);
11627
+ const nextEnd = Editor.end(editor, listItemPath);
11628
+ /**
11629
+ * If not end, split nodes, wrap a list item on the new paragraph and move it to the next list item
11630
+ */
11631
+ if (!isEnd) {
11632
+ Editor.withoutNormalizing(editor, () => {
11633
+ Transforms.splitNodes(editor, { at: editor.selection, always: true });
11634
+ Transforms.wrapNodes(editor, {
11635
+ type: ElementKinds.listItem,
11636
+ children: []
11637
+ }, { at: nextNodePath });
11638
+ Transforms.moveNodes(editor, {
11639
+ at: nextNodePath,
11640
+ to: nextListItemPath
11641
+ });
11642
+ });
11643
+ }
11644
+ else {
11645
+ /**
11646
+ * If end, split nodes
11647
+ */
11648
+ Editor.withoutNormalizing(editor, () => {
11649
+ Transforms.splitNodes(editor, {
11650
+ always: true,
11651
+ mode: 'highest',
11652
+ match: node => {
11653
+ const path = node && TheEditor.findPath(editor, node);
11654
+ return path && path.length === nextListItemPath.length;
11655
+ }
11656
+ });
11657
+ });
11658
+ }
11659
+ /**
11660
+ * If there is a list in the list item, move it to the next list item
11661
+ */
11662
+ if (getNode(editor, nextNodePath)) {
11663
+ Transforms.moveNodes(editor, {
11664
+ at: Editor.range(editor, nextNodePath, nextEnd),
11665
+ to: nextListItemPath.concat(1),
11666
+ match: node => {
11667
+ // TODO: types
11668
+ return listItemNode.children.includes(node);
11669
+ }
11670
+ });
11671
+ }
11672
+ return true;
11673
+ }
11674
+ };
11675
+
11676
+ /**
11677
+ * 获取 listItem 内的列表(如果存在).
11678
+ * 它采用以下结构:ul> li > span + ul
11679
+ */
11680
+ const getListItemSublist = (listItem, options) => {
11681
+ const [listItemNode, listItemPath] = listItem;
11682
+ if (hasListInListItem(listItemNode)) {
11683
+ return [listItemNode.children[1], listItemPath.concat([1])];
11684
+ }
11685
+ };
11686
+
11687
+ /**
11688
+ * Move fromListItem sublist list items to the end of `toListItem` sublist.
11689
+ * If there is no `toListItem` sublist, insert one.
11690
+ */
11691
+ const moveListItemSublistItemsToListItemSublist = (editor, { fromListItem, toListItem, start }, options) => {
11692
+ const [, fromListItemPath] = fromListItem;
11693
+ const [toListItemNode, toListItemPath] = toListItem;
11694
+ const fromListItemSublist = getListItemSublist(fromListItem, options);
11695
+ if (!fromListItemSublist)
11696
+ return 0;
11697
+ const [, fromListItemSublistPath] = fromListItemSublist;
11698
+ const toListItemSublist = getListItemSublist(toListItem, options);
11699
+ let to;
11700
+ if (!toListItemSublist) {
11701
+ const fromList = getParent(editor, fromListItemPath);
11702
+ if (!fromList)
11703
+ return 0;
11704
+ const [fromListNode] = fromList;
11705
+ const fromListType = fromListNode.type;
11706
+ const toListItemSublistPath = toListItemPath.concat([toListItemNode.children.length]);
11707
+ Transforms.insertNodes(editor, { type: fromListType, children: [] }, { at: toListItemSublistPath });
11708
+ to = toListItemSublistPath.concat([0]);
11709
+ }
11710
+ else if (start) {
11711
+ const [, toListItemSublistPath] = toListItemSublist;
11712
+ to = toListItemSublistPath.concat([0]);
11713
+ }
11714
+ else {
11715
+ to = Path.next(getLastChildPath(toListItemSublist));
11716
+ }
11717
+ const moved = moveChildren(editor, {
11718
+ at: Path.previous(fromListItemSublistPath),
11719
+ to
11720
+ });
11721
+ // Remove the empty list
11722
+ Transforms.delete(editor, { at: fromListItemPath });
11723
+ return moved;
11724
+ };
11725
+
11726
+ const unwrapList = (editor) => {
11727
+ Editor.withoutNormalizing(editor, () => {
11728
+ unwrapNodesByType(editor, ElementKinds.listItem);
11729
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true });
11730
+ });
11731
+ };
11732
+
11731
11733
  const withList = (editor) => {
11732
11734
  const { insertBreak, deleteBackward, onKeydown, insertData, setFragmentData, renderElement } = editor;
11733
11735
  const validLiChildrenTypes = getPluginOptions(editor, PluginKeys.list)?.validLiChildrenTypes ?? [];
@@ -11737,7 +11739,7 @@ const withList = (editor) => {
11737
11739
  onReset: (_editor) => unwrapList(_editor)
11738
11740
  };
11739
11741
  editor.insertBreak = () => {
11740
- const node = queries.anchorBlock(editor);
11742
+ const node = anchorBlock(editor);
11741
11743
  if (!node) {
11742
11744
  insertBreak();
11743
11745
  return;
@@ -11778,16 +11780,16 @@ const withList = (editor) => {
11778
11780
  }
11779
11781
  }
11780
11782
  // 如果选择的listItem为空则将其向上移动
11781
- if (isStart && queries.isBlockAboveEmpty(editor)) {
11783
+ if (isStart && isBlockAboveEmpty(editor)) {
11782
11784
  moved = moveListItemUp(editor, { list, listItem });
11783
11785
  if (moved)
11784
11786
  return;
11785
11787
  }
11786
- const didReset = transforms.onKeyDownResetBlockType({
11788
+ const didReset = onKeyDownResetBlockType({
11787
11789
  rules: [
11788
11790
  {
11789
11791
  ...resetBlockTypesListRule,
11790
- predicate: () => !moved && isStart && queries.isBlockAboveEmpty(editor)
11792
+ predicate: () => !moved && isStart && isBlockAboveEmpty(editor)
11791
11793
  }
11792
11794
  ]
11793
11795
  })(null, editor);
@@ -11849,17 +11851,17 @@ const withList = (editor) => {
11849
11851
  const { list, listItem } = res;
11850
11852
  const [, listPath] = list;
11851
11853
  const [listItemNode, listItemPath] = listItem;
11852
- const previousListItemPath = queries.getPreviousPath(listItemPath);
11854
+ const previousListItemPath = getPreviousPath(listItemPath);
11853
11855
  if (previousListItemPath) {
11854
11856
  const beforePoint = Editor.before(editor, listItemPath);
11855
11857
  const parentPath = Path.parent(beforePoint.path);
11856
11858
  const parentNode = Node.get(editor, parentPath);
11857
11859
  if (Element.isElement(parentNode) && Editor.isVoid(editor, parentNode)) {
11858
11860
  Editor.withoutNormalizing(editor, () => {
11859
- transforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], {
11861
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], {
11860
11862
  split: true
11861
11863
  });
11862
- transforms.unwrapNodesByType(editor, ElementKinds.listItem);
11864
+ unwrapNodesByType(editor, ElementKinds.listItem);
11863
11865
  });
11864
11866
  return;
11865
11867
  }
@@ -11883,7 +11885,7 @@ const withList = (editor) => {
11883
11885
  const beforePoint = Editor.before(editor, listItemPath);
11884
11886
  const startPoint = Editor.start(editor, listItemPath);
11885
11887
  const endPoint = Editor.end(editor, listItemPath);
11886
- const isInFirstChild = !isListNested(editor, listPath) && queries.isFirstChild(listItemPath);
11888
+ const isInFirstChild = !isListNested(editor, listPath) && isFirstChild(listItemPath);
11887
11889
  const to = isInFirstChild ? listPath : Path.next(Path.parent(beforePoint.path));
11888
11890
  Transforms.moveNodes(editor, {
11889
11891
  at: Editor.range(editor, startPoint, endPoint),
@@ -11898,7 +11900,7 @@ const withList = (editor) => {
11898
11900
  return;
11899
11901
  }
11900
11902
  // deprecated
11901
- if (!isListNested(editor, listPath) && queries.isFirstChild(listItemPath)) {
11903
+ if (!isListNested(editor, listPath) && isFirstChild(listItemPath)) {
11902
11904
  unwrapList(editor);
11903
11905
  return;
11904
11906
  }
@@ -12123,7 +12125,7 @@ const withNodeID = (e) => {
12123
12125
  if (operation.type === 'insert_node') {
12124
12126
  const newFilter = (entry) => {
12125
12127
  const [_node] = entry;
12126
- return filter(entry) && filterText ? Element.isElement(_node) : queries.isDescendant(_node);
12128
+ return filter(entry) && filterText ? Element.isElement(_node) : isDescendant(_node);
12127
12129
  };
12128
12130
  // fix can not find path by orign node
12129
12131
  let node = operation.node;
@@ -12131,7 +12133,7 @@ const withNodeID = (e) => {
12131
12133
  node = cloneDeep(node);
12132
12134
  }
12133
12135
  // it will not overwrite ids once it's set as it's read-only
12134
- transforms.mergeDeepToNodes({
12136
+ mergeDeepToNodes({
12135
12137
  node,
12136
12138
  source: idPropsCreator,
12137
12139
  query: {
@@ -12185,7 +12187,7 @@ const withInsertParagraphNodes = (editor) => {
12185
12187
  editor.normalizeNode = ([currentNode, currentPath]) => {
12186
12188
  if (Text.isText(currentNode) && currentPath.length) {
12187
12189
  const [node] = Editor.parent(editor, currentPath);
12188
- const containerBlocks = [...types, ...queries.getContainerBlocks(editor)];
12190
+ const containerBlocks = [...types, ...getContainerBlocks(editor)];
12189
12191
  if (Element.isElement(node) && containerBlocks.includes(node.type)) {
12190
12192
  const paragraph = createEmptyParagraph();
12191
12193
  paragraph.children[0].text = currentNode.text;
@@ -12208,9 +12210,9 @@ const withTrailingNode = (editor) => {
12208
12210
  const { type, level, ...query } = options;
12209
12211
  editor.normalizeNode = ([currentNode, currentPath]) => {
12210
12212
  if (!currentPath.length) {
12211
- const entry = queries.getLastNode(editor, level);
12213
+ const entry = getLastNode(editor, level);
12212
12214
  const [lastNode, lastPath] = entry;
12213
- if (Element.isElement(lastNode) && lastNode.type !== type && queries.isNodeType(entry, query)) {
12215
+ if (Element.isElement(lastNode) && lastNode.type !== type && isNodeType(entry, query)) {
12214
12216
  Transforms.insertNodes(editor, {
12215
12217
  type,
12216
12218
  children: [{ text: '' }]
@@ -12232,16 +12234,16 @@ const createTrailingNodePlugin = createPluginFactory({
12232
12234
 
12233
12235
  const PaintFormatEditor = {
12234
12236
  formatBrush(editor, marks) {
12235
- const block = queries.anchorBlock(editor);
12237
+ const block = anchorBlock(editor);
12236
12238
  if (block && Range.isCollapsed(editor.selection)) {
12237
12239
  // TODO:: 在撤销时有bug, 临时使用withoutSaving处理
12238
12240
  HistoryEditor.withoutSaving(editor, () => {
12239
12241
  const path = TheEditor.findPath(editor, block);
12240
- transforms.setMarks(editor, marks, path);
12242
+ setMarks(editor, marks, path);
12241
12243
  });
12242
12244
  }
12243
12245
  else {
12244
- transforms.setMarks(editor, marks);
12246
+ setMarks(editor, marks);
12245
12247
  }
12246
12248
  PaintFormatEditor.cancelFormatBrushStatus(editor);
12247
12249
  },
@@ -12257,7 +12259,7 @@ const PaintFormatEditor = {
12257
12259
  }
12258
12260
  contextService.paintFormatStatus = {
12259
12261
  isActive: true,
12260
- marks: queries.getSelectionMarks(editor)
12262
+ marks: getSelectionMarks(editor)
12261
12263
  };
12262
12264
  const element = EDITOR_TO_ELEMENT.get(editor);
12263
12265
  element.classList.add('pointer-paint');
@@ -12337,7 +12339,7 @@ const createPaintFormatPlugin = createPluginFactory({
12337
12339
  MarkProps.forEach(key => {
12338
12340
  unsetMarks[key] = null;
12339
12341
  });
12340
- transforms.setMarks(editor, unsetMarks);
12342
+ setMarks(editor, unsetMarks);
12341
12343
  }
12342
12344
  }
12343
12345
  }
@@ -12447,9 +12449,9 @@ const withSoftBreak = (editor) => {
12447
12449
  const { onKeydown } = editor;
12448
12450
  const rules = getPluginOptions(editor, PluginKeys.softBreak)?.rules ?? [];
12449
12451
  editor.onKeydown = (event) => {
12450
- const entry = queries.getBlockAbove(editor);
12452
+ const entry = getBlockAbove(editor);
12451
12453
  rules.forEach(({ hotkey, query }) => {
12452
- if (isKeyHotkey(hotkey, event) && queries.isNodeType(entry, query)) {
12454
+ if (isKeyHotkey(hotkey, event) && isNodeType(entry, query)) {
12453
12455
  event.preventDefault();
12454
12456
  editor.insertText('\n');
12455
12457
  }
@@ -13592,7 +13594,7 @@ class TheTableToolbar {
13592
13594
  this.selectedColor = cell ? cell.backgroundColor : '';
13593
13595
  const path = TheEditor.findPath(this.editor, this.tableElement);
13594
13596
  this.tableChangeSubscriber = this.tableStore.tableChange().subscribe(() => {
13595
- const columns = queries.getNode(this.editor, path).columns;
13597
+ const columns = getNode(this.editor, path).columns;
13596
13598
  this.isColumnEqual = columns?.every(col => columns[0].width === col.width) ?? true;
13597
13599
  });
13598
13600
  }
@@ -13805,7 +13807,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
13805
13807
 
13806
13808
  function calculateAnchorPositionInCell(editor, at) {
13807
13809
  at = at || editor.selection.anchor;
13808
- const entry = queries.anchorBlockEntry(editor, at);
13810
+ const entry = anchorBlockEntry(editor, at);
13809
13811
  const [block, blockPath] = entry;
13810
13812
  const blockDom = AngularEditor.toDOMNode(editor, block);
13811
13813
  const valueRangeRect = blockDom.getBoundingClientRect();
@@ -13867,7 +13869,7 @@ const moveSelectionFromCell = (editor, e) => {
13867
13869
  const cellStartPath = Editor.start(editor, cellPath).path;
13868
13870
  const cellEndPath = Editor.end(editor, cellPath).path;
13869
13871
  const { isFirstLine, isLastLine } = calculateAnchorPositionInCell(editor, cursor);
13870
- const [, anchorBlockPath] = queries.anchorBlockEntry(editor, cursor);
13872
+ const [, anchorBlockPath] = anchorBlockEntry(editor, cursor);
13871
13873
  const anchorPosition = createTablePosition(editor, selection.anchor.path);
13872
13874
  const startCellPosition = createTablePosition(editor, cellStartPath);
13873
13875
  const endCellPosition = createTablePosition(editor, cellEndPath);
@@ -14497,7 +14499,7 @@ class TheTable extends TheBaseElement {
14497
14499
  // Editor container width changes, resulting in column widths no longer valid #WIK-6766
14498
14500
  const warning = this.element.columns.some((col, index) => col.width !== columns[index]?.width);
14499
14501
  if (warning) {
14500
- transforms.setNode(this.editor, { columns }, this.element);
14502
+ setNode(this.editor, { columns }, this.element);
14501
14503
  }
14502
14504
  }
14503
14505
  else {
@@ -14507,24 +14509,24 @@ class TheTable extends TheBaseElement {
14507
14509
  width: Number((this.tableWrapperWidth / tr.children.length - tr.children.length).toFixed(2))
14508
14510
  };
14509
14511
  });
14510
- transforms.setNode(this.editor, { columns }, this.element);
14512
+ setNode(this.editor, { columns }, this.element);
14511
14513
  }
14512
14514
  }
14513
14515
  initializeRows() {
14514
- this.element.children.map((row, index) => {
14516
+ this.element.children.map((row, index$1) => {
14515
14517
  if (!row.height) {
14516
14518
  const element = TheEditor.toDOMNode(this.editor, row);
14517
14519
  let height = getElementHeight(element);
14518
- transforms.setNode(this.editor, { height }, row);
14520
+ setNode(this.editor, { height }, row);
14519
14521
  }
14520
14522
  });
14521
14523
  }
14522
14524
  transformRowHeight() {
14523
14525
  const rowElements = this.nativeElement.querySelector('tbody').children;
14524
14526
  if (rowElements) {
14525
- [...rowElements].map((row, index) => {
14527
+ [...rowElements].map((row, index$1) => {
14526
14528
  let height = getElementHeight(row);
14527
- transforms.setNode(this.editor, { height }, this.element.children[index]);
14529
+ setNode(this.editor, { height }, this.element.children[index$1]);
14528
14530
  });
14529
14531
  }
14530
14532
  }
@@ -14533,7 +14535,7 @@ class TheTable extends TheBaseElement {
14533
14535
  const columns = cols.map(col => {
14534
14536
  return { width: getElementWidth(col) };
14535
14537
  });
14536
- transforms.setNode(this.editor, { columns }, this.element);
14538
+ setNode(this.editor, { columns }, this.element);
14537
14539
  }
14538
14540
  onColMousedown(event, index) {
14539
14541
  event.stopPropagation();
@@ -15045,7 +15047,7 @@ class TheTd extends TheBaseElement {
15045
15047
  }
15046
15048
  // 聚焦
15047
15049
  useFocus() {
15048
- if (this.isCollapsedAndNonReadonly && queries.isGlobalCollapsed(this.editor)) {
15050
+ if (this.isCollapsedAndNonReadonly && isGlobalCollapsed(this.editor)) {
15049
15051
  this.renderer.addClass(this.elementRef.nativeElement, 'focused-cell');
15050
15052
  }
15051
15053
  else {
@@ -15706,8 +15708,8 @@ const withTable = (editor) => {
15706
15708
  if (startBlockPath.length <= startPosition.cellEntry[1].length + 1 &&
15707
15709
  startBlockPath.pop() === 0 &&
15708
15710
  selection.anchor.offset === 0 &&
15709
- queries.isStart(editor, selection.anchor, startBlockPath) &&
15710
- !Editor.isVoid(editor, queries.anchorBlock(editor))) {
15711
+ isStart(editor, selection.anchor, startBlockPath) &&
15712
+ !Editor.isVoid(editor, anchorBlock(editor))) {
15711
15713
  return;
15712
15714
  }
15713
15715
  deleteBackward(unit);
@@ -15765,11 +15767,11 @@ const withTable = (editor) => {
15765
15767
  const { isFirstLine, isLastLine } = calculateAnchorPositionInCell(editor);
15766
15768
  startPath.pop();
15767
15769
  endPath.pop();
15768
- if ((queries.anchorBlockEntry(editor)[1].toString() !== startPath.toString() || !isFirstLine) && isMoveUp) {
15770
+ if ((anchorBlockEntry(editor)[1].toString() !== startPath.toString() || !isFirstLine) && isMoveUp) {
15769
15771
  onKeydown(event);
15770
15772
  return;
15771
15773
  }
15772
- if ((queries.anchorBlockEntry(editor)[1].toString() !== endPath.toString() || !isLastLine) && isMoveDown) {
15774
+ if ((anchorBlockEntry(editor)[1].toString() !== endPath.toString() || !isLastLine) && isMoveDown) {
15773
15775
  onKeydown(event);
15774
15776
  return;
15775
15777
  }
@@ -15992,7 +15994,7 @@ const withTable = (editor) => {
15992
15994
  if (isTable) {
15993
15995
  setTimeout(() => {
15994
15996
  Editor.withoutNormalizing(editor, () => {
15995
- const [, currentPath] = queries.findNode(editor, {
15997
+ const [, currentPath] = findNode(editor, {
15996
15998
  match: n => Element.isElement(n) && n.type === ElementKinds.table
15997
15999
  });
15998
16000
  const nextPath = Path.next(currentPath);
@@ -16231,7 +16233,7 @@ class TheTodoItem extends TheBaseElement {
16231
16233
  if (this.readonly && !this.editableWithReadonly) {
16232
16234
  return false;
16233
16235
  }
16234
- transforms.setNode(this.editor, { checked }, this.element);
16236
+ setNode(this.editor, { checked }, this.element);
16235
16237
  }
16236
16238
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheTodoItem, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
16237
16239
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.0", type: TheTodoItem, isStandalone: true, selector: "div[theTodoItem]", host: { properties: { "class.the-check-item": "this.checkItemClass", "class.the-todo-item-selectable": "this.checkItemSelectable", "attr.the-level": "this.level" } }, viewQueries: [{ propertyName: "childrenOutlet", first: true, predicate: ["childrenOutlet"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: `
@@ -16277,7 +16279,7 @@ const withTodoItem = (editor) => {
16277
16279
  });
16278
16280
  if (match) {
16279
16281
  const [, path] = match;
16280
- const block = queries.anchorBlock(editor);
16282
+ const block = anchorBlock(editor);
16281
16283
  if (block && Editor.isStart(editor, selection.anchor, path) && Editor.isEmpty(editor, block)) {
16282
16284
  Transforms.setNodes(editor, {
16283
16285
  type: ElementKinds.default,
@@ -16290,8 +16292,8 @@ const withTodoItem = (editor) => {
16290
16292
  }
16291
16293
  }
16292
16294
  insertBreak();
16293
- const anchorBlock = queries.anchorBlock(editor);
16294
- if (anchorBlock && anchorBlock.type === ElementKinds.checkItem) {
16295
+ const anchorBlock$1 = anchorBlock(editor);
16296
+ if (anchorBlock$1 && anchorBlock$1.type === ElementKinds.checkItem) {
16295
16297
  Transforms.setNodes(editor, { checked: false });
16296
16298
  }
16297
16299
  };
@@ -16457,7 +16459,7 @@ class TheQuickInsert {
16457
16459
  return false;
16458
16460
  }
16459
16461
  hasExcludeAttribute() {
16460
- const marks = queries.getSelectionMarks(this.editor);
16462
+ const marks = getSelectionMarks(this.editor);
16461
16463
  const fontSizeMark = marks[MarkTypes.fontSize];
16462
16464
  return fontSizeMark;
16463
16465
  }
@@ -16839,7 +16841,7 @@ class TheEditorComponent {
16839
16841
  const mode = this.options?.mode;
16840
16842
  if (mode === TheDataMode.html) {
16841
16843
  let htmlValue = '';
16842
- const isEmptyContent = queries.isEmptyContent(value);
16844
+ const isEmptyContent$1 = isEmptyContent(value);
16843
16845
  value.forEach((element) => {
16844
16846
  let elementHtml = this.elementToHtml.get(element);
16845
16847
  if (elementHtml === undefined) {
@@ -16851,7 +16853,7 @@ class TheEditorComponent {
16851
16853
  }
16852
16854
  htmlValue += elementHtml;
16853
16855
  });
16854
- return isEmptyContent ? '' : htmlValue;
16856
+ return isEmptyContent$1 ? '' : htmlValue;
16855
16857
  }
16856
16858
  return value;
16857
16859
  }
@@ -16881,13 +16883,13 @@ class TheEditorComponent {
16881
16883
  handleSelectAll() {
16882
16884
  let node;
16883
16885
  if (!this.editor.selection) {
16884
- transforms.setEndSelection(this.editor);
16886
+ setEndSelection(this.editor);
16885
16887
  }
16886
16888
  const [start, end] = Range.edges(this.editor.selection);
16887
16889
  const selectionRange = Editor.range(this.editor, start, end);
16888
- const containerBlocks = queries.getContainerBlocks(this.editor);
16890
+ const containerBlocks = getContainerBlocks(this.editor);
16889
16891
  for (let i = 0; i < containerBlocks.length; i++) {
16890
- [node] = queries.getNodesByType(this.editor, containerBlocks[i]);
16892
+ [node] = getNodesByType(this.editor, containerBlocks[i]);
16891
16893
  if (node) {
16892
16894
  const [, path] = node;
16893
16895
  const isStartParent = Path.equals(path, start.path.slice(0, path.length));
@@ -17257,5 +17259,5 @@ const withTestPlugin = (plugins, initValue) => {
17257
17259
  * Generated bundle index. Do not edit.
17258
17260
  */
17259
17261
 
17260
- export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultPluginMenu, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QuickInsertEditor, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, THE_UPLOAD_SERVICE_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheDefaultElement, TheEditor, TheEditorComponent, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, queries as TheQueries, TheTableSelect, TheTemplate, TheText, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, transforms as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, buildPluginMenu, buildPluginMenuItemMap, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, copyNodeForSafari, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deleteElementKey, errorImageUrlMock, extractFragment, filterTextFormat, flattenDeepPlugins, getCellPositionsFromRange, getColsTotalWidth, getColumnsWidth, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getToolbarClass, hasHeaderRow, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isVirtualKey, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, scrollIntoView, setEditorUUID, theTethysIconRegistryFaker, topLeftPosition, uniqueCellPosition, updatePopoverPosition, useElementStyle, withMention, withTestPlugin, withTheia };
17262
+ export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DefaultPluginMenu, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QuickInsertEditor, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_INLINE_TOOLBAR_TYPES, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, THE_UPLOAD_SERVICE_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheDefaultElement, TheEditor, TheEditorComponent, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheTableSelect, TheTemplate, TheText, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, buildPluginMenu, buildPluginMenuItemMap, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, copyNodeForSafari, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deleteElementKey, errorImageUrlMock, extractFragment, filterTextFormat, flattenDeepPlugins, getCellPositionsFromRange, getColsTotalWidth, getColumnsWidth, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getToolbarClass, hasHeaderRow, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isVirtualKey, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, scrollIntoView, setEditorUUID, theTethysIconRegistryFaker, topLeftPosition, uniqueCellPosition, updatePopoverPosition, useElementStyle, withMention, withTestPlugin, withTheia };
17261
17263
  //# sourceMappingURL=worktile-theia.mjs.map