@heartlandone/vega 2.49.1 → 2.50.0-RTE-preview

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 (646) hide show
  1. package/dist/cjs/{app-globals-65622aeb.js → app-globals-8e811cac.js} +6 -6
  2. package/dist/cjs/{child-nodes-event-prevent-slimmer-cc193ee1.js → child-nodes-event-prevent-slimmer-26ecfb15.js} +1 -1
  3. package/dist/cjs/{content-state-6a48bcb5.js → code-block-4cd8bccd.js} +1166 -1131
  4. package/dist/cjs/content-state-6cb98931.js +2496 -0
  5. package/dist/cjs/{design-token-cba4222e.js → design-token-8b48cb59.js} +1 -1
  6. package/dist/cjs/{element-appender-slimmer-4a26ecb2.js → element-appender-slimmer-d6b975e6.js} +3 -3
  7. package/dist/cjs/{event-emit-slimmer-8247249c.js → event-emit-slimmer-ee7a8c06.js} +1 -1
  8. package/dist/cjs/{form-field-controller-slimmer-4b0af5bc.js → form-field-controller-slimmer-88cbb139.js} +4 -4
  9. package/dist/cjs/{image-annotation-action-9c2b9c8e.js → image-annotation-action-f36b1a72.js} +65 -35
  10. package/dist/cjs/{index-c4dec3aa.js → index-4dd54e6b.js} +1 -1
  11. package/dist/cjs/{index-09acd3c9.js → index-7700600c.js} +9 -0
  12. package/dist/cjs/index.cjs.js +17 -16
  13. package/dist/cjs/{internal-vega-event-manager-c9948b59.js → internal-vega-event-manager-58afcde7.js} +1 -0
  14. package/dist/cjs/loader.cjs.js +11 -9
  15. package/dist/cjs/{public-rules-10ec636d.js → public-rules-555271e0.js} +8 -6
  16. package/dist/cjs/{responsive-format-facade-263d49f6.js → responsive-format-facade-8ce41c8a.js} +3 -3
  17. package/dist/cjs/{rich-text-editor-required-rule-5faded94.js → rich-text-editor-required-rule-d1b38bf7.js} +1 -1
  18. package/dist/cjs/selection-controller-828990cc.js +765 -0
  19. package/dist/cjs/string-39438062.js +24 -0
  20. package/dist/cjs/{string-input-formatter-slimmer-50322824.js → string-input-formatter-slimmer-9e7d7ce2.js} +2 -2
  21. package/dist/cjs/{style-formatter-ae0ef7fc.js → style-formatter-2294d77f.js} +1 -1
  22. package/dist/cjs/{sub-state-notify-slimmer-7f437b19.js → sub-state-notify-slimmer-f3ee01b7.js} +1 -1
  23. package/dist/cjs/{sub-state-observer-slimmer-e90362cd.js → sub-state-observer-slimmer-e1a00b74.js} +1 -1
  24. package/dist/cjs/{translation-212b1875.js → translation-e5003a00.js} +5 -0
  25. package/dist/cjs/{translation-slimmer-d1512c6d.js → translation-slimmer-127a0f83.js} +1 -1
  26. package/dist/cjs/vega-accordion.cjs.entry.js +11 -9
  27. package/dist/cjs/vega-app-footer.cjs.entry.js +1 -1
  28. package/dist/cjs/vega-app-header-button.cjs.entry.js +12 -10
  29. package/dist/cjs/vega-backdrop.cjs.entry.js +1 -1
  30. package/dist/cjs/vega-banner.cjs.entry.js +3 -3
  31. package/dist/cjs/vega-bar-chart.cjs.entry.js +1 -1
  32. package/dist/cjs/vega-box.cjs.entry.js +11 -9
  33. package/dist/cjs/vega-brand-logo.cjs.entry.js +1 -1
  34. package/dist/cjs/vega-breadcrumb.cjs.entry.js +4 -4
  35. package/dist/cjs/vega-button-circle.cjs.entry.js +12 -10
  36. package/dist/cjs/vega-button-group_2.cjs.entry.js +7 -7
  37. package/dist/cjs/vega-button-link.cjs.entry.js +4 -4
  38. package/dist/cjs/vega-button.cjs.entry.js +11 -9
  39. package/dist/cjs/vega-calendar_3.cjs.entry.js +9 -9
  40. package/dist/cjs/vega-card.cjs.entry.js +10 -8
  41. package/dist/cjs/vega-carousel.cjs.entry.js +10 -8
  42. package/dist/cjs/vega-checkbox_2.cjs.entry.js +9 -9
  43. package/dist/cjs/vega-chip.cjs.entry.js +12 -10
  44. package/dist/cjs/vega-code-block.cjs.entry.js +4073 -0
  45. package/dist/cjs/vega-color-picker.cjs.entry.js +8 -8
  46. package/dist/cjs/vega-combo-box.cjs.entry.js +9 -9
  47. package/dist/cjs/vega-counter-badge.cjs.entry.js +1 -1
  48. package/dist/cjs/vega-date-picker_2.cjs.entry.js +17 -16
  49. package/dist/cjs/vega-dialog_2.cjs.entry.js +12 -10
  50. package/dist/cjs/vega-divider.cjs.entry.js +10 -8
  51. package/dist/cjs/vega-dropdown_5.cjs.entry.js +15 -13
  52. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  53. package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
  54. package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
  55. package/dist/cjs/vega-file-uploader.cjs.entry.js +9 -9
  56. package/dist/cjs/vega-flag-icon.cjs.entry.js +10 -8
  57. package/dist/cjs/vega-flex.cjs.entry.js +11 -9
  58. package/dist/cjs/vega-font.cjs.entry.js +10 -8
  59. package/dist/cjs/vega-form.cjs.entry.js +10 -10
  60. package/dist/cjs/vega-grid.cjs.entry.js +10 -8
  61. package/dist/cjs/vega-hint.cjs.entry.js +1 -1
  62. package/dist/cjs/vega-icon.cjs.entry.js +10 -8
  63. package/dist/cjs/vega-image-uploader.cjs.entry.js +14 -13
  64. package/dist/cjs/vega-input-credit-card.cjs.entry.js +9 -9
  65. package/dist/cjs/vega-input-numeric.cjs.entry.js +10 -10
  66. package/dist/cjs/vega-input-phone-number.cjs.entry.js +12 -11
  67. package/dist/cjs/vega-input-range.cjs.entry.js +10 -10
  68. package/dist/cjs/vega-input-select.cjs.entry.js +19 -18
  69. package/dist/cjs/vega-input.cjs.entry.js +10 -10
  70. package/dist/cjs/{vega-internal-event-id-bfea9b93.js → vega-internal-event-id-62371952.js} +2 -0
  71. package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
  72. package/dist/cjs/vega-left-nav_5.cjs.entry.js +13 -11
  73. package/dist/cjs/vega-line-chart.cjs.entry.js +1 -1
  74. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +9 -7
  75. package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
  76. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
  77. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +4 -4
  78. package/dist/cjs/vega-pagination.cjs.entry.js +12 -10
  79. package/dist/cjs/vega-pie-chart.cjs.entry.js +1 -1
  80. package/dist/cjs/vega-popover_2.cjs.entry.js +11 -9
  81. package/dist/cjs/vega-progress-tracker.cjs.entry.js +3 -3
  82. package/dist/cjs/vega-radio_2.cjs.entry.js +9 -9
  83. package/dist/cjs/vega-rich-text-content.cjs.entry.js +311 -137
  84. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +1225 -2502
  85. package/dist/cjs/vega-section-title.cjs.entry.js +1 -1
  86. package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
  87. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +14 -13
  88. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +10 -10
  89. package/dist/cjs/vega-sidenav_3.cjs.entry.js +12 -10
  90. package/dist/cjs/vega-signature-capture.cjs.entry.js +14 -13
  91. package/dist/cjs/{vega-skeleton-loader-controller-db868c98.js → vega-skeleton-loader-controller-83e05b6c.js} +1 -1
  92. package/dist/cjs/vega-skeleton.cjs.entry.js +1 -1
  93. package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
  94. package/dist/cjs/vega-stepper.cjs.entry.js +9 -9
  95. package/dist/cjs/vega-tab-group_2.cjs.entry.js +4 -4
  96. package/dist/cjs/vega-table_8.cjs.entry.js +14 -12
  97. package/dist/cjs/vega-text.cjs.entry.js +1 -1
  98. package/dist/cjs/vega-textarea.cjs.entry.js +9 -9
  99. package/dist/cjs/vega-time-picker_2.cjs.entry.js +15 -14
  100. package/dist/cjs/vega-toggle-switch.cjs.entry.js +8 -8
  101. package/dist/cjs/vega-tooltip_2.cjs.entry.js +10 -8
  102. package/dist/cjs/vega.cjs.js +11 -9
  103. package/dist/collection/collection-manifest.json +7 -1
  104. package/dist/collection/components/vega-code-block/assets/copy.js +3 -0
  105. package/dist/collection/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.js +62 -0
  106. package/dist/collection/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.js +48 -0
  107. package/dist/collection/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.js +99 -0
  108. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.js +50 -0
  109. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.js +57 -0
  110. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +255 -0
  111. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.js +266 -0
  112. package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.js +44 -0
  113. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.js +123 -0
  114. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +67 -0
  115. package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.js +122 -0
  116. package/dist/collection/components/vega-code-block/types.js +10 -0
  117. package/dist/collection/components/vega-code-block/vega-code-block.css +158 -0
  118. package/dist/collection/components/vega-code-block/vega-code-block.js +399 -0
  119. package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +5 -5
  120. package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +2 -0
  121. package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +60 -5
  122. package/dist/collection/components/vega-rich-text-editor/assets/file-code.js +3 -0
  123. package/dist/collection/components/vega-rich-text-editor/assets/rectangle-code.js +3 -0
  124. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +24 -0
  125. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.js +15 -0
  126. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.js +15 -0
  127. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +1 -0
  128. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.js +13 -0
  129. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +14 -0
  130. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +3 -1
  131. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +1 -1
  132. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +48 -0
  133. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +17 -0
  134. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +77 -0
  135. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +38 -0
  136. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.js +14 -0
  137. package/dist/collection/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.js +20 -0
  138. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +4 -0
  139. package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-code-block-action.js +13 -0
  140. package/dist/collection/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.js +15 -0
  141. package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.js +13 -0
  142. package/dist/collection/components/vega-rich-text-editor/dto/actions/update-code-block-action.js +15 -0
  143. package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +1 -0
  144. package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +13 -5
  145. package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +2 -0
  146. package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +14 -9
  147. package/dist/collection/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.js +12 -0
  148. package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.js +65 -0
  149. package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.js +54 -0
  150. package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.js +57 -0
  151. package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +26 -10
  152. package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +16 -7
  153. package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +8 -2
  154. package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +13 -5
  155. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +12 -9
  156. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +89 -0
  157. package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +41 -0
  158. package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +9 -9
  159. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +3 -7
  160. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +74 -12
  161. package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +9 -9
  162. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +69 -2
  163. package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +106 -0
  164. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +15 -1
  165. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +50 -0
  166. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +12 -1
  167. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +66 -2
  168. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +29 -0
  169. package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +56 -0
  170. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +26 -9
  171. package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +81 -0
  172. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +15 -2
  173. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.js +5 -22
  174. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +9 -93
  175. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +62 -0
  176. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +1 -1
  177. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +121 -0
  178. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +1 -1
  179. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +1 -1
  180. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +2 -23
  181. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.js +81 -0
  182. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +47 -7
  183. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.js +0 -27
  184. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +3 -2
  185. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +19 -4
  186. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +155 -15
  187. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +2 -1
  188. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +6 -1
  189. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.js +38 -0
  190. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +3 -20
  191. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +59 -5
  192. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.js +54 -0
  193. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +1 -1
  194. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +3 -2
  195. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +3 -20
  196. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-not-li-child-to-rte-list-item-block.js +7 -3
  197. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +3 -2
  198. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.js +69 -0
  199. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +4 -7
  200. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +7 -5
  201. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +7 -5
  202. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +25 -10
  203. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.js +64 -0
  204. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +59 -53
  205. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +21 -8
  206. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +10 -0
  207. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +5 -3
  208. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +5 -3
  209. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +5 -3
  210. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +5 -3
  211. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +5 -3
  212. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +65 -0
  213. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +5 -3
  214. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +2 -2
  215. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +8 -2
  216. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +2 -2
  217. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +2 -2
  218. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +2 -2
  219. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -2
  220. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +5 -3
  221. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +3 -3
  222. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +2 -2
  223. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +3 -3
  224. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +60 -0
  225. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +5 -3
  226. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +5 -3
  227. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +6 -4
  228. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +3 -2
  229. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +5 -3
  230. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +28 -0
  231. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +31 -3
  232. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +21 -0
  233. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +2 -0
  234. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +3 -0
  235. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +23 -1
  236. package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +247 -27
  237. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/code-block.test.js +54 -0
  238. package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +1793 -0
  239. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +12 -0
  240. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +41 -4
  241. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.js +32 -0
  242. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.js +61 -0
  243. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +7 -0
  244. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +18 -1
  245. package/dist/collection/helpers/code-format/code-formatter.js +108 -0
  246. package/dist/collection/helpers/code-format/test/code-formatter.test.js +362 -0
  247. package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +2 -1
  248. package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
  249. package/dist/collection/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.js +47 -0
  250. package/dist/collection/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.js +46 -0
  251. package/dist/collection/helpers/translation/locales/en.js +5 -0
  252. package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +5 -0
  253. package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +17 -15
  254. package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +1 -0
  255. package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
  256. package/dist/collection/utils/string.js +10 -0
  257. package/dist/esm/{app-globals-1f8c30e9.js → app-globals-9058ac3b.js} +6 -6
  258. package/dist/esm/{child-nodes-event-prevent-slimmer-5d45361e.js → child-nodes-event-prevent-slimmer-1142fb79.js} +1 -1
  259. package/dist/esm/{content-state-dbc9f635.js → code-block-8b5bd928.js} +1141 -1122
  260. package/dist/esm/content-state-8c3f862b.js +2489 -0
  261. package/dist/esm/{design-token-0699f0ca.js → design-token-bd436e0d.js} +1 -1
  262. package/dist/esm/{dom-node-subject-factory-f77cf9cc.js → dom-node-subject-factory-eb6bba5d.js} +1 -1
  263. package/dist/esm/{dom-node-subject-observer-factory-715dccf9.js → dom-node-subject-observer-factory-6083d518.js} +1 -1
  264. package/dist/esm/{element-appender-slimmer-96cb54e2.js → element-appender-slimmer-baf5e249.js} +5 -5
  265. package/dist/esm/{event-emit-slimmer-b7d511f6.js → event-emit-slimmer-480d3b54.js} +3 -3
  266. package/dist/esm/{form-field-controller-slimmer-89a72ee7.js → form-field-controller-slimmer-bfb4034d.js} +6 -6
  267. package/dist/esm/{image-annotation-action-1aa938ab.js → image-annotation-action-a8b860ad.js} +57 -28
  268. package/dist/esm/{index-187f71d1.js → index-d0a47531.js} +9 -0
  269. package/dist/esm/{index-4aa167d6.js → index-db0ec3ee.js} +2 -2
  270. package/dist/esm/index.js +12 -11
  271. package/dist/esm/{internal-vega-event-manager-87dc436c.js → internal-vega-event-manager-56c6469a.js} +2 -1
  272. package/dist/esm/loader.js +12 -10
  273. package/dist/esm/polyfills/core-js.js +0 -0
  274. package/dist/esm/polyfills/dom.js +0 -0
  275. package/dist/esm/polyfills/es5-html-element.js +0 -0
  276. package/dist/esm/polyfills/index.js +0 -0
  277. package/dist/esm/polyfills/system.js +0 -0
  278. package/dist/esm/{public-rules-5cf6aa95.js → public-rules-90fbd41a.js} +8 -6
  279. package/dist/esm/{responsive-format-facade-42f3fcfa.js → responsive-format-facade-827de03a.js} +3 -3
  280. package/dist/esm/{rich-text-editor-required-rule-6a7cd3ee.js → rich-text-editor-required-rule-0d470d82.js} +1 -1
  281. package/dist/esm/selection-controller-dd4f4407.js +759 -0
  282. package/dist/esm/string-a953eafc.js +21 -0
  283. package/dist/esm/{string-input-formatter-slimmer-c61f82d6.js → string-input-formatter-slimmer-0d30b976.js} +3 -3
  284. package/dist/esm/{style-formatter-cb00c709.js → style-formatter-232842f5.js} +1 -1
  285. package/dist/esm/{sub-state-notify-slimmer-4e3cf09d.js → sub-state-notify-slimmer-04e06501.js} +2 -2
  286. package/dist/esm/{sub-state-observer-slimmer-be7a6ce3.js → sub-state-observer-slimmer-b4c2ddc3.js} +2 -2
  287. package/dist/esm/{translation-cf7f020a.js → translation-71e0711d.js} +5 -0
  288. package/dist/esm/{translation-slimmer-88966d5c.js → translation-slimmer-e6b130bf.js} +1 -1
  289. package/dist/esm/vega-accordion.entry.js +13 -11
  290. package/dist/esm/vega-app-footer.entry.js +1 -1
  291. package/dist/esm/vega-app-header-button.entry.js +14 -12
  292. package/dist/esm/vega-backdrop.entry.js +1 -1
  293. package/dist/esm/vega-banner.entry.js +5 -5
  294. package/dist/esm/vega-bar-chart.entry.js +1 -1
  295. package/dist/esm/vega-box.entry.js +12 -10
  296. package/dist/esm/vega-brand-logo.entry.js +1 -1
  297. package/dist/esm/vega-breadcrumb.entry.js +6 -6
  298. package/dist/esm/vega-button-circle.entry.js +14 -12
  299. package/dist/esm/vega-button-group_2.entry.js +9 -9
  300. package/dist/esm/vega-button-link.entry.js +6 -6
  301. package/dist/esm/vega-button.entry.js +13 -11
  302. package/dist/esm/vega-calendar_3.entry.js +11 -11
  303. package/dist/esm/vega-card.entry.js +11 -9
  304. package/dist/esm/vega-carousel.entry.js +12 -10
  305. package/dist/esm/vega-checkbox_2.entry.js +11 -11
  306. package/dist/esm/vega-chip.entry.js +14 -12
  307. package/dist/esm/vega-code-block.entry.js +4069 -0
  308. package/dist/esm/vega-color-picker.entry.js +10 -10
  309. package/dist/esm/vega-combo-box.entry.js +11 -11
  310. package/dist/esm/vega-counter-badge.entry.js +1 -1
  311. package/dist/esm/vega-date-picker_2.entry.js +19 -18
  312. package/dist/esm/vega-dialog_2.entry.js +14 -12
  313. package/dist/esm/vega-divider.entry.js +11 -9
  314. package/dist/esm/vega-dropdown_5.entry.js +17 -15
  315. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  316. package/dist/esm/vega-field-error.entry.js +1 -1
  317. package/dist/esm/vega-field-label.entry.js +5 -5
  318. package/dist/esm/vega-file-uploader.entry.js +11 -11
  319. package/dist/esm/vega-flag-icon.entry.js +11 -9
  320. package/dist/esm/vega-flex.entry.js +12 -10
  321. package/dist/esm/vega-font.entry.js +11 -9
  322. package/dist/esm/vega-form.entry.js +12 -12
  323. package/dist/esm/vega-grid.entry.js +11 -9
  324. package/dist/esm/vega-hint.entry.js +1 -1
  325. package/dist/esm/vega-icon.entry.js +11 -9
  326. package/dist/esm/vega-image-uploader.entry.js +16 -15
  327. package/dist/esm/vega-input-credit-card.entry.js +11 -11
  328. package/dist/esm/vega-input-numeric.entry.js +12 -12
  329. package/dist/esm/vega-input-phone-number.entry.js +14 -13
  330. package/dist/esm/vega-input-range.entry.js +12 -12
  331. package/dist/esm/vega-input-select.entry.js +21 -20
  332. package/dist/esm/vega-input.entry.js +12 -12
  333. package/dist/esm/{vega-internal-event-id-85ad403f.js → vega-internal-event-id-820393ad.js} +2 -1
  334. package/dist/esm/vega-item-toggle.entry.js +5 -5
  335. package/dist/esm/vega-left-nav_5.entry.js +15 -13
  336. package/dist/esm/vega-line-chart.entry.js +1 -1
  337. package/dist/esm/vega-loader-wrapper_2.entry.js +10 -8
  338. package/dist/esm/vega-page-notification_2.entry.js +3 -3
  339. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +6 -6
  340. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +6 -6
  341. package/dist/esm/vega-pagination.entry.js +14 -12
  342. package/dist/esm/vega-pie-chart.entry.js +1 -1
  343. package/dist/esm/vega-popover_2.entry.js +13 -11
  344. package/dist/esm/vega-progress-tracker.entry.js +5 -5
  345. package/dist/esm/vega-radio_2.entry.js +11 -11
  346. package/dist/esm/vega-rich-text-content.entry.js +305 -131
  347. package/dist/esm/vega-rich-text-editor_4.entry.js +1132 -2409
  348. package/dist/esm/vega-section-title.entry.js +1 -1
  349. package/dist/esm/vega-segment-control.entry.js +5 -5
  350. package/dist/esm/vega-selection-chip_2.entry.js +16 -15
  351. package/dist/esm/vega-selection-tile_2.entry.js +12 -12
  352. package/dist/esm/vega-sidenav_3.entry.js +14 -12
  353. package/dist/esm/vega-signature-capture.entry.js +16 -15
  354. package/dist/esm/{vega-skeleton-loader-controller-c2a8bd27.js → vega-skeleton-loader-controller-878e1b28.js} +1 -1
  355. package/dist/esm/vega-skeleton.entry.js +1 -1
  356. package/dist/esm/vega-slot-container.entry.js +1 -1
  357. package/dist/esm/vega-stepper.entry.js +11 -11
  358. package/dist/esm/vega-tab-group_2.entry.js +6 -6
  359. package/dist/esm/vega-table_8.entry.js +16 -14
  360. package/dist/esm/vega-text.entry.js +1 -1
  361. package/dist/esm/vega-textarea.entry.js +11 -11
  362. package/dist/esm/vega-time-picker_2.entry.js +17 -16
  363. package/dist/esm/vega-toggle-switch.entry.js +10 -10
  364. package/dist/esm/vega-tooltip_2.entry.js +12 -10
  365. package/dist/esm/vega.js +12 -10
  366. package/dist/types/components/vega-code-block/assets/copy.d.ts +3 -0
  367. package/dist/types/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.d.ts +40 -0
  368. package/dist/types/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.d.ts +19 -0
  369. package/dist/types/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.d.ts +43 -0
  370. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.d.ts +23 -0
  371. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.d.ts +21 -0
  372. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.d.ts +100 -0
  373. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.d.ts +93 -0
  374. package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.d.ts +21 -0
  375. package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.d.ts +57 -0
  376. package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.d.ts +23 -0
  377. package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.d.ts +50 -0
  378. package/dist/types/components/vega-code-block/types.d.ts +19 -0
  379. package/dist/types/components/vega-code-block/vega-code-block.d.ts +116 -0
  380. package/dist/types/components/vega-rich-text-editor/assets/file-code.d.ts +3 -0
  381. package/dist/types/components/vega-rich-text-editor/assets/rectangle-code.d.ts +3 -0
  382. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +15 -0
  383. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.d.ts +15 -0
  384. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.d.ts +15 -0
  385. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.d.ts +12 -0
  386. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +3 -3
  387. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +4 -5
  388. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.d.ts +29 -0
  389. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.d.ts +15 -0
  390. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +28 -0
  391. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.d.ts +12 -0
  392. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.d.ts +12 -0
  393. package/dist/types/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.d.ts +17 -0
  394. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +5 -1
  395. package/dist/types/components/vega-rich-text-editor/dto/actions/remove-code-block-action.d.ts +10 -0
  396. package/dist/types/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.d.ts +14 -0
  397. package/dist/types/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.d.ts +14 -0
  398. package/dist/types/components/vega-rich-text-editor/dto/actions/update-code-block-action.d.ts +14 -0
  399. package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +2 -1
  400. package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +17 -4
  401. package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +7 -5
  402. package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +2 -1
  403. package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +5 -9
  404. package/dist/types/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.d.ts +20 -0
  405. package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.d.ts +43 -0
  406. package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.d.ts +40 -0
  407. package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.d.ts +42 -0
  408. package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +5 -9
  409. package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +7 -5
  410. package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +5 -1
  411. package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +7 -5
  412. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +6 -4
  413. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +48 -0
  414. package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +25 -0
  415. package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +15 -3
  416. package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +5 -9
  417. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +3 -7
  418. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +7 -5
  419. package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +5 -9
  420. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +39 -4
  421. package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +56 -0
  422. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +4 -0
  423. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +20 -2
  424. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +4 -0
  425. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +14 -4
  426. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +13 -0
  427. package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +45 -0
  428. package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +4 -0
  429. package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +46 -2
  430. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +7 -2
  431. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.d.ts +4 -11
  432. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +7 -5
  433. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +39 -0
  434. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.d.ts +24 -0
  435. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +0 -1
  436. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.d.ts +37 -0
  437. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.d.ts +22 -0
  438. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.d.ts +1 -15
  439. package/dist/types/components/vega-rich-text-editor/interface.d.ts +65 -26
  440. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +64 -6
  441. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +3 -1
  442. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.d.ts +20 -0
  443. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +2 -2
  444. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +30 -1
  445. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.d.ts +31 -0
  446. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +2 -3
  447. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +2 -2
  448. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +2 -3
  449. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.d.ts +42 -0
  450. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +2 -2
  451. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +7 -1
  452. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.d.ts +45 -0
  453. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +17 -23
  454. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +6 -4
  455. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +2 -0
  456. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +2 -2
  457. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +3 -2
  458. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +2 -2
  459. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +2 -2
  460. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +2 -2
  461. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +22 -0
  462. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +2 -2
  463. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +2 -2
  464. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +4 -2
  465. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +2 -2
  466. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +2 -2
  467. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +2 -2
  468. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +3 -2
  469. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +2 -2
  470. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +2 -2
  471. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +3 -2
  472. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +2 -2
  473. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +13 -0
  474. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +2 -2
  475. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +3 -2
  476. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +3 -2
  477. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +3 -2
  478. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +2 -2
  479. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +17 -0
  480. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +8 -2
  481. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.d.ts +1 -0
  482. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/code-block.test.d.ts +1 -0
  483. package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -1
  484. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.d.ts +1 -0
  485. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.d.ts +1 -0
  486. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +7 -0
  487. package/dist/types/components.d.ts +95 -0
  488. package/dist/types/helpers/code-format/code-formatter.d.ts +34 -0
  489. package/dist/types/helpers/code-format/test/code-formatter.test.d.ts +1 -0
  490. package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
  491. package/dist/types/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.d.ts +20 -0
  492. package/dist/types/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.d.ts +1 -0
  493. package/dist/types/helpers/translation/interface.d.ts +6 -1
  494. package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +26 -0
  495. package/dist/types/types/components.type.d.ts +1 -0
  496. package/dist/types/utils/string.d.ts +7 -0
  497. package/dist/vega/index.esm.js +1 -1
  498. package/dist/vega/p-0104207d.entry.js +1 -0
  499. package/dist/vega/p-010f1715.entry.js +1 -0
  500. package/dist/vega/p-01593f9d.js +1 -0
  501. package/dist/vega/p-020b04ed.js +1 -0
  502. package/dist/vega/p-02841589.js +1 -0
  503. package/dist/vega/p-03cfb331.entry.js +9 -0
  504. package/dist/vega/{p-b649e86e.entry.js → p-0bff8716.entry.js} +1 -1
  505. package/dist/vega/p-1056a049.entry.js +1 -0
  506. package/dist/vega/p-10e41bbe.js +1 -0
  507. package/dist/vega/{p-83ef9e7d.entry.js → p-12e6173c.entry.js} +1 -1
  508. package/dist/vega/{p-54add0d2.js → p-1397ba3f.js} +1 -1
  509. package/dist/vega/p-13d9a1fd.entry.js +1 -0
  510. package/dist/vega/p-13eae47f.entry.js +1 -0
  511. package/dist/vega/p-1630864e.entry.js +1 -0
  512. package/dist/vega/p-1b335e30.entry.js +1 -0
  513. package/dist/vega/{p-8ade44bf.js → p-1e194737.js} +1 -1
  514. package/dist/vega/{p-252e42c7.entry.js → p-1f346008.entry.js} +1 -1
  515. package/dist/vega/p-1f86ab76.entry.js +1 -0
  516. package/dist/vega/p-1fe746ab.entry.js +1 -0
  517. package/dist/vega/{p-8c388b58.entry.js → p-211c028f.entry.js} +1 -1
  518. package/dist/vega/p-21d26bb4.js +2 -0
  519. package/dist/vega/{p-b351ace3.entry.js → p-23e6f2b2.entry.js} +1 -1
  520. package/dist/vega/p-268aea63.js +1 -0
  521. package/dist/vega/{p-a01f149d.entry.js → p-27ccf34d.entry.js} +1 -1
  522. package/dist/vega/{p-913eb7f9.entry.js → p-29f9be26.entry.js} +1 -1
  523. package/dist/vega/{p-27003a81.entry.js → p-30dcf606.entry.js} +1 -1
  524. package/dist/vega/{p-89ab72e3.js → p-3c20ae84.js} +1 -1
  525. package/dist/vega/p-4172fb81.js +1 -0
  526. package/dist/vega/{p-45f696b4.js → p-419697c6.js} +1 -1
  527. package/dist/vega/p-427e4cee.entry.js +1 -0
  528. package/dist/vega/p-4604ed0e.entry.js +1 -0
  529. package/dist/vega/{p-8d283666.js → p-4ab3df00.js} +1 -1
  530. package/dist/vega/{p-72ecfd40.js → p-4e8fb53a.js} +1 -1
  531. package/dist/vega/p-50a3ae3d.js +1 -0
  532. package/dist/vega/{p-b847a143.entry.js → p-50b80d76.entry.js} +1 -1
  533. package/dist/vega/p-531ffb18.entry.js +1 -0
  534. package/dist/vega/p-53daeb45.entry.js +1 -0
  535. package/dist/vega/p-54fdd401.entry.js +1 -0
  536. package/dist/vega/{p-47ff95ba.entry.js → p-5741ecf0.entry.js} +1 -1
  537. package/dist/vega/{p-6cabdb36.js → p-58f8928a.js} +1 -1
  538. package/dist/vega/{p-4a32a6c0.entry.js → p-5c4cb804.entry.js} +1 -1
  539. package/dist/vega/{p-a46bc9f1.entry.js → p-5ce386c8.entry.js} +1 -1
  540. package/dist/vega/p-5f377954.js +1 -1
  541. package/dist/vega/{p-0079088b.entry.js → p-5fd5a538.entry.js} +1 -1
  542. package/dist/vega/{p-0969877b.entry.js → p-64f452fe.entry.js} +1 -1
  543. package/dist/vega/p-66759f4e.js +1 -0
  544. package/dist/vega/{p-bc2dd43d.js → p-6ea42854.js} +1 -1
  545. package/dist/vega/p-70f25341.entry.js +1 -0
  546. package/dist/vega/{p-ec1f2d21.entry.js → p-737bccb9.entry.js} +1 -1
  547. package/dist/vega/{p-bcb10ae3.entry.js → p-7503fe08.entry.js} +1 -1
  548. package/dist/vega/{p-46714da3.entry.js → p-7b0a4688.entry.js} +1 -1
  549. package/dist/vega/p-7def7b74.entry.js +1 -0
  550. package/dist/vega/{p-48517a5d.entry.js → p-7f5a85c6.entry.js} +1 -1
  551. package/dist/vega/p-825ae7c4.js +1 -0
  552. package/dist/vega/p-831c4144.entry.js +1 -0
  553. package/dist/vega/p-85dc08b4.entry.js +1 -0
  554. package/dist/vega/{p-a821bcf3.js → p-86782109.js} +1 -1
  555. package/dist/vega/p-87459914.js +1 -0
  556. package/dist/vega/{p-1971d980.entry.js → p-87a1fc77.entry.js} +1 -1
  557. package/dist/vega/p-89565247.entry.js +1 -0
  558. package/dist/vega/{p-7088ead9.entry.js → p-89e915e9.entry.js} +1 -1
  559. package/dist/vega/{p-81fbfb6d.entry.js → p-8aa7e56e.entry.js} +1 -1
  560. package/dist/vega/p-94263ece.entry.js +1 -0
  561. package/dist/vega/{p-d0007822.entry.js → p-9524e48a.entry.js} +1 -1
  562. package/dist/vega/{p-147e3cbd.entry.js → p-991b4717.entry.js} +1 -1
  563. package/dist/vega/{p-647025dd.entry.js → p-99b9b320.entry.js} +1 -1
  564. package/dist/vega/{p-aea89be5.entry.js → p-9ba14b7c.entry.js} +1 -1
  565. package/dist/vega/p-9cb79f8d.entry.js +1 -0
  566. package/dist/vega/p-9e3f52f0.entry.js +1 -0
  567. package/dist/vega/{p-6586e2a2.entry.js → p-a0e122a6.entry.js} +1 -1
  568. package/dist/vega/{p-9803042f.entry.js → p-b0fe6c0f.entry.js} +1 -1
  569. package/dist/vega/{p-b2bca332.entry.js → p-b518e1a0.entry.js} +1 -1
  570. package/dist/vega/p-b538e81a.entry.js +1 -0
  571. package/dist/vega/p-b824baf7.entry.js +1 -0
  572. package/dist/vega/{p-2fadef27.entry.js → p-b959b4d4.entry.js} +1 -1
  573. package/dist/vega/{p-54f17c2e.entry.js → p-bb4f0fa1.entry.js} +1 -1
  574. package/dist/vega/{p-2da83c2a.js → p-bbb39d6f.js} +1 -1
  575. package/dist/vega/{p-cfda64fd.entry.js → p-bc8fd0ee.entry.js} +1 -1
  576. package/dist/vega/p-bcaf8375.entry.js +1 -0
  577. package/dist/vega/{p-02d7d948.entry.js → p-bec90ff3.entry.js} +1 -1
  578. package/dist/vega/p-c6b94dde.entry.js +1 -0
  579. package/dist/vega/{p-c754b32c.js → p-ce6b62c4.js} +1 -1
  580. package/dist/vega/{p-5e34ea25.entry.js → p-d00fbc11.entry.js} +1 -1
  581. package/dist/vega/{p-10a40dfb.entry.js → p-d2a2af2c.entry.js} +1 -1
  582. package/dist/vega/p-d64b20c2.js +1 -0
  583. package/dist/vega/p-da779940.entry.js +1 -0
  584. package/dist/vega/{p-a7dcb2a3.js → p-db910162.js} +1 -1
  585. package/dist/vega/{p-6f81fe1e.js → p-e1a2a701.js} +1 -1
  586. package/dist/vega/p-e3694aa5.entry.js +1 -0
  587. package/dist/vega/p-e7318c4c.entry.js +1 -0
  588. package/dist/vega/{p-a5c39ba2.entry.js → p-e8fc027e.entry.js} +1 -1
  589. package/dist/vega/{p-6a830bc5.entry.js → p-e92ecb78.entry.js} +1 -1
  590. package/dist/vega/p-e969c3f4.entry.js +1 -0
  591. package/dist/vega/{p-61eb7f32.entry.js → p-ec8b7f01.entry.js} +1 -1
  592. package/dist/vega/p-eed9bda2.entry.js +1 -0
  593. package/dist/vega/p-f4c54c98.entry.js +1 -0
  594. package/dist/vega/{p-5160a6b9.entry.js → p-f5fc80bc.entry.js} +1 -1
  595. package/dist/vega/p-f67be7ef.js +1 -0
  596. package/dist/vega/{p-5e3a15a1.js → p-f9fafc55.js} +1 -1
  597. package/dist/vega/{p-27e56c67.entry.js → p-fc21fb2d.entry.js} +1 -1
  598. package/dist/vega/p-fed9220b.entry.js +1 -0
  599. package/dist/vega/vega.esm.js +1 -1
  600. package/package.json +2 -1
  601. package/dist/cjs/string-21427167.js +0 -13
  602. package/dist/esm/string-be824360.js +0 -11
  603. package/dist/vega/p-06adb37e.entry.js +0 -1
  604. package/dist/vega/p-06c5fe97.entry.js +0 -1
  605. package/dist/vega/p-0bb29d98.js +0 -1
  606. package/dist/vega/p-0ed7a098.entry.js +0 -1
  607. package/dist/vega/p-0f6b3a89.entry.js +0 -1
  608. package/dist/vega/p-136f665b.entry.js +0 -1
  609. package/dist/vega/p-1503f791.js +0 -1
  610. package/dist/vega/p-16fd7c32.js +0 -1
  611. package/dist/vega/p-1a263af1.entry.js +0 -1
  612. package/dist/vega/p-1af4771a.entry.js +0 -1
  613. package/dist/vega/p-1c298d5a.js +0 -2
  614. package/dist/vega/p-1c63afd2.entry.js +0 -1
  615. package/dist/vega/p-1e05b7b4.entry.js +0 -1
  616. package/dist/vega/p-1ea863a6.entry.js +0 -1
  617. package/dist/vega/p-271b30b9.entry.js +0 -1
  618. package/dist/vega/p-2d1d4f33.entry.js +0 -1
  619. package/dist/vega/p-353b3ded.entry.js +0 -1
  620. package/dist/vega/p-44b0a005.js +0 -1
  621. package/dist/vega/p-4e76904e.entry.js +0 -1
  622. package/dist/vega/p-4ec0d36f.entry.js +0 -1
  623. package/dist/vega/p-5c954088.entry.js +0 -1
  624. package/dist/vega/p-646a9198.entry.js +0 -1
  625. package/dist/vega/p-6d7d923b.js +0 -1
  626. package/dist/vega/p-6e898779.js +0 -1
  627. package/dist/vega/p-77492977.entry.js +0 -1
  628. package/dist/vega/p-804f71b3.js +0 -1
  629. package/dist/vega/p-8789d34d.entry.js +0 -1
  630. package/dist/vega/p-8813c0ac.entry.js +0 -1
  631. package/dist/vega/p-8a85c7af.entry.js +0 -1
  632. package/dist/vega/p-8ba43640.entry.js +0 -1
  633. package/dist/vega/p-98c64d77.entry.js +0 -1
  634. package/dist/vega/p-9f3539a4.entry.js +0 -1
  635. package/dist/vega/p-b42aea55.entry.js +0 -1
  636. package/dist/vega/p-b5d70ee0.entry.js +0 -1
  637. package/dist/vega/p-bf1894ec.js +0 -1
  638. package/dist/vega/p-bfb344e1.entry.js +0 -1
  639. package/dist/vega/p-c9a4e79a.entry.js +0 -1
  640. package/dist/vega/p-dbc82247.js +0 -1
  641. package/dist/vega/p-e2e36d2b.entry.js +0 -1
  642. package/dist/vega/p-ef8272b5.entry.js +0 -1
  643. package/dist/vega/p-f4c1d961.js +0 -1
  644. package/dist/vega/p-f5279deb.entry.js +0 -1
  645. package/dist/vega/p-f8033cd3.entry.js +0 -1
  646. package/dist/vega/p-fe63bd50.entry.js +0 -1
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ const typeGuard = require('./type-guard-4ba85fdc.js');
3
4
  const changeManager = require('./change-manager-a297e4d2.js');
