@heartlandone/vega 2.95.0 → 2.96.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 (181) hide show
  1. package/dist/cjs/{app-globals-76815382.js → app-globals-38afea36.js} +7 -7
  2. package/dist/cjs/{code-block-493c7ce7.js → code-block-4126dc3b.js} +1501 -55
  3. package/dist/cjs/{component-value-history-controller-slimmer.abstract-ab21fcbf.js → component-value-history-controller-slimmer.abstract-38ba956e.js} +2 -2
  4. package/dist/cjs/{content-state-fc34a814.js → content-state-50e8a03c.js} +142 -580
  5. package/dist/cjs/{element-appender-slimmer-1d6323c2.js → element-appender-slimmer-7773fdab.js} +115 -0
  6. package/dist/cjs/{image-annotation-action-7c4cd316.js → image-annotation-action-89363de8.js} +2 -2
  7. package/dist/cjs/{image-extension-30a7c10f.js → image-extension-c881c454.js} +2 -2
  8. package/dist/cjs/index.cjs.js +10 -10
  9. package/dist/cjs/{link-extension-92a63cb7.js → link-extension-b7f99a52.js} +2 -2
  10. package/dist/cjs/loader.cjs.js +7 -7
  11. package/dist/cjs/{public-rules-9e1ea1d9.js → public-rules-72894208.js} +3 -3
  12. package/dist/cjs/{range-30219330.js → range-95d41dea.js} +1 -1
  13. package/dist/cjs/{rich-text-editor-required-rule-23bf7485.js → rich-text-editor-required-rule-4d6d2493.js} +1 -1
  14. package/dist/cjs/{split-cell-operation-43752212.js → split-cell-operation-70be116d.js} +2 -2
  15. package/dist/cjs/{token-extension-d123d9d0.js → token-extension-eb828948.js} +35 -11
  16. package/dist/cjs/vega-code-block.cjs.entry.js +3 -3
  17. package/dist/cjs/vega-date-picker_2.cjs.entry.js +1 -1
  18. package/dist/cjs/vega-dropdown_5.cjs.entry.js +27 -4
  19. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  20. package/dist/cjs/vega-popover_2.cjs.entry.js +1 -1
  21. package/dist/cjs/vega-rich-text-content.cjs.entry.js +58 -9
  22. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +608 -90
  23. package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +3 -3
  24. package/dist/cjs/vega-section-title.cjs.entry.js +896 -14
  25. package/dist/cjs/vega-time-picker_2.cjs.entry.js +1 -1
  26. package/dist/cjs/vega-tooltip_2.cjs.entry.js +1 -1
  27. package/dist/cjs/vega.cjs.js +7 -7
  28. package/dist/collection/components/vega-combo-box/vega-combo-box.js +2 -2
  29. package/dist/collection/components/vega-dropdown/vega-dropdown.js +30 -7
  30. package/dist/collection/components/vega-input-select/vega-input-select.js +2 -2
  31. package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +4 -0
  32. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +29 -0
  33. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +10 -1
  34. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +8 -3
  35. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-annotation-strategy.abstract.js +60 -0
  36. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.js +36 -4
  37. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-items-strategy.abstract.js +27 -0
  38. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-nest-items-strategy.js +74 -0
  39. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +81 -1
  40. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-selection.js +30 -0
  41. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +160 -9
  42. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +376 -10
  43. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-unnest-items-strategy.js +104 -0
  44. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +2 -0
  45. package/dist/collection/components/vega-rich-text-editor/dto/actions/nest-list-items-action.js +12 -0
  46. package/dist/collection/components/vega-rich-text-editor/dto/actions/unnest-list-items-action.js +12 -0
  47. package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +12 -0
  48. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +10 -1
  49. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +11 -3
  50. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +7 -1
  51. package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-block-filter-styles-strategy.js +8 -4
  52. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +34 -1
  53. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +20 -3
  54. package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.js +25 -1
  55. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +2 -0
  56. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +29 -0
  57. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +30 -1
  58. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/abstract-list-keyboard-handler.js +204 -0
  59. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-shift-tab-outdent-handler.js +42 -0
  60. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-tab-indent-handler.js +34 -0
  61. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/list-keyboard-slimmer.js +180 -0
  62. package/dist/collection/components/vega-section-title/slimmers/a11y-tree/build-section-title-a11y-tree.js +54 -0
  63. package/dist/collection/components/vega-section-title/slimmers/renderers/vega-section-title-renderer.js +4 -4
  64. package/dist/collection/components/vega-section-title/vega-section-title.js +18 -2
  65. package/dist/collection/helpers/a11y-tree/a11y-node-dto.js +210 -0
  66. package/dist/collection/helpers/a11y-tree/a11y-tree-applier.js +189 -0
  67. package/dist/collection/helpers/a11y-tree/a11y-tree.types.js +48 -0
  68. package/dist/collection/helpers/a11y-tree/strategies/baseline-strategy.js +78 -0
  69. package/dist/collection/helpers/a11y-tree/strategies/firefox-nvda-strategy.js +56 -0
  70. package/dist/collection/helpers/a11y-tree/strategies/webkit-voiceover-strategy.js +140 -0
  71. package/dist/collection/helpers/a11y-tree/strategy-resolver.js +172 -0
  72. package/dist/collection/helpers/slimmers/a11y-tree-slimmer.js +54 -0
  73. package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +29 -0
  74. package/dist/collection/helpers/slimmers/element-appender/visibility-modifiers/clip-on-scroll-modifier.js +70 -0
  75. package/dist/collection/helpers/slimmers/element-appender/visibility-modifiers/visibility-modifier.interface.js +1 -0
  76. package/dist/collection/helpers/ui/element-appender.js +16 -0
  77. package/dist/esm/{app-globals-eafcc7a1.js → app-globals-d7b651c1.js} +7 -7
  78. package/dist/esm/{code-block-e12588fe.js → code-block-0a88b481.js} +1495 -51
  79. package/dist/esm/{component-value-history-controller-slimmer.abstract-4e8eb313.js → component-value-history-controller-slimmer.abstract-6846edfa.js} +2 -2
  80. package/dist/esm/{content-state-8032467a.js → content-state-79ca99e5.js} +105 -541
  81. package/dist/esm/{element-appender-slimmer-7fcb944b.js → element-appender-slimmer-73ad10ae.js} +115 -0
  82. package/dist/esm/{image-annotation-action-08a20d5e.js → image-annotation-action-bb299ef1.js} +2 -2
  83. package/dist/esm/{image-extension-b6c7e4a7.js → image-extension-48a96f98.js} +2 -2
  84. package/dist/esm/index.js +8 -8
  85. package/dist/esm/{link-extension-97fcb8fb.js → link-extension-09534514.js} +2 -2
  86. package/dist/esm/loader.js +7 -7
  87. package/dist/esm/{public-rules-c06f0d2a.js → public-rules-5eb03ef0.js} +3 -3
  88. package/dist/esm/{range-e999837f.js → range-d4deb7df.js} +1 -1
  89. package/dist/esm/{rich-text-editor-required-rule-71f8ee98.js → rich-text-editor-required-rule-5bbbce23.js} +1 -1
  90. package/dist/esm/{split-cell-operation-359f8082.js → split-cell-operation-7f3058ad.js} +2 -2
  91. package/dist/esm/{token-extension-f5bf9c21.js → token-extension-40c32bcc.js} +30 -6
  92. package/dist/esm/vega-code-block.entry.js +3 -3
  93. package/dist/esm/vega-date-picker_2.entry.js +1 -1
  94. package/dist/esm/vega-dropdown_5.entry.js +27 -4
  95. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  96. package/dist/esm/vega-popover_2.entry.js +1 -1
  97. package/dist/esm/vega-rich-text-content.entry.js +58 -9
  98. package/dist/esm/vega-rich-text-editor_4.entry.js +604 -86
  99. package/dist/esm/vega-rich-text-table-properties_3.entry.js +3 -3
  100. package/dist/esm/vega-section-title.entry.js +897 -15
  101. package/dist/esm/vega-time-picker_2.entry.js +1 -1
  102. package/dist/esm/vega-tooltip_2.entry.js +1 -1
  103. package/dist/esm/vega.js +7 -7
  104. package/dist/sri/vega-sri-manifest.json +94 -94
  105. package/dist/types/components/vega-combo-box/vega-combo-box.d.ts +6 -6
  106. package/dist/types/components/vega-dropdown/types.d.ts +2 -2
  107. package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +32 -9
  108. package/dist/types/components/vega-input-select/vega-input-select.d.ts +6 -6
  109. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-annotation-strategy.abstract.d.ts +36 -0
  110. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.d.ts +14 -2
  111. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-items-strategy.abstract.d.ts +22 -0
  112. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-nest-items-strategy.d.ts +21 -0
  113. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +14 -0
  114. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-selection.d.ts +15 -0
  115. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.d.ts +30 -3
  116. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.d.ts +99 -3
  117. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-unnest-items-strategy.d.ts +22 -0
  118. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -0
  119. package/dist/types/components/vega-rich-text-editor/dto/actions/nest-list-items-action.d.ts +11 -0
  120. package/dist/types/components/vega-rich-text-editor/dto/actions/unnest-list-items-action.d.ts +11 -0
  121. package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +8 -0
  122. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +6 -1
  123. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +5 -1
  124. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +2 -2
  125. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.d.ts +2 -0
  126. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.d.ts +8 -0
  127. package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.d.ts +18 -0
  128. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +8 -0
  129. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/abstract-list-keyboard-handler.d.ts +99 -0
  130. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-shift-tab-outdent-handler.d.ts +15 -0
  131. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/helper/list-tab-indent-handler.d.ts +15 -0
  132. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/list-keyboard-slimmer.d.ts +73 -0
  133. package/dist/types/components/vega-section-title/slimmers/a11y-tree/build-section-title-a11y-tree.d.ts +41 -0
  134. package/dist/types/components/vega-section-title/vega-section-title.d.ts +9 -0
  135. package/dist/types/components.d.ts +10 -10
  136. package/dist/types/helpers/a11y-tree/a11y-node-dto.d.ts +173 -0
  137. package/dist/types/helpers/a11y-tree/a11y-tree-applier.d.ts +28 -0
  138. package/dist/types/helpers/a11y-tree/a11y-tree.types.d.ts +137 -0
  139. package/dist/types/helpers/a11y-tree/strategies/baseline-strategy.d.ts +18 -0
  140. package/dist/types/helpers/a11y-tree/strategies/firefox-nvda-strategy.d.ts +16 -0
  141. package/dist/types/helpers/a11y-tree/strategies/webkit-voiceover-strategy.d.ts +23 -0
  142. package/dist/types/helpers/a11y-tree/strategy-resolver.d.ts +59 -0
  143. package/dist/types/helpers/slimmers/a11y-tree-slimmer.d.ts +49 -0
  144. package/dist/types/helpers/slimmers/element-appender/element-appender-slimmer.d.ts +9 -0
  145. package/dist/types/helpers/slimmers/element-appender/visibility-modifiers/clip-on-scroll-modifier.d.ts +37 -0
  146. package/dist/types/helpers/slimmers/element-appender/visibility-modifiers/visibility-modifier.interface.d.ts +56 -0
  147. package/dist/types/helpers/ui/element-appender.d.ts +7 -0
  148. package/dist/vega/index.esm.js +1 -1
  149. package/dist/vega/{p-9c39f90b.entry.js → p-1dfbc542.entry.js} +1 -1
  150. package/dist/vega/{p-e235020b.entry.js → p-22cc174e.entry.js} +1 -1
  151. package/dist/vega/{p-b187b82d.entry.js → p-2df5d59b.entry.js} +1 -1
  152. package/dist/vega/{p-f7e459cd.js → p-312d8205.js} +1 -1
  153. package/dist/vega/{p-a7209700.js → p-3345d903.js} +1 -1
  154. package/dist/vega/{p-02355de8.js → p-3c23ec90.js} +1 -1
  155. package/dist/vega/p-55e0014a.js +3 -0
  156. package/dist/vega/p-5f377954.js +1 -1
  157. package/dist/vega/p-65fee02f.entry.js +1 -0
  158. package/dist/vega/p-6a51d720.js +1 -0
  159. package/dist/vega/{p-fe24b459.js → p-6c7b6d45.js} +1 -1
  160. package/dist/vega/{p-579cdeae.js → p-84b7a775.js} +1 -1
  161. package/dist/vega/{p-df828d90.entry.js → p-96da7d30.entry.js} +1 -1
  162. package/dist/vega/{p-88be9ec5.js → p-9d3f69cb.js} +1 -1
  163. package/dist/vega/{p-8a001caa.js → p-9f11b579.js} +1 -1
  164. package/dist/vega/{p-ba2b9663.entry.js → p-acaff62d.entry.js} +1 -1
  165. package/dist/vega/p-b63319e9.entry.js +1 -0
  166. package/dist/vega/{p-c079c935.entry.js → p-b660f38c.entry.js} +1 -1
  167. package/dist/vega/p-b8ffa42f.entry.js +1 -0
  168. package/dist/vega/{p-4fe40b76.js → p-c4564904.js} +1 -1
  169. package/dist/vega/p-d9158512.js +1 -0
  170. package/dist/vega/p-e62d41ee.js +1 -0
  171. package/dist/vega/{p-9f7154d2.js → p-ec5dee32.js} +1 -1
  172. package/dist/vega/{p-05d04c07.entry.js → p-f29d9707.entry.js} +1 -1
  173. package/dist/vega/vega.esm.js +1 -1
  174. package/package.json +3 -2
  175. package/dist/vega/p-0be4df0a.js +0 -1
  176. package/dist/vega/p-38c9d782.js +0 -1
  177. package/dist/vega/p-513bc0d9.js +0 -1
  178. package/dist/vega/p-8d4b85e7.entry.js +0 -1
  179. package/dist/vega/p-c5d3b008.entry.js +0 -1
  180. package/dist/vega/p-d25ca0c3.entry.js +0 -1
  181. package/dist/vega/p-f4da615a.js +0 -3
