@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
@@ -0,0 +1,3692 @@
1
+ 'use strict';
2
+
3
+ const codeBlock = require('./code-block-4bfae76d.js');
4
+ const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-e2e274e1.js');
5
+ const typeGuard = require('./type-guard-aa8fdeaf.js');
6
+ const changeManager = require('./change-manager-a297e4d2.js');
7
+ const domNodeSubjectFactory = require('./dom-node-subject-factory-bad99695.js');
8
+ const vegaInternalEventId = require('./vega-internal-event-id-ae6e2c13.js');
9
+ const string = require('./string-39438062.js');
10
+ const ui = require('./ui-4ce1fa08.js');
11
+ const object = require('./object-e2e28e3d.js');
12
+
13
+ /**
14
+ * Remove list item nest list block strategy.
15
+ */
16
+ class ListItemRemoveNestListStrategy extends codeBlock.ActionHandleStrategy {
17
+ /**
18
+ * Remove the nest list block from the list item, clear the property children when the children is empty.
19
+ *
20
+ * @param {RemoveNestListAction} action - The action instance.
21
+ * @param {RTEListItemBlock} target - The list item block.
22
+ */
23
+ handleAction(action, target) {
24
+ if (target.nestList) {
25
+ if (target.nestList.length > 1) {
26
+ target.nestList = target.nestList.filter((child) => child !== action.nestListBlockToBeRemoved);
27
+ }
28
+ else {
29
+ target.nestList = undefined;
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Replace list item nest list strategy.
37
+ */
38
+ class ListItemReplaceNestListStrategy extends codeBlock.ActionHandleStrategy {
39
+ /**
40
+ * @inheritDoc
41
+ */
42
+ handleAction(action, target) {
43
+ action.newList.forEach((listBlock) => {
44
+ listBlock.parent = target;
45
+ });
46
+ target.nestList = action.newList;
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Insert image node to list item block strategy.
52
+ */
53
+ class ListItemInsertImageStrategy extends codeBlock.ActionHandleStrategy {
54
+ /**
55
+ * The image node can not insert into list item block, so insert image after parent list block.
56
+ *
57
+ * @param {InsertImageToBlockAction} action - The action instance.
58
+ * @param {RTEListItemBlock} target - The list item block.
59
+ */
60
+ handleAction(action, target) {
61
+ target.parent.apply(action);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * List item block
67
+ */
68
+ class RTEListItemBlock extends codeBlock.RTETextBlock {
69
+ constructor(id, nestList, options) {
70
+ super(id, 'list-item', options);
71
+ /**
72
+ * TODO: Refactor the list item properties children and nestList, merge two properties together.
73
+ *
74
+ * 1. Update the type of `children` to include `RTEListBlock` as a possible type.
75
+ * 2. The list block children should text block array and nest list block array, The text block should wrap a `li` tag when rendering.
76
+ */
77
+ this.nestList = [];
78
+ this.nestList = nestList;
79
+ }
80
+ /**
81
+ * Converts a VegaRTEListItemBlock object to an RTEListItemBlock
82
+ *
83
+ * @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
84
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
85
+ * @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
86
+ */
87
+ static from(block, options = { autoMatchFormat: true }) {
88
+ const listItemBlock = new RTEListItemBlock(block.id, undefined, options);
89
+ listItemBlock.children = block.nodes.map((richText) => codeBlock.RTETextNode.from(richText, listItemBlock, options));
90
+ if (block.children) {
91
+ listItemBlock.nestList = block.children.map((child) => {
92
+ const listBlock = RTEListBlock.from(child);
93
+ listBlock.parent = listItemBlock;
94
+ return listBlock;
95
+ });
96
+ }
97
+ const { annotations } = block;
98
+ if (annotations) {
99
+ Object.entries(annotations).forEach(([type, value]) => {
100
+ const item = this.createAnnotationEntity(type, value);
101
+ if (typeGuard.isNonNullable(item)) {
102
+ listItemBlock.annotationMap.set(...item);
103
+ }
104
+ });
105
+ }
106
+ return listItemBlock;
107
+ }
108
+ /**
109
+ * @inheritDoc
110
+ */
111
+ toJSON() {
112
+ var _a;
113
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
114
+ }
115
+ /**
116
+ * @inheritDoc
117
+ */
118
+ toHtml() {
119
+ const attrStr = super.generateAttributeString();
120
+ return [
121
+ `<li${attrStr}>`,
122
+ this.children.map((node) => node.toHtml()).join(''),
123
+ `</li>`,
124
+ ].join('');
125
+ }
126
+ /**
127
+ * @inheritDoc
128
+ */
129
+ cloneWithNodes(nodes) {
130
+ const block = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
131
+ block.children = [];
132
+ block.apply(new codeBlock.AppendChildrenAction(nodes));
133
+ return block;
134
+ }
135
+ /**
136
+ * @inheritDoc
137
+ */
138
+ getLastNode() {
139
+ if (this.nestList && this.nestList.length > 0) {
140
+ const childListBlock = this.nestList[this.nestList.length - 1];
141
+ return childListBlock.getLastNode();
142
+ }
143
+ return super.getLastNode();
144
+ }
145
+ /**
146
+ * Create a new list item block.
147
+ *
148
+ * @returns {RTEListItemBlock} - A list item block.
149
+ */
150
+ createNewListItem() {
151
+ return new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
152
+ }
153
+ /**
154
+ * @inheritDoc
155
+ */
156
+ clone() {
157
+ var _a;
158
+ const block = new RTEListItemBlock(this.id);
159
+ block.children = this.children.map((node) => {
160
+ const clonedNode = node.clone();
161
+ clonedNode.parent = block;
162
+ return clonedNode;
163
+ });
164
+ block.annotationMap = super.cloneAnnotations();
165
+ block.nestList = (_a = this.nestList) === null || _a === void 0 ? void 0 : _a.map((child) => {
166
+ const clonedChild = child.clone();
167
+ clonedChild.parent = block;
168
+ return clonedChild;
169
+ });
170
+ block.parent = this.parent;
171
+ return block;
172
+ }
173
+ }
174
+ (() => {
175
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new codeBlock.BlockInsertLineBreakStrategy());
176
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new codeBlock.BlockInsertLineBreakWithBlocksStrategy());
177
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
178
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new codeBlock.BlockSplitWithTextNodeStrategy());
179
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new codeBlock.BlockReplaceNodesStrategy());
180
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
181
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new codeBlock.BlockMergeNodesStrategy());
182
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
183
+ })();
184
+
185
+ /**
186
+ * Convert the selected blocks to list strategy.
187
+ */
188
+ class ListTransformToListStrategy extends codeBlock.ActionHandleStrategy {
189
+ /**
190
+ * @inheritDoc
191
+ */
192
+ handleAction(action, target) {
193
+ const selectedBlocks = action.selectedBlocks;
194
+ const bulletList = target.parent.createList(action.listType);
195
+ const isSameList = selectedBlocks.every((block) => block.parent === target);
196
+ if (isSameList) {
197
+ // Select one or more list items belonging to the same list, and all items in this list should be updated
198
+ bulletList.apply(new codeBlock.AppendChildrenAction(target.children));
199
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, bulletList));
200
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
201
+ selectedBlocks.forEach((block) => block.children.map((node) => node.apply(new codeBlock.SyncUpSelectionAction())));
202
+ }
203
+ else {
204
+ const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
205
+ bulletList.apply(new codeBlock.AppendChildrenAction(listItems));
206
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, bulletList));
207
+ action.selectedBlocks.forEach((block) => {
208
+ block.parent.apply(new codeBlock.RemoveChildrenAction(block));
209
+ });
210
+ if (target.children.length === 0) {
211
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
212
+ }
213
+ }
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Convert the selected list block to paragraph strategy.
219
+ */
220
+ class ListTransformToParagraphStrategy extends codeBlock.ActionHandleStrategy {
221
+ /**
222
+ * @inheritDoc
223
+ */
224
+ handleAction(action, target) {
225
+ let isSelectedFirstBlock = false;
226
+ let isSelectedLastBlock = false;
227
+ const selectedBlocks = action.selectedBlocks;
228
+ const currentParagraph = selectedBlocks.map((block) => {
229
+ block.children.map((node) => node.apply(new codeBlock.SyncUpSelectionAction()));
230
+ if (block === target.children[0])
231
+ isSelectedFirstBlock = true;
232
+ if (block === target.children[target.children.length - 1])
233
+ isSelectedLastBlock = true;
234
+ return this.toParagraph(block);
235
+ });
236
+ if (isSelectedFirstBlock) {
237
+ target.parent.apply(new codeBlock.InsertChildrenBeforeAction(target, ...currentParagraph));
238
+ }
239
+ else if (isSelectedLastBlock) {
240
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, ...currentParagraph));
241
+ }
242
+ else {
243
+ const startIndex = target.children.indexOf(selectedBlocks[0]);
244
+ const lastIndex = target.children.indexOf(selectedBlocks[selectedBlocks.length - 1]);
245
+ const firstBulletList = target.parent.createList(target.type);
246
+ firstBulletList.apply(new codeBlock.AppendChildrenAction(target.children.slice(0, startIndex)));
247
+ const lastBulletList = target.parent.createList(target.type);
248
+ lastBulletList.apply(new codeBlock.AppendChildrenAction(target.children.slice(lastIndex + 1)));
249
+ target.parent.apply(new codeBlock.InsertChildrenBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
250
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
251
+ }
252
+ selectedBlocks.map((block) => {
253
+ target.apply(new codeBlock.RemoveChildrenAction(block));
254
+ });
255
+ if (target.children.length === 0) {
256
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
257
+ }
258
+ }
259
+ /**
260
+ * Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
261
+ *
262
+ * @param {RTEListItemBlock} block - The block that will be covered
263
+ * @returns {RTETextBlock} Returns a `RTETextBlock`.
264
+ */
265
+ toParagraph(block) {
266
+ const textBlock = new codeBlock.RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), 'paragraph');
267
+ textBlock.apply(new codeBlock.AppendChildrenAction(block['children']));
268
+ textBlock['annotationMap'] = block['annotationMap'];
269
+ return textBlock;
270
+ }
271
+ }
272
+
273
+ /**
274
+ * Insert image to list block strategy.
275
+ */
276
+ class ListInsertImageStrategy extends codeBlock.ActionHandleStrategy {
277
+ /**
278
+ * Insert image block at behind of the list item block.
279
+ *
280
+ * @param {InsertImageToBlockAction} action - The insert image action instance.
281
+ * @param {RTEListBlock} target - The list block.
282
+ */
283
+ handleAction(action, target) {
284
+ const imageBlock = action.imageBlockToBeInserted;
285
+ if (target.parent['type'] !== 'list-item') {
286
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, imageBlock));
287
+ }
288
+ else {
289
+ target.parent.apply(action);
290
+ }
291
+ }
292
+ }
293
+
294
+ /**
295
+ * List annotation
296
+ */
297
+ class ListAnnotation extends codeBlock.BlockAnnotation {
298
+ constructor() {
299
+ super(...arguments);
300
+ this.type = codeBlock.BlockAnnotationTypeEnum.LIST;
301
+ }
302
+ /**
303
+ * @inheritDoc
304
+ */
305
+ renderStyle(options) {
306
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
307
+ return null;
308
+ return {
309
+ paddingLeft: '8px',
310
+ marginLeft: '16px',
311
+ };
312
+ }
313
+ /**
314
+ * @inheritDoc
315
+ */
316
+ renderClass(options) {
317
+ if (options === null || options === void 0 ? void 0 : options.standalone)
318
+ return null;
319
+ return 'v-rte--list';
320
+ }
321
+ /**
322
+ * @inheritDoc
323
+ */
324
+ clone() {
325
+ return new ListAnnotation();
326
+ }
327
+ /**
328
+ * @inheritDoc
329
+ */
330
+ toJSON() {
331
+ return undefined;
332
+ }
333
+ }
334
+
335
+ /**
336
+ * List block
337
+ */
338
+ class RTEListBlock extends codeBlock.RTEBlock {
339
+ constructor(id, type, options) {
340
+ super(id);
341
+ this.type = 'bullet-list';
342
+ this.children = [];
343
+ this.type = type;
344
+ const { autoMatchFormat } = options || { autoMatchFormat: true };
345
+ if (autoMatchFormat) {
346
+ this.annotationMap.set(codeBlock.BlockAnnotationTypeEnum.LIST, new ListAnnotation());
347
+ }
348
+ }
349
+ /**
350
+ * Converts a VegaRTEListBlock object to an RTEListBlock
351
+ *
352
+ * @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
353
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
354
+ * @returns {RTEListBlock} Return an instance of `RTEListBlock`
355
+ */
356
+ static from(block, options = { autoMatchFormat: true }) {
357
+ const listBlock = new RTEListBlock(block.id, block.type, options);
358
+ const { annotations } = block;
359
+ if (annotations) {
360
+ Object.entries(annotations).forEach(([type, value]) => {
361
+ const item = this.createAnnotationEntity(type, value);
362
+ if (typeGuard.isNonNullable(item)) {
363
+ listBlock.annotationMap.set(...item);
364
+ }
365
+ });
366
+ }
367
+ listBlock.children = block.blocks.map((item) => {
368
+ const listItemBlock = RTEListItemBlock.from(item, options);
369
+ listItemBlock.parent = listBlock;
370
+ return listItemBlock;
371
+ });
372
+ return listBlock;
373
+ }
374
+ /**
375
+ * The function `createAnnotationEntity` creates a block annotation entity based on the provided type
376
+ * and value.
377
+ *
378
+ * @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
379
+ * the type of annotation entity to create.
380
+ * @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
381
+ * that will be used to create the annotation entity. It can be of any type depending on the specific
382
+ * annotation being created.
383
+ * @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
384
+ * `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
385
+ */
386
+ static createAnnotationEntity(type, value) {
387
+ switch (type) {
388
+ case 'customAttribute':
389
+ return codeBlock.CustomAttributeAnnotation.from(value);
390
+ case 'customClass':
391
+ return codeBlock.CustomClassAnnotation.from(value);
392
+ case 'customStyle':
393
+ return codeBlock.CustomStyleAnnotation.from(value);
394
+ }
395
+ }
396
+ /**
397
+ * @inheritDoc
398
+ */
399
+ toJSON() {
400
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.children.map((block) => block.toJSON()) });
401
+ }
402
+ /**
403
+ * @inheritDoc
404
+ */
405
+ toHtml() {
406
+ const BlockTag = this.getBlockTag();
407
+ const attrStr = super.generateAttributeString();
408
+ return [
409
+ `<${BlockTag}${attrStr}>`,
410
+ this.children.map((block) => block.toHtml()).join(''),
411
+ `</${BlockTag}>`,
412
+ ].join('');
413
+ }
414
+ /**
415
+ * @inheritDoc
416
+ */
417
+ isNotEmpty() {
418
+ return this.children.length > 0;
419
+ }
420
+ /**
421
+ * @inheritDoc
422
+ */
423
+ getLastNode() {
424
+ return this.children[this.children.length - 1].getLastNode();
425
+ }
426
+ /**
427
+ * @inheritDoc
428
+ */
429
+ clone() {
430
+ const clonedListBlock = new RTEListBlock(this.id, this.type);
431
+ clonedListBlock.children = this.children.map((item) => {
432
+ const clonedListItemBlock = item.clone();
433
+ clonedListItemBlock.parent = clonedListBlock;
434
+ return clonedListItemBlock;
435
+ });
436
+ clonedListBlock.annotationMap = super.cloneAnnotations();
437
+ clonedListBlock.parent = this.parent;
438
+ return clonedListBlock;
439
+ }
440
+ /**
441
+ * Returns the block tag based on the type of the list block.
442
+ *
443
+ * @returns {RTEListBlockTagType} - The block tag for the list block, either 'ol' or 'ul'.
444
+ */
445
+ getBlockTag() {
446
+ return this.type === 'number-list' ? 'ol' : 'ul';
447
+ }
448
+ }
449
+ (() => {
450
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
451
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
452
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
453
+ })();
454
+
455
+ /**
456
+ * Transform the selected text blocks to a code block strategy.
457
+ */
458
+ class BlockTransformToCodeBlockStrategy extends codeBlock.ActionHandleStrategy {
459
+ /**
460
+ * Get the all select text and create a new code block.
461
+ *
462
+ * @param {TransformToCodeBlockAction} action - The action instance.
463
+ * @param {VegaRTEContent} target - The block top parent instance.
464
+ */
465
+ handleAction(action, target) {
466
+ const selectedBlocks = action.selectedBlocks;
467
+ const codeBlock$1 = new codeBlock.RTECodeBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), this.getCodeContent(selectedBlocks), 'plainText');
468
+ target.apply(new codeBlock.InsertChildrenBeforeAction(selectedBlocks[0], codeBlock$1));
469
+ action.newCodeBlock = codeBlock$1;
470
+ this.removeSelectBlocks(selectedBlocks, target);
471
+ }
472
+ /**
473
+ * Get the selected text block text content.
474
+ *
475
+ * @param {RTEBlock[]} selectedBlocks - The selected blocks.
476
+ * @returns {string} - The selected text content.
477
+ */
478
+ getCodeContent(selectedBlocks) {
479
+ const selectedTextBlocks = selectedBlocks.filter((item) => item.type !== 'image' && item.type !== 'list-item');
480
+ return selectedTextBlocks
481
+ .map((block) => {
482
+ return block.children.map((node) => node.text).join('');
483
+ })
484
+ .join('\n');
485
+ }
486
+ /**
487
+ * Remove the selected blocks after append new code block.
488
+ *
489
+ * @param {RTEBlock[]} selectedBlocks - The selected blocks.
490
+ * @param {VegaRTEContent} target - The selected block top parent object.
491
+ */
492
+ removeSelectBlocks(selectedBlocks, target) {
493
+ for (let i = 0; i < selectedBlocks.length; i++) {
494
+ target.apply(new codeBlock.RemoveChildrenAction(selectedBlocks[i]));
495
+ }
496
+ }
497
+ }
498
+
499
+ /**
500
+ * Abstract class to define strategies for processing HTML elements
501
+ */
502
+ class ElementToDTOStrategy {
503
+ }
504
+ /**
505
+ * Class to represent the output of a strategy applied to HTML elements
506
+ */
507
+ class ElementToDTOStrategyOutput {
508
+ constructor(currentStrategy, currentElements) {
509
+ this.childrenOutput = [];
510
+ this.currentStrategy = currentStrategy;
511
+ this.currentElements = currentElements;
512
+ }
513
+ /**
514
+ * Set children output.
515
+ *
516
+ * @param {ElementToDTOStrategyOutput[]} childrenOutput - children outputs.
517
+ */
518
+ setChildrenOutput(childrenOutput) {
519
+ this.childrenOutput = childrenOutput;
520
+ }
521
+ /**
522
+ * Transform current output and children output to DTO
523
+ *
524
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
525
+ * @returns {Nullable<RTEContentBlock>} - DTO.
526
+ */
527
+ toDto(options = { autoMatchFormat: true, skipCustomAnnotations: true }) {
528
+ const currentBlock = this.currentStrategy.handle(this.currentElements, options);
529
+ if (this.childrenOutput.length > 0 && currentBlock) {
530
+ this.currentStrategy.appendChildBlocks(currentBlock, this.childrenOutput
531
+ .map((childOutput) => childOutput.toDto(options))
532
+ .filter(typeGuard.isNonNullable));
533
+ }
534
+ return currentBlock;
535
+ }
536
+ }
537
+
538
+ /**
539
+ * Manager for registering and retrieving strategies that convert HTML elements to DTOs.
540
+ */
541
+ class elementToDTOClassStrategyManager {
542
+ constructor() {
543
+ this.elementToBlockStrategies = [];
544
+ this.elementToNodeStrategies = [];
545
+ }
546
+ /**
547
+ * Registers a element to block strategy for converting HTML elements to DTOs. The new strategy is added to the beginning of the list to give it higher priority.
548
+ *
549
+ * @param {ElementToDTOStrategy} strategy - The strategy to register.
550
+ */
551
+ registerElementToBlockStrategy(strategy) {
552
+ if (!this.hasDuplicateStrategy(strategy, this.elementToBlockStrategies)) {
553
+ this.elementToBlockStrategies.unshift(strategy);
554
+ }
555
+ }
556
+ /**
557
+ * Registers an element to node strategy for converting HTML elements to DTOs. The new strategy is added to the beginning of the list to give it higher priority.
558
+ *
559
+ * @param {ElementToDTOStrategy} strategy - The strategy to register.
560
+ */
561
+ registerElementToNodeStrategy(strategy) {
562
+ if (!this.hasDuplicateStrategy(strategy, this.elementToNodeStrategies)) {
563
+ this.elementToNodeStrategies.unshift(strategy);
564
+ }
565
+ }
566
+ /**
567
+ * Retrieves all registered element to block strategies for converting HTML elements to DTOs.
568
+ *
569
+ * @returns {ElementToDTOStrategy[]} - A set of all registered element to block strategies.
570
+ */
571
+ getElementToBlockStrategies() {
572
+ return this.elementToBlockStrategies;
573
+ }
574
+ /**
575
+ * Retrieves all registered element to node strategies for converting HTML elements to DTOs.
576
+ *
577
+ * @returns {ElementToDTOStrategy[]} - A set of all registered element to node strategies.
578
+ */
579
+ getElementToNodeStrategies() {
580
+ return this.elementToNodeStrategies;
581
+ }
582
+ /**
583
+ * Checks if a strategy is already registered in the provided strategy list.
584
+ *
585
+ * @param {ElementToDTOStrategy} strategy - The strategy to check for duplicates.
586
+ * @param {ElementToDTOStrategy[]} strategyList - The list of strategies to check against.
587
+ * @returns {boolean} - True if the strategy is a duplicate, false otherwise.
588
+ */
589
+ hasDuplicateStrategy(strategy, strategyList) {
590
+ return strategyList.includes(strategy);
591
+ }
592
+ }
593
+ const ElementToDTOClassStrategyManager = new elementToDTOClassStrategyManager();
594
+
595
+ /** Element to DTO processor */
596
+ class ElementToDtoStrategyProcessor {
597
+ /**
598
+ * Transform process.
599
+ *
600
+ * @param {HTMLElement[]} elements - Current elements.
601
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
602
+ * @returns {ElementToDTOStrategyOutput[]} - outputs.
603
+ */
604
+ process(elements, options = { autoMatchFormat: true, skipCustomAnnotations: true }) {
605
+ const strategies = this.getElementToBlockStrategies();
606
+ const outputs = [];
607
+ for (let i = 0; i < elements.length; i++) {
608
+ if (this.isInvalidElement(elements[i]))
609
+ continue;
610
+ let canHandledCount = 0;
611
+ for (const strategy of strategies) {
612
+ canHandledCount = strategy.canHandle(elements, i, options);
613
+ if (canHandledCount > 0) {
614
+ const handledElements = elements.slice(i, i + canHandledCount);
615
+ const output = new ElementToDTOStrategyOutput(strategy, handledElements);
616
+ if (canHandledCount === 1 && strategy.shouldProceedToElementChildren()) {
617
+ output.setChildrenOutput(this.process(Array.from(handledElements[0].childNodes), options));
618
+ }
619
+ outputs.push(output);
620
+ i += canHandledCount - 1;
621
+ break;
622
+ }
623
+ }
624
+ if (canHandledCount === 0 && i < elements.length) {
625
+ const elementChildren = Array.from(elements[i].childNodes);
626
+ const childrenOutputs = this.process(Array.from(elementChildren), options);
627
+ if (childrenOutputs.length > 0) {
628
+ outputs.push(...childrenOutputs);
629
+ }
630
+ }
631
+ }
632
+ return outputs;
633
+ }
634
+ /**
635
+ * Checks if the given element is valid to parse.
636
+ *
637
+ * @param {HTMLElement} element - The pasted element.
638
+ * @returns {boolean} Is valid
639
+ */
640
+ isInvalidElement(element) {
641
+ if (element.nodeType === Node.COMMENT_NODE)
642
+ return true;
643
+ return ['META', 'STYLE'].includes(element.nodeName);
644
+ }
645
+ /**
646
+ * Get the register element to block strategies.
647
+ *
648
+ * @returns {ElementToDTOStrategy[]} - The register element to block strategies.
649
+ */
650
+ getElementToBlockStrategies() {
651
+ return ElementToDTOClassStrategyManager.getElementToBlockStrategies();
652
+ }
653
+ }
654
+ const ElementToDtoStrategyProcessor$1 = new ElementToDtoStrategyProcessor();
655
+
656
+ /**
657
+ * Update the cursor position in the editor.
658
+ */
659
+ class UpdateCursorPositionStrategy extends codeBlock.ActionHandleStrategy {
660
+ /**
661
+ * @inheritDoc
662
+ */
663
+ handleAction(action, target) {
664
+ const { offset, nextFocusNode } = action;
665
+ const host = codeBlock.stateEntityRenderingRegistry.getDOMByEntity(target);
666
+ if (host) {
667
+ changeManager.ChangeManager.notify(domNodeSubjectFactory.domNodeSubjectFactory.getSubject(host, vegaInternalEventId.VegaInternalUpdateRTECursorPosition), {
668
+ node: nextFocusNode,
669
+ offset,
670
+ });
671
+ }
672
+ }
673
+ }
674
+
675
+ /**
676
+ * Append new block array or node array to block or VegaRTEContent instance strategy.
677
+ */
678
+ class AppendChildrenStrategy extends codeBlock.ActionHandleStrategy {
679
+ /**
680
+ * @inheritDoc
681
+ */
682
+ handleAction(action, target) {
683
+ const newBlocks = action.entityToBeAppended;
684
+ if (target.children) {
685
+ newBlocks.forEach((block) => {
686
+ block.parent = target;
687
+ });
688
+ // This line is used to fix the typescript error `This expression is not callable`. https://github.com/microsoft/TypeScript/issues/44373
689
+ const arrayFixed = target.children;
690
+ target.children = arrayFixed.concat(newBlocks);
691
+ }
692
+ }
693
+ }
694
+
695
+ /**
696
+ * Insert children at the front of the block strategy.
697
+ */
698
+ class InsertChildrenBeforeStrategy extends codeBlock.ActionHandleStrategy {
699
+ /**
700
+ * @inheritDoc
701
+ */
702
+ handleAction(action, target) {
703
+ this.replaceElementWithElements(target, action.referChildren, [
704
+ ...action.childrenToBeInserted,
705
+ action.referChildren,
706
+ ]);
707
+ }
708
+ /**
709
+ * Replaces a specific block or node with an array of blocks or nodes within RTEContentBlock array.
710
+ *
711
+ * @param {RTEBlock | VegaRTEContent} target - The block or the VegaRTEContent instance.
712
+ * @param {RTEBlock | RTENode} referElement - Used as a reference element to identify the element that needs to be replaced in the array.
713
+ * @param {RTEBlock[] | RTENode[]} elements - An array of block or node objects that you want to replace the `referElement` with in the array.
714
+ */
715
+ replaceElementWithElements(target, referElement, elements) {
716
+ if (target.children) {
717
+ elements.forEach((block) => {
718
+ block.parent = target;
719
+ });
720
+ const arrayFixed = target.children;
721
+ target.children = arrayFixed.flatMap((block) => {
722
+ if (block === referElement) {
723
+ return elements;
724
+ }
725
+ else {
726
+ return block;
727
+ }
728
+ });
729
+ }
730
+ }
731
+ }
732
+
733
+ /**
734
+ * Insert children at the front of the block strategy.
735
+ */
736
+ class InsertChildrenAfterStrategy extends InsertChildrenBeforeStrategy {
737
+ /**
738
+ * @inheritDoc
739
+ */
740
+ handleAction(action, target) {
741
+ this.replaceElementWithElements(target, action.referChildren, [
742
+ action.referChildren,
743
+ ...action.childrenToBeInserted,
744
+ ]);
745
+ }
746
+ }
747
+
748
+ /**
749
+ * Annotation for image
750
+ */
751
+ class ImageAnnotation extends codeBlock.NodeAnnotation {
752
+ constructor(size, alt) {
753
+ super();
754
+ this.type = codeBlock.NodeAnnotationTypeEnum.IMAGE;
755
+ this.size = size;
756
+ this.alt = alt;
757
+ }
758
+ /**
759
+ * Generate the map item for the annotation
760
+ *
761
+ * @param {string} size - Image size
762
+ * @param {string} alt - Image alt
763
+ * @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
764
+ */
765
+ static from(size, alt) {
766
+ return [codeBlock.NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
767
+ }
768
+ /**
769
+ * Generate the JSON representation of the annotation
770
+ *
771
+ * @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
772
+ */
773
+ toJSON() {
774
+ return typeGuard.isNonNullable(this.alt)
775
+ ? {
776
+ size: this.size,
777
+ alt: this.alt,
778
+ }
779
+ : {
780
+ size: this.size,
781
+ };
782
+ }
783
+ /**
784
+ * @inheritDoc
785
+ */
786
+ clone() {
787
+ return new ImageAnnotation(this.size, this.alt);
788
+ }
789
+ /**
790
+ * @inheritDoc
791
+ */
792
+ renderClass(options) {
793
+ if (options === null || options === void 0 ? void 0 : options.standalone)
794
+ return null;
795
+ return this.size ? `v-rte--image-size-${this.size}` : null;
796
+ }
797
+ /**
798
+ * @inheritDoc
799
+ */
800
+ renderStyle(options) {
801
+ if (!(options === null || options === void 0 ? void 0 : options.standalone))
802
+ return null;
803
+ const baseStyle = { verticalAlign: 'bottom' };
804
+ switch (this.size) {
805
+ case 'sm': {
806
+ return Object.assign(Object.assign({}, baseStyle), { width: '25%' });
807
+ }
808
+ case 'md': {
809
+ return Object.assign(Object.assign({}, baseStyle), { width: '50%' });
810
+ }
811
+ case 'lg': {
812
+ return Object.assign(Object.assign({}, baseStyle), { width: '100%' });
813
+ }
814
+ }
815
+ }
816
+ }
817
+
818
+ /**
819
+ * Update the image node annotation map strategy.
820
+ */
821
+ class ImageSetAnnotationMapStrategy extends codeBlock.ActionHandleStrategy {
822
+ /**
823
+ * @inheritDoc
824
+ */
825
+ handleAction(action, target) {
826
+ const annotation = action.toAnnotation();
827
+ target.annotationMap.set(annotation.type, annotation);
828
+ }
829
+ }
830
+
831
+ /**
832
+ * The image node update property url strategy.
833
+ */
834
+ class ImageUpdateUrlStrategy extends codeBlock.ActionHandleStrategy {
835
+ /**
836
+ * @inheritDoc
837
+ */
838
+ handleAction(action, target) {
839
+ target.url = action.url;
840
+ }
841
+ }
842
+
843
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
844
+ var t = {};
845
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
846
+ t[p] = s[p];
847
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
848
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
849
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
850
+ t[p[i]] = s[p[i]];
851
+ }
852
+ return t;
853
+ };
854
+ /**
855
+ * Image node
856
+ */
857
+ class RTEImageNode extends codeBlock.RTEDecoratorNode {
858
+ constructor(id, url, parentBlock, annotationMap) {
859
+ super(id, annotationMap);
860
+ this.type = codeBlock.NodeTypeEnum.IMAGE;
861
+ this.url = url;
862
+ this.parent = parentBlock;
863
+ }
864
+ /**
865
+ * Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
866
+ *
867
+ * @param {VegaRTEImageNode} node - The node to be converted.
868
+ * @param {RTEImageBlock} parentBlock - The parent block
869
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
870
+ * @returns {RTEImageNode} An instance of `RTEImageBlock`
871
+ */
872
+ static from(node, parentBlock, options = { autoMatchFormat: true }) {
873
+ const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
874
+ const autoMatchFormat = !!options.autoMatchFormat;
875
+ const _a = Object.assign({}, node.annotations), { size } = _a, otherAnnotations = __rest(_a, ["size"]);
876
+ const annotations = Object.assign(Object.assign({}, otherAnnotations), { size: size !== null && size !== void 0 ? size : (autoMatchFormat ? 'md' : undefined) });
877
+ imageNode.annotationMap = new Map(Object.keys(annotations)
878
+ .map((type) => {
879
+ if (type === 'size' || type === 'alt') {
880
+ return ImageAnnotation.from(annotations.size, annotations.alt);
881
+ }
882
+ return this.createAnnotationEntity(type, annotations[type]);
883
+ })
884
+ .filter(typeGuard.isNonNullable));
885
+ return imageNode;
886
+ }
887
+ /**
888
+ * @inheritDoc
889
+ */
890
+ toJSON() {
891
+ const annotations = Array.from(this.annotationMap.values())
892
+ .filter((annotation) => annotation instanceof ImageAnnotation || annotation instanceof codeBlock.CommonAnnotation)
893
+ .reduce((record, annotation) => {
894
+ return Object.assign(Object.assign({}, record), annotation.toJSON());
895
+ }, {});
896
+ if (annotations.alt == '')
897
+ delete annotations.alt;
898
+ return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
899
+ }
900
+ /**
901
+ * @inheritDoc
902
+ */
903
+ clone() {
904
+ return new RTEImageNode(this.id, this.url, this.parent, super.cloneAnnotations());
905
+ }
906
+ /**
907
+ * @inheritDoc
908
+ */
909
+ toHtml() {
910
+ const imageAnnotation = this.getAnnotationByType(codeBlock.NodeAnnotationTypeEnum.IMAGE);
911
+ const attrStr = super.generateAttributeString(...[
912
+ imageAnnotation && imageAnnotation.alt ? `alt="${imageAnnotation.alt}"` : null,
913
+ `src="${this.url}"`,
914
+ imageAnnotation && imageAnnotation.size ? `data-size="${imageAnnotation.size}"` : null,
915
+ ].filter(typeGuard.isNonNullable));
916
+ return `<img${attrStr}>`;
917
+ }
918
+ /**
919
+ * @inheritDoc
920
+ */
921
+ doAnnotationActionApply(action) {
922
+ const strategy = codeBlock.ActionHandleStrategyRegistry.get(codeBlock.AnnotationAction.name, RTEImageNode.name);
923
+ if (strategy) {
924
+ strategy.execute(action, this);
925
+ }
926
+ }
927
+ /**
928
+ * @inheritDoc
929
+ */
930
+ doModifyActionApply(action) {
931
+ codeBlock.ActionHandleStrategyRegistry.executeTheStrategy(action, this);
932
+ }
933
+ }
934
+ (() => {
935
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.UPDATE_IMAGE_NODE_URL, RTEImageNode.name, new ImageUpdateUrlStrategy());
936
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.AnnotationAction.name, RTEImageNode.name, new ImageSetAnnotationMapStrategy());
937
+ })();
938
+
939
+ /**
940
+ * Split the current image block with a special position strategy.
941
+ */
942
+ class BlockSplitWithImageNodeStrategy extends codeBlock.ActionHandleStrategy {
943
+ /**
944
+ * @inheritDoc
945
+ */
946
+ handleAction(action, target) {
947
+ action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
948
+ }
949
+ /**
950
+ * The image offset should be 0 or 1
951
+ * <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
952
+ *
953
+ * @param {RTEImageNode} imageNode The split point image node.
954
+ * @param {number} imageOffset The cursor point 0 | 1.
955
+ * @param {RTEImageBlock} target The image block.
956
+ * @returns {Nullable<RTEBlock>} The new block after split
957
+ */
958
+ splitImageNodes(imageNode, imageOffset, target) {
959
+ const nodesSplitIndex = target.children.indexOf(imageNode);
960
+ if (nodesSplitIndex > -1) {
961
+ const beforeNodes = target.children.slice(0, nodesSplitIndex + imageOffset);
962
+ const afterNodes = target.children.slice(nodesSplitIndex + imageOffset);
963
+ target.apply(new codeBlock.ReplaceChildNodesAction(beforeNodes));
964
+ const newBlock = this.cloneWithNodes(afterNodes, target);
965
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newBlock));
966
+ return newBlock;
967
+ }
968
+ }
969
+ /**
970
+ * Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
971
+ *
972
+ * @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
973
+ * @param {RTEImageBlock} target The image block.
974
+ * @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
975
+ */
976
+ cloneWithNodes(nodes, target) {
977
+ const block = target.createNewImageBlock();
978
+ block.children = [];
979
+ block.apply(new codeBlock.AppendChildrenAction(nodes));
980
+ return block;
981
+ }
982
+ }
983
+
984
+ /**
985
+ * Break the current block after press enter, this action is similar with the SplitBlockWithNodeAction,
986
+ * The SplitBlockWithNodeAction split the current block to two same type blocks, but this action will create new paragraph or list item when break at start or end.
987
+ * The property `newBlock` use to store the new create block if need.
988
+ *
989
+ * @example currentBlock.apply(new InsertNewParagraphAction(startContainerNode, startOffset))
990
+ */
991
+ class InsertNewParagraphAction extends codeBlock.ModifyContentAction {
992
+ constructor(startContainerNode, startOffset) {
993
+ super();
994
+ this.type = codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH;
995
+ this.startContainerNode = startContainerNode;
996
+ this.startOffset = startOffset;
997
+ }
998
+ }
999
+
1000
+ /**
1001
+ * The image block insert line break strategy.
1002
+ */
1003
+ class ImageInsertLineBreakStrategy extends codeBlock.ActionHandleStrategy {
1004
+ /**
1005
+ * The image block not support insert the line break node, so invoke the insert new paragraph logic directly.
1006
+ *
1007
+ * @param {LineBreakSingleBlockAction} action - The action instance.
1008
+ * @param {RTEImageBlock} target - The image block.
1009
+ */
1010
+ handleAction(action, target) {
1011
+ const insertNewParagraphAction = new InsertNewParagraphAction(action.startContainerNode, action.startOffset);
1012
+ target.apply(insertNewParagraphAction);
1013
+ const newBlock = insertNewParagraphAction.newBlock;
1014
+ if (newBlock) {
1015
+ action.lineBreakNode = newBlock.children[0];
1016
+ }
1017
+ }
1018
+ }
1019
+
1020
+ /**
1021
+ * Insert a line break node into multiple blocks selection at special position strategy.
1022
+ */
1023
+ class ImageInsertLineBreakWithBlocksStrategy extends codeBlock.ActionHandleStrategy {
1024
+ /**
1025
+ * @inheritDoc
1026
+ */
1027
+ handleAction(action, target) {
1028
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
1029
+ }
1030
+ /**
1031
+ * Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
1032
+ *
1033
+ * @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
1034
+ * @param {RTEImageBlock} target - The image block.
1035
+ * @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
1036
+ */
1037
+ lineBreakMultipleBlocks(selectedBlocks, target) {
1038
+ const newParagraph = codeBlock.RTETextBlock.from({
1039
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
1040
+ type: 'paragraph',
1041
+ nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '\n' }],
1042
+ });
1043
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newParagraph));
1044
+ const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
1045
+ if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
1046
+ afterNodes.push(new codeBlock.RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', newParagraph));
1047
+ }
1048
+ newParagraph.apply(new codeBlock.AppendChildrenAction(afterNodes));
1049
+ return newParagraph['children'][0];
1050
+ }
1051
+ /**
1052
+ * Concat the child nodes of multiple RTEBlocks if both are not images.
1053
+ *
1054
+ * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
1055
+ * @returns {RTENode[]} Array of connected block nodes
1056
+ */
1057
+ concatBlocksNodes(blocks) {
1058
+ const nodes = [];
1059
+ blocks.map((block) => {
1060
+ if (block.type !== 'image') {
1061
+ nodes.push(...block.children);
1062
+ block.parent.apply(new codeBlock.RemoveChildrenAction(block));
1063
+ }
1064
+ });
1065
+ return nodes;
1066
+ }
1067
+ }
1068
+
1069
+ /**
1070
+ * Insert a image node at the special position of image block.
1071
+ */
1072
+ class ImageBlockInsertImageStrategy extends codeBlock.ActionHandleStrategy {
1073
+ /**
1074
+ * @inheritDoc
1075
+ */
1076
+ handleAction(action, target) {
1077
+ const splitNode = action.splitPointNode;
1078
+ const startOffsetOfNode = action.startOffsetOfNode;
1079
+ const newImageBlock = action.imageBlockToBeInserted;
1080
+ const newImageNodes = newImageBlock.children;
1081
+ if (target.children.length < 1) {
1082
+ target.apply(new codeBlock.AppendChildrenAction(newImageNodes));
1083
+ }
1084
+ else if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
1085
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newImageBlock));
1086
+ }
1087
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
1088
+ target.parent.apply(new codeBlock.InsertChildrenBeforeAction(target, newImageBlock));
1089
+ }
1090
+ else {
1091
+ target.apply(new codeBlock.SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
1092
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newImageBlock));
1093
+ }
1094
+ }
1095
+ }
1096
+
1097
+ /**
1098
+ * Image block
1099
+ */
1100
+ class RTEImageBlock extends codeBlock.RTEBlock {
1101
+ constructor(id) {
1102
+ super(id);
1103
+ this.type = 'image';
1104
+ this.children = [];
1105
+ }
1106
+ /**
1107
+ * Converts a VegaRTEImageBlock object into an RTEImageBlock object by mapping nodes and creating annotations.
1108
+ *
1109
+ * @param {VegaRTEImageBlock} block - The block object to be converted.
1110
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
1111
+ * @returns {RTEImageBlock} An instance of `RTEImageBlock`
1112
+ */
1113
+ static from(block, options = { autoMatchFormat: true }) {
1114
+ const imageBlock = new RTEImageBlock(block.id);
1115
+ const { annotations } = block;
1116
+ imageBlock.children = block.nodes.map((image) => RTEImageNode.from(image, imageBlock, options));
1117
+ if (annotations) {
1118
+ super.convertAnnotationsToMap(imageBlock.annotationMap, annotations);
1119
+ }
1120
+ return imageBlock;
1121
+ }
1122
+ /**
1123
+ * @inheritDoc
1124
+ */
1125
+ toJSON() {
1126
+ return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.children.map((node) => node.toJSON()) });
1127
+ }
1128
+ /**
1129
+ * @inheritDoc
1130
+ */
1131
+ toHtml() {
1132
+ const attrStr = super.generateAttributeString();
1133
+ const children = this.children.map((node) => node.toHtml()).join('');
1134
+ return super.shouldRenderAsInternalWrapper()
1135
+ ? children
1136
+ : [`<div${attrStr}>`, children, `</div>`].join('');
1137
+ }
1138
+ /**
1139
+ * @inheritDoc
1140
+ */
1141
+ isNotEmpty() {
1142
+ return this.children.length > 0 && this.children.some((node) => node.url.length > 0);
1143
+ }
1144
+ /**
1145
+ * @inheritDoc
1146
+ */
1147
+ getLastNode() {
1148
+ return this.children[this.children.length - 1];
1149
+ }
1150
+ /**
1151
+ * Create a new image block.
1152
+ *
1153
+ * @returns {RTEImageBlock} - The empty image block.
1154
+ */
1155
+ createNewImageBlock() {
1156
+ return new RTEImageBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
1157
+ }
1158
+ /**
1159
+ * @inheritDoc
1160
+ */
1161
+ clone() {
1162
+ const clonedBlock = new RTEImageBlock(this.id);
1163
+ clonedBlock.children = this.children.map((node) => {
1164
+ const clonedNode = node.clone();
1165
+ clonedNode.parent = clonedBlock;
1166
+ return clonedNode;
1167
+ });
1168
+ clonedBlock.annotationMap = super.cloneAnnotations();
1169
+ clonedBlock.parent = this.parent;
1170
+ return clonedBlock;
1171
+ }
1172
+ }
1173
+ (() => {
1174
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name, new codeBlock.BlockMergeNodesStrategy());
1175
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new codeBlock.BlockReplaceNodesStrategy());
1176
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
1177
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
1178
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
1179
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
1180
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.HorizontalAlignmentAnnotationAction.name, RTEImageBlock.name, new codeBlock.BlockUpdateHorizontalAlignmentStrategy());
1181
+ })();
1182
+
1183
+ /**
1184
+ * HTML Block
1185
+ */
1186
+ class RTEHtmlBlock extends codeBlock.RTEBlock {
1187
+ constructor(id, htmlTag) {
1188
+ super(id);
1189
+ this.type = 'html-block';
1190
+ this.children = [];
1191
+ this.htmlTag = htmlTag;
1192
+ }
1193
+ /**
1194
+ * Converts a VegaRTEHtmlBlock to an RTEHtmlBlock.
1195
+ *
1196
+ * @param {VegaRTEHtmlBlock} block - The VegaRTEHtmlBlock to convert.
1197
+ * @param {VegaRTETransformOptions} [options] - Optional transformation options.
1198
+ * @returns {RTEHtmlBlock} The converted RTEHtmlBlock.
1199
+ */
1200
+ static from(block, options) {
1201
+ const htmlBlock = new RTEHtmlBlock(block.id, block.htmlTag);
1202
+ const { annotations } = block;
1203
+ if (annotations) {
1204
+ super.convertAnnotationsToMap(htmlBlock.annotationMap, annotations);
1205
+ }
1206
+ htmlBlock.children = block.children
1207
+ .map((child) => {
1208
+ const BlockClass = codeBlock.RTEDTOClassManager.getRTEBlockClass(child.type);
1209
+ if (BlockClass) {
1210
+ const block = BlockClass.from(child, options);
1211
+ block.parent = htmlBlock;
1212
+ return block;
1213
+ }
1214
+ })
1215
+ .filter(typeGuard.isNonNullable);
1216
+ return htmlBlock;
1217
+ }
1218
+ /**
1219
+ * @inheritDoc
1220
+ */
1221
+ clone() {
1222
+ const clonedBlock = new RTEHtmlBlock(this.id, this.htmlTag);
1223
+ clonedBlock.children = this.children.map((child) => child.clone());
1224
+ clonedBlock.annotationMap = super.cloneAnnotations();
1225
+ return clonedBlock;
1226
+ }
1227
+ /**
1228
+ * @inheritDoc
1229
+ */
1230
+ getLastNode() {
1231
+ return this.children[this.children.length - 1].getLastNode();
1232
+ }
1233
+ /**
1234
+ * @inheritDoc
1235
+ */
1236
+ isNotEmpty() {
1237
+ return this.children.length > 0;
1238
+ }
1239
+ /**
1240
+ * @inheritDoc
1241
+ */
1242
+ toHtml() {
1243
+ const BlockTag = this.htmlTag;
1244
+ const attrStr = super.generateAttributeString();
1245
+ return [
1246
+ `<${BlockTag}${attrStr}>`,
1247
+ this.children.map((block) => block.toHtml()).join(''),
1248
+ `</${BlockTag}>`,
1249
+ ].join('');
1250
+ }
1251
+ /**
1252
+ * @inheritDoc
1253
+ */
1254
+ toJSON() {
1255
+ return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, htmlTag: this.htmlTag, children: this.children.map((child) => child.toJSON()) });
1256
+ }
1257
+ }
1258
+
1259
+ /**
1260
+ * Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
1261
+ *
1262
+ * @example firstBlock.apply(new MergeTwoBlocksNodesAction(secondBlock))
1263
+ */
1264
+ class MergeTwoBlocksNodesAction extends codeBlock.ModifyContentAction {
1265
+ constructor(blockNeedToBeMerged) {
1266
+ super();
1267
+ this.type = codeBlock.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES;
1268
+ this.blockNeedToBeMerged = blockNeedToBeMerged;
1269
+ }
1270
+ }
1271
+
1272
+ /**
1273
+ * Block delete text or decorator node strategy.
1274
+ */
1275
+ class BlockDeleteTextOrDecoratorNodeStrategy extends codeBlock.BlockDeleteNodeContentStrategy {
1276
+ /**
1277
+ * @inheritDoc
1278
+ */
1279
+ handleAction(action, target) {
1280
+ const { startContainerNode } = action;
1281
+ if (!startContainerNode.isContentEditable()) {
1282
+ this.deleteDecoratorNodeContent(action, target);
1283
+ }
1284
+ else if (startContainerNode.isTextNode()) {
1285
+ this.deleteTextNodeContent(action, target);
1286
+ }
1287
+ const parent = target.parent;
1288
+ if (parent && target.isListItemBlock() && parent.children.length === 0) {
1289
+ parent.parent.apply(new codeBlock.RemoveChildrenAction(parent));
1290
+ }
1291
+ }
1292
+ /**
1293
+ * Handle the delete text logic when press delete key.
1294
+ *
1295
+ * @param {DeleteBlockContentAction} action - ModifyContentAction
1296
+ * @param {RTETextBlock} target - Current text block
1297
+ */
1298
+ deleteTextNodeContent(action, target) {
1299
+ const startContainerNode = action.startContainerNode;
1300
+ const startOffset = action.startOffset;
1301
+ if (startOffset !== 0 && !startContainerNode.isEmpty()) {
1302
+ const newText = startContainerNode.text.slice(0, startOffset - 1) +
1303
+ startContainerNode.text.slice(startOffset);
1304
+ startContainerNode.apply(new codeBlock.UpdateTextAction(newText));
1305
+ if (newText) {
1306
+ action.previousNode = startContainerNode;
1307
+ return;
1308
+ }
1309
+ else {
1310
+ const previousNode = this.getPreviousNode(startContainerNode);
1311
+ // Remove the last character will not delete paragraph, the paragraph will removed after press delete again
1312
+ if ((previousNode && previousNode.parent === target && previousNode['text'] === '\n') ||
1313
+ target.children.length === 1) {
1314
+ action.previousNode = startContainerNode;
1315
+ return;
1316
+ }
1317
+ else {
1318
+ target.apply(new codeBlock.RemoveChildrenAction(startContainerNode));
1319
+ action.previousNode = previousNode;
1320
+ return;
1321
+ }
1322
+ }
1323
+ }
1324
+ else {
1325
+ let previousNode = this.getPreviousNode(startContainerNode);
1326
+ let nextNode = null;
1327
+ if (target.children.length && previousNode && previousNode.parent !== target) {
1328
+ if (startContainerNode.isEmpty()) {
1329
+ target.apply(new codeBlock.RemoveChildrenAction(startContainerNode));
1330
+ }
1331
+ if (target.type === previousNode.parent.type) {
1332
+ previousNode.parent.apply(new MergeTwoBlocksNodesAction(target));
1333
+ }
1334
+ }
1335
+ else {
1336
+ if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
1337
+ nextNode = this.getNextNode(startContainerNode);
1338
+ }
1339
+ /**
1340
+ * Remove line break
1341
+ *
1342
+ * @example caret at the first line
1343
+ * \n
1344
+ * test
1345
+ */
1346
+ if (startContainerNode.isEmpty()) {
1347
+ target.apply(new codeBlock.RemoveChildrenAction(startContainerNode));
1348
+ }
1349
+ /**
1350
+ * Remove line break
1351
+ *
1352
+ * @example caret at the begin of second line
1353
+ * \n
1354
+ * test
1355
+ */
1356
+ if (previousNode && previousNode.isTextNode() && previousNode.isEmpty()) {
1357
+ const shouldRemoveNode = previousNode;
1358
+ previousNode = this.getPreviousNode(previousNode);
1359
+ shouldRemoveNode.parent.apply(new codeBlock.RemoveChildrenAction(shouldRemoveNode));
1360
+ if (!previousNode) {
1361
+ nextNode = startContainerNode;
1362
+ }
1363
+ }
1364
+ }
1365
+ //Remove the paragraph block if the content is empty
1366
+ if (target.children.length === 0) {
1367
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
1368
+ }
1369
+ if (previousNode) {
1370
+ action.previousNode = previousNode;
1371
+ }
1372
+ else if (nextNode) {
1373
+ action.nextNode = nextNode;
1374
+ }
1375
+ }
1376
+ }
1377
+ /**
1378
+ * Delete decorator node content
1379
+ *
1380
+ * @param {DeleteBlockContentAction} action - The delete block content action
1381
+ * @param {RTEBlock} target - The target block
1382
+ */
1383
+ deleteDecoratorNodeContent(action, target) {
1384
+ const startContainerNode = action.startContainerNode, startOffset = action.startOffset;
1385
+ let previousNode = this.getPreviousNode(startContainerNode);
1386
+ let nextNode = null;
1387
+ if (startOffset !== 0) {
1388
+ const parentBlock = target;
1389
+ if (this.isContentFirstNode(startContainerNode)) {
1390
+ nextNode = this.getNextNode(startContainerNode);
1391
+ }
1392
+ if (parentBlock.children.length === 1) {
1393
+ parentBlock.parent.apply(new codeBlock.RemoveChildrenAction(parentBlock));
1394
+ }
1395
+ else {
1396
+ parentBlock.apply(new codeBlock.RemoveChildrenAction(startContainerNode));
1397
+ }
1398
+ }
1399
+ else {
1400
+ const shouldRemoveNode = previousNode;
1401
+ if (shouldRemoveNode && !shouldRemoveNode.isContentEditable()) {
1402
+ previousNode = this.getPreviousNode(shouldRemoveNode);
1403
+ shouldRemoveNode.parent.apply(new codeBlock.RemoveChildrenAction(shouldRemoveNode));
1404
+ if (!previousNode) {
1405
+ action.nextNode = startContainerNode;
1406
+ }
1407
+ }
1408
+ }
1409
+ if (previousNode) {
1410
+ action.previousNode = previousNode;
1411
+ }
1412
+ else if (nextNode) {
1413
+ action.nextNode = nextNode;
1414
+ }
1415
+ }
1416
+ }
1417
+
1418
+ /**
1419
+ * Insert new paragraph into current block at special position.
1420
+ */
1421
+ class BlockInsertNewParagraphStrategy extends codeBlock.ActionHandleStrategy {
1422
+ /**
1423
+ * @inheritDoc
1424
+ */
1425
+ handleAction(action, target) {
1426
+ const { startContainerNode } = action;
1427
+ action.newBlock = this.breakSingleBlock(startContainerNode, action.startOffset, target);
1428
+ }
1429
+ /**
1430
+ * breakSingleTextBlock
1431
+ *
1432
+ * @param {RTETextNode} splitNode -
1433
+ * @param {number} startOffsetOfNode -
1434
+ * @param {RTEBlock} target -
1435
+ * @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
1436
+ */
1437
+ breakSingleBlock(splitNode, startOffsetOfNode, target) {
1438
+ const newParagraph = this.getNewParagraph(splitNode);
1439
+ if (newParagraph) {
1440
+ if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
1441
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newParagraph));
1442
+ }
1443
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
1444
+ target.parent.apply(new codeBlock.InsertChildrenBeforeAction(target, newParagraph));
1445
+ }
1446
+ else {
1447
+ const splitBlockAction = new codeBlock.SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1448
+ target.apply(splitBlockAction);
1449
+ return splitBlockAction.newBlock;
1450
+ }
1451
+ return newParagraph;
1452
+ }
1453
+ }
1454
+ /**
1455
+ * Create new Paragraph
1456
+ *
1457
+ * @param {RTENode} splitNode - The split node of the block.
1458
+ * @returns {Nullable<RTETextBlock>} - The new text block.
1459
+ */
1460
+ getNewParagraph(splitNode) {
1461
+ const newParagraph = this.createNewParagraph('');
1462
+ if (newParagraph) {
1463
+ let textNode = newParagraph.children[0];
1464
+ if (splitNode.isTextNode() && splitNode.isContentEditable()) {
1465
+ newParagraph.children = [];
1466
+ textNode = splitNode.cloneWithText('');
1467
+ // The link annotation don't need inherited
1468
+ textNode.annotationMap.delete(codeBlock.NodeAnnotationTypeEnum.LINK);
1469
+ newParagraph.apply(new codeBlock.AppendChildrenAction([textNode]));
1470
+ }
1471
+ return newParagraph;
1472
+ }
1473
+ }
1474
+ }
1475
+
1476
+ /**
1477
+ * Update the cursor position in the editor.
1478
+ *
1479
+ * @example richEditorRef.value.apply(new UpdateCursorPositionAction(nextFocusNode, [offset]))
1480
+ */
1481
+ class UpdateCursorPositionAction extends codeBlock.ModifyContentAction {
1482
+ /**
1483
+ * Set the cursor position at end of the current node.
1484
+ *
1485
+ * @param {RTENode} nextFocusNode - The rich text editor needs focus node.
1486
+ * @param {number} offset - The cursor offset position.
1487
+ */
1488
+ constructor(nextFocusNode, offset) {
1489
+ super();
1490
+ this.type = codeBlock.ModifyContentActionType.UPDATE_CURSOR_POSITION;
1491
+ this.nextFocusNode = nextFocusNode;
1492
+ this.offset = offset;
1493
+ }
1494
+ }
1495
+
1496
+ /**
1497
+ * Strategy for inserting text into a decorator node. The decorator can not edit, so we insert the text as a new child.
1498
+ */
1499
+ class InsertTextToDecoratorNodeStrategy extends codeBlock.ActionHandleStrategy {
1500
+ /**
1501
+ * @inheritDoc
1502
+ */
1503
+ handleAction(action, target) {
1504
+ const { text, offset, decoratorNode } = action;
1505
+ const paragraph = this.createNewParagraph(text);
1506
+ if (paragraph) {
1507
+ const newTextNode = paragraph.children[0];
1508
+ if (offset !== 0) {
1509
+ target.apply(new codeBlock.InsertChildrenAfterAction(decoratorNode, newTextNode));
1510
+ }
1511
+ else {
1512
+ target.apply(new codeBlock.InsertChildrenBeforeAction(decoratorNode, newTextNode));
1513
+ }
1514
+ this.setTheCursorPosition(newTextNode);
1515
+ }
1516
+ }
1517
+ /**
1518
+ * Set the cursor position to the new text node.
1519
+ *
1520
+ * @param {RTENode} focusNode - The new text node to focus on.
1521
+ */
1522
+ setTheCursorPosition(focusNode) {
1523
+ const rootContent = this.getRootContent(focusNode.parent);
1524
+ if (rootContent) {
1525
+ rootContent.apply(new UpdateCursorPositionAction(focusNode));
1526
+ }
1527
+ }
1528
+ }
1529
+
1530
+ /**
1531
+ * Insert new paragraph into current list item block at special position.
1532
+ */
1533
+ class ListItemInsertNewParagraphStrategy extends codeBlock.ActionHandleStrategy {
1534
+ /**
1535
+ * @inheritDoc
1536
+ */
1537
+ handleAction(action, target) {
1538
+ action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset, target);
1539
+ }
1540
+ /**
1541
+ * Breaks a single list item block at a specific position.
1542
+ *
1543
+ * @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
1544
+ * @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
1545
+ * @param {RTEListItemBlock} target - The list item block.
1546
+ * @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
1547
+ * position is at the end of the `splitNode`, or it returns the result of splitting the block at the
1548
+ * caret position if it is neither at the start nor at the end.
1549
+ */
1550
+ breakSingleListItemBlock(splitNode, startOffsetOfNode, target) {
1551
+ const newListItem = target.createNewListItem();
1552
+ const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
1553
+ newListItem.apply(new codeBlock.AppendChildrenAction([newBreakNode]));
1554
+ if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
1555
+ return this.breakListItemAtEnd(newListItem, target);
1556
+ }
1557
+ else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
1558
+ target.parent.apply(new codeBlock.InsertChildrenBeforeAction(target, newListItem));
1559
+ }
1560
+ else {
1561
+ const splitBlockAction = new codeBlock.SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
1562
+ target.apply(splitBlockAction);
1563
+ return splitBlockAction.newBlock;
1564
+ }
1565
+ return newListItem;
1566
+ }
1567
+ /**
1568
+ * Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
1569
+ *
1570
+ * @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
1571
+ * @param {RTEListItemBlock} target - The list item block.
1572
+ * @returns {RTEBlock} Returns a `RTEBlock`.
1573
+ */
1574
+ breakListItemAtEnd(newListItem, target) {
1575
+ const lastItem = target.parent.children[target.parent.children.length - 1];
1576
+ const currentItemIsEmpty = target.children.length === 1 && target.children[0].isEmpty();
1577
+ if (target === lastItem && currentItemIsEmpty) {
1578
+ const parentParent = target.parent.parent;
1579
+ if (parentParent['type'] !== 'list-item') {
1580
+ const newParagraph = codeBlock.RTETextBlock.from({
1581
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
1582
+ type: 'paragraph',
1583
+ nodes: [],
1584
+ });
1585
+ newParagraph.apply(new codeBlock.AppendChildrenAction(newListItem.children));
1586
+ parentParent.apply(new codeBlock.InsertChildrenAfterAction(target.parent, newParagraph));
1587
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
1588
+ return newParagraph;
1589
+ }
1590
+ else {
1591
+ parentParent.parent.apply(new codeBlock.InsertChildrenAfterAction(parentParent, newListItem));
1592
+ target.parent.apply(new codeBlock.RemoveChildrenAction(target));
1593
+ }
1594
+ }
1595
+ else {
1596
+ target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newListItem));
1597
+ }
1598
+ return newListItem;
1599
+ }
1600
+ /**
1601
+ * Copy the inline style to new node
1602
+ *
1603
+ * @param {RTETextNode} needCopedNode - The node that needed to be copied to
1604
+ * @returns {RTETextNode} Returns a `RTETextNode`.
1605
+ */
1606
+ copyInlineStyleToNewNode(needCopedNode) {
1607
+ const textNode = needCopedNode.cloneWithText('');
1608
+ // The link annotation doesn't need to inherit
1609
+ textNode.annotationMap.delete(codeBlock.NodeAnnotationTypeEnum.LINK);
1610
+ return textNode;
1611
+ }
1612
+ }
1613
+
1614
+ /**
1615
+ * Delete the nest list block action
1616
+ *
1617
+ * @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
1618
+ */
1619
+ class RemoveNestListAction extends codeBlock.ModifyContentAction {
1620
+ constructor(childList) {
1621
+ super();
1622
+ this.type = codeBlock.ModifyContentActionType.DELETE_NEST_LIST;
1623
+ this.nestListBlockToBeRemoved = childList;
1624
+ }
1625
+ }
1626
+
1627
+ /**
1628
+ * List remove list item strategy.
1629
+ */
1630
+ class ListRemoveListItemStrategy extends codeBlock.RemoveChildrenStrategy {
1631
+ /**
1632
+ * Remove the list item, check the list item and remove self if the list item is empty.
1633
+ *
1634
+ * @param {RemoveChildrenAction} action - The remove action instance.
1635
+ * @param {RTEListBlock} target - The list block.
1636
+ */
1637
+ handleAction(action, target) {
1638
+ super.handleAction(action, target);
1639
+ const parent = target.parent;
1640
+ if (target.children.length === 0 && parent) {
1641
+ // The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
1642
+ if (parent['type'] === 'list-item') {
1643
+ parent.apply(new RemoveNestListAction(target));
1644
+ }
1645
+ else {
1646
+ parent.apply(new codeBlock.RemoveChildrenAction(target));
1647
+ }
1648
+ }
1649
+ }
1650
+ }
1651
+
1652
+ /**
1653
+ * Manager class for registering DTO action strategies.
1654
+ */
1655
+ class RTEDTOActionStrategyManager {
1656
+ /**
1657
+ * Registers basic strategies for a given DTO class.
1658
+ *
1659
+ * @param {string} dtoClassName - The name of the RTE block class name.
1660
+ */
1661
+ registerBlockBasicStrategies(dtoClassName) {
1662
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_CHILDREN, dtoClassName, dtoClassName === RTEListBlock.name
1663
+ ? new ListRemoveListItemStrategy()
1664
+ : new codeBlock.RemoveChildrenStrategy());
1665
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.APPEND_CHILDREN, dtoClassName, new AppendChildrenStrategy());
1666
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_CHILDREN_BEFORE, dtoClassName, new InsertChildrenBeforeStrategy());
1667
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_CHILDREN_AFTER, dtoClassName, new InsertChildrenAfterStrategy());
1668
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_BLOCK_CONTENT, dtoClassName, new BlockDeleteTextOrDecoratorNodeStrategy());
1669
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH, dtoClassName, dtoClassName === RTEListItemBlock.name
1670
+ ? new ListItemInsertNewParagraphStrategy()
1671
+ : new BlockInsertNewParagraphStrategy());
1672
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_TEXT_TO_DECORATOR_NODE, dtoClassName, new InsertTextToDecoratorNodeStrategy());
1673
+ }
1674
+ }
1675
+ const RTEDTOActionStrategyManager$1 = new RTEDTOActionStrategyManager();
1676
+
1677
+ /**
1678
+ * Abstract class to define handler for generate the annotations
1679
+ */
1680
+ class AnnotationGeneratorStrategyAbstract {
1681
+ }
1682
+
1683
+ /** Handle bold annotation */
1684
+ class BoldAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1685
+ /**
1686
+ * @inheritDoc
1687
+ */
1688
+ canHandle(targetDto) {
1689
+ return targetDto.name === 'RTETextNode';
1690
+ }
1691
+ /**
1692
+ * Handle annotation.
1693
+ *
1694
+ * @param {HTMLElement} element - Current elements.
1695
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
1696
+ * @returns {VegaRTETextAnnotations} - Annotation.
1697
+ */
1698
+ handle(element, parentAnnotations = {}) {
1699
+ return this.isBold(element) || parentAnnotations.bold ? { bold: true } : {};
1700
+ }
1701
+ /**
1702
+ * Is bold element.
1703
+ *
1704
+ * @param {HTMLElement} element - current element.
1705
+ * @returns {boolean} - boolean.
1706
+ */
1707
+ isBold(element) {
1708
+ return (element.nodeName === 'STRONG' ||
1709
+ element.nodeName === 'B' ||
1710
+ element.style.fontWeight === 'bold' ||
1711
+ element.style.fontWeight === '700' ||
1712
+ element.classList.contains('v-rte--bold'));
1713
+ }
1714
+ }
1715
+
1716
+ /** Handle custom attribute annotation */
1717
+ class CustomAttributeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1718
+ /**
1719
+ * Can be handle.
1720
+ *
1721
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1722
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options for annotation generator.
1723
+ * @returns {boolean} - .
1724
+ */
1725
+ canHandle(targetDto, options) {
1726
+ return !options.skipCustomAnnotations && !!targetDto;
1727
+ }
1728
+ /**
1729
+ * Handle annotation.
1730
+ *
1731
+ * @param {HTMLElement} element - Current elements.
1732
+ * @returns {VegaRTETextAnnotations} - Annotation.
1733
+ */
1734
+ handle(element) {
1735
+ const attributes = this.getAttributes(element);
1736
+ return Object.keys(attributes).length > 0 ? { customAttribute: attributes } : {};
1737
+ }
1738
+ /**
1739
+ * Obtain the custom attributes of element, excluding 'style' and 'class'.
1740
+ *
1741
+ * @param {HTMLElement} element - current element.
1742
+ * @returns {Record<string, string>} - Record<string, string>.
1743
+ */
1744
+ getAttributes(element) {
1745
+ const attributeNames = element
1746
+ .getAttributeNames()
1747
+ .filter((attr) => attr !== 'style' && attr !== 'class' && this.isValidAttr(attr));
1748
+ return attributeNames.reduce((acc, item) => {
1749
+ acc[item] = element.getAttribute(item);
1750
+ return acc;
1751
+ }, {});
1752
+ }
1753
+ /**
1754
+ * Check if the attribute name is valid.
1755
+ *
1756
+ * @param {string} attr - Attribute name.
1757
+ * @returns {boolean} - True if valid, false otherwise.
1758
+ */
1759
+ isValidAttr(attr) {
1760
+ return /^[a-zA-Z_][\w-]*$/.test(attr);
1761
+ }
1762
+ }
1763
+
1764
+ /** Handle custom class annotation */
1765
+ class CustomClassAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1766
+ /**
1767
+ * Can be handle.
1768
+ *
1769
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1770
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options for annotation generator.
1771
+ * @returns {boolean} - .
1772
+ */
1773
+ canHandle(targetDto, options) {
1774
+ return !options.skipCustomAnnotations && !!targetDto;
1775
+ }
1776
+ /**
1777
+ * Handle annotation.
1778
+ *
1779
+ * @param {HTMLElement} element - Current elements.
1780
+ * @returns {VegaRTETextAnnotations} - Annotation.
1781
+ */
1782
+ handle(element) {
1783
+ const classes = this.getCustomClass(element);
1784
+ return classes.length > 0 ? { customClass: classes } : {};
1785
+ }
1786
+ /**
1787
+ * Get the custom class
1788
+ *
1789
+ * @param {HTMLElement} element - current element.
1790
+ * @returns {string[]} - the class after .
1791
+ */
1792
+ getCustomClass(element) {
1793
+ return element.classList
1794
+ .toString()
1795
+ .split(' ')
1796
+ .filter((item) => !item.includes('v-rte') && item !== '');
1797
+ }
1798
+ }
1799
+
1800
+ /** Handle custom style annotation */
1801
+ class CustomStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1802
+ /**
1803
+ * Can be handle.
1804
+ *
1805
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1806
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options for annotation generator.
1807
+ * @returns {boolean} - .
1808
+ */
1809
+ canHandle(targetDto, options) {
1810
+ return !options.skipCustomAnnotations && !!targetDto;
1811
+ }
1812
+ /**
1813
+ * Handle annotation.
1814
+ *
1815
+ * @param {HTMLElement} element - Current elements.
1816
+ * @returns {VegaRTETextAnnotations} - Annotation.
1817
+ */
1818
+ handle(element) {
1819
+ const styles = this.generateCustomStyleAnnotations(element);
1820
+ return Object.keys(styles).length > 0 ? { customStyle: styles } : {};
1821
+ }
1822
+ /**
1823
+ * Obtain and format the style of element.
1824
+ *
1825
+ * @param {HTMLElement} element - current element.
1826
+ * @returns {AnnotationStyle} - Record<string, string>.
1827
+ */
1828
+ generateCustomStyleAnnotations(element) {
1829
+ const customStyle = element.getAttribute('style');
1830
+ if (!customStyle)
1831
+ return {};
1832
+ const styleValue = customStyle.split(';').filter(Boolean);
1833
+ return styleValue
1834
+ .filter((key) => key !== ' ')
1835
+ .map((key) => {
1836
+ // to remove redundant quote pairs if needed, for example: ['fontFamily: "Roboto Mono"'] will be updated to ['fontFamily: Roboto Mono']
1837
+ const styleObject = key.replace(/(['"])(.*?)\1/g, '$2').split(':');
1838
+ const styleKey = string.dashCaseToCamel(styleObject[0].trim());
1839
+ return {
1840
+ [styleKey]: styleObject[1].trim().replace(';', ''),
1841
+ };
1842
+ })
1843
+ .reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
1844
+ }
1845
+ }
1846
+
1847
+ /** Handle indent annotation */
1848
+ class IndentAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1849
+ /**
1850
+ * @inheritDoc
1851
+ */
1852
+ canHandle(targetDto) {
1853
+ return ['RTETextBlock', 'RTEListItemBlock', 'RTEListBlock'].includes(targetDto.name);
1854
+ }
1855
+ /**
1856
+ * Handle annotation.
1857
+ *
1858
+ * @param {HTMLElement} element - Current elements.
1859
+ * @returns {VegaRTEBlockAnnotations} - Annotation.
1860
+ */
1861
+ handle(element) {
1862
+ const indent = this.getIndent(element);
1863
+ return indent ? { indent: indent } : {};
1864
+ }
1865
+ /**
1866
+ * Get indent of current element.
1867
+ *
1868
+ * @param {HTMLElement} element - current element.
1869
+ * @returns {Nullable<number>} - Indent.
1870
+ */
1871
+ getIndent(element) {
1872
+ const style = element.style;
1873
+ let marginLeft;
1874
+ if (style.marginLeft) {
1875
+ marginLeft = style.marginLeft;
1876
+ }
1877
+ else if (style.margin) {
1878
+ const margins = style.margin.split(' ');
1879
+ switch (margins.length) {
1880
+ case 4:
1881
+ marginLeft = margins[3];
1882
+ break;
1883
+ case 2:
1884
+ case 3:
1885
+ marginLeft = margins[1];
1886
+ break;
1887
+ default:
1888
+ marginLeft = margins[0];
1889
+ break;
1890
+ }
1891
+ }
1892
+ else {
1893
+ return null;
1894
+ }
1895
+ const marginLeftNumber = Number(marginLeft.replace('px', ''));
1896
+ return marginLeftNumber && marginLeftNumber >= 0 ? Math.floor(marginLeftNumber / 16) : null;
1897
+ }
1898
+ }
1899
+
1900
+ /** Handle text align annotation */
1901
+ class TextAlignAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1902
+ /**
1903
+ * Can be handle.
1904
+ *
1905
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
1906
+ * @returns {boolean} - .
1907
+ */
1908
+ canHandle(targetDto) {
1909
+ return ['RTETextBlock', 'RTEListItemBlock', 'RTEListBlock'].includes(targetDto.name);
1910
+ }
1911
+ /**
1912
+ * Handle annotation.
1913
+ *
1914
+ * @param {HTMLElement} element - Current elements.
1915
+ * @returns {VegaRTEBlockAnnotations} - Annotation.
1916
+ */
1917
+ handle(element) {
1918
+ const textAlign = this.getTextAlign(element);
1919
+ return textAlign ? { textAlign: textAlign } : {};
1920
+ }
1921
+ /**
1922
+ * Get text align of current element.
1923
+ *
1924
+ * @param {HTMLElement} element - current element.
1925
+ * @returns {Nullable<VegaRTEBlockAlignment>} - Text align.
1926
+ */
1927
+ getTextAlign(element) {
1928
+ const classList = element.classList;
1929
+ if (classList.contains(`v-rte--horizontal-alignment-left`)) {
1930
+ return 'left';
1931
+ }
1932
+ else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
1933
+ return 'center';
1934
+ }
1935
+ else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
1936
+ return 'right';
1937
+ }
1938
+ else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
1939
+ return 'justify';
1940
+ }
1941
+ const style = element.style;
1942
+ switch (style.textAlign) {
1943
+ case 'center':
1944
+ return 'center';
1945
+ case 'right':
1946
+ return 'right';
1947
+ case 'justify':
1948
+ return 'justify';
1949
+ case 'left':
1950
+ return 'left';
1951
+ default:
1952
+ return null;
1953
+ }
1954
+ }
1955
+ }
1956
+
1957
+ /** Handle code annotation */
1958
+ class CodeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1959
+ /**
1960
+ * @inheritDoc
1961
+ */
1962
+ canHandle(targetDto) {
1963
+ return targetDto.name === 'RTETextNode';
1964
+ }
1965
+ /**
1966
+ * Handle annotation.
1967
+ *
1968
+ * @param {HTMLElement} element - Current elements.
1969
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
1970
+ * @returns {VegaRTETextAnnotations} - Annotation.
1971
+ */
1972
+ handle(element, parentAnnotations = {}) {
1973
+ return this.isCode(element) || parentAnnotations.code ? { code: true } : {};
1974
+ }
1975
+ /**
1976
+ * Is code element.
1977
+ *
1978
+ * @param {HTMLElement} element - current element.
1979
+ * @returns {boolean} - boolean.
1980
+ */
1981
+ isCode(element) {
1982
+ return (element.classList.contains('v-rte--code') ||
1983
+ element.nodeName === 'CODE' ||
1984
+ element.nodeName === 'PRE' ||
1985
+ element.style.fontFamily === 'monospace' ||
1986
+ element.style.fontFamily.replace(/["']/g, '') === 'Roboto Mono');
1987
+ }
1988
+ }
1989
+
1990
+ /** Handle color annotation */
1991
+ class ColorAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
1992
+ /**
1993
+ * @inheritDoc
1994
+ */
1995
+ canHandle(targetDto) {
1996
+ return targetDto.name === 'RTETextNode';
1997
+ }
1998
+ /**
1999
+ * Handle annotation.
2000
+ *
2001
+ * @param {HTMLElement} element - Current elements.
2002
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2003
+ * @returns {VegaRTETextAnnotations} - Annotation.
2004
+ */
2005
+ handle(element, parentAnnotations = {}) {
2006
+ const color = this.getColor(element) || parentAnnotations.textColor;
2007
+ return color ? { textColor: color } : {};
2008
+ }
2009
+ /**
2010
+ * Get current color of element.
2011
+ *
2012
+ * @param {HTMLElement} element - current element.
2013
+ * @returns {Nullable<string>} - color.
2014
+ */
2015
+ getColor(element) {
2016
+ var _a;
2017
+ const color = element.style.color;
2018
+ const hexColor = (_a = ui.rgbToHex(color)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
2019
+ if (hexColor) {
2020
+ // We don't display default text color as inline style, because we defined it in the vega-rich-text-content.scss.
2021
+ const colorSchema = codeBlock.RTE_TEXT_COLORS.filter((item) => item.key !== codeBlock.RTE_DEFAULT_TEXT_COLOR.key).find((schema) => schema.light === hexColor || schema.dark === hexColor);
2022
+ if (colorSchema)
2023
+ return colorSchema.key;
2024
+ return null;
2025
+ }
2026
+ else {
2027
+ for (const color of codeBlock.RTE_TEXT_COLORS) {
2028
+ if (element.style.color.includes(color.key)) {
2029
+ return color.key;
2030
+ }
2031
+ }
2032
+ return null;
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ /** Handle italic annotation */
2038
+ class ItalicAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2039
+ /**
2040
+ * @inheritDoc
2041
+ */
2042
+ canHandle(targetDto) {
2043
+ return targetDto.name === 'RTETextNode';
2044
+ }
2045
+ /**
2046
+ * Handle annotation.
2047
+ *
2048
+ * @param {HTMLElement} element - Current elements.
2049
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2050
+ * @returns {VegaRTETextAnnotations} - Annotation.
2051
+ */
2052
+ handle(element, parentAnnotations = {}) {
2053
+ return this.isItalic(element) || parentAnnotations.italic ? { italic: true } : {};
2054
+ }
2055
+ /**
2056
+ * Is italic element.
2057
+ *
2058
+ * @param {HTMLElement} element - current element.
2059
+ * @returns {boolean} - boolean.
2060
+ */
2061
+ isItalic(element) {
2062
+ return (element.nodeName === 'I' ||
2063
+ element.style.fontStyle === 'italic' ||
2064
+ element.nodeName === 'EM' ||
2065
+ element.classList.contains('v-rte--italic'));
2066
+ }
2067
+ }
2068
+
2069
+ /** Handle link annotation */
2070
+ class LinkAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2071
+ constructor() {
2072
+ super(...arguments);
2073
+ this.handlers = [
2074
+ new CustomAttributeAnnotationHandler(),
2075
+ new CustomClassAnnotationHandler(),
2076
+ new CustomStyleAnnotationHandler(),
2077
+ ];
2078
+ }
2079
+ /**
2080
+ * Can be handle.
2081
+ *
2082
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
2083
+ * @returns {boolean} - .
2084
+ */
2085
+ canHandle(targetDto) {
2086
+ return targetDto.name === 'RTETextNode';
2087
+ }
2088
+ /**
2089
+ * Handle annotation.
2090
+ *
2091
+ * @param {HTMLElement} element - Current elements.
2092
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2093
+ * @returns {VegaRTETextAnnotations} - Annotation.
2094
+ */
2095
+ handle(element, parentAnnotations = {}) {
2096
+ if (parentAnnotations.link)
2097
+ return { link: parentAnnotations.link };
2098
+ return element.tagName === 'A' ? { link: this.generateLinkAnnotations(element) } : {};
2099
+ }
2100
+ /**
2101
+ * Generate link annotations.
2102
+ *
2103
+ * @param {HTMLElement} element - Current elements.
2104
+ * @returns {VegaRTELink} - link annotations.
2105
+ */
2106
+ generateLinkAnnotations(element) {
2107
+ const annotations = {
2108
+ href: element.href,
2109
+ groupKey: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2110
+ };
2111
+ this.handlers.forEach((handler) => {
2112
+ Object.assign(annotations, handler.handle(element));
2113
+ });
2114
+ return annotations;
2115
+ }
2116
+ }
2117
+
2118
+ /** Handle strike through annotation */
2119
+ class StrikeThroughAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2120
+ /**
2121
+ * @inheritDoc
2122
+ */
2123
+ canHandle(targetDto) {
2124
+ return targetDto.name === 'RTETextNode';
2125
+ }
2126
+ /**
2127
+ * Handle annotation.
2128
+ *
2129
+ * @param {HTMLElement} element - Current elements.
2130
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2131
+ * @returns {VegaRTETextAnnotations} - Annotation.
2132
+ */
2133
+ handle(element, parentAnnotations = {}) {
2134
+ return this.isStrikethrough(element) || parentAnnotations.strikethrough
2135
+ ? { strikethrough: true }
2136
+ : {};
2137
+ }
2138
+ /**
2139
+ * Is strikethrough element.
2140
+ *
2141
+ * @param {HTMLElement} element - current element.
2142
+ * @returns {boolean} - boolean.
2143
+ */
2144
+ isStrikethrough(element) {
2145
+ return (element.style.textDecoration.includes('line-through') ||
2146
+ element.nodeName === 'S' ||
2147
+ element.nodeName === 'DEL' ||
2148
+ element.classList.contains('v-rte--strikethrough'));
2149
+ }
2150
+ }
2151
+
2152
+ /** Handle underline annotation */
2153
+ class UnderlineAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2154
+ /**
2155
+ * @inheritDoc
2156
+ */
2157
+ canHandle(targetDto) {
2158
+ return targetDto.name === 'RTETextNode';
2159
+ }
2160
+ /**
2161
+ * Handle annotation.
2162
+ *
2163
+ * @param {HTMLElement} element - Current elements.
2164
+ * @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
2165
+ * @returns {VegaRTETextAnnotations} - Annotation.
2166
+ */
2167
+ handle(element, parentAnnotations = {}) {
2168
+ return this.isUnderline(element) || parentAnnotations.underline ? { underline: true } : {};
2169
+ }
2170
+ /**
2171
+ * Is underline element.
2172
+ *
2173
+ * @param {HTMLElement} element - current element.
2174
+ * @returns {boolean} - boolean.
2175
+ */
2176
+ isUnderline(element) {
2177
+ return (element.style.textDecoration.includes('underline') ||
2178
+ element.nodeName === 'U' ||
2179
+ element.nodeName === 'INS' ||
2180
+ element.classList.contains('v-rte--underline'));
2181
+ }
2182
+ }
2183
+
2184
+ /** Handle text style annotation */
2185
+ class TextStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2186
+ /**
2187
+ * Can be handle.
2188
+ *
2189
+ * @param {RTEDtoClassPrototype} targetDto - Target DTO.
2190
+ * @param {HtmlElementToAnnotationGenerateOptions} options - Options for annotation generator.
2191
+ * @returns {boolean} - .
2192
+ */
2193
+ canHandle(targetDto, options) {
2194
+ return !!options.autoMatchFormat && targetDto.name === 'RTETextBlock';
2195
+ }
2196
+ /**
2197
+ * Handle annotation.
2198
+ *
2199
+ * @param {HTMLElement} element - Current elements.
2200
+ * @returns {VegaRTETextBlockAnnotations} - Annotation.
2201
+ */
2202
+ handle(element) {
2203
+ const textStyle = this.getTextStyle(element);
2204
+ return textStyle ? { textStyle: textStyle } : {};
2205
+ }
2206
+ /**
2207
+ * Get the node type of element. The element type is determined in the following
2208
+ * order: "data-type" attribute, node name, font size and class name.
2209
+ *
2210
+ * @param {HTMLElement} element - element.
2211
+ * @returns {Nullable<VegaRTETextStyleType>} - node type.
2212
+ */
2213
+ getTextStyle(element) {
2214
+ const byDataType = this.getElementTypeByDataType(element);
2215
+ if (byDataType)
2216
+ return byDataType;
2217
+ const byNodeName = this.getElementTypeByNodeName(element);
2218
+ if (byNodeName)
2219
+ return byNodeName;
2220
+ const byFontSize = this.getElementTypeByFontSize(element);
2221
+ if (byFontSize)
2222
+ return byFontSize;
2223
+ const byClassName = this.getElementTypeByClassName(element);
2224
+ if (byClassName)
2225
+ return byClassName;
2226
+ return null;
2227
+ }
2228
+ /**
2229
+ * Get the element type by data-type attribute.
2230
+ *
2231
+ * @param {HTMLElement} element - element.
2232
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2233
+ */
2234
+ getElementTypeByDataType(element) {
2235
+ if (element.nodeType !== Node.TEXT_NODE && element.hasAttribute('data-type')) {
2236
+ return element.getAttribute('data-type');
2237
+ }
2238
+ return null;
2239
+ }
2240
+ /**
2241
+ * Get the element type by font size.
2242
+ *
2243
+ * @param {HTMLElement} element - element.
2244
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2245
+ */
2246
+ getElementTypeByFontSize(element) {
2247
+ var _a;
2248
+ switch ((_a = element.style) === null || _a === void 0 ? void 0 : _a.fontSize) {
2249
+ case '36px':
2250
+ return 'title';
2251
+ case '28px':
2252
+ return 'subtitle';
2253
+ case '22px':
2254
+ return 'heading-1';
2255
+ case '20px':
2256
+ return 'heading-2';
2257
+ case '18px':
2258
+ return 'heading-3';
2259
+ default:
2260
+ return null;
2261
+ }
2262
+ }
2263
+ /**
2264
+ * Get the element type by node name.
2265
+ *
2266
+ * @param {HTMLElement} element - element.
2267
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2268
+ */
2269
+ getElementTypeByNodeName(element) {
2270
+ switch (element.nodeName) {
2271
+ case 'H1':
2272
+ return 'heading-1';
2273
+ case 'H2':
2274
+ return 'heading-2';
2275
+ case 'H3':
2276
+ return 'heading-3';
2277
+ case 'H4':
2278
+ return 'heading-4';
2279
+ case 'H5':
2280
+ return 'heading-5';
2281
+ case 'H6':
2282
+ return 'heading-6';
2283
+ default:
2284
+ return null;
2285
+ }
2286
+ }
2287
+ /**
2288
+ * Get the element type by class name.
2289
+ *
2290
+ * @param {HTMLElement} element - element.
2291
+ * @returns {Nullable<VegaRTETextStyleType>} - element type or null if not found.
2292
+ */
2293
+ getElementTypeByClassName(element) {
2294
+ if (element.className) {
2295
+ const match = /\bv-rte--text-style-(title|subtitle|heading-1|heading-2|heading-3|paragraph)\b/.exec(element.className);
2296
+ if (match) {
2297
+ return match[1];
2298
+ }
2299
+ }
2300
+ return null;
2301
+ }
2302
+ }
2303
+
2304
+ /** Handle image size annotation */
2305
+ class ImageSizeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2306
+ /**
2307
+ * @inheritDoc
2308
+ */
2309
+ canHandle(targetDto) {
2310
+ return targetDto.name === 'RTEImageNode';
2311
+ }
2312
+ /**
2313
+ * Handle annotation.
2314
+ *
2315
+ * @param {HTMLElement} element - Current elements.
2316
+ * @returns {VegaRTEImageAnnotations} - Annotation.
2317
+ */
2318
+ handle(element) {
2319
+ const size = this.getImageSize(element);
2320
+ return size ? { size: size } : {};
2321
+ }
2322
+ /**
2323
+ * Determine the image display size based on the width of the current element.
2324
+ *
2325
+ * @param {HTMLElement} element - current element.
2326
+ * @returns {Nullable<VegaRichTextImageEditorSizeType>} -Image size, default 'md'.
2327
+ */
2328
+ getImageSize(element) {
2329
+ if (element.getAttribute('data-size')) {
2330
+ return element.getAttribute('data-size');
2331
+ }
2332
+ return null;
2333
+ }
2334
+ }
2335
+
2336
+ /** Handle image alt annotation */
2337
+ class ImageAltAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2338
+ /**
2339
+ * @inheritDoc
2340
+ */
2341
+ canHandle(targetDto) {
2342
+ return targetDto.name === 'RTEImageNode';
2343
+ }
2344
+ /**
2345
+ * Handle annotation.
2346
+ *
2347
+ * @param {HTMLElement} element - Current elements.
2348
+ * @returns {VegaRTEImageAnnotations} - Annotation.
2349
+ */
2350
+ handle(element) {
2351
+ return element.hasAttribute('alt') ? { alt: element.getAttribute('alt') } : {};
2352
+ }
2353
+ }
2354
+
2355
+ /**
2356
+ * Handle inline html annotation
2357
+ */
2358
+ class InlineHtmlAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
2359
+ constructor() {
2360
+ super(...arguments);
2361
+ this.customAttributeHandler = new CustomAttributeAnnotationHandler();
2362
+ this.customStyleAnnotationHandler = new CustomStyleAnnotationHandler();
2363
+ this.customClassAnnotationHandler = new CustomClassAnnotationHandler();
2364
+ }
2365
+ /**
2366
+ * @inheritDoc
2367
+ */
2368
+ canHandle(targetDto, options) {
2369
+ return targetDto.name === 'RTETextNode' && options.autoMatchFormat === false;
2370
+ }
2371
+ /**
2372
+ * @inheritDoc
2373
+ */
2374
+ handle(element, parentAnnotations) {
2375
+ const canHandle = InlineHtmlAnnotationHandler.canHandleTags.includes(element.nodeName);
2376
+ if (canHandle) {
2377
+ const inlineHtml = this.generateInlineHtmlAnnotation(element, Object.assign({}, parentAnnotations));
2378
+ if (inlineHtml) {
2379
+ return { inlineHtml: inlineHtml };
2380
+ }
2381
+ }
2382
+ return {};
2383
+ }
2384
+ /**
2385
+ * Generate inline html annotation.
2386
+ *
2387
+ * @param {HTMLElement} child - Current element.
2388
+ * @param {VegaRTETextAnnotations} annotations - Current annotations.
2389
+ * @returns {Nullable<VegaInlineHtmlSchema>} - Inline html annotation.
2390
+ */
2391
+ generateInlineHtmlAnnotation(child, annotations) {
2392
+ let { inlineHtml } = annotations;
2393
+ if (!codeBlock.RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) ||
2394
+ (child.childNodes.length === 1 && child.childNodes[0].nodeType !== Node.TEXT_NODE)) {
2395
+ const childInlineHtmlNode = {
2396
+ htmlTag: child.nodeName.toLowerCase(),
2397
+ customAttribute: this.customAttributeHandler.handle(child).customAttribute,
2398
+ customStyle: this.customStyleAnnotationHandler.handle(child).customStyle,
2399
+ customClass: this.customClassAnnotationHandler.handle(child).customClass,
2400
+ };
2401
+ if (!inlineHtml) {
2402
+ inlineHtml = childInlineHtmlNode;
2403
+ }
2404
+ else {
2405
+ let lastChild = inlineHtml;
2406
+ while (lastChild.child &&
2407
+ child.parentNode &&
2408
+ lastChild.child.htmlTag === child.parentNode.nodeName.toLowerCase()) {
2409
+ lastChild = lastChild.child;
2410
+ }
2411
+ lastChild.child = childInlineHtmlNode;
2412
+ }
2413
+ }
2414
+ return inlineHtml ? Object.assign({}, inlineHtml) : null;
2415
+ }
2416
+ }
2417
+ InlineHtmlAnnotationHandler.canHandleTags = [
2418
+ 'A',
2419
+ 'ABBR',
2420
+ 'AUDIO',
2421
+ 'B',
2422
+ 'BDI',
2423
+ 'BDO',
2424
+ 'CITE',
2425
+ 'CODE',
2426
+ 'DEL',
2427
+ 'DFN',
2428
+ 'EMBED',
2429
+ 'EM',
2430
+ 'I',
2431
+ 'INS',
2432
+ 'KBD',
2433
+ 'MARK',
2434
+ 'METER',
2435
+ 'OUTPUT',
2436
+ 'PROGRESS',
2437
+ 'Q',
2438
+ 'S',
2439
+ 'SMALL',
2440
+ 'SPAN',
2441
+ 'STRONG',
2442
+ 'SUB',
2443
+ 'SUP',
2444
+ 'TIME',
2445
+ 'U',
2446
+ 'VAR',
2447
+ 'VIDEO',
2448
+ ];
2449
+
2450
+ /** Html element to annotations generator */
2451
+ class HtmlElementToAnnotationGenerator {
2452
+ constructor() {
2453
+ this.handlers = [
2454
+ new TextAlignAnnotationHandler(),
2455
+ new IndentAnnotationHandler(),
2456
+ new BoldAnnotationHandler(),
2457
+ new ItalicAnnotationHandler(),
2458
+ new UnderlineAnnotationHandler(),
2459
+ new StrikeThroughAnnotationHandler(),
2460
+ new ColorAnnotationHandler(),
2461
+ new LinkAnnotationHandler(),
2462
+ new CodeAnnotationHandler(),
2463
+ new ImageSizeAnnotationHandler(),
2464
+ new ImageAltAnnotationHandler(),
2465
+ new CustomAttributeAnnotationHandler(),
2466
+ new CustomClassAnnotationHandler(),
2467
+ new CustomStyleAnnotationHandler(),
2468
+ new LinkAnnotationHandler(),
2469
+ new TextStyleAnnotationHandler(),
2470
+ new InlineHtmlAnnotationHandler(),
2471
+ ];
2472
+ }
2473
+ /**
2474
+ * The function generates annotations for a given target DTO and HTML element based on a set of
2475
+ * strategies.
2476
+ *
2477
+ * @typedef T class name of target DTO
2478
+ * @typedef V generated annotations type
2479
+ * @param {T} targetDto - Which DTO is the generated annotations to set.
2480
+ * @param {HTMLElement} element - Current html element.
2481
+ * @param {HtmlElementToAnnotationGenerateOptions} [options] - Options
2482
+ * @returns {V} Generated annotations.
2483
+ */
2484
+ generate(targetDto, element, options = { autoMatchFormat: true }) {
2485
+ const isLinkElement = element.tagName === 'A';
2486
+ return this.handlers
2487
+ .filter((handler) => !options.autoMatchFormat && isLinkElement ? handler instanceof LinkAnnotationHandler : true)
2488
+ .filter((handler) => element.nodeType !== Node.TEXT_NODE &&
2489
+ handler.canHandle(targetDto, {
2490
+ skipCustomAnnotations: options.skipCustomAnnotations || isLinkElement,
2491
+ autoMatchFormat: options.autoMatchFormat,
2492
+ }))
2493
+ .reduce((annotations, handler) => {
2494
+ const result = handler.handle(element, options.parentAnnotations);
2495
+ return Object.assign(Object.assign({}, annotations), result);
2496
+ }, {});
2497
+ }
2498
+ }
2499
+ const htmlElementToAnnotationGenerator = new HtmlElementToAnnotationGenerator();
2500
+
2501
+ /** Abstract class for block html element to RTE block dto */
2502
+ class BlockToRTEBlockStrategyAbstract extends ElementToDTOStrategy {
2503
+ constructor() {
2504
+ super(...arguments);
2505
+ this.annotationHandler = new TextStyleAnnotationHandler();
2506
+ }
2507
+ /**
2508
+ * Generate child nodes of block element, this will inherit all annotations from parent to text node and
2509
+ * flat the child nodes.
2510
+ *
2511
+ * Example:
2512
+ * <li>
2513
+ * <u><i>text1</i></u>
2514
+ * <span></span>
2515
+ * <span style='font-weight: bold;'><span>text2</span></span>
2516
+ * text3
2517
+ * </li>
2518
+ * will tranform to:
2519
+ * <li>
2520
+ * <span>text1</span> // with underline and italic annotations
2521
+ * <span></span> // empty span
2522
+ * <span>text2</span> // with bold annotations
2523
+ * <span>text3</span> // no annotations
2524
+ * </li>
2525
+ *
2526
+ * @param {HTMLElement[]} elements - Child elements.
2527
+ * @param {VegaRTETextAnnotations} annotations - Parent annotations.
2528
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
2529
+ * @returns {VegaRTETextNode[]} - Text node DTO.
2530
+ */
2531
+ generateChildNodes(elements, annotations, options) {
2532
+ const childNodes = [];
2533
+ const disableAutoMatchFormat = !!(options && options.autoMatchFormat === false);
2534
+ const parentAnnotations = Object.assign({}, annotations);
2535
+ elements.forEach((child) => {
2536
+ const strategy = ElementToDTOClassStrategyManager.getElementToNodeStrategies().find((item) => item.canHandle([child], 0, options) > 0);
2537
+ let textNodeJson = null;
2538
+ if (strategy) {
2539
+ textNodeJson = strategy.handle([child], options, parentAnnotations);
2540
+ }
2541
+ if (textNodeJson) {
2542
+ childNodes.push(textNodeJson);
2543
+ }
2544
+ else if (ui.isHTMLElement(child) && child.childNodes.length > 0) {
2545
+ const curAnnotations = htmlElementToAnnotationGenerator.generate(codeBlock.RTETextNode, child, Object.assign({ parentAnnotations: disableAutoMatchFormat
2546
+ ? {
2547
+ inlineHtml: parentAnnotations.inlineHtml,
2548
+ link: parentAnnotations.link,
2549
+ code: parentAnnotations.code,
2550
+ }
2551
+ : annotations }, options));
2552
+ childNodes.push(...this.generateChildNodes(Array.from(child.childNodes), curAnnotations, options));
2553
+ }
2554
+ });
2555
+ return childNodes;
2556
+ }
2557
+ /**
2558
+ * Get the node type of element. The element type is determined in the following
2559
+ * order: "data-type" attribute, node name, font size and class name.
2560
+ *
2561
+ * @param {HTMLElement} element - element.
2562
+ * @returns {VegaRTETextBlockType} - Block type.
2563
+ */
2564
+ matchTextBlockType(element) {
2565
+ var _a;
2566
+ return (_a = this.annotationHandler.handle(element).textStyle) !== null && _a !== void 0 ? _a : 'paragraph';
2567
+ }
2568
+ }
2569
+
2570
+ /**
2571
+ * Converting HTML block elements into RTE blocks.
2572
+ */
2573
+ class HtmlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2574
+ /**
2575
+ * @inheritDoc
2576
+ */
2577
+ canHandle(elementsArray, currentIndex, options) {
2578
+ const element = elementsArray[currentIndex];
2579
+ // - div + img should be handled by RTEImageBlock
2580
+ const isCustomContainer = element.nodeName === 'DIV'
2581
+ ? element.childNodes.length > 0 && element.childNodes[0].nodeName !== 'IMG'
2582
+ : true;
2583
+ return !options.autoMatchFormat &&
2584
+ isCustomContainer &&
2585
+ HtmlBlockStrategy.canHandleTags.includes(elementsArray[currentIndex].nodeName)
2586
+ ? 1
2587
+ : 0;
2588
+ }
2589
+ /**
2590
+ * @inheritDoc
2591
+ */
2592
+ handle(elementsArray, options) {
2593
+ const element = elementsArray[0];
2594
+ return RTEHtmlBlock.from(this.generateHtmlBlock(element, options), options);
2595
+ }
2596
+ /**
2597
+ * @inheritDoc
2598
+ */
2599
+ appendChildBlocks(currentBlock, childBlocks) {
2600
+ currentBlock.children = childBlocks.map((block) => {
2601
+ block.parent = currentBlock;
2602
+ return block;
2603
+ });
2604
+ }
2605
+ /**
2606
+ * @inheritDoc
2607
+ */
2608
+ shouldProceedToElementChildren() {
2609
+ return true;
2610
+ }
2611
+ /**
2612
+ * Generate HTML block DTO from an HTML element.
2613
+ *
2614
+ * @param {HTMLElement} element - HTML element to convert.
2615
+ * @param {VegaRTETransformOptions} options - Options for transformation.
2616
+ * @returns {VegaRTEHtmlBlock} - HTML block DTO.
2617
+ */
2618
+ generateHtmlBlock(element, options) {
2619
+ return {
2620
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2621
+ type: 'html-block',
2622
+ htmlTag: element.nodeName.toLowerCase(),
2623
+ annotations: htmlElementToAnnotationGenerator.generate(RTEHtmlBlock, element, options),
2624
+ children: [],
2625
+ };
2626
+ }
2627
+ }
2628
+ HtmlBlockStrategy.canHandleTags = [
2629
+ 'ADDRESS',
2630
+ 'ARTICLE',
2631
+ 'ASIDE',
2632
+ 'BLOCKQUOTE',
2633
+ 'BUTTON',
2634
+ 'CAPTION',
2635
+ 'COL',
2636
+ 'COLGROUP',
2637
+ 'DIV',
2638
+ 'DD',
2639
+ 'DETAILS',
2640
+ 'DL',
2641
+ 'DT',
2642
+ 'FIELDSET',
2643
+ 'FIGCAPTION',
2644
+ 'FIGURE',
2645
+ 'FOOTER',
2646
+ 'FORM',
2647
+ 'HEADER',
2648
+ 'HR',
2649
+ 'HX',
2650
+ 'INPUT',
2651
+ 'LEGEND',
2652
+ 'MAIN',
2653
+ 'NAV',
2654
+ 'PRE',
2655
+ 'SECTION',
2656
+ 'SUMMARY',
2657
+ 'TABLE',
2658
+ 'TBODY',
2659
+ 'TD',
2660
+ 'TFOOT',
2661
+ 'TH',
2662
+ 'THEAD',
2663
+ 'TR',
2664
+ ];
2665
+
2666
+ /** Transform ul element to list block DTO */
2667
+ class UlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2668
+ /**
2669
+ * Can be handle.
2670
+ *
2671
+ * @param {HTMLElement[]} elementsArray - Current elements.
2672
+ * @param {number} currentIndex - Current element index.
2673
+ * @returns {number} - can be handled element count.
2674
+ */
2675
+ canHandle(elementsArray, currentIndex) {
2676
+ return elementsArray[currentIndex].tagName === 'UL' ? 1 : 0;
2677
+ }
2678
+ /**
2679
+ * Parse to a block.
2680
+ *
2681
+ * @param {HTMLElement[]} elementsArray - Current elements.
2682
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
2683
+ * @returns {Nullable<RTEContentBlock>} - Bullet list block.
2684
+ */
2685
+ handle(elementsArray, options) {
2686
+ if (elementsArray[0].childNodes.length === 0)
2687
+ return null;
2688
+ return RTEListBlock.from({
2689
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2690
+ type: 'bullet-list',
2691
+ blocks: [],
2692
+ annotations: htmlElementToAnnotationGenerator.generate(RTEListBlock, elementsArray[0], options),
2693
+ }, options);
2694
+ }
2695
+ /**
2696
+ * Append child list item blocks to current list block.
2697
+ *
2698
+ * @param {RTEListBlock} currentBlock - Current list block.
2699
+ * @param {RTEContentBlock[]} childBlocks - Current list item blocks.
2700
+ */
2701
+ appendChildBlocks(currentBlock, childBlocks) {
2702
+ currentBlock.children = childBlocks.filter((block) => block instanceof RTEListItemBlock);
2703
+ childBlocks.forEach((block) => (block.parent = currentBlock));
2704
+ }
2705
+ /**
2706
+ * Should continue process to child elements.
2707
+ *
2708
+ * @returns {boolean} - boolean.
2709
+ */
2710
+ shouldProceedToElementChildren() {
2711
+ return true;
2712
+ }
2713
+ }
2714
+
2715
+ /** Transform ol element to list block DTO */
2716
+ class OlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2717
+ /**
2718
+ * Can be handle.
2719
+ *
2720
+ * @param {HTMLElement[]} elementsArray - Current elements.
2721
+ * @param {number} currentIndex - Current element index.
2722
+ * @returns {number} - can be handled element count.
2723
+ */
2724
+ canHandle(elementsArray, currentIndex) {
2725
+ return elementsArray[currentIndex].tagName === 'OL' ? 1 : 0;
2726
+ }
2727
+ /**
2728
+ * Parse to a number list block.
2729
+ *
2730
+ * @param {HTMLElement[]} elementsArray - Current elements.
2731
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
2732
+ * @returns {Nullable<RTEContentBlock>} - Number list block.
2733
+ */
2734
+ handle(elementsArray, options) {
2735
+ if (elementsArray[0].childNodes.length === 0)
2736
+ return null;
2737
+ return RTEListBlock.from({
2738
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2739
+ type: 'number-list',
2740
+ blocks: [],
2741
+ annotations: htmlElementToAnnotationGenerator.generate(RTEListBlock, elementsArray[0], options),
2742
+ }, options);
2743
+ }
2744
+ /**
2745
+ * Append child list item blocks to current list block.
2746
+ *
2747
+ * @param {RTEListBlock} currentBlock - Current list block.
2748
+ * @param {RTEContentBlock[]} childBlocks - Current list item blocks.
2749
+ */
2750
+ appendChildBlocks(currentBlock, childBlocks) {
2751
+ currentBlock.children = childBlocks.filter((block) => block instanceof RTEListItemBlock);
2752
+ childBlocks.forEach((block) => (block.parent = currentBlock));
2753
+ }
2754
+ /**
2755
+ * Should continue process to child elements.
2756
+ *
2757
+ * @returns {boolean} - boolean.
2758
+ */
2759
+ shouldProceedToElementChildren() {
2760
+ return true;
2761
+ }
2762
+ }
2763
+
2764
+ /** Transform child element of UL element which are not LI element to list item block DTO */
2765
+ class ULNotLiChildToRTEListItemBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2766
+ /**
2767
+ * Can be handle.
2768
+ *
2769
+ * @param {HTMLElement[]} elementsArray - Current elements.
2770
+ * @param {number} currentIndex - Current element index.
2771
+ * @returns {number} - can be handled element count.
2772
+ */
2773
+ canHandle(elementsArray, currentIndex) {
2774
+ const element = elementsArray[currentIndex];
2775
+ const parent = element.parentElement;
2776
+ const isLiNode = element.nodeName !== 'LI';
2777
+ // while child is empty text node like newline or empty string, we should not covert it.
2778
+ const isEmptyNode = element.nodeType === Node.TEXT_NODE && element.textContent.trim() === '';
2779
+ // The node must be in list item.
2780
+ const isInList = typeGuard.isNonNullable(parent) && ['UL', 'OL'].includes(parent.nodeName);
2781
+ return isLiNode && !isEmptyNode && isInList ? 1 : 0;
2782
+ }
2783
+ /**
2784
+ * Parse to a list item block.
2785
+ *
2786
+ * @param {HTMLElement[]} elementsArray - Current elements.
2787
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
2788
+ * @returns {Nullable<RTEContentBlock>} - List item block.
2789
+ */
2790
+ handle(elementsArray, options) {
2791
+ const nodes = this.generateChildNodes(elementsArray, {}, options);
2792
+ return RTEListItemBlock.from({
2793
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2794
+ type: 'list-item',
2795
+ nodes: nodes,
2796
+ annotations: {},
2797
+ }, options);
2798
+ }
2799
+ /* istanbul ignore next */
2800
+ /**
2801
+ * Append child blocks.
2802
+ */
2803
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2804
+ appendChildBlocks() { }
2805
+ /**
2806
+ * Should continue process to child elements.
2807
+ *
2808
+ * @returns {boolean} - boolean.
2809
+ */
2810
+ shouldProceedToElementChildren() {
2811
+ return false;
2812
+ }
2813
+ }
2814
+
2815
+ /** Transform li element to list item block DTO */
2816
+ class LiToRTEListItemBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2817
+ /**
2818
+ * Can be handled.
2819
+ *
2820
+ * @param {HTMLElement[]} elementsArray - Current elements.
2821
+ * @param {number} currentIndex - Current element index.
2822
+ * @returns {number} - can be handled element count.
2823
+ */
2824
+ canHandle(elementsArray, currentIndex) {
2825
+ const parent = elementsArray[currentIndex].parentElement;
2826
+ if (!['UL', 'OL'].includes(parent.nodeName) &&
2827
+ elementsArray.some((element) => element.nodeName === 'LI')) {
2828
+ let count = 0;
2829
+ for (let i = currentIndex; i < elementsArray.length; i++) {
2830
+ if (elementsArray[i].nodeName === 'LI') {
2831
+ count++;
2832
+ }
2833
+ else {
2834
+ break;
2835
+ }
2836
+ }
2837
+ return count;
2838
+ }
2839
+ return elementsArray[currentIndex].tagName === 'LI' ? 1 : 0;
2840
+ }
2841
+ /**
2842
+ * Parse to a list item block.
2843
+ *
2844
+ * @param {HTMLElement[]} elementsArray - Current elements.
2845
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
2846
+ * @returns {Nullable<RTEContentBlock>} - List item block.
2847
+ */
2848
+ handle(elementsArray, options) {
2849
+ const firstElement = elementsArray[0];
2850
+ const parent = firstElement.parentElement;
2851
+ if (!['UL', 'OL'].includes(parent.nodeName)) {
2852
+ return this.generateWithListBlock(elementsArray, options);
2853
+ }
2854
+ return RTEListItemBlock.from(this.generateListItemBlockDTO(firstElement, options), options);
2855
+ }
2856
+ /**
2857
+ * Append child list blocks to current list item block.
2858
+ *
2859
+ * @param {RTEListBlock} currentBlock - Current list item block.
2860
+ * @param {RTEListItemBlock[]} childBlocks - Current list blocks.
2861
+ */
2862
+ appendChildBlocks(currentBlock, childBlocks) {
2863
+ currentBlock.nestList = childBlocks.filter((block) => ['bullet-list', 'number-list'].includes(block.type));
2864
+ }
2865
+ /**
2866
+ * Should continue process to child elements.
2867
+ *
2868
+ * @returns {boolean} - boolean.
2869
+ */
2870
+ shouldProceedToElementChildren() {
2871
+ return true;
2872
+ }
2873
+ /**
2874
+ * Generate list block from a list of HTML elements.
2875
+ *
2876
+ * @param {HTMLElement[]} elements - List of HTML elements to convert.
2877
+ * @param {VegaRTETransformOptions} options - Options for transformation.
2878
+ * @returns {RTEListBlock} - List block DTO.
2879
+ */
2880
+ generateWithListBlock(elements, options) {
2881
+ return RTEListBlock.from({
2882
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2883
+ type: 'bullet-list',
2884
+ blocks: elements.map((item) => {
2885
+ return this.generateListItemBlockDTO(item, options);
2886
+ }),
2887
+ }, options);
2888
+ }
2889
+ /**
2890
+ * Generate list item block DTO from an HTML element.
2891
+ *
2892
+ * @param {HTMLElement} element - HTML element to convert.
2893
+ * @param {VegaRTETransformOptions} options - Options for transformation.
2894
+ * @returns {VegaRTEListItemBlock} - List item block DTO.
2895
+ */
2896
+ generateListItemBlockDTO(element, options) {
2897
+ return {
2898
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2899
+ type: 'list-item',
2900
+ annotations: htmlElementToAnnotationGenerator.generate(RTEListItemBlock, element, options),
2901
+ nodes: this.generateChildNodes(Array.from(element.childNodes.length ? element.childNodes : [element]).filter((item) => {
2902
+ return !['UL', 'OL'].includes(item.nodeName);
2903
+ }), htmlElementToAnnotationGenerator.generate(codeBlock.RTETextNode, element, Object.assign(Object.assign({}, options), { skipCustomAnnotations: true })), options),
2904
+ };
2905
+ }
2906
+ }
2907
+
2908
+ /** Transform other editor code element which has attribute data-language to RTE code block DTO */
2909
+ class JiraCodeToRTECodeBlockStrategy extends BlockToRTEBlockStrategyAbstract {
2910
+ /**
2911
+ * Can be handle.
2912
+ *
2913
+ * @param {HTMLElement[]} elementsArray - Current elements.
2914
+ * @param {number} currentIndex - Current element index.
2915
+ * @returns {number} - can be handled element count.
2916
+ */
2917
+ canHandle(elementsArray, currentIndex) {
2918
+ return (elementsArray[currentIndex].tagName === 'PRE' ||
2919
+ elementsArray[currentIndex].tagName === 'CODE') &&
2920
+ elementsArray[currentIndex].hasAttribute('data-language')
2921
+ ? 1
2922
+ : 0;
2923
+ }
2924
+ /**
2925
+ * Parse to a code block.
2926
+ *
2927
+ * @param {HTMLElement[]} elementsArray - Current elements.
2928
+ * @returns {Nullable<RTECodeBlock>} - Code block.
2929
+ */
2930
+ handle(elementsArray) {
2931
+ const codeRef = elementsArray[0];
2932
+ if (codeRef) {
2933
+ const content = codeRef.textContent;
2934
+ const language = codeRef.dataset
2935
+ .language;
2936
+ return codeBlock.RTECodeBlock.from({
2937
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
2938
+ type: 'code-block',
2939
+ content,
2940
+ language,
2941
+ });
2942
+ }
2943
+ }
2944
+ /* istanbul ignore next */
2945
+ /**
2946
+ * Append child blocks.
2947
+ */
2948
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
2949
+ appendChildBlocks() { }
2950
+ /**
2951
+ * Should continue process to child elements.
2952
+ *
2953
+ * @returns {boolean} - boolean.
2954
+ */
2955
+ shouldProceedToElementChildren() {
2956
+ return false;
2957
+ }
2958
+ }
2959
+
2960
+ /** Transform vega-code-block element to code block DTO */
2961
+ class VegaCodeBlockToRTECodeBlockStrategy extends JiraCodeToRTECodeBlockStrategy {
2962
+ /**
2963
+ * Can be handle.
2964
+ *
2965
+ * TODO: Update the browser clipboard data to fix the issue with nested vega-code-block elements.
2966
+ * In safari the html snippet will be like: <vega-code-block><p><span>paragraph</span></p><vega-code-block></vega-code-block></vega-code-block>
2967
+ * The vega-code-block nested inside the vega-code-block, so we need to check the child element.
2968
+ *
2969
+ * @param {HTMLElement[]} elementsArray - Current elements.
2970
+ * @param {number} currentIndex - Current element index.
2971
+ * @returns {number} - can be handled element count.
2972
+ */
2973
+ canHandle(elementsArray, currentIndex) {
2974
+ return (elementsArray[currentIndex].tagName === 'VEGA-CODE-BLOCK' &&
2975
+ !!elementsArray[currentIndex].querySelector('vega-code-block') === false) ||
2976
+ this.isCodeBlockContainer(elementsArray[currentIndex])
2977
+ ? 1
2978
+ : 0;
2979
+ }
2980
+ /**
2981
+ * Parse to a code block.
2982
+ *
2983
+ * @param {HTMLElement[]} elementsArray - Current elements.
2984
+ * @returns {Nullable<RTECodeBlock>} - Code block.
2985
+ */
2986
+ handle(elementsArray) {
2987
+ const codeBlockElement = this.isCodeBlockContainer(elementsArray[0])
2988
+ ? elementsArray[0].querySelector('vega-code-block')
2989
+ : elementsArray[0];
2990
+ const code = codeBlockElement.querySelector('code');
2991
+ if (code) {
2992
+ return super.handle([code]); // Call the parent method to handle the code element
2993
+ }
2994
+ else if (codeBlockElement.hasAttribute('data-content')) {
2995
+ // The code element in shadow dom could be empty in firefox.
2996
+ // eslint-disable-next-line no-restricted-globals
2997
+ const code = document.createElement('code');
2998
+ code.textContent = codeBlockElement.dataset.content;
2999
+ code.dataset.language = codeBlockElement.dataset.language;
3000
+ return super.handle([code]); // Call the parent method to handle the code element
3001
+ }
3002
+ }
3003
+ /* istanbul ignore next */
3004
+ /**
3005
+ * Append child blocks.
3006
+ */
3007
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3008
+ appendChildBlocks() { }
3009
+ /**
3010
+ * Should continue process to child elements.
3011
+ *
3012
+ * @returns {boolean} - boolean.
3013
+ */
3014
+ shouldProceedToElementChildren() {
3015
+ return false;
3016
+ }
3017
+ /**
3018
+ * Checks if the given element is a code block container.
3019
+ *
3020
+ * @param {HTMLElement} element - The element to check.
3021
+ * @returns {boolean} - Boolean result.
3022
+ */
3023
+ isCodeBlockContainer(element) {
3024
+ return (element.tagName === 'PRE' &&
3025
+ element.classList.contains('code-block-container') &&
3026
+ element.querySelectorAll('vega-code-block').length === 1);
3027
+ }
3028
+ }
3029
+
3030
+ /** Transform inline block element to text block DTO */
3031
+ class InlineBlockToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3032
+ /**
3033
+ * Can be handle.
3034
+ *
3035
+ * @param {HTMLElement[]} elementsArray - Current elements.
3036
+ * @param {number} currentIndex - Current element index.
3037
+ * @returns {number} - can be handled element count.
3038
+ */
3039
+ canHandle(elementsArray, currentIndex) {
3040
+ return [
3041
+ 'heading-1',
3042
+ 'heading-2',
3043
+ 'heading-3',
3044
+ 'heading-4',
3045
+ 'heading-5',
3046
+ 'heading-6',
3047
+ 'title',
3048
+ 'subtitle',
3049
+ ].includes(super.matchTextBlockType(elementsArray[currentIndex]))
3050
+ ? 1
3051
+ : 0;
3052
+ }
3053
+ /**
3054
+ * Parse to a text block.
3055
+ *
3056
+ * @param {HTMLElement[]} elementsArray - Current elements.
3057
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3058
+ * @returns {Nullable<RTEContentBlock>} - Text block.
3059
+ */
3060
+ handle(elementsArray, options) {
3061
+ const nodes = this.generateChildNodes(Array.from(elementsArray[0].childNodes), {}, options);
3062
+ if (nodes.length === 0)
3063
+ return null;
3064
+ return codeBlock.RTETextBlock.from({
3065
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3066
+ type: super.matchTextBlockType(elementsArray[0]),
3067
+ nodes: nodes,
3068
+ annotations: htmlElementToAnnotationGenerator.generate(codeBlock.RTETextBlock, elementsArray[0], options),
3069
+ }, options);
3070
+ }
3071
+ /* istanbul ignore next */
3072
+ /**
3073
+ * Append child blocks.
3074
+ */
3075
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3076
+ appendChildBlocks() { }
3077
+ /**
3078
+ * Should continue process to child elements.
3079
+ *
3080
+ * @returns {boolean} - boolean.
3081
+ */
3082
+ shouldProceedToElementChildren() {
3083
+ return false;
3084
+ }
3085
+ }
3086
+
3087
+ /** Abstract class for block html element to RTE block dto */
3088
+ class ElementToRTEImageBlockStrategyAbstract extends BlockToRTEBlockStrategyAbstract {
3089
+ /**
3090
+ * Create a RTE Image block according to the img element.
3091
+ *
3092
+ * @param {HTMLElement} element - current element.
3093
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3094
+ * @returns {RTEImageBlock} -RTE Image block.
3095
+ */
3096
+ createRTEImageBlock(element, options) {
3097
+ // RTEImageBlock is also wrapped by a div, should not as internal wrapper if the parent is a div.
3098
+ const isInternalWrapper = !(options && options.autoMatchFormat) &&
3099
+ !!(element.parentNode && element.parentNode.nodeName !== 'DIV');
3100
+ return RTEImageBlock.from({
3101
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3102
+ type: 'image',
3103
+ nodes: [
3104
+ {
3105
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3106
+ type: 'image',
3107
+ url: element.src,
3108
+ annotations: htmlElementToAnnotationGenerator.generate(RTEImageNode, element, options),
3109
+ },
3110
+ ],
3111
+ annotations: Object.assign(Object.assign({}, htmlElementToAnnotationGenerator.generate(RTEImageBlock, element.parentElement, options)), { internalWrapper: isInternalWrapper }),
3112
+ }, options);
3113
+ }
3114
+ }
3115
+
3116
+ /** Transform img element to image block DTO */
3117
+ class ImgToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
3118
+ /**
3119
+ * Can be handle.
3120
+ *
3121
+ * @param {HTMLElement[]} elementsArray - Current elements.
3122
+ * @param {number} currentIndex - Current element index.
3123
+ * @returns {number} - can be handled element count.
3124
+ */
3125
+ canHandle(elementsArray, currentIndex) {
3126
+ return elementsArray[currentIndex].tagName === 'IMG' ? 1 : 0;
3127
+ }
3128
+ /**
3129
+ * Parse to a image block.
3130
+ *
3131
+ * @param {HTMLElement[]} elementsArray - Current elements.
3132
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3133
+ * @returns {Nullable<RTEContentBlock>} - Image block.
3134
+ */
3135
+ handle(elementsArray, options) {
3136
+ const element = elementsArray[0];
3137
+ return this.createRTEImageBlock(element, options);
3138
+ }
3139
+ /* istanbul ignore next */
3140
+ /**
3141
+ * Append child blocks.
3142
+ */
3143
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3144
+ appendChildBlocks() { }
3145
+ /**
3146
+ * Should continue process to child elements.
3147
+ *
3148
+ * @returns {boolean} - boolean.
3149
+ */
3150
+ shouldProceedToElementChildren() {
3151
+ return false;
3152
+ }
3153
+ }
3154
+
3155
+ /** Transform vega-rich-text-image-editor element to image block DTO */
3156
+ class VegaImageToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
3157
+ /**
3158
+ * Can be handle.
3159
+ *
3160
+ * @param {HTMLElement[]} elementsArray - Current elements.
3161
+ * @param {number} currentIndex - Current element index.
3162
+ * @returns {number} - can be handled element count.
3163
+ */
3164
+ canHandle(elementsArray, currentIndex) {
3165
+ return elementsArray[currentIndex].tagName === 'VEGA-RICH-TEXT-IMAGE-EDITOR' ? 1 : 0;
3166
+ }
3167
+ /**
3168
+ * Parse to a image block.
3169
+ *
3170
+ * @param {HTMLElement[]} elementsArray - Current elements.
3171
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3172
+ * @returns {Nullable<RTEContentBlock>} - Image block.
3173
+ */
3174
+ handle(elementsArray, options) {
3175
+ const element = elementsArray[0];
3176
+ const image = element.querySelector('img');
3177
+ if (typeGuard.isNonNullable(image)) {
3178
+ return RTEImageBlock.from({
3179
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3180
+ type: 'image',
3181
+ nodes: [
3182
+ {
3183
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3184
+ type: 'image',
3185
+ url: image.src,
3186
+ annotations: htmlElementToAnnotationGenerator.generate(RTEImageNode, element, options),
3187
+ },
3188
+ ],
3189
+ annotations: htmlElementToAnnotationGenerator.generate(RTEImageBlock, element.parentElement, options),
3190
+ }, options);
3191
+ }
3192
+ }
3193
+ /* istanbul ignore next */
3194
+ /**
3195
+ * Append child blocks.
3196
+ */
3197
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3198
+ appendChildBlocks() { }
3199
+ /**
3200
+ * Should continue process to child elements.
3201
+ *
3202
+ * @returns {boolean} - boolean.
3203
+ */
3204
+ shouldProceedToElementChildren() {
3205
+ return false;
3206
+ }
3207
+ }
3208
+
3209
+ /** Transform img in span or other inline element to image block DTO */
3210
+ class SpanImageToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
3211
+ /**
3212
+ * Can be handle.
3213
+ *
3214
+ * @param {HTMLElement[]} elementsArray - Current elements.
3215
+ * @param {number} currentIndex - Current element index.
3216
+ * @returns {number} - can be handled element count.
3217
+ */
3218
+ canHandle(elementsArray, currentIndex) {
3219
+ const element = elementsArray[currentIndex];
3220
+ return element.nodeType === Node.ELEMENT_NODE &&
3221
+ element.textContent === '' &&
3222
+ element.querySelector('img')
3223
+ ? 1
3224
+ : 0;
3225
+ }
3226
+ /**
3227
+ * Parse to a image block.
3228
+ *
3229
+ * @param {HTMLElement[]} elementsArray - Current elements.
3230
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3231
+ * @returns {Nullable<RTEContentBlock>} - Image block.
3232
+ */
3233
+ handle(elementsArray, options) {
3234
+ const element = elementsArray[0].querySelector('img');
3235
+ return this.createRTEImageBlock(element, options);
3236
+ }
3237
+ /* istanbul ignore next */
3238
+ /**
3239
+ * Append child blocks.
3240
+ */
3241
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3242
+ appendChildBlocks() { }
3243
+ /**
3244
+ * Should continue process to child elements.
3245
+ *
3246
+ * @returns {boolean} - boolean.
3247
+ */
3248
+ shouldProceedToElementChildren() {
3249
+ return false;
3250
+ }
3251
+ }
3252
+
3253
+ /** Transform continue inline block elements to text block DTO */
3254
+ class ContinueInlineToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstract {
3255
+ /**
3256
+ * Can be handle.
3257
+ *
3258
+ * @param {HTMLElement[]} elementsArray - Current elements.
3259
+ * @param {number} currentIndex - Current element index.
3260
+ * @returns {number} - can be handled element count.
3261
+ */
3262
+ canHandle(elementsArray, currentIndex) {
3263
+ let count = 0;
3264
+ for (let i = currentIndex; i < elementsArray.length; i++) {
3265
+ const element = elementsArray[i];
3266
+ if (element.nodeType === Node.TEXT_NODE ||
3267
+ (ContinueInlineToRTETextBlockStrategy.canHandleTags.includes(element.nodeName) &&
3268
+ !(element.textContent === '' && element.querySelector('IMG')))) {
3269
+ count++;
3270
+ }
3271
+ else {
3272
+ break;
3273
+ }
3274
+ }
3275
+ return count;
3276
+ }
3277
+ /**
3278
+ * Parse to a text block.
3279
+ *
3280
+ * @param {HTMLElement[]} elementsArray - Current elements.
3281
+ * @param {VegaRTETransformOptions} [options] - Options for transformation.
3282
+ * @returns {Nullable<RTEContentBlock>} - Text block.
3283
+ */
3284
+ handle(elementsArray, options) {
3285
+ const parent = elementsArray[0].parentElement;
3286
+ const autoMatchFormat = options && options.autoMatchFormat;
3287
+ const nodes = this.generateChildNodes(elementsArray, autoMatchFormat
3288
+ ? htmlElementToAnnotationGenerator.generate(codeBlock.RTETextNode, parent, Object.assign(Object.assign({}, options), { skipCustomAnnotations: true }))
3289
+ : {}, options);
3290
+ const blockType = autoMatchFormat
3291
+ ? super.matchTextBlockType(parent)
3292
+ : this.matchTextBlockTypeByTagName(parent);
3293
+ const internalWrapper = !autoMatchFormat && !blockType;
3294
+ return codeBlock.RTETextBlock.from(Object.assign({ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: blockType || 'paragraph', nodes: nodes }, (internalWrapper
3295
+ ? { annotations: { internalWrapper: internalWrapper } }
3296
+ : {
3297
+ annotations: htmlElementToAnnotationGenerator.generate(codeBlock.RTETextBlock, parent, options),
3298
+ })), options);
3299
+ }
3300
+ /* istanbul ignore next */
3301
+ /**
3302
+ * Append child blocks.
3303
+ */
3304
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3305
+ appendChildBlocks() { }
3306
+ /**
3307
+ * Should continue process to child elements.
3308
+ *
3309
+ * @returns {boolean} - boolean.
3310
+ */
3311
+ shouldProceedToElementChildren() {
3312
+ return false;
3313
+ }
3314
+ /**
3315
+ * Match the block type by tag name.
3316
+ *
3317
+ * @param {HTMLElement} element - Target element.
3318
+ * @returns {Nullable<VegaRTETextBlockType>} - Block type.
3319
+ */
3320
+ matchTextBlockTypeByTagName(element) {
3321
+ switch (element.nodeName) {
3322
+ case 'P':
3323
+ return 'paragraph';
3324
+ default:
3325
+ return null;
3326
+ }
3327
+ }
3328
+ }
3329
+ ContinueInlineToRTETextBlockStrategy.canHandleTags = [
3330
+ ...InlineHtmlAnnotationHandler.canHandleTags,
3331
+ 'CODE',
3332
+ 'A',
3333
+ 'VEGA-RICH-TEXT-LINK-EDITOR',
3334
+ 'BR',
3335
+ ];
3336
+
3337
+ /**
3338
+ * Class to handle text node elements and convert them to text node DTOs
3339
+ */
3340
+ class ElementToTextNodeStrategy extends ElementToDTOStrategy {
3341
+ /**
3342
+ * @inheritDoc
3343
+ */
3344
+ shouldProceedToElementChildren() {
3345
+ return false;
3346
+ }
3347
+ /**
3348
+ * @inheritDoc
3349
+ */
3350
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
3351
+ appendChildBlocks() { }
3352
+ /**
3353
+ * Generate text node DTO object
3354
+ *
3355
+ * @param {string} text - text content.
3356
+ * @param {VegaRTETextAnnotations} annotations - Current annotations.
3357
+ * @returns {VegaRTETextNode} - Text node DTO.
3358
+ */
3359
+ generateTextNode(text, annotations) {
3360
+ return {
3361
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3362
+ type: 'text',
3363
+ text: text,
3364
+ annotations: annotations,
3365
+ };
3366
+ }
3367
+ }
3368
+
3369
+ /**
3370
+ * Class to handle plain text nodes and convert them to RTE text node DTOs
3371
+ */
3372
+ class PlainTextToTextNodeStrategy extends ElementToTextNodeStrategy {
3373
+ /**
3374
+ * @inheritDoc
3375
+ */
3376
+ canHandle(elementsArray, currentIndex) {
3377
+ const element = elementsArray[currentIndex];
3378
+ return element.nodeType === Node.TEXT_NODE ? 1 : 0;
3379
+ }
3380
+ /**
3381
+ * @inheritDoc
3382
+ */
3383
+ handle(elementsArray, options, parentTextAnnotations) {
3384
+ const parentAnnotations = Object.assign({}, parentTextAnnotations);
3385
+ const disableAutoMatchFormat = !!(options && options.autoMatchFormat === false);
3386
+ const child = elementsArray[0];
3387
+ const parentNodeName = child.parentNode.nodeName.toLowerCase();
3388
+ const plainText = disableAutoMatchFormat && !codeBlock.RTETextNode.supportsHtmlTag(parentNodeName);
3389
+ const textNode = this.generateTextNode(String(child.textContent), disableAutoMatchFormat
3390
+ ? object.cleanObject(Object.assign(Object.assign({}, (parentNodeName === 'span'
3391
+ ? parentAnnotations
3392
+ : {
3393
+ // text node could be wrapped in <a> tag, so we need to keep the parent link annotation
3394
+ link: parentAnnotations.link,
3395
+ code: parentNodeName === 'code' ? parentAnnotations.code : undefined,
3396
+ })), { inlineHtml: parentAnnotations.inlineHtml, plainText: plainText || undefined }))
3397
+ : parentAnnotations);
3398
+ return Object.assign({}, textNode);
3399
+ }
3400
+ }
3401
+
3402
+ /**
3403
+ * Class to handle inline html element to text node dto
3404
+ */
3405
+ class InlineElementToTextNodeStrategy extends ElementToTextNodeStrategy {
3406
+ /**
3407
+ * @inheritDoc
3408
+ */
3409
+ canHandle(elementsArray, currentIndex) {
3410
+ const element = elementsArray[currentIndex];
3411
+ return ui.isHTMLElement(element) && (element.nodeName === 'BR' || element.childNodes.length === 0)
3412
+ ? 1
3413
+ : 0;
3414
+ }
3415
+ /**
3416
+ * @inheritDoc
3417
+ */
3418
+ handle(elementsArray, options, annotations) {
3419
+ const disableAutoMatchFormat = !!(options && options.autoMatchFormat === false);
3420
+ const parentAnnotations = Object.assign({}, annotations);
3421
+ const child = elementsArray[0];
3422
+ const curAnnotations = htmlElementToAnnotationGenerator.generate(codeBlock.RTETextNode, child, Object.assign({ parentAnnotations: disableAutoMatchFormat
3423
+ ? {
3424
+ inlineHtml: parentAnnotations.inlineHtml,
3425
+ link: parentAnnotations.link,
3426
+ code: parentAnnotations.code,
3427
+ }
3428
+ : annotations }, options));
3429
+ if (child.nodeName === 'BR') {
3430
+ return this.generateTextNode('\n', curAnnotations);
3431
+ }
3432
+ else if (child.childNodes.length === 0) {
3433
+ // For empty dom, there will be no internal iteration, we need to handle it directly here.
3434
+ // Example: <span></span>, <video src='...'></video>
3435
+ const emptyNodeAnnotations = disableAutoMatchFormat
3436
+ ? object.cleanObject(Object.assign(Object.assign({}, (codeBlock.RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) ? curAnnotations : {})), { inlineHtml: curAnnotations.inlineHtml, plainText: typeGuard.isNonNullable(curAnnotations.inlineHtml) }))
3437
+ : curAnnotations;
3438
+ return Object.assign({}, this.generateTextNode('', emptyNodeAnnotations));
3439
+ }
3440
+ }
3441
+ }
3442
+
3443
+ /**
3444
+ * Register and setup the default DTO classes and their basic action strategies.
3445
+ */
3446
+ // Register the default block DTOs
3447
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('paragraph', codeBlock.RTETextBlock);
3448
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('title', codeBlock.RTETextBlock);
3449
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('subtitle', codeBlock.RTETextBlock);
3450
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-1', codeBlock.RTETextBlock);
3451
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-2', codeBlock.RTETextBlock);
3452
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-3', codeBlock.RTETextBlock);
3453
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-4', codeBlock.RTETextBlock);
3454
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-5', codeBlock.RTETextBlock);
3455
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-6', codeBlock.RTETextBlock);
3456
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('heading-6', codeBlock.RTETextBlock);
3457
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('list-item', RTEListItemBlock);
3458
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('bullet-list', RTEListBlock);
3459
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('number-list', RTEListBlock);
3460
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('image', RTEImageBlock);
3461
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('code-block', codeBlock.RTECodeBlock);
3462
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('html-block', RTEHtmlBlock);
3463
+ // Register the default node DTOs
3464
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('text', codeBlock.RTETextNode);
3465
+ codeBlock.RTEDTOClassManager.registerRTEDTOClass('image', RTEImageNode);
3466
+ // Register basic strategies for default block DTOs
3467
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(codeBlock.RTETextBlock.name);
3468
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEListBlock.name);
3469
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEListItemBlock.name);
3470
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEImageBlock.name);
3471
+ RTEDTOActionStrategyManager$1.registerBlockBasicStrategies(RTEHtmlBlock.name);
3472
+ // Register element to DTO strategies for default node DTOs, The order of registration matters, the later registered strategy has higher priority.
3473
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ContinueInlineToRTETextBlockStrategy());
3474
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new SpanImageToRTEImageBlockStrategy());
3475
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaImageToRTEImageBlockStrategy());
3476
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ImgToRTEImageBlockStrategy());
3477
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new InlineBlockToRTETextBlockStrategy());
3478
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new JiraCodeToRTECodeBlockStrategy());
3479
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaCodeBlockToRTECodeBlockStrategy());
3480
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new LiToRTEListItemBlockStrategy());
3481
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ULNotLiChildToRTEListItemBlockStrategy());
3482
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new OlToRTEListBlockStrategy());
3483
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new UlToRTEListBlockStrategy());
3484
+ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new HtmlBlockStrategy());
3485
+ ElementToDTOClassStrategyManager.registerElementToNodeStrategy(new InlineElementToTextNodeStrategy());
3486
+ ElementToDTOClassStrategyManager.registerElementToNodeStrategy(new PlainTextToTextNodeStrategy());
3487
+
3488
+ /**
3489
+ * Class representing the content state of the rich text editor.
3490
+ */
3491
+ class VegaRTEContent {
3492
+ constructor(blocks) {
3493
+ blocks.forEach((block) => {
3494
+ block.parent = this;
3495
+ });
3496
+ this.children = blocks;
3497
+ }
3498
+ /**
3499
+ * Converts a JSON array of blocks to a class array of RTEContentBlock.
3500
+ *
3501
+ * @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
3502
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
3503
+ * @returns {VegaRTEContent} The converted array of RTEContentBlock.
3504
+ */
3505
+ static fromJSON(value, options = { autoMatchFormat: true }) {
3506
+ const blocks = value.map((block) => {
3507
+ const BlockClass = codeBlock.RTEDTOClassManager.getRTEBlockClass(block.type);
3508
+ if (BlockClass) {
3509
+ return BlockClass.from(block, options);
3510
+ }
3511
+ else {
3512
+ throw new Error(`[Vega] Unknown block type: ${block.type}`);
3513
+ }
3514
+ });
3515
+ return new VegaRTEContent(blocks);
3516
+ }
3517
+ /**
3518
+ * Create an empty content state
3519
+ *
3520
+ * @returns {VegaRTEContent} An empty content state
3521
+ */
3522
+ static createEmptyContent() {
3523
+ return VegaRTEContent.fromJSON([
3524
+ {
3525
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3526
+ type: 'paragraph',
3527
+ nodes: [
3528
+ {
3529
+ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
3530
+ type: 'text',
3531
+ text: '',
3532
+ },
3533
+ ],
3534
+ },
3535
+ ]);
3536
+ }
3537
+ /**
3538
+ * Converts HTML content to a VegaRTEContent instance.
3539
+ *
3540
+ * @param {string} html - The HTML string to convert.
3541
+ * @param {VegaRTETransformOptions} options - Optional transformation options.
3542
+ * @returns {VegaRTEContent} The converted content state.
3543
+ */
3544
+ static fromHtml(html, options = { autoMatchFormat: true, skipCustomAnnotations: false }) {
3545
+ /**
3546
+ * remove redundant spaces between tags, for example:
3547
+ * case1:
3548
+ * '<p>\n\t <span>test</span>\n\t </p>' will be formatted into '<p><span>test</span></p>'
3549
+ * '<p>
3550
+ * test
3551
+ * </p>' will be formatted into '<p>test</p>'
3552
+ *
3553
+ * case2:
3554
+ * <h1>
3555
+ * _test&*....
3556
+ * </h1> will be formatted into <h1>_test&*....</h1>
3557
+ *
3558
+ * The blank space between individual tags should be preserved:
3559
+ * <span> </span>
3560
+ */
3561
+ const formattedHtml = html
3562
+ .replace(/>\s+<\/?/g, (match) => {
3563
+ return match.endsWith('</') ? match : '><';
3564
+ })
3565
+ .replace(/(>)[\n\t]+(?=[a-zA-Z0-9_\W])/g, '$1')
3566
+ .replace(/([a-zA-Z0-9_\W])[\n\t]+(?=<)/g, '$1');
3567
+ const body = new DOMParser().parseFromString(formattedHtml, 'text/html').body;
3568
+ const blocks = ElementToDtoStrategyProcessor$1.process(Array.from(body.childNodes), options)
3569
+ .filter(typeGuard.isNonNullable)
3570
+ .map((output) => output.toDto(options))
3571
+ .filter(typeGuard.isNonNullable);
3572
+ return new VegaRTEContent(blocks);
3573
+ }
3574
+ /**
3575
+ * Clones the content state.
3576
+ *
3577
+ * @param {boolean} deep - If true, performs a deep clone of the content state.
3578
+ * @returns {VegaRTEContent} The cloned content state.
3579
+ */
3580
+ clone(deep = false) {
3581
+ return deep
3582
+ ? new VegaRTEContent(this.children.map((block) => block.clone()))
3583
+ : new VegaRTEContent([...this.children]);
3584
+ }
3585
+ /**
3586
+ * Converts the content state to a JSON array of blocks.
3587
+ *
3588
+ * @returns {VegaRTEContentBlock[]} The JSON array of blocks.
3589
+ */
3590
+ toJSON() {
3591
+ return this.children.map((block) => block.toJSON());
3592
+ }
3593
+ /**
3594
+ * Converts the content state to HTML.
3595
+ *
3596
+ * @param {VegaRTETransformOptions} [options] - Optional rendering context for the content.
3597
+ * @returns {string} The HTML representation of the content state.
3598
+ */
3599
+ toHtml(options) {
3600
+ return this.children.map((block) => block.toHtml(options)).join('');
3601
+ }
3602
+ /**
3603
+ * Internal method to add the block item, remove the block item
3604
+ *
3605
+ * @param {ModifyContentAction} action - Modify content action
3606
+ */
3607
+ apply(action) {
3608
+ codeBlock.ActionHandleStrategyRegistry.executeTheStrategy(action, this);
3609
+ }
3610
+ /**
3611
+ * Convert text to list.
3612
+ *
3613
+ * @param {RTETextBlock} block - block
3614
+ * @returns {RTEListItemBlock} list item block dto.
3615
+ */
3616
+ toListItem(block) {
3617
+ block.children.map((node) => node.apply(new codeBlock.SyncUpSelectionAction()));
3618
+ const listItemBlock = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
3619
+ listItemBlock.apply(new codeBlock.AppendChildrenAction(block['children']));
3620
+ listItemBlock['annotationMap'] = block['annotationMap'];
3621
+ return listItemBlock;
3622
+ }
3623
+ /**
3624
+ * create list.
3625
+ *
3626
+ * @param {ListType} type - type
3627
+ * @returns {RTEListBlock} list block dto.
3628
+ */
3629
+ createList(type) {
3630
+ return new RTEListBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), type);
3631
+ }
3632
+ /**
3633
+ * Finds a node by its ID in the content.
3634
+ *
3635
+ * @param {string} id - The ID of the node to find.
3636
+ * @returns {Nullable<RTENode>} The found node or null if not found.
3637
+ */
3638
+ findNodeById(id) {
3639
+ return this.findNodeInBlocksById(id, this.children);
3640
+ }
3641
+ /**
3642
+ * Recursively searches for a node by its ID in the given blocks.
3643
+ *
3644
+ * @param {string} id - The ID of the node to find.
3645
+ * @param {RTEContentBlock[]} blocks - The blocks to search within.
3646
+ * @returns {Nullable<RTENode>} The found node or null if not found.
3647
+ */
3648
+ findNodeInBlocksById(id, blocks) {
3649
+ for (const block of blocks) {
3650
+ if ('children' in block) {
3651
+ for (const node of block.children) {
3652
+ if (node.id === id) {
3653
+ return node;
3654
+ }
3655
+ }
3656
+ }
3657
+ if (block instanceof RTEListItemBlock && block.nestList) {
3658
+ for (const cBlock of block.nestList) {
3659
+ const foundNode = this.findNodeInBlocksById(id, cBlock.children);
3660
+ if (foundNode) {
3661
+ return foundNode;
3662
+ }
3663
+ }
3664
+ }
3665
+ if (block instanceof RTEListBlock && block.children) {
3666
+ const foundNode = this.findNodeInBlocksById(id, block.children);
3667
+ if (foundNode) {
3668
+ return foundNode;
3669
+ }
3670
+ }
3671
+ }
3672
+ return null;
3673
+ }
3674
+ }
3675
+ (() => {
3676
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_CHILDREN, VegaRTEContent.name, new codeBlock.RemoveChildrenStrategy());
3677
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.APPEND_CHILDREN, VegaRTEContent.name, new AppendChildrenStrategy());
3678
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_CHILDREN_BEFORE, VegaRTEContent.name, new InsertChildrenBeforeStrategy());
3679
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_CHILDREN_AFTER, VegaRTEContent.name, new InsertChildrenAfterStrategy());
3680
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.TRANSFORM_TO_CODE_BLOCK, VegaRTEContent.name, new BlockTransformToCodeBlockStrategy());
3681
+ codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.UPDATE_CURSOR_POSITION, VegaRTEContent.name, new UpdateCursorPositionStrategy());
3682
+ })();
3683
+
3684
+ exports.ElementToDtoStrategyProcessor = ElementToDtoStrategyProcessor$1;
3685
+ exports.ImageAnnotation = ImageAnnotation;
3686
+ exports.InsertNewParagraphAction = InsertNewParagraphAction;
3687
+ exports.MergeTwoBlocksNodesAction = MergeTwoBlocksNodesAction;
3688
+ exports.RTEImageBlock = RTEImageBlock;
3689
+ exports.RTEImageNode = RTEImageNode;
3690
+ exports.RTEListBlock = RTEListBlock;
3691
+ exports.RTEListItemBlock = RTEListItemBlock;
3692
+ exports.VegaRTEContent = VegaRTEContent;