4
5
  const domNodeSubjectFactory = require('./dom-node-subject-factory-d5826bff.js');
5
- const vegaInternalEventId = require('./vega-internal-event-id-bfea9b93.js');
6
+ const vegaInternalEventId = require('./vega-internal-event-id-62371952.js');
6
7
  const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
7
- const typeGuard = require('./type-guard-4ba85fdc.js');
8
+ const string = require('./string-39438062.js');
8
9
  const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-a3d17afb.js');
9
10
  const darkModeStyleController = require('./dark-mode-style-controller-4adb7fb2.js');
10
11
 
@@ -25,6 +26,7 @@ exports.BlockAnnotationTypeEnum = void 0;
25
26
  BlockAnnotationTypeEnum["ALIGNMENT"] = "ALIGNMENT";
26
27
  BlockAnnotationTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
27
28
  BlockAnnotationTypeEnum["INDENT"] = "INDENT";
29
+ BlockAnnotationTypeEnum["LIST"] = "LIST";
28
30
  })(exports.BlockAnnotationTypeEnum || (exports.BlockAnnotationTypeEnum = {}));
29
31
  /**
30
32
  * BlockAnnotation is an abstract class that represents a block annotation.
@@ -103,6 +105,10 @@ exports.ModifyContentActionType = void 0;
103
105
  ModifyContentActionType["DELETE_BLOCK_CONTENT"] = "DELETE_BLOCK_CONTENT";
104
106
  ModifyContentActionType["INSERT_IMAGE_TO_BLOCK"] = "INSERT_IMAGE_TO_BLOCK";
105
107
  ModifyContentActionType["UPDATE_IMAGE_NODE_URL"] = "UPDATE_IMAGE_NODE_URL";
108
+ ModifyContentActionType["TRANSFORM_TO_CODE_BLOCK"] = "TRANSFORM_TO_CODE_BLOCK";
109
+ ModifyContentActionType["UPDATE_CODE_BLOCK"] = "UPDATE_CODE_BLOCK";
110
+ ModifyContentActionType["SWITCH_OUT_FROM_CODE_BLOCK"] = "SWITCH_OUT_FROM_CODE_BLOCK";
111
+ ModifyContentActionType["DELETE_CODE_BLOCK"] = "DELETE_CODE_BLOCK";
106
112
  })(exports.ModifyContentActionType || (exports.ModifyContentActionType = {}));
107
113
  /**
108
114
  * Abstract class for update node content, delete node, insert node
@@ -142,12 +148,20 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
142
148
  };
143
149
  }
144
150
  /**
145
- * Generate the class for the annotation
146
- *
147
- * @returns {string} - Annotation class
151
+ * @inheritDoc
148
152
  */
