@globalpayments/vega 2.57.1 → 2.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (965) hide show
  1. package/dist/cjs/{app-globals-26e2fe1e.js → app-globals-a8f5e755.js} +25 -12
  2. package/dist/cjs/{brand-switch-state-controller-slimmer-5efa1b24.js → brand-switch-state-controller-slimmer-b83a4596.js} +1 -1
  3. package/dist/cjs/{child-nodes-event-prevent-slimmer-96240a0e.js → child-nodes-event-prevent-slimmer-5df43771.js} +1 -1
  4. package/dist/cjs/{child-nodes-notify-observer-slimmer-30ba81ac.js → child-nodes-notify-observer-slimmer-34ac3bfc.js} +1 -1
  5. package/dist/cjs/{code-block-7650c868.js → code-block-4bfae76d.js} +2128 -990
  6. package/dist/cjs/{component-value-history-controller-slimmer.abstract-a6e4e5bc.js → component-value-history-controller-slimmer.abstract-34f4577a.js} +112 -54
  7. package/dist/cjs/content-state-0da174e0.js +3692 -0
  8. package/dist/cjs/{dark-mode-state-controller-slimmer-add5d8a8.js → dark-mode-state-controller-slimmer-17022f93.js} +1 -1
  9. package/dist/cjs/{dark-mode-style-controller-f9a32d68.js → dark-mode-style-controller-ab0703e1.js} +1 -1
  10. package/dist/cjs/{deprecated-property-slimmer-4f15005f.js → deprecated-property-slimmer-1eb8f031.js} +1 -1
  11. package/dist/cjs/{design-token-e771bb16.js → design-token-deb195e9.js} +1 -1
  12. package/dist/cjs/{dom-node-subject-factory-769dd00f.js → dom-node-subject-factory-bad99695.js} +1 -1
  13. package/dist/cjs/{dom-node-subject-observer-factory-5aa4cc83.js → dom-node-subject-observer-factory-df6e6df0.js} +1 -1
  14. package/dist/cjs/{element-appender-slimmer-7f98d16b.js → element-appender-slimmer-299039f1.js} +7 -7
  15. package/dist/cjs/{event-emit-slimmer-6154c759.js → event-emit-slimmer-efc70b94.js} +3 -3
  16. package/dist/cjs/{form-field-controller-slimmer-7bb7df10.js → form-field-controller-slimmer-772d1892.js} +24 -24
  17. package/dist/cjs/{image-annotation-action-6715d6f3.js → image-annotation-action-117fee1f.js} +130 -29
  18. package/dist/cjs/{index-7700600c.js → index-00ba6623.js} +23 -4
  19. package/dist/cjs/{index-ee4bc191.js → index-10199ee8.js} +2 -2
  20. package/dist/cjs/index.cjs.js +23 -23
  21. package/dist/cjs/{inject-keyboard-manager-f1f781b7.js → inject-keyboard-manager-70382bae.js} +1 -1
  22. package/dist/cjs/{internal-vega-event-manager-e98944ac.js → internal-vega-event-manager-83065493.js} +1 -1
  23. package/dist/cjs/{keyboard-manager-0be55fb9.js → keyboard-manager-6858915b.js} +1 -1
  24. package/dist/cjs/{keyboard-manager-slimmer-92c7227b.js → keyboard-manager-slimmer-faca2038.js} +1 -1
  25. package/dist/cjs/loader.cjs.js +16 -14
  26. package/dist/cjs/{object-bbd4ed7f.js → object-e2e28e3d.js} +13 -0
  27. package/dist/cjs/{public-rules-036795a4.js → public-rules-d1f7a352.js} +11 -9
  28. package/dist/cjs/{responsive-format-facade-d164ced7.js → responsive-format-facade-20c63e07.js} +4 -4
  29. package/dist/cjs/{rich-text-editor-required-rule-91eb0e22.js → rich-text-editor-required-rule-fbf8cbab.js} +1 -1
  30. package/dist/cjs/{static-subject-title-7e7d791a.js → static-subject-title-85732e0f.js} +2 -0
  31. package/dist/cjs/string-39438062.js +24 -0
  32. package/dist/cjs/{string-input-formatter-slimmer-dc1747ad.js → string-input-formatter-slimmer-1b757bad.js} +3 -3
  33. package/dist/cjs/{style-formatter-3e7af35b.js → style-formatter-e08163fd.js} +1 -1
  34. package/dist/cjs/{sub-state-notify-slimmer-409bbd1a.js → sub-state-notify-slimmer-943eb7cc.js} +2 -2
  35. package/dist/cjs/{sub-state-observer-slimmer-93d0a609.js → sub-state-observer-slimmer-0788232a.js} +3 -3
  36. package/dist/cjs/{translation-de7e351e.js → translation-cde4dce3.js} +31 -1
  37. package/dist/cjs/{translation-slimmer-83bdb9fe.js → translation-slimmer-af399096.js} +1 -1
  38. package/dist/cjs/{ui-6c069604.js → ui-4ce1fa08.js} +10 -0
  39. package/dist/cjs/vega-accordion.cjs.entry.js +17 -15
  40. package/dist/cjs/vega-app-footer.cjs.entry.js +4 -4
  41. package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -16
  42. package/dist/cjs/vega-backdrop.cjs.entry.js +2 -2
  43. package/dist/cjs/vega-banner.cjs.entry.js +6 -6
  44. package/dist/cjs/vega-bar-chart.cjs.entry.js +1 -1
  45. package/dist/cjs/vega-box.cjs.entry.js +16 -14
  46. package/dist/cjs/vega-brand-logo.cjs.entry.js +4 -4
  47. package/dist/cjs/vega-breadcrumb.cjs.entry.js +7 -7
  48. package/dist/cjs/vega-button-circle.cjs.entry.js +18 -16
  49. package/dist/cjs/vega-button-group_2.cjs.entry.js +10 -10
  50. package/dist/cjs/vega-button-link.cjs.entry.js +7 -7
  51. package/dist/cjs/vega-button.cjs.entry.js +17 -15
  52. package/dist/cjs/{vega-calendar_3.cjs.entry.js → vega-calendar_4.cjs.entry.js} +1674 -1072
  53. package/dist/cjs/vega-card.cjs.entry.js +15 -13
  54. package/dist/cjs/vega-carousel.cjs.entry.js +17 -16
  55. package/dist/cjs/vega-checkbox_2.cjs.entry.js +14 -14
  56. package/dist/cjs/vega-chip.cjs.entry.js +18 -16
  57. package/dist/cjs/vega-code-block.cjs.entry.js +22 -22
  58. package/dist/cjs/vega-color-picker.cjs.entry.js +12 -12
  59. package/dist/cjs/vega-combo-box.cjs.entry.js +15 -15
  60. package/dist/cjs/vega-counter-badge.cjs.entry.js +1 -1
  61. package/dist/cjs/vega-date-picker_2.cjs.entry.js +25 -24
  62. package/dist/cjs/vega-dialog_2.cjs.entry.js +19 -18
  63. package/dist/cjs/vega-divider.cjs.entry.js +15 -13
  64. package/dist/cjs/vega-dropdown_5.cjs.entry.js +61 -26
  65. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  66. package/dist/cjs/vega-field-error.cjs.entry.js +3 -2
  67. package/dist/cjs/vega-field-label.cjs.entry.js +6 -6
  68. package/dist/cjs/vega-file-uploader.cjs.entry.js +13 -13
  69. package/dist/cjs/vega-flag-icon.cjs.entry.js +15 -13
  70. package/dist/cjs/vega-flex.cjs.entry.js +16 -14
  71. package/dist/cjs/vega-font.cjs.entry.js +15 -13
  72. package/dist/cjs/vega-form.cjs.entry.js +108 -18
  73. package/dist/cjs/vega-grid.cjs.entry.js +15 -13
  74. package/dist/cjs/vega-hint.cjs.entry.js +1 -1
  75. package/dist/cjs/vega-icon.cjs.entry.js +15 -13
  76. package/dist/cjs/vega-image-uploader.cjs.entry.js +21 -20
  77. package/dist/cjs/vega-input-credit-card.cjs.entry.js +13 -13
  78. package/dist/cjs/vega-input-numeric.cjs.entry.js +16 -16
  79. package/dist/cjs/vega-input-phone-number.cjs.entry.js +19 -18
  80. package/dist/cjs/vega-input-range.cjs.entry.js +14 -14
  81. package/dist/cjs/vega-input-select.cjs.entry.js +26 -22
  82. package/dist/cjs/vega-input.cjs.entry.js +15 -15
  83. package/dist/cjs/{vega-internal-event-id-bda08efa.js → vega-internal-event-id-ae6e2c13.js} +7 -1
  84. package/dist/cjs/vega-item-toggle.cjs.entry.js +8 -8
  85. package/dist/cjs/vega-left-nav_5.cjs.entry.js +21 -20
  86. package/dist/cjs/vega-line-chart.cjs.entry.js +1 -1
  87. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +14 -12
  88. package/dist/cjs/vega-page-notification_2.cjs.entry.js +4 -4
  89. package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +7 -7
  90. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +8 -8
  91. package/dist/cjs/vega-pagination.cjs.entry.js +18 -16
  92. package/dist/cjs/vega-pie-chart.cjs.entry.js +1 -1
  93. package/dist/cjs/vega-popover_2.cjs.entry.js +43 -20
  94. package/dist/cjs/vega-progress-tracker.cjs.entry.js +8 -8
  95. package/dist/cjs/vega-radio_2.cjs.entry.js +16 -16
  96. package/dist/cjs/vega-rich-text-content.cjs.entry.js +273 -175
  97. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +709 -1496
  98. package/dist/cjs/vega-section-title.cjs.entry.js +1 -1
  99. package/dist/cjs/vega-segment-control.cjs.entry.js +6 -6
  100. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +20 -19
  101. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +41 -17
  102. package/dist/cjs/vega-sidenav_3.cjs.entry.js +18 -16
  103. package/dist/cjs/vega-signature-capture.cjs.entry.js +20 -20
  104. package/dist/cjs/{vega-skeleton-loader-controller-d534f5a1.js → vega-skeleton-loader-controller-b1971f43.js} +3 -3
  105. package/dist/cjs/vega-skeleton.cjs.entry.js +1 -1
  106. package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
  107. package/dist/cjs/vega-stepper.cjs.entry.js +13 -13
  108. package/dist/cjs/vega-tab-group_2.cjs.entry.js +8 -8
  109. package/dist/cjs/vega-table_8.cjs.entry.js +20 -19
  110. package/dist/cjs/vega-text.cjs.entry.js +2 -2
  111. package/dist/cjs/vega-textarea.cjs.entry.js +13 -13
  112. package/dist/cjs/vega-time-picker_2.cjs.entry.js +23 -22
  113. package/dist/cjs/vega-toggle-switch.cjs.entry.js +12 -12
  114. package/dist/cjs/vega-tooltip_2.cjs.entry.js +19 -18
  115. package/dist/cjs/vega.cjs.js +16 -14
  116. package/dist/collection/collection-manifest.json +8 -6
  117. package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-controller.js +3 -0
  118. package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-preivew-popover-controller.js +83 -0
  119. package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-post-operation-date-controller.js +61 -0
  120. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/base-repeat-pattern.js +16 -0
  121. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-daily-repeat-pattern.js +12 -0
  122. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-monthly-repeat-pattern.js +12 -0
  123. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-weekly-repeat-pattern.js +14 -0
  124. package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-yearly-repeat-pattern.js +13 -0
  125. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +53 -2
  126. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.js +68 -0
  127. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-full-day-event-layout-renderer.js +5 -2
  128. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-renderer.js +10 -1
  129. package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.js +11 -6
  130. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/full-day-event/vega-calendar-full-day-event-renderer.js +3 -3
  131. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-day-event-layout-renderer.js +5 -2
  132. package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-timed-event-renderer.js +1 -1
  133. package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.js +61 -23
  134. package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.js +1 -2
  135. package/dist/collection/components/vega-calendar/utils/index.js +16 -10
  136. package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +5 -32
  137. package/dist/collection/components/vega-calendar/vega-calendar-event/vega-calendar-event.js +0 -5
  138. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/assets/clock.js +3 -0
  139. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/assets/close.js +3 -0
  140. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/slimmers/controllers/vega-calendar-event-preview-state-controller.js +46 -0
  141. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.js +81 -0
  142. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/vega-calendar-event-preview.css +86 -0
  143. package/dist/collection/components/vega-calendar/vega-calendar-event-preview/vega-calendar-event-preview.js +56 -0
  144. package/dist/collection/components/vega-calendar/vega-calendar.css +10 -0
  145. package/dist/collection/components/vega-calendar/vega-calendar.js +79 -1
  146. package/dist/collection/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.js +36 -3
  147. package/dist/collection/components/vega-dropdown/vega-dropdown-item/vega-dropdown-item.css +5 -0
  148. package/dist/collection/components/vega-field-error/slimmers/controllers/vega-field-error-message-controller.js +1 -0
  149. package/dist/collection/components/vega-form/slimmers/controllers/vega-form-field-validation-state-controller.js +80 -0
  150. package/dist/collection/components/vega-form/vega-form.js +47 -0
  151. package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.css +4 -0
  152. package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +5 -2
  153. package/dist/collection/components/vega-input-select/vega-input-select.css +0 -3
  154. package/dist/collection/components/vega-popover/slimmers/renderers/vega-popover-appender-renderer.js +4 -1
  155. package/dist/collection/components/vega-popover/vega-popover-content-box/vega-popover-content-box.css +2521 -1
  156. package/dist/collection/components/vega-popover/vega-popover-content-box/vega-popover-content-box.js +42 -1
  157. package/dist/collection/components/vega-popover/vega-popover.js +36 -0
  158. package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +3 -15
  159. package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +81 -16
  160. package/dist/collection/components/vega-rich-text-editor/assets/display-code.js +3 -0
  161. package/dist/collection/components/vega-rich-text-editor/constants/constant.js +6 -5
  162. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +90 -26
  163. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.js +15 -0
  164. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.js +15 -0
  165. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.js +18 -4
  166. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +1 -0
  167. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.js +6 -1
  168. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +15 -1
  169. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/{block-append-blocks-strategy.js → append-children-strategy.js} +3 -2
  170. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/{block-delete-text-content-strategy.js → block-delete-text-or-decorator-node-strategy.js} +60 -12
  171. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.js +7 -7
  172. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.js +2 -2
  173. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.js +38 -30
  174. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +4 -4
  175. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.js +2 -2
  176. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.js +4 -4
  177. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.js +2 -2
  178. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +4 -4
  179. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +6 -6
  180. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-unlink-link-group-strategy.js +24 -0
  181. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +2 -2
  182. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +4 -4
  183. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-link-group-strategy.js +34 -0
  184. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.js +9 -9
  185. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.js +2 -2
  186. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.js +6 -6
  187. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-after-strategy.js +15 -0
  188. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-before-strategy.js +38 -0
  189. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-text-to-decorator-node-strategy.js +37 -0
  190. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/link-group-node-split-strategy.js +31 -0
  191. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.js +2 -2
  192. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.js +15 -15
  193. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +5 -5
  194. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +10 -10
  195. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +13 -13
  196. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.js +2 -2
  197. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/remove-children-strategy.js +26 -0
  198. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +2 -2
  199. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-cursor-position-strategy.js +23 -0
  200. package/dist/collection/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.js +7 -3
  201. package/dist/collection/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.js +20 -0
  202. package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-link-group-action.js +10 -0
  203. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-children-after-block.js +14 -0
  204. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-children-before-block.js +14 -0
  205. package/dist/collection/components/vega-rich-text-editor/dto/actions/{break-single-block-action.js → insert-new-paragraph-action.js} +3 -3
  206. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-text-to-decorator-node-action.js +17 -0
  207. package/dist/collection/components/vega-rich-text-editor/dto/actions/link-annotation-action.js +2 -1
  208. package/dist/collection/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.js +2 -1
  209. package/dist/collection/components/vega-rich-text-editor/dto/actions/link-group-node-split-action.js +11 -0
  210. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +10 -7
  211. package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-child-action.js +4 -5
  212. package/dist/collection/components/vega-rich-text-editor/dto/actions/unlink-link-group-action.js +11 -0
  213. package/dist/collection/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.js +20 -0
  214. package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +2 -0
  215. package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +13 -5
  216. package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +2 -0
  217. package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +21 -14
  218. package/dist/collection/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.js +12 -0
  219. package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.js +80 -0
  220. package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.js +54 -0
  221. package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.js +67 -0
  222. package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +26 -10
  223. package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +17 -8
  224. package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +8 -2
  225. package/dist/collection/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.js +68 -0
  226. package/dist/collection/components/vega-rich-text-editor/dto/annotations/internal-wrapper-annotation.js +41 -0
  227. package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +13 -5
  228. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +16 -11
  229. package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +92 -0
  230. package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +41 -0
  231. package/dist/collection/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.js +2 -0
  232. package/dist/collection/components/vega-rich-text-editor/dto/annotations/plain-text-annotation.js +42 -0
  233. package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +9 -9
  234. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +3 -7
  235. package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +74 -12
  236. package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +9 -9
  237. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +116 -4
  238. package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +10 -2
  239. package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +78 -0
  240. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +17 -21
  241. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +66 -12
  242. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +20 -18
  243. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +116 -37
  244. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +70 -33
  245. package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +9 -2
  246. package/dist/collection/components/vega-rich-text-editor/dto/nodes/decorator-node.js +58 -0
  247. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +45 -19
  248. package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +145 -0
  249. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +163 -21
  250. package/dist/collection/components/vega-rich-text-editor/dto/range.js +22 -33
  251. package/dist/collection/components/vega-rich-text-editor/dto/renderers/base-renderer.js +5 -0
  252. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.js +7 -23
  253. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +15 -93
  254. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +0 -9
  255. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/html-block-renderer.js +12 -0
  256. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +1 -5
  257. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +125 -0
  258. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +2 -6
  259. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +1 -1
  260. package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +2 -27
  261. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +70 -7
  262. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.js +2 -28
  263. package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +19 -5
  264. package/dist/collection/components/vega-rich-text-editor/dto/renderers/renderer-factory.js +47 -0
  265. package/dist/collection/components/vega-rich-text-editor/dto/setup.js +69 -0
  266. package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +83 -0
  267. package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +5 -0
  268. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +53 -29
  269. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/focus-controller.js +13 -5
  270. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/annotation-generator-strategy.abstract.js +5 -0
  271. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/bold-annotaion-handler.js +33 -0
  272. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/code-annotation-handler.js +33 -0
  273. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/color-annotation-handler.js +49 -0
  274. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-attribute-annotation-handler.js +48 -0
  275. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-class-annotation-handler.js +36 -0
  276. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.js +48 -0
  277. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.js +66 -0
  278. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-alt-annotation-handler.js +19 -0
  279. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-size-annotation-handler.js +32 -0
  280. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/indent-annotation-handler.js +53 -0
  281. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.js +99 -0
  282. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/italic-annotation-handler.js +32 -0
  283. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/link-annotation-handler.js +53 -0
  284. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/strike-through-annotation-handler.js +34 -0
  285. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-align-annotation-handler.js +57 -0
  286. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.js +120 -0
  287. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/underline-annotation-handler.js +32 -0
  288. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +38 -232
  289. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +34 -19
  290. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +19 -33
  291. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +4 -3
  292. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.js +33 -0
  293. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-text-node-strategy.js +33 -0
  294. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.js +99 -0
  295. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +5 -21
  296. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +8 -48
  297. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-element-to-text-node-strategy.js +46 -0
  298. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +59 -10
  299. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +8 -5
  300. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/plain-text-to-text-node-strategy.js +35 -0
  301. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +5 -21
  302. 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 +11 -6
  303. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +8 -5
  304. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +9 -9
  305. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +2 -2
  306. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +8 -22
  307. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +2 -2
  308. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +13 -15
  309. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +36 -28
  310. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-composition-text-controller.js +6 -3
  311. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.js +3 -3
  312. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +75 -5
  313. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.js +39 -4
  314. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +11 -0
  315. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +41 -5
  316. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +2 -2
  317. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +2 -2
  318. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +2 -2
  319. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +2 -2
  320. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +2 -2
  321. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +2 -2
  322. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +2 -2
  323. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +2 -2
  324. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +2 -2
  325. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +2 -2
  326. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +2 -2
  327. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +2 -2
  328. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -2
  329. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +2 -2
  330. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +2 -2
  331. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +3 -2
  332. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +2 -2
  333. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +64 -0
  334. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +2 -2
  335. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +2 -2
  336. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +5 -4
  337. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +10 -3
  338. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +2 -2
  339. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +37 -0
  340. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +41 -3
  341. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +2 -3
  342. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +8 -9
  343. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +15 -13
  344. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +8 -8
  345. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +12 -12
  346. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +3 -2
  347. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +2 -2
  348. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +34 -12
  349. package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-actions.test.js +1 -0
  350. package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +258 -28
  351. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/html-block.test.js +124 -0
  352. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/image-block.test.js +10 -0
  353. package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +59 -0
  354. package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +2613 -0
  355. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +29 -0
  356. package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +103 -4
  357. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/custom-attribute-annotation-handler.test.js +49 -0
  358. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/element-to-text-node-strategy.test.js +38 -0
  359. package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/html-element-to-annotation-generator.test.js +26 -0
  360. package/dist/collection/components/vega-rich-text-editor/test/spec-utils.js +32 -0
  361. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/slimmers/renderers/vega-rich-text-editor-toolbar-button-renderer.js +6 -2
  362. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +3 -0
  363. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.js +27 -0
  364. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +7 -32
  365. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +67 -2
  366. package/dist/collection/components/vega-selection-tile/slimmers/controllers/vega-selection-tile-state-controller.js +7 -0
  367. package/dist/collection/components/vega-selection-tile/vega-selection-tile-group/vega-selection-tile-group.js +37 -0
  368. package/dist/collection/components/vega-selection-tile/vega-selection-tile.css +12 -0
  369. package/dist/collection/components/vega-selection-tile/vega-selection-tile.js +7 -2
  370. package/dist/collection/constants/ui.js +1 -0
  371. package/dist/collection/helpers/calendar/calendar-date.js +12 -0
  372. package/dist/collection/helpers/calendar/calendar-event.js +24 -0
  373. package/dist/collection/helpers/calendar/calendar-period/month-period.js +15 -1
  374. package/dist/collection/helpers/calendar/calendar-period/week-period.js +6 -7
  375. package/dist/collection/helpers/calendar/test/calendar-date.test.js +4 -0
  376. package/dist/collection/helpers/calendar/test/calendar-event.test.js +57 -0
  377. package/dist/collection/helpers/calendar/test/calendar-period/month-period.test.js +12 -4
  378. package/dist/collection/helpers/calendar/test/calendar-period/week-period.test.js +2 -2
  379. package/dist/collection/helpers/calendar/utils.js +38 -0
  380. package/dist/collection/helpers/change-manager/subject/static-subject/static-subject-title.js +1 -0
  381. package/dist/collection/helpers/code-format/code-formatter.js +116 -0
  382. package/dist/collection/helpers/code-format/test/code-formatter.test.js +362 -0
  383. package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +4 -1
  384. package/dist/collection/helpers/rte-manager/dto-action-strategy-manager.js +37 -0
  385. package/dist/collection/helpers/rte-manager/dto-class-manager.js +51 -0
  386. package/dist/collection/helpers/rte-manager/dto-renderer-manager.js +54 -0
  387. package/dist/collection/helpers/rte-manager/element-dto-class-strategy-manager.js +56 -0
  388. package/dist/collection/helpers/rte-manager/rte.manager.test.js +94 -0
  389. package/dist/collection/helpers/slimmers/field-error-controller-silmmer.js +4 -6
  390. package/dist/collection/helpers/slimmers/field-error-ui-controller-slimmer.js +12 -10
  391. package/dist/collection/helpers/slimmers/global/vega-translate-observer-slimmer.js +17 -4
  392. package/dist/collection/helpers/slimmers/test/field-error-controller-slimmer.test.js +1 -0
  393. package/dist/collection/helpers/slimmers/test/global/vega-translate-observer-slimmer.test.js +89 -0
  394. package/dist/collection/helpers/translation/locales/en.js +30 -0
  395. package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +30 -0
  396. package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +16 -14
  397. package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +1 -0
  398. package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
  399. package/dist/collection/utils/object.js +12 -0
  400. package/dist/collection/utils/string.js +10 -0
  401. package/dist/collection/utils/test/object.test.js +27 -1
  402. package/dist/collection/utils/ui.js +9 -0
  403. package/dist/esm/{app-globals-ee6a1250.js → app-globals-eec29b87.js} +25 -12
  404. package/dist/esm/{brand-switch-state-controller-slimmer-05c85e6d.js → brand-switch-state-controller-slimmer-d6e4d217.js} +1 -1
  405. package/dist/esm/{child-nodes-event-prevent-slimmer-b59a578e.js → child-nodes-event-prevent-slimmer-6b5b31f5.js} +1 -1
  406. package/dist/esm/{child-nodes-notify-observer-slimmer-eeed5986.js → child-nodes-notify-observer-slimmer-78f77c2c.js} +1 -1
  407. package/dist/esm/{code-block-7bd4cb87.js → code-block-3d519665.js} +2107 -970
  408. package/dist/esm/{component-value-history-controller-slimmer.abstract-41c58caf.js → component-value-history-controller-slimmer.abstract-8b5be007.js} +112 -54
  409. package/dist/esm/content-state-100d1efd.js +3682 -0
  410. package/dist/esm/{dark-mode-state-controller-slimmer-f1c2c299.js → dark-mode-state-controller-slimmer-0c7d1c77.js} +1 -1
  411. package/dist/esm/{dark-mode-style-controller-ea798fc8.js → dark-mode-style-controller-3bbb32dc.js} +1 -1
  412. package/dist/esm/{deprecated-property-slimmer-32575f02.js → deprecated-property-slimmer-2c14df89.js} +1 -1
  413. package/dist/esm/{design-token-23522f5c.js → design-token-80dd7d60.js} +1 -1
  414. package/dist/esm/{dom-node-subject-factory-6374611f.js → dom-node-subject-factory-202655e7.js} +1 -1
  415. package/dist/esm/{dom-node-subject-observer-factory-c345ca2e.js → dom-node-subject-observer-factory-999e21e3.js} +1 -1
  416. package/dist/esm/{element-appender-slimmer-042df95a.js → element-appender-slimmer-e2d3e79a.js} +7 -7
  417. package/dist/esm/{event-emit-slimmer-b5cb9b81.js → event-emit-slimmer-40973ec2.js} +3 -3
  418. package/dist/esm/{form-field-controller-slimmer-f0982f11.js → form-field-controller-slimmer-47820eaa.js} +24 -24
  419. package/dist/esm/{image-annotation-action-1e88f5a0.js → image-annotation-action-215f92d6.js} +128 -29
  420. package/dist/esm/{index-d0a47531.js → index-057d0f70.js} +23 -4
  421. package/dist/esm/{index-fb3b74bd.js → index-18a340fb.js} +2 -2
  422. package/dist/esm/index.js +16 -16
  423. package/dist/esm/{inject-keyboard-manager-5141d09a.js → inject-keyboard-manager-a28dfee4.js} +1 -1
  424. package/dist/esm/{internal-vega-event-manager-d80c53c5.js → internal-vega-event-manager-526f8ed1.js} +1 -1
  425. package/dist/esm/{keyboard-manager-3ffe81b0.js → keyboard-manager-fa6355cb.js} +1 -1
  426. package/dist/esm/{keyboard-manager-slimmer-751e98f5.js → keyboard-manager-slimmer-818050ee.js} +1 -1
  427. package/dist/esm/loader.js +16 -14
  428. package/dist/esm/{object-261e7344.js → object-66c37948.js} +13 -1
  429. package/dist/esm/{public-rules-287d4d77.js → public-rules-1016ce0c.js} +11 -9
  430. package/dist/esm/{responsive-format-facade-d2632288.js → responsive-format-facade-4bf60125.js} +4 -4
  431. package/dist/esm/{rich-text-editor-required-rule-69d5f035.js → rich-text-editor-required-rule-423c3c83.js} +1 -1
  432. package/dist/esm/{static-subject-title-ca83d6b6.js → static-subject-title-633b3474.js} +2 -1
  433. package/dist/esm/string-a953eafc.js +21 -0
  434. package/dist/esm/{string-input-formatter-slimmer-09478e0d.js → string-input-formatter-slimmer-b144e8d7.js} +3 -3
  435. package/dist/esm/{style-formatter-f7951677.js → style-formatter-184752b5.js} +1 -1
  436. package/dist/esm/{sub-state-notify-slimmer-0a6c3cbb.js → sub-state-notify-slimmer-b3524c09.js} +2 -2
  437. package/dist/esm/{sub-state-observer-slimmer-53eec5fb.js → sub-state-observer-slimmer-c823d69c.js} +3 -3
  438. package/dist/esm/{translation-a6eacb5f.js → translation-833d9ef4.js} +31 -1
  439. package/dist/esm/{translation-slimmer-f28e4708.js → translation-slimmer-c83b52c1.js} +1 -1
  440. package/dist/esm/{ui-7d177fb0.js → ui-c20be16d.js} +10 -1
  441. package/dist/esm/vega-accordion.entry.js +17 -15
  442. package/dist/esm/vega-app-footer.entry.js +4 -4
  443. package/dist/esm/vega-app-header-button.entry.js +18 -16
  444. package/dist/esm/vega-backdrop.entry.js +2 -2
  445. package/dist/esm/vega-banner.entry.js +6 -6
  446. package/dist/esm/vega-bar-chart.entry.js +1 -1
  447. package/dist/esm/vega-box.entry.js +16 -14
  448. package/dist/esm/vega-brand-logo.entry.js +4 -4
  449. package/dist/esm/vega-breadcrumb.entry.js +7 -7
  450. package/dist/esm/vega-button-circle.entry.js +18 -16
  451. package/dist/esm/vega-button-group_2.entry.js +10 -10
  452. package/dist/esm/vega-button-link.entry.js +7 -7
  453. package/dist/esm/vega-button.entry.js +17 -15
  454. package/dist/esm/{vega-calendar_3.entry.js → vega-calendar_4.entry.js} +1674 -1073
  455. package/dist/esm/vega-card.entry.js +15 -13
  456. package/dist/esm/vega-carousel.entry.js +17 -16
  457. package/dist/esm/vega-checkbox_2.entry.js +14 -14
  458. package/dist/esm/vega-chip.entry.js +18 -16
  459. package/dist/esm/vega-code-block.entry.js +19 -19
  460. package/dist/esm/vega-color-picker.entry.js +12 -12
  461. package/dist/esm/vega-combo-box.entry.js +15 -15
  462. package/dist/esm/vega-counter-badge.entry.js +1 -1
  463. package/dist/esm/vega-date-picker_2.entry.js +25 -24
  464. package/dist/esm/vega-dialog_2.entry.js +19 -18
  465. package/dist/esm/vega-divider.entry.js +15 -13
  466. package/dist/esm/vega-dropdown_5.entry.js +61 -26
  467. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  468. package/dist/esm/vega-field-error.entry.js +3 -2
  469. package/dist/esm/vega-field-label.entry.js +6 -6
  470. package/dist/esm/vega-file-uploader.entry.js +13 -13
  471. package/dist/esm/vega-flag-icon.entry.js +15 -13
  472. package/dist/esm/vega-flex.entry.js +16 -14
  473. package/dist/esm/vega-font.entry.js +15 -13
  474. package/dist/esm/vega-form.entry.js +109 -19
  475. package/dist/esm/vega-grid.entry.js +15 -13
  476. package/dist/esm/vega-hint.entry.js +1 -1
  477. package/dist/esm/vega-icon.entry.js +15 -13
  478. package/dist/esm/vega-image-uploader.entry.js +21 -20
  479. package/dist/esm/vega-input-credit-card.entry.js +13 -13
  480. package/dist/esm/vega-input-numeric.entry.js +16 -16
  481. package/dist/esm/vega-input-phone-number.entry.js +19 -18
  482. package/dist/esm/vega-input-range.entry.js +14 -14
  483. package/dist/esm/vega-input-select.entry.js +26 -22
  484. package/dist/esm/vega-input.entry.js +15 -15
  485. package/dist/esm/{vega-internal-event-id-4072659b.js → vega-internal-event-id-b7c865de.js} +5 -2
  486. package/dist/esm/vega-item-toggle.entry.js +8 -8
  487. package/dist/esm/vega-left-nav_5.entry.js +21 -20
  488. package/dist/esm/vega-line-chart.entry.js +1 -1
  489. package/dist/esm/vega-loader-wrapper_2.entry.js +14 -12
  490. package/dist/esm/vega-page-notification_2.entry.js +4 -4
  491. package/dist/esm/vega-pagination-page-selector-mobile.entry.js +7 -7
  492. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +8 -8
  493. package/dist/esm/vega-pagination.entry.js +18 -16
  494. package/dist/esm/vega-pie-chart.entry.js +1 -1
  495. package/dist/esm/vega-popover_2.entry.js +43 -20
  496. package/dist/esm/vega-progress-tracker.entry.js +8 -8
  497. package/dist/esm/vega-radio_2.entry.js +16 -16
  498. package/dist/esm/vega-rich-text-content.entry.js +273 -175
  499. package/dist/esm/vega-rich-text-editor_4.entry.js +693 -1480
  500. package/dist/esm/vega-section-title.entry.js +1 -1
  501. package/dist/esm/vega-segment-control.entry.js +6 -6
  502. package/dist/esm/vega-selection-chip_2.entry.js +20 -19
  503. package/dist/esm/vega-selection-tile_2.entry.js +41 -17
  504. package/dist/esm/vega-sidenav_3.entry.js +18 -16
  505. package/dist/esm/vega-signature-capture.entry.js +20 -20
  506. package/dist/esm/{vega-skeleton-loader-controller-3f6faa17.js → vega-skeleton-loader-controller-38864fcd.js} +3 -3
  507. package/dist/esm/vega-skeleton.entry.js +1 -1
  508. package/dist/esm/vega-slot-container.entry.js +1 -1
  509. package/dist/esm/vega-stepper.entry.js +13 -13
  510. package/dist/esm/vega-tab-group_2.entry.js +8 -8
  511. package/dist/esm/vega-table_8.entry.js +20 -19
  512. package/dist/esm/vega-text.entry.js +2 -2
  513. package/dist/esm/vega-textarea.entry.js +13 -13
  514. package/dist/esm/vega-time-picker_2.entry.js +23 -22
  515. package/dist/esm/vega-toggle-switch.entry.js +12 -12
  516. package/dist/esm/vega-tooltip_2.entry.js +19 -18
  517. package/dist/esm/vega.js +16 -14
  518. package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-controller.d.ts +1 -0
  519. package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-preivew-popover-controller.d.ts +48 -0
  520. package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-post-operation-date-controller.d.ts +33 -0
  521. package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/base-repeat-pattern.d.ts +8 -0
  522. package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-daily-repeat-pattern.d.ts +6 -0
  523. package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-monthly-repeat-pattern.d.ts +6 -0
  524. package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-weekly-repeat-pattern.d.ts +6 -0
  525. package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-yearly-repeat-pattern.d.ts +6 -0
  526. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.d.ts +8 -1
  527. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.d.ts +18 -0
  528. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-full-day-event-layout-renderer.d.ts +3 -1
  529. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-renderer.d.ts +3 -0
  530. package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.d.ts +2 -0
  531. package/dist/types/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-day-event-layout-renderer.d.ts +3 -1
  532. package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.d.ts +6 -1
  533. package/dist/types/components/vega-calendar/utils/index.d.ts +9 -8
  534. package/dist/types/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.d.ts +0 -8
  535. package/dist/types/components/vega-calendar/vega-calendar-event/vega-calendar-event.d.ts +0 -2
  536. package/dist/types/components/vega-calendar/vega-calendar-event-preview/assets/clock.d.ts +3 -0
  537. package/dist/types/components/vega-calendar/vega-calendar-event-preview/assets/close.d.ts +3 -0
  538. package/dist/types/components/vega-calendar/vega-calendar-event-preview/slimmers/controllers/vega-calendar-event-preview-state-controller.d.ts +16 -0
  539. package/dist/types/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.d.ts +13 -0
  540. package/dist/types/components/vega-calendar/vega-calendar-event-preview/types.d.ts +5 -0
  541. package/dist/types/components/vega-calendar/vega-calendar-event-preview/vega-calendar-event-preview.d.ts +22 -0
  542. package/dist/types/components/vega-calendar/vega-calendar.d.ts +25 -1
  543. package/dist/types/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.d.ts +4 -0
  544. package/dist/types/components/vega-field-error/types.d.ts +2 -1
  545. package/dist/types/components/vega-form/slimmers/controllers/vega-form-field-validation-state-controller.d.ts +29 -0
  546. package/dist/types/components/vega-form/types.d.ts +18 -0
  547. package/dist/types/components/vega-form/vega-form.d.ts +11 -1
  548. package/dist/types/components/vega-popover/slimmers/renderers/vega-popover-appender-renderer.d.ts +1 -0
  549. package/dist/types/components/vega-popover/vega-popover-content-box/vega-popover-content-box.d.ts +7 -0
  550. package/dist/types/components/vega-popover/vega-popover.d.ts +7 -1
  551. package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +0 -2
  552. package/dist/types/components/vega-rich-text-editor/assets/display-code.d.ts +3 -0
  553. package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +1 -0
  554. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +4 -4
  555. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +55 -27
  556. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.d.ts +15 -0
  557. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.d.ts +15 -0
  558. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/append-children-strategy.d.ts +13 -0
  559. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +4 -4
  560. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.d.ts +26 -0
  561. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.d.ts +11 -12
  562. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-unlink-link-group-strategy.d.ts +15 -0
  563. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +2 -2
  564. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-link-group-strategy.d.ts +15 -0
  565. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-after-strategy.d.ts +13 -0
  566. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-before-strategy.d.ts +23 -0
  567. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-text-to-decorator-node-strategy.d.ts +18 -0
  568. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/link-group-node-split-strategy.d.ts +15 -0
  569. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.d.ts +3 -3
  570. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +5 -5
  571. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/remove-children-strategy.d.ts +17 -0
  572. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-cursor-position-strategy.d.ts +12 -0
  573. package/dist/types/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.d.ts +6 -2
  574. package/dist/types/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.d.ts +17 -0
  575. package/dist/types/components/vega-rich-text-editor/dto/actions/delete-link-group-action.d.ts +7 -0
  576. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-children-after-block.d.ts +14 -0
  577. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-children-before-block.d.ts +14 -0
  578. package/dist/types/components/vega-rich-text-editor/dto/actions/{break-single-block-action.d.ts → insert-new-paragraph-action.d.ts} +2 -2
  579. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-text-to-decorator-node-action.d.ts +14 -0
  580. package/dist/types/components/vega-rich-text-editor/dto/actions/link-annotation-action.d.ts +3 -1
  581. package/dist/types/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.d.ts +2 -1
  582. package/dist/types/components/vega-rich-text-editor/dto/actions/link-group-node-split-action.d.ts +10 -0
  583. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +12 -9
  584. package/dist/types/components/vega-rich-text-editor/dto/actions/remove-child-action.d.ts +3 -4
  585. package/dist/types/components/vega-rich-text-editor/dto/actions/unlink-link-group-action.d.ts +9 -0
  586. package/dist/types/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.d.ts +20 -0
  587. package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +2 -1
  588. package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +18 -4
  589. package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +7 -5
  590. package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +2 -1
  591. package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +9 -11
  592. package/dist/types/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.d.ts +20 -0
  593. package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.d.ts +44 -0
  594. package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.d.ts +40 -0
  595. package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.d.ts +48 -0
  596. package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +5 -9
  597. package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +10 -8
  598. package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +5 -1
  599. package/dist/types/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.d.ts +37 -0
  600. package/dist/types/components/vega-rich-text-editor/dto/annotations/internal-wrapper-annotation.d.ts +31 -0
  601. package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +7 -5
  602. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +10 -6
  603. package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +49 -0
  604. package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +25 -0
  605. package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +18 -4
  606. package/dist/types/components/vega-rich-text-editor/dto/annotations/plain-text-annotation.d.ts +31 -0
  607. package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +5 -9
  608. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +3 -7
  609. package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +9 -7
  610. package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +5 -9
  611. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +70 -9
  612. package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +7 -2
  613. package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +42 -0
  614. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +10 -4
  615. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +33 -6
  616. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +9 -5
  617. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +29 -14
  618. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +20 -3
  619. package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +7 -2
  620. package/dist/types/components/vega-rich-text-editor/dto/nodes/decorator-node.d.ts +41 -0
  621. package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +10 -4
  622. package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +116 -5
  623. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +59 -4
  624. package/dist/types/components/vega-rich-text-editor/dto/range.d.ts +0 -7
  625. package/dist/types/components/vega-rich-text-editor/dto/renderers/base-renderer.d.ts +9 -0
  626. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.d.ts +7 -20
  627. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +9 -6
  628. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +0 -8
  629. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/html-block-renderer.d.ts +8 -0
  630. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.d.ts +0 -2
  631. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.d.ts +24 -0
  632. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.d.ts +0 -2
  633. package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +0 -3
  634. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.d.ts +37 -0
  635. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.d.ts +3 -16
  636. package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.d.ts +2 -0
  637. package/dist/types/components/vega-rich-text-editor/dto/renderers/renderer-factory.d.ts +24 -0
  638. package/dist/types/components/vega-rich-text-editor/dto/setup.d.ts +1 -0
  639. package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +61 -0
  640. package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +13 -0
  641. package/dist/types/components/vega-rich-text-editor/interface.d.ts +172 -42
  642. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.d.ts +19 -0
  643. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/focus-controller.d.ts +1 -0
  644. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/annotation-generator-strategy.abstract.d.ts +16 -0
  645. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/bold-annotaion-handler.d.ts +25 -0
  646. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/code-annotation-handler.d.ts +25 -0
  647. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/color-annotation-handler.d.ts +25 -0
  648. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-attribute-annotation-handler.d.ts +35 -0
  649. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-class-annotation-handler.d.ts +28 -0
  650. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.d.ts +28 -0
  651. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.d.ts +26 -0
  652. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-alt-annotation-handler.d.ts +17 -0
  653. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-size-annotation-handler.d.ts +24 -0
  654. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/indent-annotation-handler.d.ts +24 -0
  655. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.d.ts +28 -0
  656. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/italic-annotation-handler.d.ts +25 -0
  657. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/link-annotation-handler.d.ts +29 -0
  658. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/strike-through-annotation-handler.d.ts +25 -0
  659. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-align-annotation-handler.d.ts +27 -0
  660. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.d.ts +57 -0
  661. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/underline-annotation-handler.d.ts +25 -0
  662. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +12 -85
  663. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +10 -2
  664. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +12 -3
  665. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +6 -4
  666. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.d.ts +14 -0
  667. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-text-node-strategy.d.ts +23 -0
  668. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.d.ts +34 -0
  669. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +5 -4
  670. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +3 -9
  671. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-element-to-text-node-strategy.d.ts +17 -0
  672. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.d.ts +20 -3
  673. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +5 -5
  674. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/plain-text-to-text-node-strategy.d.ts +16 -0
  675. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +5 -4
  676. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-not-li-child-to-rte-list-item-block.d.ts +3 -2
  677. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +5 -5
  678. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +5 -4
  679. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +0 -7
  680. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +0 -1
  681. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +20 -0
  682. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +20 -3
  683. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +4 -0
  684. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +6 -0
  685. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +2 -2
  686. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +3 -2
  687. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +2 -2
  688. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +2 -2
  689. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +2 -2
  690. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +2 -2
  691. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +2 -2
  692. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +2 -2
  693. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +3 -2
  694. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +2 -2
  695. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +2 -2
  696. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +2 -2
  697. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +3 -2
  698. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +2 -2
  699. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +2 -2
  700. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +3 -2
  701. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +2 -2
  702. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +14 -0
  703. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +2 -2
  704. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +3 -2
  705. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +3 -2
  706. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +7 -2
  707. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +2 -2
  708. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +24 -0
  709. package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +10 -2
  710. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +1 -1
  711. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +1 -1
  712. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +1 -1
  713. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +1 -1
  714. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/html-block.test.d.ts +1 -0
  715. package/dist/types/components/vega-rich-text-editor/test/dto/blocks/text-block.test.d.ts +1 -1
  716. package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -1
  717. package/dist/types/components/vega-rich-text-editor/test/dto/nodes/text-node.test.d.ts +1 -1
  718. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/custom-attribute-annotation-handler.test.d.ts +1 -0
  719. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/element-to-text-node-strategy.test.d.ts +1 -0
  720. package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/html-element-to-annotation-generator.test.d.ts +1 -0
  721. package/dist/types/components/vega-rich-text-editor/test/spec-utils.d.ts +15 -0
  722. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/slimmers/renderers/vega-rich-text-editor-toolbar-button-renderer.d.ts +1 -0
  723. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.d.ts +6 -0
  724. package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +17 -1
  725. package/dist/types/components/vega-selection-tile/slimmers/controllers/vega-selection-tile-state-controller.d.ts +1 -0
  726. package/dist/types/components/vega-selection-tile/vega-selection-tile-group/vega-selection-tile-group.d.ts +8 -0
  727. package/dist/types/components/vega-selection-tile/vega-selection-tile.d.ts +4 -0
  728. package/dist/types/components.d.ts +101 -2
  729. package/dist/types/constants/ui.d.ts +1 -1
  730. package/dist/types/helpers/calendar/calendar-date.d.ts +7 -0
  731. package/dist/types/helpers/calendar/calendar-event.d.ts +15 -1
  732. package/dist/types/helpers/calendar/calendar-period/calendar-period.abstract.d.ts +3 -3
  733. package/dist/types/helpers/calendar/calendar-period/month-period.d.ts +7 -1
  734. package/dist/types/helpers/calendar/utils.d.ts +18 -0
  735. package/dist/types/helpers/change-manager/subject/static-subject/static-subject-title.d.ts +2 -1
  736. package/dist/types/helpers/code-format/code-formatter.d.ts +34 -0
  737. package/dist/types/helpers/code-format/test/code-formatter.test.d.ts +1 -0
  738. package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +3 -0
  739. package/dist/types/helpers/rte-manager/dto-action-strategy-manager.d.ts +13 -0
  740. package/dist/types/helpers/rte-manager/dto-class-manager.d.ts +38 -0
  741. package/dist/types/helpers/rte-manager/dto-renderer-manager.d.ts +44 -0
  742. package/dist/types/helpers/rte-manager/element-dto-class-strategy-manager.d.ts +42 -0
  743. package/dist/types/helpers/rte-manager/rte.manager.test.d.ts +1 -0
  744. package/dist/types/helpers/slimmers/field-error-ui-controller-slimmer.d.ts +1 -1
  745. package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +1 -1
  746. package/dist/types/helpers/slimmers/global/vega-translate-observer-slimmer.d.ts +6 -0
  747. package/dist/types/helpers/slimmers/test/global/vega-translate-observer-slimmer.test.d.ts +1 -0
  748. package/dist/types/helpers/translation/interface.d.ts +31 -1
  749. package/dist/types/types/class.type.d.ts +3 -0
  750. package/dist/types/types/components.type.d.ts +10 -2
  751. package/dist/types/utils/object.d.ts +8 -0
  752. package/dist/types/utils/string.d.ts +7 -0
  753. package/dist/types/utils/ui.d.ts +7 -0
  754. package/dist/vega/index.esm.js +1 -1
  755. package/dist/vega/p-02841589.js +1 -0
  756. package/dist/vega/{p-81ed90d5.js → p-02b29c18.js} +1 -1
  757. package/dist/vega/{p-f25570f5.js → p-09d63c0c.js} +1 -1
  758. package/dist/vega/{p-4c4ac1a5.entry.js → p-09ddae74.entry.js} +1 -1
  759. package/dist/vega/{p-9afdcf65.js → p-0a2ff1e2.js} +1 -1
  760. package/dist/vega/p-0b2fef0d.entry.js +1 -0
  761. package/dist/vega/{p-1db2ba98.entry.js → p-0c247128.entry.js} +1 -1
  762. package/dist/vega/p-0cd89fb6.js +1 -0
  763. package/dist/vega/{p-e940bc37.js → p-0f0baac3.js} +1 -1
  764. package/dist/vega/{p-4a237308.js → p-0fce930c.js} +1 -1
  765. package/dist/vega/p-11663b1c.js +1 -0
  766. package/dist/vega/p-16ec4633.js +1 -0
  767. package/dist/vega/p-17d517c8.entry.js +1 -0
  768. package/dist/vega/p-18711f87.entry.js +1 -0
  769. package/dist/vega/p-19aa2dbe.entry.js +1 -0
  770. package/dist/vega/{p-8782abeb.js → p-1bd516c5.js} +1 -1
  771. package/dist/vega/p-23f0dfeb.entry.js +1 -0
  772. package/dist/vega/{p-7c348ac7.entry.js → p-26ef2066.entry.js} +1 -1
  773. package/dist/vega/{p-c69a6547.entry.js → p-27b5f69c.entry.js} +1 -1
  774. package/dist/vega/{p-41465ad0.entry.js → p-2a66e2f7.entry.js} +1 -1
  775. package/dist/vega/p-2cc8e5f0.entry.js +1 -0
  776. package/dist/vega/p-323d2af0.entry.js +1 -0
  777. package/dist/vega/p-33f45d1b.entry.js +1 -0
  778. package/dist/vega/p-351405f2.entry.js +1 -0
  779. package/dist/vega/p-35a3c0e5.entry.js +1 -0
  780. package/dist/vega/{p-82b18195.entry.js → p-36ae2dd3.entry.js} +1 -1
  781. package/dist/vega/p-3ce966b2.entry.js +1 -0
  782. package/dist/vega/p-42632023.entry.js +1 -0
  783. package/dist/vega/{p-832b59af.js → p-436f7e27.js} +1 -1
  784. package/dist/vega/{p-5bd3487e.js → p-4452e085.js} +1 -1
  785. package/dist/vega/{p-710da484.entry.js → p-446d0317.entry.js} +1 -1
  786. package/dist/vega/{p-012cbd8f.js → p-4474bc63.js} +1 -1
  787. package/dist/vega/{p-6dad2e5c.entry.js → p-476cc642.entry.js} +1 -1
  788. package/dist/vega/p-48a58baf.js +2 -0
  789. package/dist/vega/{p-bcdb235d.js → p-4a368e1e.js} +1 -1
  790. package/dist/vega/p-4b7edf72.entry.js +1 -0
  791. package/dist/vega/{p-a4a0fcfd.entry.js → p-4ca12302.entry.js} +2 -2
  792. package/dist/vega/p-4ee21459.entry.js +1 -0
  793. package/dist/vega/{p-4674c318.entry.js → p-4fc18f2f.entry.js} +1 -1
  794. package/dist/vega/p-521ace2d.js +1 -0
  795. package/dist/vega/{p-1f9a735a.entry.js → p-53d67971.entry.js} +1 -1
  796. package/dist/vega/p-55b4b6ff.entry.js +1 -0
  797. package/dist/vega/p-56290b7e.entry.js +1 -0
  798. package/dist/vega/{p-d5776087.js → p-575235c8.js} +1 -1
  799. package/dist/vega/p-57ea996e.entry.js +1 -0
  800. package/dist/vega/p-59e990c7.entry.js +1 -0
  801. package/dist/vega/p-5b7d347a.js +1 -0
  802. package/dist/vega/p-5f377954.js +1 -1
  803. package/dist/vega/{p-7d5ebd26.entry.js → p-606d1f7c.entry.js} +1 -1
  804. package/dist/vega/{p-4ab67150.entry.js → p-61d1f3cb.entry.js} +1 -1
  805. package/dist/vega/p-6a24c2d9.entry.js +1 -0
  806. package/dist/vega/{p-5f6b942c.entry.js → p-6b292628.entry.js} +1 -1
  807. package/dist/vega/p-6e42d500.entry.js +1 -0
  808. package/dist/vega/{p-c9740710.entry.js → p-70939752.entry.js} +1 -1
  809. package/dist/vega/p-778b1d71.entry.js +1 -0
  810. package/dist/vega/{p-fda6f8bc.js → p-7934c09c.js} +1 -1
  811. package/dist/vega/p-7a3b142b.js +1 -0
  812. package/dist/vega/{p-9b08ed46.entry.js → p-7b1bb372.entry.js} +1 -1
  813. package/dist/vega/p-7b365345.entry.js +1 -0
  814. package/dist/vega/p-7bb74931.js +1 -0
  815. package/dist/vega/{p-4c871d0f.entry.js → p-7cd2fac8.entry.js} +1 -1
  816. package/dist/vega/{p-0c8bd757.js → p-7e8f055d.js} +1 -1
  817. package/dist/vega/p-7f087c8b.js +1 -0
  818. package/dist/vega/{p-fcb5b40f.entry.js → p-801cb489.entry.js} +1 -1
  819. package/dist/vega/p-80aac6eb.entry.js +1 -0
  820. package/dist/vega/{p-904d1b43.js → p-846ae5fb.js} +1 -1
  821. package/dist/vega/{p-66e9d31a.entry.js → p-847dbae4.entry.js} +1 -1
  822. package/dist/vega/{p-397b5d91.entry.js → p-850a6305.entry.js} +1 -1
  823. package/dist/vega/p-86f17433.js +1 -0
  824. package/dist/vega/{p-acd9bfa4.js → p-8852361b.js} +1 -1
  825. package/dist/vega/p-8a877e12.js +1 -0
  826. package/dist/vega/p-966a9940.entry.js +1 -0
  827. package/dist/vega/{p-8c4f893b.js → p-9773c913.js} +1 -1
  828. package/dist/vega/{p-bd84b7b9.entry.js → p-9a74eb86.entry.js} +1 -1
  829. package/dist/vega/p-a0954e7c.entry.js +1 -0
  830. package/dist/vega/p-a6dacccd.js +1 -0
  831. package/dist/vega/{p-59282fc8.entry.js → p-a7baad6d.entry.js} +1 -1
  832. package/dist/vega/{p-8e581755.entry.js → p-ae21e5f5.entry.js} +1 -1
  833. package/dist/vega/p-aeea4154.entry.js +1 -0
  834. package/dist/vega/{p-613ee009.js → p-af464251.js} +1 -1
  835. package/dist/vega/p-b40adb9e.js +1 -0
  836. package/dist/vega/p-b4be8573.entry.js +1 -0
  837. package/dist/vega/{p-6e01f0a2.js → p-b5822a21.js} +1 -1
  838. package/dist/vega/p-b5bef48a.js +1 -0
  839. package/dist/vega/p-b6f78c1e.entry.js +1 -0
  840. package/dist/vega/{p-f3bd26a1.entry.js → p-b73532c0.entry.js} +1 -1
  841. package/dist/vega/{p-d789b291.js → p-bbb96a13.js} +1 -1
  842. package/dist/vega/p-bca1f8f9.js +1 -0
  843. package/dist/vega/p-bf0ced3c.js +1 -0
  844. package/dist/vega/p-bf19682d.js +1 -0
  845. package/dist/vega/p-c131544b.entry.js +1 -0
  846. package/dist/vega/p-c81cb852.entry.js +1 -0
  847. package/dist/vega/{p-091ab617.entry.js → p-cc20f01f.entry.js} +1 -1
  848. package/dist/vega/{p-500684e1.entry.js → p-cc5a3a1b.entry.js} +1 -1
  849. package/dist/vega/{p-f940b7f7.entry.js → p-d0fbbb7f.entry.js} +1 -1
  850. package/dist/vega/{p-864de9a1.js → p-d4564bfd.js} +1 -1
  851. package/dist/vega/{p-c42ec0ac.entry.js → p-d45f79ce.entry.js} +1 -1
  852. package/dist/vega/p-d590402d.entry.js +1 -0
  853. package/dist/vega/{p-34dc3f71.entry.js → p-d72abacd.entry.js} +1 -1
  854. package/dist/vega/{p-fe1512f9.entry.js → p-d7558ed7.entry.js} +1 -1
  855. package/dist/vega/p-d8566958.entry.js +1 -0
  856. package/dist/vega/{p-a1e50e6c.entry.js → p-dc5026e7.entry.js} +1 -1
  857. package/dist/vega/p-e4674c00.entry.js +1 -0
  858. package/dist/vega/{p-311f338d.entry.js → p-e9ad8223.entry.js} +1 -1
  859. package/dist/vega/p-e9d2e0dc.entry.js +1 -0
  860. package/dist/vega/{p-86a300e8.entry.js → p-ebbaa112.entry.js} +1 -1
  861. package/dist/vega/p-ee1e7389.entry.js +1 -0
  862. package/dist/vega/{p-24042f0c.entry.js → p-f47de801.entry.js} +1 -1
  863. package/dist/vega/p-f993bcca.entry.js +1 -0
  864. package/dist/vega/{p-9ce0bd82.entry.js → p-fc8badd3.entry.js} +2 -2
  865. package/dist/vega/{p-42ec43ef.entry.js → p-fe6ea6cf.entry.js} +1 -1
  866. package/dist/vega/{p-92355996.entry.js → p-ffaee583.entry.js} +1 -1
  867. package/dist/vega/vega.esm.js +1 -1
  868. package/package.json +5 -3
  869. package/dist/cjs/content-state-fd5ad4a8.js +0 -1152
  870. package/dist/cjs/string-21427167.js +0 -13
  871. package/dist/cjs/types-a4295b11.js +0 -12
  872. package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/controllers/vega-calendar-event-bg-color-controller.js +0 -29
  873. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.js +0 -21
  874. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.js +0 -54
  875. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.js +0 -15
  876. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.js +0 -38
  877. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.js +0 -14
  878. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.js +0 -14
  879. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.js +0 -15
  880. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +0 -21
  881. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.js +0 -28
  882. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.js +0 -44
  883. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.js +0 -20
  884. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.js +0 -19
  885. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.js +0 -14
  886. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.js +0 -14
  887. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.js +0 -14
  888. package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.js +0 -14
  889. package/dist/esm/content-state-a43e703e.js +0 -1146
  890. package/dist/esm/string-be824360.js +0 -11
  891. package/dist/esm/types-0cadfd73.js +0 -12
  892. package/dist/types/components/vega-calendar/vega-calendar-event/slimmers/controllers/vega-calendar-event-bg-color-controller.d.ts +0 -12
  893. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.d.ts +0 -13
  894. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.d.ts +0 -16
  895. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.d.ts +0 -19
  896. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.d.ts +0 -19
  897. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.d.ts +0 -13
  898. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.d.ts +0 -23
  899. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.d.ts +0 -13
  900. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.d.ts +0 -13
  901. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.d.ts +0 -13
  902. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +0 -16
  903. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.d.ts +0 -20
  904. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.d.ts +0 -21
  905. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.d.ts +0 -15
  906. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.d.ts +0 -15
  907. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.d.ts +0 -13
  908. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.d.ts +0 -13
  909. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.d.ts +0 -13
  910. package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.d.ts +0 -13
  911. package/dist/vega/p-080db42b.entry.js +0 -1
  912. package/dist/vega/p-083af15f.entry.js +0 -1
  913. package/dist/vega/p-0b5330e1.entry.js +0 -1
  914. package/dist/vega/p-0bb29d98.js +0 -1
  915. package/dist/vega/p-1792a352.entry.js +0 -1
  916. package/dist/vega/p-1a4f77de.entry.js +0 -1
  917. package/dist/vega/p-1a6dacc7.entry.js +0 -1
  918. package/dist/vega/p-21d26bb4.js +0 -2
  919. package/dist/vega/p-27ec0c07.entry.js +0 -1
  920. package/dist/vega/p-317920e6.entry.js +0 -1
  921. package/dist/vega/p-376b3ec7.entry.js +0 -1
  922. package/dist/vega/p-394594e9.entry.js +0 -1
  923. package/dist/vega/p-39906ad2.entry.js +0 -1
  924. package/dist/vega/p-43263510.js +0 -1
  925. package/dist/vega/p-435451be.entry.js +0 -1
  926. package/dist/vega/p-45eb1e01.entry.js +0 -1
  927. package/dist/vega/p-472108bd.entry.js +0 -1
  928. package/dist/vega/p-47a4c625.js +0 -1
  929. package/dist/vega/p-48ae6f02.entry.js +0 -1
  930. package/dist/vega/p-48b24fd3.entry.js +0 -1
  931. package/dist/vega/p-5773a9a3.js +0 -1
  932. package/dist/vega/p-5fe47fe8.entry.js +0 -1
  933. package/dist/vega/p-61ea2d75.entry.js +0 -1
  934. package/dist/vega/p-63adca7b.entry.js +0 -1
  935. package/dist/vega/p-699032fc.entry.js +0 -1
  936. package/dist/vega/p-6be16084.js +0 -1
  937. package/dist/vega/p-71c65f7e.js +0 -1
  938. package/dist/vega/p-81279fea.entry.js +0 -1
  939. package/dist/vega/p-88e08a33.js +0 -1
  940. package/dist/vega/p-8e662f26.js +0 -1
  941. package/dist/vega/p-8f8de5ab.entry.js +0 -1
  942. package/dist/vega/p-9a956a00.js +0 -1
  943. package/dist/vega/p-9ca7467d.entry.js +0 -1
  944. package/dist/vega/p-9d6003ef.js +0 -1
  945. package/dist/vega/p-a04491cc.entry.js +0 -1
  946. package/dist/vega/p-a1056063.entry.js +0 -1
  947. package/dist/vega/p-a7042a5a.entry.js +0 -1
  948. package/dist/vega/p-acf7667e.entry.js +0 -1
  949. package/dist/vega/p-b21b128c.entry.js +0 -1
  950. package/dist/vega/p-b75a8edb.entry.js +0 -1
  951. package/dist/vega/p-c21295cf.entry.js +0 -1
  952. package/dist/vega/p-ce5a3589.entry.js +0 -1
  953. package/dist/vega/p-d1355307.js +0 -1
  954. package/dist/vega/p-d1cb7f28.js +0 -1
  955. package/dist/vega/p-d7e0c57a.js +0 -1
  956. package/dist/vega/p-e1ed78db.js +0 -1
  957. package/dist/vega/p-e7b00bf0.js +0 -1
  958. package/dist/vega/p-ef84dc90.entry.js +0 -1
  959. package/dist/vega/p-f229d6d1.js +0 -1
  960. package/dist/vega/p-f27fcc7c.entry.js +0 -1
  961. package/dist/vega/p-f3ab00ad.entry.js +0 -1
  962. package/dist/vega/p-f543e911.entry.js +0 -1
  963. package/dist/vega/p-f5ac60f5.js +0 -1
  964. package/dist/vega/p-f7b5833d.entry.js +0 -1
  965. package/dist/vega/p-fc02a67a.js +0 -1
