@worktile/theia 17.1.0 → 17.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/components/inline-toolbar/inline-toolbar.component.d.ts +2 -2
  2. package/editor.component.d.ts +1 -0
  3. package/esm2022/components/conversion-hint/conversion-hint.component.mjs +3 -3
  4. package/esm2022/components/inline-toolbar/inline-toolbar.component.mjs +6 -6
  5. package/esm2022/constants/auto-format-rules.mjs +7 -7
  6. package/esm2022/core/toolbar-item/base-toolbar-item.mjs +2 -2
  7. package/esm2022/editor.component.mjs +20 -11
  8. package/esm2022/interfaces/editor.mjs +1 -1
  9. package/esm2022/interfaces/preset.mjs +1 -1
  10. package/esm2022/plugins/align/align.editor.mjs +2 -2
  11. package/esm2022/plugins/align/align.plugin.mjs +3 -3
  12. package/esm2022/plugins/autoformat/autoformat.plugin.mjs +2 -2
  13. package/esm2022/plugins/autoformat/transforms/auto-format-inline.mjs +2 -2
  14. package/esm2022/plugins/blockquote/blockquote.editor.mjs +4 -4
  15. package/esm2022/plugins/blockquote/blockquote.plugin.mjs +3 -3
  16. package/esm2022/plugins/code/code.component.mjs +2 -2
  17. package/esm2022/plugins/code/code.editor.mjs +3 -3
  18. package/esm2022/plugins/code/code.plugin.mjs +3 -4
  19. package/esm2022/plugins/common/block-card.plugin.mjs +3 -3
  20. package/esm2022/plugins/common/get-fragment.plugin.mjs +2 -2
  21. package/esm2022/plugins/common/move-selection.plugin.mjs +3 -3
  22. package/esm2022/plugins/common/remove-empty.plugin.mjs +4 -4
  23. package/esm2022/plugins/common/remove-void.plugin.mjs +4 -4
  24. package/esm2022/plugins/common/reset-type.plugin.mjs +4 -4
  25. package/esm2022/plugins/deserialize/deserialize-md.plugin.mjs +2 -2
  26. package/esm2022/plugins/font-size/font-size.editor.mjs +5 -5
  27. package/esm2022/plugins/heading/heading.editor.mjs +5 -5
  28. package/esm2022/plugins/heading/heading.plugin.mjs +2 -2
  29. package/esm2022/plugins/hr/hr.editor.mjs +2 -2
  30. package/esm2022/plugins/hr/hr.plugin.mjs +4 -4
  31. package/esm2022/plugins/image/image.component.mjs +2 -2
  32. package/esm2022/plugins/image/image.editor.mjs +3 -3
  33. package/esm2022/plugins/list/components/list-item.component.mjs +2 -2
  34. package/esm2022/plugins/list/list.editor.mjs +4 -4
  35. package/esm2022/plugins/list/list.plugin.mjs +21 -21
  36. package/esm2022/plugins/list/normalizers/normalize-no.mjs +4 -4
  37. package/esm2022/plugins/list/on-key-down-list.mjs +4 -4
  38. package/esm2022/plugins/list/queries/get-list-item-entry.mjs +2 -2
  39. package/esm2022/plugins/list/queries/is-in-list.mjs +2 -2
  40. package/esm2022/plugins/list/queries/is-selection-at-list-item-start.mjs +2 -2
  41. package/esm2022/plugins/list/transforms/insert-list-data.mjs +4 -4
  42. package/esm2022/plugins/list/transforms/insert-list-item.mjs +4 -4
  43. package/esm2022/plugins/list/transforms/move-list-item-sublist-items-to-list-item-sublist.mjs +2 -2
  44. package/esm2022/plugins/list/transforms/move-list-item-sublist-items-to-list.mjs +3 -3
  45. package/esm2022/plugins/list/transforms/move-list-item-up.mjs +2 -2
  46. package/esm2022/plugins/list/transforms/unwrap-list.mjs +2 -2
  47. package/esm2022/plugins/mention/mention.editor.mjs +2 -2
  48. package/esm2022/plugins/node-id/node-id.plugin.mjs +7 -7
  49. package/esm2022/plugins/normalizers/insert-paragraph-nodes.mjs +2 -2
  50. package/esm2022/plugins/normalizers/trailing-node.plugin.mjs +4 -4
  51. package/esm2022/plugins/paint-format/paint-format.editor.mjs +7 -7
  52. package/esm2022/plugins/quick-insert/components/quick-insert.component.mjs +2 -2
  53. package/esm2022/plugins/soft-break/soft-break.plugin.mjs +3 -3
  54. package/esm2022/plugins/table/components/table.component.mjs +2 -2
  55. package/esm2022/plugins/table/components/td/td.component.mjs +2 -2
  56. package/esm2022/plugins/table/components/toolbar/table-toolbar.component.mjs +2 -2
  57. package/esm2022/plugins/table/table.editor.mjs +3 -3
  58. package/esm2022/plugins/table/table.plugin.mjs +2 -2
  59. package/esm2022/plugins/table/transforms/insert-table.mjs +2 -2
  60. package/esm2022/plugins/table/transforms/move-selection-from-cell.mjs +2 -2
  61. package/esm2022/plugins/table/utils/calc-anchor-position.mjs +2 -2
  62. package/esm2022/plugins/table/utils/calculate-table.mjs +2 -2
  63. package/esm2022/plugins/table/utils/is-legal-table.mjs +4 -4
  64. package/esm2022/plugins/table/utils/merge-cell.mjs +2 -2
  65. package/esm2022/plugins/table/utils/split-cell.mjs +2 -2
  66. package/esm2022/plugins/todo-item/todo-item.component.mjs +2 -2
  67. package/esm2022/plugins/todo-item/todo-item.editor.mjs +2 -2
  68. package/esm2022/plugins/todo-item/todo-item.plugin.mjs +4 -4
  69. package/esm2022/public-api.mjs +3 -3
  70. package/esm2022/queries/index.mjs +2 -67
  71. package/esm2022/transforms/apply-deep-to-nodes.mjs +2 -2
  72. package/esm2022/transforms/delete-element.mjs +3 -3
  73. package/esm2022/transforms/delete-node-by-type.mjs +2 -2
  74. package/esm2022/transforms/handle-continual-delete-backward.mjs +2 -2
  75. package/esm2022/transforms/index.mjs +14 -34
  76. package/esm2022/transforms/insert-elements.mjs +3 -3
  77. package/esm2022/transforms/move-children.mjs +2 -2
  78. package/esm2022/transforms/on-keydown-reset-block-type.mjs +2 -2
  79. package/esm2022/transforms/set-node-by-type.mjs +2 -2
  80. package/esm2022/transforms/set-node.mjs +2 -2
  81. package/esm2022/utils/auto-focus.mjs +2 -2
  82. package/esm2022/utils/index.mjs +2 -1
  83. package/esm2022/utils/insert-data-by-invalid-type.mjs +2 -2
  84. package/esm2022/utils/normalize.mjs +61 -0
  85. package/esm2022/utils/refocus.mjs +4 -4
  86. package/fesm2022/worktile-theia.mjs +1045 -978
  87. package/fesm2022/worktile-theia.mjs.map +1 -1
  88. package/interfaces/editor.d.ts +3 -2
  89. package/interfaces/preset.d.ts +1 -1
  90. package/package.json +2 -2
  91. package/plugins/list/list.editor.d.ts +1 -1
  92. package/plugins/list/transforms/insert-list-data.d.ts +1 -1
  93. package/plugins/normalizers/trailing-node.plugin.d.ts +1 -1
  94. package/plugins/paint-format/paint-format.editor.d.ts +1 -1
  95. package/plugins/table/components/table.component.d.ts +1 -1
  96. package/plugins/table/utils/is-legal-table.d.ts +1 -1
  97. package/plugins/vertical-align/vertical-align.scss +1 -2
  98. package/public-api.d.ts +2 -2
  99. package/queries/index.d.ts +61 -82
  100. package/queries/is-range-across-blocks.d.ts +1 -1
  101. package/transforms/handle-continual-delete-backward.d.ts +1 -1
  102. package/transforms/index.d.ts +17 -29
  103. package/utils/index.d.ts +1 -0
  104. package/utils/normalize.d.ts +5 -0
@@ -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;
@@ -2276,6 +2277,63 @@ const updatePopoverPosition = (overlayRef, origin, positions = []) => {
2276
2277
  }
2277
2278
  };
2278
2279
 
2280
+ function getDirtyElements(editor, content, result) {
2281
+ const dirtyElements = result || [];
2282
+ content.forEach(value => {
2283
+ if (Element.isElement(value) && value.children.length === 0) {
2284
+ dirtyElements.push(value);
2285
+ }
2286
+ else if (Element.isElement(value)) {
2287
+ getDirtyElements(editor, value.children, dirtyElements);
2288
+ }
2289
+ });
2290
+ return dirtyElements;
2291
+ }
2292
+ function fixBlockWithoutText(editor, path) {
2293
+ const block = Node.get(editor, path);
2294
+ if (Element.isElement(block) && block.children.length === 0) {
2295
+ Transforms.insertNodes(editor, { text: '' }, { at: path.concat(0) });
2296
+ console.warn(`fix data: `, block);
2297
+ }
2298
+ }
2299
+ function fixBlockWithoutParagraph(editor, path) {
2300
+ const block = Node.get(editor, path);
2301
+ if (Element.isElement(block) && block.children.length === 0) {
2302
+ Transforms.insertNodes(editor, { type: ElementKinds.paragraph, children: [{ text: '' }] }, { at: path.concat(0) });
2303
+ console.warn(`fix data: `, block);
2304
+ }
2305
+ }
2306
+ const isLowestType = (kind) => {
2307
+ return kind === ElementKinds.paragraph || kind === ElementKinds.checkItem;
2308
+ };
2309
+ function normalizeValue(editor, value) {
2310
+ const dirtyElements = getDirtyElements(editor, value);
2311
+ if (dirtyElements && dirtyElements.length > 0) {
2312
+ setTimeout(() => {
2313
+ HistoryEditor.withoutSaving(editor, () => {
2314
+ dirtyElements.forEach((dirtyElement) => {
2315
+ try {
2316
+ const dirtyPath = AngularEditor.findPath(editor, dirtyElement);
2317
+ if (Editor.isBlock(editor, dirtyElement) && isLowestType(dirtyElement.type)) {
2318
+ fixBlockWithoutText(editor, dirtyPath);
2319
+ }
2320
+ if (Editor.isInline(editor, dirtyElement)) {
2321
+ fixBlockWithoutText(editor, dirtyPath);
2322
+ }
2323
+ if (Editor.isBlock(editor, dirtyElement) && !isLowestType(dirtyElement.type)) {
2324
+ fixBlockWithoutParagraph(editor, dirtyPath);
2325
+ }
2326
+ }
2327
+ catch (error) {
2328
+ console.error(error);
2329
+ }
2330
+ // todo 根据类型配置自定义修复函数
2331
+ });
2332
+ });
2333
+ }, 0);
2334
+ }
2335
+ }
2336
+
2279
2337
  const nextToolbarEntity = (toolbarDefinition, toolbarItems) => {
2280
2338
  const entity = {};
2281
2339
  for (const defKey in toolbarDefinition) {
@@ -2356,8 +2414,8 @@ class TheBaseToolbarItem {
2356
2414
  this.disabled = this._toolbarItem?.disable ? this._toolbarItem?.disable(editor) : false;
2357
2415
  }
2358
2416
  else {
2359
- const thePlugin = queries.getPluginByToolbarItem(editor, this._toolbarItem);
2360
- this.disabled = thePlugin && queries.getToolbarItemDisabled(editor, thePlugin.key);
2417
+ const thePlugin = getPluginByToolbarItem(editor, this._toolbarItem);
2418
+ this.disabled = thePlugin && getToolbarItemDisabled(editor, thePlugin.key);
2361
2419
  }
2362
2420
  }
2363
2421
  else {
@@ -3623,6 +3681,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
3623
3681
  }]
3624
3682
  }] });
3625
3683
 