149
- renderClass() {
150
- return `v-rte--horizontal-alignment-${this.textAlign}`;
153
+ renderClass(options) {
154
+ if (options === null || options === void 0 ? void 0 : options.standalone)
155
+ return null;
156
+ switch (this.textAlign) {
157
+ case 'right':
158
+ case 'center':
159
+ case 'justify':
160
+ return `v-rte--horizontal-alignment-${this.textAlign}`;
161
+ case 'left':
162
+ default:
163
+ return `v-rte--horizontal-alignment-left`;
164
+ }
151
165
  }
152
166
  /**
153
167
  * @inheritDoc
@@ -156,12 +170,20 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
156
170
  return new HorizontalAlignmentAnnotation(this.textAlign);
157
171
  }
158
172
  /**
159
- * Generate the style for the annotation
160
- *
161
- * @returns {Nullable<AnnotationStyle>} - Annotation style
173
+ * @inheritDoc
162
174
  */
163
- render() {
164
- return null;
175
+ renderStyle(options) {
176
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
177
+ return null;
178
+ switch (this.textAlign) {
179
+ case 'right':
180
+ case 'center':
181
+ case 'justify':
182
+ return { textAlign: this.textAlign };
183
+ case 'left':
184
+ default:
185
+ return { textAlign: 'left' };
186
+ }
165
187
  }
166
188
  }
167
189
 
@@ -197,13 +219,19 @@ class IndentAnnotation extends BlockAnnotation {
197
219
  clone() {
198
220
  return new IndentAnnotation(this.indent);
199
221
  }
222
+ /**
223
+ * @inheritDoc
224
+ */
225
+ renderClass() {
226
+ return null;
227
+ }
200
228
  /**
201
229
  * Generate the style for the annotation
202
230
  *
203
231
  * @returns {Nullable<AnnotationStyle>} - Annotation style
204
232
  */
205
- render() {
206
- return this.indent > 0 ? { 'margin-left': `${this.indent * 16}px` } : null;
233
+ renderStyle() {
234
+ return this.indent > 0 ? { marginLeft: `${this.indent * 16}px` } : null;
207
235
  }
208
236
  }
209
237
 
@@ -262,6 +290,193 @@ class ActionHandleStrategyRegistry {
262
290
  }
263
291
  ActionHandleStrategyRegistry.registry = new Map();
264
292
 
293
+ exports.CommonAnnotationTypeEnum = void 0;
294
+ (function (CommonAnnotationTypeEnum) {
295
+ CommonAnnotationTypeEnum["CUSTOM_ATTRIBUTE"] = "CUSTOM_ATTRIBUTE";
296
+ CommonAnnotationTypeEnum["CUSTOM_CLASS"] = "CUSTOM_CLASS";
297
+ CommonAnnotationTypeEnum["CUSTOM_STYLE"] = "CUSTOM_STYLE";
298
+ })(exports.CommonAnnotationTypeEnum || (exports.CommonAnnotationTypeEnum = {}));
299
+ /**
300
+ * CommonAnnotation is an abstract class that represents common annotation for block and node.
301
+ */
302
+ class CommonAnnotation extends Annotation {
303
+ }
304
+
305
+ /**
306
+ * Annotation to add custom attributes of element
307
+ */
308
+ class CustomAttributeAnnotation extends CommonAnnotation {
309
+ constructor(customAttribute) {
310
+ super();
311
+ this.type = exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE;
312
+ this.customAttribute = customAttribute;
313
+ }
314
+ /**
315
+ * Generate the map item for the annotation
316
+ *
317
+ * @param {Record<string, string>} customizeAttribute - custom attribute annotation
318
+ * @returns {[CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE, CustomAttributeAnnotation]} Map item for the annotation
319
+ */
320
+ static from(customizeAttribute) {
321
+ return [exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE, new CustomAttributeAnnotation(customizeAttribute)];
322
+ }
323
+ /**
324
+ * Generate the JSON representation of the annotation
325
+ *
326
+ * @returns {Record<string, unknown>} JSON representation of the annotation
327
+ */
328
+ toJSON() {
329
+ return {
330
+ customAttribute: this.customAttribute,
331
+ };
332
+ }
333
+ /**
334
+ * Create a new custom attribute annotation
335
+ *
336
+ * @returns {CustomAttributeAnnotation} - Custom attribute annotation
337
+ */
338
+ clone() {
339
+ return new CustomAttributeAnnotation(this.customAttribute);
340
+ }
341
+ /**
342
+ * Generate the custom attribute of current element, excluding 'style' and 'class'
343
+ *
344
+ * @param {string[]} filterAttr - should filter these existed attrs
345
+ * @returns {string[]} - Custom attributes
346
+ */
347
+ toString(filterAttr = []) {
348
+ const filterAttrKeys = filterAttr.map((attr) => attr.split('=')[0]);
349
+ return Object.keys(this.customAttribute)
350
+ .map((key) => {
351
+ return !filterAttrKeys.includes(key) ? `${key}="${this.customAttribute[key]}"` : null;
352
+ })
353
+ .filter(typeGuard.isNonNullable);
354
+ }
355
+ /**
356
+ * Generate the custom attribute for the annotation
357
+ *
358
+ * @param {RTERenderCustomAttributes} options - should filter these certain attrs
359
+ * @returns {Record<string, string>} custom attribute
360
+ */
361
+ render(options = {}) {
362
+ var _a;
363
+ const customAttribute = Object.assign({}, this.customAttribute);
364
+ (_a = options.filterAttributes) === null || _a === void 0 ? void 0 : _a.forEach((attr) => delete customAttribute[attr]);
365
+ return customAttribute;
366
+ }
367
+ }
368
+
369
+ /**
370
+ * Annotation to add custom class of element
371
+ */
372
+ class CustomClassAnnotation extends CommonAnnotation {
373
+ constructor(customClass) {
374
+ super();
375
+ this.type = exports.CommonAnnotationTypeEnum.CUSTOM_CLASS;
376
+ this.customClass = customClass;
377
+ }
378
+ /**
379
+ * Generate the map item for the annotation
380
+ *
381
+ * @param {string[]} customClass - custom class annotation
382
+ * @returns {[CommonAnnotationTypeEnum.CUSTOM_CLASS, CustomClassAnnotation]} Map item for the annotation
383
+ */
384
+ static from(customClass) {
385
+ return [exports.CommonAnnotationTypeEnum.CUSTOM_CLASS, new CustomClassAnnotation(customClass)];
386
+ }
387
+ /**
388
+ * Generate the JSON representation of the annotation
389
+ *
390
+ * @returns {Record<string, unknown>} JSON representation of the annotation
391
+ */
392
+ toJSON() {
393
+ return {
394
+ customClass: this.customClass,
395
+ };
396
+ }
397
+ /**
398
+ * Create a new custom class annotation
399
+ *
400
+ * @returns {CustomClassAnnotation} - Custom class annotation
401
+ */
402
+ clone() {
403
+ return new CustomClassAnnotation(this.customClass);
404
+ }
405
+ /**
406
+ * Generate the custom class of current element
407
+ *
408
+ * @returns {string} - Custom class
409
+ */
410
+ toString() {
411
+ return `class="${this.customClass.join(' ')}"`;
412
+ }
413
+ /**
414
+ * Generate the custom attribute for the annotation
415
+ *
416
+ * @returns {string[]} custom classes
417
+ */
418
+ renderClass() {
419
+ return this.customClass;
420
+ }
421
+ }
422
+
423
+ /**
424
+ * Annotation to add custom attributes of element
425
+ */
426
+ class CustomStyleAnnotation extends CommonAnnotation {
427
+ constructor(customStyle) {
428
+ super();
429
+ this.type = exports.CommonAnnotationTypeEnum.CUSTOM_STYLE;
430
+ this.customStyle = customStyle;
431
+ }
432
+ /**
433
+ * Generate the map item for the annotation
434
+ *
435
+ * @param {AnnotationStyle} customStyle - custom attribute annotation
436
+ * @returns {[CommonAnnotationTypeEnum.CUSTOM_STYLE, CustomStyleAnnotation]} Map item for the annotation
437
+ */
438
+ static from(customStyle) {
439
+ return [exports.CommonAnnotationTypeEnum.CUSTOM_STYLE, new CustomStyleAnnotation(customStyle)];
440
+ }
441
+ /**
442
+ * Generate the JSON representation of the annotation
443
+ *
444
+ * @returns {Record<string, unknown>} JSON representation of the annotation
445
+ */
446
+ toJSON() {
447
+ return {
448
+ customStyle: this.customStyle,
449
+ };
450
+ }
451
+ /**
452
+ * Create a new custom attribute annotation
453
+ *
454
+ * @returns {CustomStyleAnnotation} - Custom attribute annotation
455
+ */
456
+ clone() {
457
+ return new CustomStyleAnnotation(this.customStyle);
458
+ }
459
+ /**
460
+ * Generate the custom attribute for the annotation
461
+ *
462
+ * @returns {AnnotationStyle} custom attribute
463
+ */
464
+ renderStyle() {
465
+ return this.customStyle;
466
+ }
467
+ /**
468
+ * Remove the style
469
+ *
470
+ * @param {string[]} styleKeys - custom attribute annotation
471
+ * @returns {AnnotationStyle} Map item for the annotation
472
+ */
473
+ removeStyles(styleKeys) {
474
+ const customStyle = Object.assign({}, this.customStyle);
475
+ styleKeys.forEach((item) => delete customStyle[item]);
476
+ return customStyle;
477
+ }
478
+ }
479
+
265
480
  /**
266
481
  * Abstract class for block
267
482
  */
@@ -279,7 +494,7 @@ class RTEBlock {
279
494
  * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
280
495
  * that will be used to create the annotation entity. It can be of any type depending on the specific
281
496
  * annotation being created.
282
- * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
497
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
283
498
  * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
284
499
  */
285
500
  static createAnnotationEntity(type, value) {
@@ -288,6 +503,12 @@ class RTEBlock {
288
503
  return HorizontalAlignmentAnnotation.from(value);
289
504
  case 'indent':
290
505
  return IndentAnnotation.from(value);
506
+ case 'customAttribute':
507
+ return CustomAttributeAnnotation.from(value);
508
+ case 'customClass':
509
+ return CustomClassAnnotation.from(value);
510
+ case 'customStyle':
511
+ return CustomStyleAnnotation.from(value);
291
512
  }
292
513
  }
293
514
  /**
@@ -297,7 +518,7 @@ class RTEBlock {
297
518
  */
298
519
  toJSON() {
299
520
  const annotations = Array.from(this.annotationMap.values())
300
- .filter((annotation) => annotation instanceof BlockAnnotation)
521
+ .filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CommonAnnotation)
301
522
  .reduce((record, annotation) => {
302
523
  return Object.assign(Object.assign({}, record), annotation.toJSON());
303
524
  }, {});
@@ -330,6 +551,61 @@ class RTEBlock {
330
551
  }
331
552
  }
332
553
  }
554
+ /**
555
+ * Get styles from annotations
556
+ *
557
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
558
+ * @returns {AnnotationStyle} - Annotation styles
559
+ */
560
+ getStyles(options = { standalone: false }) {
561
+ return Array.from(this.annotationMap.values())
562
+ .filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomStyleAnnotation)
563
+ .map((annotation) => annotation.renderStyle(options))
564
+ .filter(typeGuard.isNonNullable)
565
+ .reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
566
+ }
567
+ /**
568
+ * Get classes from annotations
569
+ *
570
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control standalone mode
571
+ * @returns {string} - Annotation style
572
+ */
573
+ getClasses(options = { standalone: false }) {
574
+ return Array.from(this.annotationMap.values())
575
+ .filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomClassAnnotation)
576
+ .map((annotation) => annotation.renderClass(options))
577
+ .filter(typeGuard.isNonNullable)
578
+ .reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
579
+ }
580
+ /**
581
+ * Get custom attribute annotation, excluding "class" and "style"
582
+ *
583
+ * @returns {Nullable<CustomAttributeAnnotation>} - custom attribute annotation
584
+ */
585
+ getCustomAttributesAnnotation() {
586
+ return this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
587
+ }
588
+ /**
589
+ * Generate attributes as string
590
+ *
591
+ * @param {...string} attrs - Additional attributes to include
592
+ * @returns {string} - Attributes as string
593
+ */
594
+ generateAttributeString(...attrs) {
595
+ var _a;
596
+ const styles = Object.entries(Object.assign({}, this.getStyles({ standalone: true })))
597
+ .map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
598
+ .join('');
599
+ const customClassAnnotation = this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_CLASS);
600
+ const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
601
+ const attributes = [
602
+ ...customAttributeString,
603
+ customClassAnnotation === null || customClassAnnotation === void 0 ? void 0 : customClassAnnotation.toString(),
604
+ styles ? `style="${styles}"` : null,
605
+ ...attrs,
606
+ ].filter(typeGuard.isNonNullable);
607
+ return attributes.length ? ` ${attributes.join(' ')}` : '';
608
+ }
333
609
  /**
334
610
  * Apply action to block
335
611
  *
@@ -363,10 +639,29 @@ class RTEBlock {
363
639
  }
364
640
  }
365
641
 
642
+ exports.NodeAnnotationTypeEnum = void 0;
643
+ (function (NodeAnnotationTypeEnum) {
644
+ NodeAnnotationTypeEnum["BOLD"] = "BOLD";
645
+ NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
646
+ NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
647
+ NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
648
+ NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
649
+ NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
650
+ NodeAnnotationTypeEnum["CODE"] = "CODE";
651
+ NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
652
+ NodeAnnotationTypeEnum["LINK"] = "LINK";
653
+ })(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
654
+ /**
655
+ * Abstract class for all annotations
656
+ */
657
+ class NodeAnnotation extends Annotation {
658
+ }
659
+
366
660
  var NodeTypeEnum;
367
661
  (function (NodeTypeEnum) {
368
662
  NodeTypeEnum["TEXT"] = "TEXT";
369
663
  NodeTypeEnum["IMAGE"] = "IMAGE";
664
+ NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
370
665
  })(NodeTypeEnum || (NodeTypeEnum = {}));
