@globalpayments/vega 2.38.0 → 2.40.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 (435) hide show
  1. package/dist/cjs/{app-globals-7087f121.js → app-globals-cdd0972c.js} +14 -4
  2. package/dist/cjs/check-box-required-rule-1ee54b9a.js +70 -0
  3. package/dist/cjs/content-state-c5b47ca1.js +6644 -0
  4. package/dist/cjs/date-required-rule-4e1f84fd.js +92 -0
  5. package/dist/cjs/{element-appender-slimmer-c6e0f4ca.js → element-appender-slimmer-4f0dc8c6.js} +9 -5
  6. package/dist/cjs/file-uploader-required-rule-313ec9e3.js +21 -0
  7. package/dist/cjs/{form-field-controller-slimmer-48c0ad0b.js → form-field-controller-slimmer-d92e8212.js} +28 -1
  8. package/dist/cjs/{image-annotation-action-7d82f7e1.js → image-annotation-action-75b9c0d3.js} +5 -6
  9. package/dist/cjs/index.cjs.js +35 -15
  10. package/dist/cjs/input-phone-number-required-rule-2668fdf1.js +65 -0
  11. package/dist/cjs/input-range-required-rule-5b9c2a95.js +63 -0
  12. package/dist/cjs/internal-form-field-validation-rule.abstract-07cdff46.js +15 -0
  13. package/dist/cjs/loader.cjs.js +10 -10
  14. package/dist/cjs/{min-number-rule-115c5a3b.js → min-number-rule-5bcccc8f.js} +7 -4
  15. package/dist/cjs/{min-string-length-rule-75f24a48.js → min-string-length-rule-af215976.js} +8 -4
  16. package/dist/cjs/public-rules-90b972e5.js +42 -0
  17. package/dist/cjs/{required-field-rule-7f9945fa.js → required-field-rule-d73c1d8c.js} +6 -3
  18. package/dist/cjs/rich-text-editor-required-rule-cacc5fe0.js +64 -0
  19. package/dist/cjs/time-required-rule-ccf178e7.js +141 -0
  20. package/dist/cjs/toggle-switch-required-rule-88a51b36.js +66 -0
  21. package/dist/cjs/{valid-credit-card-number-rule-4a9ae5d9.js → valid-credit-card-number-rule-4a1b00b8.js} +3 -2
  22. package/dist/cjs/vega-checkbox_2.cjs.entry.js +11 -79
  23. package/dist/cjs/vega-color-picker.cjs.entry.js +3 -2
  24. package/dist/cjs/vega-combo-box.cjs.entry.js +3 -2
  25. package/dist/cjs/vega-date-picker_2.cjs.entry.js +9 -91
  26. package/dist/cjs/vega-dialog_2.cjs.entry.js +29 -1
  27. package/dist/cjs/vega-dropdown_5.cjs.entry.js +1 -1
  28. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  29. package/dist/cjs/vega-file-uploader.cjs.entry.js +5 -19
  30. package/dist/cjs/vega-form.cjs.entry.js +2 -1
  31. package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -2
  32. package/dist/cjs/vega-input-credit-card.cjs.entry.js +4 -3
  33. package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -2
  34. package/dist/cjs/vega-input-phone-number.cjs.entry.js +38 -70
  35. package/dist/cjs/vega-input-range.cjs.entry.js +6 -61
  36. package/dist/cjs/vega-input-select.cjs.entry.js +3 -2
  37. package/dist/cjs/vega-input.cjs.entry.js +7 -6
  38. package/dist/cjs/vega-popover_2.cjs.entry.js +15 -1
  39. package/dist/cjs/vega-radio_2.cjs.entry.js +3 -2
  40. package/dist/cjs/vega-rich-text-content.cjs.entry.js +18 -19
  41. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +79 -139
  42. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -2
  43. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -2
  44. package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -2
  45. package/dist/cjs/vega-stepper.cjs.entry.js +3 -2
  46. package/dist/cjs/vega-textarea.cjs.entry.js +4 -3
  47. package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -140
  48. package/dist/cjs/vega-toggle-switch.cjs.entry.js +4 -63
  49. package/dist/cjs/vega-tooltip_2.cjs.entry.js +53 -12
  50. package/dist/cjs/vega.cjs.js +10 -10
  51. package/dist/collection/components/vega-checkbox/vega-checkbox.css +82 -33
  52. package/dist/collection/components/vega-checkbox/vega-checkbox.js +8 -13
  53. package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +2 -2
  54. package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +18 -2
  55. package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +7 -4
  56. package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.js +9 -0
  57. package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-scroll-controller.js +16 -0
  58. package/dist/collection/components/vega-modal/vega-modal.js +6 -0
  59. package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +4 -0
  60. package/dist/collection/components/vega-popover/vega-popover.js +37 -0
  61. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +52 -0
  62. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +63 -0
  63. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.js +21 -0
  64. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +32 -0
  65. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.js +13 -0
  66. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.js +134 -0
  67. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +47 -0
  68. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.js +19 -0
  69. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.js +21 -0
  70. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.js +54 -0
  71. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +152 -0
  72. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +99 -0
  73. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.js +15 -0
  74. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.js +38 -0
  75. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.js +31 -0
  76. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.js +57 -0
  77. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.js +60 -0
  78. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.js +55 -0
  79. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.js +14 -0
  80. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.js +14 -0
  81. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +25 -0
  82. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.js +15 -0
  83. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +21 -0
  84. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.js +28 -0
  85. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.js +17 -0
  86. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.js +48 -0
  87. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.js +43 -0
  88. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +26 -0
  89. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.js +32 -0
  90. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.js +21 -0
  91. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.js +55 -0
  92. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.js +44 -0
  93. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.js +12 -0
  94. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.js +22 -0
  95. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.js +20 -0
  96. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.js +15 -0
  97. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.js +92 -0
  98. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.js +22 -0
  99. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.js +19 -0
  100. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.js +15 -0
  101. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +27 -0
  102. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +36 -0
  103. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +63 -0
  104. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.js +46 -0
  105. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.js +20 -0
  106. package/dist/collection/components/vega-rich-text-editor/dto/actions/image-update-url-action.js +13 -0
  107. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -1
  108. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +3 -215
  109. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +31 -244
  110. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +17 -155
  111. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +33 -184
  112. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +40 -352
  113. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +13 -23
  114. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +14 -6
  115. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +23 -182
  116. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -1
  117. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +41 -0
  118. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.js +24 -0
  119. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +14 -0
  120. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +30 -0
  121. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.js +11 -0
  122. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.js +16 -0
  123. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +20 -0
  124. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +31 -0
  125. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +31 -0
  126. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +17 -0
  127. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +55 -0
  128. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.js +23 -0
  129. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +2 -2
  130. package/dist/collection/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.js +45 -11
  131. package/dist/collection/components/vega-tooltip/vega-tooltip.js +12 -0
  132. package/dist/collection/global/scripts/before-vega-load.js +11 -0
  133. package/dist/collection/helpers/slimmers/element-appender-slimmer.js +8 -5
  134. package/dist/collection/helpers/slimmers/test/element-appender-slimmer.test.js +2 -0
  135. package/dist/collection/helpers/ui/element-appender.js +1 -0
  136. package/dist/collection/helpers/ui/test/element-appender.test.js +1 -0
  137. package/dist/collection/helpers/validator/form-field-controller.js +28 -1
  138. package/dist/collection/helpers/validator/public-rules.js +10 -0
  139. package/dist/collection/helpers/validator/rules/check-box-required-rule.js +4 -3
  140. package/dist/collection/helpers/validator/rules/date-range-rule.js +2 -1
  141. package/dist/collection/helpers/validator/rules/date-required-rule.js +5 -3
  142. package/dist/collection/helpers/validator/rules/email-field-rule.js +3 -2
  143. package/dist/collection/helpers/validator/rules/{object-array-required-rule.js → file-uploader-required-rule.js} +1 -1
  144. package/dist/collection/helpers/validator/rules/input-phone-number-required-rule.js +5 -3
  145. package/dist/collection/helpers/validator/rules/input-range-min-and-max-rule.js +3 -1
  146. package/dist/collection/helpers/validator/rules/input-range-required-rule.js +5 -4
  147. package/dist/collection/helpers/validator/rules/internal-form-field-validation-rule.abstract.js +11 -0
  148. package/dist/collection/helpers/validator/rules/max-number-rule.js +4 -2
  149. package/dist/collection/helpers/validator/rules/max-string-length-rule.js +4 -2
  150. package/dist/collection/helpers/validator/rules/min-and-max-date-rule.js +3 -1
  151. package/dist/collection/helpers/validator/rules/min-number-rule.js +4 -2
  152. package/dist/collection/helpers/validator/rules/min-string-length-rule.js +4 -2
  153. package/dist/collection/helpers/validator/rules/required-field-rule.js +5 -3
  154. package/dist/collection/helpers/validator/rules/rich-text-editor-required-rule.js +4 -3
  155. package/dist/collection/helpers/validator/rules/time-range-required-rule.js +5 -3
  156. package/dist/collection/helpers/validator/rules/time-range-rule.js +3 -1
  157. package/dist/collection/helpers/validator/rules/time-required-rule.js +5 -3
  158. package/dist/collection/helpers/validator/rules/toggle-switch-required-rule.js +4 -3
  159. package/dist/collection/helpers/validator/rules/valid-credit-card-number-rule.js +3 -2
  160. package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +11 -4
  161. package/dist/collection/helpers/validator/test/rules/file-uploader-required-rule.test.js +7 -0
  162. package/dist/collection/helpers/validator/test/rules/public-rules.test.js +80 -0
  163. package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +8 -0
  164. package/dist/collection/index.js +1 -0
  165. package/dist/esm/{app-globals-4cca4a96.js → app-globals-88fa3549.js} +14 -4
  166. package/dist/esm/check-box-required-rule-cb0aa339.js +68 -0
  167. package/dist/esm/content-state-2edba4ec.js +6600 -0
  168. package/dist/esm/{date-732bc749.js → date-c55b97f0.js} +1 -1
  169. package/dist/esm/date-required-rule-8944f3bf.js +90 -0
  170. package/dist/esm/{element-appender-slimmer-f5e703f3.js → element-appender-slimmer-d9155ee0.js} +9 -5
  171. package/dist/esm/file-uploader-required-rule-ad886d01.js +19 -0
  172. package/dist/esm/{form-field-controller-slimmer-3535e76a.js → form-field-controller-slimmer-bb64dec7.js} +29 -2
  173. package/dist/esm/{image-annotation-action-3da42221.js → image-annotation-action-b6668f48.js} +1 -2
  174. package/dist/esm/{index-6e05b241.js → index-d172bafa.js} +1 -1
  175. package/dist/esm/index.js +17 -7
  176. package/dist/esm/input-phone-number-required-rule-be6a5572.js +63 -0
  177. package/dist/esm/input-range-required-rule-3ad74776.js +61 -0
  178. package/dist/esm/internal-form-field-validation-rule.abstract-f5b6bdbf.js +13 -0
  179. package/dist/esm/loader.js +11 -11
  180. package/dist/esm/{min-number-rule-31d48b22.js → min-number-rule-a6082418.js} +7 -4
  181. package/dist/esm/{min-string-length-rule-c6a69eeb.js → min-string-length-rule-c31c89f4.js} +8 -4
  182. package/dist/esm/public-rules-413f6a17.js +27 -0
  183. package/dist/esm/{required-field-rule-368b31fa.js → required-field-rule-ab4bdc47.js} +6 -3
  184. package/dist/esm/rich-text-editor-required-rule-75cc2db0.js +62 -0
  185. package/dist/esm/{string-input-formatter-slimmer-d4132497.js → string-input-formatter-slimmer-418b54f0.js} +2 -2
  186. package/dist/esm/{sub-state-notify-slimmer-51151fc3.js → sub-state-notify-slimmer-b36fd081.js} +1 -1
  187. package/dist/esm/{sub-state-observer-slimmer-d77a1c46.js → sub-state-observer-slimmer-09452523.js} +1 -1
  188. package/dist/esm/time-required-rule-a01163b5.js +138 -0
  189. package/dist/esm/toggle-switch-required-rule-b3cf4302.js +64 -0
  190. package/dist/esm/{valid-credit-card-number-rule-2aef3ad5.js → valid-credit-card-number-rule-cc497bec.js} +3 -2
  191. package/dist/esm/vega-button-group_2.entry.js +3 -3
  192. package/dist/esm/vega-calendar_3.entry.js +4 -4
  193. package/dist/esm/vega-checkbox_2.entry.js +12 -80
  194. package/dist/esm/vega-color-picker.entry.js +4 -3
  195. package/dist/esm/vega-combo-box.entry.js +4 -3
  196. package/dist/esm/vega-date-picker_2.entry.js +12 -94
  197. package/dist/esm/vega-dialog_2.entry.js +29 -1
  198. package/dist/esm/vega-dropdown_5.entry.js +4 -4
  199. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  200. package/dist/esm/vega-file-uploader.entry.js +6 -20
  201. package/dist/esm/vega-form.entry.js +3 -2
  202. package/dist/esm/vega-image-uploader.entry.js +4 -3
  203. package/dist/esm/vega-input-credit-card.entry.js +5 -4
  204. package/dist/esm/vega-input-numeric.entry.js +5 -4
  205. package/dist/esm/vega-input-phone-number.entry.js +38 -70
  206. package/dist/esm/vega-input-range.entry.js +6 -61
  207. package/dist/esm/vega-input-select.entry.js +4 -3
  208. package/dist/esm/vega-input.entry.js +11 -10
  209. package/dist/esm/{vega-internal-event-id-d0690d0d.js → vega-internal-event-id-f269c42f.js} +1 -1
  210. package/dist/esm/vega-left-nav_5.entry.js +3 -3
  211. package/dist/esm/vega-popover_2.entry.js +16 -2
  212. package/dist/esm/vega-radio_2.entry.js +4 -3
  213. package/dist/esm/vega-rich-text-content.entry.js +6 -7
  214. package/dist/esm/vega-rich-text-editor_4.entry.js +23 -83
  215. package/dist/esm/vega-selection-chip_2.entry.js +6 -5
  216. package/dist/esm/vega-selection-tile_2.entry.js +6 -5
  217. package/dist/esm/vega-sidenav_3.entry.js +3 -3
  218. package/dist/esm/vega-signature-capture.entry.js +4 -3
  219. package/dist/esm/vega-stepper.entry.js +4 -3
  220. package/dist/esm/vega-table_8.entry.js +3 -3
  221. package/dist/esm/vega-textarea.entry.js +5 -4
  222. package/dist/esm/vega-time-picker_2.entry.js +8 -137
  223. package/dist/esm/vega-toggle-switch.entry.js +4 -63
  224. package/dist/esm/vega-tooltip_2.entry.js +53 -12
  225. package/dist/esm/vega.js +11 -11
  226. package/dist/types/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.d.ts +7 -0
  227. package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.d.ts +4 -0
  228. package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-scroll-controller.d.ts +5 -0
  229. package/dist/types/components/vega-modal/vega-modal.d.ts +1 -0
  230. package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +1 -0
  231. package/dist/types/components/vega-popover/vega-popover.d.ts +10 -0
  232. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +37 -0
  233. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +66 -0
  234. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.d.ts +15 -0
  235. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.d.ts +15 -0
  236. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.d.ts +13 -0
  237. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.d.ts +47 -0
  238. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.d.ts +15 -0
  239. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.d.ts +13 -0
  240. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.d.ts +16 -0
  241. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.d.ts +19 -0
  242. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +61 -0
  243. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.d.ts +19 -0
  244. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.d.ts +13 -0
  245. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.d.ts +23 -0
  246. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.d.ts +15 -0
  247. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.d.ts +30 -0
  248. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.d.ts +36 -0
  249. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.d.ts +29 -0
  250. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.d.ts +13 -0
  251. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.d.ts +13 -0
  252. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.d.ts +16 -0
  253. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.d.ts +13 -0
  254. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +17 -0
  255. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.d.ts +20 -0
  256. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.d.ts +16 -0
  257. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.d.ts +30 -0
  258. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.d.ts +24 -0
  259. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.d.ts +15 -0
  260. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.d.ts +12 -0
  261. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.d.ts +15 -0
  262. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.d.ts +27 -0
  263. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.d.ts +21 -0
  264. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.d.ts +12 -0
  265. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.d.ts +15 -0
  266. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.d.ts +15 -0
  267. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.d.ts +15 -0
  268. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.d.ts +38 -0
  269. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.d.ts +15 -0
  270. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.d.ts +15 -0
  271. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.d.ts +12 -0
  272. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +15 -0
  273. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.d.ts +12 -0
  274. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.d.ts +19 -0
  275. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.d.ts +20 -0
  276. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.d.ts +15 -0
  277. package/dist/types/components/vega-rich-text-editor/dto/actions/image-update-url-action.d.ts +11 -0
  278. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -2
  279. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +1 -79
  280. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +3 -77
  281. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -38
  282. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +3 -58
  283. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +5 -93
  284. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +1 -2
  285. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -43
  286. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.d.ts +1 -0
  287. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.d.ts +1 -0
  288. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +1 -0
  289. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.d.ts +1 -0
  290. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.d.ts +1 -0
  291. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +1 -0
  292. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.d.ts +1 -0
  293. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +1 -0
  294. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.d.ts +1 -0
  295. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +1 -0
  296. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.d.ts +1 -0
  297. package/dist/types/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.d.ts +18 -0
  298. package/dist/types/components/vega-tooltip/vega-tooltip.d.ts +4 -0
  299. package/dist/types/components.d.ts +14 -0
  300. package/dist/types/helpers/slimmers/element-appender-slimmer.d.ts +1 -0
  301. package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +2 -1
  302. package/dist/types/helpers/validator/form-field-controller.d.ts +10 -0
  303. package/dist/types/helpers/validator/public-rules.d.ts +10 -0
  304. package/dist/types/helpers/validator/rules/check-box-required-rule.d.ts +7 -6
  305. package/dist/types/helpers/validator/rules/date-range-rule.d.ts +3 -2
  306. package/dist/types/helpers/validator/rules/date-required-rule.d.ts +7 -6
  307. package/dist/types/helpers/validator/rules/email-field-rule.d.ts +4 -3
  308. package/dist/types/helpers/validator/rules/{object-array-required-rule.d.ts → file-uploader-required-rule.d.ts} +1 -1
  309. package/dist/types/helpers/validator/rules/input-phone-number-required-rule.d.ts +7 -6
  310. package/dist/types/helpers/validator/rules/input-range-min-and-max-rule.d.ts +3 -2
  311. package/dist/types/helpers/validator/rules/input-range-required-rule.d.ts +8 -7
  312. package/dist/types/helpers/validator/rules/internal-form-field-validation-rule.abstract.d.ts +19 -0
  313. package/dist/types/helpers/validator/rules/max-number-rule.d.ts +4 -3
  314. package/dist/types/helpers/validator/rules/max-string-length-rule.d.ts +4 -3
  315. package/dist/types/helpers/validator/rules/min-and-max-date-rule.d.ts +3 -2
  316. package/dist/types/helpers/validator/rules/min-number-rule.d.ts +4 -3
  317. package/dist/types/helpers/validator/rules/min-string-length-rule.d.ts +4 -3
  318. package/dist/types/helpers/validator/rules/required-field-rule.d.ts +7 -6
  319. package/dist/types/helpers/validator/rules/rich-text-editor-required-rule.d.ts +7 -6
  320. package/dist/types/helpers/validator/rules/time-range-required-rule.d.ts +7 -6
  321. package/dist/types/helpers/validator/rules/time-range-rule.d.ts +3 -2
  322. package/dist/types/helpers/validator/rules/time-required-rule.d.ts +7 -6
  323. package/dist/types/helpers/validator/rules/toggle-switch-required-rule.d.ts +5 -4
  324. package/dist/types/helpers/validator/rules/valid-credit-card-number-rule.d.ts +4 -3
  325. package/dist/types/helpers/validator/rules/valid-phone-number-rule.d.ts +7 -4
  326. package/dist/types/helpers/validator/test/rules/file-uploader-required-rule.test.d.ts +1 -0
  327. package/dist/types/helpers/validator/test/rules/public-rules.test.d.ts +1 -0
  328. package/dist/types/index.d.ts +1 -0
  329. package/dist/types/types/public-api.d.ts +1 -1
  330. package/dist/vega/index.esm.js +1 -1
  331. package/dist/vega/p-04c72f30.entry.js +1 -0
  332. package/dist/vega/{p-ba077ca8.entry.js → p-073beb31.entry.js} +1 -1
  333. package/dist/vega/p-07c2725a.js +1 -0
  334. package/dist/vega/{p-b5990090.js → p-08835909.js} +1 -1
  335. package/dist/vega/p-0b6d4561.entry.js +1 -0
  336. package/dist/vega/p-0bb860cc.js +1 -0
  337. package/dist/vega/p-0cc1ad76.js +1 -0
  338. package/dist/vega/p-113cd659.entry.js +1 -0
  339. package/dist/vega/{p-b9a0f136.entry.js → p-154d262e.entry.js} +1 -1
  340. package/dist/vega/p-17598aac.entry.js +1 -0
  341. package/dist/vega/p-23130825.entry.js +1 -0
  342. package/dist/vega/{p-29d6ec6c.js → p-239bae84.js} +1 -1
  343. package/dist/vega/{p-7198d675.entry.js → p-24ac5151.entry.js} +1 -1
  344. package/dist/vega/p-280cbcdb.js +1 -0
  345. package/dist/vega/p-3299c30b.entry.js +1 -0
  346. package/dist/vega/p-3fd9d39f.entry.js +1 -0
  347. package/dist/vega/p-42a949f5.entry.js +1 -0
  348. package/dist/vega/p-4bd1b877.entry.js +1 -0
  349. package/dist/vega/p-590fd123.js +1 -0
  350. package/dist/vega/p-5a7eabcc.js +1 -0
  351. package/dist/vega/p-5e56f3bd.js +1 -0
  352. package/dist/vega/p-5f377954.js +1 -1
  353. package/dist/vega/p-612c9374.entry.js +1 -0
  354. package/dist/vega/p-6408d3dc.entry.js +1 -0
  355. package/dist/vega/{p-a2a34239.entry.js → p-6585bddc.entry.js} +2 -2
  356. package/dist/vega/p-6603081a.entry.js +1 -0
  357. package/dist/vega/p-6e5db02b.js +1 -0
  358. package/dist/vega/p-6f90d444.js +1 -0
  359. package/dist/vega/p-7303fff2.entry.js +1 -0
  360. package/dist/vega/p-7b648a05.entry.js +1 -0
  361. package/dist/vega/p-7c0b4c36.js +1 -0
  362. package/dist/vega/p-81b21503.entry.js +1 -0
  363. package/dist/vega/p-8fae8f9e.js +1 -0
  364. package/dist/vega/p-924b4e24.js +1 -0
  365. package/dist/vega/{p-ee2e4bff.entry.js → p-94459733.entry.js} +1 -1
  366. package/dist/vega/p-a05ca459.entry.js +1 -0
  367. package/dist/vega/p-a3e80fb2.entry.js +1 -0
  368. package/dist/vega/p-a7a46358.entry.js +1 -0
  369. package/dist/vega/{p-34bd9204.js → p-a9e1123a.js} +1 -1
  370. package/dist/vega/p-abd7aeaa.js +1 -0
  371. package/dist/vega/{p-267cde46.entry.js → p-b071be5c.entry.js} +1 -1
  372. package/dist/vega/p-b24da503.entry.js +1 -0
  373. package/dist/vega/p-b44f3309.js +1 -0
  374. package/dist/vega/p-b9051ad2.js +1 -0
  375. package/dist/vega/{p-20326c64.js → p-bd0116f9.js} +1 -1
  376. package/dist/vega/{p-4ab0d645.js → p-c253d09c.js} +1 -1
  377. package/dist/vega/p-c56acdd5.entry.js +1 -0
  378. package/dist/vega/p-cdbbdcc2.js +1 -0
  379. package/dist/vega/p-d1a06058.entry.js +1 -0
  380. package/dist/vega/{p-348e95ba.js → p-d2ff56d8.js} +1 -1
  381. package/dist/vega/p-d51b04ce.entry.js +1 -0
  382. package/dist/vega/p-e0446879.js +1 -0
  383. package/dist/vega/p-e08b6542.entry.js +1 -0
  384. package/dist/vega/p-e0d3ca2d.js +1 -0
  385. package/dist/vega/{p-e9a5bd12.entry.js → p-f1ebe86b.entry.js} +1 -1
  386. package/dist/vega/p-f396c69a.js +1 -0
  387. package/dist/vega/p-fda6c178.entry.js +1 -0
  388. package/dist/vega/p-ffac4b8c.entry.js +1 -0
  389. package/dist/vega/vega.esm.js +1 -1
  390. package/package.json +1 -1
  391. package/dist/cjs/content-state-f97d3278.js +0 -2990
  392. package/dist/cjs/node-annotation.abstract-4f6df9cf.js +0 -3223
  393. package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.js +0 -12
  394. package/dist/collection/components/vega-rich-text-editor/dto/helper/block-base-operator.js +0 -47
  395. package/dist/collection/helpers/validator/test/rules/object-array-required-rule.test.js +0 -7
  396. package/dist/esm/content-state-ccf5f960.js +0 -2954
  397. package/dist/esm/node-annotation.abstract-b2e36bc4.js +0 -3214
  398. package/dist/types/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.d.ts +0 -9
  399. package/dist/types/components/vega-rich-text-editor/dto/helper/block-base-operator.d.ts +0 -24
  400. package/dist/vega/p-0461e318.js +0 -1
  401. package/dist/vega/p-12fe63c1.entry.js +0 -1
  402. package/dist/vega/p-1b67c443.entry.js +0 -1
  403. package/dist/vega/p-1d93b3a9.js +0 -1
  404. package/dist/vega/p-23fd9401.entry.js +0 -1
  405. package/dist/vega/p-2fecbcf9.entry.js +0 -1
  406. package/dist/vega/p-3152031c.js +0 -1
  407. package/dist/vega/p-3cb90bdf.entry.js +0 -1
  408. package/dist/vega/p-3e8f9fcf.entry.js +0 -1
  409. package/dist/vega/p-497f2f86.entry.js +0 -1
  410. package/dist/vega/p-50eabdca.entry.js +0 -1
  411. package/dist/vega/p-52a8a4f8.js +0 -1
  412. package/dist/vega/p-6419e13e.entry.js +0 -1
  413. package/dist/vega/p-66b9e86d.entry.js +0 -1
  414. package/dist/vega/p-74958b1a.js +0 -1
  415. package/dist/vega/p-7baa4fae.entry.js +0 -1
  416. package/dist/vega/p-7edcb8d0.entry.js +0 -1
  417. package/dist/vega/p-904b489a.entry.js +0 -1
  418. package/dist/vega/p-9689ad99.entry.js +0 -1
  419. package/dist/vega/p-9728d571.entry.js +0 -1
  420. package/dist/vega/p-a7e078ac.entry.js +0 -1
  421. package/dist/vega/p-a7f40a65.entry.js +0 -1
  422. package/dist/vega/p-a8a809e1.entry.js +0 -1
  423. package/dist/vega/p-a8b16ff2.js +0 -1
  424. package/dist/vega/p-aed80794.entry.js +0 -1
  425. package/dist/vega/p-b517ed15.js +0 -1
  426. package/dist/vega/p-b809f3d7.entry.js +0 -1
  427. package/dist/vega/p-ba2833c0.entry.js +0 -1
  428. package/dist/vega/p-bf4996d5.entry.js +0 -1
  429. package/dist/vega/p-cb4fd6e1.entry.js +0 -1
  430. package/dist/vega/p-e9785742.entry.js +0 -1
  431. package/dist/vega/p-ecaf4cfa.entry.js +0 -1
  432. package/dist/vega/p-f41102cd.js +0 -1
  433. package/dist/vega/p-f5b0ce61.js +0 -1
  434. package/dist/vega/p-f86ec91b.js +0 -1
  435. /package/dist/types/{helpers/validator/test/rules/object-array-required-rule.test.d.ts → components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.d.ts} +0 -0