@@ -1,10 +1,13 @@
1
- import { i as isNonNullable } from './type-guard-84b1f192.js';
2
1
  import { C as ChangeManager } from './change-manager-6a7eb88c.js';
3
- import { d as domNodeSubjectFactory } from './dom-node-subject-factory-6374611f.js';
4
- import { a as VegaInternalRichTextEditorFlushChanges, b as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-4072659b.js';
2
+ import { d as domNodeSubjectFactory } from './dom-node-subject-factory-202655e7.js';
3
+ import { b as VegaInternalRichTextEditorFlushChanges, c as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-b7c865de.js';
4
+ import { c as camelToDashCase } from './string-a953eafc.js';
5
5
  import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
6
+ import { i as isNonNullable } from './type-guard-84b1f192.js';
6
7
  import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-bedf3a1e.js';
7
- import { V as VegaInternalThemeManager } from './dark-mode-style-controller-ea798fc8.js';
8
+ import { V as VegaInternalThemeManager } from './dark-mode-style-controller-3bbb32dc.js';
9
+ import { c as cleanObject } from './object-66c37948.js';
10
+ import { f as findParent } from './ui-c20be16d.js';
8
11
 
9
12
  var InternalAnnotationTypeEnum;
10
13
  (function (InternalAnnotationTypeEnum) {
@@ -23,6 +26,8 @@ var BlockAnnotationTypeEnum;
23
26
  BlockAnnotationTypeEnum["ALIGNMENT"] = "ALIGNMENT";
24
27
  BlockAnnotationTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
25
28
  BlockAnnotationTypeEnum["INDENT"] = "INDENT";
29
+ BlockAnnotationTypeEnum["LIST"] = "LIST";
30
+ BlockAnnotationTypeEnum["INTERNAL_WRAPPER"] = "INTERNAL_WRAPPER";
26
31
  })(BlockAnnotationTypeEnum || (BlockAnnotationTypeEnum = {}));
27
32
  /**
28
33
  * BlockAnnotation is an abstract class that represents a block annotation.
@@ -37,16 +42,23 @@ class StateEntityRenderingRegistry {
37
42
  constructor() {
38
43
  this.domToEntity = new WeakMap();
39
44
  this.entityToDOM = new WeakMap();
45
+ this.contentEntityToRootDom = new Map();
46
+ this.rootDomToContentEntity = new WeakMap();
40
47
  }
41
48
  /**
42
49
  * Registers a DOM element and its corresponding entity.
43
50
  *
44
51
  * @param {HTMLElement} dom The DOM element to register.
45
- * @param {RTEBlock | RTENode} entity The entity to register.
52
+ * @param {RTEBlock | RTENode | VegaRTEContent} entity The entity to register.
46
53
  */
47
54
  register(dom, entity) {
48
- this.domToEntity.set(dom, entity);
49
- this.entityToDOM.set(entity, dom);
55
+ if (!this.isVegaRTEContent(entity)) {
56
+ this.domToEntity.set(dom, entity);
57
+ this.entityToDOM.set(entity, dom);
58
+ }
59
+ else {
60
+ this.registerRootDomAndContentEntity(dom, entity);
61
+ }
50
62
  }
51
63
  /**
52
64
  * Retrieves the entity corresponding to a DOM element.
@@ -64,7 +76,12 @@ class StateEntityRenderingRegistry {
64
76
  * @returns {Nullable<HTMLElement>} The DOM element corresponding to the entity, or null if not found.
65
77
  */
66
78
  getDOMByEntity(entity) {
67
- return this.entityToDOM.get(entity);
79
+ if (!this.isVegaRTEContent(entity)) {
80
+ return this.entityToDOM.get(entity);
81
+ }
82
+ else {
83
+ return this.contentEntityToRootDom.get(entity);
84
+ }
68
85
  }
69
86
  /**
70
87
  * Delete the dirty element to entity ref.
@@ -75,25 +92,46 @@ class StateEntityRenderingRegistry {
75
92
  removeDirtyDomRef(dom) {
76
93
  this.domToEntity.delete(dom);
77
94
  }
95
+ /**
96
+ * Bind the root dom ref and content entity.
97
+ *
98
+ * @param {HTMLElement} dom - The vega rich text editor ref.
99
+ * @param {VegaRTEContent} contentEntity - The rich text editor value content.
100
+ */
101
+ registerRootDomAndContentEntity(dom, contentEntity) {
102
+ const oldContent = this.rootDomToContentEntity.get(dom);
103
+ if (oldContent && oldContent !== contentEntity) {
104
+ this.contentEntityToRootDom.delete(oldContent);
105
+ }
106
+ this.rootDomToContentEntity.set(dom, contentEntity);
107
+ this.contentEntityToRootDom.set(contentEntity, dom);
108
+ }
109
+ /**
110
+ * Check the entity is VegaRTEContent instance.
111
+ *
112
+ * @param {VegaRTEContent | RTEBlock | RTENode} entity - The entity to check.
113
+ * @returns {entity is VegaRTEContent} - True if the entity is a VegaRTEContent instance, false otherwise.
114
+ */
115
+ isVegaRTEContent(entity) {
116
+ return entity && entity.constructor.name === 'VegaRTEContent';
117
+ }
78
118
  }
79
119
  const stateEntityRenderingRegistry = new StateEntityRenderingRegistry();
80
120
 
81
121
  var ModifyContentActionType;
82
122
  (function (ModifyContentActionType) {
83
- ModifyContentActionType["DELETE_CHILD"] = "DELETE_CHILD";
123
+ ModifyContentActionType["DELETE_CHILDREN"] = "DELETE_CHILDREN";
84
124
  ModifyContentActionType["DELETE_NEST_LIST"] = "DELETE_NEST_LIST";
85
125
  ModifyContentActionType["UPDATE_TEXT"] = "UPDATE_TEXT";
86
126
  ModifyContentActionType["REPLACE_SELECTED_TEXT"] = "REPLACE_SELECTED_TEXT";
87
- ModifyContentActionType["APPEND_CHILD_NODES"] = "APPEND_CHILD_NODES";
88
- ModifyContentActionType["INSERT_BLOCKS_AFTER"] = "INSERT_BLOCKS_AFTER";
89
- ModifyContentActionType["INSERT_BLOCKS_BEFORE"] = "INSERT_BLOCKS_BEFORE";
90
- ModifyContentActionType["INSERT_NODES_AFTER"] = "INSERT_NODES_AFTER";
91
- ModifyContentActionType["INSERT_NODES_BEFORE"] = "INSERT_NODES_BEFORE";
127
+ ModifyContentActionType["APPEND_CHILDREN"] = "APPEND_CHILDREN";
128
+ ModifyContentActionType["INSERT_CHILDREN_AFTER"] = "INSERT_CHILDREN_AFTER";
129
+ ModifyContentActionType["INSERT_CHILDREN_BEFORE"] = "INSERT_CHILDREN_BEFORE";
92
130
  ModifyContentActionType["SPLIT_BLOCK_WITH_NODE"] = "SPLIT_BLOCK_WITH_NODE";
93
131
  ModifyContentActionType["REPLACE_CHILD_NODES"] = "REPLACE_CHILD_NODES";
94
132
  ModifyContentActionType["REPLACE_NEST_LIST"] = "REPLACE_NEST_LIST";
95
133
  ModifyContentActionType["MERGE_TWO_BLOCKS_NODES"] = "MERGE_TWO_BLOCKS_NODES";
96
- ModifyContentActionType["BREAK_SINGLE_BLOCK"] = "BREAK_SINGLE_BLOCK";
134
+ ModifyContentActionType["INSERT_NEW_PARAGRAPH"] = "INSERT_NEW_PARAGRAPH";
97
135
  ModifyContentActionType["LINE_BREAK_SINGLE_BLOCK"] = "LINE_BREAK_SINGLE_BLOCK";
98
136
  ModifyContentActionType["LINE_BREAK_MULTIPLE_BLOCKS"] = "LINE_BREAK_MULTIPLE_BLOCKS";
99
137
  ModifyContentActionType["TRANSFORM_LIST_BLOCK"] = "TRANSFORM_LIST_BLOCK";
@@ -105,6 +143,11 @@ var ModifyContentActionType;
105
143
  ModifyContentActionType["UPDATE_CODE_BLOCK"] = "UPDATE_CODE_BLOCK";
106
144
  ModifyContentActionType["SWITCH_OUT_FROM_CODE_BLOCK"] = "SWITCH_OUT_FROM_CODE_BLOCK";
107
145
  ModifyContentActionType["DELETE_CODE_BLOCK"] = "DELETE_CODE_BLOCK";
146
+ ModifyContentActionType["UNLINK_LINK_GROUP"] = "UNLINK_LINK_GROUP";
147
+ ModifyContentActionType["LINK_GROUP_NODE_SPLIT"] = "LINK_GROUP_NODE_SPLIT";
148
+ ModifyContentActionType["DELETE_LINK_GROUP"] = "DELETE_LINK_GROUP";
149
+ ModifyContentActionType["UPDATE_CURSOR_POSITION"] = "UPDATE_CURSOR_POSITION";
150
+ ModifyContentActionType["INSERT_TEXT_TO_DECORATOR_NODE"] = "INSERT_TEXT_TO_DECORATOR_NODE";
108
151
  })(ModifyContentActionType || (ModifyContentActionType = {}));
109
152
  /**
110
153
  * Abstract class for update node content, delete node, insert node
@@ -115,6 +158,116 @@ class ModifyContentAction {
115
158
  }
116
159
  }
117
160
 
161
+ /**
162
+ * Annotation to represent a link of grouped nodes
163
+ */
164
+ class LinkGroupAnnotation extends Annotation {
165
+ constructor(groupKey) {
166
+ super();
167
+ this.type = InternalAnnotationTypeEnum.LINK_GROUP;
168
+ this.linkGroups = new Map();
169
+ this.linkGroups = new Map([[groupKey, []]]);
170
+ }
171
+ clone() {
172
+ const clonedAnnotation = new LinkGroupAnnotation('');
173
+ this.linkGroups.forEach((nodes, key) => {
174
+ clonedAnnotation.linkGroups.set(key, nodes.map((node) => node.clone()));
175
+ });
176
+ return clonedAnnotation;
177
+ }
178
+ /**
179
+ * Convert the custom style, class and attribute to string which html can used
180
+ *
181
+ * @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
182
+ * @param {RTERenderContext} options - options.
183
+ * @returns {string} - string.
184
+ */
185
+ toString(linkAnnotation, options) {
186
+ const attributes = this.toJsx(linkAnnotation, options);
187
+ return Object.entries(attributes)
188
+ .map(([key, value]) => {
189
+ const valueString = typeof value === 'string' ? value : this.formatStyleToString(value);
190
+ return `${camelToDashCase(key)}="${valueString}"`;
191
+ })
192
+ .join(' ');
193
+ }
194
+ /**
195
+ * Convert the custom style, class and attribute to JSX attributes
196
+ *
197
+ * @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
198
+ * @param {RTERenderContext} options - options.
199
+ * @returns {Record<string, string | AnnotationStyle>} JSX used attributes.
200
+ */
201
+ toJsx(linkAnnotation, options) {
202
+ const linkStyle = this.getStyle(linkAnnotation, options);
203
+ const linkClass = this.getClass(linkAnnotation, options);
204
+ const attributes = this.getAttribute(linkAnnotation, options);
205
+ if (linkClass.length > 0) {
206
+ attributes.class = linkClass.join(' ');
207
+ }
208
+ if (linkStyle && Object.keys(linkStyle).length > 0) {
209
+ attributes.style = linkStyle;
210
+ }
211
+ return attributes;
212
+ }
213
+ /**
214
+ * Get the custom class for the annotation
215
+ *
216
+ * @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
217
+ * @param {RTERenderContext} options - options.
218
+ * @returns {string[]} Link class
219
+ */
220
+ getClass(linkAnnotation, options) {
221
+ const linkClass = [];
222
+ if (linkAnnotation.link.customClass)
223
+ linkClass.push(...linkAnnotation.link.customClass);
224
+ if (!(options === null || options === void 0 ? void 0 : options.standalone) && linkAnnotation.useInternalStyle)
225
+ linkClass.push('v-rte--link');
226
+ return linkClass;
227
+ }
228
+ /**
229
+ * Get the custom style for the annotation
230
+ *
231
+ * @param {LinkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
232
+ * @param {RTERenderContext} options - options.
233
+ * @returns {AnnotationStyle} Link style
234
+ */
235
+ getStyle(linkAnnotation, options) {
236
+ const linkStyle = {};
237
+ if (linkAnnotation.link.customStyle)
238
+ Object.assign(linkStyle, linkAnnotation.link.customStyle);
239
+ if ((options === null || options === void 0 ? void 0 : options.standalone) && linkAnnotation.useInternalStyle) {
240
+ linkStyle.color = 'rgba(var(--v-text-link, 19, 98, 226, 1))';
241
+ }
242
+ return linkStyle;
243
+ }
244
+ /**
245
+ * Get the custom attribute for the annotation
246
+ *
247
+ * @param {LinkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
248
+ * @param {RTERenderContext} options - Render context options.
249
+ * @returns {Record<string, string>} Link attributes
250
+ */
251
+ getAttribute(linkAnnotation, options) {
252
+ var _a;
253
+ const { href, customAttribute = {} } = linkAnnotation.link;
254
+ const autoMatchFormat = (_a = options === null || options === void 0 ? void 0 : options.autoMatchFormat) !== null && _a !== void 0 ? _a : true;
255
+ const target = customAttribute.target || (autoMatchFormat ? '_blank' : '');
256
+ return Object.assign(Object.assign(Object.assign({}, customAttribute), (href ? { href } : autoMatchFormat ? { href } : {})), (target ? { target } : {}));
257
+ }
258
+ /**
259
+ * Convert style to string which can be used to html string.
260
+ *
261
+ * @param {AnnotationStyle} style Style object.
262
+ * @returns {string} Style string
263
+ */
264
+ formatStyleToString(style) {
265
+ return Object.entries(style)
266
+ .map(([key, value]) => `${camelToDashCase(key)}: ${value};`)
267
+ .join(' ');
268
+ }
269
+ }
270
+
118
271
  /**
119
272
  * Annotation to make block with horizontal alignment
120
273
  */
@@ -144,12 +297,20 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
144
297
  };