371
666
  /**
372
667
  * Abstract class for all nodes
@@ -379,6 +674,24 @@ class RTENode {
379
674
  this.annotationMap = annotationMap;
380
675
  }
381
676
  }
677
+ /**
678
+ * Creates different types of text annotations based on the provided type and value.
679
+ *
680
+ * @param {keyof VegaRTETextAnnotations} type - The key of the type.
681
+ * @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
682
+ * @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
683
+ * value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
684
+ */
685
+ static createAnnotationEntity(type, value) {
686
+ switch (type) {
687
+ case 'customAttribute':
688
+ return CustomAttributeAnnotation.from(value);
689
+ case 'customClass':
690
+ return CustomClassAnnotation.from(value);
691
+ case 'customStyle':
692
+ return CustomStyleAnnotation.from(value);
693
+ }
694
+ }
382
695
  /**
383
696
  * Get annotation by type
384
697
  *
@@ -411,6 +724,61 @@ class RTENode {
411
724
  }
412
725
  return this;
413
726
  }
727
+ /**
728
+ * Get styles from annotations
729
+ *
730
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
731
+ * @returns {AnnotationStyle} - Annotation styles
732
+ */
733
+ getStyles(options = { standalone: false }) {
734
+ return Array.from(this.annotationMap.values())
735
+ .filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomStyleAnnotation)
736
+ .map((annotation) => annotation.renderStyle(options))
737
+ .filter(Boolean)
738
+ .reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
739
+ }
740
+ /**
741
+ * Get classes from annotations
742
+ *
743
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
744
+ * @returns {string} - Annotation style
745
+ */
746
+ getClasses(options = { standalone: false }) {
747
+ return Array.from(this.annotationMap.values())
748
+ .filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomClassAnnotation)
749
+ .map((annotation) => annotation.renderClass(options))
750
+ .filter(typeGuard.isNonNullable)
751
+ .reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
752
+ }
753
+ /**
754
+ * Get custom attribute annotation, excluding "class" and "style"
755
+ *
756
+ * @returns {CustomAttributeAnnotation} - custom attribute annotation
757
+ */
758
+ getCustomAttributesAnnotation() {
759
+ return this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
760
+ }
761
+ /**
762
+ * Generate attributes as string
763
+ *
764
+ * @param {...string} attrs - Additional attributes to include
765
+ * @returns {string} - Attributes as string
766
+ */
767
+ generateAttributeString(...attrs) {
768
+ var _a;
769
+ const styles = Object.entries(Object.assign({}, this.getStyles({ standalone: true })))
770
+ .map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
771
+ .join('');
772
+ const customClassAnnotation = this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_CLASS);
773
+ const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
774
+ const attributes = [
775
+ ...customAttributeString,
776
+ customClassAnnotation === null || customClassAnnotation === void 0 ? void 0 : customClassAnnotation.toString(),
777
+ styles ? `style="${styles}"` : null,
778
+ ...attrs,
779
+ ].filter(typeGuard.isNonNullable);
780
+ return attributes.length ? ` ${attributes.join(' ')}` : '';
781
+ }
414
782
  /**
415
783
  * apply annotation action or modify content action
416
784
  *
@@ -446,24 +814,6 @@ class RTENode {
446
814
  }
447
815
  }
448
816
 
449
- exports.NodeAnnotationTypeEnum = void 0;
450
- (function (NodeAnnotationTypeEnum) {
451
- NodeAnnotationTypeEnum["BOLD"] = "BOLD";
452
- NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
453
- NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
454
- NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
455
- NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
456
- NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
457
- NodeAnnotationTypeEnum["CODE"] = "CODE";
458
- NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
459
- NodeAnnotationTypeEnum["LINK"] = "LINK";
460
- })(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
461
- /**
462
- * Abstract class for all annotations
463
- */
464
- class NodeAnnotation extends Annotation {
465
- }
466
-
467
817
  /**
468
818
  * Annotation for image
469
819
  */
@@ -506,20 +856,29 @@ class ImageAnnotation extends NodeAnnotation {
506
856
  return new ImageAnnotation(this.size, this.alt);
507
857
  }
508
858
  /**
509
- * Generate the style for the image
510
- *
511
- * @returns {Nullable<AnnotationStyle>} image style
859
+ * @inheritDoc
860
+ */
861
+ renderClass(options) {
862
+ if (options === null || options === void 0 ? void 0 : options.standalone)
863
+ return null;
864
+ return `v-rte--image-size-${this.size}`;
865
+ }
866
+ /**
867
+ * @inheritDoc
512
868
  */
513
- render() {
869
+ renderStyle(options) {
870
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
871
+ return null;
872
+ const baseStyle = { verticalAlign: 'bottom' };
514
873
  switch (this.size) {
515
874
  case 'sm': {
516
- return { width: '25%' };
875
+ return Object.assign(Object.assign({}, baseStyle), { width: '25%' });
517
876
  }
518
877
  case 'md': {
519
- return { width: '50%' };
878
+ return Object.assign(Object.assign({}, baseStyle), { width: '50%' });
520
879
  }
521
880
  case 'lg': {
522
- return { width: '100%' };
881
+ return Object.assign(Object.assign({}, baseStyle), { width: '100%' });
523
882
  }
524
883
  }
525
884
  }
@@ -587,6 +946,28 @@ class ActionHandleStrategy {
587
946
  const lastNode = target.nodes[target.nodes.length - 1];
588
947
  return node === lastNode && startOffset === 1;
589
948
  }
949
+ /**
950
+ * Update the custom style annotation of a block or node
951
+ *
952
+ * @param {RTEBlock | RTETextNode} item - block or node
953
+ * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
954
+ */
955
+ updateCustomStyleAnnotation(item, styleKeys) {
956
+ const customStyleAnnotation = item.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_STYLE);
957
+ if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
958
+ item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
959
+ }
960
+ }
961
+ /**
962
+ * Determines if the custom style annotation includes any the custom style.
963
+ *
964
+ * @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
965
+ * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
966
+ * @returns {boolean} - True if the custom key includes the custom style, false otherwise.
967
+ */
968
+ isCustomStyle(customStyleAnnotation, styleKeys) {
969
+ return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
970
+ }
590
971
  }
591
972
 
592
973
  /**
@@ -647,7 +1028,12 @@ class RTEImageNode extends RTENode {
647
1028
  annotations = node.annotations;
648
1029
  }
649
1030
  imageNode.annotationMap = new Map(Object.keys(annotations)
650
- .map(() => ImageAnnotation.from(annotations.size, annotations.alt))
1031
+ .map((type) => {
1032
+ if (type === 'size' || type === 'alt') {
1033
+ return ImageAnnotation.from(annotations.size, annotations.alt);
1034
+ }
1035
+ return this.createAnnotationEntity(type, annotations[type]);
1036
+ })
651
1037
  .filter(typeGuard.isNonNullable));
652
1038
  return imageNode;
653
1039
  }
@@ -655,14 +1041,13 @@ class RTEImageNode extends RTENode {
655
1041
  * @inheritDoc
656
1042
  */
657
1043
  toJSON() {
658
- const imageAnnotation = this.annotationMap.get(exports.NodeAnnotationTypeEnum.IMAGE);
659
- const annotations = {};
660
- if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size) {
661
- annotations.size = imageAnnotation.size;
662
- }
663
- if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt) {
664
- annotations.alt = imageAnnotation.alt;
665
- }
1044
+ const annotations = Array.from(this.annotationMap.values())
1045
+ .filter((annotation) => annotation instanceof ImageAnnotation || annotation instanceof CommonAnnotation)
1046
+ .reduce((record, annotation) => {
1047
+ return Object.assign(Object.assign({}, record), annotation.toJSON());
1048
+ }, {});
1049
+ if (annotations.alt == '')
1050
+ delete annotations.alt;
666
1051
  return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
667
1052
  }
668
1053
  /**
@@ -671,6 +1056,18 @@ class RTEImageNode extends RTENode {
671
1056
  clone() {
672
1057
  return new RTEImageNode(this.id, this.url, this.parentBlock, super.cloneAnnotations());
673
1058
  }
1059
+ /**
1060
+ * @inheritDoc
1061
+ */
1062
+ toHtml() {
1063
+ const imageAnnotation = this.getAnnotationByType(exports.NodeAnnotationTypeEnum.IMAGE);
1064
+ const attrStr = super.generateAttributeString(...[
1065
+ imageAnnotation && imageAnnotation.alt ? `alt="${imageAnnotation.alt}"` : null,
1066
+ `src="${this.url}"`,
1067
+ `data-size="${imageAnnotation.size}"`,
1068
+ ].filter(typeGuard.isNonNullable));
1069
+ return `<img${attrStr}>`;
1070
+ }
674
1071
  /**
675
1072
  * @inheritDoc
676
1073
  */
@@ -858,76 +1255,24 @@ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
858
1255
  }
859
1256
  }
860
1257
 
1258
+ /** Append blocks or nodes to a block */
1259
+ class AppendChildNodesAction extends ModifyContentAction {
1260
+ constructor(childNodes) {
1261
+ super();
1262
+ this.type = exports.ModifyContentActionType.APPEND_CHILD_NODES;
1263
+ this.entityToBeAppended = childNodes;
1264
+ }
1265
+ }
1266
+
861
1267
  /**
862
- * The image block delete the image node strategy.
1268
+ * Append the second block child nodes to the first block child nodes and remove the second block strategy.
863
1269
  */
864
- class BlockDeleteImageStrategy extends BlockDeleteNodeContentStrategy {
865
- /**
866
- * @inheritDoc
867
- */
868
- handleAction(action, target) {
869
- this.deleteNodeContent(action, target);
870
- }
1270
+ class BlockMergeNodesStrategy extends ActionHandleStrategy {
871
1271
  /**
872
- * Deletes content from a block node based on specific conditions.
1272
+ * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
873
1273
  *
874
- * @param {DeleteBlockContentAction} action - Delete block content action
875
- * @param {RTEImageBlock} target - The image block.
876
- */
877
- deleteNodeContent(action, target) {
878
- const startContainerNode = action
879
- .startContainerNode, startOffset = action.startOffset;
880
- let previousNode = this.getPreviousNode(startContainerNode);
881
- let nextNode = null;
882
- if (startOffset === 1) {
883
- const parentBlock = target;
884
- if (this.isContentFirstNode(startContainerNode)) {
885
- nextNode = this.getNextNode(startContainerNode);
886
- }
887
- if (parentBlock.nodes.length === 1) {
888
- parentBlock.parent.apply(new RemoveChildAction(parentBlock));
889
- }
890
- else {
891
- parentBlock.apply(new RemoveChildAction(startContainerNode));
892
- }
893
- }
894
- else {
895
- const shouldRemoveNode = previousNode;
896
- if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
897
- previousNode = this.getPreviousNode(shouldRemoveNode);
898
- shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
899
- if (!previousNode) {
900
- action.nextNode = startContainerNode;
901
- }
902
- }
903
- }
904
- if (previousNode) {
905
- action.previousNode = previousNode;
906
- }
907
- else if (nextNode) {
908
- action.nextNode = nextNode;
909
- }
910
- }
911
- }
912
-
913
- /** Append blocks or nodes to a block */
914
- class AppendChildNodesAction extends ModifyContentAction {
915
- constructor(childNodes) {
916
- super();
917
- this.type = exports.ModifyContentActionType.APPEND_CHILD_NODES;
918
- this.entityToBeAppended = childNodes;
919
- }
920
- }
921
-
922
- /**
923
- * Append the second block child nodes to the first block child nodes and remove the second block strategy.
924
- */
925
- class BlockMergeNodesStrategy extends ActionHandleStrategy {
926
- /**
927
- * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
928
- *
929
- * @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
930
- * @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
1274
+ * @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
1275
+ * @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
931
1276
  */
932
1277
  handleAction(action, target) {
933
1278
  const anotherBlock = action.blockNeedToBeMerged;
@@ -951,7 +1296,7 @@ class BlockRemoveNodeStrategy extends ActionHandleStrategy {
951
1296
  * Remove the block if the block nodes is empty after delete the current node.
952
1297
  *
953
1298
  * @param {RemoveChildAction} action - The remove child action instance.
954
- * @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
1299
+ * @param {RTEBlockWithNodes} target - The parent block of the node that will be removed.
955
1300
  */
956
1301
  handleAction(action, target) {
957
1302
  const arrayFixed = target.nodes;
@@ -1026,51 +1371,6 @@ class ReplaceChildNodesAction extends ModifyContentAction {
1026
1371
  }
1027
1372
  }
1028
1373
 
1029
- /**
1030
- * Split the current image block with a special position strategy.
1031
- */
1032
- class BlockSplitWithImageNodeStrategy extends ActionHandleStrategy {
1033
- /**
1034
- * @inheritDoc
1035
- */
1036
- handleAction(action, target) {
1037
- action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
1038
- }
1039
- /**
1040
- * The image offset should be 0 or 1
1041
- * <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
1042
- *
1043
- * @param {RTEImageNode} imageNode The split point image node.
1044
- * @param {number} imageOffset The cursor point 0 | 1.
1045
- * @param {RTEImageBlock} target The image block.
1046
- * @returns {Nullable<RTEBlock>} The new block after split
1047
- */
1048
- splitImageNodes(imageNode, imageOffset, target) {
1049
- const nodesSplitIndex = target.nodes.indexOf(imageNode);
1050
- if (nodesSplitIndex > -1) {
1051
- const beforeNodes = target.nodes.slice(0, nodesSplitIndex + imageOffset);
1052
- const afterNodes = target.nodes.slice(nodesSplitIndex + imageOffset);
1053
- target.apply(new ReplaceChildNodesAction(beforeNodes));
1054
- const newBlock = this.cloneWithNodes(afterNodes, target);
1055
- target.parent.apply(new InsertBlocksAfterAction(target, newBlock));
1056
- return newBlock;
1057
- }
1058
- }
1059
- /**
1060
- * Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
1061
- *
1062
- * @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
1063
- * @param {RTEImageBlock} target The image block.
1064
- * @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
1065
- */
1066
- cloneWithNodes(nodes, target) {
1067
- const block = target.createNewImageBlock();
1068
- block.nodes = [];
1069
- block.apply(new AppendChildNodesAction(nodes));
1070
- return block;
1071
- }
1072
- }
1073
-
1074
1374
  /**
1075
1375
  * Insert a new block before a existing block
1076
1376
  *
@@ -1167,20 +1467,20 @@ class StrikethroughAnnotation extends NodeAnnotation {
1167
1467
  return new StrikethroughAnnotation(this.strikethrough);
1168
1468
  }
1169
1469
  /**
1170
- * Generate the class for the annotation
1171
- *
1172
- * @returns {Nullable<string>} - Annotation class
1470
+ * @inheritDoc
1173
1471
  */
1174
- renderClass() {
1472
+ renderClass(options) {
1473
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1474
+ return null;
1175
1475
  return this.strikethrough ? 'v-rte--strikethrough' : null;
1176
1476
  }
1177
1477
  /**
1178
- * Generate the style for the annotation
1179
- *
1180
- * @returns {Nullable<AnnotationStyle>} - Annotation style
1478
+ * @inheritDoc
1181
1479
  */
1182
- render() {
1183
- return null;
1480
+ renderStyle(options) {
1481
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1482
+ return null;
1483
+ return this.strikethrough ? { textDecoration: 'line-through' } : null;
1184
1484
  }
1185
1485
  }
1186
1486
 
@@ -1219,20 +1519,20 @@ class UnderlineAnnotation extends NodeAnnotation {
1219
1519
  return new UnderlineAnnotation(this.underline);
1220
1520
  }
1221
1521
  /**
1222
- * Generate the class for the annotation
1223
- *
1224
- * @returns {Nullable<string>} - Annotation class
1522
+ * @inheritDoc
1225
1523
  */
1226
- renderClass() {
1524
+ renderClass(options) {
1525
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1526
+ return null;
1227
1527
  return this.underline ? 'v-rte--underline' : null;
1228
1528
  }
1229
1529
  /**
1230
- * Generate the style for the annotation
1231
- *
1232
- * @returns {Nullable<AnnotationStyle>} - Annotation style
1530
+ * @inheritDoc
1233
1531
  */
1234
- render() {
1235
- return null;
1532
+ renderStyle(options) {
1533
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1534
+ return null;
1535
+ return this.underline ? { textDecoration: 'underline' } : null;
1236
1536
  }
1237
1537
  }
1238
1538
 
@@ -1271,12 +1571,20 @@ class ItalicAnnotation extends NodeAnnotation {
1271
1571
  return new ItalicAnnotation(this.italic);
1272
1572
  }
1273
1573
  /**
1274
- * Generate the style for the annotation
1275
- *
1276
- * @returns {Nullable<AnnotationStyle>} Italic style
1574
+ * @inheritDoc
1575
+ */
1576
+ renderClass(options) {
1577
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1578
+ return null;
1579
+ return this.italic ? 'v-rte--italic' : null;
1580
+ }
1581
+ /**
1582
+ * @inheritDoc
1277
1583
  */
1278
- render() {
1279
- return this.italic ? { 'font-style': 'italic' } : null;
1584
+ renderStyle(options) {
1585
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1586
+ return null;
1587
+ return this.italic ? { fontStyle: 'italic' } : null;
1280
1588
  }
1281
1589
  }
1282
1590
 
@@ -1315,12 +1623,20 @@ class BoldAnnotation extends NodeAnnotation {
1315
1623
  return new BoldAnnotation(this.bold);
1316
1624
  }
1317
1625
  /**
1318
- * Generate the style for the annotation
1319
- *
1320
- * @returns {Nullable<AnnotationStyle>} Bold style
1626
+ * @inheritDoc
1627
+ */
1628
+ renderClass(options) {
1629
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1630
+ return null;
1631
+ return this.bold ? 'v-rte--bold' : null;
1632
+ }
1633
+ /**
1634
+ * @inheritDoc
1321
1635
  */
1322
- render() {
1323
- return this.bold ? { 'font-weight': '700' } : null;
1636
+ renderStyle(options) {
1637
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1638
+ return null;
1639
+ return this.bold ? { fontWeight: '700' } : null;
1324
1640
  }
1325
1641
  }
1326
1642
 
@@ -1359,20 +1675,25 @@ class CodeAnnotation extends NodeAnnotation {
1359
1675
  return new CodeAnnotation(this.code);
1360
1676
  }
1361
1677
  /**
1362
- * Generate the class for the annotation
1363
- *
1364
- * @returns {Nullable<string>} - Annotation class
1678
+ * @inheritDoc
1365
1679
  */
1366
- renderClass() {
1680
+ renderClass(options) {
1681
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1682
+ return null;
1367
1683
  return this.code ? 'v-rte--code' : null;
1368
1684
  }
1369
1685
  /**
1370
- * Generate the style for the annotation
1371
- *
1372
- * @returns {Nullable<AnnotationStyle>} Bold style
1686
+ * @inheritDoc
1373
1687
  */
1374
- render() {
1375
- return null;
1688
+ renderStyle(options) {
1689
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1690
+ return null;
1691
+ return this.code
1692
+ ? {
1693
+ fontFamily: 'Roboto Mono',
1694
+ whiteSpace: 'pre-wrap',
1695
+ }
1696
+ : null;
1376
1697
  }
1377
1698
  }
1378
1699
 
@@ -1445,19 +1766,15 @@ class TextColorAnnotation extends NodeAnnotation {
1445
1766
  return new TextColorAnnotation(this.textColor.key);
1446
1767
  }
1447
1768
  /**
1448
- * Generate the class for the annotation
1449
- *
1450
- * @returns {Nullable<string>} - Annotation class
1769
+ * @inheritDoc
1451
1770
  */
1452
1771
  renderClass() {
1453
1772
  return null;
1454
1773
  }
1455
1774
  /**
1456
- * Generate the style for the annotation
1457
- *
1458
- * @returns {Nullable<AnnotationStyle>} - Annotation style
1775
+ * @inheritDoc
1459
1776
  */
1460
- render() {
1777
+ renderStyle() {
1461
1778
  return {
1462
1779
  color: darkModeStyleController.VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
1463
1780
  };
@@ -1489,10 +1806,7 @@ class LinkAnnotation extends NodeAnnotation {
1489
1806
  * @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
1490
1807
  */
1491
1808
  static from(link) {
1492
- return [
1493
- exports.NodeAnnotationTypeEnum.LINK,
1494
- new LinkAnnotation({ href: link.href, groupKey: link.groupKey }),
1495
- ];
1809
+ return [exports.NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link)];
1496
1810
  }
1497
1811
  /**
1498
1812
  * Generate the JSON representation of the annotation
@@ -1500,7 +1814,9 @@ class LinkAnnotation extends NodeAnnotation {
1500
1814
  * @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
1501
1815
  */
1502
1816
  toJSON() {
1503
- return { link: { href: this.link.href, groupKey: this.link.groupKey } };
1817
+ return {
1818
+ link: this.link,
1819
+ };
1504
1820
  }
1505
1821
  /**
1506
1822
  * @inheritDoc
@@ -1518,11 +1834,15 @@ class LinkAnnotation extends NodeAnnotation {
1518
1834
  return this.link.groupKey === annotation.link.groupKey;
1519
1835
  }
1520
1836
  /**
1521
- * Generate the style for the annotation
1522
- *
1523
- * @returns {Nullable<AnnotationStyle>} Link style
1837
+ * @inheritDoc
1524
1838
  */
1525
- render() {
1839
+ renderClass() {
1840
+ return null;
1841
+ }
1842
+ /**
1843
+ * @inheritDoc
1844
+ */
1845
+ renderStyle() {
1526
1846
  return null;
1527
1847
  }
1528
1848
  }
@@ -1544,6 +1864,94 @@ class LinkGroupAnnotation extends Annotation {
1544
1864
  });
1545
1865
  return clonedAnnotation;
1546
1866
  }
1867
+ /**
1868
+ * Convert the custom style, class and attribute to string which html can used
1869
+ *
1870
+ * @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
1871
+ * @param {RTERenderContext} options - options.
1872
+ * @returns {string} - string.
1873
+ */
1874
+ toString(linkAnnotation, options) {
1875
+ const attributes = this.toJsx(linkAnnotation, options);
1876
+ return Object.entries(attributes)
1877
+ .map(([key, value]) => {
1878
+ const valueString = typeof value === 'string' ? value : this.formatStyleToString(value);
1879
+ return `${string.camelToDashCase(key)}="${valueString}"`;
1880
+ })
1881
+ .join(' ');
1882
+ }
1883
+ /**
1884
+ * Convert the custom style, class and attribute to JSX attributes
1885
+ *
1886
+ * @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
1887
+ * @param {RTERenderContext} options - options.
1888
+ * @returns {Record<string, string | AnnotationStyle>} JSX used attributes.
1889
+ */
1890
+ toJsx(linkAnnotation, options) {
1891
+ const linkStyle = this.getStyle(linkAnnotation, options);
1892
+ const linkClass = this.getClass(linkAnnotation, options);
1893
+ const attributes = this.getAttribute(linkAnnotation);
1894
+ if (linkClass.length > 0) {
1895
+ attributes.class = linkClass.join(' ');
1896
+ }
1897
+ if (linkStyle && Object.keys(linkStyle).length > 0) {
1898
+ attributes.style = linkStyle;
1899
+ }
1900
+ return attributes;
1901
+ }
1902
+ /**
1903
+ * Get the custom class for the annotation
1904
+ *
1905
+ * @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
1906
+ * @param {RTERenderContext} options - options.
1907
+ * @returns {string[]} Link class
1908
+ */
1909
+ getClass(linkAnnotation, options) {
1910
+ const linkClass = [];
1911
+ if (linkAnnotation.link.customClass)
1912
+ linkClass.push(...linkAnnotation.link.customClass);
1913
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1914
+ linkClass.push('v-rte--link');
1915
+ return linkClass;
1916
+ }
1917
+ /**
1918
+ * Get the custom style for the annotation
1919
+ *
1920
+ * @param {LinkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
1921
+ * @param {RTERenderContext} options - options.
1922
+ * @returns {AnnotationStyle} Link style
1923
+ */
1924
+ getStyle(linkAnnotation, options) {
1925
+ const linkStyle = {};
1926
+ if (linkAnnotation.link.customStyle)
1927
+ Object.assign(linkStyle, linkAnnotation.link.customStyle);
1928
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1929
+ linkStyle.color = 'rgba(var(--v-text-link, 19, 98, 226, 1))';
1930
+ return linkStyle;
1931
+ }
1932
+ /**
1933
+ * Get the custom attribute for the annotation
1934
+ *
1935
+ * @param {LinkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
1936
+ * @returns {Record<string, string>} Link attributes
1937
+ */
1938
+ getAttribute(linkAnnotation) {
1939
+ const { href, customAttribute = {} } = linkAnnotation.link;
1940
+ customAttribute.href = href;
1941
+ customAttribute.target = customAttribute.target || '_blank';
1942
+ return customAttribute;
1943
+ }
1944
+ /**
1945
+ * Convert style to string which can be used to html string.
1946
+ *
1947
+ * @param {AnnotationStyle} style Style object.
1948
+ * @returns {string} Style string
1949
+ */
1950
+ formatStyleToString(style) {
1951
+ return Object.entries(style)
1952
+ .map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
1953
+ .join(' ');
1954
+ }
1547
1955
  }
1548
1956
 
1549
1957
  /**
@@ -1792,6 +2200,25 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
1792
2200
  }
1793
2201
  }
1794
2202
 
2203
+ /**
2204
+ * Action to toggle bold annotation
2205
+ */
2206
+ class BoldAnnotationAction extends TextSplittableAction {
2207
+ constructor(bold) {
2208
+ super();
2209
+ this.isFlushable = true;
2210
+ this.bold = bold;
2211
+ }
2212
+ /**
2213
+ * Converts the action to an annotation
2214
+ *
2215
+ * @returns {BoldAnnotation} the annotation
2216
+ */
2217
+ toAnnotation() {
2218
+ return new BoldAnnotation(this.bold);
2219
+ }
2220
+ }
2221
+
1795
2222
  /**
1796
2223
  * Annotation to host which annotations will be clear formatting
1797
2224
  */
@@ -1806,6 +2233,7 @@ class ClearFormattingAnnotation extends Annotation {
1806
2233
  exports.NodeAnnotationTypeEnum.STRIKETHROUGH,
1807
2234
  exports.NodeAnnotationTypeEnum.TEXT_COLOR,
1808
2235
  exports.NodeAnnotationTypeEnum.CODE,
2236
+ exports.CommonAnnotationTypeEnum.CUSTOM_STYLE,
1809
2237
  ];
1810
2238
  }
1811
2239
  }
@@ -1866,6 +2294,25 @@ class DeleteNodeAnnotationAction extends AnnotationAction {
1866
2294
  }
1867
2295
  }
1868
2296
 
2297
+ /**
2298
+ * Action to toggle the italic annotation
2299
+ */
2300
+ class ItalicAnnotationAction extends TextSplittableAction {
2301
+ constructor(italic) {
2302
+ super();
2303
+ this.isFlushable = true;
2304
+ this.italic = italic;
2305
+ }
2306
+ /**
2307
+ * Converts the action to an annotation
2308
+ *
2309
+ * @returns {ItalicAnnotation} The annotation
2310
+ */
2311
+ toAnnotation() {
2312
+ return new ItalicAnnotation(this.italic);
2313
+ }
2314
+ }
2315
+
1869
2316
  /**
1870
2317
  * Action to toggle link annotation
1871
2318
  */
@@ -1890,6 +2337,44 @@ class LinkAnnotationAction extends TextSplittableAction {
1890
2337
  }
1891
2338
  }
1892
2339
 
2340
+ /**
2341
+ * Action to toggle the strikethrough annotation
2342
+ */
2343
+ class StrikethroughAnnotationAction extends TextSplittableAction {
2344
+ constructor(underline) {
2345
+ super();
2346
+ this.isFlushable = true;
2347
+ this.strikethrough = underline;
2348
+ }
2349
+ /**
2350
+ * Converts the action to an annotation
2351
+ *
2352
+ * @returns {Annotation} the annotation
2353
+ */
2354
+ toAnnotation() {
2355
+ return new StrikethroughAnnotation(this.strikethrough);
2356
+ }
2357
+ }
2358
+
2359
+ /**
2360
+ * Action to toggle the underline annotation
2361
+ */
2362
+ class UnderlineAnnotationAction extends TextSplittableAction {
2363
+ constructor(underline) {
2364
+ super();
2365
+ this.isFlushable = true;
2366
+ this.underline = underline;
2367
+ }
2368
+ /**
2369
+ * Converts the action to an annotation
2370
+ *
2371
+ * @returns {Annotation} the annotation
2372
+ */
2373
+ toAnnotation() {
2374
+ return new UnderlineAnnotation(this.underline);
2375
+ }
2376
+ }
2377
+
1893
2378
  /**
1894
2379
  * The current strategy used to modify the text node annotation map.
1895
2380
  */
@@ -1922,6 +2407,16 @@ class NodeUpdateAnnotationMapStrategy extends ActionHandleStrategy {
1922
2407
  if (action instanceof CodeAnnotationAction) {
1923
2408
  this.handleAction(new ClearFormattingAnnotationAction(), target);
1924
2409
  }
2410
+ if (action instanceof BoldAnnotationAction) {
2411
+ this.updateCustomStyleAnnotation(target, ['fontWeight']);
2412
+ }
2413
+ if (action instanceof ItalicAnnotationAction) {
2414
+ this.updateCustomStyleAnnotation(target, ['fontStyle']);
2415
+ }
2416
+ if (action instanceof UnderlineAnnotationAction ||
2417
+ action instanceof StrikethroughAnnotationAction) {
2418
+ this.updateCustomStyleAnnotation(target, ['textDecoration']);
2419
+ }
1925
2420
  target.annotationMap.set(annotation.type, annotation);
1926
2421
  return;
1927
2422
  }
@@ -1985,18 +2480,30 @@ class RTETextNode extends RTENode {
1985
2480
  case 'link':
1986
2481
  return LinkAnnotation.from(value);
1987
2482
  }
2483
+ return RTENode.createAnnotationEntity(type, value);
1988
2484
  }