@@ -56,6 +56,16 @@ export class VegaPopover {
56
56
  * @vegaVersion 2.8.0
57
57
  */
58
58
  this.showArrow = true;
59
+ /**
60
+ * Determines whether the popover's position is calculated relative to the screen.
61
+ *
62
+ * @VegaWarning When enabled (set to true), it overrides the positionRelativeTo property, making it ineffective.
63
+ *
64
+ * @VegaWarning Currently, when set to true, the position calculation may be inaccurate if the popover is placed inside a scrollable container within a shadowRoot (e.g., inside a vega-modal with scrollable content).
65
+ *
66
+ * @vegaVersion 2.39.0
67
+ */
68
+ this.isScreenPosition = false;
59
69
  /* istanbul ignore next */
60
70
  this.showPopover = () => {
61
71
  this.appenderController.show();
@@ -255,6 +265,33 @@ export class VegaPopover {
255
265
  "attribute": "show-arrow",
256
266
  "reflect": false,
257
267
  "defaultValue": "true"
268
+ },
269
+ "isScreenPosition": {
270
+ "type": "boolean",
271
+ "mutable": false,
272
+ "complexType": {
273
+ "original": "boolean",
274
+ "resolved": "boolean",
275
+ "references": {}
276
+ },
277
+ "required": false,
278
+ "optional": false,
279
+ "docs": {
280
+ "tags": [{
281
+ "name": "VegaWarning",
282
+ "text": "When enabled (set to true), it overrides the positionRelativeTo property, making it ineffective."
283
+ }, {
284
+ "name": "VegaWarning",
285
+ "text": "Currently, when set to true, the position calculation may be inaccurate if the popover is placed inside a scrollable container within a shadowRoot (e.g., inside a vega-modal with scrollable content)."
286
+ }, {
287
+ "name": "vegaVersion",
288
+ "text": "2.39.0"
289
+ }],
290
+ "text": "Determines whether the popover's position is calculated relative to the screen."
291
+ },
292
+ "attribute": "is-screen-position",
293
+ "reflect": false,
294
+ "defaultValue": "false"
258
295
  }
259
296
  }; }