145
298
  }
146
299
  /**
147
- * Generate the class for the annotation
148
- *
149
- * @returns {string} - Annotation class
300
+ * @inheritDoc
150
301
  */
151
- renderClass() {
152
- return `v-rte--horizontal-alignment-${this.textAlign}`;
302
+ renderClass(options) {
303
+ if (options === null || options === void 0 ? void 0 : options.standalone)
304
+ return null;
305
+ switch (this.textAlign) {
306
+ case 'right':
307
+ case 'center':
308
+ case 'justify':
309
+ return `v-rte--horizontal-alignment-${this.textAlign}`;
310
+ case 'left':
311
+ default:
312
+ return `v-rte--horizontal-alignment-left`;
313
+ }
153
314
  }
154
315
  /**
155
316
  * @inheritDoc
@@ -158,12 +319,20 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
158
319
  return new HorizontalAlignmentAnnotation(this.textAlign);
159
320
  }
160
321
  /**
161
- * Generate the style for the annotation
162
- *
163
- * @returns {Nullable<AnnotationStyle>} - Annotation style
322
+ * @inheritDoc
164
323
  */
165
- render() {
166
- return null;
324
+ renderStyle(options) {
325
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
326
+ return null;
327
+ switch (this.textAlign) {
328
+ case 'right':
329
+ case 'center':
330
+ case 'justify':
331
+ return { textAlign: this.textAlign };
332
+ case 'left':
333
+ default:
334
+ return { textAlign: 'left' };
335
+ }
167
336
  }
168
337
  }
169
338
 
@@ -199,13 +368,19 @@ class IndentAnnotation extends BlockAnnotation {
199
368
  clone() {
200
369
  return new IndentAnnotation(this.indent);
201
370
  }
371
+ /**
372
+ * @inheritDoc
373
+ */
374
+ renderClass() {
375
+ return null;
376
+ }
202
377
  /**
203
378
  * Generate the style for the annotation
204
379
  *
205
380
  * @returns {Nullable<AnnotationStyle>} - Annotation style
206
381
  */
207
- render() {
208
- return this.indent > 0 ? { 'margin-left': `${this.indent * 16}px` } : null;
382
+ renderStyle() {
383
+ return this.indent > 0 ? { marginLeft: `${this.indent * 16}px` } : null;
209
384
  }
210
385
  }
211
386
 
@@ -264,6 +439,259 @@ class ActionHandleStrategyRegistry {
264
439
  }
265
440
  ActionHandleStrategyRegistry.registry = new Map();
266
441
 
442
+ var CommonAnnotationTypeEnum;
443
+ (function (CommonAnnotationTypeEnum) {
444
+ CommonAnnotationTypeEnum["CUSTOM_ATTRIBUTE"] = "CUSTOM_ATTRIBUTE";
445
+ CommonAnnotationTypeEnum["CUSTOM_CLASS"] = "CUSTOM_CLASS";
446
+ CommonAnnotationTypeEnum["CUSTOM_STYLE"] = "CUSTOM_STYLE";
447
+ })(CommonAnnotationTypeEnum || (CommonAnnotationTypeEnum = {}));
448
+ /**
449
+ * CommonAnnotation is an abstract class that represents common annotation for block and node.
450
+ */
451
+ class CommonAnnotation extends Annotation {
452
+ }
453
+
454
+ /**
455
+ * Annotation to add custom attributes of element
456
+ */
457
+ class CustomAttributeAnnotation extends CommonAnnotation {
458
+ constructor(customAttribute) {
459
+ super();
460
+ this.type = CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE;
461
+ this.BOOLEAN_ATTRS = new Set([
462
+ 'controls',
463
+ 'disabled',
464
+ 'checked',
465
+ 'readonly',
466
+ 'multiple',
467
+ 'required',
468
+ 'autoplay',
469
+ 'muted',
470
+ ]);
471
+ this.customAttribute = customAttribute;
472
+ }
473
+ /**
474
+ * Generate the map item for the annotation
475
+ *
476
+ * @param {Record<string, string>} customizeAttribute - custom attribute annotation
477
+ * @returns {[CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE, CustomAttributeAnnotation]} Map item for the annotation
478
+ */
479
+ static from(customizeAttribute) {
480
+ return [CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE, new CustomAttributeAnnotation(customizeAttribute)];
481
+ }
482
+ /**
483
+ * Generate the JSON representation of the annotation
484
+ *
485
+ * @returns {Record<string, unknown>} JSON representation of the annotation
486
+ */
487
+ toJSON() {
488
+ return {
489
+ customAttribute: this.customAttribute,
490
+ };
491
+ }
492
+ /**
493
+ * Create a new custom attribute annotation
494
+ *
495
+ * @returns {CustomAttributeAnnotation} - Custom attribute annotation
496
+ */
497
+ clone() {
498
+ return new CustomAttributeAnnotation(this.customAttribute);
499
+ }
500
+ /**
501
+ * Generate the custom attribute of current element, excluding 'style' and 'class'
502
+ *
503
+ * @param {string[]} filterAttr - should filter these existed attrs
504
+ * @returns {string[]} - Custom attributes
505
+ */
506
+ toString(filterAttr = []) {
507
+ const filterAttrKeys = filterAttr.map((attr) => attr.split('=')[0]);
508
+ return Object.keys(this.customAttribute)
509
+ .map((key) => {
510
+ return !filterAttrKeys.includes(key) ? `${key}="${this.customAttribute[key]}"` : null;
511
+ })
512
+ .filter(isNonNullable);
513
+ }
514
+ /**
515
+ * Generate the custom attribute for the annotation
516
+ *
517
+ * @param {RTERenderCustomAttributes} options - should filter these certain attrs
518
+ * @returns {Record<string, string>} custom attribute
519
+ */
520
+ render(options = {}) {
521
+ var _a;
522
+ const customAttribute = Object.assign({}, this.customAttribute);
523
+ (_a = options.filterAttributes) === null || _a === void 0 ? void 0 : _a.forEach((attr) => delete customAttribute[attr]);
524
+ Object.keys(customAttribute).forEach((key) => {
525
+ if (this.BOOLEAN_ATTRS.has(key) && customAttribute[key] === '') {
526
+ customAttribute[key] = 'true';
527
+ }
528
+ });
529
+ return customAttribute;
530
+ }
531
+ }
532
+
533
+ /**
534
+ * Annotation to add custom class of element
535
+ */
536
+ class CustomClassAnnotation extends CommonAnnotation {
537
+ constructor(customClass) {
538
+ super();
539
+ this.type = CommonAnnotationTypeEnum.CUSTOM_CLASS;
540
+ this.customClass = customClass;
541
+ }
542
+ /**
543
+ * Generate the map item for the annotation
544
+ *
545
+ * @param {string[]} customClass - custom class annotation
546
+ * @returns {[CommonAnnotationTypeEnum.CUSTOM_CLASS, CustomClassAnnotation]} Map item for the annotation
547
+ */
548
+ static from(customClass) {
549
+ return [CommonAnnotationTypeEnum.CUSTOM_CLASS, new CustomClassAnnotation(customClass)];
550
+ }
551
+ /**
552
+ * Generate the JSON representation of the annotation
553
+ *
554
+ * @returns {Record<string, unknown>} JSON representation of the annotation
555
+ */
556
+ toJSON() {
557
+ return {
558
+ customClass: this.customClass,
559
+ };
560
+ }
561
+ /**
562
+ * Create a new custom class annotation
563
+ *
564
+ * @returns {CustomClassAnnotation} - Custom class annotation
565
+ */
566
+ clone() {
567
+ return new CustomClassAnnotation(this.customClass);
568
+ }
569
+ /**
570
+ * Generate the custom class of current element
571
+ *
572
+ * @returns {string} - Custom class
573
+ */
574
+ toString() {
575
+ return `class="${this.customClass.join(' ')}"`;
576
+ }
577
+ /**
578
+ * Generate the custom attribute for the annotation
579
+ *
580
+ * @returns {string[]} custom classes
581
+ */
582
+ renderClass() {
583
+ return this.customClass;
584
+ }
585
+ }
586
+
587
+ /**
588
+ * Annotation to add custom attributes of element
589
+ */
590
+ class CustomStyleAnnotation extends CommonAnnotation {
591
+ constructor(customStyle) {
592
+ super();
593
+ this.type = CommonAnnotationTypeEnum.CUSTOM_STYLE;
594
+ this.customStyle = customStyle;
595
+ }
596
+ /**
597
+ * Generate the map item for the annotation
598
+ *
599
+ * @param {AnnotationStyle} customStyle - custom attribute annotation
600
+ * @returns {[CommonAnnotationTypeEnum.CUSTOM_STYLE, CustomStyleAnnotation]} Map item for the annotation
601
+ */
602
+ static from(customStyle) {
603
+ return [CommonAnnotationTypeEnum.CUSTOM_STYLE, new CustomStyleAnnotation(customStyle)];
604
+ }
605
+ /**
606
+ * Generate the JSON representation of the annotation
607
+ *
608
+ * @returns {Record<string, unknown>} JSON representation of the annotation
609
+ */
610
+ toJSON() {
611
+ return {
612
+ customStyle: this.customStyle,
613
+ };
614
+ }
615
+ /**
616
+ * Create a new custom attribute annotation
617
+ *
618
+ * @returns {CustomStyleAnnotation} - Custom attribute annotation
619
+ */
620
+ clone() {
621
+ return new CustomStyleAnnotation(this.customStyle);
622
+ }
623
+ /**
624
+ * Generate the custom attribute for the annotation
625
+ *
626
+ * @returns {AnnotationStyle} custom attribute
627
+ */
628
+ renderStyle() {
629
+ return this.customStyle;
630
+ }
631
+ /**
632
+ * Remove the style
633
+ *
634
+ * @param {string[]} styleKeys - custom attribute annotation
635
+ * @returns {AnnotationStyle} Map item for the annotation
636
+ */
637
+ removeStyles(styleKeys) {
638
+ const customStyle = Object.assign({}, this.customStyle);
639
+ styleKeys.forEach((item) => delete customStyle[item]);
640
+ return customStyle;
641
+ }
642
+ /**
643
+ * Generate the custom style string for the annotation
644
+ *
645
+ * @returns {string} custom style string
646
+ */
647
+ toString() {
648
+ return `style="${Object.entries(this.customStyle)
649
+ .map(([key, value]) => `${key}: ${value};`)
650
+ .join(' ')}"`;
651
+ }
652
+ }
653
+
654
+ /**
655
+ * Internal wrapper annotation for block node.
656
+ */
657
+ class InternalWrapperAnnotation extends BlockAnnotation {
658
+ constructor(internalWrapper) {
659
+ super();
660
+ this.type = BlockAnnotationTypeEnum.INTERNAL_WRAPPER;
661
+ this.internalWrapper = internalWrapper;
662
+ }
663
+ /**
664
+ * @inheritDoc
665
+ */
666
+ static from(internalWrapper) {
667
+ return [BlockAnnotationTypeEnum.INTERNAL_WRAPPER, new InternalWrapperAnnotation(internalWrapper)];
668
+ }
669
+ /**
670
+ * @inheritDoc
671
+ */
672
+ clone() {
673
+ return new InternalWrapperAnnotation(this.internalWrapper);
674
+ }
675
+ /**
676
+ * @inheritDoc
677
+ */
678
+ renderClass() {
679
+ return undefined;
680
+ }
681
+ /**
682
+ * @inheritDoc
683
+ */
684
+ renderStyle() {
685
+ return undefined;
686
+ }
687
+ /**
688
+ * @inheritDoc
689
+ */
690
+ toJSON() {
691
+ return this.internalWrapper ? { internalWrapper: this.internalWrapper } : undefined;
692
+ }
693
+ }
694
+
267
695
  /**
268
696
  * Abstract class for block
269
697
  */
@@ -272,6 +700,15 @@ class RTEBlock {
272
700
  this.annotationMap = new Map();
273
701
  this.id = id;
274
702
  }
703
+ /**
704
+ * Creates a new instance of the block from the given JSON object.
705
+ *
706
+ * @param {unknown} json - The JSON object to create the block from.
707
+ * @param {VegaRTETransformOptions} options - Options for transforming the block.
708
+ */
709
+ static from(json, options) {
710
+ throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${options}) is not implemented. Please implement this method in the subclass.`);
711
+ }
275
712
  /**
276
713
  * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
277
714
  * and value.
@@ -281,7 +718,7 @@ class RTEBlock {
281
718
  * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
282
719
  * that will be used to create the annotation entity. It can be of any type depending on the specific
283
720
  * annotation being created.
284
- * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
721
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
285
722
  * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
286
723
  */
287
724
  static createAnnotationEntity(type, value) {
@@ -290,6 +727,44 @@ class RTEBlock {
290
727
  return HorizontalAlignmentAnnotation.from(value);
291
728
  case 'indent':
292
729
  return IndentAnnotation.from(value);
730
+ case 'customAttribute':
731
+ return CustomAttributeAnnotation.from(value);
732
+ case 'customClass':
733
+ return CustomClassAnnotation.from(value);
734
+ case 'customStyle':
735
+ return CustomStyleAnnotation.from(value);
736
+ case 'internalWrapper':
737
+ return InternalWrapperAnnotation.from(value);
738
+ }
739
+ }
740
+ /**
741
+ * Converts annotations to an array of block annotation entities.
742
+ *
743
+ * @param {BlockAnnotations} annotationMap - The map to store the converted annotations.
744
+ * @param {VegaRTEBlockAnnotations} annotations - The annotations to convert.
745
+ */
746
+ static convertAnnotationsToMap(annotationMap, annotations) {
747
+ Object.entries(annotations).forEach(([type, value]) => {
748
+ const item = this.createAnnotationEntity(type, value);
749
+ if (isNonNullable(item)) {
750
+ annotationMap.set(...item);
751
+ }
752
+ });
753
+ }
754
+ /**
755
+ * Check if the block should be rendered as a wrapper.
756
+ *
757
+ * @returns {boolean} - Returns true if the block is an internal wrapper.
758
+ */
759
+ shouldRenderAsInternalWrapper() {
760
+ const internalWrapperAnnotation = this.getAnnotationByType(BlockAnnotationTypeEnum.INTERNAL_WRAPPER);
761
+ if (internalWrapperAnnotation) {
762
+ return (internalWrapperAnnotation.internalWrapper &&
763
+ Array.from(this.annotationMap.values()).filter((annotation) => !(annotation instanceof LinkGroupAnnotation) &&
764
+ !(annotation instanceof InternalWrapperAnnotation)).length === 0);
765
+ }
766
+ else {
767
+ return false;
293
768
  }
294
769
  }
295
770
  /**
@@ -299,7 +774,7 @@ class RTEBlock {
299
774
  */
300
775
  toJSON() {
301
776
  const annotations = Array.from(this.annotationMap.values())
302
- .filter((annotation) => annotation instanceof BlockAnnotation)
777
+ .filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CommonAnnotation)
303
778
  .reduce((record, annotation) => {
304
779
  return Object.assign(Object.assign({}, record), annotation.toJSON());
305
780
  }, {});
@@ -340,6 +815,61 @@ class RTEBlock {
340
815
  isListItemBlock() {
341
816
  return this.type === 'list-item';
342
817
  }
818
+ /**
819
+ * Get styles from annotations
820
+ *
821
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
822
+ * @returns {AnnotationStyle} - Annotation styles
823
+ */
824
+ getStyles(options = { standalone: false }) {
825
+ return Object.assign(Object.assign({}, Array.from(this.annotationMap.values())
826
+ .filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomStyleAnnotation)
827
+ .map((annotation) => annotation.renderStyle(options))
828
+ .filter(isNonNullable)
829
+ .reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {})), (this.shouldRenderAsInternalWrapper() ? { display: 'contents' } : {}));
830
+ }
831
+ /**
832
+ * Get classes from annotations
833
+ *
834
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control standalone mode
835
+ * @returns {string} - Annotation style
836
+ */
837
+ getClasses(options = { standalone: false }) {
838
+ return Array.from(this.annotationMap.values())
839
+ .filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomClassAnnotation)
840
+ .map((annotation) => annotation.renderClass(options))
841
+ .filter(isNonNullable)
842
+ .reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
843
+ }
844
+ /**
845
+ * Get custom attribute annotation, excluding "class" and "style"
846
+ *
847
+ * @returns {Nullable<CustomAttributeAnnotation>} - custom attribute annotation
848
+ */
849
+ getCustomAttributesAnnotation() {
850
+ return this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
851
+ }
852
+ /**
853
+ * Generate attributes as string
854
+ *
855
+ * @param {...string} attrs - Additional attributes to include
856
+ * @returns {string} - Attributes as string
857
+ */
858
+ generateAttributeString(...attrs) {
859
+ var _a;
860
+ const styles = Object.entries(Object.assign({}, this.getStyles({ standalone: true })))
861
+ .map(([key, value]) => `${camelToDashCase(key)}: ${value};`)
862
+ .join('');
863
+ const customClassAnnotation = this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_CLASS);
864
+ const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
865
+ const attributes = [
866
+ ...customAttributeString,
867
+ customClassAnnotation === null || customClassAnnotation === void 0 ? void 0 : customClassAnnotation.toString(),
868
+ styles ? `style="${styles}"` : null,
869
+ ...attrs,
870
+ ].filter(isNonNullable);
871
+ return attributes.length ? ` ${attributes.join(' ')}` : '';
872
+ }
343
873
  /**
344
874
  * Apply action to block
345
875
  *
@@ -360,7 +890,9 @@ class RTEBlock {
360
890
  */
361
891
  applyAnnotationAction(action) {
362
892
  const annotation = action.toAnnotation();
363
- this.annotationMap.set(annotation.type, annotation);
893
+ if (!(annotation instanceof LinkGroupAnnotation)) {
894
+ this.annotationMap.set(annotation.type, annotation);
895
+ }
364
896
  typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
365
897
  }
366
898
  /**
@@ -373,8 +905,28 @@ class RTEBlock {
373
905
  }
374
906
  }
375
907
 
376
- var NodeTypeEnum;
377
- (function (NodeTypeEnum) {
908
+ var NodeAnnotationTypeEnum;
909
+ (function (NodeAnnotationTypeEnum) {
910
+ NodeAnnotationTypeEnum["BOLD"] = "BOLD";
911
+ NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
912
+ NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
913
+ NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
914
+ NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
915
+ NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
916
+ NodeAnnotationTypeEnum["CODE"] = "CODE";
917
+ NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
918
+ NodeAnnotationTypeEnum["LINK"] = "LINK";
919
+ NodeAnnotationTypeEnum["INLINE_HTML"] = "INLINE_HTML";
920
+ NodeAnnotationTypeEnum["PLAIN_TEXT"] = "PLAIN_TEXT";
921
+ })(NodeAnnotationTypeEnum || (NodeAnnotationTypeEnum = {}));
922
+ /**
923
+ * Abstract class for all annotations
924
+ */
925
+ class NodeAnnotation extends Annotation {
926
+ }
927
+
928
+ var NodeTypeEnum;
929
+ (function (NodeTypeEnum) {
378
930
  NodeTypeEnum["TEXT"] = "TEXT";
379
931
  NodeTypeEnum["IMAGE"] = "IMAGE";
380
932
  NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
@@ -390,6 +942,34 @@ class RTENode {
390
942
  this.annotationMap = annotationMap;
391
943
  }
392
944
  }
945
+ /**
946
+ * Creates a new instance of the RTENode from the given JSON data.
947
+ *
948
+ * @param {unknown} json - The JSON data to create the node from.
949
+ * @param {RTEBlock} parentBlock - The parent block of the node.
950
+ * @param {VegaRTETransformOptions} options - Options for transforming the node.
951
+ */
952
+ static from(json, parentBlock, options) {
953
+ throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${parentBlock}, ${options}) is not implemented. Please implement this method in the subclass.`);
954
+ }
955
+ /**
956
+ * Creates different types of text annotations based on the provided type and value.
957
+ *
958
+ * @param {keyof VegaRTETextAnnotations} type - The key of the type.
959
+ * @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
960
+ * @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
961
+ * value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
962
+ */
963
+ static createAnnotationEntity(type, value) {
964
+ switch (type) {
965
+ case 'customAttribute':
966
+ return CustomAttributeAnnotation.from(value);
967
+ case 'customClass':
968
+ return CustomClassAnnotation.from(value);
969
+ case 'customStyle':
970
+ return CustomStyleAnnotation.from(value);
971
+ }
972
+ }
393
973
  /**
394
974
  * Get annotation by type
395
975
  *
@@ -423,576 +1003,151 @@ class RTENode {
423
1003
  return this;
424
1004
  }
425
1005
  /**
426
- * apply annotation action or modify content action
427
- *
428
- * @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
429
- */
430
- doApply(action) {
431
- if (action instanceof ModifyContentAction) {
432
- this.doModifyActionApply(action);
433
- }
434
- else {
435
- this.doAnnotationActionApply(action);
436
- }
437
- }
438
- /**
439
- * Flush the value change
440
- */
441
- flushChange() {
442
- const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
443
- if (domNode) {
444
- const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
445
- if (nodeSubject) {
446
- ChangeManager.notify(nodeSubject, {});
447
- }
448
- }
449
- }
450
- /**
451
- * Clones the annotations of the current RTETextNode.
452
- *
453
- * @returns {NodeAnnotations} A new Map containing cloned annotations.
454
- */
455
- cloneAnnotations() {
456
- return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
457
- }
458
- }
459
-
460
- var NodeAnnotationTypeEnum;
461
- (function (NodeAnnotationTypeEnum) {
462
- NodeAnnotationTypeEnum["BOLD"] = "BOLD";
463
- NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
464
- NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
465
- NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
466
- NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
467
- NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
468
- NodeAnnotationTypeEnum["CODE"] = "CODE";
469
- NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
470
- NodeAnnotationTypeEnum["LINK"] = "LINK";
471
- })(NodeAnnotationTypeEnum || (NodeAnnotationTypeEnum = {}));
472
- /**
473
- * Abstract class for all annotations
474
- */
475
- class NodeAnnotation extends Annotation {
476
- }
477
-
478
- /**
479
- * Annotation for image
480
- */
481
- class ImageAnnotation extends NodeAnnotation {
482
- constructor(size = 'md', alt) {
483
- super();
484
- this.type = NodeAnnotationTypeEnum.IMAGE;
485
- this.size = size;
486
- this.alt = alt;
487
- }
488
- /**
489
- * Generate the map item for the annotation
490
- *
491
- * @param {string} size - Image size
492
- * @param {string} alt - Image alt
493
- * @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
494
- */
495
- static from(size, alt) {
496
- return [NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
497
- }
498
- /**
499
- * Generate the JSON representation of the annotation
1006
+ * Get styles from annotations
500
1007
  *
501
- * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
1008
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
1009
+ * @returns {AnnotationStyle} - Annotation styles
502
1010
  */
503
- toJSON() {
504
- return isNonNullable(this.alt)
505
- ? {
506
- size: this.size,
507
- alt: this.alt,
508
- }
509
- : {
510
- size: this.size,
511
- };
1011
+ getStyles(options = { standalone: false }) {
1012
+ const styles = Array.from(this.annotationMap.values())
1013
+ .filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomStyleAnnotation)
1014
+ .map((annotation) => annotation.renderStyle(options))
1015
+ .filter(Boolean);
1016
+ return this.mergeAnnotationStyles(styles, ['textDecoration']);
512
1017
  }
513
1018
  /**
514
- * @inheritDoc
515
- */
516
- clone() {
517
- return new ImageAnnotation(this.size, this.alt);
518
- }
519
- /**
520
- * Generate the style for the image
521
- *
522
- * @returns {Nullable<AnnotationStyle>} image style
523
- */
524
- render() {
525
- switch (this.size) {
526
- case 'sm': {
527
- return { width: '25%' };
528
- }
529
- case 'md': {
530
- return { width: '50%' };
531
- }
532
- case 'lg': {
533
- return { width: '100%' };
534
- }
535
- }
536
- }
537
- }
538
-
539
- /**
540
- * The base action handle strategy class, use to modify the rich text node content or modify the annotation.
541
- */
542
- class ActionHandleStrategy {
543
- /**
544
- * Public method to invoke the handle logic.
1019
+ * Get classes from annotations
545
1020
  *
546
- * @typedef R generic type
547
- * @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
548
- * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
549
- * @returns {R} - The invoke result in special strategy.
550
- */
551
- execute(action, target) {
552
- LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
553
- return this.handleAction(action, target);
554
- }
555
- /**
556
- * Checks if the caret position is at the end of a specified RTETextNode.
557
- *
558
- * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
559
- * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
560
- * @param {number} startOffset - The position within the text node where the caret is located.
561
- * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
562
- */
563
- isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
564
- const lastNode = textBlock.children[textBlock.children.length - 1];
565
- return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
566
- }
567
- /**
568
- * Checks if the caret position is at the start of a specified RTETextNode.
569
- *
570
- * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
571
- * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
572
- * @param {number} startOffset - The position within the text node where the caret is located.
573
- * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
1021
+ * @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
1022
+ * @returns {string} - Annotation style
574
1023
  */
575
- isCaretPositionAtTextBlockStart(textBlock, node, startOffset) {
576
- return node === textBlock.children[0] && startOffset === 0;
1024
+ getClasses(options = { standalone: false }) {
1025
+ return Array.from(this.annotationMap.values())
1026
+ .filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomClassAnnotation)
1027
+ .map((annotation) => annotation.renderClass(options))
1028
+ .filter(isNonNullable)
1029
+ .reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
577
1030
  }
578
1031
  /**
579
- * Checks if the caret position is at the start of a specified RTEImageNode.
1032
+ * Get custom attribute annotation, excluding "class" and "style"
580
1033
  *
581
- * @param {RTEImageBlock} target - The image block.
582
- * @param {RTEImageNode} node - `RTEImageNode` - a node representing an image in a rich text editor.
583
- * @param {number} startOffset - The position within the text node where the caret is located.
584
- * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTEImageNode.
1034
+ * @returns {CustomAttributeAnnotation} - custom attribute annotation
585
1035
  */
586
- isCaretPositionAtImageBlockStart(target, node, startOffset) {
587
- return node === target.children[0] && startOffset === 0;
1036
+ getCustomAttributesAnnotation() {
1037
+ return this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
588
1038
  }
589
1039
  /**
590
- * Checks if the caret position is at the end of a given RTEImageNode.
1040
+ * Check if the node is a text node.
591
1041
  *
592
- * @param {RTEImageBlock} target - The image block.
593
- * @param {RTEImageNode} node - `node` is a RTEImageNode
594
- * @param {number} startOffset - The position within the `RTEImageNode` where the caret is located.
595
- * @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEImageNode`.
1042
+ * @returns {boolean} - True if the node is a text node, false otherwise.
596
1043
  */
597
- isCaretPositionAtImageBlockEnd(target, node, startOffset) {
598
- const lastNode = target.children[target.children.length - 1];
599
- return node === lastNode && startOffset === 1;
1044
+ isTextNode() {
1045
+ return false;
600
1046
  }
601
- }
602
-
603
- /**
604
- * Update the image node annotation map strategy.
605
- */
606
- class ImageSetAnnotationMapStrategy extends ActionHandleStrategy {
607
1047
  /**
608
- * @inheritDoc
609
- */
610
- handleAction(action, target) {
611
- const annotation = action.toAnnotation();
612
- target.annotationMap.set(annotation.type, annotation);
613
- }
614
- }
615
-
616
- /**
617
- * The image node update property url strategy.
618
- */
619
- class ImageUpdateUrlStrategy extends ActionHandleStrategy {
620
- /**
621
- * @inheritDoc
622
- */
623
- handleAction(action, target) {
624
- target.url = action.url;
625
- }
626
- }
627
-
628
- /**
629
- * Abstract class for annotation actions
630
- */
631
- class AnnotationAction {
632
- }
633
-
634
- /**
635
- * Image node
636
- */
637
- class RTEImageNode extends RTENode {
638
- constructor(id, url, parentBlock, annotationMap) {
639
- super(id, annotationMap);
640
- this.type = NodeTypeEnum.IMAGE;
641
- this.url = url;
642
- this.parent = parentBlock;
643
- }
644
- /**
645
- * Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
1048
+ * Generate attributes as string
646
1049
  *
647
- * @param {VegaRTEImageNode} node - The node to be converted.
648
- * @param {RTEImageBlock} parentBlock - The parent block
649
- * @returns {RTEImageNode} An instance of `RTEImageBlock`
650
- */
651
- static from(node, parentBlock) {
652
- const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
653
- let annotations;
654
- if (!node.annotations || Object.keys(node.annotations).length === 0) {
655
- annotations = { size: 'md' };
656
- }
657
- else {
658
- annotations = node.annotations;
659
- }
660
- imageNode.annotationMap = new Map(Object.keys(annotations)
661
- .map(() => ImageAnnotation.from(annotations.size, annotations.alt))
662
- .filter(isNonNullable));
663
- return imageNode;
664
- }
665
- /**
666
- * @inheritDoc
1050
+ * @param {...string} attrs - Additional attributes to include
1051
+ * @returns {string} - Attributes as string
667
1052
  */
668
- toJSON() {
669
- const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
670
- const annotations = {};
671
- if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size) {
672
- annotations.size = imageAnnotation.size;
673
- }
674
- if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt) {
675
- annotations.alt = imageAnnotation.alt;
676
- }
677
- return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
1053
+ generateAttributeString(...attrs) {
1054
+ var _a;
1055
+ const styles = Object.entries(Object.assign({}, this.getStyles({ standalone: true })))
1056
+ .map(([key, value]) => `${camelToDashCase(key)}: ${value};`)
1057
+ .join('');
1058
+ const customClassAnnotation = this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_CLASS);
1059
+ const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
1060
+ const attributes = [
1061
+ ...customAttributeString,
1062
+ customClassAnnotation === null || customClassAnnotation === void 0 ? void 0 : customClassAnnotation.toString(),
1063
+ styles ? `style="${styles}"` : null,
1064
+ ...attrs,
1065
+ ].filter(isNonNullable);
1066
+ return attributes.length ? ` ${attributes.join(' ')}` : '';
678
1067
  }
679
1068
  /**
680
- * @inheritDoc
681
- */
682
- clone() {
683
- return new RTEImageNode(this.id, this.url, this.parent, super.cloneAnnotations());
684
- }
685
- /**
686
- * @inheritDoc
687
- */
688
- doAnnotationActionApply(action) {
689
- const strategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTEImageNode.name);
690
- if (strategy) {
691
- strategy.execute(action, this);
692
- }
693
- }
694
- /**
695
- * @inheritDoc
696
- */
697
- doModifyActionApply(action) {
698
- ActionHandleStrategyRegistry.executeTheStrategy(action, this);
699
- }
700
- }
701
- (() => {
702
- ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_IMAGE_NODE_URL, RTEImageNode.name, new ImageUpdateUrlStrategy());
703
- ActionHandleStrategyRegistry.register(AnnotationAction.name, RTEImageNode.name, new ImageSetAnnotationMapStrategy());
704
- })();
705
-
706
- /**
707
- * Delete child node or child block from the current list action
708
- *
709
- * @example needRemovedNode.parentBlock.apply(new RemoveChildAction(needRemovedNode))
710
- * @example needRemovedBlock.parent.apply(new RemoveChildAction(needRemovedBlock))
711
- */
712
- class RemoveChildAction extends ModifyContentAction {
713
- constructor(childNode) {
714
- super();
715
- this.type = ModifyContentActionType.DELETE_CHILD;
716
- this.entityToBeRemoved = childNode;
717
- }
718
- }
719
-
720
- /**
721
- * The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
722
- */
723
- class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
724
- /**
725
- * Returns the previous node relative to the current node in a rich text editor structure.
726
- *
727
- * @param {RTENode} currentNode - An object of type `RTENode`.
728
- * @returns {Nullable<RTENode>} the previous block last node
729
- */
730
- getPreviousNode(currentNode) {
731
- const currentBlock = currentNode.parent;
732
- const currentIndex = currentBlock.children.indexOf(currentNode);
733
- if (currentIndex > 0) {
734
- return currentBlock.children[currentIndex - 1];
735
- }
736
- else if (currentBlock.parent) {
737
- const previousBlock = this.getPreviousBlock(currentBlock);
738
- if (previousBlock) {
739
- return this.getBlockLastNode(previousBlock);
740
- }
741
- }
742
- }
743
- /**
744
- * Returns the next node relative to the current node in a rich text editor structure.
745
- *
746
- * @param {RTENode} currentNode - An object of type `RTENode`.
747
- * @returns {Nullable<RTENode>} the next block first node
748
- */
749
- getNextNode(currentNode) {
750
- const currentBlock = currentNode.parent;
751
- const currentIndex = currentBlock.children.indexOf(currentNode);
752
- if (currentBlock.children[currentIndex + 1]) {
753
- return currentBlock.children[currentIndex + 1];
754
- }
755
- else if (currentBlock.parent) {
756
- const nextBlock = this.getNextBlock(currentBlock);
757
- if (nextBlock) {
758
- return this.getBlockFirstNode(nextBlock);
759
- }
760
- }
761
- }
762
- /**
763
- * Determines if a given node is the first node within the current state.
764
- *
765
- * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
766
- * @returns {boolean} True or false;
767
- */
768
- isContentFirstNode(currentNode) {
769
- const currentBlock = currentNode.parent;
770
- const currentIndex = currentBlock.children.indexOf(currentNode);
771
- const parent = currentBlock.parent;
772
- if (currentBlock.isListItemBlock()) {
773
- const listParent = parent.parent;
774
- return (currentIndex === 0 &&
775
- Array.isArray(parent.children) &&
776
- parent.children[0] === currentBlock &&
777
- listParent['type'] !== 'list-item' &&
778
- Array.isArray(listParent.children) &&
779
- listParent.children[0] === parent);
780
- }
781
- else {
782
- return (currentIndex === 0 && Array.isArray(parent.children) && parent.children[0] === currentBlock);
783
- }
784
- }
785
- /**
786
- * TODO: The getPreviousBlock add nest list support
787
- * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
788
- *
789
- * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
790
- * @returns {Nullable<RTEBlock>} The previous block if existing
791
- */
792
- getPreviousBlock(currentBlock) {
793
- if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
794
- const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
795
- if (currentBlockIndex > 0) {
796
- return currentBlock.parent.children[currentBlockIndex - 1];
797
- }
798
- else if ((currentBlock.parent['type'] === 'number-list' ||
799
- currentBlock.parent['type'] === 'bullet-list') &&
800
- currentBlockIndex === 0) {
801
- return this.getPreviousBlock(currentBlock.parent);
802
- }
803
- }
804
- }
805
- /**
806
- * Returns the last node within a given RTE block, handling different block types accordingly.
807
- *
808
- * @param {RTEBlock} currentBlock - Returns the last node within that block.
809
- * @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
810
- */
811
- getBlockLastNode(currentBlock) {
812
- return currentBlock.getLastNode();
813
- }
814
- /**
815
- * Returns the first node within a given RTE block, handling different block types accordingly.
1069
+ * apply annotation action or modify content action
816
1070
  *
817
- * @param {RTEBlock} currentBlock - Returns the first node within that block.
818
- * @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
1071
+ * @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
819
1072
  */