1989
2485
  /**
1990
2486
  * @inheritDoc
1991
2487
  */
1992
2488
  toJSON() {
1993
2489
  const annotations = Array.from(this.annotationMap.values())
1994
- .filter((annotation) => annotation instanceof NodeAnnotation)
2490
+ .filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CommonAnnotation)
1995
2491
  .reduce((record, annotation) => {
1996
2492
  return Object.assign(Object.assign({}, record), annotation.toJSON());
1997
2493
  }, {});
1998
2494
  return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'text', text: this.text });
1999
2495
  }
2496
+ /**
2497
+ * @inheritDoc
2498
+ */
2499
+ toHtml() {
2500
+ var _a;
2501
+ const NodeTag = ((_a = this.getAnnotationByType(exports.NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
2502
+ ? 'code'
2503
+ : 'span';
2504
+ const attrStr = super.generateAttributeString();
2505
+ return `<${NodeTag}${attrStr}>${this.text}</${NodeTag}>`;
2506
+ }
2000
2507
  /**
2001
2508
  * Creates a new RTETextNode with the specified text and copies the parent block and annotation map from the original node.
2002
2509
  *
@@ -2122,44 +2629,106 @@ class TextStyleAnnotation extends BlockAnnotation {
2122
2629
  return new TextStyleAnnotation(this.textStyle);
2123
2630
  }
2124
2631
  /**
2125
- * Render the styles by block type
2126
- *
2127
- * @returns {AnnotationStyle} the styles to apply
2632
+ * @inheritDoc
2633
+ */
2634
+ renderClass(options) {
2635
+ if (options === null || options === void 0 ? void 0 : options.standalone)
2636
+ return null;
2637
+ return `v-rte--text-style-${this.textStyle}`;
2638
+ }
2639
+ /**
2640
+ * @inheritDoc
2128
2641
  */
2129
- render() {
2642
+ renderStyle(options) {
2643
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
2644
+ return null;
2130
2645
  const paragraphStyle = {
2131
2646
  fontFamily: 'Inter',
2132
2647
  fontSize: '16px',
2133
2648
  lineHeight: '22px',
2134
2649
  fontWeight: '500',
2650
+ marginTop: '0px',
2651
+ marginBottom: '0px',
2135
2652
  };
2136
2653
  switch (this.textStyle) {
2137
2654
  case 'paragraph': {
2138
2655
  return paragraphStyle;
2139
2656
  }
2140
2657
  case 'title': {
2141
- return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
2658
+ return {
2659
+ fontFamily: 'Inter',
2660
+ fontSize: '36px',
2661
+ lineHeight: '40px',
2662
+ fontWeight: '500',
2663
+ };
2142
2664
  }
2143
2665
  case 'subtitle': {
2144
- return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
2666
+ return {
2667
+ fontFamily: 'Inter',
2668
+ fontSize: '28px',
2669
+ lineHeight: '32px',
2670
+ fontWeight: '500',
2671
+ };
2145
2672
  }
2146
2673
  case 'heading-1': {
2147
- return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
2674
+ return {
2675
+ fontFamily: 'Inter',
2676
+ fontSize: '22px',
2677
+ lineHeight: '24px',
2678
+ fontWeight: '500',
2679
+ marginTop: '0px',
2680
+ marginBottom: '0px',
2681
+ };
2148
2682
  }
2149
2683
  case 'heading-2': {
2150
- return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
2684
+ return {
2685
+ fontFamily: 'Inter',
2686
+ fontSize: '20px',
2687
+ lineHeight: '24px',
2688
+ fontWeight: '500',
2689
+ marginTop: '0px',
2690
+ marginBottom: '0px',
2691
+ };
2151
2692
  }
2152
2693
  case 'heading-3': {
2153
- return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
2694
+ return {
2695
+ fontFamily: 'Inter',
2696
+ fontSize: '18px',
2697
+ lineHeight: '22px',
2698
+ fontWeight: '500',
2699
+ marginTop: '0px',
2700
+ marginBottom: '0px',
2701
+ };
2154
2702
  }
2155
2703
  case 'heading-4': {
2156
- return { fontFamily: 'Inter', fontSize: '16px', lineHeight: '22px', fontWeight: '500' };
2704
+ return {
2705
+ fontFamily: 'Inter',
2706
+ fontSize: '16px',
2707
+ lineHeight: '22px',
2708
+ fontWeight: '500',
2709
+ marginTop: '0px',
2710
+ marginBottom: '0px',
2711
+ };
2157
2712
  }
2158
2713
  case 'heading-5': {
2159
- return { fontFamily: 'Inter', fontSize: '14px', lineHeight: '22px', fontWeight: '500' };
2714
+ return {
2715
+ fontFamily: 'Inter',
2716
+ fontSize: '14px',
2717
+ lineHeight: '22px',
2718
+ fontWeight: '500',
2719
+ marginTop: '0px',
2720
+ marginBottom: '0px',
2721
+ };
2160
2722
  }
2161
2723
  case 'heading-6': {
2162
- return { fontFamily: 'Inter', fontSize: '12px', lineHeight: '22px', fontWeight: '500' };
2724
+ return {
2725
+ fontFamily: 'Inter',
2726
+ fontSize: '12px',
2727
+ lineHeight: '22px',
2728
+ fontWeight: '500',
2729
+ marginTop: '0px',
2730
+ marginBottom: '0px',
2731
+ };
2163
2732
  }
2164
2733
  }
2165
2734
  }
@@ -2185,25 +2754,6 @@ class TextStyleAnnotationAction extends AnnotationAction {
2185
2754
  }
2186
2755
  }
2187
2756
 
2188
- /**
2189
- * Action to toggle bold annotation
2190
- */
2191
- class BoldAnnotationAction extends TextSplittableAction {
2192
- constructor(bold) {
2193
- super();
2194
- this.isFlushable = true;
2195
- this.bold = bold;
2196
- }
2197
- /**
2198
- * Converts the action to an annotation
2199
- *
2200
- * @returns {BoldAnnotation} the annotation
2201
- */
2202
- toAnnotation() {
2203
- return new BoldAnnotation(this.bold);
2204
- }
2205
- }
2206
-
2207
2757
  /**
2208
2758
  * Update the text block text style strategy.
2209
2759
  */
@@ -2230,6 +2780,7 @@ class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
2230
2780
  node.apply(new DeleteNodeAnnotationAction(exports.NodeAnnotationTypeEnum.BOLD));
2231
2781
  });
2232
2782
  }
2783
+ this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
2233
2784
  }
2234
2785
  }
2235
2786
 
@@ -2516,7 +3067,9 @@ class BlockDeleteTextContentStrategy extends BlockDeleteNodeContentStrategy {
2516
3067
  if (startContainerNode.isEmpty()) {
2517
3068
  target.apply(new RemoveChildAction(startContainerNode));
2518
3069
  }
2519
- previousNode.parentBlock.apply(new MergeTwoBlocksNodesAction(target));
3070
+ if (target.type === previousNode.parentBlock.type) {
3071
+ previousNode.parentBlock.apply(new MergeTwoBlocksNodesAction(target));
3072
+ }
2520
3073
  }