260
297
  static get states() { return {
@@ -0,0 +1,52 @@
1
+ import { LogUtility } from '../../../../utils/log';
2
+ import { ModifyContentAction } from '../actions/modify-content-action.abstract';
3
+ /**
4
+ * The strategies registry, contains static methods `register`, `get` and `getStrategyAndExecute`.
5
+ */
6
+ export class ActionHandleStrategyRegistry {
7
+ /**
8
+ * Bind a specific strategy to a special action type of the rich text node.
9
+ *
10
+ * @param {string} actionType - The special action type or the action class name.
11
+ * @param {string} targetClass - The rich text node class name.
12
+ * @param {ActionHandleStrategy} strategy - The action handle strategy instance.
13
+ */
14
+ static register(actionType, targetClass, strategy) {
15
+ if (!this.registry.has(targetClass)) {
16
+ this.registry.set(targetClass, new Map());
17
+ }
18
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
19
+ this.registry.get(targetClass).set(actionType, strategy);
20
+ }
21
+ /**
22
+ * Get the special strategy that handle the action logic.
23
+ *
24
+ * @param {string} actionType - The special action type or the action class name.
25
+ * @param {string} targetClass - The rich text node class name.
26
+ * @returns {Nullable<ActionHandleStrategy>} - The action handle strategy instance if defined.
27
+ */
28
+ static get(actionType, targetClass) {
29
+ const strategyMap = this.registry.get(targetClass);
30
+ if (strategyMap) {
31
+ return strategyMap.get(actionType);
32
+ }
33
+ }
34
+ /**
35
+ * Get the special strategy from the registry and run the strategy execute method.
36
+ *
37
+ * @param {ModifyContentAction | AnnotationAction} action - The update node action instance.
38
+ * @param {RTENode | RTEBlock | VegaRTEContent} RTEInstance - The rich text editor node.
39
+ * @returns {unknown} The return value of the strategy method execute invoke result.
40
+ */
41
+ static executeTheStrategy(action, RTEInstance) {
42
+ const actionType = action instanceof ModifyContentAction ? action.type : action.constructor.name;
43
+ const strategy = ActionHandleStrategyRegistry.get(actionType, RTEInstance.constructor.name);
44
+ if (strategy) {
45
+ return strategy.execute(action, RTEInstance);
46
+ }
47
+ else {
48
+ LogUtility.error(`Type ${actionType} action handle strategy is not registered in class ${RTEInstance.constructor.name}`);
49
+ }
50
+ }
51
+ }
52
+ ActionHandleStrategyRegistry.registry = new Map();
@@ -0,0 +1,63 @@
1
+ import { LogUtility } from '../../../../utils/log';
2
+ /**
3
+ * The base action handle strategy class, use to modify the rich text node content or modify the annotation.
4
+ */
5
+ export class ActionHandleStrategy {
6
+ /**
7
+ * Public method to invoke the handle logic.
8
+ *
9
+ * @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
10
+ * @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
11
+ * @returns {unknown} - The invoke result in special strategy.
12
+ */
13
+ execute(action, target) {
14
+ LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
15
+ return this.handleAction(action, target);
16
+ }
17
+ /**
18
+ * Checks if the caret position is at the end of a specified RTETextNode.
19
+ *
20
+ * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
21
+ * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
22
+ * @param {number} startOffset - The position within the text node where the caret is located.
23
+ * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
24
+ */
25
+ isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
26
+ const lastNode = textBlock.nodes[textBlock.nodes.length - 1];
27
+ return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
28
+ }
29
+ /**
30
+ * Checks if the caret position is at the start of a specified RTETextNode.
31
+ *
32
+ * @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
33
+ * @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
34
+ * @param {number} startOffset - The position within the text node where the caret is located.
35
+ * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
36
+ */
37
+ isCaretPositionAtTextBlockStart(textBlock, node, startOffset) {
38
+ return node === textBlock.nodes[0] && startOffset === 0;
39
+ }
40
+ /**
41
+ * Checks if the caret position is at the start of a specified RTEImageNode.
42
+ *
43
+ * @param {RTEImageBlock} target - The image block.
44
+ * @param {RTEImageNode} node - `RTEImageNode` - a node representing an image in a rich text editor.
45
+ * @param {number} startOffset - The position within the text node where the caret is located.
46
+ * @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTEImageNode.
47
+ */
48
+ isCaretPositionAtImageBlockStart(target, node, startOffset) {
49
+ return node === target.nodes[0] && startOffset === 0;
50
+ }
51
+ /**
52
+ * Checks if the caret position is at the end of a given RTEImageNode.
53
+ *
54
+ * @param {RTEImageBlock} target - The image block.
55
+ * @param {RTEImageNode} node - `node` is a RTEImageNode
56
+ * @param {number} startOffset - The position within the `RTEImageNode` where the caret is located.
57
+ * @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEImageNode`.
58
+ */
59
+ isCaretPositionAtImageBlockEnd(target, node, startOffset) {
60
+ const lastNode = target.nodes[target.nodes.length - 1];
61
+ return node === lastNode && startOffset === 1;
62
+ }
63
+ }
@@ -0,0 +1,21 @@
1
+ import { InternalAnnotationTypeEnum } from '../../annotations/annotation.abstract';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * Update the text block link group annotation strategy.
5
+ */
6
+ export class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * Update link group after the child link node update.
9
+ *
10
+ * @param {LinkGroupAnnotationAction} action - The link group annotation action instance.
11
+ * @param {RTETextBlock} target - The current text block.
12
+ */
13
+ handleAction(action, target) {
14
+ const linkGroupAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
15
+ if (linkGroupAnnotation) {
16
+ const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
17
+ linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
18
+ target.annotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,32 @@
1
+ import { BoldAnnotationAction } from '../../actions/bold-annotation-action';
2
+ import { DeleteNodeAnnotationAction } from '../../actions/delete-node-annotation-action';
3
+ import { NodeAnnotationTypeEnum } from '../../annotations/node-annotation.abstract';
4
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
5
+ /**
6
+ * Update the text block text style strategy.
7
+ */
8
+ export class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
9
+ /**
10
+ * Update the text block type and add or remove the bold style from child nodes.
11
+ *
12
+ * @param {TextStyleAnnotationAction} action - The text style annotation action.
13
+ * @param {RTETextBlock} target - The current text block.
14
+ */
15
+ handleAction(action, target) {
16
+ if (target.type !== 'list-item') {
17
+ target.type = action.textStyle;
18
+ }
19
+ if (action.bold) {
20
+ target.nodes.forEach((node) => {
21
+ const boldAnnotationAction = new BoldAnnotationAction(true);
22
+ boldAnnotationAction.doSplit = false;
23
+ node.apply(boldAnnotationAction);
24
+ });
25
+ }
26
+ else {
27
+ target.nodes.forEach((node) => {
28
+ node.apply(new DeleteNodeAnnotationAction(NodeAnnotationTypeEnum.BOLD));
29
+ });
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,13 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Update the image node annotation map strategy.
4
+ */
5
+ export class ImageSetAnnotationMapStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ const annotation = action.toAnnotation();
11
+ target.annotationMap.set(annotation.type, annotation);
12
+ }
13
+ }
@@ -0,0 +1,134 @@
1
+ import { InternalAnnotationTypeEnum } from '../../annotations/annotation.abstract';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ import { TextSplittableAction } from '../../actions/splittable-action.abstract';
4
+ import stateEntityRenderingRegistry from '../../../slimmers/controllers/state-entity-rendering-registry';
5
+ /**
6
+ * Split the text node into two or there nodes according to the rules.
7
+ */
8
+ export class NodeSplitTextStrategy extends ActionHandleStrategy {
9
+ constructor() {
10
+ super(...arguments);
11
+ // The new create node that need apply annotation or the current target. This property used to export after the execute method invoke.
12
+ this.applyTargetNode = null;
13
+ }
14
+ /**
15
+ * Split the text node.
16
+ *
17
+ * @param {TextSplittableAction} action - The split action.
18
+ * @param {RTETextNode} target - The text node that need to be splited.
19
+ * @returns {Nullable<RTETextNode>} - The new insert text node or the current text node that need to apply the action.
20
+ */
21
+ handleAction(action, target) {
22
+ const selectionRangeAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
23
+ this.setApplyTargetNode(null);
24
+ if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
25
+ const { startContainer, endContainer, startOffset, endOffset } = selectionRangeAnnotation.range;
26
+ const noTextRangeSelected = startContainer === endContainer && startOffset === endOffset;
27
+ target.parentBlock.nodes = target.parentBlock.nodes.flatMap((item) => {
28
+ if (item.id === target.id) {
29
+ if (noTextRangeSelected) {
30
+ return this.insertNewNode(startOffset, target);
31
+ }
32
+ if (this.shouldSplitSelection(selectionRangeAnnotation.range)) {
33
+ return this.splitTextNode(selectionRangeAnnotation.range, target);
34
+ }
35
+ else {
36
+ this.setApplyTargetNode(target);
37
+ return target;
38
+ }
39
+ }
40
+ return item;
41
+ });
42
+ }
43
+ return this.applyTargetNode;
44
+ }
45
+ /**
46
+ * Insert the new node at the start offset
47
+ *
48
+ * @param {number} startOffset - The start position offset
49
+ * @param {RTETextNode} target - RTETextNode
50
+ * @returns {RTETextNode[]} - RTETextNode array
51
+ */
52
+ insertNewNode(startOffset, target) {
53
+ const newNode = target.cloneWithText('');
54
+ this.setApplyTargetNode(newNode);
55
+ if (startOffset === 0) {
56
+ return [newNode, target];
57
+ }
58
+ if (startOffset === target.text.length) {
59
+ return [target, newNode];
60
+ }
61
+ const beforeNode = target.cloneWithText(target.text.substring(0, startOffset));
62
+ const afterNode = target.cloneWithText(target.text.substring(startOffset));
63
+ return [beforeNode, newNode, afterNode];
64
+ }
65
+ /**
66
+ * Whether a given range should be split based on various conditions within the range.
67
+ *
68
+ * @param {Range} range - Selection range
69
+ * @returns {boolean} Returns a boolean value indicating whether the selection range should be split.
70
+ */
71
+ shouldSplitSelection(range) {
72
+ const { startContainer, endContainer, startOffset, endOffset } = range;
73
+ const isCrossNode = startContainer !== endContainer;
74
+ const isPartialStart = startOffset > 0;
75
+ const isPartialEnd = endOffset < (endContainer.textContent ? endContainer.textContent.length : 0);
76
+ const isPartialSelection = isPartialStart || isPartialEnd;
77
+ return isCrossNode || isPartialSelection;
78
+ }
79
+ /**
80
+ * Split text node with range
81
+ *
82
+ * @param {Range} range - Selection range
83
+ * @param {RTETextNode} target - RTETextNode
84
+ * @returns {RTETextNode[] | this} RTETextNode array
85
+ */
86
+ splitTextNode(range, target) {
87
+ const { startContainer, endContainer, startOffset } = range;
88
+ const startNode = startContainer.parentElement;
89
+ const endNode = endContainer.parentElement;
90
+ /**
91
+ * Split the text from the start offset to the end offset
92
+ *
93
+ * @param {string} text - The text string
94
+ * @param {number} startOffset - The start offset position
95
+ * @param {number} endOffset - The end offset position
96
+ * @returns {RTETextNode[]} - The split text node array
97
+ */
98
+ const splitText = (text, startOffset, endOffset) => {
99
+ const beforeText = text.substring(0, startOffset);
100
+ const selectedText = text.substring(startOffset, endOffset);
101
+ const afterText = text.substring(endOffset);
102
+ return [
103
+ target.cloneWithText(beforeText),
104
+ target.cloneWithText(selectedText),
105
+ target.cloneWithText(afterText),
106
+ ];
107
+ };
108
+ const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
109
+ const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
110
+ if (startItemDto && startItemDto.id === target.id) {
111
+ const endOffset = startContainer === endContainer ? range.endOffset : target.text.length;
112
+ const [beforeNode, selectedNode, afterNode] = splitText(target.text, startOffset, endOffset);
113
+ this.setApplyTargetNode(selectedNode);
114
+ return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
115
+ }
116
+ else if (endItemDto && endItemDto.id === target.id) {
117
+ const [beforeNode, selectedNode, afterNode] = splitText(target.text, 0, range.endOffset);
118
+ this.setApplyTargetNode(selectedNode);
119
+ return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
120
+ }
121
+ else {
122
+ this.setApplyTargetNode(target);
123
+ return target;
124
+ }
125
+ }
126
+ /**
127
+ * Store the text node which need to apply the annotation. Clear the value if the input is null.
128
+ *
129
+ * @param {RTETextNode | null} node - The new text node.
130
+ */
131
+ setApplyTargetNode(node) {
132
+ this.applyTargetNode = node;
133
+ }
134
+ }
@@ -0,0 +1,47 @@
1
+ import { isNonNullable } from '../../../../../types/type-guard';
2
+ import { ClearFormattingAnnotationAction } from '../../actions/clear-formatting-annotation-action';
3
+ import { CodeAnnotationAction } from '../../actions/code-annotation-action';
4
+ import { DeleteNodeAnnotationAction } from '../../actions/delete-node-annotation-action';
5
+ import { LinkAnnotationAction } from '../../actions/link-annotation-action';
6
+ import { LinkGroupAnnotationAction } from '../../actions/link-group-annotation-action';
7
+ import { ClearFormattingAnnotation } from '../../annotations/clear-formatting-annotation';
8
+ import { NodeAnnotation } from '../../annotations/node-annotation.abstract';
9
+ import { SelectionRangeAnnotation } from '../../annotations/selection-range-annotation';
10
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
11
+ /**
12
+ * The current strategy used to modify the text node annotation map.
13
+ */
14
+ export class NodeUpdateAnnotationMapStrategy extends ActionHandleStrategy {
15
+ /**
16
+ * Remove or set annotation to the text node annotation map.
17
+ *
18
+ * @param {AnnotationAction} action - The annotation action instance.
19
+ * @param {RTETextNode} target - The current text node.
20
+ */
21
+ handleAction(action, target) {
22
+ const annotation = action.toAnnotation();
23
+ if (action instanceof DeleteNodeAnnotationAction) {
24
+ target.annotationMap.delete(action.annotationType);
25
+ return;
26
+ }
27
+ if (annotation instanceof ClearFormattingAnnotation) {
28
+ annotation.items.forEach((item) => {
29
+ target.deleteAnnotationByType(item);
30
+ });
31
+ return;
32
+ }
33
+ if (annotation instanceof NodeAnnotation || annotation instanceof SelectionRangeAnnotation) {
34
+ if (action instanceof LinkAnnotationAction) {
35
+ if (isNonNullable(action.newText)) {
36
+ target.text = action.newText;
37
+ }
38
+ target.parentBlock.apply(new LinkGroupAnnotationAction(action.link.groupKey, [target]));
39
+ }
40
+ if (action instanceof CodeAnnotationAction) {
41
+ this.handleAction(new ClearFormattingAnnotationAction(), target);
42
+ }
43
+ target.annotationMap.set(annotation.type, annotation);
44
+ return;
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,19 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Append new block array to list block or VegaRTEContent instance strategy.
4
+ */
5
+ export class BlockAppendBlocksStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ const newBlocks = action.entityToBeAppended;
11
+ if (target.blocks) {
12
+ newBlocks.forEach((block) => {
13
+ block.parent = target;
14
+ });
15
+ const arrayFixed = target.blocks;
16
+ target.blocks = arrayFixed.concat(newBlocks);
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,21 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Append the nodes to the text block or image block strategy.
4
+ */
5
+ export class BlockAppendNodesStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * Append the text nodes to the text block or the image block.
8
+ *
9
+ * @param {AppendChildNodesAction} action - The remove child action instance.
10
+ * @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
11
+ */
12
+ handleAction(action, target) {
13
+ const nodesToBeAppended = action.entityToBeAppended;
14
+ nodesToBeAppended.forEach((node) => {
15
+ node.parentBlock = target;
16
+ });
17
+ // This line is used to fix the typescript error `This expression is not callable`. https://github.com/microsoft/TypeScript/issues/44373
18
+ const arrayFixed = target.nodes;
19
+ target.nodes = arrayFixed.concat(nodesToBeAppended);
20
+ }
21
+ }
@@ -0,0 +1,54 @@
1
+ import { RemoveChildAction } from '../../actions/remove-child-action';
2
+ import { RTEImageNode } from '../../nodes/image-node';
3
+ import { BlockDeleteNodeContentStrategy } from './block-delete-node-content-strategy';
4
+ /**
5
+ * The image block delete the image node strategy.
6
+ */
7
+ export class BlockDeleteImageStrategy extends BlockDeleteNodeContentStrategy {
8
+ /**
9
+ * @inheritDoc
10
+ */
11
+ handleAction(action, target) {
12
+ this.deleteNodeContent(action, target);
13
+ }
14
+ /**
15
+ * Deletes content from a block node based on specific conditions.
16
+ *
17
+ * @param {DeleteBlockContentAction} action - Delete block content action
18
+ * @param {RTEImageBlock} target - The image block.
19
+ */
20
+ deleteNodeContent(action, target) {
21
+ const startContainerNode = action
22
+ .startContainerNode, startOffset = action.startOffset;
23
+ let previousNode = this.getPreviousNode(startContainerNode);
24
+ let nextNode = null;
25
+ if (startOffset === 1) {
26
+ const parentBlock = target;
27
+ if (this.isContentFirstNode(startContainerNode)) {
28
+ nextNode = this.getNextNode(startContainerNode);
29
+ }
30
+ if (parentBlock.nodes.length === 1) {
31
+ parentBlock.parent.apply(new RemoveChildAction(parentBlock));
32
+ }
33
+ else {
34
+ parentBlock.apply(new RemoveChildAction(startContainerNode));
35
+ }
36
+ }
37
+ else {
38
+ const shouldRemoveNode = previousNode;
39
+ if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
40
+ previousNode = this.getPreviousNode(shouldRemoveNode);
41
+ shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
42
+ if (!previousNode) {
43
+ action.nextNode = startContainerNode;
44
+ }
45
+ }
46
+ }
47
+ if (previousNode) {
48
+ action.previousNode = previousNode;
49
+ }
50
+ else if (nextNode) {
51
+ action.nextNode = nextNode;
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,152 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
4
+ */
5
+ export class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * Returns the previous node relative to the current node in a rich text editor structure.
8
+ *
9
+ * @param {RTENode} currentNode - An object of type `RTENode`.
10
+ * @returns {Nullable<RTENode>} the previous block last node
11
+ */
12
+ getPreviousNode(currentNode) {
13
+ const currentBlock = currentNode.parentBlock;
14
+ const currentIndex = currentBlock['nodes'].indexOf(currentNode);
15
+ if (currentIndex > 0) {
16
+ return currentBlock['nodes'][currentIndex - 1];
17
+ }
18
+ else if (currentBlock.parent) {
19
+ const previousBlock = this.getPreviousBlock(currentBlock);
20
+ if (previousBlock) {
21
+ return this.getBlockLastNode(previousBlock);
22
+ }
23
+ }
24
+ }
25
+ /**
26
+ * Returns the next node relative to the current node in a rich text editor structure.
27
+ *
28
+ * @param {RTENode} currentNode - An object of type `RTENode`.
29
+ * @returns {Nullable<RTENode>} the next block first node
30
+ */
31
+ getNextNode(currentNode) {
32
+ const currentBlock = currentNode.parentBlock;
33
+ const currentIndex = currentBlock['nodes'].indexOf(currentNode);
34
+ if (currentBlock['nodes'][currentIndex + 1]) {
35
+ return currentBlock['nodes'][currentIndex + 1];
36
+ }
37
+ else if (currentBlock.parent) {
38
+ const nextBlock = this.getNextBlock(currentBlock);
39
+ if (nextBlock) {
40
+ return this.getBlockFirstNode(nextBlock);
41
+ }
42
+ }
43
+ }
44
+ /**
45
+ * Determines if a given node is the first node within the current state.
46
+ *
47
+ * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
48
+ * @returns {boolean} True or false;
49
+ */
50
+ isContentFirstNode(currentNode) {
51
+ const currentBlock = currentNode.parentBlock;
52
+ const currentIndex = currentBlock['nodes'].indexOf(currentNode);
53
+ const parent = currentBlock.parent;
54
+ if (currentBlock.type === 'list-item') {
55
+ const listParent = parent.parent;
56
+ return (currentIndex === 0 &&
57
+ Array.isArray(parent['blocks']) &&
58
+ parent['blocks'][0] === currentBlock &&
59
+ listParent['type'] !== 'list-item' &&
60
+ Array.isArray(listParent['blocks']) &&
61
+ listParent['blocks'][0] === parent);
62
+ }
63
+ else {
64
+ return (currentIndex === 0 && Array.isArray(parent['blocks']) && parent['blocks'][0] === currentBlock);
65
+ }
66
+ }
67
+ /**
68
+ * TODO: The getPreviousBlock add nest list support
69
+ * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
70
+ *
71
+ * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
72
+ * @returns {Nullable<RTEBlock>} The previous block if existing
73
+ */
74
+ getPreviousBlock(currentBlock) {
75
+ if (currentBlock && currentBlock.parent && currentBlock.parent['blocks']) {
76
+ const currentBlockIndex = currentBlock.parent['blocks'].indexOf(currentBlock);
77
+ if (currentBlockIndex > 0) {
78
+ return currentBlock.parent['blocks'][currentBlockIndex - 1];
79
+ }
80
+ else if ((currentBlock.parent['type'] === 'number-list' ||
81
+ currentBlock.parent['type'] === 'bullet-list') &&
82
+ currentBlockIndex === 0) {
83
+ return this.getPreviousBlock(currentBlock.parent);
84
+ }
85
+ }
86
+ }
87
+ /**
88
+ * Returns the last node within a given RTE block, handling different block types accordingly.
89
+ *
90
+ * @param {RTEBlock} currentBlock - Returns the last node within that block.
91
+ * @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
92
+ */
93
+ getBlockLastNode(currentBlock) {
94
+ if (currentBlock.type === 'list-item') {
95
+ if (currentBlock['children'] && currentBlock['children'].length > 0) {
96
+ return this.getBlockLastNode(currentBlock['children'][currentBlock['children'].length - 1]);
97
+ }
98
+ else {
99
+ return currentBlock['nodes'][currentBlock['nodes'].length - 1];
100
+ }
101
+ }
102
+ else if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
103
+ const listItems = currentBlock.blocks;
104
+ if (listItems) {
105
+ const lastListItem = listItems[listItems.length - 1];
106
+ return this.getBlockLastNode(lastListItem);
107
+ }
108
+ }
109
+ else {
110
+ if (currentBlock['nodes']) {
111
+ return currentBlock['nodes'][currentBlock['nodes'].length - 1];
112
+ }
113
+ }
114
+ }
115
+ /**
116
+ * Returns the first node within a given RTE block, handling different block types accordingly.
117
+ *
118
+ * @param {RTEBlock} currentBlock - Returns the first node within that block.
119
+ * @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
120
+ */
121
+ getBlockFirstNode(currentBlock) {
122
+ if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
123
+ if (currentBlock.blocks) {
124
+ const firstListItem = currentBlock.blocks[0];
125
+ return this.getBlockFirstNode(firstListItem);
126
+ }
127
+ }
128
+ else {
129
+ if (currentBlock['nodes']) {
130
+ return currentBlock['nodes'][0];
131
+ }
132
+ }
133
+ }
134
+ /**
135
+ * This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
136
+ *
137
+ * @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
138
+ * @returns {Nullable<RTEBlock>} The next block if existing
139
+ */
140
+ getNextBlock(currentBlock) {
141
+ if (currentBlock && currentBlock.parent && currentBlock.parent['blocks']) {
142
+ const currentBlockIndex = currentBlock.parent['blocks'].indexOf(currentBlock);
143
+ if (currentBlock.parent['blocks'][currentBlockIndex + 1]) {
144
+ return currentBlock.parent['blocks'][currentBlockIndex + 1];
145
+ }
146
+ else if (currentBlock.type === 'list-item' &&
147
+ currentBlock.parent.blocks.length === currentBlockIndex + 1) {
148
+ return this.getNextBlock(currentBlock.parent);
149
+ }
150
+ }
151
+ }
152
+ }