820
- getBlockFirstNode(currentBlock) {
821
- if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
822
- if (currentBlock.children) {
823
- const firstListItem = currentBlock.children[0];
824
- return this.getBlockFirstNode(firstListItem);
825
- }
1073
+ doApply(action) {
1074
+ if (action instanceof ModifyContentAction) {
1075
+ this.doModifyActionApply(action);
826
1076
  }
827
1077
  else {
828
- if (currentBlock.children) {
829
- return currentBlock.children[0];
830
- }
831
- }
832
- }
833
- /**
834
- * This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
835
- *
836
- * @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
837
- * @returns {Nullable<RTEBlock>} The next block if existing
838
- */
839
- getNextBlock(currentBlock) {
840
- if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
841
- const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
842
- if (currentBlock.parent.children[currentBlockIndex + 1]) {
843
- return currentBlock.parent.children[currentBlockIndex + 1];
844
- }
845
- else if (currentBlock.type === 'list-item' &&
846
- currentBlock.parent.children.length === currentBlockIndex + 1) {
847
- return this.getNextBlock(currentBlock.parent);
848
- }
1078
+ this.doAnnotationActionApply(action);
849
1079
  }
850
1080
  }
851
- }
852
-
853
- /** Append blocks or nodes to a block */
854
- class AppendChildNodesAction extends ModifyContentAction {
855
- constructor(childNodes) {
856
- super();
857
- this.type = ModifyContentActionType.APPEND_CHILD_NODES;
858
- this.entityToBeAppended = childNodes;
859
- }
860
- }
861
-
862
- /**
863
- * Append the second block child nodes to the first block child nodes and remove the second block strategy.
864
- */
865
- class BlockMergeNodesStrategy extends ActionHandleStrategy {
866
1081
  /**
867
- * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
868
- *
869
- * @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
870
- * @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
1082
+ * Flush the value change
871
1083
  */
872
- handleAction(action, target) {
873
- const anotherBlock = action.blockNeedToBeMerged;
874
- if (target.type === anotherBlock.type || (target.type !== 'image' && anotherBlock.type !== 'image')) {
875
- let shouldMergeNodes = anotherBlock.children;
876
- if (anotherBlock.type !== 'image') {
877
- shouldMergeNodes = anotherBlock.children.filter((node) => node.text);
878
- }
879
- target.apply(new AppendChildNodesAction(shouldMergeNodes));
880
- anotherBlock.parent.apply(new RemoveChildAction(anotherBlock));
881
- }
882
- }
883
- }
884
-
885
- /**
886
- * Remove the node from the text block or image block strategy.
887
- */
888
- class BlockRemoveNodeStrategy extends ActionHandleStrategy {
1084
+ flushChange() {
1085
+ const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
1086
+ if (domNode) {
1087
+ const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
1088
+ if (nodeSubject) {
1089
+ ChangeManager.notify(nodeSubject, {});
1090
+ }
1091
+ }
1092
+ }
889
1093
  /**
890
- * Remove the text node from the parent text block or remove the image node from the parent image block.
891
- * Remove the block if the block nodes is empty after delete the current node.
1094
+ * Clones the annotations of the current RTETextNode.
892
1095
  *
893
- * @param {RemoveChildAction} action - The remove child action instance.
894
- * @param {RTEBlockWithNodes} target - The parent block of the node that will be removed.
1096
+ * @returns {NodeAnnotations} A new Map containing cloned annotations.
895
1097
  */
896
- handleAction(action, target) {
897
- const arrayFixed = target.children;
898
- target.children = arrayFixed.filter((node) => node !== action.entityToBeRemoved);
899
- if (target.children.length === 0 && target.parent) {
900
- target.parent.apply(new RemoveChildAction(target));
901
- }
1098
+ cloneAnnotations() {
1099
+ return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
902
1100
  }
903
- }
904
-
905
- /**
906
- * Append the nodes to the text block or image block strategy.
907
- */
908
- class BlockAppendNodesStrategy extends ActionHandleStrategy {
1101
+ /* istanbul ignore next */
909
1102
  /**
910
- * Append the text nodes to the text block or the image block.
1103
+ * Placeholder for the method to be implemented in sub classes.
911
1104
  *
912
- * @param {AppendChildNodesAction} action - The remove child action instance.
913
- * @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
1105
+ * @param {AnnotationAction} action Annotation action
914
1106
  */
915
- handleAction(action, target) {
916
- const nodesToBeAppended = action.entityToBeAppended;
917
- nodesToBeAppended.forEach((node) => {
918
- node.parent = target;
919
- });
920
- // This line is used to fix the typescript error `This expression is not callable`. https://github.com/microsoft/TypeScript/issues/44373
921
- const arrayFixed = target.children;
922
- target.children = arrayFixed.concat(nodesToBeAppended);
1107
+ doAnnotationActionApply(action) {
923
1108
  }
924
- }
925
-
926
- /**
927
- * Remove all nodes and append new nodes strategy.
928
- */
929
- class BlockReplaceNodesStrategy extends ActionHandleStrategy {
1109
+ /* istanbul ignore next */
930
1110
  /**
931
- * Empty the text block or image block nodes and add new nodes.
1111
+ * Placeholder for the method to be implemented in sub classes.
932
1112
  *
933
- * @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
934
- * @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
1113
+ * @param {ModifyContentAction} action ModifyContentAction
935
1114
  */
936
- handleAction(action, target) {
937
- target.children = [];
938
- target.apply(new AppendChildNodesAction(action.newChildNodes));
939
- }
940
- }
941
-
942
- /**
943
- * Insert a new block after a existing block
944
- *
945
- * @example currentBlock.parent.apply(new InsertBlocksAfterAction(currentBlock, newBlock, ...))
946
- */
947
- class InsertBlocksAfterAction extends ModifyContentAction {
948
- constructor(referBlock, ...blocksToBeInserted) {
949
- super();
950
- this.type = ModifyContentActionType.INSERT_BLOCKS_AFTER;
951
- this.referBlock = referBlock;
952
- this.blocksToBeInserted = blocksToBeInserted;
953
- }
954
- }
955
-
956
- /**
957
- * Clear the current block nodes and append new nodes
958
- *
959
- * @example block.apply(new ReplaceChildNodesAction(newNodes))
960
- */
961
- class ReplaceChildNodesAction extends ModifyContentAction {
962
- constructor(newChildNodes) {
963
- super();
964
- this.type = ModifyContentActionType.REPLACE_CHILD_NODES;
965
- this.newChildNodes = newChildNodes;
1115
+ doModifyActionApply(action) {
966
1116
  }
967
- }
968
-
969
- /**
970
- * Insert a new block before a existing block
971
- *
972
- * @example currentBlock.parent.apply(new InsertBlocksBeforeAction(currentBlock, newBlock, ...))
973
- */
974
- class InsertBlocksBeforeAction extends ModifyContentAction {
975
- constructor(referBlock, ...blocksToBeInserted) {
976
- super();
977
- this.type = ModifyContentActionType.INSERT_BLOCKS_BEFORE;
978
- this.referBlock = referBlock;
979
- this.blocksToBeInserted = blocksToBeInserted;
1117
+ /**
1118
+ * Merge an array of annotation styles into a single style object.
1119
+ * e.g.,
1120
+ * { textDecoration: 'underline', textDecoration: 'line-through' }
1121
+ * -> { textDecoration: 'underline line-through' }
1122
+ *
1123
+ * @param {AnnotationStyle[]} styles - Array of annotation style objects to merge.
1124
+ * @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
1125
+ * @returns {AnnotationStyle} - The merged annotation style object.
1126
+ */
1127
+ mergeAnnotationStyles(styles, canMergeKeyList) {
1128
+ const merged = {};
1129
+ for (const style of styles) {
1130
+ for (const key in style) {
1131
+ const value = style[key];
1132
+ const existing = merged[key];
1133
+ if (typeof existing === 'string' &&
1134
+ typeof value === 'string' &&
1135
+ canMergeKeyList.includes(key)) {
1136
+ merged[key] = Array.from(new Set(`${existing} ${value}`.split(/\s+/).filter(Boolean))).join(' ');
1137
+ }
1138
+ else {
1139
+ merged[key] = value;
1140
+ }
1141
+ }
1142
+ }
1143
+ return merged;
980
1144
  }
981
1145
  }
982
1146
 
983
1147
  /**
984
- * Split the block with a split point node.
985
- * The property `newBlock` use to store the new create block if need.
986
- *
987
- * @example block.apply(new SplitBlockWithNodeAction(node, offset))
1148
+ * Abstract class for annotation actions
988
1149
  */
989
- class SplitBlockWithNodeAction extends ModifyContentAction {
990
- constructor(splitPointNode, startOffsetOfNode) {
991
- super();
992
- this.type = ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
993
- this.splitPointNode = splitPointNode;
994
- this.startOffsetOfNode = startOffsetOfNode;
995
- }
1150
+ class AnnotationAction {
996
1151
  }
997
1152
 
998
1153
  /**
@@ -1062,20 +1217,20 @@ class StrikethroughAnnotation extends NodeAnnotation {
1062
1217
  return new StrikethroughAnnotation(this.strikethrough);
1063
1218
  }
1064
1219
  /**
1065
- * Generate the class for the annotation
1066
- *
1067
- * @returns {Nullable<string>} - Annotation class
1220
+ * @inheritDoc
1068
1221
  */
1069
- renderClass() {
1222
+ renderClass(options) {
1223
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1224
+ return null;
1070
1225
  return this.strikethrough ? 'v-rte--strikethrough' : null;
1071
1226
  }
1072
1227
  /**
1073
- * Generate the style for the annotation
1074
- *
1075
- * @returns {Nullable<AnnotationStyle>} - Annotation style
1228
+ * @inheritDoc
1076
1229
  */
1077
- render() {
1078
- return null;
1230
+ renderStyle(options) {
1231
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1232
+ return null;
1233
+ return this.strikethrough ? { textDecoration: 'line-through' } : null;
1079
1234
  }
1080
1235
  }
1081
1236
 
@@ -1114,20 +1269,20 @@ class UnderlineAnnotation extends NodeAnnotation {
1114
1269
  return new UnderlineAnnotation(this.underline);
1115
1270
  }
1116
1271
  /**
1117
- * Generate the class for the annotation
1118
- *
1119
- * @returns {Nullable<string>} - Annotation class
1272
+ * @inheritDoc
1120
1273
  */
1121
- renderClass() {
1274
+ renderClass(options) {
1275
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1276
+ return null;
1122
1277
  return this.underline ? 'v-rte--underline' : null;
1123
1278
  }
1124
1279
  /**
1125
- * Generate the style for the annotation
1126
- *
1127
- * @returns {Nullable<AnnotationStyle>} - Annotation style
1280
+ * @inheritDoc
1128
1281
  */
1129
- render() {
1130
- return null;
1282
+ renderStyle(options) {
1283
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1284
+ return null;
1285
+ return this.underline ? { textDecoration: 'underline' } : null;
1131
1286
  }
1132
1287
  }
1133
1288
 
@@ -1166,12 +1321,20 @@ class ItalicAnnotation extends NodeAnnotation {
1166
1321
  return new ItalicAnnotation(this.italic);
1167
1322
  }
1168
1323
  /**
1169
- * Generate the style for the annotation
1170
- *
1171
- * @returns {Nullable<AnnotationStyle>} Italic style
1324
+ * @inheritDoc
1325
+ */
1326
+ renderClass(options) {
1327
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1328
+ return null;
1329
+ return this.italic ? 'v-rte--italic' : null;
1330
+ }
1331
+ /**
1332
+ * @inheritDoc
1172
1333
  */
1173
- render() {
1174
- return this.italic ? { 'font-style': 'italic' } : null;
1334
+ renderStyle(options) {
1335
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1336
+ return null;
1337
+ return this.italic ? { fontStyle: 'italic' } : null;
1175
1338
  }
1176
1339
  }
1177
1340
 
@@ -1210,12 +1373,20 @@ class BoldAnnotation extends NodeAnnotation {
1210
1373
  return new BoldAnnotation(this.bold);
1211
1374
  }
1212
1375
  /**
1213
- * Generate the style for the annotation
1214
- *
1215
- * @returns {Nullable<AnnotationStyle>} Bold style
1376
+ * @inheritDoc
1377
+ */
1378
+ renderClass(options) {
1379
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1380
+ return null;
1381
+ return this.bold ? 'v-rte--bold' : null;
1382
+ }
1383
+ /**
1384
+ * @inheritDoc
1216
1385
  */
1217
- render() {
1218
- return this.bold ? { 'font-weight': '700' } : null;
1386
+ renderStyle(options) {
1387
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1388
+ return null;
1389
+ return this.bold ? { fontWeight: '700' } : null;
1219
1390
  }
1220
1391
  }
1221
1392
 
@@ -1223,19 +1394,21 @@ class BoldAnnotation extends NodeAnnotation {
1223
1394
  * Annotation to make text code
1224
1395
  */
1225
1396
  class CodeAnnotation extends NodeAnnotation {
1226
- constructor(code) {
1397
+ constructor(code, useInternalStyle = true) {
1227
1398
  super();
1228
1399
  this.type = NodeAnnotationTypeEnum.CODE;
1229
1400
  this.code = code;
1401
+ this.useInternalStyle = useInternalStyle;
1230
1402
  }
1231
1403
  /**
1232
1404
  * Generate the map item for the annotation
1233
1405
  *
1234
1406
  * @param {boolean} code - Bold annotation
1407
+ * @param {boolean} useInternalStyle - Whether to use default style for the link
1235
1408
  * @returns {[NodeAnnotationTypeEnum.CODE, CodeAnnotation]} Map item for the annotation
1236
1409
  */
1237
- static from(code) {
1238
- return [NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code)];
1410
+ static from(code, useInternalStyle) {
1411
+ return [NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code, useInternalStyle)];
1239
1412
  }
1240
1413
  /**
1241
1414
  * Generate the JSON representation of the annotation
@@ -1251,32 +1424,38 @@ class CodeAnnotation extends NodeAnnotation {
1251
1424
  * @inheritDoc
1252
1425
  */
1253
1426
  clone() {
1254
- return new CodeAnnotation(this.code);
1427
+ return new CodeAnnotation(this.code, this.useInternalStyle);
1255
1428
  }
1256
1429
  /**
1257
- * Generate the class for the annotation
1258
- *
1259
- * @returns {Nullable<string>} - Annotation class
1430
+ * @inheritDoc
1260
1431
  */
1261
- renderClass() {
1262
- return this.code ? 'v-rte--code' : null;
1432
+ renderClass(options) {
1433
+ if (options === null || options === void 0 ? void 0 : options.standalone)
1434
+ return null;
1435
+ return this.code && this.useInternalStyle ? 'v-rte--code' : null;
1263
1436
  }
1264
1437
  /**
1265
- * Generate the style for the annotation
1266
- *
1267
- * @returns {Nullable<AnnotationStyle>} Bold style
1438
+ * @inheritDoc
1268
1439
  */
1269
- render() {
1270
- return null;
1440
+ renderStyle(options) {
1441
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
1442
+ return null;
1443
+ return this.code && this.useInternalStyle
1444
+ ? {
1445
+ fontFamily: 'Roboto Mono',
1446
+ whiteSpace: 'pre-wrap',
1447
+ }
1448
+ : null;
1271
1449
  }
1272
1450
  }
1273
1451
 
1452
+ const RTE_DEFAULT_TEXT_COLOR = {
1453
+ key: 'black',
1454
+ light: '#111128',
1455
+ dark: '#E3E3E8',
1456
+ };
1274
1457
  const RTE_TEXT_COLORS = [
1275
- {
1276
- key: 'black',
1277
- light: '#111128',
1278
- dark: '#E3E3E8',
1279
- },
1458
+ RTE_DEFAULT_TEXT_COLOR,
1280
1459
  {
1281
1460
  key: 'gray',
1282
1461
  light: '#5E5E6D',
@@ -1340,19 +1519,15 @@ class TextColorAnnotation extends NodeAnnotation {
1340
1519
  return new TextColorAnnotation(this.textColor.key);
1341
1520
  }
1342
1521
  /**
1343
- * Generate the class for the annotation
1344
- *
1345
- * @returns {Nullable<string>} - Annotation class
1522
+ * @inheritDoc
1346
1523
  */
1347
1524
  renderClass() {
1348
1525
  return null;
1349
1526
  }
1350
1527
  /**
1351
- * Generate the style for the annotation
1352
- *
1353
- * @returns {Nullable<AnnotationStyle>} - Annotation style
1528
+ * @inheritDoc
1354
1529
  */
1355
- render() {
1530
+ renderStyle() {
1356
1531
  return {
1357
1532
  color: VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
1358
1533
  };
@@ -1372,22 +1547,21 @@ class TextColorAnnotation extends NodeAnnotation {
1372
1547
  * Annotation to make text a link
1373
1548
  */
1374
1549
  class LinkAnnotation extends NodeAnnotation {
1375
- constructor(link) {
1550
+ constructor(link, useInternalStyle = true) {
1376
1551
  super();
1377
1552
  this.type = NodeAnnotationTypeEnum.LINK;
1378
1553
  this.link = link;
1554
+ this.useInternalStyle = useInternalStyle;
1379
1555
  }
1380
1556
  /**
1381
1557
  * Generate the map item for the annotation
1382
1558
  *
1383
1559
  * @param {VegaRTELink} link - Bold annotation
1560
+ * @param {boolean} useInternalStyle - Whether to use default style for the link
1384
1561
  * @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
1385
1562
  */
1386
- static from(link) {
1387
- return [
1388
- NodeAnnotationTypeEnum.LINK,
1389
- new LinkAnnotation({ href: link.href, groupKey: link.groupKey }),
1390
- ];
1563
+ static from(link, useInternalStyle = true) {
1564
+ return [NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link, useInternalStyle)];
1391
1565
  }
1392
1566
  /**
1393
1567
  * Generate the JSON representation of the annotation
@@ -1395,7 +1569,9 @@ class LinkAnnotation extends NodeAnnotation {
1395
1569
  * @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
1396
1570
  */
1397
1571
  toJSON() {
1398
- return { link: { href: this.link.href, groupKey: this.link.groupKey } };
1572
+ return {
1573
+ link: this.link,
1574
+ };
1399
1575
  }
1400
1576
  /**
1401
1577
  * @inheritDoc
@@ -1413,31 +1589,16 @@ class LinkAnnotation extends NodeAnnotation {
1413
1589
  return this.link.groupKey === annotation.link.groupKey;
1414
1590
  }
1415
1591
  /**
1416
- * Generate the style for the annotation
1417
- *
1418
- * @returns {Nullable<AnnotationStyle>} Link style
1592
+ * @inheritDoc
1419
1593
  */
1420
- render() {
1594
+ renderClass() {
1421
1595
  return null;
1422
1596
  }
1423
- }
1424
-
1425
- /**
1426
- * Annotation to represent a link of grouped nodes
1427
- */
1428
- class LinkGroupAnnotation extends Annotation {
1429
- constructor(groupKey) {
1430
- super();
1431
- this.type = InternalAnnotationTypeEnum.LINK_GROUP;
1432
- this.linkGroups = new Map();
1433
- this.linkGroups = new Map([[groupKey, []]]);
1434
- }
1435
- clone() {
1436
- const clonedAnnotation = new LinkGroupAnnotation('');
1437
- this.linkGroups.forEach((nodes, key) => {
1438
- clonedAnnotation.linkGroups.set(key, nodes.map((node) => node.clone()));
1439
- });
1440
- return clonedAnnotation;
1597
+ /**
1598
+ * @inheritDoc
1599
+ */
1600
+ renderStyle() {
1601
+ return null;
1441
1602
  }
1442
1603
  }
1443
1604
 
@@ -1445,11 +1606,12 @@ class LinkGroupAnnotation extends Annotation {
1445
1606
  * Action to link a group of nodes
1446
1607
  */
1447
1608
  class LinkGroupAnnotationAction extends AnnotationAction {
1448
- constructor(groupKey, nodes) {
1609
+ constructor(groupKey, nodes, type) {
1449
1610
  super();
1450
1611
  this.isFlushable = false;
1451
1612
  this.groupKey = groupKey;
1452
1613
  this.nodes = nodes;
1614
+ this.type = type;
1453
1615
  }
1454
1616
  /**
1455
1617
  * Converts the action to an annotation
@@ -1480,80 +1642,188 @@ class SyncUpSelectionAction extends AnnotationAction {
1480
1642
  }
1481
1643
 
1482
1644
  /**
1483
- * Update the editor text node text content strategy.
1645
+ * RTEDTOClassManager is a singleton class that manages the registration and retrieval of RTE DTO classes.
1646
+ * It allows for the dynamic handling of different RTE blocks and nodes by their types.
1484
1647
  */
1485
- class NodeUpdateTextStrategy extends ActionHandleStrategy {
1648
+ class RTEDTOClassManager {
1649
+ constructor() {
1650
+ // Register RTE Block DTO classes.
1651
+ this.RTE_BLOCK_DTO_CLASS_MAP = new Map();
1652
+ // Register RTE Block DTO classes.
1653
+ this.RTE_NODE_DTO_CLASS_MAP = new Map();
1654
+ }
1486
1655
  /**
1487
- * Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
1656
+ * Registers a new RTE DTO class.
1488
1657
  *
1489
- * @param {UpdateTextAction} action - The update text action instance.
1490
- * @param {RTETextNode} target - The text node instance which need update the text.
1658
+ * @typedef T - The type of the RTE DTO class to register.
1659
+ * @param {string} type - The type identifier for the RTE DTO class.
1660
+ * @param {ClassType<T>} RTEDTOClass - The class constructor for the RTE DTO.
1491
1661
  */
1492
- handleAction(action, target) {
1493
- target.text = action.newTextContent;
1494
- // The link node should unlink when delete all text
1495
- if (!target.text && target.annotationMap.has('LINK')) {
1496
- target.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
1662
+ registerRTEDTOClass(type, RTEDTOClass) {
1663
+ if (RTEDTOClass.prototype instanceof RTEBlock) {
1664
+ this.RTE_BLOCK_DTO_CLASS_MAP.set(type, RTEDTOClass);
1665
+ }
1666
+ else if (RTEDTOClass.prototype instanceof RTENode) {
1667
+ this.RTE_NODE_DTO_CLASS_MAP.set(type, RTEDTOClass);
1668
+ }
1669
+ else {
1670
+ throw new Error(`Invalid RTE DTO class type: ${type}`);
1497
1671
  }
1498
1672
  }
1499
- }
1500
-
1501
- /**
1502
- * Update the text node property text action
1503
- *
1504
- * @example textNode.apply(new UpdateTextAction(newText))
1505
- */
1506
- class UpdateTextAction extends ModifyContentAction {
1507
- constructor(text) {
1508
- super();
1509
- this.type = ModifyContentActionType.UPDATE_TEXT;
1510
- this.newTextContent = '';
1511
- this.newTextContent = text;
1673
+ /**
1674
+ * Retrieves the RTE block class for a given type.
1675
+ *
1676
+ * @param {string} type - The type identifier for the RTE block.
1677
+ * @returns {Nullable<RTEBlockDTOClass>} - The class constructor for the RTE block, or null if not found.
1678
+ */
1679
+ getRTEBlockClass(type) {
1680
+ return this.RTE_BLOCK_DTO_CLASS_MAP.get(type);
1681
+ }
1682
+ /**
1683
+ * Retrieves the RTE node class for a given type.
1684
+ *
1685
+ * @param {string} type - The type identifier for the RTE node.
1686
+ * @returns {Nullable<RTENodeDTOClass>} - The class constructor for the RTE node, or null if not found.
1687
+ */
1688
+ getRTENodeClass(type) {
1689
+ return this.RTE_NODE_DTO_CLASS_MAP.get(type);
1512
1690
  }
1513
1691
  }
1692
+ const RTEDTOClassManager$1 = new RTEDTOClassManager();
1514
1693
 
1515
1694
  /**
1516
- * Replaces the rich text node selected text strategy.
1695
+ * The base action handle strategy class, use to modify the rich text node content or modify the annotation.
1517
1696
  */
1518
- class NodeReplaceSelectedTextStrategy extends ActionHandleStrategy {
1697
+ class ActionHandleStrategy {
1519
1698
  /**
1520
- * @inheritDoc
1699
+ * Public method to invoke the handle logic.
1700
+ *
1701
+ * @typedef R generic type
1702
+ * @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
1703
+ * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
1704
+ * @returns {R} - The invoke result in special strategy.
1521
1705
  */
1522
- handleAction(action, target) {
1523
- this.replaceSelectedText(action.textToBeInsert, action.currentRange, target);
1706
+ execute(action, target) {
1707
+ LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
1708
+ return this.handleAction(action, target);
1524
1709
  }
1525
1710
  /**
1526
- * Replaces the selected text within a given range with a new text in a TypeScript class.
1711
+ * Update the custom style annotation of a block or node
1527
1712
  *
1528
- * @param {string} text - The new text that will replace the currently selected text within the specified range.
1529
- * @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
1530
- * @param {RTETextNode} target - The RTE text node instance.
1713
+ * @param {RTEBlock | RTETextNode} item - block or node
1714
+ * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
1531
1715
  */
1532
- replaceSelectedText(text, currentRange, target) {
1533
- if (currentRange && currentRange.startContainer && currentRange.endContainer) {
1534
- const { startContainer, endContainer, startOffset, endOffset } = currentRange;
1535
- let newText = target.text;
1536
- if (startContainer === endContainer && startOffset === endOffset && text) {
1537
- newText = target.text.slice(0, startOffset) + text + target.text.slice(startOffset);
1716
+ updateCustomStyleAnnotation(item, styleKeys) {
1717
+ const customStyleAnnotation = item.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_STYLE);
1718
+ if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
1719
+ item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
1720
+ }
1721
+ }
1722
+ /**
1723
+ * Create a new paragraph block with the given text.
1724
+ *
1725
+ * @param {string} text - The text content for the new paragraph.
1726
+ * @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
1727
+ */
1728
+ createNewParagraph(text) {
1729
+ const dtoClass = RTEDTOClassManager$1.getRTEBlockClass('paragraph');
1730
+ if (dtoClass) {
1731
+ const newParagraph = dtoClass.from({
1732
+ id: generateUUID(),
1733
+ type: 'paragraph',
1734
+ nodes: [{ id: generateUUID(), type: 'text', text }],
1735
+ });
1736
+ return newParagraph;
1737
+ }
1738
+ }
1739
+ /**
1740
+ * Get the root content from a child block or node.
1741
+ *
1742
+ * @param {RTEBlock | RTENode} child - The child block or node.
1743
+ * @returns {Nullable<VegaRTEContent>} The root content, if found.
1744
+ */
1745
+ getRootContent(child) {
1746
+ const parent = child.parent;
1747
+ if (parent) {
1748
+ if (parent.constructor.name === 'VegaRTEContent') {
1749
+ return parent;
1538
1750
  }
1539
1751
  else {
1540
- const startNode = startContainer.parentElement;
1541
- const endNode = endContainer.parentElement;
1542
- const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
1543
- const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
1544
- let startIndex = 0, endIndex = target.text.length;
1545
- if (startItemDto && startItemDto === target) {
1546
- startIndex = startOffset;
1547
- endIndex = startContainer === endContainer ? endOffset : endIndex;
1548
- }
1549
- else if (endItemDto && endItemDto === target) {
1550
- endIndex = endOffset;
1551
- }
1552
- newText = target.text.slice(0, startIndex) + text + target.text.slice(endIndex);
1752
+ return this.getRootContent(parent);
1553
1753
  }
1554
- target.apply(new UpdateTextAction(newText));
1555
1754
  }
1556
1755
  }
1756
+ /**
1757
+ * Check the caret position at the start of a block.
1758
+ *
1759
+ * @param {RTEBlock} block - The RTE Block.
1760
+ * @param {RTENode} node - The RTE Node.
1761
+ * @param {number} offset - The offset position.
1762
+ * @returns {boolean} - Whether the caret is at the start of the block.
1763
+ */
1764
+ isCaretPositionAtBlockStart(block, node, offset) {
1765
+ return node === block.children[0] && offset === 0;
1766
+ }
1767
+ /**
1768
+ * Check the caret position at the end of a block.
1769
+ *
1770
+ * @param {RTEBlock} block - The RTE Block.
1771
+ * @param {RTENode} node - The RTE Node.
1772
+ * @param {number} offset - The offset position.
1773
+ * @returns {boolean} - Whether the caret is at the end of the block.
1774
+ */
1775
+ isCaretPositionAtBlockEnd(block, node, offset) {
1776
+ if (!node.isContentEditable()) {
1777
+ return this.isCaretPositionAtDecoratorBlockEnd(block, node, offset);
1778
+ }
1779
+ else {
1780
+ return this.isCaretPositionAtTextBlockEnd(block, node, offset);
1781
+ }
1782
+ }
1783
+ /**
1784
+ * Checks if the caret position is at the end of a specified RTETextNode.
1785
+ *
1786
+ * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
1787
+ * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
1788
+ * @param {number} startOffset - The position within the text node where the caret is located.
1789
+ * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
1790
+ */
1791
+ isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
1792
+ const lastNode = textBlock.children[textBlock.children.length - 1];
1793
+ return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
1794
+ }
1795
+ /**
1796
+ * Checks if the caret position is at the end of a given decorator node.
1797
+ *
1798
+ * @param {RTEBlock} target - The image block.
1799
+ * @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
1800
+ * @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
1801
+ * @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
1802
+ */
1803
+ isCaretPositionAtDecoratorBlockEnd(target, node, startOffset) {
1804
+ return node === target.children[target.children.length - 1] && startOffset !== 0;
1805
+ }
1806
+ /**
1807
+ * Determines if the custom style annotation includes any the custom style.
1808
+ *
1809
+ * @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
1810
+ * @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
1811
+ * @returns {boolean} - True if the custom key includes the custom style, false otherwise.
1812
+ */
1813
+ isCustomStyle(customStyleAnnotation, styleKeys) {
1814
+ return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
1815
+ }
1816
+ }
1817
+
1818
+ /**
1819
+ * Split the corresponding link group nodes *
1820
+ */
1821
+ class LinkGroupNodeSplitAction extends ModifyContentAction {
1822
+ constructor(splittedTextNodes) {
1823
+ super();
1824
+ this.type = ModifyContentActionType.LINK_GROUP_NODE_SPLIT;
1825
+ this.splittedTextNodes = splittedTextNodes;
1826
+ }
1557
1827
  }
1558
1828
 
1559
1829
  /**
@@ -1584,7 +1854,11 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
1584
1854
  return this.insertNewNode(startOffset, target);
1585
1855
  }
1586
1856
  if (this.shouldSplitSelection(selectionRangeAnnotation.range)) {
1587
- return this.splitTextNode(selectionRangeAnnotation.range, target);
1857
+ const splittedTextNodes = this.splitTextNode(selectionRangeAnnotation.range, target);
1858
+ if (item.annotationMap.has('LINK')) {
1859
+ item.apply(new LinkGroupNodeSplitAction(splittedTextNodes));
1860
+ }
1861
+ return splittedTextNodes;
1588
1862
  }
1589
1863
  else {
1590
1864
  this.setApplyTargetNode(target);
@@ -1687,6 +1961,25 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
1687
1961
  }
1688
1962
  }
1689
1963
 
1964
+ /**
1965
+ * Action to toggle bold annotation
1966
+ */
1967
+ class BoldAnnotationAction extends TextSplittableAction {
1968
+ constructor(bold) {
1969
+ super();
1970
+ this.isFlushable = true;
1971
+ this.bold = bold;
1972
+ }
1973
+ /**
1974
+ * Converts the action to an annotation
1975
+ *
1976
+ * @returns {BoldAnnotation} the annotation
1977
+ */
1978
+ toAnnotation() {
1979
+ return new BoldAnnotation(this.bold);
1980
+ }
1981
+ }
1982
+
1690
1983
  /**
1691
1984
  * Annotation to host which annotations will be clear formatting
1692
1985
  */
@@ -1701,6 +1994,7 @@ class ClearFormattingAnnotation extends Annotation {
1701
1994
  NodeAnnotationTypeEnum.STRIKETHROUGH,
1702
1995
  NodeAnnotationTypeEnum.TEXT_COLOR,
1703
1996
  NodeAnnotationTypeEnum.CODE,
1997
+ CommonAnnotationTypeEnum.CUSTOM_STYLE,
1704
1998
  ];
1705
1999
  }
1706
2000
  }
@@ -1761,16 +2055,36 @@ class DeleteNodeAnnotationAction extends AnnotationAction {
1761
2055
  }
1762
2056
  }
1763
2057
 
2058
+ /**
2059
+ * Action to toggle the italic annotation
2060
+ */
2061
+ class ItalicAnnotationAction extends TextSplittableAction {
2062
+ constructor(italic) {
2063
+ super();
2064
+ this.isFlushable = true;
2065
+ this.italic = italic;
2066
+ }
2067
+ /**
2068
+ * Converts the action to an annotation
2069
+ *
2070
+ * @returns {ItalicAnnotation} The annotation
2071
+ */
2072
+ toAnnotation() {
2073
+ return new ItalicAnnotation(this.italic);
2074
+ }
2075
+ }
2076
+
1764
2077
  /**
1765
2078
  * Action to toggle link annotation
1766
2079
  */
1767
2080
  class LinkAnnotationAction extends TextSplittableAction {
1768
- constructor({ link, newText, needMergeNode, doSplit, }) {
2081
+ constructor({ link, newText, needMergeNode, doSplit, type, }) {
1769
2082
  super();
1770
2083
  this.isFlushable = true;
1771
2084
  this.link = link;
1772
2085
  this.needMergeNode = needMergeNode;
1773
2086
  this.newText = newText;
2087
+ this.type = type;
1774
2088
  if (isNonNullable(doSplit)) {
1775
2089
  this.doSplit = doSplit;
1776
2090
  }
@@ -1785,6 +2099,44 @@ class LinkAnnotationAction extends TextSplittableAction {
1785
2099
  }
1786
2100
  }
1787
2101
 
2102
+ /**
2103
+ * Action to toggle the strikethrough annotation
2104
+ */
2105
+ class StrikethroughAnnotationAction extends TextSplittableAction {
2106
+ constructor(underline) {
2107
+ super();
2108
+ this.isFlushable = true;
2109
+ this.strikethrough = underline;
2110
+ }
2111
+ /**
2112
+ * Converts the action to an annotation
2113
+ *
2114
+ * @returns {Annotation} the annotation
2115
+ */
2116
+ toAnnotation() {
2117
+ return new StrikethroughAnnotation(this.strikethrough);
2118
+ }
2119
+ }
2120
+
2121
+ /**
2122
+ * Action to toggle the underline annotation
2123
+ */
2124
+ class UnderlineAnnotationAction extends TextSplittableAction {
2125
+ constructor(underline) {
2126
+ super();
2127
+ this.isFlushable = true;
2128
+ this.underline = underline;
2129
+ }
2130
+ /**
2131
+ * Converts the action to an annotation
2132
+ *
2133
+ * @returns {Annotation} the annotation
2134
+ */
2135
+ toAnnotation() {
2136
+ return new UnderlineAnnotation(this.underline);
2137
+ }
2138
+ }
2139
+
1788
2140
  /**
1789
2141
  * The current strategy used to modify the text node annotation map.
1790
2142
  */
@@ -1812,17 +2164,281 @@ class NodeUpdateAnnotationMapStrategy extends ActionHandleStrategy {
1812
2164
  if (isNonNullable(action.newText)) {
1813
2165
  target.text = action.newText;
1814
2166
  }
1815
- target.parent.apply(new LinkGroupAnnotationAction(action.link.groupKey, [target]));
2167
+ target.parent.apply(new LinkGroupAnnotationAction(action.link.groupKey, [target], action.type));
1816
2168
  }
1817
2169
  if (action instanceof CodeAnnotationAction) {
1818
2170
  this.handleAction(new ClearFormattingAnnotationAction(), target);
1819
2171
  }
2172
+ if (action instanceof BoldAnnotationAction) {
2173
+ this.updateCustomStyleAnnotation(target, ['fontWeight']);
2174
+ }
2175
+ if (action instanceof ItalicAnnotationAction) {
2176
+ this.updateCustomStyleAnnotation(target, ['fontStyle']);
2177
+ }
2178
+ if (action instanceof UnderlineAnnotationAction ||
2179
+ action instanceof StrikethroughAnnotationAction) {
2180
+ this.updateCustomStyleAnnotation(target, ['textDecoration']);
2181
+ }
1820
2182
  target.annotationMap.set(annotation.type, annotation);
1821
2183
  return;
1822
2184
  }
1823
2185
  }
1824
2186
  }
1825
2187
 
2188
+ /**
2189
+ * Delete the corresponding link group according to the text node *
2190
+ */
2191
+ class DeleteLinkGroupAction extends ModifyContentAction {
2192
+ constructor() {
2193
+ super(...arguments);
2194
+ this.type = ModifyContentActionType.DELETE_LINK_GROUP;
2195
+ }
2196
+ }
2197
+
2198
+ /**
2199
+ * Update the editor text node text content strategy.
2200
+ */
2201
+ class NodeUpdateTextStrategy extends ActionHandleStrategy {
2202
+ /**
2203
+ * Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
2204
+ *
2205
+ * @param {UpdateTextAction} action - The update text action instance.
2206
+ * @param {RTETextNode} target - The text node instance which need update the text.
2207
+ */
2208
+ handleAction(action, target) {
2209
+ target.text = action.newTextContent;
2210
+ // The link node should unlink when delete all text
2211
+ if (!target.text && target.annotationMap.has('LINK')) {
2212
+ target.apply(new DeleteLinkGroupAction());
2213
+ }
2214
+ }
2215
+ }
2216
+
2217
+ /**
2218
+ * Update the text node property text action
2219
+ *
2220
+ * @example textNode.apply(new UpdateTextAction(newText))
2221
+ */
2222
+ class UpdateTextAction extends ModifyContentAction {
2223
+ constructor(text) {
2224
+ super();
2225
+ this.type = ModifyContentActionType.UPDATE_TEXT;
2226
+ this.newTextContent = '';
2227
+ this.newTextContent = text;
2228
+ }
2229
+ }
2230
+
2231
+ /**
2232
+ * Replaces the rich text node selected text strategy.
2233
+ */
2234
+ class NodeReplaceSelectedTextStrategy extends ActionHandleStrategy {
2235
+ /**
2236
+ * @inheritDoc
2237
+ */
2238
+ handleAction(action, target) {
2239
+ this.replaceSelectedText(action.textToBeInsert, action.currentRange, target);
2240
+ }
2241
+ /**
2242
+ * Replaces the selected text within a given range with a new text in a TypeScript class.
2243
+ *
2244
+ * @param {string} text - The new text that will replace the currently selected text within the specified range.
2245
+ * @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
2246
+ * @param {RTETextNode} target - The RTE text node instance.
2247
+ */
2248
+ replaceSelectedText(text, currentRange, target) {
2249
+ if (currentRange && currentRange.startContainer && currentRange.endContainer) {
2250
+ const { startContainer, endContainer, startOffset, endOffset } = currentRange;
2251
+ let newText = target.text;
2252
+ if (startContainer === endContainer && startOffset === endOffset && text) {
2253
+ newText = target.text.slice(0, startOffset) + text + target.text.slice(startOffset);
2254
+ }
2255
+ else {
2256
+ const startNode = startContainer.parentElement;
2257
+ const endNode = endContainer.parentElement;
2258
+ const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
2259
+ const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
2260
+ let startIndex = 0, endIndex = target.text.length;
2261
+ if (startItemDto && startItemDto === target) {
2262
+ startIndex = startOffset;
2263
+ endIndex = startContainer === endContainer ? endOffset : endIndex;
2264
+ }
2265
+ else if (endItemDto && endItemDto === target) {
2266
+ endIndex = endOffset;
2267
+ }
2268
+ newText = target.text.slice(0, startIndex) + text + target.text.slice(endIndex);
2269
+ }
2270
+ target.apply(new UpdateTextAction(newText));
2271
+ }
2272
+ }
2273
+ }
2274
+
2275
+ /**
2276
+ * Inline HTML annotation
2277
+ */
2278
+ class InlineHtmlAnnotation extends Annotation {
2279
+ constructor(htmlTag) {
2280
+ super();
2281
+ this.type = NodeAnnotationTypeEnum.INLINE_HTML;
2282
+ this.htmlTag = htmlTag;
2283
+ }
2284
+ /**
2285
+ * Generate the map item for the annotation
2286
+ *
2287
+ * @param {VegaInlineHtmlSchema} inlineHtml - Inline HTML node
2288
+ * @returns {[NodeAnnotationTypeEnum.INLINE_HTML, InlineHtmlAnnotation]} Map item for the annotation
2289
+ */
2290
+ static from(inlineHtml) {
2291
+ const { htmlTag, child, customStyle, customClass, customAttribute } = inlineHtml;
2292
+ const inlineHtmlAnnotation = new InlineHtmlAnnotation(htmlTag);
2293
+ inlineHtmlAnnotation.child = child ? InlineHtmlAnnotation.from(child)[1] : undefined;
2294
+ inlineHtmlAnnotation.customAttribute = customAttribute
2295
+ ? CustomAttributeAnnotation.from(customAttribute)[1]
2296
+ : undefined;
2297
+ inlineHtmlAnnotation.customClass = customClass
2298
+ ? CustomClassAnnotation.from(customClass)[1]
2299
+ : undefined;
2300
+ inlineHtmlAnnotation.customStyle = customStyle
2301
+ ? CustomStyleAnnotation.from(customStyle)[1]
2302
+ : undefined;
2303
+ return [NodeAnnotationTypeEnum.INLINE_HTML, inlineHtmlAnnotation];
2304
+ }
2305
+ /**
2306
+ * Create a new inline HTML annotation
2307
+ *
2308
+ * @returns {InlineHtmlAnnotation} - Inline HTML annotation
2309
+ */
2310
+ clone() {
2311
+ var _a, _b, _c, _d;
2312
+ const inlineHtmlAnnotation = new InlineHtmlAnnotation(this.htmlTag);
2313
+ inlineHtmlAnnotation.child = (_a = this.child) === null || _a === void 0 ? void 0 : _a.clone();
2314
+ inlineHtmlAnnotation.customAttribute = (_b = this.customAttribute) === null || _b === void 0 ? void 0 : _b.clone();
2315
+ inlineHtmlAnnotation.customClass = (_c = this.customClass) === null || _c === void 0 ? void 0 : _c.clone();
2316
+ inlineHtmlAnnotation.customStyle = (_d = this.customStyle) === null || _d === void 0 ? void 0 : _d.clone();
2317
+ return inlineHtmlAnnotation;
2318
+ }
2319
+ /**
2320
+ * Generate the JSON representation of the annotation
2321
+ *
2322
+ * @returns {Record<string, unknown>} JSON representation of the annotation
2323
+ */
2324
+ toJSON() {
2325
+ var _a, _b, _c, _d;
2326
+ return {
2327
+ inlineHtml: cleanObject({
2328
+ htmlTag: this.htmlTag,
2329
+ child: (_a = this.child) === null || _a === void 0 ? void 0 : _a.toJSON().inlineHtml,
2330
+ customAttribute: (_b = this.customAttribute) === null || _b === void 0 ? void 0 : _b.toJSON().customAttribute,
2331
+ customClass: (_c = this.customClass) === null || _c === void 0 ? void 0 : _c.toJSON().customClass,
2332
+ customStyle: (_d = this.customStyle) === null || _d === void 0 ? void 0 : _d.toJSON().customStyle,
2333
+ }),
2334
+ };
2335
+ }
2336
+ }
2337
+
2338
+ /**
2339
+ * Split the link nodes in the corresponding link group
2340
+ */
2341
+ class LinkGroupNodeSplitStrategy extends ActionHandleStrategy {
2342
+ /**
2343
+ * Split the text node.
2344
+ *
2345
+ * @param {LinkGroupNodeSplitAction} action - The split action.
2346
+ * @param {RTETextNode} target - The text node that need to be splitted.
2347
+ */
2348
+ handleAction(action, target) {
2349
+ const linkGroupAnnotation = target.parent.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
2350
+ if (linkGroupAnnotation) {
2351
+ const currentGroupKey = target.annotationMap.get('LINK').link
2352
+ .groupKey;
2353
+ const currentLinkGroup = linkGroupAnnotation.linkGroups.get(currentGroupKey);
2354
+ if (currentLinkGroup) {
2355
+ const index = currentLinkGroup.indexOf(target);
2356
+ if (index !== -1) {
2357
+ /* istanbul ignore next */
2358
+ currentLinkGroup.splice(index, 1, ...(Array.isArray(action.splittedTextNodes)
2359
+ ? action.splittedTextNodes
2360
+ : [action.splittedTextNodes]));
2361
+ linkGroupAnnotation.linkGroups.set(currentGroupKey, currentLinkGroup);
2362
+ }
2363
+ }
2364
+ }
2365
+ }
2366
+ }
2367
+
2368
+ /**
2369
+ * Delete the corresponding link group
2370
+ */
2371
+ class DeleteLinkGroupStrategy extends ActionHandleStrategy {
2372
+ /**
2373
+ * Delete the corresponding link group
2374
+ *
2375
+ * @param {DeleteLinkGroupAction} _action - The delete link group action.
2376
+ * @param {RTETextNode} target - The text node that need to remove link annotation.
2377
+ */
2378
+ handleAction(_action, target) {
2379
+ const linkGroupAnnotation = target.parent.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
2380
+ if (linkGroupAnnotation) {
2381
+ const currentGroupKey = target.annotationMap.get(NodeAnnotationTypeEnum.LINK).link.groupKey;
2382
+ const currentLinkGroup = linkGroupAnnotation.linkGroups.get(currentGroupKey);
2383
+ if (currentLinkGroup) {
2384
+ const index = currentLinkGroup.indexOf(target);
2385
+ if (index !== -1) {
2386
+ currentLinkGroup.splice(index, 1);
2387
+ }
2388
+ if (currentLinkGroup.length === 0) {
2389
+ linkGroupAnnotation.linkGroups.delete(currentGroupKey);
2390
+ }
2391
+ if (linkGroupAnnotation.linkGroups.size === 0) {
2392
+ target.parent.annotationMap.delete(InternalAnnotationTypeEnum.LINK_GROUP);
2393
+ }
2394
+ }
2395
+ }
2396
+ target.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
2397
+ }
2398
+ }
2399
+
2400
+ /**
2401
+ * Annotation to make text as plain text
2402
+ */
2403
+ class PlainTextAnnotation extends NodeAnnotation {
2404
+ constructor(plainText) {
2405
+ super();
2406
+ this.type = NodeAnnotationTypeEnum.PLAIN_TEXT;
2407
+ this.plainText = true;
2408
+ this.plainText = plainText;
2409
+ }
2410
+ /**
2411
+ * @inheritDoc
2412
+ */
2413
+ static from(plainText) {
2414
+ return [NodeAnnotationTypeEnum.PLAIN_TEXT, new PlainTextAnnotation(plainText)];
2415
+ }
2416
+ /**
2417
+ * @inheritDoc
2418
+ */
2419
+ clone() {
2420
+ return new PlainTextAnnotation(this.plainText);
2421
+ }
2422
+ /**
2423
+ * @inheritDoc
2424
+ */
2425
+ renderClass() {
2426
+ return undefined;
2427
+ }
2428
+ /**
2429
+ * @inheritDoc
2430
+ */
2431
+ renderStyle() {
2432
+ return undefined;
2433
+ }
2434
+ /**
2435
+ * @inheritDoc
2436
+ */
2437
+ toJSON() {
2438
+ return { plainText: this.plainText };
2439
+ }
2440
+ }
2441
+
1826
2442
  /**
1827
2443
  * Text node
1828
2444
  */
@@ -1832,24 +2448,35 @@ class RTETextNode extends RTENode {
1832
2448
  this.type = NodeTypeEnum.TEXT;
1833
2449
  this.parent = parentBlock;
1834
2450
  this.text = text;
2451
+ this.registerModifyStrategy();
2452
+ }
2453
+ /**
2454
+ * Determines if the given HTML tag is supported by the RTETextNode.
2455
+ *
2456
+ * @param {string} tag - The HTML tag to check.
2457
+ * @returns {boolean} `true` if the tag is supported, otherwise `false`.
2458
+ */
2459
+ static supportsHtmlTag(tag) {
2460
+ return ['span', 'code'].includes(tag);
1835
2461
  }
1836
2462
  /**
1837
2463
  * Creates an RTETextNode from a VegaRTETextNode with annotations and a parent RTETextBlock.
1838
2464
  *
1839
2465
  * @param {VegaRTETextNode} richText - A rich text node
1840
2466
  * @param {RTETextBlock} parentBlock - Parent block
2467
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
1841
2468
  * @returns {RTETextNode} an RTETextNode
1842
2469
  */
1843
- static from(richText, parentBlock) {
2470
+ static from(richText, parentBlock, options = { autoMatchFormat: true }) {
1844
2471
  const textNode = new RTETextNode(richText.id, richText.text, parentBlock);
1845
2472
  const { annotations } = richText;
1846
2473
  if (annotations) {
1847
2474
  textNode.annotationMap = new Map(Object.keys(annotations)
1848
2475
  .map((type) => {
1849
- if (annotations.link) {
1850
- parentBlock.apply(new LinkGroupAnnotationAction(annotations.link.groupKey, [textNode]));
2476
+ if (type === 'link' && annotations.link && parentBlock) {
2477
+ parentBlock.apply(new LinkGroupAnnotationAction(annotations.link.groupKey, [textNode], 'link'));
1851
2478
  }
1852
- return this.createAnnotationEntity(type, annotations[type]);
2479
+ return this.createAnnotationEntity(type, annotations[type], options);
1853
2480
  })
1854
2481
  .filter(isNonNullable));
1855
2482
  }
@@ -1860,10 +2487,12 @@ class RTETextNode extends RTENode {
1860
2487
  *
1861
2488
  * @param {keyof VegaRTETextAnnotations} type - The key of the type.
1862
2489
  * @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
2490
+ * @param {VegaRTETransformOptions} [options] - Optional transformation options that may be used for creating the annotation entity.
1863
2491
  * @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
1864
2492
  * value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
1865
2493
  */
1866
- static createAnnotationEntity(type, value) {
2494
+ static createAnnotationEntity(type, value, options) {
2495
+ const autoMatchFormat = !!(options && options.autoMatchFormat);
1867
2496
  switch (type) {
1868
2497
  case 'bold':
1869
2498
  return BoldAnnotation.from(value);
@@ -1874,24 +2503,40 @@ class RTETextNode extends RTENode {
1874
2503
  case 'strikethrough':
1875
2504
  return StrikethroughAnnotation.from(value);
1876
2505
  case 'code':
1877
- return CodeAnnotation.from(value);
2506
+ return CodeAnnotation.from(value, autoMatchFormat);
1878
2507
  case 'textColor':
1879
2508
  return TextColorAnnotation.from(value);
1880
2509
  case 'link':
1881
- return LinkAnnotation.from(value);
2510
+ return LinkAnnotation.from(value, autoMatchFormat);
2511
+ case 'inlineHtml': {
2512
+ return InlineHtmlAnnotation.from(value);
2513
+ }
2514
+ case 'plainText': {
2515
+ return PlainTextAnnotation.from(value);
2516
+ }
1882
2517
  }
2518
+ return RTENode.createAnnotationEntity(type, value);
1883
2519
  }
1884
2520
  /**
1885
2521
  * @inheritDoc
1886
2522
  */
1887
2523
  toJSON() {
1888
2524
  const annotations = Array.from(this.annotationMap.values())
1889
- .filter((annotation) => annotation instanceof NodeAnnotation)
2525
+ .filter((annotation) => annotation instanceof NodeAnnotation ||
2526
+ annotation instanceof CommonAnnotation ||
2527
+ annotation instanceof InlineHtmlAnnotation)
1890
2528
  .reduce((record, annotation) => {
1891
2529
  return Object.assign(Object.assign({}, record), annotation.toJSON());
1892
2530
  }, {});
1893
2531
  return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'text', text: this.text });
1894
2532
  }
2533
+ /**
2534
+ * @inheritDoc
2535
+ */
2536
+ toHtml() {
2537
+ const inlineHtmlAnnotation = this.getAnnotationByType(NodeAnnotationTypeEnum.INLINE_HTML);
2538
+ return inlineHtmlAnnotation ? this.renderWithWrapperStr(inlineHtmlAnnotation) : this.renderTextStr();
2539
+ }
1895
2540
  /**
1896
2541
  * Creates a new RTETextNode with the specified text and copies the parent block and annotation map from the original node.
1897
2542
  *
@@ -1899,13 +2544,15 @@ class RTETextNode extends RTENode {
1899
2544
  * @returns {RTETextNode} An new RTETextNode
1900
2545
  */
1901
2546
  cloneWithText(text) {
1902
- return new RTETextNode(generateUUID(), text, this.parent, super.cloneAnnotations());
2547
+ const cloned = new RTETextNode(generateUUID(), text, this.parent, super.cloneAnnotations());
2548
+ return cloned;
1903
2549
  }
1904
2550
  /**
1905
2551
  * @inheritDoc
1906
2552
  */
1907
2553
  clone() {
1908
- return new RTETextNode(this.id, this.text, this.parent, super.cloneAnnotations());
2554
+ const cloned = new RTETextNode(this.id, this.text, this.parent, super.cloneAnnotations());
2555
+ return cloned;
1909
2556
  }
1910
2557
  /**
1911
2558
  * Checks if a node is empty
@@ -1915,13 +2562,67 @@ class RTETextNode extends RTENode {
1915
2562
  isEmpty() {
1916
2563
  return !this.text || this.text === ZERO_WIDTH_SPACE || this.text === '\n';
1917
2564
  }
2565
+ /**
2566
+ * @inheritDoc
2567
+ */
2568
+ isTextNode() {
2569
+ return true;
2570
+ }
2571
+ /**
2572
+ * @inheritDoc
2573
+ */
2574
+ getRangeEndOffset() {
2575
+ if (!this.isContentEditable() && this.parent) {
2576
+ const parent = this.parent;
2577
+ const nodeIndex = parent.children.indexOf(this);
2578
+ return nodeIndex + 1; // place the cursor after the non-editable text node;
2579
+ }
2580
+ return this.text === '\n' ? 0 : this.text.length;
2581
+ }
2582
+ /**
2583
+ * @inheritDoc
2584
+ */
2585
+ getRangeContainer() {
2586
+ const element = stateEntityRenderingRegistry.getDOMByEntity(this);
2587
+ if (element) {
2588
+ if (this.isContentEditable()) {
2589
+ return element.firstChild;
2590
+ }
2591
+ else {
2592
+ return element.parentElement;
2593
+ }
2594
+ }
2595
+ }
2596
+ /**
2597
+ * @inheritDoc
2598
+ */
2599
+ isContentEditable() {
2600
+ return true;
2601
+ }
2602
+ /**
2603
+ * Registers the action strategies for the RTETextNode.
2604
+ */
2605
+ registerModifyStrategy() {
2606
+ const dtoClassName = this.constructor.name;
2607
+ if (!RTETextNode.registerActionStrategyStatus[dtoClassName]) {
2608
+ if (this.isContentEditable()) {
2609
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_TEXT, dtoClassName, new NodeUpdateTextStrategy());
2610
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_SELECTED_TEXT, dtoClassName, new NodeReplaceSelectedTextStrategy());
2611
+ ActionHandleStrategyRegistry.register(TextSplittableAction.name, dtoClassName, new NodeSplitTextStrategy());
2612
+ }
2613
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.LINK_GROUP_NODE_SPLIT, dtoClassName, new LinkGroupNodeSplitStrategy());
2614
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_LINK_GROUP, dtoClassName, new DeleteLinkGroupStrategy());
2615
+ ActionHandleStrategyRegistry.register(AnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
2616
+ RTETextNode.registerActionStrategyStatus[dtoClassName] = true;
2617
+ }
2618
+ }
1918
2619
  /**
1919
2620
  * @inheritDoc
1920
2621
  */
1921
2622
  doAnnotationActionApply(action) {
1922
2623
  const selectionRangeAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
1923
2624
  if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
1924
- const splitStrategy = ActionHandleStrategyRegistry.get(TextSplittableAction.name, RTETextNode.name);
2625
+ const splitStrategy = ActionHandleStrategyRegistry.get(TextSplittableAction.name, this.constructor.name);
1925
2626
  if (splitStrategy) {
1926
2627
  const newNode = splitStrategy.execute(action, this);
1927
2628
  if (newNode) {
@@ -1932,7 +2633,9 @@ class RTETextNode extends RTENode {
1932
2633
  else {
1933
2634
  this.applyActionToNode(this, action);
1934
2635
  }
1935
- this.parent.mergeNodes(action);
2636
+ if (typeof this.parent.mergeNodes === 'function') {
2637
+ this.parent.mergeNodes(action);
2638
+ }
1936
2639
  }
1937
2640
  /**
1938
2641
  * @inheritDoc
@@ -1976,13 +2679,76 @@ class RTETextNode extends RTENode {
1976
2679
  }
1977
2680
  }
1978
2681
  }
2682
+ /**
2683
+ * Render the text node with the inline HTML wrapper.
2684
+ *
2685
+ * @param {VegaInlineHtmlSchema} inlineHtmlNode - The inline HTML schema to wrap the text node.
2686
+ * @returns {string} The HTML string representation of the text node wrapped with the inline HTML.
2687
+ */
2688
+ renderWithWrapperStr(inlineHtmlNode) {
2689
+ const { htmlTag, customAttribute, customClass, customStyle, child } = inlineHtmlNode;
2690
+ const attrs = [
2691
+ ...((customAttribute === null || customAttribute === void 0 ? void 0 : customAttribute.toString()) || []),
2692
+ customClass === null || customClass === void 0 ? void 0 : customClass.toString(),
2693
+ customStyle === null || customStyle === void 0 ? void 0 : customStyle.toString(),
2694
+ ].filter(isNonNullable);
2695
+ const attrStr = attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
2696
+ if (!child) {
2697
+ return `<${htmlTag}${attrStr}>${this.renderTextStr()}</${htmlTag}>`;
2698
+ }
2699
+ return `<${htmlTag}${attrStr}>${this.renderWithWrapperStr(child)}</${htmlTag}>`;
2700
+ }
2701
+ /**
2702
+ * Generates the HTML representation of the text node.
2703
+ *
2704
+ * @returns {string} The HTML string representation of the text node.
2705
+ */
2706
+ renderTextStr() {
2707
+ var _a;
2708
+ const NodeTag = ((_a = this.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
2709
+ ? 'code'
2710
+ : 'span';
2711
+ const attrStr = super.generateAttributeString();
2712
+ // If the text contains a newline character, we need to replace it with a <br> tag.
2713
+ if (this.text === '\n') {
2714
+ return `<br>`;
2715
+ }
2716
+ return this.shouldRenderAsPlainText() ? this.text : `<${NodeTag}${attrStr}>${this.text}</${NodeTag}>`;
2717
+ }
2718
+ /**
2719
+ * Determines if the text node should be rendered as plain text.
2720
+ *
2721
+ * @returns {boolean} `true` if the text node should be rendered as plain text, otherwise `false`.
2722
+ */
2723
+ shouldRenderAsPlainText() {
2724
+ const plainTextAnnotation = super.getAnnotationByType(NodeAnnotationTypeEnum.PLAIN_TEXT);
2725
+ if (plainTextAnnotation) {
2726
+ return (plainTextAnnotation.plainText &&
2727
+ Array.from(this.annotationMap.values()).filter((annotation) => (annotation instanceof NodeAnnotation &&
2728
+ !(annotation instanceof LinkAnnotation) &&
2729
+ !(annotation instanceof PlainTextAnnotation)) ||
2730
+ annotation instanceof CommonAnnotation).length === 0);
2731
+ }
2732
+ else {
2733
+ return false;
2734
+ }
2735
+ }
2736
+ }
2737
+ RTETextNode.registerActionStrategyStatus = {};
2738
+ RTETextNode.htmlTag = 'span';
2739
+
2740
+ /**
2741
+ * Append children to a block or rte content
2742
+ *
2743
+ * @example parent.apply(new AppendChildrenAction([newChildren]))
2744
+ */
2745
+ class AppendChildrenAction extends ModifyContentAction {
2746
+ constructor(childNodes) {
2747
+ super();
2748
+ this.type = ModifyContentActionType.APPEND_CHILDREN;
2749
+ this.entityToBeAppended = childNodes;
2750
+ }
1979
2751
  }
1980
- (() => {
1981
- ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_TEXT, RTETextNode.name, new NodeUpdateTextStrategy());
1982
- ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_SELECTED_TEXT, RTETextNode.name, new NodeReplaceSelectedTextStrategy());
1983
- ActionHandleStrategyRegistry.register(TextSplittableAction.name, RTETextNode.name, new NodeSplitTextStrategy());
1984
- ActionHandleStrategyRegistry.register(AnnotationAction.name, RTETextNode.name, new NodeUpdateAnnotationMapStrategy());
1985
- })();
1986
2752
 
1987
2753
  /**
1988
2754
  * Text style annotation
@@ -2017,44 +2783,106 @@ class TextStyleAnnotation extends BlockAnnotation {
2017
2783
  return new TextStyleAnnotation(this.textStyle);
2018
2784
  }
2019
2785
  /**
2020
- * Render the styles by block type
2021
- *
2022
- * @returns {AnnotationStyle} the styles to apply
2786
+ * @inheritDoc
2787
+ */
2788
+ renderClass(options) {
2789
+ if (options === null || options === void 0 ? void 0 : options.standalone)
2790
+ return null;
2791
+ return this.textStyle ? `v-rte--text-style-${this.textStyle}` : null;
2792
+ }
2793
+ /**
2794
+ * @inheritDoc
2023
2795
  */
2024
- render() {
2796
+ renderStyle(options) {
2797
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
2798
+ return null;
2025
2799
  const paragraphStyle = {
2026
2800
  fontFamily: 'Inter',
2027
2801
  fontSize: '16px',
2028
2802
  lineHeight: '22px',
2029
2803
  fontWeight: '500',
2804
+ marginTop: '0px',
2805
+ marginBottom: '0px',
2030
2806
  };
2031
2807
  switch (this.textStyle) {
2032
2808
  case 'paragraph': {
2033
2809
  return paragraphStyle;
2034
2810
  }
2035
2811
  case 'title': {
2036
- return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
2812
+ return {
2813
+ fontFamily: 'Inter',
2814
+ fontSize: '36px',
2815
+ lineHeight: '40px',
2816
+ fontWeight: '500',
2817
+ };
2037
2818
  }
2038
2819
  case 'subtitle': {
2039
- return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
2820
+ return {
2821
+ fontFamily: 'Inter',
2822
+ fontSize: '28px',
2823
+ lineHeight: '32px',
2824
+ fontWeight: '500',
2825
+ };
2040
2826
  }
2041
2827
  case 'heading-1': {
2042
- return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
2828
+ return {
2829
+ fontFamily: 'Inter',
2830
+ fontSize: '22px',
2831
+ lineHeight: '24px',
2832
+ fontWeight: '500',
2833
+ marginTop: '0px',
2834
+ marginBottom: '0px',
2835
+ };
2043
2836
  }
2044
2837
  case 'heading-2': {
2045
- return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
2838
+ return {
2839
+ fontFamily: 'Inter',
2840
+ fontSize: '20px',
2841
+ lineHeight: '24px',
2842
+ fontWeight: '500',
2843
+ marginTop: '0px',
2844
+ marginBottom: '0px',
2845
+ };
2046
2846
  }
2047
2847
  case 'heading-3': {
2048
- return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
2848
+ return {
2849
+ fontFamily: 'Inter',
2850
+ fontSize: '18px',
2851
+ lineHeight: '22px',
2852
+ fontWeight: '500',
2853
+ marginTop: '0px',
2854
+ marginBottom: '0px',
2855
+ };
2049
2856
  }
2050
2857
  case 'heading-4': {
2051
- return { fontFamily: 'Inter', fontSize: '16px', lineHeight: '22px', fontWeight: '500' };
2858
+ return {
2859
+ fontFamily: 'Inter',
2860
+ fontSize: '16px',
2861
+ lineHeight: '22px',
2862
+ fontWeight: '500',
2863
+ marginTop: '0px',
2864
+ marginBottom: '0px',
2865
+ };
2052
2866
  }
2053
2867
  case 'heading-5': {
2054
- return { fontFamily: 'Inter', fontSize: '14px', lineHeight: '22px', fontWeight: '500' };
2868
+ return {
2869
+ fontFamily: 'Inter',
2870
+ fontSize: '14px',
2871
+ lineHeight: '22px',
2872
+ fontWeight: '500',
2873
+ marginTop: '0px',
2874
+ marginBottom: '0px',
2875
+ };
2055
2876
  }
2056
2877
  case 'heading-6': {
2057
- return { fontFamily: 'Inter', fontSize: '12px', lineHeight: '22px', fontWeight: '500' };
2878
+ return {
2879
+ fontFamily: 'Inter',
2880
+ fontSize: '12px',
2881
+ lineHeight: '22px',
2882
+ fontWeight: '500',
2883
+ marginTop: '0px',
2884
+ marginBottom: '0px',
2885
+ };
2058
2886
  }
2059
2887
  }
2060
2888
  }
@@ -2080,25 +2908,6 @@ class TextStyleAnnotationAction extends AnnotationAction {
2080
2908
  }
2081
2909
  }
2082
2910
 
2083
- /**
2084
- * Action to toggle bold annotation
2085
- */
2086
- class BoldAnnotationAction extends TextSplittableAction {
2087
- constructor(bold) {
2088
- super();
2089
- this.isFlushable = true;
2090
- this.bold = bold;
2091
- }
2092
- /**
2093
- * Converts the action to an annotation
2094
- *
2095
- * @returns {BoldAnnotation} the annotation
2096
- */
2097
- toAnnotation() {
2098
- return new BoldAnnotation(this.bold);
2099
- }
2100
- }
2101
-
2102
2911
  /**
2103
2912
  * Update the text block text style strategy.
2104
2913
  */
@@ -2125,6 +2934,7 @@ class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
2125
2934
  node.apply(new DeleteNodeAnnotationAction(NodeAnnotationTypeEnum.BOLD));
2126
2935
  });
2127
2936
  }
2937
+ this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
2128
2938
  }
2129
2939
  }
2130
2940
 
@@ -2139,15 +2949,56 @@ class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
2139
2949
  * @param {RTETextBlock} target - The current text block.
2140
2950
  */
2141
2951
  handleAction(action, target) {
2142
- const linkGroupAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
2143
- if (linkGroupAnnotation) {
2144
- const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
2145
- linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
2952
+ let linkGroupAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
2953
+ if (action.type === 'update_link') {
2954
+ if (linkGroupAnnotation) {
2955
+ const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
2956
+ if (linkGroup) {
2957
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [linkGroup[0]]);
2958
+ }
2959
+ }
2960
+ }
2961
+ else {
2962
+ if (linkGroupAnnotation) {
2963
+ const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey) || [];
2964
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
2965
+ }
2966
+ else {
2967
+ linkGroupAnnotation = action.toAnnotation();
2968
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [...action.nodes]);
2969
+ }
2146
2970
  target.annotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
2147
2971
  }
2148
2972
  }
2149
2973
  }
2150
2974
 
2975
+ /**
2976
+ * Insert a new children after a existing children
2977
+ *
2978
+ * @example parent.apply(new InsertChildrenAfterAction(existingChildren, newChildren, ...))
2979
+ */
2980
+ class InsertChildrenAfterAction extends ModifyContentAction {
2981
+ constructor(referBlock, ...blocksToBeInserted) {
2982
+ super();
2983
+ this.type = ModifyContentActionType.INSERT_CHILDREN_AFTER;
2984
+ this.referChildren = referBlock;
2985
+ this.childrenToBeInserted = blocksToBeInserted;
2986
+ }
2987
+ }
2988
+
2989
+ /**
2990
+ * Clear the current block nodes and append new nodes
2991
+ *
2992
+ * @example block.apply(new ReplaceChildNodesAction(newNodes))
2993
+ */
2994
+ class ReplaceChildNodesAction extends ModifyContentAction {
2995
+ constructor(newChildNodes) {
2996
+ super();
2997
+ this.type = ModifyContentActionType.REPLACE_CHILD_NODES;
2998
+ this.newChildNodes = newChildNodes;
2999
+ }
3000
+ }
3001
+
2151
3002
  /**
2152
3003
  * Split the current node with a special position strategy.
2153
3004
  */
@@ -2182,7 +3033,7 @@ class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
2182
3033
  }
2183
3034
  textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
2184
3035
  const newBlock = textBlock.cloneWithNodes(afterNodes);
2185
- textBlock.parent.apply(new InsertBlocksAfterAction(textBlock, newBlock));
3036
+ textBlock.parent.apply(new InsertChildrenAfterAction(textBlock, newBlock));
2186
3037
  return newBlock;
2187
3038
  }
2188
3039
  }
@@ -2190,52 +3041,54 @@ class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
2190
3041
  }
2191
3042
 
2192
3043
  /**
2193
- * Insert new paragraph into current text block at special position.
3044
+ * Remove all nodes and append new nodes strategy.
2194
3045
  */
2195
- class BlockInsertNewParagraphStrategy extends ActionHandleStrategy {
3046
+ class BlockReplaceNodesStrategy extends ActionHandleStrategy {
2196
3047
  /**
2197
- * @inheritDoc
3048
+ * Empty the text block or image block nodes and add new nodes.
3049
+ *
3050
+ * @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
3051
+ * @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
2198
3052
  */
2199
3053
  handleAction(action, target) {
2200
- action.newBlock = this.breakSingleTextBlock(action.startContainerNode, action.startOffset, target);
3054
+ target.children = [];
3055
+ target.apply(new AppendChildrenAction(action.newChildNodes));
2201
3056
  }
2202
- /**
2203
- * breakSingleTextBlock
2204
- *
2205
- * @param {RTETextNode} splitNode -
2206
- * @param {number} startOffsetOfNode -
2207
- * @param {RTETextBlock} target -
2208
- * @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
2209
- */
2210
- breakSingleTextBlock(splitNode, startOffsetOfNode, target) {
2211
- const newParagraph = this.copyInlineStyleToNewParagraph(splitNode, target);
2212
- if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
2213
- target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
2214
- }
2215
- else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
2216
- target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
2217
- }
2218
- else {
2219
- const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
2220
- target.apply(splitBlockAction);
2221
- return splitBlockAction.newBlock;
2222
- }
2223
- return newParagraph;
3057
+ }
3058
+
3059
+ /**
3060
+ * Remove a children from the current block
3061
+ *
3062
+ * @example needRemovedChildren.parent.apply(new RemoveChildrenAction(needRemovedChildren))
3063
+ */
3064
+ class RemoveChildrenAction extends ModifyContentAction {
3065
+ constructor(childNode) {
3066
+ super();
3067
+ this.type = ModifyContentActionType.DELETE_CHILDREN;
3068
+ this.entityToBeRemoved = childNode;
2224
3069
  }
3070
+ }
3071
+
3072
+ /**
3073
+ * Append the second block child nodes to the first block child nodes and remove the second block strategy.
3074
+ */
3075
+ class BlockMergeNodesStrategy extends ActionHandleStrategy {
2225
3076
  /**
2226
- * copyInlineStyleToNewParagraph
3077
+ * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
2227
3078
  *
2228
- * @param {RTETextNode} needCopedNode - The text node.
2229
- * @param {RTETextBlock} target - The text block.
2230
- * @returns {RTETextBlock} - The new paragraph.
3079
+ * @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
3080
+ * @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
2231
3081
  */
2232
- copyInlineStyleToNewParagraph(needCopedNode, target) {
2233
- const textNode = needCopedNode.cloneWithText('');
2234
- // The link annotation don't need inherited
2235
- textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
2236
- const newParagraph = target.createNewParagraph();
2237
- newParagraph.apply(new AppendChildNodesAction([textNode]));
2238
- return newParagraph;
3082
+ handleAction(action, target) {
3083
+ const anotherBlock = action.blockNeedToBeMerged;
3084
+ if (target.type === anotherBlock.type || (target.type !== 'image' && anotherBlock.type !== 'image')) {
3085
+ let shouldMergeNodes = anotherBlock.children;
3086
+ if (anotherBlock.type !== 'image') {
3087
+ shouldMergeNodes = anotherBlock.children.filter((node) => node.text);
3088
+ }
3089
+ target.apply(new AppendChildrenAction(shouldMergeNodes));
3090
+ anotherBlock.parent.apply(new RemoveChildrenAction(anotherBlock));
3091
+ }
2239
3092
  }
2240
3093
  }
2241
3094
 
@@ -2328,7 +3181,7 @@ class BlockInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
2328
3181
  blocks.map((block) => {
2329
3182
  if (block.type !== 'image') {
2330
3183
  nodes.push(...block.children);
2331
- block.parent.apply(new RemoveChildAction(block));
3184
+ block.parent.apply(new RemoveChildrenAction(block));
2332
3185
  }
2333
3186
  });
2334
3187
  return nodes;
@@ -2350,112 +3203,31 @@ class BlockInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
2350
3203
  }
2351
3204
 
2352
3205
  /**
2353
- * Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
3206
+ * Insert a children before a existing children
2354
3207
  *
2355
- * @example firstBlock.apply(new MergeTwoBlocksNodesAction(secondBlock))
3208
+ * @example parent.apply(new InsertChildrenBeforeAction(existingChildren, newChildren, ...))
2356
3209
  */
2357
- class MergeTwoBlocksNodesAction extends ModifyContentAction {
2358
- constructor(blockNeedToBeMerged) {
3210
+ class InsertChildrenBeforeAction extends ModifyContentAction {
3211
+ constructor(referChildren, ...childrenToBeInserted) {
2359
3212
  super();
2360
- this.type = ModifyContentActionType.MERGE_TWO_BLOCKS_NODES;
2361
- this.blockNeedToBeMerged = blockNeedToBeMerged;
3213
+ this.type = ModifyContentActionType.INSERT_CHILDREN_BEFORE;
3214
+ this.referChildren = referChildren;
3215
+ this.childrenToBeInserted = childrenToBeInserted;
2362
3216
  }
2363
3217
  }
2364
3218
 
2365
3219
  /**
2366
- * The text block delete text content strategy.
3220
+ * Split the block with a split point node.
3221
+ * The property `newBlock` use to store the new create block if need.
3222
+ *
3223
+ * @example block.apply(new SplitBlockWithNodeAction(node, offset))
2367
3224
  */
2368
- class BlockDeleteTextContentStrategy extends BlockDeleteNodeContentStrategy {
2369
- /**
2370
- * @inheritDoc
2371
- */
2372
- handleAction(action, target) {
2373
- this.deleteNodeContent(action, target);
2374
- }
2375
- /**
2376
- * Handle the delete text logic when press delete key.
2377
- *
2378
- * @param {DeleteBlockContentAction} action - ModifyContentAction
2379
- * @param {RTETextBlock} target - Current text block
2380
- */
2381
- deleteNodeContent(action, target) {
2382
- const startContainerNode = action.startContainerNode;
2383
- const startOffset = action.startOffset;
2384
- if (startOffset !== 0 && !startContainerNode.isEmpty()) {
2385
- const newText = startContainerNode.text.slice(0, startOffset - 1) +
2386
- startContainerNode.text.slice(startOffset);
2387
- startContainerNode.apply(new UpdateTextAction(newText));
2388
- if (newText) {
2389
- action.previousNode = startContainerNode;
2390
- return;
2391
- }
2392
- else {
2393
- const previousNode = this.getPreviousNode(startContainerNode);
2394
- // Remove the last character will not delete paragraph, the paragraph will removed after press delete again
2395
- if ((previousNode && previousNode.parent === target && previousNode['text'] === '\n') ||
2396
- target.children.length === 1) {
2397
- action.previousNode = startContainerNode;
2398
- return;
2399
- }
2400
- else {
2401
- target.apply(new RemoveChildAction(startContainerNode));
2402
- action.previousNode = previousNode;
2403
- return;
2404
- }
2405
- }
2406
- }
2407
- else {
2408
- let previousNode = this.getPreviousNode(startContainerNode);
2409
- let nextNode = null;
2410
- if (target.children.length && previousNode && previousNode.parent !== target) {
2411
- if (startContainerNode.isEmpty()) {
2412
- target.apply(new RemoveChildAction(startContainerNode));
2413
- }
2414
- if (target.type === previousNode.parent.type) {
2415
- previousNode.parent.apply(new MergeTwoBlocksNodesAction(target));
2416
- }
2417
- }
2418
- else {
2419
- if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
2420
- nextNode = this.getNextNode(startContainerNode);
2421
- }
2422
- /**
2423
- * Remove line break
2424
- *
2425
- * @example caret at the first line
2426
- * \n
2427
- * test
2428
- */
2429
- if (startContainerNode.isEmpty()) {
2430
- target.apply(new RemoveChildAction(startContainerNode));
2431
- }
2432
- /**
2433
- * Remove line break
2434
- *
2435
- * @example caret at the begin of second line
2436
- * \n
2437
- * test
2438
- */
2439
- if (previousNode instanceof RTETextNode && previousNode.isEmpty()) {
2440
- const shouldRemoveNode = previousNode;
2441
- previousNode = this.getPreviousNode(previousNode);
2442
- shouldRemoveNode.parent.apply(new RemoveChildAction(shouldRemoveNode));
2443
- if (!previousNode) {
2444
- nextNode = startContainerNode;
2445
- }
2446
- }
2447
- }
2448
- //Remove the paragraph block if the content is empty
2449
- if (target.children.length === 0) {
2450
- target.parent.apply(new RemoveChildAction(target));
2451
- }
2452
- if (previousNode) {
2453
- action.previousNode = previousNode;
2454
- }
2455
- else if (nextNode) {
2456
- action.nextNode = nextNode;
2457
- }
2458
- }
3225
+ class SplitBlockWithNodeAction extends ModifyContentAction {
3226
+ constructor(splitPointNode, startOffsetOfNode) {
3227
+ super();
3228
+ this.type = ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
3229
+ this.splitPointNode = splitPointNode;
3230
+ this.startOffsetOfNode = startOffsetOfNode;
2459
3231
  }
2460
3232
  }
2461
3233
 
@@ -2473,82 +3245,131 @@ class BlockInsertImageIntoTextStrategy extends ActionHandleStrategy {
2473
3245
  const splitNode = action.splitPointNode;
2474
3246
  const startOffsetOfNode = action.startOffsetOfNode;
2475
3247
  const newImageBlock = action.imageBlockToBeInserted;
2476
- if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
2477
- target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
3248
+ if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
3249
+ target.parent.apply(new InsertChildrenAfterAction(target, newImageBlock));
2478
3250
  }
2479
- else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
2480
- target.parent.apply(new InsertBlocksBeforeAction(target, newImageBlock));
3251
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
3252
+ target.parent.apply(new InsertChildrenBeforeAction(target, newImageBlock));
2481
3253
  }
2482
3254
  else {
2483
3255
  const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
2484
3256
  target.apply(splitBlockAction);
2485
- target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
3257
+ target.parent.apply(new InsertChildrenAfterAction(target, newImageBlock));
2486
3258
  }
2487
3259
  }
2488
3260
  }
2489
3261
 
2490
3262
  /**
2491
- * Replace the node with new node array strategy.
3263
+ * Convert the selected blocks to list strategy.
3264
+ */
3265
+ class BlockTransformToListStrategy extends ActionHandleStrategy {
3266
+ /**
3267
+ * This method will create a empty list block and append all selected blocks as list item block.
3268
+ *
3269
+ * @param {TransformListAction} action - The transform list action instance.
3270
+ * @param {RTETextBlock} target - The first item of the selected block.
3271
+ */
3272
+ handleAction(action, target) {
3273
+ const contentState = target.parent;
3274
+ const bulletList = contentState.createList(action.listType);
3275
+ const selectedBlocks = action.selectedBlocks;
3276
+ const listItems = selectedBlocks.map((block) => contentState.toListItem(block));
3277
+ bulletList.apply(new AppendChildrenAction(listItems));
3278
+ contentState.apply(new InsertChildrenAfterAction(action.selectedBlocks[0], bulletList));
3279
+ selectedBlocks.forEach((block) => {
3280
+ block.parent.apply(new RemoveChildrenAction(block));
3281
+ });
3282
+ }
3283
+ }
3284
+
3285
+ /**
3286
+ * Action to toggle block horizontal alignment annotation
3287
+ */
3288
+ class HorizontalAlignmentAnnotationAction extends AnnotationAction {
3289
+ constructor(textAlign) {
3290
+ super();
3291
+ this.isFlushable = true;
3292
+ this.textAlign = textAlign;
3293
+ }
3294
+ /**
3295
+ * Converts the action to an annotation
3296
+ *
3297
+ * @returns {HorizontalAlignmentAnnotation} The annotation
3298
+ */
3299
+ toAnnotation() {
3300
+ return new HorizontalAlignmentAnnotation(this.textAlign);
3301
+ }
3302
+ }
3303
+
3304
+ /**
3305
+ * Update the text block and image block horizontal alignment strategy.
3306
+ */
3307
+ class BlockUpdateHorizontalAlignmentStrategy extends ActionHandleStrategy {
3308
+ /**
3309
+ * Updating the horizontal alignment of a block requires cascading updates to the custom style.
3310
+ *
3311
+ * @param {HorizontalAlignmentAnnotationAction} _action - The horizontal alignment annotation action.
3312
+ * @param {RTETextBlock} target - The current text block.
3313
+ */
3314
+ handleAction(_action, target) {
3315
+ this.updateCustomStyleAnnotation(target, ['textAlign']);
3316
+ }
3317
+ }
3318
+
3319
+ /**
3320
+ * Update the text block and image block horizontal alignment strategy.
2492
3321
  */
2493
- class BlockReplaceNodeWithNodesStrategy extends ActionHandleStrategy {
3322
+ class BlockUpdateIndentStrategy extends ActionHandleStrategy {
2494
3323
  /**
2495
- * Replace the current node to the new node array.
3324
+ * Updating the indent of a block requires cascading updates to the custom style.
2496
3325
  *
2497
- * @param {RTEBlock} target - The image block or the text block.
2498
- * @param {RTENode} referNode - The text node or the image node.
2499
- * @param {RTENode[]} newNodes - The array of the text node or the image node.
3326
+ * @param {IndentAnnotationAction} _action - The indent annotation action.
3327
+ * @param {RTETextBlock} target - The current text block.
2500
3328
  */
2501
- replaceNodeWithNodes(target, referNode, newNodes) {
2502
- if (target.children) {
2503
- newNodes.forEach((node) => {
2504
- node.parent = target;
2505
- });
2506
- target.children = target.children.flatMap((node) => {
2507
- if (node === referNode) {
2508
- return newNodes;
2509
- }
2510
- else {
2511
- return node;
2512
- }
2513
- });
2514
- }
3329
+ handleAction(_action, target) {
3330
+ this.updateCustomStyleAnnotation(target, ['marginLeft']);
2515
3331
  }
2516
3332
  }
2517
3333
 
2518
3334
  /**
2519
- * Insert some text nodes at the before of the node strategy.
3335
+ * Action to toggle block indent annotation
2520
3336
  */
2521
- class BlockInsertNodesBeforeNodeStrategy extends BlockReplaceNodeWithNodesStrategy {
3337
+ class IndentAnnotationAction extends AnnotationAction {
3338
+ constructor(indent) {
3339
+ super();
3340
+ this.isFlushable = true;
3341
+ this.indent = indent;
3342
+ }
2522
3343
  /**
2523
- * @inheritDoc
3344
+ * Converts the action to an annotation
3345
+ *
3346
+ * @returns {Annotation} The annotation
2524
3347
  */
2525
- handleAction(action, target) {
2526
- const referNode = action.referNode;
2527
- const nodes = [...action.nodesToBeInserted, referNode];
2528
- this.replaceNodeWithNodes(target, referNode, nodes);
3348
+ toAnnotation() {
3349
+ return new IndentAnnotation(this.indent);
2529
3350
  }
2530
3351
  }
2531
3352
 
2532
3353
  /**
2533
- * Convert the selected blocks to list strategy.
3354
+ * Unlink the text block link group annotation strategy.
2534
3355
  */
2535
- class BlockTransformToListStrategy extends ActionHandleStrategy {
3356
+ class BlockUnlinkLinkGroupStrategy extends ActionHandleStrategy {
2536
3357
  /**
2537
- * This method will create a empty list block and append all selected blocks as list item block.
3358
+ * Unlink the link group based on group key
2538
3359
  *
2539
- * @param {TransformListAction} action - The transform list action instance.
2540
- * @param {RTETextBlock} target - The first item of the selected block.
3360
+ * @param {UnlinkLinkGroupAction} action - The unlink link group action instance.
3361
+ * @param {RTETextBlock} target - The current text block.
2541
3362
  */
2542
3363
  handleAction(action, target) {
2543
- const contentState = target.parent;
2544
- const bulletList = contentState.createList(action.listType);
2545
- const selectedBlocks = action.selectedBlocks;
2546
- const listItems = selectedBlocks.map((block) => contentState.toListItem(block));
2547
- bulletList.apply(new AppendChildNodesAction(listItems));
2548
- contentState.apply(new InsertBlocksAfterAction(action.selectedBlocks[0], bulletList));
2549
- selectedBlocks.forEach((block) => {
2550
- block.parent.apply(new RemoveChildAction(block));
2551
- });
3364
+ const linkGroupAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
3365
+ if (linkGroupAnnotation) {
3366
+ if (linkGroupAnnotation.linkGroups.size > 1) {
3367
+ linkGroupAnnotation.linkGroups.delete(action.groupKey);
3368
+ }
3369
+ else {
3370
+ target.annotationMap.delete(InternalAnnotationTypeEnum.LINK_GROUP);
3371
+ }
3372
+ }
2552
3373
  }
2553
3374
  }
2554
3375
 
@@ -2556,34 +3377,42 @@ class BlockTransformToListStrategy extends ActionHandleStrategy {
2556
3377
  * Text block
2557
3378
  */
2558
3379
  class RTETextBlock extends RTEBlock {
2559
- constructor(id, type) {
3380
+ constructor(id, type, options) {
2560
3381
  super(id);
2561
3382
  this.children = [];
2562
3383
  this.type = type;
2563
- if (RTETextBlock.isAcceptableTextStyle(type)) {
2564
- this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
2565
- }
2566
- else {
2567
- this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
3384
+ const { autoMatchFormat } = options || { autoMatchFormat: true };
3385
+ if (autoMatchFormat) {
3386
+ if (RTETextBlock.isAcceptableTextStyle(type)) {
3387
+ this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
3388
+ }
3389
+ else {
3390
+ this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
3391
+ }
2568
3392
  }
2569
3393
  }
2570
3394
  /**
2571
3395
  * Converts a VegaRTETextBlock into an RTETextBlock.
2572
3396
  *
2573
3397
  * @param {VegaRTETextBlock} block - The block object
3398
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
2574
3399
  * @returns {RTETextBlock} A RTETextBlock class
2575
3400
  */
2576
- static from(block) {
2577
- const textBlock = new RTETextBlock(block.id, block.type);
2578
- const { annotations } = block;
2579
- textBlock.children = block.nodes.map((richText) => RTETextNode.from(richText, textBlock));
3401
+ static from(block, options = { autoMatchFormat: true }) {
3402
+ var _a, _b;
3403
+ const textBlock = new RTETextBlock(block.id, block.type, options);
3404
+ const annotations = options.autoMatchFormat
3405
+ ? Object.assign(Object.assign({}, block.annotations), { textStyle: (_b = (_a = block.annotations) === null || _a === void 0 ? void 0 : _a.textStyle) !== null && _b !== void 0 ? _b : textBlock.type }) : block.annotations;
3406
+ textBlock.children = block.nodes
3407
+ .map((richText) => {
3408
+ const NodeClass = RTEDTOClassManager$1.getRTENodeClass(richText.type);
3409
+ if (NodeClass) {
3410
+ return NodeClass.from(richText, textBlock, options);
3411
+ }
3412
+ })
3413
+ .filter(isNonNullable);
2580
3414
  if (annotations) {
2581
- Object.entries(annotations).forEach(([type, value]) => {
2582
- const item = this.createAnnotationEntity(type, value);
2583
- if (isNonNullable(item)) {
2584
- textBlock.annotationMap.set(...item);
2585
- }
2586
- });
3415
+ super.convertAnnotationsToMap(textBlock.annotationMap, annotations);
2587
3416
  }
2588
3417
  return textBlock;
2589
3418
  }
@@ -2596,7 +3425,7 @@ class RTETextBlock extends RTEBlock {
2596
3425
  * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
2597
3426
  * that will be used to create the annotation entity. It can be of any type depending on the specific
2598
3427
  * annotation being created.
2599
- * @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
3428
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
2600
3429
  * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
2601
3430
  */
2602
3431
  static createAnnotationEntity(type, value) {
@@ -2653,16 +3482,31 @@ class RTETextBlock extends RTEBlock {
2653
3482
  toJSON() {
2654
3483
  return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.children.map((node) => node.toJSON()) });
2655
3484
  }
3485
+ /**
3486
+ * @inheritDoc
3487
+ */
3488
+ toHtml(options) {
3489
+ const BlockTag = this.getBlockTag();
3490
+ const attrStr = super.generateAttributeString();
3491
+ const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
3492
+ let nodesHtml = this.children.map((node) => node.toHtml()).join('');
3493
+ if (linkGroupAnnotation && this.children.length > 0) {
3494
+ nodesHtml = this.generateLinkHtml(linkGroupAnnotation, nodesHtml, options);
3495
+ }
3496
+ return super.shouldRenderAsInternalWrapper()
3497
+ ? nodesHtml
3498
+ : [`<${BlockTag}${attrStr}>`, nodesHtml, `</${BlockTag}>`].join('');
3499
+ }
2656
3500
  /**
2657
3501
  * Clone the nodes to a new block
2658
3502
  *
2659
3503
  * @param {RTEBlock} nodes - The nodes will be copied
2660
- * @returns {RTEBlock} New block
3504
+ * @returns {RTETextBlock} New block
2661
3505
  */
2662
3506
  cloneWithNodes(nodes) {
2663
3507
  const block = new RTETextBlock(generateUUID(), this.type);
2664
- block.children = [];
2665
- block.apply(new AppendChildNodesAction(nodes));
3508
+ block.annotationMap = super.cloneAnnotations();
3509
+ block.apply(new AppendChildrenAction(nodes));
2666
3510
  return block;
2667
3511
  }
2668
3512
  /**
@@ -2692,12 +3536,31 @@ class RTETextBlock extends RTEBlock {
2692
3536
  return this.children[this.children.length - 1];
2693
3537
  }
2694
3538
  /**
2695
- * Create new empty paragraph.
2696
- *
2697
- * @returns {RTETextBlock} Paragraph.
2698
- */
2699
- createNewParagraph() {
2700
- return new RTETextBlock(generateUUID(), 'paragraph');
3539
+ * Get the HTML tag for the block based on its type.
3540
+ *
3541
+ * @returns {RTETextBlockTagType} The HTML tag for the block.
3542
+ */
3543
+ getBlockTag() {
3544
+ switch (this.type) {
3545
+ case 'title':
3546
+ case 'subtitle':
3547
+ return `div`;
3548
+ case 'heading-1':
3549
+ return `h1`;
3550
+ case 'heading-2':
3551
+ return `h2`;
3552
+ case 'heading-3':
3553
+ return `h3`;
3554
+ case 'heading-4':
3555
+ return `h4`;
3556
+ case 'heading-5':
3557
+ return `h5`;
3558
+ case 'heading-6':
3559
+ return `h6`;
3560
+ case 'paragraph':
3561
+ default:
3562
+ return 'p';
3563
+ }
2701
3564
  }
2702
3565
  /**
2703
3566
  * @inheritDoc
@@ -2708,24 +3571,193 @@ class RTETextBlock extends RTEBlock {
2708
3571
  strategy.execute(action, this);
2709
3572
  }
2710
3573
  }
3574
+ /**
3575
+ * Generate Link Html
3576
+ *
3577
+ * @param {LinkGroupAnnotation} linkGroupAnnotation - linkGroupAnnotation
3578
+ * @param {string} nodesHtml - The nodes html
3579
+ * @param {VegaRTETransformOptions} options - options
3580
+ * @returns {string} link html
3581
+ */
3582
+ generateLinkHtml(linkGroupAnnotation, nodesHtml, options) {
3583
+ nodesHtml = '';
3584
+ let linkGroupNodes = [];
3585
+ for (let i = 0; i < this.children.length; i++) {
3586
+ const currentLinkAnnotation = this.children[i].getAnnotationByType(NodeAnnotationTypeEnum.LINK);
3587
+ const nextLinkAnnotation = this.children[i + 1]
3588
+ ? this.children[i + 1].getAnnotationByType(NodeAnnotationTypeEnum.LINK)
3589
+ : null;
3590
+ if (currentLinkAnnotation) {
3591
+ linkGroupNodes.push(this.children[i]);
3592
+ if (!nextLinkAnnotation ||
3593
+ currentLinkAnnotation.link.groupKey !== nextLinkAnnotation.link.groupKey) {
3594
+ const linkAttributes = linkGroupAnnotation.toString(currentLinkAnnotation, {
3595
+ standalone: true,
3596
+ autoMatchFormat: options === null || options === void 0 ? void 0 : options.autoMatchFormat,
3597
+ });
3598
+ nodesHtml += [
3599
+ `<a${linkAttributes ? ` ${linkAttributes}` : ''}>`,
3600
+ linkGroupNodes.map((linkNode) => linkNode.toHtml()).join(''),
3601
+ `</a>`,
3602
+ ].join('');
3603
+ linkGroupNodes = [];
3604
+ }
3605
+ }
3606
+ else {
3607
+ nodesHtml += this.children[i].toHtml();
3608
+ }
3609
+ }
3610
+ return nodesHtml;
3611
+ }
2711
3612
  }
2712
3613
  (() => {
2713
3614
  ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTETextBlock.name, new BlockUpdateTextStyleStrategy());
3615
+ ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTETextBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
3616
+ ActionHandleStrategyRegistry.register(IndentAnnotationAction.name, RTETextBlock.name, new BlockUpdateIndentStrategy());
2714
3617
  ActionHandleStrategyRegistry.register(LinkGroupAnnotationAction.name, RTETextBlock.name, new BlockUpdateLinkGroupStrategy());
2715
- ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTETextBlock.name, new BlockRemoveNodeStrategy());
2716
- ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTETextBlock.name, new BlockAppendNodesStrategy());
3618
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.UNLINK_LINK_GROUP, RTETextBlock.name, new BlockUnlinkLinkGroupStrategy());
2717
3619
  ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTETextBlock.name, new BlockSplitWithTextNodeStrategy());
2718
3620
  ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTETextBlock.name, new BlockReplaceNodesStrategy());
2719
3621
  ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTETextBlock.name, new BlockMergeNodesStrategy());
2720
- ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTETextBlock.name, new BlockInsertNewParagraphStrategy());
2721
3622
  ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTETextBlock.name, new BlockInsertLineBreakStrategy());
2722
3623
  ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTETextBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
2723
- ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTETextBlock.name, new BlockDeleteTextContentStrategy());
2724
3624
  ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTETextBlock.name, new BlockInsertImageIntoTextStrategy());
2725
- ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTETextBlock.name, new BlockInsertNodesBeforeNodeStrategy());
2726
3625
  ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTETextBlock.name, new BlockTransformToListStrategy());
2727
3626
  })();
2728
3627
 
3628
+ /**
3629
+ * The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
3630
+ */
3631
+ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
3632
+ /**
3633
+ * Returns the previous node relative to the current node in a rich text editor structure.
3634
+ *
3635
+ * @param {RTENode} currentNode - An object of type `RTENode`.
3636
+ * @returns {Nullable<RTENode>} the previous block last node
3637
+ */
3638
+ getPreviousNode(currentNode) {
3639
+ const currentBlock = currentNode.parent;
3640
+ const currentIndex = currentBlock.children.indexOf(currentNode);
3641
+ if (currentIndex > 0) {
3642
+ return currentBlock.children[currentIndex - 1];
3643
+ }
3644
+ else if (currentBlock.parent) {
3645
+ const previousBlock = this.getPreviousBlock(currentBlock);
3646
+ if (previousBlock) {
3647
+ return this.getBlockLastNode(previousBlock);
3648
+ }
3649
+ }
3650
+ }
3651
+ /**
3652
+ * Returns the next node relative to the current node in a rich text editor structure.
3653
+ *
3654
+ * @param {RTENode} currentNode - An object of type `RTENode`.
3655
+ * @returns {Nullable<RTENode>} the next block first node
3656
+ */
3657
+ getNextNode(currentNode) {
3658
+ const currentBlock = currentNode.parent;
3659
+ const currentIndex = currentBlock.children.indexOf(currentNode);
3660
+ if (currentBlock.children[currentIndex + 1]) {
3661
+ return currentBlock.children[currentIndex + 1];
3662
+ }
3663
+ else if (currentBlock.parent) {
3664
+ const nextBlock = this.getNextBlock(currentBlock);
3665
+ if (nextBlock) {
3666
+ return this.getBlockFirstNode(nextBlock);
3667
+ }
3668
+ }
3669
+ }
3670
+ /**
3671
+ * Determines if a given node is the first node within the current state.
3672
+ *
3673
+ * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
3674
+ * @returns {boolean} True or false;
3675
+ */
3676
+ isContentFirstNode(currentNode) {
3677
+ const currentBlock = currentNode.parent;
3678
+ const currentIndex = currentBlock.children.indexOf(currentNode);
3679
+ const parent = currentBlock.parent;
3680
+ if (currentBlock.isListItemBlock()) {
3681
+ const listParent = parent.parent;
3682
+ return (currentIndex === 0 &&
3683
+ Array.isArray(parent.children) &&
3684
+ parent.children[0] === currentBlock &&
3685
+ listParent['type'] !== 'list-item' &&
3686
+ Array.isArray(listParent.children) &&
3687
+ listParent.children[0] === parent);
3688
+ }
3689
+ else {
3690
+ return (currentIndex === 0 && Array.isArray(parent.children) && parent.children[0] === currentBlock);
3691
+ }
3692
+ }
3693
+ /**
3694
+ * TODO: The getPreviousBlock add nest list support
3695
+ * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
3696
+ *
3697
+ * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
3698
+ * @returns {Nullable<RTEBlock>} The previous block if existing
3699
+ */
3700
+ getPreviousBlock(currentBlock) {
3701
+ if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
3702
+ const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
3703
+ if (currentBlockIndex > 0) {
3704
+ return currentBlock.parent.children[currentBlockIndex - 1];
3705
+ }
3706
+ else if ((currentBlock.parent['type'] === 'number-list' ||
3707
+ currentBlock.parent['type'] === 'bullet-list') &&
3708
+ currentBlockIndex === 0) {
3709
+ return this.getPreviousBlock(currentBlock.parent);
3710
+ }
3711
+ }
3712
+ }
3713
+ /**
3714
+ * Returns the last node within a given RTE block, handling different block types accordingly.
3715
+ *
3716
+ * @param {RTEBlock} currentBlock - Returns the last node within that block.
3717
+ * @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
3718
+ */
3719
+ getBlockLastNode(currentBlock) {
3720
+ return currentBlock.getLastNode();
3721
+ }
3722
+ /**
3723
+ * Returns the first node within a given RTE block, handling different block types accordingly.
3724
+ *
3725
+ * @param {RTEBlock} currentBlock - Returns the first node within that block.
3726
+ * @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
3727
+ */
3728
+ getBlockFirstNode(currentBlock) {
3729
+ if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
3730
+ if (currentBlock.children) {
3731
+ const firstListItem = currentBlock.children[0];
3732
+ return this.getBlockFirstNode(firstListItem);
3733
+ }
3734
+ }
3735
+ else {
3736
+ if (currentBlock.children) {
3737
+ return currentBlock.children[0];
3738
+ }
3739
+ }
3740
+ }
3741
+ /**
3742
+ * This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
3743
+ *
3744
+ * @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
3745
+ * @returns {Nullable<RTEBlock>} The next block if existing
3746
+ */
3747
+ getNextBlock(currentBlock) {
3748
+ if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
3749
+ const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
3750
+ if (currentBlock.parent.children[currentBlockIndex + 1]) {
3751
+ return currentBlock.parent.children[currentBlockIndex + 1];
3752
+ }
3753
+ else if (currentBlock.type === 'list-item' &&
3754
+ currentBlock.parent.children.length === currentBlockIndex + 1) {
3755
+ return this.getNextBlock(currentBlock.parent);
3756
+ }
3757
+ }
3758
+ }
3759
+ }
3760
+
2729
3761
  /**
2730
3762
  * Remove the code block from the value, call this action if want to flush value after action.
2731
3763
  */
@@ -2743,7 +3775,7 @@ class CodeBlockRemoveSelfStrategy extends BlockDeleteNodeContentStrategy {
2743
3775
  focusNode = this.getNextNode(node);
2744
3776
  offset = 0;
2745
3777
  }
2746
- parent.apply(new RemoveChildAction(target));
3778
+ parent.apply(new RemoveChildrenAction(target));
2747
3779
  const focusElement = focusNode
2748
3780
  ? stateEntityRenderingRegistry.getDOMByEntity(focusNode)
2749
3781
  : null;
@@ -2753,7 +3785,7 @@ class CodeBlockRemoveSelfStrategy extends BlockDeleteNodeContentStrategy {
2753
3785
  type: 'paragraph',
2754
3786
  nodes: [{ id: generateUUID(), type: 'text', text: '' }],
2755
3787
  });
2756
- target.parent.apply(new AppendChildNodesAction([defaultParagraph]));
3788
+ target.parent.apply(new AppendChildrenAction([defaultParagraph]));
2757
3789
  focusNode = defaultParagraph.children[0];
2758
3790
  offset = 0;
2759
3791
  }
@@ -2828,7 +3860,7 @@ class SwitchOutFromCodeBlockStrategy extends ActionHandleStrategy {
2828
3860
  type: 'paragraph',
2829
3861
  nodes: [{ id: generateUUID(), text: '', type: 'text' }],
2830
3862
  });
2831
- target.parent.apply(new InsertBlocksAfterAction(target, textBlock));
3863
+ target.parent.apply(new InsertChildrenAfterAction(target, textBlock));
2832
3864
  // Focus the next text node after value update.
2833
3865
  const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(target);
2834
3866
  if (currentNodeDom) {
@@ -2885,10 +3917,66 @@ class CodeNodeSetSelectionRangeAnnotationStrategy extends ActionHandleStrategy {
2885
3917
  }
2886
3918
  }
2887
3919
 
3920
+ /**
3921
+ * Abstract class for decorator nodes. A decorator node modifies content like an image node that will delete the whole node when the delete button is pressed.
3922
+ */
3923
+ class RTEDecoratorNode extends RTENode {
3924
+ constructor() {
3925
+ super(...arguments);
3926
+ this.type = 'decorator-node';
3927
+ this.isSelected = false;
3928
+ }
3929
+ /**
3930
+ * Check the element is a decorator node container.
3931
+ *
3932
+ * @param {HTMLElement} element - The checked element.
3933
+ * @returns {boolean} - The result of the check.
3934
+ */
3935
+ static isDecoratorNodeContainerElement(element) {
3936
+ return element && element.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS);
3937
+ }
3938
+ /**
3939
+ * Get the decorator node element within the container.
3940
+ *
3941
+ * @param {HTMLElement} container - The container element.
3942
+ * @returns {Nullable<HTMLElement>} - The decorator node element, if found.
3943
+ */
3944
+ static getDecoratorNodeElement(container) {
3945
+ return container.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`);
3946
+ }
3947
+ /**
3948
+ * @inheritDoc
3949
+ */
3950
+ getRangeEndOffset() {
3951
+ return 1;
3952
+ }
3953
+ /**
3954
+ * @inheritDoc
3955
+ */
3956
+ getRangeContainer() {
3957
+ const element = stateEntityRenderingRegistry.getDOMByEntity(this);
3958
+ if (element) {
3959
+ return findParent(element, `.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`);
3960
+ }
3961
+ }
3962
+ /**
3963
+ * The decorator node is not content editable from the outside.
3964
+ *
3965
+ * @returns {boolean} - Always returns false for decorator nodes.
3966
+ */
3967
+ isContentEditable() {
3968
+ return false;
3969
+ }
3970
+ }
3971
+ // CSS class names for the decorator node parent element
3972
+ RTEDecoratorNode.DECORATOR_CONTAINER_CLASS = 'v-internal-decorator-container';
3973
+ // CSS class names for the decorator node element
3974
+ RTEDecoratorNode.DECORATOR_NODE_CLASS = 'v-internal-decorator-node';
3975
+
2888
3976
  /**
2889
3977
  * RTE code node DTO class.
2890
3978
  */
2891
- class RTECodeBlockNode extends RTENode {
3979
+ class RTECodeBlockNode extends RTEDecoratorNode {
2892
3980
  constructor(id, content, language, parentBlock) {
2893
3981
  super(id);
2894
3982
  this.type = NodeTypeEnum.CODE_BLOCK_NODE;
@@ -2906,6 +3994,12 @@ class RTECodeBlockNode extends RTENode {
2906
3994
  toJSON() {
2907
3995
  return { id: this.id, type: 'text', text: this.text, language: this.language };
2908
3996
  }
3997
+ /**
3998
+ * @inheritDoc
3999
+ */
4000
+ toHtml() {
4001
+ 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>`;
4002
+ }
2909
4003
  /**
2910
4004
  * @inheritDoc
2911
4005
  */
@@ -2942,7 +4036,43 @@ class CodeBlockInsertImageStrategy extends ActionHandleStrategy {
2942
4036
  */
2943
4037
  handleAction(action, target) {
2944
4038
  const imageBlock = action.imageBlockToBeInserted;
2945
- target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
4039
+ target.parent.apply(new InsertChildrenAfterAction(target, imageBlock));
4040
+ }
4041
+ }
4042
+
4043
+ var CodeLanguage;
4044
+ (function (CodeLanguage) {
4045
+ CodeLanguage["CSS"] = "css";
4046
+ CodeLanguage["HTML"] = "html";
4047
+ CodeLanguage["JavaScript"] = "js";
4048
+ CodeLanguage["JSX"] = "jsx";
4049
+ CodeLanguage["Plain Text"] = "plainText";
4050
+ CodeLanguage["TypeScript"] = "ts";
4051
+ CodeLanguage["TSX"] = "tsx";
4052
+ })(CodeLanguage || (CodeLanguage = {}));
4053
+
4054
+ /**
4055
+ * Remove the node from the text block or image block strategy.
4056
+ */
4057
+ class RemoveChildrenStrategy extends ActionHandleStrategy {
4058
+ /**
4059
+ * Remove the node or block from the parent.
4060
+ * Remove the block if the block children is empty after delete the current element.
4061
+ *
4062
+ * @param {RemoveChildrenAction} action - The remove child action instance.
4063
+ * @param {RTEBlock | VegaRTEContent} target - The parent block of the node that will be removed.
4064
+ */
4065
+ handleAction(action, target) {
4066
+ const arrayFixed = target.children;
4067
+ target.children = arrayFixed.filter((node) => node !== action.entityToBeRemoved);
4068
+ if (target.children.length === 0 && 'parent' in target && target.parent) {
4069
+ if (!target.isListItemBlock()) {
4070
+ target.parent.apply(new RemoveChildrenAction(target));
4071
+ }
4072
+ else if (!target.nestList || !target.nestList.length) {
4073
+ target.parent.apply(new RemoveChildrenAction(target));
4074
+ }
4075
+ }
2946
4076
  }
2947
4077
  }
2948
4078
 
@@ -2976,6 +4106,13 @@ class RTECodeBlock extends RTEBlock {
2976
4106
  language,
2977
4107
  };
2978
4108
  }
4109
+ /**
4110
+ * @inheritDoc
4111
+ */
4112
+ toHtml() {
4113
+ const { language = CodeLanguage['Plain Text'] } = this.children[0];
4114
+ return `<pre data-language="${language}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((node) => node.toHtml())}</pre>`;
4115
+ }
2979
4116
  /**
2980
4117
  * @inheritDoc
2981
4118
  */
@@ -3026,10 +4163,10 @@ class RTECodeBlock extends RTEBlock {
3026
4163
  }
3027
4164
  (() => {
3028
4165
  ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CODE_BLOCK, RTECodeBlock.name, new CodeBlockRemoveSelfStrategy());
3029
- ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTECodeBlock.name, new BlockRemoveNodeStrategy());
4166
+ ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILDREN, RTECodeBlock.name, new RemoveChildrenStrategy());
3030
4167
  ActionHandleStrategyRegistry.register(ModifyContentActionType.SWITCH_OUT_FROM_CODE_BLOCK, RTECodeBlock.name, new SwitchOutFromCodeBlockStrategy());
3031
4168
  ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTECodeBlock.name, new CodeBlockInsertImageStrategy());
3032
4169
  })();