2521
3074
  else {
2522
3075
  if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
@@ -2656,22 +3209,90 @@ class BlockTransformToListStrategy extends ActionHandleStrategy {
2656
3209
  }
2657
3210
 
2658
3211
  /**
2659
- * Text block
3212
+ * Action to toggle block horizontal alignment annotation
2660
3213
  */
2661
- class RTETextBlock extends RTEBlock {
2662
- constructor(id, type) {
2663
- super(id);
2664
- this.nodes = [];
2665
- this.type = type;
2666
- if (RTETextBlock.isAcceptableTextStyle(type)) {
2667
- this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
2668
- }
2669
- else {
2670
- this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
2671
- }
3214
+ class HorizontalAlignmentAnnotationAction extends AnnotationAction {
3215
+ constructor(textAlign) {
3216
+ super();
3217
+ this.isFlushable = true;
3218
+ this.textAlign = textAlign;
2672
3219
  }
2673
3220
  /**
2674
- * Converts a VegaRTETextBlock into an RTETextBlock.
3221
+ * Converts the action to an annotation
3222
+ *
3223
+ * @returns {HorizontalAlignmentAnnotation} The annotation
3224
+ */
3225
+ toAnnotation() {
3226
+ return new HorizontalAlignmentAnnotation(this.textAlign);
3227
+ }
3228
+ }
3229
+
3230
+ /**
3231
+ * Update the text block and image block horizontal alignment strategy.
3232
+ */
3233
+ class BlockUpdateHorizontalAlignmentStrategy extends ActionHandleStrategy {
3234
+ /**
3235
+ * Updating the horizontal alignment of a block requires cascading updates to the custom style.
3236
+ *
3237
+ * @param {HorizontalAlignmentAnnotationAction} _action - The horizontal alignment annotation action.
3238
+ * @param {RTETextBlock} target - The current text block.
3239
+ */
3240
+ handleAction(_action, target) {
3241
+ this.updateCustomStyleAnnotation(target, ['textAlign']);
3242
+ }
3243
+ }
3244
+
3245
+ /**
3246
+ * Update the text block and image block horizontal alignment strategy.
3247
+ */
3248
+ class BlockUpdateIndentStrategy extends ActionHandleStrategy {
3249
+ /**
3250
+ * Updating the indent of a block requires cascading updates to the custom style.
3251
+ *
3252
+ * @param {IndentAnnotationAction} _action - The indent annotation action.
3253
+ * @param {RTETextBlock} target - The current text block.
3254
+ */
3255
+ handleAction(_action, target) {
3256
+ this.updateCustomStyleAnnotation(target, ['marginLeft']);
3257
+ }
3258
+ }
3259
+
3260
+ /**
3261
+ * Action to toggle block indent annotation
3262
+ */
3263
+ class IndentAnnotationAction extends AnnotationAction {
3264
+ constructor(indent) {
3265
+ super();
3266
+ this.isFlushable = true;
3267
+ this.indent = indent;
3268
+ }
3269
+ /**
3270
+ * Converts the action to an annotation
3271
+ *
3272
+ * @returns {Annotation} The annotation
3273
+ */
3274
+ toAnnotation() {
3275
+ return new IndentAnnotation(this.indent);
3276
+ }
3277
+ }
3278
+
3279
+ /**
3280
+ * Text block
3281
+ */
3282
+ class RTETextBlock extends RTEBlock {
3283
+ constructor(id, type) {
3284
+ super(id);
3285
+ this.nodes = [];
3286
+ this.type = type;
3287
+ if (RTETextBlock.isAcceptableTextStyle(type)) {
3288
+ this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
3289
+ }
3290
+ else {
3291
+ this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
3292
+ }
3293
+ }
3294
+ /**
3295
+ * Converts a VegaRTETextBlock into an RTETextBlock.
2675
3296
  *
2676
3297
  * @param {VegaRTETextBlock} block - The block object
2677
3298
  * @returns {RTETextBlock} A RTETextBlock class
@@ -2699,7 +3320,7 @@ class RTETextBlock extends RTEBlock {
2699
3320
  * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
2700
3321
  * that will be used to create the annotation entity. It can be of any type depending on the specific
2701
3322
  * annotation being created.
2702
- * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
3323
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
2703
3324
  * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
2704
3325
  */
2705
3326
  static createAnnotationEntity(type, value) {
@@ -2756,6 +3377,36 @@ class RTETextBlock extends RTEBlock {
2756
3377
  toJSON() {
2757
3378
  return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
2758
3379
  }
3380
+ /**
3381
+ * @inheritDoc
3382
+ */
3383
+ toHtml() {
3384
+ const BlockTag = this.getBlockTag();
3385
+ const attrStr = super.generateAttributeString();
3386
+ const linkGroupAnnotation = this.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
3387
+ let nodesHtml = this.nodes.map((node) => node.toHtml()).join('');
3388
+ if (linkGroupAnnotation && this.nodes.length > 0) {
3389
+ //TODO: should revert to above code while https://gethired.atlassian.net/browse/VD-6513 have be fixed.
3390
+ // const linkAnnotation: Nullable<LinkAnnotation> =
3391
+ // this.nodes[0].getAnnotationByType<LinkAnnotation>(NodeAnnotationTypeEnum.LINK);
3392
+ let linkAnnotation;
3393
+ this.nodes.find((node) => {
3394
+ const link = node.getAnnotationByType(exports.NodeAnnotationTypeEnum.LINK);
3395
+ if (link) {
3396
+ linkAnnotation = link;
3397
+ return true;
3398
+ }
3399
+ });
3400
+ if (linkAnnotation) {
3401
+ nodesHtml = [
3402
+ `<a ${linkGroupAnnotation.toString(linkAnnotation, { standalone: true })}>`,
3403
+ nodesHtml,
3404
+ `</a>`,
3405
+ ].join('');
3406
+ }
3407
+ }
3408
+ return [`<${BlockTag}${attrStr}>`, nodesHtml, `</${BlockTag}>`].join('');
3409
+ }
2759
3410
  /**
2760
3411
  * Clone the nodes to a new block
2761
3412
  *
@@ -2802,6 +3453,33 @@ class RTETextBlock extends RTEBlock {
2802
3453
  createNewParagraph() {
2803
3454
  return new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), 'paragraph');
2804
3455
  }
3456
+ /**
3457
+ * Get the HTML tag for the block based on its type.
3458
+ *
3459
+ * @returns {RTETextBlockTagType} The HTML tag for the block.
3460
+ */
3461
+ getBlockTag() {
3462
+ switch (this.type) {
3463
+ case 'title':
3464
+ case 'subtitle':
3465
+ return `div`;
3466
+ case 'heading-1':
3467
+ return `h1`;
3468
+ case 'heading-2':
3469
+ return `h2`;
3470
+ case 'heading-3':
3471
+ return `h3`;
3472
+ case 'heading-4':
3473
+ return `h4`;
3474
+ case 'heading-5':
3475
+ return `h5`;
3476
+ case 'heading-6':
3477
+ return `h6`;
3478
+ case 'paragraph':
3479
+ default:
3480
+ return 'p';
3481
+ }
3482
+ }
2805
3483
  /**
2806
3484
  * @inheritDoc
2807
3485
  */
@@ -2814,6 +3492,8 @@ class RTETextBlock extends RTEBlock {
2814
3492
  }
2815
3493
  (() => {
2816
3494
  ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTETextBlock.name, new BlockUpdateTextStyleStrategy());
3495
+ ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTETextBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
3496
+ ActionHandleStrategyRegistry.register(IndentAnnotationAction.name, RTETextBlock.name, new BlockUpdateIndentStrategy());
2817
3497
  ActionHandleStrategyRegistry.register(LinkGroupAnnotationAction.name, RTETextBlock.name, new BlockUpdateLinkGroupStrategy());
2818
3498
  ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILD, RTETextBlock.name, new BlockRemoveNodeStrategy());
2819
3499
  ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.APPEND_CHILD_NODES, RTETextBlock.name, new BlockAppendNodesStrategy());
@@ -2830,1034 +3510,389 @@ class RTETextBlock extends RTEBlock {
2830
3510
  })();
2831
3511
 
2832
3512
  /**
2833
- * Insert a new paragraph at the image block special position strategy.
3513
+ * Remove the code block from the value, call this action if want to flush value after action.
2834
3514
  */
2835
- class ImageInsertNewParagraphStrategy extends ActionHandleStrategy {
3515
+ class CodeBlockRemoveSelfStrategy extends BlockDeleteNodeContentStrategy {
2836
3516
  /**
2837
3517
  * @inheritDoc
2838
3518
  */
2839
- handleAction(action, target) {
2840
- action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset, target);
3519
+ handleAction(_action, target) {
3520
+ const node = target.nodes[0];
3521
+ const parent = target.parent;
3522
+ if (parent) {
3523
+ let focusNode = this.getPreviousNode(node);
3524
+ let offset = this.getRTENodeEndOffset(focusNode);
3525
+ if (!focusNode) {
3526
+ focusNode = this.getNextNode(node);
3527
+ offset = 0;
3528
+ }
3529
+ parent.apply(new RemoveChildAction(target));
3530
+ const focusElement = focusNode
3531
+ ? stateEntityRenderingRegistry.getDOMByEntity(focusNode)
3532
+ : null;
3533
+ if (parent.blocks.length === 0) {
3534
+ const defaultParagraph = RTETextBlock.from({
3535
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3536
+ type: 'paragraph',
3537
+ nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '' }],
3538
+ });
3539
+ target.parent.apply(new AppendChildNodesAction([defaultParagraph]));
3540
+ focusNode = defaultParagraph.nodes[0];
3541
+ offset = 0;
3542
+ }
3543
+ this.notifyUpdateSelection(focusNode, focusElement, offset, target);
3544
+ }
2841
3545
  }
2842
3546
  /**
2843
- * Used to split a block of text at a specific position and insert a new paragraph block.
3547
+ * Update the rich text next selection range.
2844
3548
  *
2845
- * @param {RTEImageNode} splitNode - The node that needs to be split into separate blocks.
2846
- * @param {number} startOffsetOfNode - The index or position within the `splitNode` where the block should be broken or split.
2847
- * @param {RTEImageBlock} target - The image block.
2848
- * @returns {Nullable<RTEBlock>} Returns either a new paragraph block or the new block created after splitting the original block.
3549
+ * @param {RTENode} focusNode - The next focus node dto.
3550
+ * @param {Nullable<HTMLElement>} focusElement - The next focus element. The update selection task could run directly when the element is exist.
3551
+ * @param {number} offset - The next focus text offset.
3552
+ * @param {RTECodeBlock} target - The code block dto.
2849
3553
  */
2850
- breakSingleBlock(splitNode, startOffsetOfNode, target) {
2851
- const newParagraph = RTETextBlock.from({
2852
- id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2853
- type: 'paragraph',
2854
- nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '' }],
2855
- });
2856
- if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
2857
- target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
2858
- }
2859
- else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
2860
- target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
3554
+ notifyUpdateSelection(focusNode, focusElement, offset, target) {
3555
+ const targetDom = stateEntityRenderingRegistry.getDOMByEntity(target);
3556
+ if (targetDom) {
3557
+ const nodeSubject = domNodeSubjectFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(targetDom, vegaInternalEventId.VegaInternalRichTextEditorSelectionRangeChange);
3558
+ if (nodeSubject) {
3559
+ changeManager.ChangeManager.notify(nodeSubject, {
3560
+ node: focusNode,
3561
+ updateDirectly: focusElement ? true : false,
3562
+ offset,
3563
+ });
3564
+ }
2861
3565
  }
2862
- else {
2863
- const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
2864
- target.apply(splitBlockAction);
2865
- return splitBlockAction.newBlock;
3566
+ }
3567
+ /**
3568
+ * Get the node content end offset.
3569
+ *
3570
+ * @param {Nullable<RTENode>} node - The RTENode.
3571
+ * @returns {number} - The number value.
3572
+ */
3573
+ getRTENodeEndOffset(node) {
3574
+ if (node && node.type !== 'CODE_BLOCK_NODE') {
3575
+ return node['type'] !== 'IMAGE' ? node['text'].length : 1;
2866
3576
  }
2867
- return newParagraph;
3577
+ return 0;
2868
3578
  }
2869
3579
  }
2870
3580
 
2871
3581
  /**
2872
- * Break the current block after press enter, this action is similar with the SplitBlockWithNodeAction,
2873
- * The SplitBlockWithNodeAction split the current block to two same type blocks, but this action will create new paragraph or list item when break at start or end.
2874
- * The property `newBlock` use to store the new create block if need.
3582
+ * Update the code block content or language action.
2875
3583
  *
2876
- * @example currentBlock.apply(new BreakSingleBlockAction(startContainerNode, startOffset))
3584
+ * @example codeNode.apply(new UpdateCodeBlockAction(content, language))
2877
3585
  */
2878
- class BreakSingleBlockAction extends ModifyContentAction {
2879
- constructor(startContainerNode, startOffset) {
3586
+ class UpdateCodeBlockAction extends ModifyContentAction {
3587
+ constructor(content, language) {
2880
3588
  super();
2881
- this.type = exports.ModifyContentActionType.BREAK_SINGLE_BLOCK;
2882
- this.startContainerNode = startContainerNode;
2883
- this.startOffset = startOffset;
3589
+ this.isFlushable = true;
3590
+ this.type = exports.ModifyContentActionType.UPDATE_CODE_BLOCK;
3591
+ this.content = content;
3592
+ this.language = language;
2884
3593
  }
2885
3594
  }
2886
3595
 
2887
3596
  /**
2888
- * The image block insert line break strategy.
3597
+ * Remove the line break and insert new paragraph after code block.
2889
3598
  */
2890
- class ImageInsertLineBreakStrategy extends ActionHandleStrategy {
3599
+ class SwitchOutFromCodeBlockStrategy extends ActionHandleStrategy {
2891
3600
  /**
2892
- * The image block not support insert the line break node, so invoke the insert new paragraph logic directly.
2893
- *
2894
- * @param {LineBreakSingleBlockAction} action - The action instance.
2895
- * @param {RTEImageBlock} target - The image block.
3601
+ * @inheritDoc
2896
3602
  */
2897
3603
  handleAction(action, target) {
2898
- const insertNewParagraphAction = new BreakSingleBlockAction(action.startContainerNode, action.startOffset);
2899
- target.apply(insertNewParagraphAction);
2900
- const newBlock = insertNewParagraphAction.newBlock;
2901
- if (newBlock) {
2902
- action.lineBreakNode = newBlock.nodes[0];
3604
+ const { content, language } = action;
3605
+ const textArray = content.split('\n');
3606
+ const updateAction = new UpdateCodeBlockAction(textArray.slice(0, textArray.length - 2).join('\n'), language);
3607
+ updateAction.isFlushable = false;
3608
+ target.nodes[0].apply(updateAction);
3609
+ const textBlock = RTETextBlock.from({
3610
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3611
+ type: 'paragraph',
3612
+ nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), text: '', type: 'text' }],
3613
+ });
3614
+ target.parent.apply(new InsertBlocksAfterAction(target, textBlock));
3615
+ // Focus the next text node after value update.
3616
+ const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(target);
3617
+ if (currentNodeDom) {
3618
+ const nodeSubject = domNodeSubjectFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, vegaInternalEventId.VegaInternalRichTextEditorSelectionRangeChange);
3619
+ if (nodeSubject) {
3620
+ changeManager.ChangeManager.notify(nodeSubject, { node: textBlock.nodes[0] });
3621
+ }
2903
3622
  }
2904
3623
  }
2905
3624
  }
2906
3625
 
2907
3626
  /**
2908
- * Insert a line break node into multiple blocks selection at special position strategy.
3627
+ * Update the language or content of code block strategy.
2909
3628
  */
2910
- class ImageInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
3629
+ class UpdateCodeBlockStrategy extends ActionHandleStrategy {
2911
3630
  /**
2912
3631
  * @inheritDoc
2913
3632
  */
2914
3633
  handleAction(action, target) {
2915
- action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
2916
- }
2917
- /**
2918
- * Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
2919
- *
2920
- * @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
2921
- * @param {RTEImageBlock} target - The image block.
2922
- * @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
2923
- */
2924
- lineBreakMultipleBlocks(selectedBlocks, target) {
2925
- const newParagraph = RTETextBlock.from({
2926
- id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2927
- type: 'paragraph',
2928
- nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '\n' }],
2929
- });
2930
- target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
2931
- const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
2932
- if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
2933
- afterNodes.push(new RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', newParagraph));
2934
- }
2935
- newParagraph.apply(new AppendChildNodesAction(afterNodes));
2936
- return newParagraph['nodes'][0];
2937
- }
2938
- /**
2939
- * Concat the child nodes of multiple RTEBlocks if both are not images.
2940
- *
2941
- * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
2942
- * @returns {RTENode[]} Array of connected block nodes
2943
- */
2944
- concatBlocksNodes(blocks) {
2945
- const nodes = [];
2946
- blocks.map((block) => {
2947
- if (block.type !== 'image') {
2948
- nodes.push(...block['nodes']);
2949
- block.parent.apply(new RemoveChildAction(block));
2950
- }
2951
- });
2952
- return nodes;
3634
+ const { content, language } = action;
3635
+ target.language = language;
3636
+ target.text = content;
2953
3637
  }
2954
3638
  }
2955
3639
 
2956
3640
  /**
2957
- * Insert a image node at the special position of image block.
3641
+ * Action to change the selection range
2958
3642
  */
2959
- class ImageBlockInsertImageStrategy extends ActionHandleStrategy {
3643
+ class SelectionChangeAction extends AnnotationAction {
3644
+ constructor(range) {
3645
+ super();
3646
+ this.isFlushable = false;
3647
+ this.range = range;
3648
+ }
2960
3649
  /**
2961
- * @inheritDoc
3650
+ * Converts the action to an annotation
3651
+ *
3652
+ * @returns {SelectionRangeAnnotation} The annotation
2962
3653
  */
2963
- handleAction(action, target) {
2964
- const splitNode = action.splitPointNode;
2965
- const startOffsetOfNode = action.startOffsetOfNode;
2966
- const newImageBlock = action.imageBlockToBeInserted;
2967
- const newImageNodes = newImageBlock.nodes;
2968
- if (target.nodes.length < 1) {
2969
- target.apply(new AppendChildNodesAction(newImageNodes));
2970
- }
2971
- else if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
2972
- target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
2973
- }
2974
- else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
2975
- target.parent.apply(new InsertBlocksBeforeAction(target, newImageBlock));
2976
- }
2977
- else {
2978
- target.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
2979
- target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
2980
- }
3654
+ toAnnotation() {
3655
+ return new SelectionRangeAnnotation(this.range);
2981
3656
  }
2982
3657
  }
2983
3658
 
2984
3659
  /**
2985
- * Insert some text nodes at the behind of the node strategy.
3660
+ * Update the code block node annotation map strategy.
2986
3661
  */
2987
- class BlockInsertNodesAfterNodeStrategy extends BlockReplaceNodeWithNodesStrategy {
3662
+ class CodeNodeSetSelectionRangeAnnotationStrategy extends ActionHandleStrategy {
2988
3663
  /**
2989
3664
  * @inheritDoc
2990
3665
  */
2991
3666
  handleAction(action, target) {
2992
- const referNode = action.referNode;
2993
- const nodes = [referNode, ...action.nodesToBeInserted];
2994
- this.replaceNodeWithNodes(target, referNode, nodes);
3667
+ target.annotationMap.set(exports.InternalAnnotationTypeEnum.SELECTION_RANGE, action.toAnnotation());
2995
3668
  }
2996
3669
  }
2997
3670
 
2998
3671
  /**
2999
- * Image block
3672
+ * RTE code node DTO class.
3000
3673
  */
3001
- class RTEImageBlock extends RTEBlock {
3002
- constructor(id) {
3674
+ class RTECodeBlockNode extends RTENode {
3675
+ constructor(id, content, language, parentBlock) {
3003
3676
  super(id);
3004
- this.type = 'image';
3005
- this.nodes = [];
3677
+ this.type = NodeTypeEnum.CODE_BLOCK_NODE;
3678
+ this.text = '';
3679
+ this.annotationMap = new Map();
3680
+ this.text = content;
3681
+ this.parentBlock = parentBlock;
3682
+ this.language = language;
3006
3683
  }
3007
3684
  /**
3008
- * Converts a VegaRTEImageBlock object into an RTEImageBlock object by mapping nodes and creating annotations.
3685
+ * The code node toJSON method will called internal.
3009
3686
  *
3010
- * @param {VegaRTEImageBlock} block - The block object to be converted.
3011
- * @returns {RTEImageBlock} An instance of `RTEImageBlock`
3012
- */
3013
- static from(block) {
3014
- const imageBlock = new RTEImageBlock(block.id);
3015
- const { annotations } = block;
3016
- imageBlock.nodes = block.nodes.map((image) => RTEImageNode.from(image, imageBlock));
3017
- if (annotations) {
3018
- Object.entries(annotations).forEach(([type, value]) => {
3019
- const item = this.createAnnotationEntity(type, value);
3020
- if (typeGuard.isNonNullable(item)) {
3021
- imageBlock.annotationMap.set(...item);
3022
- }
3023
- });
3024
- }
3025
- return imageBlock;
3026
- }
3027
- /**
3028
- * @inheritDoc
3687
+ * @returns {VegaRTECodeNode} - An object contains content property.
3029
3688
  */
3030
3689
  toJSON() {
3031
- return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
3690
+ return { id: this.id, type: 'text', text: this.text, language: this.language };
3032
3691
  }
3033
3692
  /**
3034
3693
  * @inheritDoc
3035
3694
  */
3036
- isNotEmpty() {
3037
- return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
3695
+ toHtml() {
3696
+ return `<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`;
3038
3697
  }
3039
3698
  /**
3040
3699
  * @inheritDoc
3041
3700
  */
3042
- getLastNode() {
3043
- return this.nodes[this.nodes.length - 1];
3701
+ clone() {
3702
+ return new RTECodeBlockNode(this.id, this.text, this.language, this.parentBlock);
3044
3703
  }
3045
3704
  /**
3046
- * Create a new image block.
3047
- *
3048
- * @returns {RTEImageBlock} - The empty image block.
3705
+ * @inheritDoc
3049
3706
  */
3050
- createNewImageBlock() {
3051
- return new RTEImageBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
3707
+ doAnnotationActionApply(action) {
3708
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3052
3709
  }
3053
3710
  /**
3054
3711
  * @inheritDoc
3055
3712
  */
3056
- clone() {
3057
- const clonedBlock = new RTEImageBlock(this.id);
3058
- clonedBlock.nodes = this.nodes.map((node) => {
3059
- const clonedNode = node.clone();
3060
- clonedNode.parentBlock = clonedBlock;
3061
- return clonedNode;
3062
- });
3063
- clonedBlock.annotationMap = super.cloneAnnotations();
3064
- clonedBlock.parent = this.parent;
3065
- return clonedBlock;
3713
+ doModifyActionApply(action) {
3714
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3066
3715
  }
3067
3716
  }
3068
3717
  (() => {
3069
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEImageBlock.name, new BlockDeleteImageStrategy());
3070
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name, new BlockMergeNodesStrategy());
3071
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILD, RTEImageBlock.name, new BlockRemoveNodeStrategy());
3072
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.APPEND_CHILD_NODES, RTEImageBlock.name, new BlockAppendNodesStrategy());
3073
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new BlockReplaceNodesStrategy());
3074
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
3075
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertNewParagraphStrategy());
3076
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
3077
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
3078
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
3079
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_NODES_BEFORE, RTEImageBlock.name, new BlockInsertNodesBeforeNodeStrategy());
3080
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_NODES_AFTER, RTEImageBlock.name, new BlockInsertNodesAfterNodeStrategy());
3718
+ ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.UPDATE_CODE_BLOCK, RTECodeBlockNode.name, new UpdateCodeBlockStrategy());
3719
+ ActionHandleStrategyRegistry.register(SelectionChangeAction.name, RTECodeBlockNode.name, new CodeNodeSetSelectionRangeAnnotationStrategy());
3081
3720
  })();