3684
+ /**
3685
+ * Recursively apply an operation to children nodes with a query.
3686
+ */
3687
+ const applyDeepToNodes = ({ node, source, apply, query }) => {
3688
+ const entry = [node, []];
3689
+ if (isNodeType(entry, query)) {
3690
+ if (source instanceof Function) {
3691
+ apply(node, source());
3692
+ }
3693
+ else {
3694
+ apply(node, source);
3695
+ }
3696
+ }
3697
+ if (!isAncestor(node)) {
3698
+ return;
3699
+ }
3700
+ node.children.forEach((child) => {
3701
+ applyDeepToNodes({ node: child, source, apply, query });
3702
+ });
3703
+ };
3704
+
3626
3705
  const setMarks = (editor, marks, at) => {
3627
3706
  Transforms.setNodes(editor, marks, {
3628
3707
  at,
@@ -3651,6 +3730,72 @@ const clearMarks = (editor) => {
3651
3730
  }
3652
3731
  };
3653
3732
 
3733
+ const closeConversionHint = (editor) => {
3734
+ const hintRef = THE_EDITOR_CONVERSION_HINT_REF.get(editor);
3735
+ if (hintRef) {
3736
+ hintRef.close();
3737
+ }
3738
+ };
3739
+
3740
+ const deleteElement = (editor, element) => {
3741
+ const at = findPath(editor, element);
3742
+ Transforms.insertNodes(editor, createEmptyParagraph(), { at });
3743
+ AngularEditor.focus(editor);
3744
+ Transforms.select(editor, at);
3745
+ Transforms.removeNodes(editor, { at: Path.next(at) });
3746
+ };
3747
+
3748
+ const deleteNodeByType = (editor, type) => {
3749
+ const node = getAboveByType(editor, type);
3750
+ const element = node && node[0];
3751
+ if (element) {
3752
+ deleteElement(editor, element);
3753
+ }
3754
+ };
3755
+
3756
+ const unWrap = (editor, kind) => {
3757
+ Editor.withoutNormalizing(editor, () => {
3758
+ Transforms.setNodes(editor, { type: ElementKinds.paragraph });
3759
+ Transforms.unwrapNodes(editor, {
3760
+ match: n => Element.isElement(n) && n.type === kind,
3761
+ split: true
3762
+ });
3763
+ });
3764
+ };
3765
+
3766
+ function handleContinualDeleteBackward(editor, aboveResult, type) {
3767
+ const highestBlock = aboveResult[0];
3768
+ const lowestBlock = anchorBlock(editor);
3769
+ const wrapBlockType = highestBlock.type;
3770
+ if (lowestBlock && Editor.isStart(editor, editor.selection.anchor, aboveResult[1])) {
3771
+ if (wrapBlockType === type) {
3772
+ if (highestBlock.children[0] === lowestBlock) {
3773
+ unWrap(editor, wrapBlockType);
3774
+ return true;
3775
+ }
3776
+ }
3777
+ }
3778
+ return false;
3779
+ }
3780
+
3781
+ function handleContinualInsertBreak(editor, lowestBlock, type) {
3782
+ const isEmpty = Editor.isEmpty(editor, lowestBlock);
3783
+ const isEnd = Editor.isEnd(editor, editor.selection.anchor, editor.selection.focus.path);
3784
+ const aboveResult = Editor.above(editor, {
3785
+ match: n => Element.isElement(n) && n.type === type
3786
+ });
3787
+ if (aboveResult && aboveResult[0] && isEnd && isEmpty) {
3788
+ const wrapBlock = aboveResult[0];
3789
+ if (wrapBlock.type === type) {
3790
+ if (wrapBlock.children[wrapBlock.children.length - 1] === lowestBlock) {
3791
+ unWrap(editor, wrapBlock.type);
3792
+ return true;
3793
+ }
3794
+ }
3795
+ }
3796
+ return false;
3797
+ }
3798
+
3654
3799
  const insertElements = (editor, elements) => {
3655
3800
  if (!editor.selection) {
3656
3801
  refocus(editor);
@@ -3660,8 +3805,8 @@ const insertElements = (editor, elements) => {
3660
3805
  }
3661
3806
  const type = !isArray(elements) ? elements.type : elements[0].type; // 后期处理复制粘贴需要修改
3662
3807
  const allowParentTypes = getPluginOptions(editor, type)?.allowParentTypes || [];
3663
- const insertNodePath = queries.getInsertElementsPath(editor, allowParentTypes);
3664
- const [anchorBlock, anchorBlockPath] = queries.anchorBlockEntry(editor);
3808
+ const insertNodePath = getInsertElementsPath(editor, allowParentTypes);
3809
+ const [anchorBlock, anchorBlockPath] = anchorBlockEntry(editor);
3665
3810
  let isEmpty = Editor.isEmpty(editor, anchorBlock);
3666
3811
  if (insertNodePath) {
3667
3812
  Editor.withoutNormalizing(editor, () => {
@@ -3684,40 +3829,15 @@ const insertElements = (editor, elements) => {
3684
3829
  }
3685
3830
  };
3686
3831
 
3687
- const setNode = (editor, props, origin) => {
3688
- Transforms.setNodes(editor, props, { at: queries.findPath(editor, origin) });
3832
+ const insertParagraph = (editor, at) => {
3833
+ Transforms.insertNodes(editor, createEmptyParagraph(), { at });
3689
3834
  };
3690
3835
 
3691
3836
  /**
3692
- * Unwrap nodes by type
3837
+ * Recursively merge a source object to children nodes with a query.
3693
3838
  */
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;
3839
+ const mergeDeepToNodes = (options) => {
3840
+ applyDeepToNodes({ ...options, apply: defaults });
3721
3841
  };
3722
3842
 
3723
3843
  /**
@@ -3731,7 +3851,7 @@ const moveChildren = (editor, { at, to, match, start = 0 }) => {
3731
3851
  return moved;
3732
3852
  for (let i = parentNode.children.length - 1; i >= start; i--) {
3733
3853
  const childPath = [...parentPath, i];
3734
- const childNode = queries.getNode(editor, childPath);
3854
+ const childNode = getNode(editor, childPath);
3735
3855
  if (!match || (childNode && match([childNode, childPath]))) {
3736
3856
  Transforms.moveNodes(editor, { at: childPath, to });
3737
3857
  moved++;
@@ -3740,54 +3860,23 @@ const moveChildren = (editor, { at, to, match, start = 0 }) => {
3740
3860
  return moved;
3741
3861
  };
3742
3862
 
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
3863
+ const onKeyDownResetBlockType = ({ rules }) => (event, editor) => {
3864
+ let reset;
3865
+ if (editor.selection && isCollapsed(editor.selection)) {
3866
+ rules.forEach(({ types, defaultType, hotkey, predicate, onReset }) => {
3867
+ if (!event || (hotkey && isKeyHotkey(hotkey, event))) {
3868
+ if (predicate(editor) && isNodeTypeIn(editor, types)) {
3869
+ if (event !== null) {
3870
+ event.preventDefault();
3871
+ }
3872
+ Transforms.setNodes(editor, { type: defaultType });
3873
+ onReset(editor);
3874
+ reset = true;
3875
+ }
3876
+ }
3781
3877
  });
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) });
3878
+ }
3879
+ return reset;
3791
3880
  };
3792
3881
 
3793
3882
  const setEndSelection = (editor) => {
@@ -3797,83 +3886,53 @@ const setEndSelection = (editor) => {
3797
3886
  AngularEditor.focus(editor);
3798
3887
  };
3799
3888
 
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
- }
3889
+ const setNode = (editor, props, origin) => {
3890
+ Transforms.setNodes(editor, props, { at: findPath(editor, origin) });
3846
3891
  };
3847
3892
 
3848
3893
  const setNodeByType = (editor, props, type) => {
3849
- const node = queries.getAboveByType(editor, type);
3894
+ const node = getAboveByType(editor, type);
3850
3895
  const path = node && node[1];
3851
3896
  if (path) {
3852
3897
  Transforms.setNodes(editor, props, { at: path });
3853
3898
  }
3854
3899
  };
3855
3900
 
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
3901
+ /**
3902
+ * Unwrap nodes by type
3903
+ */
3904
+ const unwrapNodesByType = (editor, types, options = {}) => {
3905
+ if (!Array.isArray(types)) {
3906
+ types = [types];
3907
+ }
3908
+ Transforms.unwrapNodes(editor, {
3909
+ match: n => Element.isElement(n) && types.includes(n.type),
3910
+ ...options
3911
+ });
3875
3912
  };
3876
3913
 
3914
+ var index = /*#__PURE__*/Object.freeze({
3915
+ __proto__: null,
3916
+ applyDeepToNodes: applyDeepToNodes,
3917
+ clearMarks: clearMarks,
3918
+ closeConversionHint: closeConversionHint,
3919
+ deleteElement: deleteElement,
3920
+ deleteNodeByType: deleteNodeByType,
3921
+ handleContinualDeleteBackward: handleContinualDeleteBackward,
3922
+ handleContinualInsertBreak: handleContinualInsertBreak,
3923
+ insertElements: insertElements,
3924
+ insertParagraph: insertParagraph,
3925
+ mergeDeepToNodes: mergeDeepToNodes,
3926
+ moveChildren: moveChildren,
3927
+ onKeyDownResetBlockType: onKeyDownResetBlockType,
3928
+ setEndSelection: setEndSelection,
3929
+ setMarks: setMarks,
3930
+ setNode: setNode,
3931
+ setNodeByType: setNodeByType,
3932
+ unWrap: unWrap,
3933
+ unwrapNodesByType: unwrapNodesByType
3934
+ });
3935
+
3877
3936
  const THE_TABLE_COMPONENT_TOKEN = new InjectionToken('the-Table-token');
3878
3937
  const HEADER_CELL_CLASS = 'the-header-cell';
3879
3938
  const STICKY_CELL_CLASS = 'the-sticky-cell';
@@ -4119,7 +4178,7 @@ const calculateRowControls = (editor, element) => {
4119
4178
  };
4120
4179
  const calculateHeaderRowHeight = (editor, element) => {
4121
4180
  const firstRow = element.children[0];
4122
- if (firstRow.children.some((cell) => cell.rowspan && cell.rowspan > 1)) {
4181
+ if (firstRow.children.some(cell => cell.rowspan && cell.rowspan > 1)) {
4123
4182
  throw new Error('can not calculate header row height');
4124
4183
  }
4125
4184
  const cellDom = AngularEditor.toDOMNode(editor, firstRow.children[0]);
@@ -4717,7 +4776,7 @@ function insertTable(opts, editor, rows = 3, columns = 3, getCellContent) {
4717
4776
  }
4718
4777
  // Create the table node
4719
4778
  const table = createTable(opts, columns, rows, getCellContent);
4720
- transforms.insertElements(editor, table);
4779
+ insertElements(editor, table);
4721
4780
  }
4722
4781
 
4723
4782
  function getInsertRowState(opts, editor, count = 1, at) {
@@ -5113,7 +5172,7 @@ function mergeCell(editor, selectedCells) {
5113
5172
  selectCellNodes.forEach((cell, index) => {
5114
5173
  const { row, node } = cell;
5115
5174
  if (node) {
5116
- const cellPath = queries.findPath(editor, node);
5175
+ const cellPath = findPath(editor, node);
5117
5176
  if (index === 0) {
5118
5177
  leftTopCellPath = cellPath;
5119
5178
  }
@@ -5183,7 +5242,7 @@ function resetTableCell(editor, table, cell, cellRow, cellCol) {
5183
5242
  table.children.map((row, rowIndex) => {
5184
5243
  row.children.map((col, colIndex) => {
5185
5244
  if (rowIndex >= cellRow && rowIndex <= rowSpanIndex && colIndex >= cellCol && colIndex <= colSpanIndex) {
5186
- const path = queries.findPath(editor, col);
5245
+ const path = findPath(editor, col);
5187
5246
  Transforms.setNodes(editor, { colspan: null, rowspan: null, hidden: null }, { at: path });
5188
5247
  }
5189
5248
  });
@@ -5293,7 +5352,7 @@ const TableEditor = {
5293
5352
  const equalColumns = columns.map(() => {
5294
5353
  return { width: sumWidth / columns.length };
5295
5354
  });
5296
- transforms.setNode(editor, { columns: equalColumns }, tableElement);
5355
+ setNode(editor, { columns: equalColumns }, tableElement);
5297
5356
  }
5298
5357
  },
5299
5358
  clearCellsContent(editor, cells) {
@@ -5318,7 +5377,7 @@ const TableEditor = {
5318
5377
  return !!table;
5319
5378
  },
5320
5379
  getSelectedCellPositions(editor) {
5321
- const tableNode = queries.getAboveByType(editor, ElementKinds.table);
5380
+ const tableNode = getAboveByType(editor, ElementKinds.table);
5322
5381
  if (tableNode) {
5323
5382
  const tableComponent = ELEMENT_TO_COMPONENT.get(tableNode[0]);
5324
5383
  const selectedCellPositions = tableComponent.tableStore.getSelectedCellPositions();
@@ -5329,7 +5388,7 @@ const TableEditor = {
5329
5388
  return null;
5330
5389
  },
5331
5390
  getSelectedCells(editor, location) {
5332
- const tableNode = queries.getAboveByType(editor, ElementKinds.table, {
5391
+ const tableNode = getAboveByType(editor, ElementKinds.table, {
5333
5392
  at: location || editor.selection.anchor
5334
5393
  });
5335
5394
  if (tableNode) {
@@ -5351,7 +5410,7 @@ const TableEditor = {
5351
5410
  Transforms.setNodes(editor, { verticalAlign: alignment }, { at: cellPath });
5352
5411
  }, cells);
5353
5412
  if (!isSelected) {
5354
- const cellEntry = queries.getAboveByType(editor, ElementKinds.tableCell);
5413
+ const cellEntry = getAboveByType(editor, ElementKinds.tableCell);
5355
5414
  if (cellEntry) {
5356
5415
  const [, cellPath] = cellEntry;
5357
5416
  Transforms.setNodes(editor, { verticalAlign: alignment }, {
@@ -5368,7 +5427,7 @@ const TableEditor = {
5368
5427
  const cells = TableEditor.getSelectedCellPositions(editor);
5369
5428
  if (cells) {
5370
5429
  const lastCell = cells[cells.length - 1];
5371
- const tableNode = queries.getAboveByType(editor, ElementKinds.table);
5430
+ const tableNode = getAboveByType(editor, ElementKinds.table);
5372
5431
  const cellPath = [...tableNode[1], lastCell.row, lastCell.col];
5373
5432
  const cell = Node.get(editor, cellPath);
5374
5433
  const { verticalAlign } = cell;
@@ -5378,7 +5437,7 @@ const TableEditor = {
5378
5437
  return verticalAlign === alignment;
5379
5438
  }
5380
5439
  else {
5381
- const cellElement = queries.getAboveByType(editor, ElementKinds.tableCell);
5440
+ const cellElement = getAboveByType(editor, ElementKinds.tableCell);
5382
5441
  if (cellElement) {
5383
5442
  const { verticalAlign } = cellElement[0];
5384
5443
  if (!verticalAlign && alignment === VerticalAlignment.top) {
@@ -5413,12 +5472,12 @@ const TableEditor = {
5413
5472
  MarkProps.forEach(key => {
5414
5473
  unsetMarks[key] = null;
5415
5474
  });
5416
- transforms.setMarks(editor, unsetMarks, cellRange);
5475
+ setMarks(editor, unsetMarks, cellRange);
5417
5476
  });
5418
5477
  },
5419
5478
  formatBrush(editor, marks) {
5420
5479
  return TableEditor.handleSelectedCells(editor, (cellPath, cellRange) => {
5421
- transforms.setMarks(editor, marks, cellRange);
5480
+ setMarks(editor, marks, cellRange);
5422
5481
  });
5423
5482
  },
5424
5483
  handleSelectedCells(editor, handle, cells) {
@@ -5470,7 +5529,7 @@ const TableEditor = {
5470
5529
  return isHeaderRow && isContainHeaderRow;
5471
5530
  },
5472
5531
  hasHeaderColumnCell(editor) {
5473
- const table = queries.getAboveByType(editor, ElementKinds.table);
5532
+ const table = getAboveByType(editor, ElementKinds.table);
5474
5533
  const selectedCells = TableEditor.getSelectedCellPositions(editor) ?? [];
5475
5534
  sortCell(selectedCells);
5476
5535
  const isContainHeaderColumn = !!selectedCells && selectedCells[0].col === 0;
@@ -5486,7 +5545,7 @@ const TableEditor = {
5486
5545
  },
5487
5546
  handleIndent(editor, indentType) {
5488
5547
  return TableEditor.handleSelectedCells(editor, (cellPath, cellRange) => {
5489
- const children = queries.getNode(editor, cellPath).children;
5548
+ const children = getNode(editor, cellPath).children;
5490
5549
  if (children.length) {
5491
5550
  children.forEach((child, index) => {
5492
5551
  setCellIndent(editor, indentType, child, [...cellPath, index]);
@@ -5501,7 +5560,7 @@ const AlignEditor = {
5501
5560
  if (!editor?.selection) {
5502
5561
  return;
5503
5562
  }
5504
- const blockElement = queries.anchorBlock(editor);
5563
+ const blockElement = anchorBlock(editor);
5505
5564
  if (blockElement) {
5506
5565
  const { align } = blockElement;
5507
5566
  if (!align && alignment === Alignment.left) {
@@ -5516,7 +5575,7 @@ const AlignEditor = {
5516
5575
  },
5517
5576
  isDisabled(editor) {
5518
5577
  const { richMedia } = editor.options;
5519
- return queries.getToolbarItemDisabled(editor, PluginKeys.align, richMedia ? [ElementKinds.image] : []);
5578
+ return getToolbarItemDisabled(editor, PluginKeys.align, richMedia ? [ElementKinds.image] : []);
5520
5579
  },
5521
5580
  setAlign(editor, alignment) {
5522
5581
  if (TableEditor.setAlign(editor, alignment)) {
@@ -5534,7 +5593,7 @@ const AlignEditor = {
5534
5593
 
5535
5594
  const BlockquoteEditor = {
5536
5595
  toggleBlockquote(editor) {
5537
- const isActive = queries.isBlockActive(editor, ElementKinds.blockquote);
5596
+ const isActive = isBlockActive(editor, ElementKinds.blockquote);
5538
5597
  const allowParentTypes = getPluginOptions(editor, PluginKeys.blockquote)?.allowParentTypes || [];
5539
5598
  if (!isActive) {
5540
5599
  Transforms.wrapNodes(editor, { type: ElementKinds.blockquote, children: [] }, {
@@ -5550,10 +5609,10 @@ const BlockquoteEditor = {
5550
5609
  const CodeEditor = {
5551
5610
  setCodeAttribute(editor, props, element) {
5552
5611
  if (!element) {
5553
- transforms.setNodeByType(editor, props, ElementKinds.code);
5612
+ setNodeByType(editor, props, ElementKinds.code);
5554
5613
  }
5555
5614
  else {
5556
- const path = queries.findPath(editor, element);
5615
+ const path = findPath(editor, element);
5557
5616
  Transforms.setNodes(editor, props, { at: path });
5558
5617
  }
5559
5618
  },
@@ -5580,7 +5639,7 @@ const CodeEditor = {
5580
5639
  language: DEFAULT_LANGUAGE.value,
5581
5640
  children: [{ text: '' }]
5582
5641
  };
5583
- transforms.insertElements(editor, codeElement);
5642
+ insertElements(editor, codeElement);
5584
5643
  }
5585
5644
  else {
5586
5645
  const codeElement = {
@@ -5589,15 +5648,15 @@ const CodeEditor = {
5589
5648
  language: DEFAULT_LANGUAGE.value,
5590
5649
  children: [{ text: '' }]
5591
5650
  };
5592
- transforms.insertElements(editor, codeElement);
5651
+ insertElements(editor, codeElement);
5593
5652
  }
5594
5653
  },
5595
5654
  removeCode(editor, code) {
5596
5655
  if (code) {
5597
- transforms.deleteElement(editor, code);
5656
+ deleteElement(editor, code);
5598
5657
  }
5599
5658
  else {
5600
- transforms.deleteNodeByType(editor, ElementKinds.code);
5659
+ deleteNodeByType(editor, ElementKinds.code);
5601
5660
  }
5602
5661
  }
5603
5662
  };
@@ -5643,15 +5702,15 @@ const HeadingEditor = {
5643
5702
  split: true
5644
5703
  });
5645
5704
  Transforms.setNodes(editor, { type: heading });
5646
- const entry = queries.anchorBlockEntry(editor);
5705
+ const entry = anchorBlockEntry(editor);
5647
5706
  const unMarks = {
5648
5707
  [MarkTypes.fontSize]: null
5649
5708
  };
5650
5709
  if (entry) {
5651
- transforms.setMarks(editor, unMarks, entry[1]);
5710
+ setMarks(editor, unMarks, entry[1]);
5652
5711
  return;
5653
5712
  }
5654
- transforms.setMarks(editor, unMarks, editor.selection);
5713
+ setMarks(editor, unMarks, editor.selection);
5655
5714
  });
5656
5715
  },
5657
5716
  isHeadingActive(editor, heading) {
@@ -5677,7 +5736,7 @@ const HeadingEditor = {
5677
5736
 
5678
5737
  const HrEditor = {
5679
5738
  insertHr(editor) {
5680
- transforms.insertElements(editor, { type: ElementKinds.hr, children: [{ text: '' }] });
5739
+ insertElements(editor, { type: ElementKinds.hr, children: [{ text: '' }] });
5681
5740
  },
5682
5741
  isHrActive(editor) {
5683
5742
  const [match] = Editor.nodes(editor, {
@@ -5847,7 +5906,7 @@ const ImageEditor = {
5847
5906
  }
5848
5907
  }
5849
5908
  if (imageNodes.length > 0) {
5850
- transforms.insertElements(editor, imageNodes);
5909
+ insertElements(editor, imageNodes);
5851
5910
  }
5852
5911
  },
5853
5912
  handleBase64ImageElement(editor, image) {
@@ -5908,10 +5967,10 @@ const ImageEditor = {
5908
5967
  },
5909
5968
  setImageNode(editor, props, image) {
5910
5969
  if (!image) {
5911
- transforms.setNodeByType(editor, props, ElementKinds.image);
5970
+ setNodeByType(editor, props, ElementKinds.image);
5912
5971
  }
5913
5972
  else {
5914
- const path = queries.findPath(editor, image);
5973
+ const path = findPath(editor, image);
5915
5974
  Transforms.setNodes(editor, props, { at: path });
5916
5975
  }
5917
5976
  },
@@ -5920,10 +5979,10 @@ const ImageEditor = {
5920
5979
  },
5921
5980
  removeImage(editor, image) {
5922
5981
  if (image) {
5923
- transforms.deleteElement(editor, image);
5982
+ deleteElement(editor, image);
5924
5983
  }
5925
5984
  else {
5926
- transforms.deleteNodeByType(editor, ElementKinds.image);
5985
+ deleteNodeByType(editor, ElementKinds.image);
5927
5986
  }
5928
5987
  }
5929
5988
  };
@@ -6153,8 +6212,8 @@ const ListEditor = {
6153
6212
  },
6154
6213
  unwrapList(editor) {
6155
6214
  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' });
6215
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true, mode: 'all' });
6216
+ unwrapNodesByType(editor, [ElementKinds.listItem], { split: true, mode: 'all' });
6158
6217
  });
6159
6218
  },
6160
6219
  wrapList(editor, type) {
@@ -6172,11 +6231,11 @@ const ListEditor = {
6172
6231
  });
6173
6232
  },
6174
6233
  isActive(editor, type) {
6175
- const [match] = queries.getNodesByType(editor, type);
6234
+ const [match] = getNodesByType(editor, type);
6176
6235
  return !!match;
6177
6236
  },
6178
6237
  getActiveList(editor) {
6179
- const [match] = queries.getNodesByType(editor, LIST_BLOCK_TYPES);
6238
+ const [match] = getNodesByType(editor, LIST_BLOCK_TYPES);
6180
6239
  return match;
6181
6240
  },
6182
6241
  buildListItem(editor) {
@@ -6250,7 +6309,7 @@ const MentionEditor = {
6250
6309
  Transforms.insertText(editor, ` ${currentMention.trigger}`);
6251
6310
  setTimeout(() => {
6252
6311
  THE_EDITOR_ORIGIN_ANCHOR.set(editor, Editor.before(editor, editor.selection.anchor));
6253
- const textElement = AngularEditor.toDOMNode(editor, queries.anchorBlockEntry(editor)[0]);
6312
+ const textElement = AngularEditor.toDOMNode(editor, anchorBlockEntry(editor)[0]);
6254
6313
  MentionEditor.openSelectOverlay(editor, type, textElement);
6255
6314
  });
6256
6315
  },
@@ -6262,7 +6321,7 @@ const MentionEditor = {
6262
6321
  openSuggestion(editor, type) {
6263
6322
  const { selection } = editor;
6264
6323
  const elementRef = editor.injector.get(ElementRef);
6265
- const isParagraphStart = Editor.isStart(editor, selection?.anchor, queries.anchorBlockEntry(editor)[1]);
6324
+ const isParagraphStart = Editor.isStart(editor, selection?.anchor, anchorBlockEntry(editor)[1]);
6266
6325
  const originAnchor = THE_EDITOR_ORIGIN_ANCHOR.get(editor);
6267
6326
  let text = '';
6268
6327
  if (!isParagraphStart) {
@@ -6277,7 +6336,7 @@ const MentionEditor = {
6277
6336
  if (!originAnchor) {
6278
6337
  THE_EDITOR_ORIGIN_ANCHOR.set(editor, editor.selection.anchor);
6279
6338
  }
6280
- const textElement = AngularEditor.toDOMNode(editor, queries.anchorBlockEntry(editor)[0]);
6339
+ const textElement = AngularEditor.toDOMNode(editor, anchorBlockEntry(editor)[0]);
6281
6340
  const origin = isParagraphStart ? textElement : elementRef;
6282
6341
  MentionEditor.openSelectOverlay(editor, type, origin, isSoftBreak);
6283
6342
  }
@@ -6370,11 +6429,11 @@ const MentionEditor = {
6370
6429
  editor.insertText(' ');
6371
6430
  },
6372
6431
  isActive(editor, type) {
6373
- const [match] = queries.getNodesByType(editor, type);
6432
+ const [match] = getNodesByType(editor, type);
6374
6433
  return !!match;
6375
6434
  },
6376
6435
  updatePositionStrategy(editor, isSoftBreak = false) {
6377
- const textElement = AngularEditor.toDOMNode(editor, queries.anchorBlockEntry(editor)[0]);
6436
+ const textElement = AngularEditor.toDOMNode(editor, anchorBlockEntry(editor)[0]);
6378
6437
  const nativeRange = AngularEditor.toDOMRange(editor, editor.selection);
6379
6438
  const cursorRect = nativeRange.getBoundingClientRect();
6380
6439
  const textElementRect = textElement.getBoundingClientRect();
@@ -6577,7 +6636,7 @@ const QuickInsertEditor = {
6577
6636
 
6578
6637
  const TodoItemEditor = {
6579
6638
  isActive(editor) {
6580
- const [match] = queries.getNodesByType(editor, ElementKinds.checkItem);
6639
+ const [match] = getNodesByType(editor, ElementKinds.checkItem);
6581
6640
  return !!match;
6582
6641
  },
6583
6642
  insertTodoItem(editor) {
@@ -7245,8 +7304,8 @@ class TheInlineToolbar {
7245
7304
  inlineToolbar.removeAttribute('style');
7246
7305
  return;
7247
7306
  }
7248
- const anchorBlock = queries.anchorBlock(this.editor);
7249
- if (!inlineToolbar || !anchorBlock) {
7307
+ const anchorBlock$1 = anchorBlock(this.editor);
7308
+ if (!inlineToolbar || !anchorBlock$1) {
7250
7309
  return;
7251
7310
  }
7252
7311
  const { editor } = this;
@@ -7258,7 +7317,7 @@ class TheInlineToolbar {
7258
7317
  inlineToolbar.removeAttribute('style');
7259
7318
  return;
7260
7319
  }
7261
- if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock.type)) {
7320
+ if (!THE_INLINE_TOOLBAR_TYPES.includes(anchorBlock$1.type)) {
7262
7321
  return;
7263
7322
  }
7264
7323
  const native = window.getSelection();
@@ -7367,7 +7426,7 @@ class TheConversionHint {
7367
7426
  creatCloseTimer() {
7368
7427
  this.closeTimer = setInterval(() => {
7369
7428
  clearInterval(this.closeTimer);
7370
- transforms.closeConversionHint(this.editor);
7429
+ closeConversionHint(this.editor);
7371
7430
  }, this.duration);
7372
7431
  }
7373
7432
  clearCloseTimer() {
@@ -7900,7 +7959,7 @@ const withAlign = (editor) => {
7900
7959
  const { deleteBackward } = editor;
7901
7960
  editor.deleteBackward = unit => {
7902
7961
  const { anchor } = editor.selection;
7903
- const node = queries.anchorBlock(editor);
7962
+ const node = anchorBlock(editor);
7904
7963
  const isVoid = Element.isElement(node) && Editor.isVoid(editor, node);
7905
7964
  const alignTypes = [Alignment.center, Alignment.right];
7906
7965
  const startLine = Editor.start(editor, anchor.path);
@@ -8069,7 +8128,7 @@ const defaultAutoFormatRules = [
8069
8128
  type: ElementKinds.listItem,
8070
8129
  markup: [],
8071
8130
  match: (editor) => {
8072
- return queries.isParagraph(editor) ? ['*', '-', '+'] : [];
8131
+ return isParagraph(editor) ? ['*', '-', '+'] : [];
8073
8132
  },
8074
8133
  format: (editor) => {
8075
8134
  ListEditor.toggleList(editor, ElementKinds.bulletedList);
@@ -8080,7 +8139,7 @@ const defaultAutoFormatRules = [
8080
8139
  type: ElementKinds.listItem,
8081
8140
  markup: [],
8082
8141
  match: (editor, textFromBlockStart) => {
8083
- return queries.isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
8142
+ return isParagraph(editor) && /^-?\d+(\.|\))$/.test(textFromBlockStart) ? [textFromBlockStart] : [];
8084
8143
  },
8085
8144
  format: (editor, markup) => {
8086
8145
  let startIndex = 1;
@@ -8098,7 +8157,7 @@ const defaultAutoFormatRules = [
8098
8157
  type: ElementKinds.checkItem,
8099
8158
  markup: [],
8100
8159
  match: (editor) => {
8101
- return queries.isParagraph(editor) ? ['[]'] : [];
8160
+ return isParagraph(editor) ? ['[]'] : [];
8102
8161
  },
8103
8162
  format: (editor) => {
8104
8163
  TodoItemEditor.insertTodoItem(editor);
@@ -8131,14 +8190,14 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format })
8131
8190
  const endMarkup = between ? between[1] : '';
8132
8191
  let endMarkupPointBefore = selection.anchor;
8133
8192
  if (endMarkup) {
8134
- endMarkupPointBefore = queries.getPointBefore(editor, selection, {
8193
+ endMarkupPointBefore = getPointBefore(editor, selection, {
8135
8194
  matchString: endMarkup
8136
8195
  });
8137
8196
  if (!endMarkupPointBefore) {
8138
8197
  return false;
8139
8198
  }
8140
8199
  }
8141
- const startMarkupPointAfter = queries.getPointBefore(editor, endMarkupPointBefore, {
8200
+ const startMarkupPointAfter = getPointBefore(editor, endMarkupPointBefore, {
8142
8201
  matchString: startMarkup,
8143
8202
  skipInvalid: true,
8144
8203
  afterMatch: true
@@ -8152,14 +8211,14 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format })
8152
8211
  focus: endMarkupPointBefore
8153
8212
  };
8154
8213
  if (!ignoreTrim) {
8155
- const markupText = queries.getText(editor, markupRange);
8214
+ const markupText = getText(editor, markupRange);
8156
8215
  if (markupText.trim() !== markupText) {
8157
8216
  return false;
8158
8217
  }
8159
8218
  }
8160
8219
  // delete end markup
8161
8220
  if (endMarkup) {
8162
- endMarkupPointBefore = queries.getPointBefore(editor, selection, {
8221
+ endMarkupPointBefore = getPointBefore(editor, selection, {
8163
8222
  matchString: endMarkup
8164
8223
  });
8165
8224
  Transforms.delete(editor, {
@@ -8169,12 +8228,12 @@ const autoFormatInline = (editor, { type, between, markup, ignoreTrim, format })
8169
8228
  }
8170
8229
  });
8171
8230
  }
8172
- const startMarkupPointBefore = queries.getPointBefore(editor, selection, {
8231
+ const startMarkupPointBefore = getPointBefore(editor, selection, {
8173
8232
  matchString: startMarkup,
8174
8233
  skipInvalid: true
8175
8234
  });
8176
8235
  if (format) {
8177
- const markupText = queries.getText(editor, markupRange);
8236
+ const markupText = getText(editor, markupRange);
8178
8237
  format(editor, markupText);
8179
8238
  // delete start to end selection
8180
8239
  Transforms.delete(editor, {
@@ -8219,7 +8278,7 @@ const withAutoFormat = (editor) => {
8219
8278
  let autoFormatRules = getPluginOptions(editor, PluginKeys.autoFormat)?.autoFormatRules;
8220
8279
  const extraRules = mergAutoFormateRules(autoFormatRules);
8221
8280
  autoFormatRules = Object.values(extraRules);
8222
- if (!queries.isCollapsed(editor.selection)) {
8281
+ if (!isCollapsed(editor.selection)) {
8223
8282
  return insertText(text);
8224
8283
  }
8225
8284
  for (const { query, ...rule } of autoFormatRules) {
@@ -8235,15 +8294,15 @@ const withAutoFormat = (editor) => {
8235
8294
  let markups = castArray(markup);
8236
8295
  let markupRange;
8237
8296
  if (triggerAtBlockStart) {
8238
- markupRange = queries.getRangeFromBlockStart(editor);
8297
+ markupRange = getRangeFromBlockStart(editor);
8239
8298
  // Don't autoformat if there is void nodes.
8240
- const hasVoidNode = queries.someNode(editor, {
8299
+ const hasVoidNode = someNode(editor, {
8241
8300
  at: markupRange,
8242
8301
  match: n => Element.isElement(n) && Editor.isVoid(editor, n)
8243
8302
  });
8244
8303
  if (hasVoidNode)
8245
8304
  continue;
8246
- const textFromBlockStart = queries.getText(editor, markupRange);
8305
+ const textFromBlockStart = getText(editor, markupRange);
8247
8306
  if (match) {
8248
8307
  markups = match(editor, textFromBlockStart);
8249
8308
  }
@@ -8251,13 +8310,13 @@ const withAutoFormat = (editor) => {
8251
8310
  continue;
8252
8311
  }
8253
8312
  else {
8254
- markupRange = queries.getRangeBefore(editor, editor.selection, {
8313
+ markupRange = getRangeBefore(editor, editor.selection, {
8255
8314
  matchString: markup,
8256
8315
  skipInvalid: true
8257
8316
  });
8258
8317
  if (!markupRange)
8259
8318
  continue;
8260
- const blockAbovePath = queries.getBlockAbove(editor)?.[1];
8319
+ const blockAbovePath = getBlockAbove(editor)?.[1];
8261
8320
  if (!blockAbovePath)
8262
8321
  continue;
8263
8322
  // If the markup is not at the start, insert break before autoformatting.
@@ -8267,7 +8326,7 @@ const withAutoFormat = (editor) => {
8267
8326
  }
8268
8327
  if (!allowSameTypeAbove) {
8269
8328
  // Don't autoformat if already in a block of the same type.
8270
- const isBelowSameBlockType = queries.someNode(editor, { match: { type } });
8329
+ const isBelowSameBlockType = someNode(editor, { match: { type } });
8271
8330
  if (isBelowSameBlockType)
8272
8331
  continue;
8273
8332
  }
@@ -8335,19 +8394,19 @@ const withBlockquote = (editor) => {
8335
8394
  if (!aboveResult) {
8336
8395
  return deleteBackward(unit);
8337
8396
  }
8338
- const hasHandled = transforms.handleContinualDeleteBackward(editor, aboveResult, ElementKinds.blockquote);
8397
+ const hasHandled = handleContinualDeleteBackward(editor, aboveResult, ElementKinds.blockquote);
8339
8398
  if (hasHandled) {
8340
8399
  return;
8341
8400
  }
8342
8401
  return deleteBackward(unit);
8343
8402
  };
8344
8403
  editor.insertBreak = () => {
8345
- const lowestBlock = queries.anchorBlock(editor);
8404
+ const lowestBlock = anchorBlock(editor);
8346
8405
  if (!lowestBlock) {
8347
8406
  insertBreak();
8348
8407
  return;
8349
8408
  }
8350
- const hasHandled = transforms.handleContinualInsertBreak(editor, lowestBlock, ElementKinds.blockquote);
8409
+ const hasHandled = handleContinualInsertBreak(editor, lowestBlock, ElementKinds.blockquote);
8351
8410
  if (hasHandled) {
8352
8411
  return;
8353
8412
  }
@@ -8373,7 +8432,7 @@ const createBlockquotePlugin = createPluginFactory({
8373
8432
  key: ElementKinds.blockquote,
8374
8433
  icon: 'blockquote',
8375
8434
  name: '引用',
8376
- active: editor => queries.isBlockActive(editor, ElementKinds.blockquote),
8435
+ active: editor => isBlockActive(editor, ElementKinds.blockquote),
8377
8436
  execute: editor => BlockquoteEditor.toggleBlockquote(editor)
8378
8437
  }
8379
8438
  ],
@@ -8382,7 +8441,7 @@ const createBlockquotePlugin = createPluginFactory({
8382
8441
  key: ElementKinds.blockquote,
8383
8442
  type: ThePluginMenuItemType.group,
8384
8443
  keywords: 'yy,yinyong,quote,引用',
8385
- active: editor => queries.isBlockActive(editor, ElementKinds.blockquote),
8444
+ active: editor => isBlockActive(editor, ElementKinds.blockquote),
8386
8445
  execute: editor => BlockquoteEditor.toggleBlockquote(editor),
8387
8446
  name: '引用',
8388
8447
  description: '支持引用内容',
@@ -8499,7 +8558,7 @@ class TheCode extends TheBaseElement {
8499
8558
  this.maxHeight = isPrintMode(this.editor) ? 0 : 350 - CODEMIRROR_PADDING_TOP * 2;
8500
8559
  }
8501
8560
  openToolbar() {
8502
- if (!queries.isGlobalCollapsed(this.editor) || this.isToolbarOpen) {
8561
+ if (!isGlobalCollapsed(this.editor) || this.isToolbarOpen) {
8503
8562
  return;
8504
8563
  }
8505
8564
  this.toolbarPopoverRef = this.thyPopover.open(this.toolbar, {
@@ -8654,8 +8713,8 @@ const withCode = (editor) => {
8654
8713
  setFragmentData(unit);
8655
8714
  const { selection } = editor;
8656
8715
  const [start] = Editor.edges(editor, selection);
8657
- if (queries.isNodeTypeIn(editor, [ElementKinds.code], { at: start })) {
8658
- const [codeNode] = queries.getAboveByType(editor, ElementKinds.code);
8716
+ if (isNodeTypeIn(editor, [ElementKinds.code], { at: start })) {
8717
+ const [codeNode] = getAboveByType(editor, ElementKinds.code);
8659
8718
  unit.setData('text/plain', codeNode.content.trim());
8660
8719
  return unit;
8661
8720
  }
@@ -8670,7 +8729,7 @@ const createCodePlugin = createPluginFactory({
8670
8729
  key: ElementKinds.code,
8671
8730
  icon: 'code-syntax',
8672
8731
  name: '代码块',
8673
- active: editor => queries.isBlockActive(editor, ElementKinds.code),
8732
+ active: editor => isBlockActive(editor, ElementKinds.code),
8674
8733
  execute: editor => CodeEditor.insertCode(editor)
8675
8734
  }
8676
8735
  ],
@@ -8679,7 +8738,7 @@ const createCodePlugin = createPluginFactory({
8679
8738
  key: ElementKinds.code,
8680
8739
  type: ThePluginMenuItemType.group,
8681
8740
  keywords: 'dmk,daimakuai,code,代码块',
8682
- active: editor => queries.isBlockActive(editor, ElementKinds.code),
8741
+ active: editor => isBlockActive(editor, ElementKinds.code),
8683
8742
  execute: editor => CodeEditor.insertCode(editor),
8684
8743
  name: '代码块',
8685
8744
  description: '支持插入语法高亮的代码',
@@ -8820,7 +8879,7 @@ const withBlockCard = (editor) => {
8820
8879
  const isLeftCursor = isCardLeft(anchorNode);
8821
8880
  const cardEntry = AngularEditor.toSlateCardEntry(editor, anchorNode);
8822
8881
  const cursorRootPath = cardEntry[1];
8823
- transforms.insertParagraph(editor, isLeftCursor ? cursorRootPath : Path.next(cursorRootPath));
8882
+ insertParagraph(editor, isLeftCursor ? cursorRootPath : Path.next(cursorRootPath));
8824
8883
  if (!isLeftCursor) {
8825
8884
  Transforms.select(editor, Path.next(cursorRootPath));
8826
8885
  }
@@ -8840,7 +8899,7 @@ const withBlockCard = (editor) => {
8840
8899
  if (!previousPath) {
8841
8900
  return;
8842
8901
  }
8843
- if (previousPath && queries.isEmptyParagraphByPath(editor, previousPath)) {
8902
+ if (previousPath && isEmptyParagraphByPath(editor, previousPath)) {
8844
8903
  Transforms.removeNodes(editor, {
8845
8904
  at: previousPath
8846
8905
  });
@@ -8852,17 +8911,17 @@ const withBlockCard = (editor) => {
8852
8911
  return;
8853
8912
  }
8854
8913
  else {
8855
- transforms.insertParagraph(editor, cursorRootPath);
8914
+ insertParagraph(editor, cursorRootPath);
8856
8915
  Transforms.select(editor, cursorRootPath);
8857
8916
  Transforms.removeNodes(editor, { at: Path.next(cursorRootPath) });
8858
8917
  return;
8859
8918
  }
8860
8919
  }
8861
- const blockCard = queries.getBlockCardAbove(editor);
8920
+ const blockCard = getBlockCardAbove(editor);
8862
8921
  const beforePoint = Editor.before(editor, editor.selection.anchor);
8863
- const beforeBlockCard = queries.getBlockCardAbove(editor, { at: beforePoint });
8922
+ const beforeBlockCard = getBlockCardAbove(editor, { at: beforePoint });
8864
8923
  if (!blockCard && beforeBlockCard) {
8865
- if (queries.isBlockAboveEmpty(editor)) {
8924
+ if (isBlockAboveEmpty(editor)) {
8866
8925
  const [node, path] = Editor.parent(editor, editor.selection.anchor.path);
8867
8926
  HistoryEditor.withoutMerging(editor, () => {
8868
8927
  const rightCursor = { path: beforeBlockCard[1], offset: FAKE_RIGHT_BLOCK_CARD_OFFSET };
@@ -8886,7 +8945,7 @@ const withBlockCard = (editor) => {
8886
8945
  const cardEntry = AngularEditor.toSlateCardEntry(editor, anchorNode);
8887
8946
  const cursorRootPath = cardEntry[1];
8888
8947
  if (isLeftCursor) {
8889
- transforms.insertParagraph(editor, cursorRootPath);
8948
+ insertParagraph(editor, cursorRootPath);
8890
8949
  Transforms.select(editor, cursorRootPath);
8891
8950
  Transforms.removeNodes(editor, { at: Path.next(cursorRootPath) });
8892
8951
  return;
@@ -8899,11 +8958,11 @@ const withBlockCard = (editor) => {
8899
8958
  return;
8900
8959
  }
8901
8960
  }
8902
- const blockCard = queries.getBlockCardAbove(editor);
8961
+ const blockCard = getBlockCardAbove(editor);
8903
8962
  const afterPoint = Editor.after(editor, editor.selection.anchor);
8904
- const afterBlockCard = queries.getBlockCardAbove(editor, { at: afterPoint });
8963
+ const afterBlockCard = getBlockCardAbove(editor, { at: afterPoint });
8905
8964
  if (!blockCard && afterBlockCard) {
8906
- if (queries.isBlockAboveEmpty(editor)) {
8965
+ if (isBlockAboveEmpty(editor)) {
8907
8966
  HistoryEditor.withoutMerging(editor, () => {
8908
8967
  const leftCursor = { path: afterBlockCard[1], offset: -1 };
8909
8968
  Transforms.select(editor, { anchor: leftCursor, focus: leftCursor });
@@ -8925,14 +8984,14 @@ const withBlockCard = (editor) => {
8925
8984
  const isMoveUp = hotkeys.isMoveUp(nativeEvent);
8926
8985
  const isMoveDown = hotkeys.isMoveDown(nativeEvent);
8927
8986
  const isCollapsed = selection && Range.isCollapsed(selection);
8928
- const anchorEntry = queries.anchorBlockEntry(editor);
8987
+ const anchorEntry = anchorBlockEntry(editor);
8929
8988
  // block card cursor
8930
8989
  if (anchorNode && hasBlockCard(domSelection)) {
8931
8990
  const isCardLeftCursor = isCardLeft(anchorNode);
8932
8991
  if (isMoveUp) {
8933
8992
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8934
8993
  const previousPath = Path.hasPrevious(path) && Path.previous(path);
8935
- const previousNode = previousPath && queries.getNode(editor, previousPath);
8994
+ const previousNode = previousPath && getNode(editor, previousPath);
8936
8995
  if (previousNode && editor.isBlockCard(previousNode)) {
8937
8996
  AngularEditor.moveBlockCard(editor, previousNode, { direction: isCardLeftCursor ? 'left' : 'right' });
8938
8997
  }
@@ -8948,7 +9007,7 @@ const withBlockCard = (editor) => {
8948
9007
  if (isMoveDown) {
8949
9008
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8950
9009
  const nextPath = Path.next(path);
8951
- const nextNode = queries.getNode(editor, nextPath);
9010
+ const nextNode = getNode(editor, nextPath);
8952
9011
  if (nextNode && editor.isBlockCard(nextNode)) {
8953
9012
  AngularEditor.moveBlockCard(editor, nextNode, { direction: isCardLeftCursor ? 'left' : 'right' });
8954
9013
  }
@@ -8966,7 +9025,7 @@ const withBlockCard = (editor) => {
8966
9025
  nativeEvent.preventDefault();
8967
9026
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8968
9027
  const nextPath = Path.next(path);
8969
- const nextNode = queries.getNode(editor, nextPath);
9028
+ const nextNode = getNode(editor, nextPath);
8970
9029
  if (nextNode && editor.isBlockCard(nextNode)) {
8971
9030
  event.preventDefault();
8972
9031
  AngularEditor.moveBlockCard(editor, nextNode, { direction: 'left' });
@@ -8983,7 +9042,7 @@ const withBlockCard = (editor) => {
8983
9042
  nativeEvent.preventDefault();
8984
9043
  const [, path] = AngularEditor.toSlateCardEntry(editor, anchorNode);
8985
9044
  const previousPath = Path.hasPrevious(path) && Path.previous(path);
8986
- const previousNode = previousPath && queries.getNode(editor, previousPath);
9045
+ const previousNode = previousPath && getNode(editor, previousPath);
8987
9046
  if (previousNode && editor.isBlockCard(previousNode)) {
8988
9047
  event.preventDefault();
8989
9048
  AngularEditor.moveBlockCard(editor, previousNode, { direction: 'right' });
@@ -9170,10 +9229,10 @@ const withGetFragment = (editor) => {
9170
9229
  const elementKinds = getPluginOptions(editor, PluginKeys.getFragment)?.types ?? [];
9171
9230
  editor.getFragment = () => {
9172
9231
  const { selection } = editor;
9173
- const containerBlocks = [...elementKinds, ...queries.getContainerBlocks(editor)];
9232
+ const containerBlocks = [...elementKinds, ...getContainerBlocks(editor)];
9174
9233
  if (selection && selection.anchor.path[0] === selection.focus.path[0]) {
9175
9234
  const fragmentData = getFragment();
9176
- const nodes = queries.getSelectionNodesByType(editor, fragmentData, containerBlocks);
9235
+ const nodes = getSelectionNodesByType(editor, fragmentData, containerBlocks);
9177
9236
  return nodes && Element.isElement(nodes) ? nodes.children : fragmentData;
9178
9237
  }
9179
9238
  return getFragment();
@@ -9250,7 +9309,7 @@ const withMoveSelection = (editor) => {
9250
9309
  if (inlineBlockEntry &&
9251
9310
  !(Element.isElement(inlineBlockEntry[0]) && Editor.isVoid(editor, inlineBlockEntry[0])) &&
9252
9311
  selection.anchor.offset === 0) {
9253
- const beforePoint = queries.getPointBefore(editor, selection.focus);
9312
+ const beforePoint = getPointBefore(editor, selection.focus);
9254
9313
  Transforms.select(editor, beforePoint);
9255
9314
  }
9256
9315
  deleteBackward(unit);
@@ -9263,9 +9322,9 @@ const withMoveSelection = (editor) => {
9263
9322
  }
9264
9323
  const isMoveBackward = hotkeys.isMoveBackward(event);
9265
9324
  const isMoveForward = hotkeys.isMoveForward(event);
9266
- const isCollapsed = selection && queries.isCollapsed(selection);
9325
+ const isCollapsed$1 = selection && isCollapsed(selection);
9267
9326
  const isInlineNode = isInline(editor);
9268
- if (isCollapsed && isMoveForward) {
9327
+ if (isCollapsed$1 && isMoveForward) {
9269
9328
  let isInlineCodeBefore = false;
9270
9329
  if (!isInlineNode) {
9271
9330
  try {
@@ -9282,7 +9341,7 @@ const withMoveSelection = (editor) => {
9282
9341
  return;
9283
9342
  }
9284
9343
  }
9285
- if (isCollapsed && isMoveBackward) {
9344
+ if (isCollapsed$1 && isMoveBackward) {
9286
9345
  let isInlineCodeAfter = false;
9287
9346
  if (!isInlineNode) {
9288
9347
  try {
@@ -9323,16 +9382,16 @@ const withRemoveEmpty = (editor) => {
9323
9382
  const { deleteBackward, deleteForward } = editor;
9324
9383
  editor.deleteBackward = unit => {
9325
9384
  const { selection } = editor;
9326
- const anchorBlock = queries.anchorBlock(editor);
9327
- if (!anchorBlock) {
9385
+ const anchorBlock$1 = anchorBlock(editor);
9386
+ if (!anchorBlock$1) {
9328
9387
  deleteBackward(unit);
9329
9388
  return;
9330
9389
  }
9331
9390
  // delete empty paragraphs or empty headings, the default operation is to delete before the void node
9332
9391
  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) {
9392
+ const isEmptyHeading = HEADING_TYPES.includes(anchorBlock$1.type) && Editor.isEmpty(editor, anchorBlock$1);
9393
+ const isEmptyParagraph$1 = isEmptyParagraph(editor, editor.selection.anchor);
9394
+ if ((isEmptyParagraph$1 || isEmptyHeading) && parentPath[parentPath.length - 1] > 0) {
9336
9395
  const previousNodeOfParent = Node.get(editor, Path.previous(parentPath));
9337
9396
  if (Element.isElement(previousNodeOfParent) && Editor.isVoid(editor, previousNodeOfParent)) {
9338
9397
  Transforms.delete(editor, { at: editor.selection.anchor.path.slice(0, editor.selection.anchor.path.length - 1) });
@@ -9354,10 +9413,10 @@ const withRemoveEmpty = (editor) => {
9354
9413
  deleteBackward(unit);
9355
9414
  };
9356
9415
  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]))) {
9416
+ const anchorBlockEntry$1 = anchorBlockEntry(editor);
9417
+ if (anchorBlockEntry$1 &&
9418
+ isAncestorEmpty(editor, anchorBlockEntry$1[0]) &&
9419
+ getNode(editor, Path.next(anchorBlockEntry$1[1]))) {
9361
9420
  const pathRef = Editor.pathRef(editor, Path.parent(editor.selection.anchor.path));
9362
9421
  HistoryEditor.withoutMerging(editor, () => {
9363
9422
  Transforms.move(editor);
@@ -9377,7 +9436,7 @@ const createRemoveEmptyPlugin = createPluginFactory({
9377
9436
  const withRemoveVoid = (editor) => {
9378
9437
  const { deleteBackward, deleteForward, onKeydown } = editor;
9379
9438
  const deleteBlockVoid = (e) => {
9380
- const aboveEntry = queries.getAbove(e);
9439
+ const aboveEntry = getAbove(e);
9381
9440
  const canDelete = aboveEntry && Element.isElement(aboveEntry[0]) && Editor.isBlock(e, aboveEntry[0]) && Editor.isVoid(e, aboveEntry[0]);
9382
9441
  if (canDelete) {
9383
9442
  Transforms.insertNodes(e, createEmptyParagraph(), { at: Path.next(aboveEntry[1]) });
@@ -9393,7 +9452,7 @@ const withRemoveVoid = (editor) => {
9393
9452
  deleteBackward(unit);
9394
9453
  };
9395
9454
  editor.onKeydown = event => {
9396
- const aboveEntry = queries.getAbove(editor);
9455
+ const aboveEntry = getAbove(editor);
9397
9456
  if (aboveEntry &&
9398
9457
  Element.isElement(aboveEntry[0]) &&
9399
9458
  Editor.isVoid(editor, aboveEntry[0]) &&
@@ -9432,7 +9491,7 @@ const withResetType = (editor) => {
9432
9491
  editor.onKeydown = (event) => {
9433
9492
  const { selection } = editor;
9434
9493
  if (IS_SAFARI && selection && Range.isCollapsed(selection) && hotkeys.isDeleteBackward(event)) {
9435
- const blockEntry = queries.getAboveByType(editor, BLOCK_DELETE_BACKWARD_TYPES);
9494
+ const blockEntry = getAboveByType(editor, BLOCK_DELETE_BACKWARD_TYPES);
9436
9495
  if (blockEntry && blockEntry[0]) {
9437
9496
  const isStart = Editor.isStart(editor, selection.anchor, blockEntry[1]);
9438
9497
  if (isStart) {
@@ -9509,7 +9568,7 @@ const createDeserializeHTMLPlugin = createPluginFactory({
9509
9568
  const withDeserializeMd = (editor) => {
9510
9569
  const { insertData, onKeydown } = editor;
9511
9570
  editor.onKeydown = (event) => {
9512
- transforms.closeConversionHint(editor);
9571
+ closeConversionHint(editor);
9513
9572
  onKeydown(event);
9514
9573
  };
9515
9574
  editor.insertData = (data) => {
@@ -9519,7 +9578,7 @@ const withDeserializeMd = (editor) => {
9519
9578
  const plainFragment = data.getData('text/plain');
9520
9579
  const slateFragment = data.getData(`application/${CLIPBOARD_FORMAT_KEY}`);
9521
9580
  const oldRange = editor.selection;
9522
- transforms.closeConversionHint(editor);
9581
+ closeConversionHint(editor);
9523
9582
  if (plainFragment && isMarkdownStynx(plainFragment) && !slateFragment) {
9524
9583
  setTimeout(() => {
9525
9584
  const overlay = editor.injector.get(Overlay);
@@ -9537,7 +9596,7 @@ const withDeserializeMd = (editor) => {
9537
9596
  const htmlDom = new DOMParser().parseFromString(html, 'text/html');
9538
9597
  const fragment = TheiaConverter.convertToTheia(Array.from(htmlDom.body.children));
9539
9598
  if (!isUnformatted(fragment)) {
9540
- transforms.closeConversionHint(editor);
9599
+ closeConversionHint(editor);
9541
9600
  editor.undo();
9542
9601
  setTimeout(() => {
9543
9602
  Transforms.select(editor, oldRange);
@@ -9560,11 +9619,11 @@ const withDeserializeMd = (editor) => {
9560
9619
  return;
9561
9620
  }
9562
9621
  else {
9563
- transforms.closeConversionHint(editor);
9622
+ closeConversionHint(editor);
9564
9623
  }
9565
9624
  }
9566
9625
  catch (error) {
9567
- transforms.closeConversionHint(editor);
9626
+ closeConversionHint(editor);
9568
9627
  }
9569
9628
  }
9570
9629
  },
@@ -9632,7 +9691,7 @@ const FontSizeEditor = {
9632
9691
  setFontSize(editor, size) {
9633
9692
  const contextService = editor.injector.get(TheContextService);
9634
9693
  const defaultFontSize = contextService.getDefaultFontSize();
9635
- const marks = queries.getSelectionMarks(editor);
9694
+ const marks = getSelectionMarks(editor);
9636
9695
  const fontSizeMark = marks[MarkTypes.fontSize];
9637
9696
  const isDefaultFontSize = size === defaultFontSize;
9638
9697
  if (!fontSizeMark && isDefaultFontSize) {
@@ -9660,14 +9719,14 @@ const FontSizeEditor = {
9660
9719
  return;
9661
9720
  }
9662
9721
  // unset paragraph text fontSize
9663
- transforms.setMarks(editor, {
9722
+ setMarks(editor, {
9664
9723
  [MarkTypes.fontSize]: null
9665
9724
  }, editor.selection);
9666
9725
  },
9667
9726
  isFontSizeActive(editor, size) {
9668
9727
  if (editor.selection) {
9669
- const anchorBlock = queries.anchorBlock(editor);
9670
- switch (anchorBlock?.type) {
9728
+ const anchorBlock$1 = anchorBlock(editor);
9729
+ switch (anchorBlock$1?.type) {
9671
9730
  case ElementKinds.heading_1:
9672
9731
  return size === FontSizes.fontSize28;
9673
9732
  case ElementKinds.heading_2:
@@ -9681,7 +9740,7 @@ const FontSizeEditor = {
9681
9740
  case ElementKinds.heading_6:
9682
9741
  return size === FontSizes.fontSize14;
9683
9742
  case ElementKinds.paragraph:
9684
- const marks = queries.getSelectionMarks(editor);
9743
+ const marks = getSelectionMarks(editor);
9685
9744
  const fontSizeMark = marks[MarkTypes.fontSize];
9686
9745
  return Number(size) === fontSizeMark;
9687
9746
  default:
@@ -9722,7 +9781,7 @@ const withHeading = (editor) => {
9722
9781
  const { insertBreak } = editor;
9723
9782
  editor.insertBreak = () => {
9724
9783
  const { selection } = editor;
9725
- const anchorBlock = queries.getAnchorBlockEntry(editor);
9784
+ const anchorBlock = getAnchorBlockEntry(editor);
9726
9785
  if (anchorBlock && Range.isCollapsed(selection) && anchorBlock[0].type.startsWith('heading')) {
9727
9786
  if (Editor.isStart(editor, selection.anchor, anchorBlock[1])) {
9728
9787
  insertBreak();
@@ -9760,7 +9819,7 @@ const createHeadingPlugin = createPluginFactory({
9760
9819
  name: '正文',
9761
9820
  styles: { height: '40px' },
9762
9821
  execute: editor => Transforms.setNodes(editor, { type: ElementKinds.paragraph }),
9763
- active: editor => queries.isParagraph(editor)
9822
+ active: editor => isParagraph(editor)
9764
9823
  },
9765
9824
  {
9766
9825
  key: ElementKinds.heading_1,
@@ -9912,7 +9971,7 @@ const createHrPlugin = createPluginFactory({
9912
9971
  key: ElementKinds.hr,
9913
9972
  icon: 'horizontal-line',
9914
9973
  name: '分割线',
9915
- active: editor => queries.isBlockActive(editor, ElementKinds.hr),
9974
+ active: editor => isBlockActive(editor, ElementKinds.hr),
9916
9975
  execute: editor => HrEditor.insertHr(editor)
9917
9976
  }
9918
9977
  ],
@@ -9921,7 +9980,7 @@ const createHrPlugin = createPluginFactory({
9921
9980
  key: ElementKinds.hr,
9922
9981
  keywords: 'fengexian,fgx,divider,line,分割线',
9923
9982
  type: ThePluginMenuItemType.group,
9924
- active: editor => queries.isBlockActive(editor, ElementKinds.hr),
9983
+ active: editor => isBlockActive(editor, ElementKinds.hr),
9925
9984
  execute: editor => HrEditor.insertHr(editor),
9926
9985
  name: '分割线',
9927
9986
  menuIcon: PluginMenuIcons.hr,
@@ -10214,13 +10273,13 @@ class TheImage extends TheBaseElement {
10214
10273
  return (!this?.readonly &&
10215
10274
  richMedia &&
10216
10275
  this.isCollapsedAndNonReadonly &&
10217
- queries.isGlobalCollapsed(this.editor) &&
10276
+ isGlobalCollapsed(this.editor) &&
10218
10277
  !this.uploading &&
10219
10278
  !this.isOpen);
10220
10279
  }
10221
10280
  isShouldClose() {
10222
10281
  return (this.isOpen &&
10223
- (this?.readonly || !this.isCollapsedAndNonReadonly || !queries.isGlobalCollapsed(this.editor) || this.uploading));
10282
+ (this?.readonly || !this.isCollapsedAndNonReadonly || !isGlobalCollapsed(this.editor) || this.uploading));
10224
10283
  }
10225
10284
  openLayoutToolbar() {
10226
10285
  if (!this.img) {
@@ -11003,98 +11062,269 @@ const createLinkPlugin = createPluginFactory({
11003
11062
  }
11004
11063
  });
11005
11064
 
11006
- const isList = (n) => {
11007
- return [...LIST_BLOCK_TYPES].includes(n.type);
11008
- };
11065
+ class TheBulletedList extends TheBaseElement {
11066
+ get level() {
11067
+ return this.element?.indent || null;
11068
+ }
11069
+ constructor(elementRef, cdr) {
11070
+ super(elementRef, cdr);
11071
+ this.elementRef = elementRef;
11072
+ this.cdr = cdr;
11073
+ }
11074
+ ngOnInit() {
11075
+ super.ngOnInit();
11076
+ }
11077
+ ngOnDestroy() {
11078
+ super.ngOnDestroy();
11079
+ }
11080
+ 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 }); }
11081
+ 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 }); }
11082
+ }
11083
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheBulletedList, decorators: [{
11084
+ type: Component,
11085
+ args: [{
11086
+ selector: 'ul[theUl]',
11087
+ template: ``,
11088
+ standalone: true
11089
+ }]
11090
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { level: [{
11091
+ type: HostBinding,
11092
+ args: ['attr.the-level']
11093
+ }] } });
11009
11094
 
11010
- const isInList = (editor, at = editor.selection) => {
11011
- return queries.isNodeTypeIn(editor, [ElementKinds.numberedList, ElementKinds.bulletedList], { at });
11012
- };
11095
+ class TheListItem extends TheBaseElement {
11096
+ constructor(elementRef, cdr) {
11097
+ super(elementRef, cdr);
11098
+ this.elementRef = elementRef;
11099
+ this.cdr = cdr;
11100
+ }
11101
+ ngOnInit() {
11102
+ super.ngOnInit();
11103
+ }
11104
+ onContextChange() {
11105
+ super.onContextChange();
11106
+ this.addFontSize();
11107
+ this.addMultiDigit();
11108
+ }
11109
+ ngOnDestroy() {
11110
+ super.ngOnDestroy();
11111
+ }
11112
+ addFontSize() {
11113
+ let firstText;
11114
+ for (const entry of Node.descendants(this.element)) {
11115
+ const node = entry[0];
11116
+ if (Text.isText(node) && !firstText) {
11117
+ firstText = node;
11118
+ break;
11119
+ }
11120
+ }
11121
+ if (!firstText) {
11122
+ return;
11123
+ }
11124
+ const { text, ...rest } = firstText;
11125
+ const size = rest[MarkTypes.fontSize];
11126
+ if (size) {
11127
+ const sizeClass = `font-size-${size}`;
11128
+ const isContains = this.elementRef.nativeElement?.classList?.contains(sizeClass);
11129
+ if (isContains) {
11130
+ return;
11131
+ }
11132
+ this.clearFontSize();
11133
+ this.elementRef.nativeElement.classList.add(sizeClass);
11134
+ this.fontSizeClass = sizeClass;
11135
+ }
11136
+ else {
11137
+ this.clearFontSize();
11138
+ }
11139
+ }
11140
+ clearFontSize() {
11141
+ if (this.fontSizeClass) {
11142
+ this.elementRef.nativeElement.classList.remove(this.fontSizeClass);
11143
+ this.fontSizeClass = null;
11144
+ }
11145
+ }
11146
+ getStart() {
11147
+ const parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
11148
+ const start = parent?.getAttribute('start') || 1;
11149
+ return Number(start);
11150
+ }
11151
+ getLiIndex() {
11152
+ const path = findPath(this.editor, this.element);
11153
+ const index = path[path.length - 1];
11154
+ return index || 0;
11155
+ }
11156
+ addMultiDigit() {
11157
+ const start = this.getStart();
11158
+ const index = this.getLiIndex();
11159
+ const multiDigit = 'data-multi-digit';
11160
+ // start number + index
11161
+ // when it is greater than 9, it is a multi-digit serial number
11162
+ // exclude Font size >= 20
11163
+ if (start + index > 9) {
11164
+ this.elementRef.nativeElement.setAttribute(multiDigit, true);
11165
+ }
11166
+ else {
11167
+ this.elementRef.nativeElement.removeAttribute(multiDigit);
11168
+ }
11169
+ }
11170
+ 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 }); }
11171
+ 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 }); }
11172
+ }
11173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheListItem, decorators: [{
11174
+ type: Component,
11175
+ args: [{
11176
+ selector: 'li[theLi]',
11177
+ template: ``,
11178
+ standalone: true
11179
+ }]
11180
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }] });
11013
11181
 
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
- };
11182
+ class TheNumberedList extends TheBaseElement {
11183
+ get start() {
11184
+ return this.element.start;
11185
+ }
11186
+ get level() {
11187
+ return this.element?.indent || null;
11188
+ }
11189
+ constructor(elementRef, cdr) {
11190
+ super(elementRef, cdr);
11191
+ this.elementRef = elementRef;
11192
+ this.cdr = cdr;
11193
+ }
11194
+ ngOnInit() {
11195
+ super.ngOnInit();
11196
+ }
11197
+ ngOnDestroy() {
11198
+ super.ngOnDestroy();
11199
+ }
11200
+ 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 }); }
11201
+ 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 }); }
11202
+ }
11203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: TheNumberedList, decorators: [{
11204
+ type: Component,
11205
+ args: [{
11206
+ selector: 'ol[theOl]',
11207
+ template: ``,
11208
+ standalone: true
11209
+ }]
11210
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }], propDecorators: { start: [{
11211
+ type: HostBinding,
11212
+ args: ['attr.start']
11213
+ }], level: [{
11214
+ type: HostBinding,
11215
+ args: ['attr.the-level']
11216
+ }] } });
11021
11217
 
11022
11218
  const getListTypes = () => {
11023
11219
  return [ElementKinds.bulletedList, ElementKinds.numberedList];
11024
11220
  };
11025
11221
 
11026
- /**
11027
- * 获取 List 中 ListItems,过滤掉空列表嵌套
11028
- * @param node
11029
- * @param initialValue
11030
- * @returns
11031
- */
11032
- const getStartListItem = (node, initialValue) => {
11033
- if (!initialValue) {
11034
- initialValue = [];
11222
+ const normalizeListItem = (editor, { nodeEntry }) => {
11223
+ const [listItemNode, listItemPath] = nodeEntry;
11224
+ const firstChildPath = listItemPath.concat([0]);
11225
+ const firstChild = listItemNode.children?.[0];
11226
+ if (!firstChild) {
11227
+ insertParagraph(editor, firstChildPath);
11228
+ return true;
11035
11229
  }
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);
11230
+ // Ensure that all lists have a <p> tag as a first element
11231
+ if (Element.isElement(firstChild) && (firstChild.type === ElementKinds.bulletedList || firstChild.type === ElementKinds.numberedList)) {
11232
+ insertParagraph(editor, firstChildPath);
11233
+ return true;
11048
11234
  }
11049
11235
  };
11050
11236
 
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;
11237
+ const isList = (n) => {
11238
+ return [...LIST_BLOCK_TYPES].includes(n.type);
11065
11239
  };
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;
11240
+
11241
+ // 列表续号
11242
+ const normalizeNo = (editor, nodeEntry) => {
11243
+ const [listNode, listPath] = nodeEntry;
11244
+ let moved = false;
11245
+ Editor.withoutNormalizing(editor, () => {
11246
+ /**
11247
+ * 获取nextList判断是否为同类型list
11248
+ * 如果为同类型list,则把nextList children移动到当前list的尾部, 并删除nextList
11249
+ */
11250
+ const nextPath = Path.next(listPath);
11251
+ const nextNode = getNode(editor, nextPath);
11252
+ if (nextNode && Element.isElement(nextNode) && Element.isElement(listNode) && nextNode.type === listNode.type) {
11253
+ moveChildren(editor, {
11254
+ at: [nextNode, nextPath],
11255
+ to: listPath.concat(listNode.children.length)
11256
+ });
11257
+ Transforms.removeNodes(editor, { at: nextPath });
11258
+ moved = true;
11259
+ }
11260
+ if (listPath[listPath.length - 1] !== 0) {
11261
+ /**
11262
+ * 获取prevList判断是否为同类型list
11263
+ * 如果为同类型list,则把当前list children移动到prevList的尾部, 并删除当前List
11264
+ */
11265
+ const currentListNode = getNode(editor, listPath);
11266
+ const prevPath = Path.previous(listPath);
11267
+ const prevNode = getNode(editor, prevPath);
11268
+ if (prevNode && Element.isElement(prevNode) && Element.isElement(currentListNode) && prevNode.type === currentListNode.type) {
11269
+ moveChildren(editor, {
11270
+ at: [currentListNode, listPath],
11271
+ to: prevPath.concat(prevNode.children.length)
11272
+ });
11273
+ Transforms.removeNodes(editor, { at: listPath });
11274
+ moved = true;
11275
+ }
11276
+ }
11277
+ });
11278
+ return moved;
11073
11279
  };
11074
11280
 
11075
11281
  /**
11076
- * list 是否是单个listItem,且listItem没有子列表
11282
+ * Normalize list node to force the ul>li>p+ul structure.
11077
11283
  */
11078
- const isSingleListItem = (list) => {
11079
- return isNodeTypeList(list) && list.children.length === 1 && !hasListInListItem(list.children[0]);
11284
+ const getListNormalizer = (editor, { validLiChildrenTypes }) => {
11285
+ const { normalizeNode } = editor;
11286
+ return ([node, path]) => {
11287
+ // 不是选区, 执行续号检测操作
11288
+ if (isList(node) && !TheHistoryEditor.isUndoing(editor)) {
11289
+ const moved = normalizeNo(editor, [node, path]);
11290
+ if (moved) {
11291
+ return;
11292
+ }
11293
+ }
11294
+ if (match(node, { type: getListTypes() })) {
11295
+ if (Element.isElement(node) && !node.children.length) {
11296
+ return Transforms.removeNodes(editor, { at: path });
11297
+ }
11298
+ }
11299
+ // normalize list item
11300
+ // 1. list-item at least one child
11301
+ // 2. list-item first child is not list
11302
+ if (Element.isElement(node) && node.type === ElementKinds.listItem) {
11303
+ if (normalizeListItem(editor, { nodeEntry: [node, path] })) {
11304
+ // Tree changed - kick off another normalization
11305
+ return;
11306
+ }
11307
+ }
11308
+ normalizeNode([node, path]);
11309
+ };
11080
11310
  };
11081
11311
 
11082
11312
  /**
11083
11313
  * 如果at(默认= selection)位于ul> li> p中,则返回li和ul节点条目。
11084
11314
  */
11085
11315
  const getListItemEntry = (editor, { at = editor.selection } = {}) => {
11086
- if (at && queries.isNodeTypeIn(editor, ElementKinds.listItem, { at })) {
11087
- const selectionParent = queries.getParent(editor, at);
11316
+ if (at && isNodeTypeIn(editor, ElementKinds.listItem, { at })) {
11317
+ const selectionParent = getParent(editor, at);
11088
11318
  if (!selectionParent)
11089
11319
  return;
11090
11320
  const [, paragraphPath] = selectionParent;
11091
- const listItem = queries.getAboveByType(editor, ElementKinds.listItem, { at }) || queries.getParent(editor, paragraphPath);
11321
+ const listItem = getAboveByType(editor, ElementKinds.listItem, { at }) || getParent(editor, paragraphPath);
11092
11322
  if (!listItem)
11093
11323
  return;
11094
11324
  const [listItemNode, listItemPath] = listItem;
11095
11325
  if (listItemNode.type !== ElementKinds.listItem)
11096
11326
  return;
11097
- const list = queries.getParent(editor, listItemPath);
11327
+ const list = getParent(editor, listItemPath);
11098
11328
  if (!list || !isList(list[0]))
11099
11329
  return;
11100
11330
  return {
@@ -11105,82 +11335,89 @@ const getListItemEntry = (editor, { at = editor.selection } = {}) => {
11105
11335
  };
11106
11336
 
11107
11337
  /**
11108
- * Is the selection focus at the start of its parent block.
11338
+ *
11109
11339
  */
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]);
11114
- }
11115
- return false;
11340
+ const hasListInListItem = (listItemNode) => {
11341
+ const sublist = listItemNode.children.find(n => match(n, { type: getListTypes() }));
11342
+ return listItemNode.children.length > 1 && sublist;
11343
+ };
11344
+ /**
11345
+ * p + ul/ol structure
11346
+ * @param listItemNode
11347
+ */
11348
+ const hasStableListInListItem = (listItemNode) => {
11349
+ const sublist = listItemNode.children.find(n => match(n, { type: getListTypes() }));
11350
+ return listItemNode.children.length === 2 && sublist;
11351
+ };
11352
+ /**
11353
+ * li + p structure
11354
+ * @param listItemNode
11355
+ */
11356
+ const hasStableListItem = (listItemNode) => {
11357
+ const type = listItemNode.children[0].type;
11358
+ return listItemNode.children.length === 1 && type === ElementKinds.paragraph;
11116
11359
  };
11117
11360
 
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 });
11361
+ /**
11362
+ * fromListItem 子列表的列表项移到 toList
11363
+ */
11364
+ const moveListItemSublistItemsToList = (editor, { fromListItem, toList, location }) => {
11365
+ const fromListItemSublist = findDescendant(editor, {
11366
+ at: fromListItem[1],
11367
+ match: {
11368
+ type: getListTypes()
11139
11369
  }
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
11370
+ });
11371
+ if (!fromListItemSublist)
11372
+ return 0;
11373
+ const [, fromListItemSublistPath] = fromListItemSublist;
11374
+ const lastChildPath = getLastChildPath(toList);
11375
+ let moved;
11376
+ Editor.withoutNormalizing(editor, () => {
11377
+ moved = moveChildren(editor, {
11378
+ at: fromListItemSublistPath,
11379
+ to: location ? toList[1].concat(location) : Path.next(lastChildPath)
11380
+ });
11381
+ // 删除空白列表
11382
+ Transforms.delete(editor, { at: fromListItemSublistPath });
11383
+ });
11384
+ return moved;
11385
+ };
11386
+
11387
+ const moveListItemDown = (editor, { list, listItem }) => {
11388
+ const [listNode] = list;
11389
+ const [, listItemPath] = listItem;
11390
+ Editor.withoutNormalizing(editor, () => {
11391
+ // 以前的兄弟是新父级
11392
+ const previousSiblingItem = Editor.node(editor, Path.previous(listItemPath));
11393
+ if (previousSiblingItem) {
11394
+ const [previousNode, previousPath] = previousSiblingItem;
11395
+ const lastChildIndexOfPreviousNode = previousNode.children.length - 1;
11396
+ const lastChildOfPreviousNode = previousNode.children[lastChildIndexOfPreviousNode];
11397
+ const newPath = previousPath.concat(isNodeTypeList(lastChildOfPreviousNode)
11398
+ ? [lastChildIndexOfPreviousNode, lastChildOfPreviousNode.children.length]
11399
+ : [previousNode.children.length]);
11400
+ if (!isNodeTypeList(lastChildOfPreviousNode)) {
11401
+ // 创建新子列表
11402
+ const type = listNode.type;
11403
+ Transforms.wrapNodes(editor, { type, children: [] }, {
11404
+ at: listItemPath
11165
11405
  });
11166
- return;
11167
11406
  }
11168
- Transforms.select(editor, Editor.end(editor, selectPath));
11169
- // 粘贴数据不是多级
11170
- const currentListItemEntry = getListItemEntry(editor, {});
11407
+ // 将当前listItem移动到子列表
11171
11408
  Transforms.moveNodes(editor, {
11172
- at: nextSubListPath,
11173
- to: currentListItemEntry.listItem[1].concat(1)
11409
+ at: listItemPath,
11410
+ to: newPath
11174
11411
  });
11175
- if (toListItemIsEmptyParagraph) {
11176
- Transforms.delete(editor, { at: toListItemPath });
11412
+ const currentListItemEntry = getListItemEntry(editor, {});
11413
+ if (hasListInListItem(currentListItemEntry.listItem[0])) {
11414
+ moveListItemSublistItemsToList(editor, {
11415
+ fromListItem: currentListItemEntry.listItem,
11416
+ toList: currentListItemEntry.list
11417
+ });
11177
11418
  }
11178
- return;
11179
11419
  }
11180
11420
  });
11181
- // 粘贴目标listItem没有子列表, 设置选区
11182
- Transforms.select(editor, Editor.end(editor, selectPath));
11183
- return;
11184
11421
  };
11185
11422
 
11186
11423
  /**
@@ -11190,7 +11427,7 @@ const insertListData = (editor, { fromList, toListItemEntry }) => {
11190
11427
  const moveListItemUp = (editor, { list, listItem }, options) => {
11191
11428
  const [listNode, listPath] = list;
11192
11429
  const [, listItemPath] = listItem;
11193
- const listParentEntry = queries.getParent(editor, listPath);
11430
+ const listParentEntry = getParent(editor, listPath);
11194
11431
  if (!listParentEntry)
11195
11432
  return;
11196
11433
  const [listParentNode, listParentPath] = listParentEntry;
@@ -11239,8 +11476,8 @@ const moveListItemUp = (editor, { list, listItem }, options) => {
11239
11476
  type: ElementKinds.listItem,
11240
11477
  children: []
11241
11478
  }, { at: nextPath });
11242
- const moveStartPath = queries.findPath(editor, behindNode[0]);
11243
- const moveEndPath = queries.findPath(editor, behindNode[behindNode.length - 1]);
11479
+ const moveStartPath = findPath(editor, behindNode[0]);
11480
+ const moveEndPath = findPath(editor, behindNode[behindNode.length - 1]);
11244
11481
  const moveRange = Editor.range(editor, moveStartPath, moveEndPath);
11245
11482
  Transforms.moveNodes(editor, {
11246
11483
  at: moveRange,
@@ -11258,461 +11495,82 @@ const moveListItemUp = (editor, { list, listItem }, options) => {
11258
11495
  return true;
11259
11496
  };
11260
11497
 
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;
11269
- }
11270
- const [, paragraphPath] = paragraphEntry;
11271
- const [listItemNode, listItemPath] = Editor.parent(editor, paragraphPath);
11272
- if (Element.isElement(listItemNode) && listItemNode.type !== ElementKinds.listItem) {
11273
- return;
11274
- }
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
- });
11297
- }
11298
- 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
- });
11498
+ function onKeyDownList(e, editor) {
11499
+ let moved = false;
11500
+ if (e.key === 'Tab') {
11501
+ const res = getListItemEntry(editor, {});
11502
+ if (!res) {
11503
+ return false;
11312
11504
  }
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
- });
11325
- }
11326
- return true;
11327
- }
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])];
11345
- }
11346
- };
11347
-
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]);
11370
- }
11371
- else if (start) {
11372
- const [, toListItemSublistPath] = toListItemSublist;
11373
- to = toListItemSublistPath.concat([0]);
11374
- }
11375
- else {
11376
- to = Path.next(queries.getLastChildPath(toListItemSublist));
11377
- }
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;
11385
- };
11386
-
11387
- const normalizeListItem = (editor, { nodeEntry }) => {
11388
- const [listItemNode, listItemPath] = nodeEntry;
11389
- const firstChildPath = listItemPath.concat([0]);
11390
- const firstChild = listItemNode.children?.[0];
11391
- if (!firstChild) {
11392
- insertParagraph(editor, firstChildPath);
11393
- return true;
11394
- }
11395
- // Ensure that all lists have a <p> tag as a first element
11396
- if (Element.isElement(firstChild) && (firstChild.type === ElementKinds.bulletedList || firstChild.type === ElementKinds.numberedList)) {
11397
- insertParagraph(editor, firstChildPath);
11398
- return true;
11399
- }
11400
- };
11401
-
11402
- // 列表续号
11403
- const normalizeNo = (editor, nodeEntry) => {
11404
- const [listNode, listPath] = nodeEntry;
11405
- let moved = false;
11406
- Editor.withoutNormalizing(editor, () => {
11407
- /**
11408
- * 获取nextList判断是否为同类型list
11409
- * 如果为同类型list,则把nextList children移动到当前list的尾部, 并删除nextList
11410
- */
11411
- const nextPath = Path.next(listPath);
11412
- const nextNode = queries.getNode(editor, nextPath);
11413
- if (nextNode && Element.isElement(nextNode) && Element.isElement(listNode) && nextNode.type === listNode.type) {
11414
- transforms.moveChildren(editor, {
11415
- at: [nextNode, nextPath],
11416
- to: listPath.concat(listNode.children.length)
11417
- });
11418
- Transforms.removeNodes(editor, { at: nextPath });
11419
- moved = true;
11420
- }
11421
- if (listPath[listPath.length - 1] !== 0) {
11422
- /**
11423
- * 获取prevList判断是否为同类型list
11424
- * 如果为同类型list,则把当前list children移动到prevList的尾部, 并删除当前List
11425
- */
11426
- const currentListNode = queries.getNode(editor, listPath);
11427
- const prevPath = Path.previous(listPath);
11428
- const prevNode = queries.getNode(editor, prevPath);
11429
- if (prevNode && Element.isElement(prevNode) && Element.isElement(currentListNode) && prevNode.type === currentListNode.type) {
11430
- transforms.moveChildren(editor, {
11431
- at: [currentListNode, listPath],
11432
- to: prevPath.concat(prevNode.children.length)
11433
- });
11434
- Transforms.removeNodes(editor, { at: listPath });
11435
- moved = true;
11436
- }
11437
- }
11438
- });
11439
- return moved;
11440
- };
11441
-
11442
- /**
11443
- * Normalize list node to force the ul>li>p+ul structure.
11444
- */
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
- };
11471
- };
11472
-
11473
- /**
11474
- * 将 fromListItem 子列表的列表项移到 toList
11475
- */
11476
- const moveListItemSublistItemsToList = (editor, { fromListItem, toList, location }) => {
11477
- const fromListItemSublist = queries.findDescendant(editor, {
11478
- at: fromListItem[1],
11479
- match: {
11480
- type: getListTypes()
11481
- }
11482
- });
11483
- if (!fromListItemSublist)
11484
- return 0;
11485
- const [, fromListItemSublistPath] = fromListItemSublist;
11486
- const lastChildPath = queries.getLastChildPath(toList);
11487
- let moved;
11488
- Editor.withoutNormalizing(editor, () => {
11489
- moved = moveChildren(editor, {
11490
- at: fromListItemSublistPath,
11491
- to: location ? toList[1].concat(location) : Path.next(lastChildPath)
11492
- });
11493
- // 删除空白列表
11494
- Transforms.delete(editor, { at: fromListItemSublistPath });
11495
- });
11496
- return moved;
11497
- };
11498
-
11499
- const moveListItemDown = (editor, { list, listItem }) => {
11500
- const [listNode] = list;
11501
- const [, listItemPath] = listItem;
11502
- Editor.withoutNormalizing(editor, () => {
11503
- // 以前的兄弟是新父级
11504
- const previousSiblingItem = Editor.node(editor, Path.previous(listItemPath));
11505
- if (previousSiblingItem) {
11506
- const [previousNode, previousPath] = previousSiblingItem;
11507
- const lastChildIndexOfPreviousNode = previousNode.children.length - 1;
11508
- const lastChildOfPreviousNode = previousNode.children[lastChildIndexOfPreviousNode];
11509
- const newPath = previousPath.concat(isNodeTypeList(lastChildOfPreviousNode)
11510
- ? [lastChildIndexOfPreviousNode, lastChildOfPreviousNode.children.length]
11511
- : [previousNode.children.length]);
11512
- if (!isNodeTypeList(lastChildOfPreviousNode)) {
11513
- // 创建新子列表
11514
- const type = listNode.type;
11515
- Transforms.wrapNodes(editor, { type, children: [] }, {
11516
- at: listItemPath
11517
- });
11518
- }
11519
- // 将当前listItem移动到子列表
11520
- Transforms.moveNodes(editor, {
11521
- at: listItemPath,
11522
- to: newPath
11523
- });
11524
- const currentListItemEntry = getListItemEntry(editor, {});
11525
- if (hasListInListItem(currentListItemEntry.listItem[0])) {
11526
- moveListItemSublistItemsToList(editor, {
11527
- fromListItem: currentListItemEntry.listItem,
11528
- toList: currentListItemEntry.list
11529
- });
11530
- }
11531
- }
11532
- });
11533
- };
11534
-
11535
- function onKeyDownList(e, editor) {
11536
- let moved = false;
11537
- if (e.key === 'Tab') {
11538
- const res = getListItemEntry(editor, {});
11539
- if (!res) {
11540
- return false;
11541
- }
11542
- const { list, listItem } = res;
11543
- const [, listItemPath] = listItem;
11544
- e.preventDefault();
11545
- // move up with shift+tab
11546
- const shiftTab = e.shiftKey;
11547
- if (shiftTab) {
11548
- moved = moveListItemUp(editor, { list, listItem });
11549
- if (moved) {
11550
- e.preventDefault();
11551
- return true;
11552
- }
11505
+ const { list, listItem } = res;
11506
+ const [, listItemPath] = listItem;
11507
+ e.preventDefault();
11508
+ // move up with shift+tab
11509
+ const shiftTab = e.shiftKey;
11510
+ if (shiftTab) {
11511
+ moved = moveListItemUp(editor, { list, listItem });
11512
+ if (moved) {
11513
+ e.preventDefault();
11514
+ return true;
11515
+ }
11553
11516
  }
11554
11517
  // move down with tab
11555
11518
  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);
11700
- }
11701
- else {
11702
- this.elementRef.nativeElement.removeAttribute(multiDigit);
11519
+ if (tab && !isFirstChild(listItemPath)) {
11520
+ moveListItemDown(editor, { list, listItem });
11521
+ return true;
11703
11522
  }
11523
+ return false;
11704
11524
  }
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
11525
  }
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 }] });
11526
+
11527
+ /**
11528
+ * 获取 List 中 ListItems,过滤掉空列表嵌套
11529
+ * @param node
11530
+ * @param initialValue
11531
+ * @returns
11532
+ */
11533
+ const getStartListItem = (node, initialValue) => {
11534
+ if (!initialValue) {
11535
+ initialValue = [];
11536
+ }
11537
+ if (node) {
11538
+ return node.reduce((result, current) => {
11539
+ if (current.type === ElementKinds.listItem && !getListTypes().includes(current.children[0].type)) {
11540
+ result.push(current);
11541
+ }
11542
+ else {
11543
+ if (current.children) {
11544
+ getStartListItem(current.children, result);
11545
+ }
11546
+ }
11547
+ return result;
11548
+ }, initialValue);
11549
+ }
11550
+ };
11551
+
11552
+ const isInList = (editor, at = editor.selection) => {
11553
+ return isNodeTypeIn(editor, [ElementKinds.numberedList, ElementKinds.bulletedList], { at });
11554
+ };
11555
+
11556
+ /**
11557
+ * Is the list nested, i.e. its parent is a list item.
11558
+ */
11559
+ const isListNested = (editor, listPath, options) => {
11560
+ const [listParentNode] = Editor.parent(editor, listPath);
11561
+ return listParentNode.type === ElementKinds.listItem;
11562
+ };
11563
+
11564
+ /**
11565
+ * Is the selection focus at the start of its parent block.
11566
+ */
11567
+ const isSelectionAtListItemStart = (editor) => {
11568
+ const listItemEntry = getAboveByType(editor, [ElementKinds.listItem]);
11569
+ if (listItemEntry) {
11570
+ return isStart(editor, editor.selection.focus, listItemEntry[1]);
11571
+ }
11572
+ return false;
11573
+ };
11716
11574
 
11717
11575
  /**
11718
11576
  * Is the selection in same li
@@ -11728,6 +11586,207 @@ const isSelectionInSameListItem = (editor) => {
11728
11586
  return startListItemEntry && endListItemEntry && Path.equals(startListItemEntry[1], endListItemEntry[1]);
11729
11587
  };
11730
11588
 
11589
+ /**
11590
+ * list 中 是否是单个listItem,且listItem没有子列表
11591
+ */
11592
+ const isSingleListItem = (list) => {
11593
+ return isNodeTypeList(list) && list.children.length === 1 && !hasListInListItem(list.children[0]);
11594
+ };
11595
+
11596
+ const insertListData = (editor, { fromList, toListItemEntry }) => {
11597
+ const { children } = fromList;
11598
+ const [toListItem, toListItemPath] = toListItemEntry;
11599
+ const nextListItemPath = Path.next(toListItemPath);
11600
+ const toListItemIsEmptyParagraph = isEmptyParagraph(editor, editor.selection.anchor);
11601
+ const hasSubList = hasListInListItem(toListItem);
11602
+ let selectPath = [...toListItemPath];
11603
+ const liIndex = selectPath.pop();
11604
+ selectPath = [...selectPath, liIndex + children.length];
11605
+ Editor.withoutNormalizing(editor, () => {
11606
+ if (toListItemIsEmptyParagraph && hasSubList) {
11607
+ Transforms.insertNodes(editor, children, { at: nextListItemPath });
11608
+ }
11609
+ else {
11610
+ const insertListItemPath = toListItemIsEmptyParagraph ? toListItemPath : nextListItemPath;
11611
+ // 如果粘贴目标listItem为空,则先删除listItem
11612
+ if (toListItemIsEmptyParagraph) {
11613
+ Transforms.removeNodes(editor, { at: insertListItemPath });
11614
+ selectPath = Path.previous(selectPath);
11615
+ }
11616
+ Transforms.insertNodes(editor, children, { at: insertListItemPath });
11617
+ }
11618
+ /**
11619
+ * 粘贴目标lisItem有子列表
11620
+ */
11621
+ if (hasSubList) {
11622
+ const paragraphPath = toListItemPath.concat([0]);
11623
+ const nextSubListPath = Path.next(paragraphPath);
11624
+ // 判断粘贴数据是否是多级
11625
+ if (hasListInListItem(fromList.children[0])) {
11626
+ // 设置粘贴后正确选区
11627
+ Transforms.select(editor, Editor.end(editor, nextListItemPath));
11628
+ // 获取当前选区所在listItem entry
11629
+ const currentListItemEntry = getListItemEntry(editor, {});
11630
+ // 获取粘贴目标listItem中的子列表
11631
+ const { children: subListChildren } = Node.get(editor, nextSubListPath);
11632
+ /**
11633
+ * 复制子列表数据
11634
+ * 之所以是复制,而不是移动,因为无法单纯一次性移动子列表的所有listItem(不包含subList本身)到目标位置,
11635
+ * 需要循环移动才可以
11636
+ **/
11637
+ Transforms.insertNodes(editor, subListChildren, {
11638
+ at: Path.next(currentListItemEntry.listItem[1])
11639
+ });
11640
+ // 删除已被复制后无用的listItem/listItem subList
11641
+ Transforms.delete(editor, {
11642
+ at: toListItemIsEmptyParagraph ? toListItemPath : nextSubListPath
11643
+ });
11644
+ return;
11645
+ }
11646
+ Transforms.select(editor, Editor.end(editor, selectPath));
11647
+ // 粘贴数据不是多级
11648
+ const currentListItemEntry = getListItemEntry(editor, {});
11649
+ Transforms.moveNodes(editor, {
11650
+ at: nextSubListPath,
11651
+ to: currentListItemEntry.listItem[1].concat(1)
11652
+ });
11653
+ if (toListItemIsEmptyParagraph) {
11654
+ Transforms.delete(editor, { at: toListItemPath });
11655
+ }
11656
+ return;
11657
+ }
11658
+ });
11659
+ // 粘贴目标listItem没有子列表, 设置选区
11660
+ Transforms.select(editor, Editor.end(editor, selectPath));
11661
+ return;
11662
+ };
11663
+
11664
+ /**
11665
+ * Insert list item if selection in li>p.
11666
+ */
11667
+ const insertListItem = (editor) => {
11668
+ if (editor.selection && !isRangeAtRoot(editor.selection)) {
11669
+ const paragraphEntry = getAboveByType(editor, ElementKinds.paragraph);
11670
+ if (!paragraphEntry) {
11671
+ return;
11672
+ }
11673
+ const [, paragraphPath] = paragraphEntry;
11674
+ const [listItemNode, listItemPath] = Editor.parent(editor, paragraphPath);
11675
+ if (Element.isElement(listItemNode) && listItemNode.type !== ElementKinds.listItem) {
11676
+ return;
11677
+ }
11678
+ if (!Range.isCollapsed(editor.selection)) {
11679
+ Transforms.delete(editor);
11680
+ }
11681
+ const isEnd = isBlockTextEmptyAfterSelection(editor);
11682
+ const nextNodePath = Path.next(paragraphPath);
11683
+ const nextListItemPath = Path.next(listItemPath);
11684
+ const nextEnd = Editor.end(editor, listItemPath);
11685
+ /**
11686
+ * If not end, split nodes, wrap a list item on the new paragraph and move it to the next list item
11687
+ */
11688
+ if (!isEnd) {
11689
+ Editor.withoutNormalizing(editor, () => {
11690
+ Transforms.splitNodes(editor, { at: editor.selection, always: true });
11691
+ Transforms.wrapNodes(editor, {
11692
+ type: ElementKinds.listItem,
11693
+ children: []
11694
+ }, { at: nextNodePath });
11695
+ Transforms.moveNodes(editor, {
11696
+ at: nextNodePath,
11697
+ to: nextListItemPath
11698
+ });
11699
+ });
11700
+ }
11701
+ else {
11702
+ /**
11703
+ * If end, split nodes
11704
+ */
11705
+ Editor.withoutNormalizing(editor, () => {
11706
+ Transforms.splitNodes(editor, {
11707
+ always: true,
11708
+ mode: 'highest',
11709
+ match: node => {
11710
+ const path = node && TheEditor.findPath(editor, node);
11711
+ return path && path.length === nextListItemPath.length;
11712
+ }
11713
+ });
11714
+ });
11715
+ }
11716
+ /**
11717
+ * If there is a list in the list item, move it to the next list item
11718
+ */
11719
+ if (getNode(editor, nextNodePath)) {
11720
+ Transforms.moveNodes(editor, {
11721
+ at: Editor.range(editor, nextNodePath, nextEnd),
11722
+ to: nextListItemPath.concat(1),
11723
+ match: node => {
11724
+ // TODO: types
11725
+ return listItemNode.children.includes(node);
11726
+ }
11727
+ });
11728
+ }
11729
+ return true;
11730
+ }
11731
+ };
11732
+
11733
+ /**
11734
+ * 获取 listItem 内的列表(如果存在).
11735
+ * 它采用以下结构:ul> li > span + ul
11736
+ */
11737
+ const getListItemSublist = (listItem, options) => {
11738
+ const [listItemNode, listItemPath] = listItem;
11739
+ if (hasListInListItem(listItemNode)) {
11740
+ return [listItemNode.children[1], listItemPath.concat([1])];
11741
+ }
11742
+ };
11743
+
11744
+ /**
11745
+ * Move fromListItem sublist list items to the end of `toListItem` sublist.
11746
+ * If there is no `toListItem` sublist, insert one.
11747
+ */
11748
+ const moveListItemSublistItemsToListItemSublist = (editor, { fromListItem, toListItem, start }, options) => {
11749
+ const [, fromListItemPath] = fromListItem;
11750
+ const [toListItemNode, toListItemPath] = toListItem;
11751
+ const fromListItemSublist = getListItemSublist(fromListItem, options);
11752
+ if (!fromListItemSublist)
11753
+ return 0;
11754
+ const [, fromListItemSublistPath] = fromListItemSublist;
11755
+ const toListItemSublist = getListItemSublist(toListItem, options);
11756
+ let to;
11757
+ if (!toListItemSublist) {
11758
+ const fromList = getParent(editor, fromListItemPath);
11759
+ if (!fromList)
11760
+ return 0;
11761
+ const [fromListNode] = fromList;
11762
+ const fromListType = fromListNode.type;
11763
+ const toListItemSublistPath = toListItemPath.concat([toListItemNode.children.length]);
11764
+ Transforms.insertNodes(editor, { type: fromListType, children: [] }, { at: toListItemSublistPath });
11765
+ to = toListItemSublistPath.concat([0]);
11766
+ }
11767
+ else if (start) {
11768
+ const [, toListItemSublistPath] = toListItemSublist;
11769
+ to = toListItemSublistPath.concat([0]);
11770
+ }
11771
+ else {
11772
+ to = Path.next(getLastChildPath(toListItemSublist));
11773
+ }
11774
+ const moved = moveChildren(editor, {
11775
+ at: Path.previous(fromListItemSublistPath),
11776
+ to
11777
+ });
11778
+ // Remove the empty list
11779
+ Transforms.delete(editor, { at: fromListItemPath });
11780
+ return moved;
11781
+ };
11782
+
11783
+ const unwrapList = (editor) => {
11784
+ Editor.withoutNormalizing(editor, () => {
11785
+ unwrapNodesByType(editor, ElementKinds.listItem);
11786
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], { split: true });
11787
+ });
11788
+ };
11789
+
11731
11790
  const withList = (editor) => {
11732
11791
  const { insertBreak, deleteBackward, onKeydown, insertData, setFragmentData, renderElement } = editor;
11733
11792
  const validLiChildrenTypes = getPluginOptions(editor, PluginKeys.list)?.validLiChildrenTypes ?? [];
@@ -11737,7 +11796,7 @@ const withList = (editor) => {
11737
11796
  onReset: (_editor) => unwrapList(_editor)
11738
11797
  };
11739
11798
  editor.insertBreak = () => {
11740
- const node = queries.anchorBlock(editor);
11799
+ const node = anchorBlock(editor);
11741
11800
  if (!node) {
11742
11801
  insertBreak();
11743
11802
  return;
@@ -11778,16 +11837,16 @@ const withList = (editor) => {
11778
11837
  }
11779
11838
  }
11780
11839
  // 如果选择的listItem为空则将其向上移动
11781
- if (isStart && queries.isBlockAboveEmpty(editor)) {
11840
+ if (isStart && isBlockAboveEmpty(editor)) {
11782
11841
  moved = moveListItemUp(editor, { list, listItem });
11783
11842
  if (moved)
11784
11843
  return;
11785
11844
  }
11786
- const didReset = transforms.onKeyDownResetBlockType({
11845
+ const didReset = onKeyDownResetBlockType({
11787
11846
  rules: [
11788
11847
  {
11789
11848
  ...resetBlockTypesListRule,
11790
- predicate: () => !moved && isStart && queries.isBlockAboveEmpty(editor)
11849
+ predicate: () => !moved && isStart && isBlockAboveEmpty(editor)
11791
11850
  }
11792
11851
  ]
11793
11852
  })(null, editor);
@@ -11849,17 +11908,17 @@ const withList = (editor) => {
11849
11908
  const { list, listItem } = res;
11850
11909
  const [, listPath] = list;
11851
11910
  const [listItemNode, listItemPath] = listItem;
11852
- const previousListItemPath = queries.getPreviousPath(listItemPath);
11911
+ const previousListItemPath = getPreviousPath(listItemPath);
11853
11912
  if (previousListItemPath) {
11854
11913
  const beforePoint = Editor.before(editor, listItemPath);
11855
11914
  const parentPath = Path.parent(beforePoint.path);
11856
11915
  const parentNode = Node.get(editor, parentPath);
11857
11916
  if (Element.isElement(parentNode) && Editor.isVoid(editor, parentNode)) {
11858
11917
  Editor.withoutNormalizing(editor, () => {
11859
- transforms.unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], {
11918
+ unwrapNodesByType(editor, [ElementKinds.bulletedList, ElementKinds.numberedList], {
11860
11919
  split: true
11861
11920
  });
11862
- transforms.unwrapNodesByType(editor, ElementKinds.listItem);
11921
+ unwrapNodesByType(editor, ElementKinds.listItem);
11863
11922
  });
11864
11923
  return;
11865
11924
  }
@@ -11883,7 +11942,7 @@ const withList = (editor) => {
11883
11942
  const beforePoint = Editor.before(editor, listItemPath);
11884
11943
  const startPoint = Editor.start(editor, listItemPath);
11885
11944
  const endPoint = Editor.end(editor, listItemPath);
11886
- const isInFirstChild = !isListNested(editor, listPath) && queries.isFirstChild(listItemPath);
11945
+ const isInFirstChild = !isListNested(editor, listPath) && isFirstChild(listItemPath);
11887
11946
  const to = isInFirstChild ? listPath : Path.next(Path.parent(beforePoint.path));
11888
11947
  Transforms.moveNodes(editor, {
11889
11948
  at: Editor.range(editor, startPoint, endPoint),
@@ -11898,7 +11957,7 @@ const withList = (editor) => {
11898
11957
  return;
11899
11958
  }
11900
11959
  // deprecated
11901
- if (!isListNested(editor, listPath) && queries.isFirstChild(listItemPath)) {
11960
+ if (!isListNested(editor, listPath) && isFirstChild(listItemPath)) {
11902
11961
  unwrapList(editor);
11903
11962
  return;
11904
11963
  }
@@ -12123,7 +12182,7 @@ const withNodeID = (e) => {
12123
12182
  if (operation.type === 'insert_node') {
12124
12183
  const newFilter = (entry) => {
12125
12184
  const [_node] = entry;
12126
- return filter(entry) && filterText ? Element.isElement(_node) : queries.isDescendant(_node);
12185
+ return filter(entry) && filterText ? Element.isElement(_node) : isDescendant(_node);
12127
12186
  };
12128
12187
  // fix can not find path by orign node
12129
12188
  let node = operation.node;
@@ -12131,7 +12190,7 @@ const withNodeID = (e) => {
12131
12190
  node = cloneDeep(node);
12132
12191
  }
12133
12192
  // it will not overwrite ids once it's set as it's read-only
12134
- transforms.mergeDeepToNodes({
12193
+ mergeDeepToNodes({
12135
12194
  node,
12136
12195
  source: idPropsCreator,
12137
12196
  query: {
@@ -12185,7 +12244,7 @@ const withInsertParagraphNodes = (editor) => {
12185
12244
  editor.normalizeNode = ([currentNode, currentPath]) => {
12186
12245
  if (Text.isText(currentNode) && currentPath.length) {
12187
12246
  const [node] = Editor.parent(editor, currentPath);
12188
- const containerBlocks = [...types, ...queries.getContainerBlocks(editor)];
12247
+ const containerBlocks = [...types, ...getContainerBlocks(editor)];
12189
12248
  if (Element.isElement(node) && containerBlocks.includes(node.type)) {
12190
12249
  const paragraph = createEmptyParagraph();
12191
12250
  paragraph.children[0].text = currentNode.text;
@@ -12208,9 +12267,9 @@ const withTrailingNode = (editor) => {
12208
12267
  const { type, level, ...query } = options;
12209
12268
  editor.normalizeNode = ([currentNode, currentPath]) => {
12210
12269
  if (!currentPath.length) {
12211
- const entry = queries.getLastNode(editor, level);
12270
+ const entry = getLastNode(editor, level);
12212
12271
  const [lastNode, lastPath] = entry;
12213
- if (Element.isElement(lastNode) && lastNode.type !== type && queries.isNodeType(entry, query)) {
12272
+ if (Element.isElement(lastNode) && lastNode.type !== type && isNodeType(entry, query)) {
12214
12273
  Transforms.insertNodes(editor, {
12215
12274
  type,
12216
12275
  children: [{ text: '' }]
@@ -12232,16 +12291,16 @@ const createTrailingNodePlugin = createPluginFactory({
12232
12291
 
12233
12292
  const PaintFormatEditor = {
12234
12293
  formatBrush(editor, marks) {
12235
- const block = queries.anchorBlock(editor);
12294
+ const block = anchorBlock(editor);
12236
12295
  if (block && Range.isCollapsed(editor.selection)) {
12237
12296
  // TODO:: 在撤销时有bug, 临时使用withoutSaving处理
12238
12297
  HistoryEditor.withoutSaving(editor, () => {
12239
12298
  const path = TheEditor.findPath(editor, block);
12240
- transforms.setMarks(editor, marks, path);
12299
+ setMarks(editor, marks, path);
12241
12300
  });
12242
12301
  }
12243
12302
  else {
12244
- transforms.setMarks(editor, marks);
12303
+ setMarks(editor, marks);
12245
12304
  }
12246
12305
  PaintFormatEditor.cancelFormatBrushStatus(editor);
12247
12306
  },
@@ -12257,7 +12316,7 @@ const PaintFormatEditor = {
12257
12316
  }
12258
12317
  contextService.paintFormatStatus = {
12259
12318
  isActive: true,
12260
- marks: queries.getSelectionMarks(editor)
12319
+ marks: getSelectionMarks(editor)
12261
12320
  };
12262
12321
  const element = EDITOR_TO_ELEMENT.get(editor);
12263
12322
  element.classList.add('pointer-paint');
@@ -12337,7 +12396,7 @@ const createPaintFormatPlugin = createPluginFactory({
12337
12396
  MarkProps.forEach(key => {
12338
12397
  unsetMarks[key] = null;
12339
12398
  });
12340
- transforms.setMarks(editor, unsetMarks);
12399
+ setMarks(editor, unsetMarks);
12341
12400
  }
12342
12401
  }
12343
12402
  }
@@ -12447,9 +12506,9 @@ const withSoftBreak = (editor) => {
12447
12506
  const { onKeydown } = editor;
12448
12507
  const rules = getPluginOptions(editor, PluginKeys.softBreak)?.rules ?? [];
12449
12508
  editor.onKeydown = (event) => {
12450
- const entry = queries.getBlockAbove(editor);
12509
+ const entry = getBlockAbove(editor);
12451
12510
  rules.forEach(({ hotkey, query }) => {
12452
- if (isKeyHotkey(hotkey, event) && queries.isNodeType(entry, query)) {
12511
+ if (isKeyHotkey(hotkey, event) && isNodeType(entry, query)) {
12453
12512
  event.preventDefault();
12454
12513
  editor.insertText('\n');
12455
12514
  }
@@ -13592,7 +13651,7 @@ class TheTableToolbar {
13592
13651
  this.selectedColor = cell ? cell.backgroundColor : '';
13593
13652
  const path = TheEditor.findPath(this.editor, this.tableElement);
13594
13653
  this.tableChangeSubscriber = this.tableStore.tableChange().subscribe(() => {
13595
- const columns = queries.getNode(this.editor, path).columns;
13654
+ const columns = getNode(this.editor, path).columns;
13596
13655
  this.isColumnEqual = columns?.every(col => columns[0].width === col.width) ?? true;
13597
13656
  });
13598
13657
  }
@@ -13805,7 +13864,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImpor
13805
13864
 
13806
13865
  function calculateAnchorPositionInCell(editor, at) {
13807
13866
  at = at || editor.selection.anchor;
13808
- const entry = queries.anchorBlockEntry(editor, at);
13867
+ const entry = anchorBlockEntry(editor, at);
13809
13868
  const [block, blockPath] = entry;
13810
13869
  const blockDom = AngularEditor.toDOMNode(editor, block);
13811
13870
  const valueRangeRect = blockDom.getBoundingClientRect();
@@ -13867,7 +13926,7 @@ const moveSelectionFromCell = (editor, e) => {
13867
13926
  const cellStartPath = Editor.start(editor, cellPath).path;
13868
13927
  const cellEndPath = Editor.end(editor, cellPath).path;
13869
13928
  const { isFirstLine, isLastLine } = calculateAnchorPositionInCell(editor, cursor);
13870
- const [, anchorBlockPath] = queries.anchorBlockEntry(editor, cursor);
13929
+ const [, anchorBlockPath] = anchorBlockEntry(editor, cursor);
13871
13930
  const anchorPosition = createTablePosition(editor, selection.anchor.path);
13872
13931
  const startCellPosition = createTablePosition(editor, cellStartPath);
13873
13932
  const endCellPosition = createTablePosition(editor, cellEndPath);
@@ -14497,7 +14556,7 @@ class TheTable extends TheBaseElement {
14497
14556
  // Editor container width changes, resulting in column widths no longer valid #WIK-6766
14498
14557
  const warning = this.element.columns.some((col, index) => col.width !== columns[index]?.width);
14499
14558
  if (warning) {
14500
- transforms.setNode(this.editor, { columns }, this.element);
14559
+ setNode(this.editor, { columns }, this.element);
14501
14560
  }
14502
14561
  }
14503
14562
  else {
@@ -14507,24 +14566,24 @@ class TheTable extends TheBaseElement {
14507
14566
  width: Number((this.tableWrapperWidth / tr.children.length - tr.children.length).toFixed(2))
14508
14567
  };
14509
14568
  });
14510
- transforms.setNode(this.editor, { columns }, this.element);
14569
+ setNode(this.editor, { columns }, this.element);
14511
14570
  }
14512
14571
  }
14513
14572
  initializeRows() {
14514
- this.element.children.map((row, index) => {
14573
+ this.element.children.map((row, index$1) => {
14515
14574
  if (!row.height) {
14516
14575
  const element = TheEditor.toDOMNode(this.editor, row);
14517
14576
  let height = getElementHeight(element);
14518
- transforms.setNode(this.editor, { height }, row);
14577
+ setNode(this.editor, { height }, row);
14519
14578
  }
14520
14579
  });
14521
14580
  }
14522
14581
  transformRowHeight() {
14523
14582
  const rowElements = this.nativeElement.querySelector('tbody').children;
14524
14583
  if (rowElements) {
14525
- [...rowElements].map((row, index) => {
14584
+ [...rowElements].map((row, index$1) => {
14526
14585
  let height = getElementHeight(row);
14527
- transforms.setNode(this.editor, { height }, this.element.children[index]);
14586
+ setNode(this.editor, { height }, this.element.children[index$1]);
14528
14587
  });
14529
14588
  }
14530
14589
  }
@@ -14533,7 +14592,7 @@ class TheTable extends TheBaseElement {
14533
14592
  const columns = cols.map(col => {
14534
14593
  return { width: getElementWidth(col) };
14535
14594
  });
14536
- transforms.setNode(this.editor, { columns }, this.element);
14595
+ setNode(this.editor, { columns }, this.element);
14537
14596
  }
14538
14597
  onColMousedown(event, index) {
14539
14598
  event.stopPropagation();
@@ -15045,7 +15104,7 @@ class TheTd extends TheBaseElement {
15045
15104
  }
15046
15105
  // 聚焦
15047
15106
  useFocus() {
15048
- if (this.isCollapsedAndNonReadonly && queries.isGlobalCollapsed(this.editor)) {
15107
+ if (this.isCollapsedAndNonReadonly && isGlobalCollapsed(this.editor)) {
15049
15108
  this.renderer.addClass(this.elementRef.nativeElement, 'focused-cell');
15050
15109
  }
15051
15110
  else {
@@ -15706,8 +15765,8 @@ const withTable = (editor) => {
15706
15765
  if (startBlockPath.length <= startPosition.cellEntry[1].length + 1 &&
15707
15766
  startBlockPath.pop() === 0 &&
15708
15767
  selection.anchor.offset === 0 &&
15709
- queries.isStart(editor, selection.anchor, startBlockPath) &&
15710
- !Editor.isVoid(editor, queries.anchorBlock(editor))) {
15768
+ isStart(editor, selection.anchor, startBlockPath) &&
15769
+ !Editor.isVoid(editor, anchorBlock(editor))) {
15711
15770
  return;
15712
15771
  }
15713
15772
  deleteBackward(unit);
@@ -15765,11 +15824,11 @@ const withTable = (editor) => {
15765
15824
  const { isFirstLine, isLastLine } = calculateAnchorPositionInCell(editor);
15766
15825
  startPath.pop();
15767
15826
  endPath.pop();
15768
- if ((queries.anchorBlockEntry(editor)[1].toString() !== startPath.toString() || !isFirstLine) && isMoveUp) {
15827
+ if ((anchorBlockEntry(editor)[1].toString() !== startPath.toString() || !isFirstLine) && isMoveUp) {
15769
15828
  onKeydown(event);
15770
15829
  return;
15771
15830
  }
15772
- if ((queries.anchorBlockEntry(editor)[1].toString() !== endPath.toString() || !isLastLine) && isMoveDown) {
15831
+ if ((anchorBlockEntry(editor)[1].toString() !== endPath.toString() || !isLastLine) && isMoveDown) {
15773
15832
  onKeydown(event);
15774
15833
  return;
15775
15834
  }
@@ -15992,7 +16051,7 @@ const withTable = (editor) => {
15992
16051
  if (isTable) {
15993
16052
  setTimeout(() => {
15994
16053
  Editor.withoutNormalizing(editor, () => {
15995
- const [, currentPath] = queries.findNode(editor, {
16054
+ const [, currentPath] = findNode(editor, {
15996
16055
  match: n => Element.isElement(n) && n.type === ElementKinds.table
15997
16056
  });
15998
16057
  const nextPath = Path.next(currentPath);
@@ -16231,7 +16290,7 @@ class TheTodoItem extends TheBaseElement {
16231
16290
  if (this.readonly && !this.editableWithReadonly) {
16232
16291
  return false;
16233
16292
  }
16234
- transforms.setNode(this.editor, { checked }, this.element);
16293
+ setNode(this.editor, { checked }, this.element);
16235
16294
  }
16236
16295
  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
16296
  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 +16336,7 @@ const withTodoItem = (editor) => {
16277
16336
  });
16278
16337
  if (match) {
16279
16338
  const [, path] = match;
16280
- const block = queries.anchorBlock(editor);
16339
+ const block = anchorBlock(editor);
16281
16340
  if (block && Editor.isStart(editor, selection.anchor, path) && Editor.isEmpty(editor, block)) {
16282
16341
  Transforms.setNodes(editor, {
16283
16342
  type: ElementKinds.default,
@@ -16290,8 +16349,8 @@ const withTodoItem = (editor) => {
16290
16349
  }
16291
16350
  }
16292
16351
  insertBreak();
16293
- const anchorBlock = queries.anchorBlock(editor);
16294
- if (anchorBlock && anchorBlock.type === ElementKinds.checkItem) {
16352
+ const anchorBlock$1 = anchorBlock(editor);
16353
+ if (anchorBlock$1 && anchorBlock$1.type === ElementKinds.checkItem) {
16295
16354
  Transforms.setNodes(editor, { checked: false });
16296
16355
  }
16297
16356
  };
@@ -16457,7 +16516,7 @@ class TheQuickInsert {
16457
16516
  return false;
16458
16517
  }
16459
16518
  hasExcludeAttribute() {
16460
- const marks = queries.getSelectionMarks(this.editor);
16519
+ const marks = getSelectionMarks(this.editor);
16461
16520
  const fontSizeMark = marks[MarkTypes.fontSize];
16462
16521
  return fontSizeMark;
16463
16522
  }
@@ -16562,6 +16621,7 @@ class TheEditorComponent {
16562
16621
  this.elementToHtml = new WeakMap();
16563
16622
  this.onChangeCallback = () => { };
16564
16623
  this.onTouchedCallback = () => { };
16624
+ this.isFirstWriteValue = true;
16565
16625
  this.scrollSelectionIntoView = (e, domRange) => {
16566
16626
  const { neededScrollIntoView } = e.options;
16567
16627
  if (neededScrollIntoView && !neededScrollIntoView(this.editor)) {
@@ -16712,6 +16772,7 @@ class TheEditorComponent {
16712
16772
  }
16713
16773
  initializeOptions(theOptions) {
16714
16774
  const presetMode = this.presetConfig?.options?.mode;
16775
+ const presetAutoNormalize = this.presetConfig?.options?.autoNormalize;
16715
16776
  const presetInlineToolbarVisible = this.presetConfig?.options?.inlineToolbarVisible;
16716
16777
  const presetMenu = this.presetConfig?.options?.menu;
16717
16778
  const presetToolbarAlign = this.presetConfig?.options?.toolbar?.align;
@@ -16723,6 +16784,7 @@ class TheEditorComponent {
16723
16784
  readonly: false,
16724
16785
  neededScrollIntoView: () => true,
16725
16786
  ...theOptions,
16787
+ autoNormalize: theOptions?.autoNormalize ?? presetAutoNormalize ?? false,
16726
16788
  mode: theOptions?.mode ?? presetMode ?? TheDataMode.html,
16727
16789
  inlineToolbarVisible: theOptions?.inlineToolbarVisible ?? presetInlineToolbarVisible,
16728
16790
  menu: theOptions?.menu ?? presetMenu ?? DefaultPluginMenu,
@@ -16803,21 +16865,26 @@ class TheEditorComponent {
16803
16865
  }
16804
16866
  }
16805
16867
  writeValue(value) {
16806
- const firstNil = value === null && !this.editorValue;
16807
- if (firstNil) {
16868
+ if (this.isFirstWriteValue) {
16869
+ this.isFirstWriteValue = false;
16808
16870
  return;
16809
16871
  }
16810
16872
  const data = dataDeserialize(this.editor.options?.mode, value);
16811
16873
  // data-deserialize
16812
16874
  this.editorValue = data;
16813
16875
  this.cdr.markForCheck();
16814
- setTimeout(() => {
16815
- if (!this.options.readonly && AngularEditor.isFocused(this.editor) && this.editor.selection) {
16816
- const selection = this.editor.selection;
16817
- Transforms.deselect(this.editor);
16818
- Transforms.select(this.editor, selection);
16876
+ if (!this.options.readonly) {
16877
+ setTimeout(() => {
16878
+ if (AngularEditor.isFocused(this.editor) && this.editor.selection) {
16879
+ const selection = this.editor.selection;
16880
+ Transforms.deselect(this.editor);
16881
+ Transforms.select(this.editor, selection);
16882
+ }
16883
+ });
16884
+ if (this.options.autoNormalize) {
16885
+ normalizeValue(this.editor, data);
16819
16886
  }
16820
- });
16887
+ }
16821
16888
  }
16822
16889
  registerOnChange(fn) {
16823
16890
  this.onChangeCallback = fn;
@@ -16839,7 +16906,7 @@ class TheEditorComponent {
16839
16906
  const mode = this.options?.mode;
16840
16907
  if (mode === TheDataMode.html) {
16841
16908
  let htmlValue = '';
16842
- const isEmptyContent = queries.isEmptyContent(value);
16909
+ const isEmptyContent$1 = isEmptyContent(value);
16843
16910
  value.forEach((element) => {
16844
16911
  let elementHtml = this.elementToHtml.get(element);
16845
16912
  if (elementHtml === undefined) {
@@ -16851,7 +16918,7 @@ class TheEditorComponent {
16851
16918
  }
16852
16919
  htmlValue += elementHtml;
16853
16920
  });
16854
- return isEmptyContent ? '' : htmlValue;
16921
+ return isEmptyContent$1 ? '' : htmlValue;
16855
16922
  }
16856
16923
  return value;
16857
16924
  }
@@ -16881,13 +16948,13 @@ class TheEditorComponent {
16881
16948
  handleSelectAll() {
16882
16949
  let node;
16883
16950
  if (!this.editor.selection) {
16884
- transforms.setEndSelection(this.editor);
16951
+ setEndSelection(this.editor);
16885
16952
  }
16886
16953
  const [start, end] = Range.edges(this.editor.selection);
16887
16954
  const selectionRange = Editor.range(this.editor, start, end);
16888
- const containerBlocks = queries.getContainerBlocks(this.editor);
16955
+ const containerBlocks = getContainerBlocks(this.editor);
16889
16956
  for (let i = 0; i < containerBlocks.length; i++) {
16890
- [node] = queries.getNodesByType(this.editor, containerBlocks[i]);
16957
+ [node] = getNodesByType(this.editor, containerBlocks[i]);
16891
16958
  if (node) {
16892
16959
  const [, path] = node;
16893
16960
  const isStartParent = Path.equals(path, start.path.slice(0, path.length));
@@ -17257,5 +17324,5 @@ const withTestPlugin = (plugins, initValue) => {
17257
17324
  * Generated bundle index. Do not edit.
17258
17325
  */
17259
17326
 
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 };
17327
+ 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, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getColsTotalWidth, getColumnsWidth, getDirtyElements, 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, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, scrollIntoView, setEditorUUID, theTethysIconRegistryFaker, topLeftPosition, uniqueCellPosition, updatePopoverPosition, useElementStyle, withMention, withTestPlugin, withTheia };
17261
17328
  //# sourceMappingURL=worktile-theia.mjs.map