@@ -137,6 +137,8 @@ var ModifyContentActionType;
137
137
  ModifyContentActionType["LINE_BREAK_MULTIPLE_BLOCKS"] = "LINE_BREAK_MULTIPLE_BLOCKS";
138
138
  ModifyContentActionType["TRANSFORM_LIST_BLOCK"] = "TRANSFORM_LIST_BLOCK";
139
139
  ModifyContentActionType["TRANSFORM_PARAGRAPH_BLOCK"] = "TRANSFORM_PARAGRAPH_BLOCK";
140
+ ModifyContentActionType["NEST_LIST_ITEMS"] = "NEST_LIST_ITEMS";
141
+ ModifyContentActionType["UNNEST_LIST_ITEMS"] = "UNNEST_LIST_ITEMS";
140
142
  ModifyContentActionType["DELETE_BLOCK_CONTENT"] = "DELETE_BLOCK_CONTENT";
141
143
  ModifyContentActionType["INSERT_IMAGE_TO_BLOCK"] = "INSERT_IMAGE_TO_BLOCK";
142
144
  ModifyContentActionType["UPDATE_IMAGE_NODE_URL"] = "UPDATE_IMAGE_NODE_URL";
@@ -4259,6 +4261,37 @@ class BlockInsertImageIntoTextStrategy extends ActionHandleStrategy {
4259
4261
  }
4260
4262
  }
4261
4263
 
4264
+ /**
4265
+ * Normalize a mixed paragraph/list selection before rebuilding it as a list.
4266
+ *
4267
+ * Selected list items whose owning ancestor item is also selected remain inside
4268
+ * that ancestor's nestList instead of being emitted again as flattened siblings.
4269
+ * Their immediate list type is still updated because the nested item was part of
4270
+ * the toolbar selection.
4271
+ *
4272
+ * @param {RTEBlock[]} selectedBlocks - Blocks selected by the toolbar action.
4273
+ * @param {ListType} listType - Target list type.
4274
+ * @returns {RTEBlock[]} Top-level selected blocks to emit into the rebuilt list.
4275
+ */
4276
+ function normalizeMixedListSelection(selectedBlocks, listType) {
4277
+ const selectedListItems = new Set(selectedBlocks.filter((block) => block.dtoName === 'RTEListItemBlock'));
4278
+ return selectedBlocks.filter((block) => {
4279
+ if (!(block.dtoName === 'RTEListItemBlock')) {
4280
+ return true;
4281
+ }
4282
+ let parentList = block.parent;
4283
+ while (parentList.parent && parentList.parent.dtoName === 'RTEListItemBlock') {
4284
+ const ownerItem = parentList.parent;
4285
+ if (selectedListItems.has(ownerItem)) {
4286
+ block.parent.type = listType;
4287
+ return false;
4288
+ }
4289
+ parentList = ownerItem.parent;
4290
+ }
4291
+ return true;
4292
+ });
4293
+ }
4294
+
4262
4295
  /**
4263
4296
  * Convert the selected blocks to list strategy.
4264
4297
  */