3082
3721
 
3083
3722
  /**
3084
- * The list item block block delete text content strategy.
3723
+ * Insert image behind after code block strategy.
3085
3724
  */
3086
- class ListItemDeleteTextContentStrategy extends BlockDeleteTextContentStrategy {
3725
+ class CodeBlockInsertImageStrategy extends ActionHandleStrategy {
3087
3726
  /**
3088
- * Delete the list item content and delete the parent list after delete the last item.
3727
+ * Insert image block at behind of the RTE code block.
3089
3728
  *
3090
- * @param {DeleteBlockContentAction} action - The delete block content action instance.
3091
- * @param {RTEListItemBlock} target - The list item block.
3729
+ * @param {InsertImageToBlockAction} action - The insert image action instance.
3730
+ * @param {RTECodeBlock} target - The code block.
3092
3731
  */
3093
3732
  handleAction(action, target) {
3094
- const listBlock = target.parent;
3095
- this.deleteNodeContent(action, target);
3096
- if (listBlock.blocks.length === 0) {
3097
- listBlock.parent.apply(new RemoveChildAction(listBlock));
3098
- }
3733
+ const imageBlock = action.imageBlockToBeInserted;
3734
+ target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
3099
3735
  }
3100
3736
  }
3101
3737
 
3738
+ exports.CodeLanguage = void 0;
3739
+ (function (CodeLanguage) {
3740
+ CodeLanguage["CSS"] = "css";
3741
+ CodeLanguage["HTML"] = "html";
3742
+ CodeLanguage["JavaScript"] = "js";
3743
+ CodeLanguage["JSX"] = "jsx";
3744
+ CodeLanguage["Plain Text"] = "plainText";
3745
+ CodeLanguage["TypeScript"] = "ts";
3746
+ CodeLanguage["TSX"] = "tsx";
3747
+ })(exports.CodeLanguage || (exports.CodeLanguage = {}));
3748
+
3102
3749
  /**
3103
- * Remove list item child node strategy.
3750
+ * The code block DTO class.
3104
3751
  */
3105
- class ListItemRemoveNodeStrategy extends ActionHandleStrategy {
3752
+ class RTECodeBlock extends RTEBlock {
3753
+ constructor(id, content, language) {
3754
+ super(id);
3755
+ this.type = 'code-block';
3756
+ this.nodes = [new RTECodeBlockNode(`${id}-1`, content, language, this)];
3757
+ }
3106
3758
  /**
3107
- * Remove child node from the list item, remove the list item if the list item is empty.
3759
+ * Converts a VegaRTECodeBlock into an RTECodeBlock.
3108
3760
  *
3109
- * @param {RemoveChildAction} action - The remove child action instance.
3110
- * @param {RTEListItemBlock} target - The list item block.
3761
+ * @param {VegaRTECodeBlock} block - The block object
3762
+ * @returns {RTECodeBlock} A RTECodeBlock class
3111
3763
  */
3112
- handleAction(action, target) {
3113
- target.nodes = target.nodes.filter((node) => node !== action.entityToBeRemoved);
3114
- if (target.nodes.length === 0 && (!target.children || !target.children.length)) {
3115
- target.parent.apply(new RemoveChildAction(target));
3116
- }
3764
+ static from(block) {
3765
+ return new RTECodeBlock(block.id, block.content, block.language);
3117
3766
  }
3118
- }
3119
-
3120
- /**
3121
- * Remove list item nest list block strategy.
3122
- */
3123
- class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
3124
3767
  /**
3125
- * Remove the nest list block from the list item, clear the property children when the children is empty.
3126
- *
3127
- * @param {RemoveNestListAction} action - The action instance.
3128
- * @param {RTEListItemBlock} target - The list item block.
3768
+ * @inheritDoc
3129
3769
  */
3130
- handleAction(action, target) {
3131
- if (target.children) {
3132
- if (target.children.length > 1) {
3133
- target.children = target.children.filter((child) => child !== action.nestListBlockToBeRemoved);
3134
- }
3135
- else {
3136
- target.children = undefined;
3137
- }
3138
- }
3770
+ toJSON() {
3771
+ const { language, text } = this.nodes[0];
3772
+ return {
3773
+ id: this.id,
3774
+ type: 'code-block',
3775
+ content: text,
3776
+ language,
3777
+ };
3139
3778
  }
3140
- }
3141
-
3142
- /**
3143
- * Replace list item nest list strategy.
3144
- */
3145
- class ListItemReplaceNestListStrategy extends ActionHandleStrategy {
3146
3779
  /**
3147
3780
  * @inheritDoc
3148
3781
  */
3149
- handleAction(action, target) {
3150
- action.newList.forEach((listBlock) => {
3151
- listBlock.parent = target;
3152
- });
3153
- target.children = action.newList;
3782
+ toHtml() {
3783
+ const { language = exports.CodeLanguage['Plain Text'] } = this.nodes[0];
3784
+ return `<pre data-language="${language}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.nodes.map((node) => node.toHtml())}</pre>`;
3154
3785
  }
3155
- }
3156
-
3157
- /**
3158
- * Insert new paragraph into current list item block at special position.
3159
- */
3160
- class ListItemInsertNewParagraphStrategy extends ActionHandleStrategy {
3161
3786
  /**
3162
3787
  * @inheritDoc
3163
3788
  */
3164
- handleAction(action, target) {
3165
- action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset, target);
3789
+ clone() {
3790
+ const cloneCodeBlock = RTECodeBlock.from(this.toJSON());
3791
+ cloneCodeBlock.parent = this.parent;
3792
+ return cloneCodeBlock;
3166
3793
  }
3167
3794
  /**
3168
- * Breaks a single list item block at a specific position.
3795
+ * Apply action to block
3169
3796
  *
3170
- * @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
3171
- * @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
3172
- * @param {RTEListItemBlock} target - The list item block.
3173
- * @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
3174
- * position is at the end of the `splitNode`, or it returns the result of splitting the block at the
3175
- * caret position if it is neither at the start nor at the end.
3797
+ * @param {ModifyContentAction} action - modify content action.
3176
3798
  */
3177
- breakSingleListItemBlock(splitNode, startOffsetOfNode, target) {
3178
- const newListItem = target.createNewListItem();
3179
- const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
3180
- newListItem.apply(new AppendChildNodesAction([newBreakNode]));
3181
- if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
3182
- return this.breakListItemAtEnd(newListItem, target);
3799
+ apply(action) {
3800
+ if (action instanceof ModifyContentAction) {
3801
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3183
3802
  }
3184
- else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
3185
- target.parent.apply(new InsertBlocksBeforeAction(target, newListItem));
3803
+ if (action.isFlushable) {
3804
+ const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
3805
+ if (domNode) {
3806
+ const nodeSubject = domNodeSubjectFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
3807
+ if (nodeSubject) {
3808
+ changeManager.ChangeManager.notify(nodeSubject, {});
3809
+ }
3810
+ }
3186
3811
  }
3187
- else {
3188
- const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
3189
- target.apply(splitBlockAction);
3190
- return splitBlockAction.newBlock;
3191
- }
3192
- return newListItem;
3193
- }
3194
- /**
3195
- * Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
3196
- *
3197
- * @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
3198
- * @param {RTEListItemBlock} target - The list item block.
3199
- * @returns {RTEBlock} Returns a `RTEBlock`.
3200
- */
3201
- breakListItemAtEnd(newListItem, target) {
3202
- const lastItem = target.parent.blocks[target.parent.blocks.length - 1];
3203
- const currentItemIsEmpty = target.nodes.length === 1 && target.nodes[0].isEmpty();
3204
- if (target === lastItem && currentItemIsEmpty) {
3205
- const parentParent = target.parent.parent;
3206
- if (parentParent['type'] !== 'list-item') {
3207
- const newParagraph = RTETextBlock.from({
3208
- id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3209
- type: 'paragraph',
3210
- nodes: [],
3211
- });
3212
- newParagraph.apply(new AppendChildNodesAction(newListItem.nodes));
3213
- parentParent.apply(new InsertBlocksAfterAction(target.parent, newParagraph));
3214
- target.parent.apply(new RemoveChildAction(target));
3215
- return newParagraph;
3216
- }
3217
- else {
3218
- parentParent.parent.apply(new InsertBlocksAfterAction(parentParent, newListItem));
3219
- target.parent.apply(new RemoveChildAction(target));
3220
- }
3221
- }
3222
- else {
3223
- target.parent.apply(new InsertBlocksAfterAction(target, newListItem));
3224
- }
3225
- return newListItem;
3226
- }
3227
- /**
3228
- * Copy the inline style to new node
3229
- *
3230
- * @param {RTETextNode} needCopedNode - The node that needed to be copied to
3231
- * @returns {RTETextNode} Returns a `RTETextNode`.
3232
- */
3233
- copyInlineStyleToNewNode(needCopedNode) {
3234
- const textNode = needCopedNode.cloneWithText('');
3235
- // The link annotation doesn't need to inherit
3236
- textNode.annotationMap.delete(exports.NodeAnnotationTypeEnum.LINK);
3237
- return textNode;
3238
- }
3239
- }
3240
-
3241
- /**
3242
- * Insert image node to list item block strategy.
3243
- */
3244
- class ListItemInsertImageStrategy extends ActionHandleStrategy {
3245
- /**
3246
- * The image node can not insert into list item block, so insert image after parent list block.
3247
- *
3248
- * @param {InsertImageToBlockAction} action - The action instance.
3249
- * @param {RTEListItemBlock} target - The list item block.
3250
- */
3251
- handleAction(action, target) {
3252
- target.parent.apply(action);
3253
- }
3254
- }
3255
-
3256
- /**
3257
- * List item block
3258
- */
3259
- class RTEListItemBlock extends RTETextBlock {
3260
- constructor(id, children) {
3261
- super(id, 'list-item');
3262
- this.children = [];
3263
- this.children = children;
3264
- }
3265
- /**
3266
- * Converts a VegaRTEListItemBlock object to an RTEListItemBlock
3267
- *
3268
- * @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
3269
- * @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
3270
- */
3271
- static from(block) {
3272
- const listItemBlock = new RTEListItemBlock(block.id);
3273
- listItemBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock));
3274
- if (block.children) {
3275
- listItemBlock.children = block.children.map((child) => {
3276
- const listBlock = RTEListBlock.from(child);
3277
- listBlock.parent = listItemBlock;
3278
- return listBlock;
3279
- });
3280
- }
3281
- const { annotations } = block;
3282
- if (annotations) {
3283
- Object.entries(annotations).forEach(([type, value]) => {
3284
- const item = this.createAnnotationEntity(type, value);
3285
- if (typeGuard.isNonNullable(item)) {
3286
- listItemBlock.annotationMap.set(...item);
3287
- }
3288
- });
3289
- }
3290
- return listItemBlock;
3291
- }
3292
- /**
3293
- * @inheritDoc
3294
- */
3295
- toJSON() {
3296
- var _a;
3297
- return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
3298
- }
3299
- /**
3300
- * @inheritDoc
3301
- */
3302
- cloneWithNodes(nodes) {
3303
- const block = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
3304
- block.nodes = [];
3305
- block.apply(new AppendChildNodesAction(nodes));
3306
- return block;
3307
- }
3308
- /**
3309
- * @inheritDoc
3310
- */
3311
- getLastNode() {
3312
- if (this.children && this.children.length > 0) {
3313
- const childListBlock = this.children[this.children.length - 1];
3314
- return childListBlock.getLastNode();
3315
- }
3316
- return super.getLastNode();
3317
- }
3318
- /**
3319
- * Create a new list item block.
3320
- *
3321
- * @returns {RTEListItemBlock} - A list item block.
3322
- */
3323
- createNewListItem() {
3324
- return new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
3325
- }
3326
- /**
3327
- * @inheritDoc
3328
- */
3329
- clone() {
3330
- var _a;
3331
- const block = new RTEListItemBlock(this.id);
3332
- block.nodes = this.nodes.map((node) => {
3333
- const clonedNode = node.clone();
3334
- clonedNode.parentBlock = block;
3335
- return clonedNode;
3336
- });
3337
- block.annotationMap = super.cloneAnnotations();
3338
- block.children = (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((child) => {
3339
- const clonedChild = child.clone();
3340
- clonedChild.parent = block;
3341
- return clonedChild;
3342
- });
3343
- block.parent = this.parent;
3344
- return block;
3345
- }
3346
- }
3347
- (() => {
3348
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEListItemBlock.name, new ListItemDeleteTextContentStrategy());
3349
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new BlockInsertLineBreakStrategy());
3350
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
3351
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILD, RTEListItemBlock.name, new ListItemRemoveNodeStrategy());
3352
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
3353
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.APPEND_CHILD_NODES, RTEListItemBlock.name, new BlockAppendNodesStrategy());
3354
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new BlockSplitWithTextNodeStrategy());
3355
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new BlockReplaceNodesStrategy());
3356
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
3357
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new BlockMergeNodesStrategy());
3358
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new ListItemInsertNewParagraphStrategy());
3359
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
3360
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_NODES_BEFORE, RTEListItemBlock.name, new BlockInsertNodesBeforeNodeStrategy());
3361
- })();
3362
-
3363
- /**
3364
- * Insert block array at the front of the block strategy.
3365
- */
3366
- class BlockInsertBlocksBeforeStrategy extends ActionHandleStrategy {
3367
- /**
3368
- * @inheritDoc
3369
- */
3370
- handleAction(action, target) {
3371
- this.replaceBlockWithBlocks(target, action.referBlock, [
3372
- ...action.blocksToBeInserted,
3373
- action.referBlock,
3374
- ]);
3375
- }
3376
- /**
3377
- * Replaces a specific block with an array of blocks within a RTEContentBlock array.
3378
- *
3379
- * @param {RTEListBlock|VegaRTEContent} target - The list block or the VegaRTEContent instance.
3380
- * @param {RTEBlock} referBlock - Used as a reference block to identify the block that needs to be replaced in the `blocks` array.
3381
- * @param {RTEBlock[]} blocks - An array of RTEBlock objects that you want to replace the `referBlock` with in the `blocks` array.
3382
- */
3383
- replaceBlockWithBlocks(target, referBlock, blocks) {
3384
- if (target.blocks) {
3385
- blocks.forEach((block) => {
3386
- block.parent = target;
3387
- });
3388
- const arrayFixed = target.blocks;
3389
- target.blocks = arrayFixed.flatMap((block) => {
3390
- if (block === referBlock) {
3391
- return blocks;
3392
- }
3393
- else {
3394
- return block;
3395
- }
3396
- });
3397
- }
3398
- }
3399
- }
3400
-
3401
- /**
3402
- * Insert block array at the behind of the block strategy.
3403
- */
3404
- class BlockInsertBlocksAfterStrategy extends BlockInsertBlocksBeforeStrategy {
3405
- /**
3406
- * @inheritDoc
3407
- */
3408
- handleAction(action, target) {
3409
- this.replaceBlockWithBlocks(target, action.referBlock, [
3410
- action.referBlock,
3411
- ...action.blocksToBeInserted,
3412
- ]);
3413
- }
3414
- }
3415
-
3416
- /**
3417
- * Append new block array to list block or VegaRTEContent instance strategy.
3418
- */
3419
- class BlockAppendBlocksStrategy extends ActionHandleStrategy {
3420
- /**
3421
- * @inheritDoc
3422
- */
3423
- handleAction(action, target) {
3424
- const newBlocks = action.entityToBeAppended;
3425
- if (target.blocks) {
3426
- newBlocks.forEach((block) => {
3427
- block.parent = target;
3428
- });
3429
- const arrayFixed = target.blocks;
3430
- target.blocks = arrayFixed.concat(newBlocks);
3431
- }
3432
- }
3433
- }
3434
-
3435
- /**
3436
- * Delete the nest list block action
3437
- *
3438
- * @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
3439
- */
3440
- class RemoveNestListAction extends ModifyContentAction {
3441
- constructor(childList) {
3442
- super();
3443
- this.type = exports.ModifyContentActionType.DELETE_NEST_LIST;
3444
- this.nestListBlockToBeRemoved = childList;
3445
- }
3446
- }
3447
-
3448
- /**
3449
- * List block or VegaRTEContent remove child block strategy.
3450
- */
3451
- class BlockRemoveChildBlockStrategy extends ActionHandleStrategy {
3452
- /**
3453
- * @inheritDoc
3454
- */
3455
- handleAction(action, target) {
3456
- const blockToBeRemoved = action.entityToBeRemoved;
3457
- if (target.blocks) {
3458
- target.blocks = target.blocks.filter((block) => block !== blockToBeRemoved);
3459
- }
3460
- }
3461
- }
3462
-
3463
- /**
3464
- * List remove list item strategy.
3465
- */
3466
- class ListRemoveListItemStrategy extends BlockRemoveChildBlockStrategy {
3467
- /**
3468
- * Remove the list item, check the list item and remove self if the list item is empty.
3469
- *
3470
- * @param {RemoveChildAction} action - The remove action instance.
3471
- * @param {RTEListBlock} target - The list block.
3472
- */
3473
- handleAction(action, target) {
3474
- super.handleAction(action, target);
3475
- const parent = target.parent;
3476
- if (target.blocks.length === 0 && parent) {
3477
- // The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
3478
- if (parent['type'] === 'list-item') {
3479
- parent.apply(new RemoveNestListAction(target));
3480
- }
3481
- else {
3482
- parent.apply(new RemoveChildAction(target));
3483
- }
3484
- }
3485
- }
3486
- }
3487
-
3488
- /**
3489
- * Convert the selected blocks to list strategy.
3490
- */
3491
- class ListTransformToListStrategy extends ActionHandleStrategy {
3492
- /**
3493
- * @inheritDoc
3494
- */
3495
- handleAction(action, target) {
3496
- const selectedBlocks = action.selectedBlocks;
3497
- const bulletList = target.parent.createList(action.listType);
3498
- const isSameList = selectedBlocks.every((block) => block.parent === target);
3499
- if (isSameList) {
3500
- // Select one or more list items belonging to the same list, and all items in this list should be updated
3501
- bulletList.apply(new AppendChildNodesAction(target.blocks));
3502
- target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
3503
- target.parent.apply(new RemoveChildAction(target));
3504
- selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new SyncUpSelectionAction())));
3505
- }
3506
- else {
3507
- const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
3508
- bulletList.apply(new AppendChildNodesAction(listItems));
3509
- target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
3510
- action.selectedBlocks.forEach((block) => {
3511
- block.parent.apply(new RemoveChildAction(block));
3512
- });
3513
- if (target.blocks.length === 0) {
3514
- target.parent.apply(new RemoveChildAction(target));
3515
- }
3516
- }
3517
- }
3518
- }
3519
-
3520
- /**
3521
- * Convert the selected list block to paragraph strategy.
3522
- */
3523
- class ListTransformToParagraphStrategy extends ActionHandleStrategy {
3524
- /**
3525
- * @inheritDoc
3526
- */
3527
- handleAction(action, target) {
3528
- let isSelectedFirstBlock = false;
3529
- let isSelectedLastBlock = false;
3530
- const selectedBlocks = action.selectedBlocks;
3531
- const currentParagraph = selectedBlocks.map((block) => {
3532
- block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
3533
- if (block === target.blocks[0])
3534
- isSelectedFirstBlock = true;
3535
- if (block === target.blocks[target.blocks.length - 1])
3536
- isSelectedLastBlock = true;
3537
- return this.toParagraph(block);
3538
- });
3539
- if (isSelectedFirstBlock) {
3540
- target.parent.apply(new InsertBlocksBeforeAction(target, ...currentParagraph));
3541
- }
3542
- else if (isSelectedLastBlock) {
3543
- target.parent.apply(new InsertBlocksAfterAction(target, ...currentParagraph));
3544
- }
3545
- else {
3546
- const startIndex = target.blocks.indexOf(selectedBlocks[0]);
3547
- const lastIndex = target.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
3548
- const firstBulletList = target.parent.createList(target.type);
3549
- firstBulletList.apply(new AppendChildNodesAction(target.blocks.slice(0, startIndex)));
3550
- const lastBulletList = target.parent.createList(target.type);
3551
- lastBulletList.apply(new AppendChildNodesAction(target.blocks.slice(lastIndex + 1)));
3552
- target.parent.apply(new InsertBlocksBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
3553
- target.parent.apply(new RemoveChildAction(target));
3554
- }
3555
- selectedBlocks.map((block) => {
3556
- target.apply(new RemoveChildAction(block));
3557
- });
3558
- if (target.blocks.length === 0) {
3559
- target.parent.apply(new RemoveChildAction(target));
3560
- }
3561
- }
3562
- /**
3563
- * Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
3564
- *
3565
- * @param {RTEListItemBlock} block - The block that will be covered
3566
- * @returns {RTETextBlock} Returns a `RTETextBlock`.
3567
- */
3568
- toParagraph(block) {
3569
- const textBlock = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), 'paragraph');
3570
- textBlock.apply(new AppendChildNodesAction(block['nodes']));
3571
- textBlock['annotationMap'] = block['annotationMap'];
3572
- return textBlock;
3573
- }
3574
- }
3575
-
3576
- /**
3577
- * Insert image to list block strategy.
3578
- */
3579
- class ListInsertImageStrategy extends ActionHandleStrategy {
3580
- /**
3581
- * Insert image block at behind of the list item block.
3582
- *
3583
- * @param {InsertImageToBlockAction} action - The insert image action instance.
3584
- * @param {RTEListBlock} target - The list block.
3585
- */
3586
- handleAction(action, target) {
3587
- const imageBlock = action.imageBlockToBeInserted;
3588
- if (target.parent['type'] !== 'list-item') {
3589
- target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
3590
- }
3591
- else {
3592
- target.parent.apply(action);
3593
- }
3594
- }
3595
- }
3596
-
3597
- /**
3598
- * List block
3599
- */
3600
- class RTEListBlock extends RTEBlock {
3601
- constructor(id, type) {
3602
- super(id);
3603
- this.type = 'bullet-list';
3604
- this.blocks = [];
3605
- this.type = type;
3606
- }
3607
- /**
3608
- * Converts a VegaRTEListBlock object to an RTEListBlock
3609
- *
3610
- * @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
3611
- * @returns {RTEListBlock} Return an instance of `RTEListBlock`
3612
- */
3613
- static from(block) {
3614
- const listBlock = new RTEListBlock(block.id, block.type);
3615
- listBlock.blocks = block.blocks.map((item) => {
3616
- const listItemBlock = RTEListItemBlock.from(item);
3617
- listItemBlock.parent = listBlock;
3618
- return listItemBlock;
3619
- });
3620
- return listBlock;
3621
- }
3622
- /**
3623
- * @inheritDoc
3624
- */
3625
- toJSON() {
3626
- return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
3627
3812
  }
3628
3813
  /**
3629
3814
  * @inheritDoc
3630
3815
  */
3631
3816
  isNotEmpty() {
3632
- return this.blocks.length > 0;
3817
+ return !!this.nodes.length;
3633
3818
  }
3634
3819
  /**
3635
3820
  * @inheritDoc
3636
3821
  */
3637
3822
  getLastNode() {
3638
- return this.blocks[this.blocks.length - 1].getLastNode();
3639
- }
3640
- /**
3641
- * @inheritDoc
3642
- */
3643
- clone() {
3644
- const clonedListBlock = new RTEListBlock(this.id, this.type);
3645
- clonedListBlock.blocks = this.blocks.map((item) => {
3646
- const clonedListItemBlock = item.clone();
3647
- clonedListItemBlock.parent = clonedListBlock;
3648
- return clonedListItemBlock;
3649
- });
3650
- clonedListBlock.annotationMap = super.cloneAnnotations();
3651
- clonedListBlock.parent = this.parent;
3652
- return clonedListBlock;
3653
- }
3654
- }
3655
- (() => {
3656
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILD, RTEListBlock.name, new ListRemoveListItemStrategy());
3657
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_BLOCKS_BEFORE, RTEListBlock.name, new BlockInsertBlocksBeforeStrategy());
3658
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_BLOCKS_AFTER, RTEListBlock.name, new BlockInsertBlocksAfterStrategy());
3659
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.APPEND_CHILD_NODES, RTEListBlock.name, new BlockAppendBlocksStrategy());
3660
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
3661
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
3662
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
3663
- })();
3664
-
3665
- /**
3666
- * Class representing the content state of the rich text editor.
3667
- */
3668
- class VegaRTEContent {
3669
- constructor(blocks) {
3670
- blocks.forEach((block) => {
3671
- block.parent = this;
3672
- });
3673
- this.blocks = blocks;
3674
- }
3675
- /**
3676
- * Converts a JSON array of blocks to a class array of RTEContentBlock.
3677
- *
3678
- * @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
3679
- * @returns {VegaRTEContent} The converted array of RTEContentBlock.
3680
- */
3681
- static fromJSON(value) {
3682
- const blocks = value.map((block) => {
3683
- switch (block.type) {
3684
- case 'paragraph':
3685
- case 'title':
3686
- case 'subtitle':
3687
- case 'heading-1':
3688
- case 'heading-2':
3689
- case 'heading-3': {
3690
- return RTETextBlock.from(block);
3691
- }
3692
- case 'image':
3693
- return RTEImageBlock.from(block);
3694
- case 'bullet-list':
3695
- case 'number-list':
3696
- return RTEListBlock.from(block);
3697
- default: {
3698
- throw new Error(`[Vega] Unknown block type: ${block.type}`);
3699
- }
3700
- }
3701
- });
3702
- return new VegaRTEContent(blocks);
3703
- }
3704
- /**
3705
- * Create an empty content state
3706
- *
3707
- * @returns {VegaRTEContent} An empty content state
3708
- */
3709
- static createEmptyContent() {
3710
- return VegaRTEContent.fromJSON([
3711
- {
3712
- id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3713
- type: 'paragraph',
3714
- nodes: [
3715
- {
3716
- id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3717
- type: 'text',
3718
- text: '',
3719
- },
3720
- ],
3721
- },
3722
- ]);
3823
+ return this.nodes[0];
3723
3824
  }
3724
3825
  /**
3725
- * Clones the content state.
3826
+ * The code block is selected or not.
3726
3827
  *
3727
- * @param {boolean} deep - If true, performs a deep clone of the content state.
3728
- * @returns {VegaRTEContent} The cloned content state.
3828
+ * @returns {boolean} - The boolean result.
3729
3829
  */
3730
- clone(deep = false) {
3731
- return deep
3732
- ? new VegaRTEContent(this.blocks.map((block) => block.clone()))
3733
- : new VegaRTEContent([...this.blocks]);
3734
- }
3735
- /**
3736
- * Converts the content state to a JSON array of blocks.
3737
- *
3738
- * @returns {VegaRTEContentBlock[]} The JSON array of blocks.
3739
- */
3740
- toJSON() {
3741
- return this.blocks.map((block) => block.toJSON());
3742
- }
3743
- /**
3744
- * Internal method to add the block item, remove the block item
3745
- *
3746
- * @param {ModifyContentAction} action - Modify content action
3747
- */
3748
- apply(action) {
3749
- ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3750
- }
3751
- /**
3752
- * Convert text to list.
3753
- *
3754
- * @param {RTETextBlock} block - block
3755
- * @returns {RTEListItemBlock} list item block dto.
3756
- */
3757
- toListItem(block) {
3758
- block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
3759
- const listItemBlock = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
3760
- listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
3761
- listItemBlock['annotationMap'] = block['annotationMap'];
3762
- return listItemBlock;
3763
- }
3764
- /**
3765
- * create list.
3766
- *
3767
- * @param {ListType} type - type
3768
- * @returns {RTEListBlock} list block dto.
3769
- */
3770
- createList(type) {
3771
- return new RTEListBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), type);
3772
- }
3773
- /**
3774
- * Finds a node by its ID in the content.
3775
- *
3776
- * @param {string} id - The ID of the node to find.
3777
- * @returns {Nullable<RTENode>} The found node or null if not found.
3778
- */
3779
- findNodeById(id) {
3780
- return this.findNodeInBlocksById(id, this.blocks);
3781
- }
3782
- /**
3783
- * Recursively searches for a node by its ID in the given blocks.
3784
- *
3785
- * @param {string} id - The ID of the node to find.
3786
- * @param {RTEContentBlock[]} blocks - The blocks to search within.
3787
- * @returns {Nullable<RTENode>} The found node or null if not found.
3788
- */
3789
- findNodeInBlocksById(id, blocks) {
3790
- for (const block of blocks) {
3791
- if ('nodes' in block) {
3792
- for (const node of block.nodes) {
3793
- if (node.id === id) {
3794
- return node;
3795
- }
3796
- }
3797
- }
3798
- if (block instanceof RTEListItemBlock && block.children) {
3799
- for (const cBlock of block.children) {
3800
- const foundNode = this.findNodeInBlocksById(id, cBlock.blocks);
3801
- if (foundNode) {
3802
- return foundNode;
3803
- }
3804
- }
3805
- }
3806
- if (block instanceof RTEListBlock && block.blocks) {
3807
- const foundNode = this.findNodeInBlocksById(id, block.blocks);
3808
- if (foundNode) {
3809
- return foundNode;
3810
- }
3811
- }
3812
- }
3813
- return null;
3830
+ isSelected() {
3831
+ return this.nodes[0].annotationMap.has(exports.InternalAnnotationTypeEnum.SELECTION_RANGE);
3814
3832
  }
3815
3833
  }