3033
4170
  RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element';
3034
4171
 
3035
- export { IndentAnnotation as $, ActionHandleStrategy as A, BlockDeleteNodeContentStrategy as B, ImageAnnotation as C, SelectionChangeAction as D, TextColorAnnotation as E, RTE_TEXT_COLORS as F, RTECodeBlockNode as G, AnnotationAction as H, InsertBlocksAfterAction as I, BoldAnnotationAction as J, ItalicAnnotation as K, LinkAnnotationAction as L, ModifyContentAction as M, NodeAnnotationTypeEnum as N, UnderlineAnnotation as O, TextStyleAnnotationAction as P, TextStyleAnnotation as Q, RemoveChildAction as R, SplitBlockWithNodeAction as S, TextSplittableAction as T, UpdateCodeBlockAction as U, BoldAnnotation as V, BlockAnnotationTypeEnum as W, ClearFormattingAnnotationAction as X, CodeAnnotationAction as Y, ZERO_WIDTH_SPACE as Z, StrikethroughAnnotation as _, RTEImageNode as a, HorizontalAlignmentAnnotation as a0, UpdateTextAction as a1, MergeTwoBlocksNodesAction as a2, ReplaceChildNodesAction as b, AppendChildNodesAction as c, RTETextBlock as d, InsertBlocksBeforeAction as e, ModifyContentActionType as f, RTETextNode as g, BlockReplaceNodeWithNodesStrategy as h, RTEBlock as i, ActionHandleStrategyRegistry as j, BlockMergeNodesStrategy as k, BlockRemoveNodeStrategy as l, BlockAppendNodesStrategy as m, BlockReplaceNodesStrategy as n, BlockInsertNodesBeforeNodeStrategy as o, BlockDeleteTextContentStrategy as p, BlockInsertLineBreakStrategy as q, BlockInsertLineBreakWithBlocksStrategy as r, BlockSplitWithTextNodeStrategy as s, SyncUpSelectionAction as t, RTECodeBlock as u, RTENode as v, stateEntityRenderingRegistry as w, BlockAnnotation as x, NodeAnnotation as y, InternalAnnotationTypeEnum as z };
4172
+ export { UnderlineAnnotationAction as $, ActionHandleStrategy as A, BlockInsertLineBreakStrategy as B, CustomStyleAnnotation as C, BlockDeleteNodeContentStrategy as D, RemoveChildrenStrategy as E, RTE_TEXT_COLORS as F, RTE_DEFAULT_TEXT_COLOR as G, HorizontalAlignmentAnnotationAction as H, InsertChildrenAfterAction as I, RTENode as J, CodeLanguage as K, LinkAnnotationAction as L, ModifyContentActionType as M, NodeAnnotation as N, InternalAnnotationTypeEnum as O, CommonAnnotationTypeEnum as P, UpdateCodeBlockAction as Q, RTETextBlock as R, SyncUpSelectionAction as S, SelectionChangeAction as T, UpdateTextAction as U, TextSplittableAction as V, TextColorAnnotation as W, RTECodeBlockNode as X, BoldAnnotationAction as Y, ZERO_WIDTH_SPACE as Z, ItalicAnnotationAction as _, RTETextNode as a, TextStyleAnnotationAction as a0, TextStyleAnnotation as a1, BoldAnnotation as a2, ClearFormattingAnnotationAction as a3, CodeAnnotationAction as a4, StrikethroughAnnotationAction as a5, IndentAnnotationAction as a6, AppendChildrenAction as b, ActionHandleStrategyRegistry as c, BlockInsertLineBreakWithBlocksStrategy as d, BlockSplitWithTextNodeStrategy as e, BlockReplaceNodesStrategy as f, BlockMergeNodesStrategy as g, RemoveChildrenAction as h, InsertChildrenBeforeAction as i, BlockAnnotation as j, BlockAnnotationTypeEnum as k, RTEBlock as l, CustomClassAnnotation as m, CustomAttributeAnnotation as n, RTECodeBlock as o, NodeAnnotationTypeEnum as p, RTEDecoratorNode as q, NodeTypeEnum as r, stateEntityRenderingRegistry as s, CommonAnnotation as t, AnnotationAction as u, ReplaceChildNodesAction as v, ModifyContentAction as w, SplitBlockWithNodeAction as x, BlockUpdateHorizontalAlignmentStrategy as y, RTEDTOClassManager$1 as z };