@@ -4270,12 +4303,16 @@ class BlockTransformToListStrategy extends ActionHandleStrategy {
4270
4303
  * @param {RTETextBlock} target - The first item of the selected block.
4271
4304
  */
4272
4305
  handleAction(action, target) {
4273
- const contentState = target.parent;
4306
+ const contentState = this.getRootContent(target);
4307
+ if (!contentState) {
4308
+ return;
4309
+ }
4310
+ const container = target.parent;
4274
4311
  const bulletList = contentState.createList(action.listType);
4275
- const selectedBlocks = action.selectedBlocks;
4312
+ const selectedBlocks = normalizeMixedListSelection(action.selectedBlocks, action.listType);
4276
4313
  const listItems = selectedBlocks.map((block) => contentState.toListItem(block));
4277
4314
  bulletList.apply(new AppendChildrenAction(listItems));
4278
- contentState.apply(new InsertChildrenAfterAction(action.selectedBlocks[0], bulletList));
4315
+ container.apply(new InsertChildrenAfterAction(action.selectedBlocks[0], bulletList));
4279
4316
  selectedBlocks.forEach((block) => {
4280
4317
  block.parent.apply(new RemoveChildrenAction(block));
4281
4318
  });
@@ -4672,78 +4709,1485 @@ class RTETextBlock extends RTEBlock {
4672
4709
  RTETextBlock.dtoName = 'RTETextBlock';
4673
4710
 
4674
4711
  /**
4675
- * The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
4712
+ * Remove list item nest list block strategy.
4676
4713
  */
4677
- class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
4714
+ class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
4678
4715
  /**
4679
- * Returns the previous node relative to the current node in a rich text editor structure.
4716
+ * Remove the nest list block from the list item, clear the property children when the children is empty.
4680
4717
  *
4681
- * @param {RTENode} currentNode - An object of type `RTENode`.
4682
- * @returns {Nullable<RTENode>} the previous block last node
4718
+ * @param {RemoveNestListAction} action - The action instance.
4719
+ * @param {RTEListItemBlock} target - The list item block.
4683
4720
  */
4684
- getPreviousNode(currentNode) {
4685
- const currentBlock = currentNode.parent;
4686
- const currentIndex = currentBlock.children.indexOf(currentNode);
4687
- if (currentIndex > 0) {
4688
- return currentBlock.children[currentIndex - 1];
4721
+ handleAction(action, target) {
4722
+ if (target.nestList) {
4723
+ if (target.nestList.length > 1) {
4724
+ target.nestList = target.nestList.filter((child) => child !== action.nestListBlockToBeRemoved);
4725
+ }
4726
+ else {
4727
+ target.nestList = undefined;
4728
+ }
4689
4729
  }
4690
- else if (currentBlock.parent) {
4691
- const previousBlock = this.getPreviousBlock(currentBlock);
4692
- if (previousBlock) {
4693
- return this.getBlockLastNode(previousBlock);
4730
+ }
4731
+ }
4732
+
4733
+ /**
4734
+ * Base strategy for list operations that reconstruct or merge list containers.
4735
+ * Keeps annotation cloning and equality rules consistent across those operations.
4736
+ */
4737
+ class ListAnnotationStrategy extends ActionHandleStrategy {
4738
+ /**
4739
+ * Copy list-container annotations without sharing mutable annotation instances.
4740
+ * Factory-provided defaults remain intact unless the source supplies the same key.
4741
+ *
4742
+ * @param {RTEListBlock} source - List whose annotations should be copied.
4743
+ * @param {RTEListBlock} target - Newly created list receiving the annotations.
4744
+ */
4745
+ copyListAnnotations(source, target) {
4746
+ source.annotationMap.forEach((annotation, key) => {
4747
+ target.annotationMap.set(key, annotation.clone());
4748
+ });
4749
+ }
4750
+ /**
4751
+ * Compare list annotations independently of map/object insertion order. Map keys
4752
+ * are compared separately because rendering annotations such as LIST intentionally
4753
+ * do not serialize to the DTO but still affect the rendered list.
4754
+ * Array order remains significant because it can affect rendered class order.
4755
+ *
4756
+ * @param {RTEListBlock} first - First list to compare.
4757
+ * @param {RTEListBlock} second - Second list to compare.
4758
+ * @returns {boolean} Whether both list containers have equivalent annotations.
4759
+ */
4760
+ haveSameListAnnotations(first, second) {
4761
+ var _a, _b;
4762
+ const firstKeys = Array.from(first.annotationMap.keys()).sort();
4763
+ const secondKeys = Array.from(second.annotationMap.keys()).sort();
4764
+ if (JSON.stringify(firstKeys) !== JSON.stringify(secondKeys)) {
4765
+ return false;
4766
+ }
4767
+ return (JSON.stringify(this.normalizeAnnotationValue((_a = first.toJSON().annotations) !== null && _a !== void 0 ? _a : {})) ===
4768
+ JSON.stringify(this.normalizeAnnotationValue((_b = second.toJSON().annotations) !== null && _b !== void 0 ? _b : {})));
4769
+ }
4770
+ /**
4771
+ * Recursively sort object keys for stable annotation comparison.
4772
+ *
4773
+ * @param {unknown} value - Annotation value to normalize.
4774
+ * @returns {unknown} Normalized annotation value.
4775
+ */
4776
+ normalizeAnnotationValue(value) {
4777
+ if (Array.isArray(value)) {
4778
+ return value.map((item) => this.normalizeAnnotationValue(item));
4779
+ }
4780
+ if (value && typeof value === 'object') {
4781
+ const record = value;
4782
+ return Object.keys(record)
4783
+ .sort()
4784
+ .reduce((normalized, key) => {
4785
+ normalized[key] = this.normalizeAnnotationValue(record[key]);
4786
+ return normalized;
4787
+ }, {});
4788
+ }
4789
+ return value;
4790
+ }
4791
+ }
4792
+
4793
+ /**
4794
+ * Replace list item nest list strategy.
4795
+ *
4796
+ * This is the single write-through point for `nestList` mutations. It automatically
4797
+ * normalizes the incoming array by merging adjacent lists only when their types
4798
+ * and container annotations match. Styled list boundaries remain independent.
4799
+ */
4800
+ class ListItemReplaceNestListStrategy extends ListAnnotationStrategy {
4801
+ /**
4802
+ * @inheritDoc
4803
+ */
4804
+ handleAction(action, target) {
4805
+ const normalized = this.mergeAdjacentSameType(action.newList);
4806
+ normalized.forEach((listBlock) => {
4807
+ listBlock.parent = target;
4808
+ });
4809
+ target.nestList = normalized;
4810
+ }
4811
+ /**
4812
+ * Merge adjacent entries that share the same list type and annotations.
4813
+ * This is an idempotent O(n) pass — calling it on an already-normalized array is a no-op.
4814
+ *
4815
+ * @param {RTEListBlock[]} lists - The nest list array to normalize.
4816
+ * @returns {RTEListBlock[]} A new array with adjacent same-type entries merged.
4817
+ */
4818
+ mergeAdjacentSameType(lists) {
4819
+ if (lists.length <= 1) {
4820
+ return lists;
4821
+ }
4822
+ const merged = [lists[0]];
4823
+ for (let i = 1; i < lists.length; i++) {
4824
+ const prev = merged[merged.length - 1];
4825
+ const current = lists[i];
4826
+ if (prev.type === current.type && this.haveSameListAnnotations(prev, current)) {
4827
+ current.children.forEach((item) => {
4828
+ item.parent = prev;
4829
+ });
4830
+ prev.children = prev.children.concat(current.children);
4831
+ }
4832
+ else {
4833
+ merged.push(current);
4694
4834
  }
4695
4835
  }
4836
+ return merged;
4696
4837
  }
4838
+ }
4839
+
4840
+ /**
4841
+ * Insert image node to list item block strategy.
4842
+ */
4843
+ class ListItemInsertImageStrategy extends ActionHandleStrategy {
4697
4844
  /**
4698
- * Returns the next node relative to the current node in a rich text editor structure.
4845
+ * The image node can not insert into list item block, so insert image after parent list block.
4699
4846
  *
4700
- * @param {RTENode} currentNode - An object of type `RTENode`.
4701
- * @returns {Nullable<RTENode>} the next block first node
4847
+ * @param {InsertImageToBlockAction} action - The action instance.
4848
+ * @param {RTEListItemBlock} target - The list item block.
4702
4849
  */
4703
- getNextNode(currentNode) {
4704
- const currentBlock = currentNode.parent;
4705
- const currentIndex = currentBlock.children.indexOf(currentNode);
4706
- if (currentBlock.children[currentIndex + 1]) {
4707
- return currentBlock.children[currentIndex + 1];
4850
+ handleAction(action, target) {
4851
+ target.parent.apply(action);
4852
+ }
4853
+ }
4854
+
4855
+ /**
4856
+ * List item block.
4857
+ *
4858
+ * Bidirectional nesting contract:
4859
+ * - nestList stores nested list blocks owned by this list item.
4860
+ * - Every nested list block must have listBlock.parent === this list item.
4861
+ */
4862
+ class RTEListItemBlock extends RTETextBlock {
4863
+ constructor(id, nestList, options) {
4864
+ super(id, 'list-item', options);
4865
+ this.dtoName = RTEListItemBlock.dtoName;
4866
+ /**
4867
+ * TODO: Refactor the list item properties children and nestList, merge two properties together.
4868
+ *
4869
+ * 1. Update the type of `children` to include `RTEListBlock` as a possible type.
4870
+ * 2. The list block children should text block array and nest list block array, The text block should wrap a `li` tag when rendering.
4871
+ */
4872
+ this.nestList = [];
4873
+ this.nestList = nestList;
4874
+ }
4875
+ /**
4876
+ * Converts a VegaRTEListItemBlock object to an RTEListItemBlock
4877
+ *
4878
+ * @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
4879
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
4880
+ * @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
4881
+ */
4882
+ static from(block, options = { autoMatchFormat: true }) {
4883
+ const listItemBlock = new RTEListItemBlock(block.id, undefined, options);
4884
+ listItemBlock.children = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock, options));
4885
+ if (block.children) {
4886
+ listItemBlock.nestList = block.children.map((child) => {
4887
+ const listBlock = RTEListBlock.from(child, options);
4888
+ listBlock.parent = listItemBlock;
4889
+ return listBlock;
4890
+ });
4708
4891
  }
4709
- else if (currentBlock.parent) {
4710
- const nextBlock = this.getNextBlock(currentBlock);
4711
- if (nextBlock) {
4712
- return this.getBlockFirstNode(nextBlock);
4892
+ const { annotations } = block;
4893
+ if (annotations) {
4894
+ Object.entries(annotations).forEach(([type, value]) => {
4895
+ const item = this.createAnnotationEntity(type, value);
4896
+ if (isNonNullable(item)) {
4897
+ listItemBlock.annotationMap.set(...item);
4898
+ }
4899
+ });
4900
+ }
4901
+ return listItemBlock;
4902
+ }
4903
+ /**
4904
+ * @inheritDoc
4905
+ */
4906
+ toJSON() {
4907
+ var _a;
4908
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
4909
+ }
4910
+ /**
4911
+ * @inheritDoc
4912
+ */
4913
+ toHtml(options) {
4914
+ var _a;
4915
+ const attrStr = super.generateAttributeString(options);
4916
+ const nestListHtml = ((_a = this.nestList) === null || _a === void 0 ? void 0 : _a.length)
4917
+ ? this.nestList.map((list) => list.toHtml(options)).join('')
4918
+ : '';
4919
+ return [`<li${attrStr}>`, this.getChildrenHtml(options), nestListHtml, `</li>`].join('');
4920
+ }
4921
+ /**
4922
+ * @inheritDoc
4923
+ */
4924
+ cloneWithNodes(nodes) {
4925
+ const block = new RTEListItemBlock(generateUUID());
4926
+ block.children = [];
4927
+ block.apply(new AppendChildrenAction(nodes));
4928
+ return block;
4929
+ }
4930
+ /**
4931
+ * @inheritDoc
4932
+ */
4933
+ getLastNode() {
4934
+ if (this.nestList && this.nestList.length > 0) {
4935
+ const childListBlock = this.nestList[this.nestList.length - 1];
4936
+ return childListBlock.getLastNode();
4937
+ }
4938
+ return super.getLastNode();
4939
+ }
4940
+ /**
4941
+ * Create a new list item block.
4942
+ *
4943
+ * @returns {RTEListItemBlock} - A list item block.
4944
+ */
4945
+ createNewListItem() {
4946
+ return new RTEListItemBlock(generateUUID());
4947
+ }
4948
+ /**
4949
+ * @inheritDoc
4950
+ */
4951
+ clone(parent) {
4952
+ var _a;
4953
+ const block = new RTEListItemBlock(this.id);
4954
+ block.children = this.children.map((node) => node.clone(block));
4955
+ block.annotationMap = super.cloneAnnotations();
4956
+ block.nestList = (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((child) => child.clone(block));
4957
+ block.parent = parent;
4958
+ return block;
4959
+ }
4960
+ }
4961
+ (() => {
4962
+ ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTEListItemBlock.name, new BlockUpdateTextStyleStrategy());
4963
+ ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTEListItemBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
4964
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new BlockInsertLineBreakStrategy());
4965
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
4966
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
4967
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new BlockSplitWithTextNodeStrategy());
4968
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new BlockReplaceNodesStrategy());
4969
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
4970
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new BlockMergeNodesStrategy());
4971
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
4972
+ })();
4973
+ RTEListItemBlock.dtoName = 'RTEListItemBlock';
4974
+
4975
+ /**
4976
+ * Replace the nest list with new list array
4977
+ *
4978
+ * @example listItemBlock.apply(new ReplaceNestListAction(newListBlockArray))
4979
+ */
4980
+ class ReplaceNestListAction extends ModifyContentAction {
4981
+ constructor(newList) {
4982
+ super();
4983
+ this.type = ModifyContentActionType.REPLACE_NEST_LIST;
4984
+ this.newList = newList;
4985
+ }
4986
+ }
4987
+
4988
+ /**
4989
+ * Convert the selected blocks to list strategy.
4990
+ */
4991
+ class ListTransformToListStrategy extends ListAnnotationStrategy {
4992
+ /**
4993
+ * @inheritDoc
4994
+ */
4995
+ handleAction(action, target) {
4996
+ var _a;
4997
+ const selectedBlocks = action.selectedBlocks;
4998
+ const isSameList = selectedBlocks.every((block) => block.parent === target);
4999
+ const rootContent = this.getRootContent(target);
5000
+ if (!rootContent) {
5001
+ return;
5002
+ }
5003
+ // Nested list case: target.parent is RTEListItemBlock, not VegaRTEContent.
5004
+ // Replace the entry in the parent item's nestList using the existing ReplaceNestListAction.
5005
+ if (target.parent instanceof RTEListItemBlock) {
5006
+ if (isSameList) {
5007
+ const newList = this.createListFromSource(rootContent, target, action.listType);
5008
+ newList.apply(new AppendChildrenAction(target.children));
5009
+ const parentListItem = target.parent;
5010
+ const newNestList = ((_a = parentListItem.nestList) !== null && _a !== void 0 ? _a : []).map((list) => (list === target ? newList : list));
5011
+ // Adjacent same-type merge is handled automatically by ListItemReplaceNestListStrategy.
5012
+ parentListItem.apply(new ReplaceNestListAction(newNestList));
5013
+ selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new SyncUpSelectionAction())));
5014
+ }
5015
+ else {
5016
+ this.handleCrossListTransform(action, target);
5017
+ }
5018
+ return;
5019
+ }
5020
+ // Root list case: target.parent is VegaRTEContent.
5021
+ // When all selected blocks are list items from different lists, convert each
5022
+ // affected list's type in place (preserving nesting), then normalize adjacent
5023
+ // same-type root lists into one.
5024
+ if (!isSameList && selectedBlocks.every((block) => block instanceof RTEListItemBlock)) {
5025
+ const affectedLists = new Set(selectedBlocks.map((block) => block.parent));
5026
+ // Track which root lists result from conversion (new lists replace old ones).
5027
+ const convertedRootLists = new Set();
5028
+ affectedLists.forEach((list) => {
5029
+ if (list.type !== action.listType) {
5030
+ this.convertListTypeInPlace(list, action.listType);
5031
+ }
5032
+ });
5033
+ // Collect current top-level lists that contain any selected item, grouped
5034
+ // by their root or HTML-block container.
5035
+ const affectedContainers = new Set();
5036
+ selectedBlocks.forEach((block) => {
5037
+ const parentList = block.parent;
5038
+ if (!(parentList.parent instanceof RTEListItemBlock)) {
5039
+ convertedRootLists.add(parentList);
5040
+ affectedContainers.add(parentList.parent);
5041
+ }
5042
+ });
5043
+ // Only merge adjacent root lists when BOTH are affected by this transform.
5044
+ affectedContainers.forEach((container) => {
5045
+ for (let i = 0; i < container.children.length - 1;) {
5046
+ const current = container.children[i];
5047
+ const next = container.children[i + 1];
5048
+ if (current instanceof RTEListBlock &&
5049
+ next instanceof RTEListBlock &&
5050
+ current.type === next.type &&
5051
+ this.haveSameListAnnotations(current, next) &&
5052
+ convertedRootLists.has(current) &&
5053
+ convertedRootLists.has(next)) {
5054
+ current.apply(new AppendChildrenAction([...next.children]));
5055
+ container.apply(new RemoveChildrenAction(next));
5056
+ convertedRootLists.delete(next);
5057
+ }
5058
+ else {
5059
+ i++;
5060
+ }
5061
+ }
5062
+ });
5063
+ selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new SyncUpSelectionAction())));
5064
+ return;
5065
+ }
5066
+ const bulletList = this.createListFromSource(rootContent, target, action.listType);
5067
+ const targetContainer = target.parent;
5068
+ if (isSameList) {
5069
+ // Select one or more list items belonging to the same list, and all items in this list should be updated
5070
+ bulletList.apply(new AppendChildrenAction(target.children));
5071
+ targetContainer.apply(new InsertChildrenAfterAction(target, bulletList));
5072
+ targetContainer.apply(new RemoveChildrenAction(target));
5073
+ selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new SyncUpSelectionAction())));
5074
+ }
5075
+ else {
5076
+ const mixedSelection = normalizeMixedListSelection(action.selectedBlocks, action.listType);
5077
+ const listItems = mixedSelection.map((block) => rootContent.toListItem(block));
5078
+ bulletList.apply(new AppendChildrenAction(listItems));
5079
+ targetContainer.apply(new InsertChildrenAfterAction(target, bulletList));
5080
+ mixedSelection.forEach((block) => {
5081
+ block.parent.apply(new RemoveChildrenAction(block));
5082
+ });
5083
+ if (target.children.length === 0) {
5084
+ targetContainer.apply(new RemoveChildrenAction(target));
4713
5085
  }
4714
5086
  }