3816
3834
  (() => {
3817
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILD, VegaRTEContent.name, new BlockRemoveChildBlockStrategy());
3818
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.APPEND_CHILD_NODES, VegaRTEContent.name, new BlockAppendBlocksStrategy());
3819
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_BLOCKS_BEFORE, VegaRTEContent.name, new BlockInsertBlocksBeforeStrategy());
3820
- ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_BLOCKS_AFTER, VegaRTEContent.name, new BlockInsertBlocksAfterStrategy());
3835
+ ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CODE_BLOCK, RTECodeBlock.name, new CodeBlockRemoveSelfStrategy());
3836
+ ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILD, RTECodeBlock.name, new BlockRemoveNodeStrategy());
3837
+ ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.SWITCH_OUT_FROM_CODE_BLOCK, RTECodeBlock.name, new SwitchOutFromCodeBlockStrategy());
3838
+ ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTECodeBlock.name, new CodeBlockInsertImageStrategy());
3821
3839
  })();
3840
+ RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element';
3822
3841
 
3842
+ exports.ActionHandleStrategy = ActionHandleStrategy;
3843
+ exports.ActionHandleStrategyRegistry = ActionHandleStrategyRegistry;
3823
3844
  exports.AnnotationAction = AnnotationAction;
3824
3845
  exports.AppendChildNodesAction = AppendChildNodesAction;
3825
3846
  exports.BlockAnnotation = BlockAnnotation;
3847
+ exports.BlockAppendNodesStrategy = BlockAppendNodesStrategy;
3848
+ exports.BlockDeleteNodeContentStrategy = BlockDeleteNodeContentStrategy;
3849
+ exports.BlockDeleteTextContentStrategy = BlockDeleteTextContentStrategy;
3850
+ exports.BlockInsertLineBreakStrategy = BlockInsertLineBreakStrategy;
3851
+ exports.BlockInsertLineBreakWithBlocksStrategy = BlockInsertLineBreakWithBlocksStrategy;
3852
+ exports.BlockInsertNodesBeforeNodeStrategy = BlockInsertNodesBeforeNodeStrategy;
3853
+ exports.BlockMergeNodesStrategy = BlockMergeNodesStrategy;
3854
+ exports.BlockRemoveNodeStrategy = BlockRemoveNodeStrategy;
3855
+ exports.BlockReplaceNodeWithNodesStrategy = BlockReplaceNodeWithNodesStrategy;
3856
+ exports.BlockReplaceNodesStrategy = BlockReplaceNodesStrategy;
3857
+ exports.BlockSplitWithTextNodeStrategy = BlockSplitWithTextNodeStrategy;
3858
+ exports.BlockUpdateHorizontalAlignmentStrategy = BlockUpdateHorizontalAlignmentStrategy;
3826
3859
  exports.BoldAnnotation = BoldAnnotation;
3827
3860
  exports.BoldAnnotationAction = BoldAnnotationAction;
3828
- exports.BreakSingleBlockAction = BreakSingleBlockAction;
3829
3861
  exports.ClearFormattingAnnotationAction = ClearFormattingAnnotationAction;
3830
3862
  exports.CodeAnnotationAction = CodeAnnotationAction;
3831
- exports.HorizontalAlignmentAnnotation = HorizontalAlignmentAnnotation;
3863
+ exports.CustomAttributeAnnotation = CustomAttributeAnnotation;
3864
+ exports.CustomClassAnnotation = CustomClassAnnotation;
3865
+ exports.CustomStyleAnnotation = CustomStyleAnnotation;
3866
+ exports.HorizontalAlignmentAnnotationAction = HorizontalAlignmentAnnotationAction;
3832
3867
  exports.ImageAnnotation = ImageAnnotation;
3833
- exports.IndentAnnotation = IndentAnnotation;
3868
+ exports.IndentAnnotationAction = IndentAnnotationAction;
3834
3869
  exports.InsertBlocksAfterAction = InsertBlocksAfterAction;
3835
3870
  exports.InsertBlocksBeforeAction = InsertBlocksBeforeAction;
3836
- exports.ItalicAnnotation = ItalicAnnotation;
3871
+ exports.ItalicAnnotationAction = ItalicAnnotationAction;
3837
3872
  exports.LinkAnnotationAction = LinkAnnotationAction;
3838
3873
  exports.MergeTwoBlocksNodesAction = MergeTwoBlocksNodesAction;
3839
3874
  exports.ModifyContentAction = ModifyContentAction;
3840
3875
  exports.NodeAnnotation = NodeAnnotation;
3841
3876
  exports.RTEBlock = RTEBlock;
3842
- exports.RTEImageBlock = RTEImageBlock;
3877
+ exports.RTECodeBlock = RTECodeBlock;
3878
+ exports.RTECodeBlockNode = RTECodeBlockNode;
3843
3879
  exports.RTEImageNode = RTEImageNode;
3844
- exports.RTEListBlock = RTEListBlock;
3845
- exports.RTEListItemBlock = RTEListItemBlock;
3846
3880
  exports.RTENode = RTENode;
3847
3881
  exports.RTETextBlock = RTETextBlock;
3848
3882
  exports.RTETextNode = RTETextNode;
3849
3883
  exports.RTE_TEXT_COLORS = RTE_TEXT_COLORS;
3850
3884
  exports.RemoveChildAction = RemoveChildAction;
3851
3885
  exports.ReplaceChildNodesAction = ReplaceChildNodesAction;
3852
- exports.SelectionRangeAnnotation = SelectionRangeAnnotation;
3886
+ exports.SelectionChangeAction = SelectionChangeAction;
3853
3887
  exports.SplitBlockWithNodeAction = SplitBlockWithNodeAction;
3854
- exports.StrikethroughAnnotation = StrikethroughAnnotation;
3888
+ exports.StrikethroughAnnotationAction = StrikethroughAnnotationAction;
3889
+ exports.SyncUpSelectionAction = SyncUpSelectionAction;
3855
3890
  exports.TextColorAnnotation = TextColorAnnotation;
3856
3891
  exports.TextSplittableAction = TextSplittableAction;
3857
3892
  exports.TextStyleAnnotation = TextStyleAnnotation;
3858
3893
  exports.TextStyleAnnotationAction = TextStyleAnnotationAction;
3859
- exports.UnderlineAnnotation = UnderlineAnnotation;
3894
+ exports.UnderlineAnnotationAction = UnderlineAnnotationAction;
3895
+ exports.UpdateCodeBlockAction = UpdateCodeBlockAction;
3860
3896
  exports.UpdateTextAction = UpdateTextAction;
3861
- exports.VegaRTEContent = VegaRTEContent;
3862
3897
  exports.ZERO_WIDTH_SPACE = ZERO_WIDTH_SPACE;
3863
3898
  exports.stateEntityRenderingRegistry = stateEntityRenderingRegistry;