4715
5087
  }
4716
5088
  /**
4717
- * Determines if a given node is the first node within the current state.
5089
+ * Convert a single list's type in place, preserving its items and their nested
5090
+ * structure. Root lists are swapped in the content children; nested lists are
5091
+ * swapped inside their parent item's nestList.
4718
5092
  *
4719
- * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
4720
- * @returns {boolean} True or false;
5093
+ * @param {RTEListBlock} list - The list whose type should be converted.
5094
+ * @param {RTEListBlock['type']} listType - The target list type.
4721
5095
  */
4722
- isContentFirstNode(currentNode) {
4723
- const currentBlock = currentNode.parent;
4724
- const currentIndex = currentBlock.children.indexOf(currentNode);
4725
- const parent = currentBlock.parent;
4726
- if (currentBlock.isListItemBlock()) {
4727
- const listParent = parent.parent;
4728
- return (currentIndex === 0 &&
4729
- Array.isArray(parent.children) &&
4730
- parent.children[0] === currentBlock &&
4731
- listParent['type'] !== 'list-item' &&
4732
- Array.isArray(listParent.children) &&
4733
- listParent.children[0] === parent);
5096
+ convertListTypeInPlace(list, listType) {
5097
+ var _a;
5098
+ const rootContent = this.getRootContent(list);
5099
+ if (!rootContent) {
5100
+ return;
5101
+ }
5102
+ const parent = list.parent;
5103
+ const newList = this.createListFromSource(rootContent, list, listType);
5104
+ newList.apply(new AppendChildrenAction([...list.children]));
5105
+ if (parent instanceof RTEListItemBlock) {
5106
+ // Adjacent same-type merge is handled automatically by ListItemReplaceNestListStrategy.
5107
+ const newNestList = ((_a = parent.nestList) !== null && _a !== void 0 ? _a : []).map((entry) => entry === list ? newList : entry);
5108
+ parent.apply(new ReplaceNestListAction(newNestList));
4734
5109
  }
4735
5110
  else {
4736
- return (currentIndex === 0 && Array.isArray(parent.children) && parent.children[0] === currentBlock);
5111
+ parent.apply(new InsertChildrenAfterAction(list, newList));
5112
+ parent.apply(new RemoveChildrenAction(list));
4737
5113
  }
4738
5114
  }
4739
5115
  /**
4740
- * TODO: The getPreviousBlock add nest list support
4741
- * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
5116
+ * Handle the case where selected blocks span multiple nestLists under the same parent item.
5117
+ * Transform each affected list and then merge adjacent same-type lists.
4742
5118
  *
4743
- * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
4744
- * @returns {Nullable<RTEBlock>} The previous block if existing
5119
+ * @param {TransformListAction} action - The transform action with selection and target list type.
5120
+ * @param {RTEListBlock} target - The nested list where transformation starts.
4745
5121
  */
4746
- getPreviousBlock(currentBlock) {
5122
+ handleCrossListTransform(action, target) {
5123
+ if (!(target.parent instanceof RTEListItemBlock)) {
5124
+ return;
5125
+ }
5126
+ const rootContent = this.getRootContent(target);
5127
+ if (!rootContent) {
5128
+ return;
5129
+ }
5130
+ const parentListItem = target.parent;
5131
+ const parentNestLists = parentListItem.nestList;
5132
+ const affectedLists = new Set(action.selectedBlocks
5133
+ .filter((block) => block instanceof RTEListItemBlock)
5134
+ .map((block) => block.parent)
5135
+ .filter((list) => parentNestLists.includes(list)));
5136
+ if (!affectedLists.size) {
5137
+ return;
5138
+ }
5139
+ const newNestList = parentNestLists.map((list) => {
5140
+ if (!affectedLists.has(list)) {
5141
+ return list;
5142
+ }
5143
+ const newList = this.createListFromSource(rootContent, list, action.listType);
5144
+ newList.apply(new AppendChildrenAction(list.children));
5145
+ return newList;
5146
+ });
5147
+ // Adjacent same-type merge is handled automatically by ListItemReplaceNestListStrategy.
5148
+ parentListItem.apply(new ReplaceNestListAction(newNestList));
5149
+ action.selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new SyncUpSelectionAction())));
5150
+ }
5151
+ /**
5152
+ * Create a replacement list through the owning content factory while retaining
5153
+ * the source list's container annotations.
5154
+ *
5155
+ * @param {VegaRTEContent} rootContent - Editor content owning the factory.
5156
+ * @param {RTEListBlock} source - List whose annotations should be retained.
5157
+ * @param {RTEListBlock['type']} listType - Replacement list type.
5158
+ * @returns {RTEListBlock} New annotated list shell.
5159
+ */
5160
+ createListFromSource(rootContent, source, listType) {
5161
+ const list = rootContent.createList(listType);
5162
+ this.copyListAnnotations(source, list);
5163
+ return list;
5164
+ }
5165
+ }
5166
+
5167
+ /**
5168
+ * Action to toggle bullet annotation
5169
+ */
5170
+ class TransformParagraphAction extends ModifyContentAction {
5171
+ constructor(selectedBlocks) {
5172
+ super();
5173
+ this.type = ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK;
5174
+ this.isFlushable = true;
5175
+ this.selectedBlocks = selectedBlocks;
5176
+ }
5177
+ }
5178
+
5179
+ /**
5180
+ * HTML Block
5181
+ */
5182
+ class RTEHtmlBlock extends RTEBlock {
5183
+ constructor(id, htmlTag) {
5184
+ super(id);
5185
+ this.dtoName = RTEHtmlBlock.dtoName;
5186
+ this.type = 'html-block';
5187
+ this.children = [];
5188
+ this.htmlTag = htmlTag;
5189
+ }
5190
+ /**
5191
+ * Converts a VegaRTEHtmlBlock to an RTEHtmlBlock.
5192
+ *
5193
+ * @param {VegaRTEHtmlBlock} block - The VegaRTEHtmlBlock to convert.
5194
+ * @param {VegaRTETransformOptions} [options] - Optional transformation options.
5195
+ * @returns {RTEHtmlBlock} The converted RTEHtmlBlock.
5196
+ */
5197
+ static from(block, options) {
5198
+ const htmlBlock = new RTEHtmlBlock(block.id, block.htmlTag);
5199
+ const { annotations } = block;
5200
+ if (annotations) {
5201
+ super.convertAnnotationsToMap(htmlBlock.annotationMap, annotations);
5202
+ }
5203
+ htmlBlock.children = this.generateBlockChildren(block.children, options, htmlBlock);
5204
+ return htmlBlock;
5205
+ }
5206
+ /**
5207
+ * @inheritDoc
5208
+ */
5209
+ clone(parent) {
5210
+ const clonedBlock = new RTEHtmlBlock(this.id, this.htmlTag);
5211
+ clonedBlock.children = this.children.map((child) => child.clone(clonedBlock));
5212
+ clonedBlock.annotationMap = super.cloneAnnotations();
5213
+ clonedBlock.parent = parent;
5214
+ return clonedBlock;
5215
+ }
5216
+ /**
5217
+ * @inheritDoc
5218
+ */
5219
+ getLastNode() {
5220
+ return this.children[this.children.length - 1].getLastNode();
5221
+ }
5222
+ /**
5223
+ * @inheritDoc
5224
+ */
5225
+ isNotEmpty() {
5226
+ // Any RTEHtmlBlock — whether void (hr, br), childless (canvas, iframe),
5227
+ // or with children — represents real user content. Only the default empty
5228
+ // text paragraph should make the editor report as empty.
5229
+ return true;
5230
+ }
5231
+ /**
5232
+ * @inheritDoc
5233
+ */
5234
+ toHtml(options) {
5235
+ const BlockTag = this.htmlTag;
5236
+ const attrStr = super.generateAttributeString(options);
5237
+ // Handle void/self-closing tags (hr, input, col, etc.)
5238
+ // Uses HTML5 syntax without self-closing slash for consistency with img and br tags
5239
+ if (HTML_VOID_TAGS.has(this.htmlTag)) {
5240
+ return `<${BlockTag}${attrStr}>`;
5241
+ }
5242
+ // Handle normal tags with children
5243
+ return [
5244
+ `<${BlockTag}${attrStr}>`,
5245
+ this.children.map((block) => block.toHtml(options)).join(''),
5246
+ `</${BlockTag}>`,
5247
+ ].join('');
5248
+ }
5249
+ /**
5250
+ * @inheritDoc
5251
+ */
5252
+ toJSON() {
5253
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, htmlTag: this.htmlTag, children: this.children.map((child) => child.toJSON()) });
5254
+ }
5255
+ }
5256
+ RTEHtmlBlock.dtoName = 'RTEHtmlBlock';
5257
+
5258
+ /**
5259
+ * Convert the selected list block to paragraph strategy.
5260
+ */
5261
+ class ListTransformToParagraphStrategy extends ListAnnotationStrategy {
5262
+ /**
5263
+ * @inheritDoc
5264
+ */
5265
+ handleAction(action, target) {
5266
+ const selectedSegments = this.getSelectedSegments(action.selectedBlocks);
5267
+ if (selectedSegments.length === 0 || !this.hasConsistentTargetAndRoot(selectedSegments, target)) {
5268
+ return;
5269
+ }
5270
+ this.syncSelection(selectedSegments);
5271
+ [...selectedSegments]
5272
+ .reverse()
5273
+ .forEach((segment) => this.transformSegment(segment));
5274
+ }
5275
+ /**
5276
+ * Ensure the action is applied to the first selected item's parent list and
5277
+ * every selected item belongs to the same editor content.
5278
+ *
5279
+ * @param {RTEListItemBlock[][]} selectedSegments - Normalized selection segments.
5280
+ * @param {RTEListBlock} target - List receiving the transform action.
5281
+ * @returns {boolean} Whether the target and root content are consistent.
5282
+ */
5283
+ hasConsistentTargetAndRoot(selectedSegments, target) {
5284
+ if (selectedSegments[0][0].parent !== target) {
5285
+ return false;
5286
+ }
5287
+ const targetRoot = this.getRootContent(target);
5288
+ return Boolean(targetRoot &&
5289
+ selectedSegments.every((segment) => segment.every((item) => this.getRootContent(item) === targetRoot)));
5290
+ }
5291
+ /**
5292
+ * Capture selected text nodes in document order before reverse-order tree
5293
+ * mutations move them into paragraphs.
5294
+ *
5295
+ * @param {RTEListItemBlock[][]} selectedSegments - Normalized selection segments.
5296
+ */
5297
+ syncSelection(selectedSegments) {
5298
+ selectedSegments.forEach((segment) => {
5299
+ segment.forEach((block) => {
5300
+ block.children.forEach((node) => node.apply(new SyncUpSelectionAction()));
5301
+ });
5302
+ });
5303
+ }
5304
+ /**
5305
+ * Transform one normalized segment without recursively dispatching another
5306
+ * flushable action.
5307
+ *
5308
+ * @param {RTEListItemBlock[]} segment - Contiguous items sharing one parent list.
5309
+ */
5310
+ transformSegment(segment) {
5311
+ const segmentTarget = segment[0].parent;
5312
+ const normalizedAction = new TransformParagraphAction(segment);
5313
+ if (segmentTarget.parent instanceof RTEListItemBlock) {
5314
+ this.handleNestedListCase(normalizedAction, segmentTarget);
5315
+ return;
5316
+ }
5317
+ this.handleRootListCase(normalizedAction, segmentTarget);
5318
+ }
5319
+ /**
5320
+ * Handle the case where the target list is at root level (parent is VegaRTEContent).
5321
+ *
5322
+ * @param {TransformParagraphAction} action - The paragraph transform action.
5323
+ * @param {RTEListBlock} target - The root list being transformed.
5324
+ */
5325
+ handleRootListCase(action, target) {
5326
+ // handleAction validates that the target belongs to an editor content root.
5327
+ const rootContent = this.getRootContent(target);
5328
+ let isSelectedFirstBlock = false;
5329
+ let isSelectedLastBlock = false;
5330
+ const selectedBlocks = action.selectedBlocks;
5331
+ // Build an operation-local insertion sequence. Paragraphs are merge
5332
+ // boundaries; only consecutive same-type promoted lists are merged.
5333
+ const insertionBlocks = [];
5334
+ selectedBlocks.forEach((block) => {
5335
+ var _a;
5336
+ if (block === target.children[0])
5337
+ isSelectedFirstBlock = true;
5338
+ if (block === target.children[target.children.length - 1])
5339
+ isSelectedLastBlock = true;
5340
+ insertionBlocks.push(this.toParagraph(block));
5341
+ for (const nestList of (_a = block.nestList) !== null && _a !== void 0 ? _a : []) {
5342
+ this.appendListBlock(insertionBlocks, nestList);
5343
+ }
5344
+ });
5345
+ if (isSelectedFirstBlock) {
5346
+ target.parent.apply(new InsertChildrenBeforeAction(target, ...insertionBlocks));
5347
+ }
5348
+ else if (isSelectedLastBlock) {
5349
+ target.parent.apply(new InsertChildrenAfterAction(target, ...insertionBlocks));
5350
+ }
5351
+ else {
5352
+ const startIndex = target.children.indexOf(selectedBlocks[0]);
5353
+ const lastIndex = target.children.indexOf(selectedBlocks[selectedBlocks.length - 1]);
5354
+ const firstBulletList = this.createListFromSource(rootContent, target);
5355
+ firstBulletList.apply(new AppendChildrenAction(target.children.slice(0, startIndex)));
5356
+ const lastBulletList = this.createListFromSource(rootContent, target);
5357
+ lastBulletList.apply(new AppendChildrenAction(target.children.slice(lastIndex + 1)));
5358
+ // Merge last insertionBlock with lastBulletList if same type
5359
+ const lastInsertion = insertionBlocks[insertionBlocks.length - 1];
5360
+ if (lastInsertion instanceof RTEListBlock &&
5361
+ lastBulletList.children.length > 0 &&
5362
+ lastInsertion.type === lastBulletList.type &&
5363
+ this.haveSameListAnnotations(lastInsertion, lastBulletList)) {
5364
+ lastInsertion.apply(new AppendChildrenAction(lastBulletList.children));
5365
+ target.parent.apply(new InsertChildrenBeforeAction(target, firstBulletList, ...insertionBlocks));
5366
+ }
5367
+ else {
5368
+ target.parent.apply(new InsertChildrenBeforeAction(target, firstBulletList, ...insertionBlocks, lastBulletList));
5369
+ }
5370
+ target.parent.apply(new RemoveChildrenAction(target));
5371
+ }
5372
+ selectedBlocks.map((block) => {
5373
+ // Clear nestList before removal to prevent ListRemoveListItemStrategy
5374
+ // from promoting the same nested lists a second time.
5375
+ block.nestList = [];
5376
+ target.apply(new RemoveChildrenAction(block));
5377
+ });
5378
+ if (target.children.length === 0) {
5379
+ target.parent.apply(new RemoveChildrenAction(target));
5380
+ }
5381
+ else if (isSelectedFirstBlock) {
5382
+ // When removing the first item(s), a promoted same-type nestList (last
5383
+ // insertionBlock) ends up immediately before the remaining target. Merge
5384
+ // them so the user doesn't see two adjacent same-type lists.
5385
+ const lastInserted = insertionBlocks[insertionBlocks.length - 1];
5386
+ if (lastInserted instanceof RTEListBlock &&
5387
+ lastInserted.type === target.type &&
5388
+ this.haveSameListAnnotations(lastInserted, target)) {
5389
+ lastInserted.apply(new AppendChildrenAction([...target.children]));
5390
+ target.parent.apply(new RemoveChildrenAction(target));
5391
+ }
5392
+ }
5393
+ }
5394
+ /**
5395
+ * Handle the case where the target list is nested (parent is RTEListItemBlock).
5396
+ *
5397
+ * Algorithm:
5398
+ * 1. Build the ancestor path from root list down to the target nested list.
5399
+ * 2. At each level on the path, collect "trailing" items (items after the ancestor).
5400
+ * 3. Trim each list along the path to keep only the "before" portion.
5401
+ * 4. Collect trailing items from all levels + selected item's own nestList children.
5402
+ * 5. Group trailing items into lists by consecutive type.
5403
+ * 6. Insert into content: [before-root-list, paragraphs, ...after-lists].
5404
+ *
5405
+ * @param {TransformParagraphAction} action - The paragraph transform action.
5406
+ * @param {RTEListBlock} target - The nested list being transformed.
5407
+ */
5408
+ handleNestedListCase(action, target) {
5409
+ const selectedBlocks = action.selectedBlocks;
5410
+ const rootContent = this.getRootContent(target);
5411
+ const selectedItem = selectedBlocks[0];
5412
+ const selectedIndex = target.children.indexOf(selectedItem);
5413
+ // Emit each selected item as paragraph + its own nested lists so that
5414
+ // selecting multiple levels never moves a child list past another paragraph.
5415
+ const insertions = [];
5416
+ selectedBlocks.forEach((block) => {
5417
+ var _a;
5418
+ insertions.push(this.toParagraph(block));
5419
+ for (const nestList of (_a = block.nestList) !== null && _a !== void 0 ? _a : []) {
5420
+ this.appendListBlock(insertions, nestList);
5421
+ }
5422
+ });
5423
+ const lastSelectedIndex = target.children.indexOf(selectedBlocks[selectedBlocks.length - 1]);
5424
+ // Collect trailing items from the nested list (items AFTER the last selected)
5425
+ const nestedTrailingItems = target.children.slice(lastSelectedIndex + 1);
5426
+ const ancestorPath = [];
5427
+ let currentList = target;
5428
+ while (currentList.parent instanceof RTEListItemBlock) {
5429
+ const parentItem = currentList.parent;
5430
+ const grandParentList = parentItem.parent;
5431
+ const ancestorIndex = grandParentList.children.indexOf(parentItem);
5432
+ // Collect nestLists of parentItem that are AFTER currentList
5433
+ const parentNestLists = parentItem.nestList;
5434
+ const nestListIndex = parentNestLists.indexOf(currentList);
5435
+ const trailingNestLists = parentNestLists.slice(nestListIndex + 1);
5436
+ ancestorPath.push({ list: grandParentList, ancestorIndex, trailingNestLists });
5437
+ currentList = grandParentList;
5438
+ }
5439
+ // currentList is now the root-level list
5440
+ const rootList = currentList;
5441
+ const rootContainer = rootList.parent;
5442
+ const trailingGroups = [];
5443
+ // 1. Trailing items from the target nested list (same type as target)
5444
+ if (nestedTrailingItems.length > 0) {
5445
+ trailingGroups.push({ items: nestedTrailingItems, sourceList: target });
5446
+ }
5447
+ // 2. Trailing nestLists from ancestors (innermost to outermost)
5448
+ // 3. Trailing items from each ancestor level's list
5449
+ for (const level of ancestorPath) {
5450
+ // Trailing nestLists from the ancestor item
5451
+ for (const trailingNest of level.trailingNestLists) {
5452
+ if (trailingNest.children.length > 0) {
5453
+ trailingGroups.push({ items: [...trailingNest.children], sourceList: trailingNest });
5454
+ }
5455
+ }
5456
+ // Trailing items from ancestor's list (items after the ancestor item)
5457
+ const trailingFromLevel = level.list.children.slice(level.ancestorIndex + 1);
5458
+ if (trailingFromLevel.length > 0) {
5459
+ trailingGroups.push({ items: trailingFromLevel, sourceList: level.list });
5460
+ }
5461
+ }
5462
+ // Merge only groups whose list type and container annotations match. Different
5463
+ // class/style/attribute boundaries must survive the structural reconstruction.
5464
+ const mergedGroups = [];
5465
+ for (const group of trailingGroups) {
5466
+ const prev = mergedGroups[mergedGroups.length - 1];
5467
+ if (prev &&
5468
+ prev.sourceList.type === group.sourceList.type &&
5469
+ this.haveSameListAnnotations(prev.sourceList, group.sourceList)) {
5470
+ prev.items.push(...group.items);
5471
+ }
5472
+ else {
5473
+ mergedGroups.push({ items: [...group.items], sourceList: group.sourceList });
5474
+ }
5475
+ }
5476
+ // Build the "after" lists
5477
+ const afterLists = mergedGroups.map((group) => {
5478
+ const newList = this.createListFromSource(rootContent, group.sourceList);
5479
+ newList.apply(new AppendChildrenAction(group.items));
5480
+ return newList;
5481
+ });
5482
+ afterLists.forEach((list) => this.appendListBlock(insertions, list));
5483
+ // --- Now trim the "before" portion ---
5484
+ // Trim target nested list: keep only items before selected
5485
+ target.children = target.children.slice(0, selectedIndex);
5486
+ // Clean up the target nested list's parent item's nestList
5487
+ const targetParentItem = target.parent;
5488
+ const targetParentNestLists = targetParentItem.nestList;
5489
+ const targetNestIndex = targetParentNestLists.indexOf(target);
5490
+ // Keep only nestLists up to and including the target (remove trailing ones we already collected)
5491
+ let trimmedNestList = targetParentNestLists.slice(0, targetNestIndex + 1);
5492
+ // If target is now empty, remove it too
5493
+ if (target.children.length === 0) {
5494
+ trimmedNestList = trimmedNestList.filter((l) => l !== target);
5495
+ }
5496
+ targetParentItem.apply(new ReplaceNestListAction(trimmedNestList));
5497
+ // Trim ancestor levels: remove trailing items and trailing nestLists
5498
+ for (const level of ancestorPath) {
5499
+ // Remove trailing items from the ancestor's list
5500
+ level.list.children = level.list.children.slice(0, level.ancestorIndex + 1);
5501
+ // Remove trailing nestLists from the ancestor item
5502
+ if (level.trailingNestLists.length > 0) {
5503
+ const ancestorItem = level.list.children[level.ancestorIndex];
5504
+ const ancestorNestLists = ancestorItem.nestList;
5505
+ const firstTrailingNestIndex = ancestorNestLists.indexOf(level.trailingNestLists[0]);
5506
+ if (firstTrailingNestIndex >= 0) {
5507
+ const keptNestLists = ancestorNestLists.slice(0, firstTrailingNestIndex);
5508
+ ancestorItem.apply(new ReplaceNestListAction(keptNestLists));
5509
+ }
5510
+ }
5511
+ }
5512
+ rootContainer.apply(new InsertChildrenAfterAction(rootList, ...insertions));
5513
+ }
5514
+ /**
5515
+ * Normalize selected items into document order and split them into contiguous
5516
+ * segments that share the same immediate parent list. Unlike Shift+Tab, the
5517
+ * toolbar action keeps selected descendants so every selected item becomes a
5518
+ * paragraph.
5519
+ *
5520
+ * @param {RTEBlock[]} selectedBlocks - Raw selected blocks.
5521
+ * @returns {RTEListItemBlock[][]} Parent-based contiguous selection segments.
5522
+ */
5523
+ getSelectedSegments(selectedBlocks) {
5524
+ const selectedItems = Array.from(new Set(selectedBlocks.filter((block) => block instanceof RTEListItemBlock)))
5525
+ .map((item) => ({ item, path: this.getStructuralPath(item) }))
5526
+ .filter((entry) => entry.path !== null)
5527
+ .sort((a, b) => this.compareStructuralPaths(a.path, b.path))
5528
+ .map((entry) => entry.item);
5529
+ const segments = [];
5530
+ for (const item of selectedItems) {
5531
+ const segment = segments[segments.length - 1];
5532
+ const previousItem = segment === null || segment === void 0 ? void 0 : segment[segment.length - 1];
5533
+ const isContiguousSibling = (previousItem === null || previousItem === void 0 ? void 0 : previousItem.parent) === item.parent &&
5534
+ item.parent.children.indexOf(item) - item.parent.children.indexOf(previousItem) === 1;
5535
+ if (isContiguousSibling) {
5536
+ segment.push(item);
5537
+ }
5538
+ else {
5539
+ segments.push([item]);
5540
+ }
5541
+ }
5542
+ return segments;
5543
+ }
5544
+ /**
5545
+ * Resolve a list item's structural document path, including the positions of
5546
+ * root lists, owning list items, nested lists, and the item itself.
5547
+ *
5548
+ * @param {RTEListItemBlock} item - Selected list item.
5549
+ * @returns {number[] | null} Structural path, or null for a detached item.
5550
+ */
5551
+ getStructuralPath(item) {
5552
+ var _a;
5553
+ const path = [];
5554
+ const visitedLists = new Set();
5555
+ let currentItem = item;
5556
+ let currentList = item.parent;
5557
+ while (!visitedLists.has(currentList)) {
5558
+ visitedLists.add(currentList);
5559
+ const itemIndex = currentList.children.indexOf(currentItem);
5560
+ if (itemIndex < 0) {
5561
+ return null;
5562
+ }
5563
+ path.unshift(itemIndex);
5564
+ if (currentList.parent.dtoName === 'VegaRTEContent' ||
5565
+ currentList.parent.dtoName === 'RTEHtmlBlock') {
5566
+ const containerPath = this.getContainerPath(currentList);
5567
+ return containerPath ? [...containerPath, ...path] : null;
5568
+ }
5569
+ if (!(currentList.parent instanceof RTEListItemBlock)) {
5570
+ return null;
5571
+ }
5572
+ const ownerItem = currentList.parent;
5573
+ const nestListIndex = ((_a = ownerItem.nestList) !== null && _a !== void 0 ? _a : []).indexOf(currentList);
5574
+ if (nestListIndex < 0) {
5575
+ return null;
5576
+ }
5577
+ path.unshift(nestListIndex);
5578
+ currentItem = ownerItem;
5579
+ currentList = ownerItem.parent;
5580
+ }
5581
+ return null;
5582
+ }
5583
+ /**
5584
+ * Resolve a root list's path through zero or more HTML containers to the
5585
+ * editor content.
5586
+ *
5587
+ * @param {RTEListBlock} rootList - List whose parent is a content container.
5588
+ * @returns {number[] | null} Container path, or null for detached/cyclic ownership.
5589
+ */
5590
+ getContainerPath(rootList) {
5591
+ const path = [];
5592
+ const visitedContainers = new Set();
5593
+ let child = rootList;
5594
+ let container = rootList.parent;
5595
+ while (container instanceof RTEHtmlBlock) {
5596
+ if (visitedContainers.has(container)) {
5597
+ return null;
5598
+ }
5599
+ visitedContainers.add(container);
5600
+ const childIndex = container.children.indexOf(child);
5601
+ if (childIndex < 0) {
5602
+ return null;
5603
+ }
5604
+ path.unshift(childIndex);
5605
+ child = container;
5606
+ container = container.parent;
5607
+ }
5608
+ const rootChildIndex = container.children.indexOf(child);
5609
+ if (rootChildIndex < 0) {
5610
+ return null;
5611
+ }
5612
+ path.unshift(rootChildIndex);
5613
+ return path;
5614
+ }
5615
+ /**
5616
+ * Compare two structural paths in document order.
5617
+ *
5618
+ * @param {number[]} firstPath - First structural path.
5619
+ * @param {number[]} secondPath - Second structural path.
5620
+ * @returns {number} Relative document order.
5621
+ */
5622
+ compareStructuralPaths(firstPath, secondPath) {
5623
+ const length = Math.min(firstPath.length, secondPath.length);
5624
+ for (let index = 0; index < length; index++) {
5625
+ if (firstPath[index] !== secondPath[index]) {
5626
+ return firstPath[index] - secondPath[index];
5627
+ }
5628
+ }
5629
+ return firstPath.length - secondPath.length;
5630
+ }
5631
+ /**
5632
+ * Append a list to an operation-local block sequence, merging only with the
5633
+ * immediately preceding same-type list in that sequence.
5634
+ *
5635
+ * @param {RTEBlock[]} blocks - Operation-local output sequence.
5636
+ * @param {RTEListBlock} list - List to append or merge.
5637
+ */
5638
+ appendListBlock(blocks, list) {
5639
+ const previousBlock = blocks[blocks.length - 1];
5640
+ if (previousBlock instanceof RTEListBlock &&
5641
+ previousBlock.type === list.type &&
5642
+ this.haveSameListAnnotations(previousBlock, list)) {
5643
+ previousBlock.apply(new AppendChildrenAction([...list.children]));
5644
+ return;
5645
+ }
5646
+ blocks.push(list);
5647
+ }
5648
+ /**
5649
+ * Create a list through the content factory and retain the source list's
5650
+ * container annotations when a structural split requires a new list block.
5651
+ *
5652
+ * @param {VegaRTEContent} rootContent - Editor content that owns the factory.
5653
+ * @param {RTEListBlock} source - List whose type and annotations should be retained.
5654
+ * @returns {RTEListBlock} Newly created list shell.
5655
+ */
5656
+ createListFromSource(rootContent, source) {
5657
+ const list = rootContent.createList(source.type);
5658
+ this.copyListAnnotations(source, list);
5659
+ return list;
5660
+ }
5661
+ /**
5662
+ * Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
5663
+ *
5664
+ * @param {RTEListItemBlock} block - The block that will be covered
5665
+ * @returns {RTETextBlock} Returns a `RTETextBlock`.
5666
+ */
5667
+ toParagraph(block) {
5668
+ const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
5669
+ textBlock.apply(new AppendChildrenAction(block['children']));
5670
+ textBlock['annotationMap'] = block['annotationMap'];
5671
+ return textBlock;
5672
+ }
5673
+ }
5674
+
5675
+ /**
5676
+ * Insert image to list block strategy.
5677
+ */
5678
+ class ListInsertImageStrategy extends ActionHandleStrategy {
5679
+ /**
5680
+ * Insert image block at behind of the list item block.
5681
+ *
5682
+ * @param {InsertImageToBlockAction} action - The insert image action instance.
5683
+ * @param {RTEListBlock} target - The list block.
5684
+ */
5685
+ handleAction(action, target) {
5686
+ const imageBlock = action.imageBlockToBeInserted;
5687
+ if (target.parent['type'] !== 'list-item') {
5688
+ target.parent.apply(new InsertChildrenAfterAction(target, imageBlock));
5689
+ }
5690
+ else {
5691
+ target.parent.apply(action);
5692
+ }
5693
+ }
5694
+ }
5695
+
5696
+ /**
5697
+ * Shared base strategy for list-item operations that require ordered contiguous
5698
+ * item selection within the same target list.
5699
+ */
5700
+ class AbstractListItemsStrategy extends ActionHandleStrategy {
5701
+ /**
5702
+ * Returns selected list items ordered by their position in target and validated
5703
+ * as a contiguous range. Returns an empty array when selection is invalid.
5704
+ *
5705
+ * @param {RTEListBlock} target - The target list block containing selected items.
5706
+ * @param {RTEListItemBlock[]} selectedBlocks - Selected list items from action payload.
5707
+ * @returns {RTEListItemBlock[]} Ordered contiguous selected items, or empty array.
5708
+ */
5709
+ getOrderedContiguousItems(target, selectedBlocks) {
5710
+ const orderedItems = [...selectedBlocks].sort((a, b) => target.children.indexOf(a) - target.children.indexOf(b));
5711
+ const startIndex = target.children.indexOf(orderedItems[0]);
5712
+ if (startIndex < 0) {
5713
+ return [];
5714
+ }
5715
+ return target.children
5716
+ .slice(startIndex, startIndex + orderedItems.length)
5717
+ .every((item, index) => item === orderedItems[index])
5718
+ ? orderedItems
5719
+ : [];
5720
+ }
5721
+ }
5722
+
5723
+ /**
5724
+ * Move selected list items into a nested list under the previous sibling.
5725
+ */
5726
+ class ListNestItemsStrategy extends AbstractListItemsStrategy {
5727
+ /**
5728
+ * @inheritDoc
5729
+ */
5730
+ handleAction(action, target) {
5731
+ var _a, _b;
5732
+ const selectedItems = this.getOrderedContiguousItems(target, action.selectedBlocks);
5733
+ if (!selectedItems.length) {
5734
+ return;
5735
+ }
5736
+ const startIndex = target.children.indexOf(selectedItems[0]);
5737
+ if (startIndex <= 0) {
5738
+ return;
5739
+ }
5740
+ const previousSibling = target.children[startIndex - 1];
5741
+ const selectedItemSet = new Set(selectedItems);
5742
+ // Tab behavior intentionally keeps using the last nested list entry if present,
5743
+ // even when mixed nested-list types exist, to preserve current behavior.
5744
+ // This also matches the behavior of other rich text editors, especially CKEditor.
5745
+ let nestedList = (_a = previousSibling.nestList) === null || _a === void 0 ? void 0 : _a[previousSibling.nestList.length - 1];
5746
+ if (!nestedList) {
5747
+ nestedList = new RTEListBlock(generateUUID(), target.type);
5748
+ previousSibling.apply(new ReplaceNestListAction([...((_b = previousSibling.nestList) !== null && _b !== void 0 ? _b : []), nestedList]));
5749
+ }
5750
+ target.children = target.children.filter((item) => !selectedItemSet.has(item));
5751
+ nestedList.children = nestedList.children.concat(selectedItems);
5752
+ selectedItems.forEach((item) => {
5753
+ var _a;
5754
+ item.parent = nestedList;
5755
+ if ((_a = item.nestList) === null || _a === void 0 ? void 0 : _a.length) {
5756
+ this.unifyDescendantNestLists(item, item.nestList[0].type);
5757
+ }
5758
+ item.children.forEach((node) => node.apply(new SyncUpSelectionAction()));
5759
+ });
5760
+ }
5761
+ /**
5762
+ * Recursively unify all nestLists of a list item (and its descendants) to the given type.
5763
+ * Adjacent same-type merge is handled automatically by ListItemReplaceNestListStrategy
5764
+ * when ReplaceNestListAction is applied, so this method only needs to set the type.
5765
+ *
5766
+ * @param {RTEListItemBlock} item - The list item whose descendants should be normalized.
5767
+ * @param {RTEListBlock['type']} targetType - The target list type used for normalization.
5768
+ */
5769
+ unifyDescendantNestLists(item, targetType) {
5770
+ var _a;
5771
+ if (!((_a = item.nestList) === null || _a === void 0 ? void 0 : _a.length)) {
5772
+ return;
5773
+ }
5774
+ let typeChanged = false;
5775
+ for (const list of item.nestList) {
5776
+ if (list.type !== targetType) {
5777
+ list.type = targetType;
5778
+ typeChanged = true;
5779
+ }
5780
+ // Recursively unify children
5781
+ for (const child of list.children) {
5782
+ this.unifyDescendantNestLists(child, targetType);
5783
+ }
5784
+ }
5785
+ // If any type was changed, re-apply through ReplaceNestListAction so that the
5786
+ // centralized normalize in ListItemReplaceNestListStrategy merges adjacent same-type entries.
5787
+ if (typeChanged) {
5788
+ item.apply(new ReplaceNestListAction([...item.nestList]));
5789
+ }
5790
+ }
5791
+ }
5792
+
5793
+ /**
5794
+ * Delete the nest list block action
5795
+ *
5796
+ * @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
5797
+ */
5798
+ class RemoveNestListAction extends ModifyContentAction {
5799
+ constructor(childList) {
5800
+ super();
5801
+ this.type = ModifyContentActionType.DELETE_NEST_LIST;
5802
+ this.nestListBlockToBeRemoved = childList;
5803
+ }
5804
+ }
5805
+
5806
+ /**
5807
+ * Promote selected nested list items one level up.
5808
+ */
5809
+ class ListUnnestItemsStrategy extends AbstractListItemsStrategy {
5810
+ /**
5811
+ * @inheritDoc
5812
+ */
5813
+ handleAction(action, target) {
5814
+ var _a;
5815
+ const selectedItems = this.getOrderedContiguousItems(target, action.selectedBlocks);
5816
+ const parentListParent = target.parent;
5817
+ if (!selectedItems.length || !(parentListParent instanceof RTEListItemBlock)) {
5818
+ return;
5819
+ }
5820
+ const selectedStartIndex = target.children.indexOf(selectedItems[0]);
5821
+ const selectedEndIndex = target.children.indexOf(selectedItems[selectedItems.length - 1]);
5822
+ if (selectedStartIndex < 0 || selectedEndIndex < selectedStartIndex) {
5823
+ return;
5824
+ }
5825
+ const parentListItem = parentListParent;
5826
+ const grandParentList = parentListItem.parent;
5827
+ const insertAfterIndex = grandParentList.children.indexOf(parentListItem);
5828
+ if (insertAfterIndex < 0) {
5829
+ return;
5830
+ }
5831
+ const trailingSiblingItems = target.children.slice(selectedEndIndex + 1);
5832
+ const selectedItemSet = new Set(selectedItems);
5833
+ target.children = target.children.filter((item) => !selectedItemSet.has(item));
5834
+ grandParentList.children = [
5835
+ ...grandParentList.children.slice(0, insertAfterIndex + 1),
5836
+ ...selectedItems,
5837
+ ...grandParentList.children.slice(insertAfterIndex + 1),
5838
+ ];
5839
+ selectedItems.forEach((item) => {
5840
+ item.parent = grandParentList;
5841
+ item.children.forEach((node) => node.apply(new SyncUpSelectionAction()));
5842
+ });
5843
+ if (trailingSiblingItems.length > 0) {
5844
+ const trailingSiblingSet = new Set(trailingSiblingItems);
5845
+ target.children = target.children.filter((item) => !trailingSiblingSet.has(item));
5846
+ const newParentItem = selectedItems[selectedItems.length - 1];
5847
+ let nestedList = (_a = newParentItem.nestList) === null || _a === void 0 ? void 0 : _a[newParentItem.nestList.length - 1];
5848
+ // Shift+Tab follows same-type guard: when the last nested list has a
5849
+ // different type, create a new child list of target.type instead of merging.
5850
+ if (nestedList && nestedList.type !== target.type) {
5851
+ nestedList = null;
5852
+ }
5853
+ if (!nestedList) {
5854
+ nestedList = new RTEListBlock(generateUUID(), target.type);
5855
+ const existingNestLists = Array.isArray(newParentItem.nestList)
5856
+ ? newParentItem.nestList
5857
+ : [];
5858
+ newParentItem.apply(new ReplaceNestListAction([...existingNestLists, nestedList]));
5859
+ }
5860
+ nestedList.children = nestedList.children.concat(trailingSiblingItems);
5861
+ trailingSiblingItems.forEach((item) => {
5862
+ item.parent = nestedList;
5863
+ });
5864
+ }
5865
+ // Lists after target are visually after every target item. Once selected items
5866
+ // move above their former parent, transfer those later branches to the last
5867
+ // selected item even when target still contains leading items; otherwise the
5868
+ // branches render before the promoted selection and document order changes.
5869
+ const trailingNestLists = this.collectTrailingNestLists(parentListItem, target);
5870
+ if (trailingNestLists.length > 0) {
5871
+ const lastSelected = selectedItems[selectedItems.length - 1];
5872
+ const existingNest = Array.isArray(lastSelected.nestList)
5873
+ ? lastSelected.nestList
5874
+ : [];
5875
+ lastSelected.apply(new ReplaceNestListAction([...existingNest, ...trailingNestLists]));
5876
+ }
5877
+ if (target.children.length === 0) {
5878
+ parentListItem.apply(new RemoveNestListAction(target));
5879
+ }
5880
+ }
5881
+ /**
5882
+ * Collect and remove nestList entries that appear after the given target list
5883
+ * in the parent item's nestList array. These trailing entries need to be
5884
+ * transferred to the unnested item to preserve visual document order.
5885
+ *
5886
+ * @param {RTEListItemBlock} parentListItem - The list item owning the nestList.
5887
+ * @param {RTEListBlock} target - The list being removed (used as the reference point).
5888
+ * @returns {RTEListBlock[]} The trailing nestList entries (already removed from parentListItem).
5889
+ */
5890
+ collectTrailingNestLists(parentListItem, target) {
5891
+ var _a;
5892
+ const nestLists = (_a = parentListItem.nestList) !== null && _a !== void 0 ? _a : [];
5893
+ const targetIndex = nestLists.indexOf(target);
5894
+ if (targetIndex < 0 || targetIndex >= nestLists.length - 1) {
5895
+ return [];
5896
+ }
5897
+ const trailing = nestLists.slice(targetIndex + 1);
5898
+ // Keep only entries up to and including target (target will be removed separately).
5899
+ parentListItem.apply(new ReplaceNestListAction(nestLists.slice(0, targetIndex + 1)));
5900
+ return trailing;
5901
+ }
5902
+ }
5903
+
5904
+ /**
5905
+ * List annotation
5906
+ */
5907
+ class ListAnnotation extends BlockAnnotation {
5908
+ constructor() {
5909
+ super(...arguments);
5910
+ this.type = BlockAnnotationTypeEnum.LIST;
5911
+ }
5912
+ /**
5913
+ * Get the default standalone styles for a list block.
5914
+ *
5915
+ * @returns {AnnotationStyle} The default styles.
5916
+ */
5917
+ static getDefaultStyles() {
5918
+ return {
5919
+ paddingLeft: '8px',
5920
+ marginLeft: '16px',
5921
+ };
5922
+ }
5923
+ /**
5924
+ * Get the default standalone styles for a list block's item marker
5925
+ * (`li::marker`). Capping the marker font-size keeps bullets/numbers
5926
+ * at a normal size when list items are styled as title/subtitle.
5927
+ *
5928
+ * @returns {AnnotationStyle} The default marker styles.
5929
+ */
5930
+ static getDefaultMarkerStyles() {
5931
+ return {
5932
+ fontSize: '16px',
5933
+ };
5934
+ }
5935
+ /**
5936
+ * @inheritDoc
5937
+ */
5938
+ renderStyle(options) {
5939
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
5940
+ return null;
5941
+ return ListAnnotation.getDefaultStyles();
5942
+ }
5943
+ /**
5944
+ * @inheritDoc
5945
+ */
5946
+ renderClass(options) {
5947
+ if (options === null || options === void 0 ? void 0 : options.standalone)
5948
+ return null;
5949
+ return 'v-rte--list';
5950
+ }
5951
+ /**
5952
+ * @inheritDoc
5953
+ */
5954
+ clone() {
5955
+ return new ListAnnotation();
5956
+ }
5957
+ /**
5958
+ * @inheritDoc
5959
+ */
5960
+ toJSON() {
5961
+ return undefined;
5962
+ }
5963
+ }
5964
+
5965
+ /**
5966
+ * List block.
5967
+ *
5968
+ * Bidirectional nesting contract:
5969
+ * - Every child list item must have item.parent === this list block.
5970
+ * - If this list block is nested, its parent must be a list item and that
5971
+ * list item keeps this block in listItem.nestList.
5972
+ */
5973
+ class RTEListBlock extends RTEBlock {
5974
+ constructor(id, type, options) {
5975
+ super(id);
5976
+ this.dtoName = RTEListBlock.dtoName;
5977
+ this.type = 'bullet-list';
5978
+ this.children = [];
5979
+ this.type = type;
5980
+ const { autoMatchFormat } = options || { autoMatchFormat: true };
5981
+ if (autoMatchFormat) {
5982
+ this.annotationMap.set(BlockAnnotationTypeEnum.LIST, new ListAnnotation());
5983
+ }
5984
+ }
5985
+ /**
5986
+ * Converts a VegaRTEListBlock object to an RTEListBlock
5987
+ *
5988
+ * @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
5989
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
5990
+ * @returns {RTEListBlock} Return an instance of `RTEListBlock`
5991
+ */
5992
+ static from(block, options = { autoMatchFormat: true }) {
5993
+ const listBlock = new RTEListBlock(block.id, block.type, options);
5994
+ const { annotations } = block;
5995
+ if (annotations) {
5996
+ Object.entries(annotations).forEach(([type, value]) => {
5997
+ const item = this.createAnnotationEntity(type, value);
5998
+ if (isNonNullable(item)) {
5999
+ listBlock.annotationMap.set(...item);
6000
+ }
6001
+ });
6002
+ }
6003
+ listBlock.children = block.blocks.map((item) => {
6004
+ const listItemBlock = RTEListItemBlock.from(item, options);
6005
+ listItemBlock.parent = listBlock;
6006
+ return listItemBlock;
6007
+ });
6008
+ return listBlock;
6009
+ }
6010
+ /**
6011
+ * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
6012
+ * and value.
6013
+ *
6014
+ * @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
6015
+ * the type of annotation entity to create.
6016
+ * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
6017
+ * that will be used to create the annotation entity. It can be of any type depending on the specific
6018
+ * annotation being created.
6019
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
6020
+ * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
6021
+ */
6022
+ static createAnnotationEntity(type, value) {
6023
+ switch (type) {
6024
+ case 'customAttribute':
6025
+ return CustomAttributeAnnotation.from(value);
6026
+ case 'customClass':
6027
+ return CustomClassAnnotation.from(value);
6028
+ case 'customStyle':
6029
+ return CustomStyleAnnotation.from(value);
6030
+ }
6031
+ }
6032
+ /**
6033
+ * @inheritDoc
6034
+ */
6035
+ toJSON() {
6036
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.children.map((block) => block.toJSON()) });
6037
+ }
6038
+ /**
6039
+ * @inheritDoc
6040
+ */
6041
+ toHtml(options) {
6042
+ const BlockTag = this.getBlockTag();
6043
+ const attrStr = super.generateAttributeString(options);
6044
+ return [
6045
+ `<${BlockTag}${attrStr}>`,
6046
+ this.children.map((block) => block.toHtml(options)).join(''),
6047
+ `</${BlockTag}>`,
6048
+ ].join('');
6049
+ }
6050
+ /**
6051
+ * @inheritDoc
6052
+ */
6053
+ isNotEmpty() {
6054
+ return this.children.length > 0;
6055
+ }
6056
+ /**
6057
+ * @inheritDoc
6058
+ */
6059
+ getLastNode() {
6060
+ return this.children[this.children.length - 1].getLastNode();
6061
+ }
6062
+ /**
6063
+ * @inheritDoc
6064
+ */
6065
+ clone(parent) {
6066
+ const clonedListBlock = new RTEListBlock(this.id, this.type);
6067
+ clonedListBlock.children = this.children.map((item) => item.clone(clonedListBlock));
6068
+ clonedListBlock.annotationMap = super.cloneAnnotations();
6069
+ clonedListBlock.parent = parent;
6070
+ return clonedListBlock;
6071
+ }
6072
+ /**
6073
+ * Returns the block tag based on the type of the list block.
6074
+ *
6075
+ * @returns {RTEListBlockTagType} - The block tag for the list block, either 'ol' or 'ul'.
6076
+ */
6077
+ getBlockTag() {
6078
+ return this.type === 'number-list' ? 'ol' : 'ul';
6079
+ }
6080
+ }
6081
+ (() => {
6082
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
6083
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
6084
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
6085
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.NEST_LIST_ITEMS, RTEListBlock.name, new ListNestItemsStrategy());
6086
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.UNNEST_LIST_ITEMS, RTEListBlock.name, new ListUnnestItemsStrategy());
6087
+ })();
6088
+ RTEListBlock.dtoName = 'RTEListBlock';
6089
+
6090
+ /**
6091
+ * The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
6092
+ */
6093
+ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
6094
+ /**
6095
+ * Returns the previous node relative to the current node in a rich text editor structure.
6096
+ *
6097
+ * @param {RTENode} currentNode - An object of type `RTENode`.
6098
+ * @returns {Nullable<RTENode>} the previous block last node
6099
+ */
6100
+ getPreviousNode(currentNode) {
6101
+ var _a;
6102
+ const currentBlock = currentNode.parent;
6103
+ const currentIndex = currentBlock.children.indexOf(currentNode);
6104
+ if (currentIndex > 0) {
6105
+ return currentBlock.children[currentIndex - 1];
6106
+ }
6107
+ else if (currentBlock.parent) {
6108
+ // Special case: cursor is at the start of the first item in a nested list.
6109
+ // Return the last direct text node of the grandparent list item so that
6110
+ // Backspace correctly merges the nested item into the parent item rather
6111
+ // than descending into the nested list's own descendants.
6112
+ if (currentBlock.isListItemBlock() &&
6113
+ currentBlock.parent.children.indexOf(currentBlock) === 0 &&
6114
+ currentBlock.parent.parent instanceof RTEListItemBlock) {
6115
+ const grandParentItem = currentBlock.parent.parent;
6116
+ const nestedListIndex = ((_a = grandParentItem.nestList) !== null && _a !== void 0 ? _a : []).indexOf(currentBlock.parent);
6117
+ if (nestedListIndex !== 0) {
6118
+ const previousBlock = this.getPreviousBlock(currentBlock);
6119
+ return previousBlock ? this.getBlockLastNode(previousBlock) : null;
6120
+ }
6121
+ const textNodes = grandParentItem.children;
6122
+ return textNodes.length > 0 ? textNodes[textNodes.length - 1] : null;
6123
+ }
6124
+ const previousBlock = this.getPreviousBlock(currentBlock);
6125
+ if (previousBlock) {
6126
+ return this.getBlockLastNode(previousBlock);
6127
+ }
6128
+ }
6129
+ }
6130
+ /**
6131
+ * Returns the next node relative to the current node in a rich text editor structure.
6132
+ *
6133
+ * @param {RTENode} currentNode - An object of type `RTENode`.
6134
+ * @returns {Nullable<RTENode>} the next block first node
6135
+ */
6136
+ getNextNode(currentNode) {
6137
+ const currentBlock = currentNode.parent;
6138
+ const currentIndex = currentBlock.children.indexOf(currentNode);
6139
+ if (currentBlock.children[currentIndex + 1]) {
6140
+ return currentBlock.children[currentIndex + 1];
6141
+ }
6142
+ else if (currentBlock.parent) {
6143
+ const nextBlock = this.getNextBlock(currentBlock);
6144
+ if (nextBlock) {
6145
+ return this.getBlockFirstNode(nextBlock);
6146
+ }
6147
+ }
6148
+ }
6149
+ /**
6150
+ * Determines if a given node is the first node within the current state.
6151
+ *
6152
+ * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
6153
+ * @returns {boolean} True or false;
6154
+ */
6155
+ isContentFirstNode(currentNode) {
6156
+ const currentBlock = currentNode.parent;
6157
+ const currentIndex = currentBlock.children.indexOf(currentNode);
6158
+ const parent = currentBlock.parent;
6159
+ if (currentBlock.isListItemBlock()) {
6160
+ const listParent = parent.parent;
6161
+ return (currentIndex === 0 &&
6162
+ Array.isArray(parent.children) &&
6163
+ parent.children[0] === currentBlock &&
6164
+ listParent['type'] !== 'list-item' &&
6165
+ Array.isArray(listParent.children) &&
6166
+ listParent.children[0] === parent);
6167
+ }
6168
+ else {
6169
+ return (currentIndex === 0 && Array.isArray(parent.children) && parent.children[0] === currentBlock);
6170
+ }
6171
+ }
6172
+ /**
6173
+ * TODO: The getPreviousBlock add nest list support
6174
+ * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
6175
+ *
6176
+ * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
6177
+ * @returns {Nullable<RTEBlock>} The previous block if existing
6178
+ */
6179
+ getPreviousBlock(currentBlock) {
6180
+ var _a;
6181
+ if (currentBlock.parent instanceof RTEListItemBlock) {
6182
+ const nestedLists = (_a = currentBlock.parent.nestList) !== null && _a !== void 0 ? _a : [];
6183
+ const nestedListIndex = nestedLists.indexOf(currentBlock);
6184
+ if (nestedListIndex > 0) {
6185
+ return nestedLists[nestedListIndex - 1];
6186
+ }
6187
+ if (nestedListIndex === 0) {
6188
+ return currentBlock.parent;
6189
+ }
6190
+ }
4747
6191
  if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
4748
6192
  const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
4749
6193
  if (currentBlockIndex > 0) {
@@ -5315,4 +6759,4 @@ class RTECodeBlock extends RTEBlock {
5315
6759
  RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element';
5316
6760
  RTECodeBlock.dtoName = 'RTECodeBlock';
5317
6761
 
5318
- export { RTE_DEFAULT_TEXT_COLOR as $, ActionHandleStrategyRegistry as A, BlockAnnotation as B, CommonAnnotationTypeEnum as C, BlockMergeNodesStrategy as D, SyncUpSelectionAction as E, BlockAnnotationTypeEnum as F, CustomClassAnnotation as G, HorizontalAlignmentAnnotationAction as H, InsertChildrenAfterAction as I, NodeAnnotation as J, NodeTypeEnum as K, CommonAnnotation as L, ModifyContentAction as M, NodeAnnotationTypeEnum as N, ReplaceChildNodesAction as O, HTML_VOID_TAGS as P, BlockDeleteNodeContentStrategy as Q, RTETextNode as R, SplitBlockWithNodeAction as S, TextStyleAnnotationAction as T, UpdateTextAction as U, VegaRTEPresetToolbarItems as V, RemoveChildrenStrategy as W, BOLD_FONT_WEIGHT_KEYWORD as X, BOLD_FONT_WEIGHT as Y, createStyleMapFromElement as Z, RTE_TEXT_COLORS as _, RTEBlock as a, ITALIC_FONT_STYLE as a0, STRIKETHROUGH_TEXT_DECORATION as a1, UNDERLINE_TEXT_DECORATION as a2, TextStyleAnnotation as a3, Predicate as a4, HorizontalAlignmentAnnotation as a5, CodeAnnotation as a6, LinkFilterStylesStrategy as a7, CodeBlockFilterStylesStrategy as a8, CodeBlockNodeFilterStylesStrategy as a9, ActionHandlerInterceptorRegistry as aa, CodeLanguage as ab, VegaRTEDefaultTextStyleItems as ac, ZERO_WIDTH_SPACE as ad, LinkAnnotationAction as ae, UpdateCodeBlockAction as af, SelectionChangeAction as ag, TextColorAnnotationAction as ah, VegaRTEOneRowHeightPx as ai, BoldAnnotationAction as aj, ItalicAnnotationAction as ak, UnderlineAnnotationAction as al, BoldAnnotation as am, ClearFormattingAnnotationAction as an, CodeAnnotationAction as ao, StrikethroughAnnotationAction as ap, IndentAnnotationAction as aq, escapeHtml as ar, RTETextBlock as b, RTEAnnotationStyle as c, ActionHandleStrategy as d, AppendChildrenAction as e, RTENode as f, InsertChildrenBeforeAction as g, InternalAnnotationTypeEnum as h, ModifyContentActionType as i, AnnotationAction as j, RemoveChildrenAction as k, CustomAttributeAnnotation as l, RTEDTOClassManager$1 as m, RTEFilterStylesStrategy as n, RTEDecoratorNode as o, RTECodeBlock as p, RTECodeBlockNode as q, CustomStyleAnnotation as r, stateEntityRenderingRegistry as s, RTEFilterStylesStrategyRegistry as t, BlockUpdateTextStyleStrategy as u, BlockUpdateHorizontalAlignmentStrategy as v, BlockInsertLineBreakStrategy as w, BlockInsertLineBreakWithBlocksStrategy as x, BlockSplitWithTextNodeStrategy as y, BlockReplaceNodesStrategy as z };
6762
+ export { RTEHtmlBlock as $, ActionHandleStrategyRegistry as A, BlockAnnotation as B, CommonAnnotationTypeEnum as C, BlockReplaceNodesStrategy as D, BlockUpdateHorizontalAlignmentStrategy as E, BlockDeleteNodeContentStrategy as F, RemoveChildrenStrategy as G, HorizontalAlignmentAnnotationAction as H, InsertChildrenAfterAction as I, RemoveNestListAction as J, ReplaceNestListAction as K, RTEListBlock as L, ModifyContentAction as M, NodeAnnotationTypeEnum as N, BOLD_FONT_WEIGHT_KEYWORD as O, BOLD_FONT_WEIGHT as P, createStyleMapFromElement as Q, RTETextNode as R, SplitBlockWithNodeAction as S, RTE_TEXT_COLORS as T, UpdateTextAction as U, VegaRTEPresetToolbarItems as V, RTE_DEFAULT_TEXT_COLOR as W, ITALIC_FONT_STYLE as X, STRIKETHROUGH_TEXT_DECORATION as Y, UNDERLINE_TEXT_DECORATION as Z, TextStyleAnnotation as _, RTEBlock as a, Predicate as a0, ListAnnotation as a1, HorizontalAlignmentAnnotation as a2, CodeAnnotation as a3, LinkFilterStylesStrategy as a4, CodeBlockFilterStylesStrategy as a5, CodeBlockNodeFilterStylesStrategy as a6, SyncUpSelectionAction as a7, ActionHandlerInterceptorRegistry as a8, CodeLanguage as a9, CustomClassAnnotation as aa, VegaRTEDefaultTextStyleItems as ab, ZERO_WIDTH_SPACE as ac, LinkAnnotationAction as ad, UpdateCodeBlockAction as ae, SelectionChangeAction as af, TextColorAnnotationAction as ag, VegaRTEOneRowHeightPx as ah, BoldAnnotationAction as ai, ItalicAnnotationAction as aj, UnderlineAnnotationAction as ak, TextStyleAnnotationAction as al, BoldAnnotation as am, BlockAnnotationTypeEnum as an, ClearFormattingAnnotationAction as ao, CodeAnnotationAction as ap, StrikethroughAnnotationAction as aq, IndentAnnotationAction as ar, TransformParagraphAction as as, escapeHtml as at, RTETextBlock as b, RTEAnnotationStyle as c, ActionHandleStrategy as d, AppendChildrenAction as e, RTENode as f, InsertChildrenBeforeAction as g, InternalAnnotationTypeEnum as h, ModifyContentActionType as i, AnnotationAction as j, RemoveChildrenAction as k, CustomAttributeAnnotation as l, RTEDTOClassManager$1 as m, RTEFilterStylesStrategy as n, RTEDecoratorNode as o, RTECodeBlock as p, RTEListItemBlock as q, RTECodeBlockNode as r, stateEntityRenderingRegistry as s, CustomStyleAnnotation as t, RTEFilterStylesStrategyRegistry as u, NodeAnnotation as v, NodeTypeEnum as w, CommonAnnotation as x, ReplaceChildNodesAction as y, BlockMergeNodesStrategy as z };