@globalpayments/vega 2.38.0 → 2.39.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 (262) hide show
  1. package/dist/cjs/{app-globals-7087f121.js → app-globals-dd3e7925.js} +2 -3
  2. package/dist/cjs/content-state-c5b47ca1.js +6644 -0
  3. package/dist/cjs/{image-annotation-action-7d82f7e1.js → image-annotation-action-75b9c0d3.js} +5 -6
  4. package/dist/cjs/index.cjs.js +13 -14
  5. package/dist/cjs/loader.cjs.js +8 -9
  6. package/dist/cjs/vega-date-picker_2.cjs.entry.js +1 -1
  7. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  8. package/dist/cjs/vega-input-phone-number.cjs.entry.js +31 -7
  9. package/dist/cjs/vega-popover_2.cjs.entry.js +14 -0
  10. package/dist/cjs/vega-rich-text-content.cjs.entry.js +18 -19
  11. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +75 -79
  12. package/dist/cjs/vega.cjs.js +8 -9
  13. package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +18 -2
  14. package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +7 -4
  15. package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +4 -0
  16. package/dist/collection/components/vega-popover/vega-popover.js +37 -0
  17. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +52 -0
  18. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +63 -0
  19. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.js +21 -0
  20. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +32 -0
  21. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.js +13 -0
  22. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.js +134 -0
  23. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +47 -0
  24. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.js +19 -0
  25. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.js +21 -0
  26. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.js +54 -0
  27. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +152 -0
  28. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +99 -0
  29. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.js +15 -0
  30. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.js +38 -0
  31. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.js +31 -0
  32. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.js +57 -0
  33. 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
  34. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.js +55 -0
  35. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.js +14 -0
  36. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.js +14 -0
  37. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +25 -0
  38. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.js +15 -0
  39. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +21 -0
  40. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.js +28 -0
  41. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.js +17 -0
  42. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.js +48 -0
  43. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.js +43 -0
  44. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +26 -0
  45. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.js +32 -0
  46. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.js +21 -0
  47. 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
  48. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.js +44 -0
  49. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.js +12 -0
  50. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.js +22 -0
  51. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.js +20 -0
  52. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.js +15 -0
  53. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.js +92 -0
  54. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.js +22 -0
  55. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.js +19 -0
  56. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.js +15 -0
  57. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +27 -0
  58. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +36 -0
  59. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +63 -0
  60. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.js +46 -0
  61. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.js +20 -0
  62. package/dist/collection/components/vega-rich-text-editor/dto/actions/image-update-url-action.js +13 -0
  63. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -1
  64. package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +3 -215
  65. package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +31 -244
  66. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +17 -155
  67. package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +33 -184
  68. package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +40 -352
  69. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +13 -23
  70. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +14 -6
  71. package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +23 -182
  72. package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -1
  73. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +41 -0
  74. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.js +24 -0
  75. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +14 -0
  76. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +30 -0
  77. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.js +11 -0
  78. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.js +16 -0
  79. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +20 -0
  80. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +31 -0
  81. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +31 -0
  82. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +17 -0
  83. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +55 -0
  84. package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.js +23 -0
  85. package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +2 -2
  86. package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +7 -2
  87. package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +8 -0
  88. package/dist/esm/{app-globals-4cca4a96.js → app-globals-c954167a.js} +2 -3
  89. package/dist/esm/content-state-2edba4ec.js +6600 -0
  90. package/dist/esm/{form-field-controller-slimmer-3535e76a.js → form-field-controller-slimmer-7a9f2b2e.js} +1 -1
  91. package/dist/esm/{image-annotation-action-3da42221.js → image-annotation-action-b6668f48.js} +1 -2
  92. package/dist/esm/{index-6e05b241.js → index-d172bafa.js} +1 -1
  93. package/dist/esm/index.js +5 -6
  94. package/dist/esm/loader.js +9 -10
  95. package/dist/esm/{string-input-formatter-slimmer-d4132497.js → string-input-formatter-slimmer-418b54f0.js} +2 -2
  96. package/dist/esm/{sub-state-notify-slimmer-51151fc3.js → sub-state-notify-slimmer-b36fd081.js} +1 -1
  97. package/dist/esm/{sub-state-observer-slimmer-d77a1c46.js → sub-state-observer-slimmer-09452523.js} +1 -1
  98. package/dist/esm/vega-button-group_2.entry.js +3 -3
  99. package/dist/esm/vega-calendar_3.entry.js +3 -3
  100. package/dist/esm/vega-checkbox_2.entry.js +2 -2
  101. package/dist/esm/vega-color-picker.entry.js +2 -2
  102. package/dist/esm/vega-combo-box.entry.js +2 -2
  103. package/dist/esm/vega-date-picker_2.entry.js +5 -5
  104. package/dist/esm/vega-dropdown_5.entry.js +3 -3
  105. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  106. package/dist/esm/vega-file-uploader.entry.js +2 -2
  107. package/dist/esm/vega-form.entry.js +2 -2
  108. package/dist/esm/vega-image-uploader.entry.js +2 -2
  109. package/dist/esm/vega-input-credit-card.entry.js +2 -2
  110. package/dist/esm/vega-input-numeric.entry.js +3 -3
  111. package/dist/esm/vega-input-phone-number.entry.js +33 -9
  112. package/dist/esm/vega-input-range.entry.js +2 -2
  113. package/dist/esm/vega-input-select.entry.js +2 -2
  114. package/dist/esm/vega-input.entry.js +5 -5
  115. package/dist/esm/{vega-internal-event-id-d0690d0d.js → vega-internal-event-id-f269c42f.js} +1 -1
  116. package/dist/esm/vega-left-nav_5.entry.js +3 -3
  117. package/dist/esm/vega-popover_2.entry.js +15 -1
  118. package/dist/esm/vega-radio_2.entry.js +2 -2
  119. package/dist/esm/vega-rich-text-content.entry.js +6 -7
  120. package/dist/esm/vega-rich-text-editor_4.entry.js +21 -25
  121. package/dist/esm/vega-selection-chip_2.entry.js +4 -4
  122. package/dist/esm/vega-selection-tile_2.entry.js +4 -4
  123. package/dist/esm/vega-sidenav_3.entry.js +3 -3
  124. package/dist/esm/vega-signature-capture.entry.js +2 -2
  125. package/dist/esm/vega-stepper.entry.js +2 -2
  126. package/dist/esm/vega-table_8.entry.js +3 -3
  127. package/dist/esm/vega-textarea.entry.js +2 -2
  128. package/dist/esm/vega-time-picker_2.entry.js +2 -2
  129. package/dist/esm/vega-toggle-switch.entry.js +2 -2
  130. package/dist/esm/vega.js +9 -10
  131. package/dist/types/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.d.ts +7 -0
  132. package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +1 -0
  133. package/dist/types/components/vega-popover/vega-popover.d.ts +10 -0
  134. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +37 -0
  135. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +66 -0
  136. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.d.ts +15 -0
  137. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.d.ts +15 -0
  138. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.d.ts +13 -0
  139. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.d.ts +47 -0
  140. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.d.ts +15 -0
  141. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.d.ts +13 -0
  142. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.d.ts +16 -0
  143. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.d.ts +19 -0
  144. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +61 -0
  145. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.d.ts +19 -0
  146. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.d.ts +13 -0
  147. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.d.ts +23 -0
  148. 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
  149. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.d.ts +30 -0
  150. 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
  151. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.d.ts +29 -0
  152. 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
  153. 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
  154. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.d.ts +16 -0
  155. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.d.ts +13 -0
  156. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +17 -0
  157. 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
  158. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.d.ts +16 -0
  159. 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
  160. 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
  161. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.d.ts +15 -0
  162. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.d.ts +12 -0
  163. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.d.ts +15 -0
  164. 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
  165. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.d.ts +21 -0
  166. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.d.ts +12 -0
  167. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.d.ts +15 -0
  168. 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
  169. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.d.ts +15 -0
  170. 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
  171. 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
  172. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.d.ts +15 -0
  173. 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
  174. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +15 -0
  175. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.d.ts +12 -0
  176. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.d.ts +19 -0
  177. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.d.ts +20 -0
  178. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.d.ts +15 -0
  179. package/dist/types/components/vega-rich-text-editor/dto/actions/image-update-url-action.d.ts +11 -0
  180. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -2
  181. package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +1 -79
  182. package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +3 -77
  183. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -38
  184. package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +3 -58
  185. package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +5 -93
  186. package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +1 -2
  187. package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -43
  188. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.d.ts +1 -0
  189. 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
  190. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.d.ts +1 -0
  191. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +1 -0
  192. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.d.ts +1 -0
  193. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.d.ts +1 -0
  194. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +1 -0
  195. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.d.ts +1 -0
  196. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +1 -0
  197. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.d.ts +1 -0
  198. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +1 -0
  199. package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.d.ts +1 -0
  200. package/dist/types/components.d.ts +14 -0
  201. package/dist/types/helpers/validator/rules/valid-phone-number-rule.d.ts +3 -1
  202. package/dist/vega/index.esm.js +1 -1
  203. package/dist/vega/{p-ba077ca8.entry.js → p-073beb31.entry.js} +1 -1
  204. package/dist/vega/{p-6419e13e.entry.js → p-0b697841.entry.js} +1 -1
  205. package/dist/vega/p-0cc1ad76.js +1 -0
  206. package/dist/vega/{p-29d6ec6c.js → p-239bae84.js} +1 -1
  207. package/dist/vega/{p-7198d675.entry.js → p-24ac5151.entry.js} +1 -1
  208. package/dist/vega/{p-cb4fd6e1.entry.js → p-257b1bc2.entry.js} +1 -1
  209. package/dist/vega/{p-ba2833c0.entry.js → p-3c85a11b.entry.js} +1 -1
  210. package/dist/vega/{p-b517ed15.js → p-49bf2b3a.js} +1 -1
  211. package/dist/vega/p-4a8db510.entry.js +1 -0
  212. package/dist/vega/p-4b19706c.entry.js +1 -0
  213. package/dist/vega/{p-bf4996d5.entry.js → p-4e436842.entry.js} +1 -1
  214. package/dist/vega/{p-12fe63c1.entry.js → p-59834ea4.entry.js} +1 -1
  215. package/dist/vega/{p-50eabdca.entry.js → p-59cfed37.entry.js} +1 -1
  216. package/dist/vega/p-5f377954.js +1 -1
  217. package/dist/vega/p-60e1ebe1.entry.js +1 -0
  218. package/dist/vega/{p-23fd9401.entry.js → p-629bd266.entry.js} +1 -1
  219. package/dist/vega/p-6408d3dc.entry.js +1 -0
  220. package/dist/vega/{p-3e8f9fcf.entry.js → p-64e0c944.entry.js} +1 -1
  221. package/dist/vega/{p-b9a0f136.entry.js → p-64e49394.entry.js} +1 -1
  222. package/dist/vega/p-6e5db02b.js +1 -0
  223. package/dist/vega/{p-9689ad99.entry.js → p-74ff73d6.entry.js} +1 -1
  224. package/dist/vega/{p-b809f3d7.entry.js → p-8120e7a1.entry.js} +1 -1
  225. package/dist/vega/p-894c067a.entry.js +1 -0
  226. package/dist/vega/{p-e9785742.entry.js → p-989b36a2.entry.js} +1 -1
  227. package/dist/vega/{p-a2a34239.entry.js → p-9ee23f34.entry.js} +1 -1
  228. package/dist/vega/{p-34bd9204.js → p-a9e1123a.js} +1 -1
  229. package/dist/vega/{p-267cde46.entry.js → p-b071be5c.entry.js} +1 -1
  230. package/dist/vega/{p-1b67c443.entry.js → p-b6bffdf3.entry.js} +1 -1
  231. package/dist/vega/{p-20326c64.js → p-bd0116f9.js} +1 -1
  232. package/dist/vega/{p-a7e078ac.entry.js → p-bf6d3c00.entry.js} +1 -1
  233. package/dist/vega/{p-ecaf4cfa.entry.js → p-c00fde35.entry.js} +1 -1
  234. package/dist/vega/{p-7baa4fae.entry.js → p-c2e96537.entry.js} +1 -1
  235. package/dist/vega/{p-3cb90bdf.entry.js → p-ce94a9c5.entry.js} +1 -1
  236. package/dist/vega/{p-904b489a.entry.js → p-d03945cb.entry.js} +1 -1
  237. package/dist/vega/p-d2e6090a.js +1 -0
  238. package/dist/vega/{p-348e95ba.js → p-d2ff56d8.js} +1 -1
  239. package/dist/vega/p-e0d3ca2d.js +1 -0
  240. package/dist/vega/{p-ee2e4bff.entry.js → p-ea78ddfa.entry.js} +1 -1
  241. package/dist/vega/{p-e9a5bd12.entry.js → p-f1ebe86b.entry.js} +1 -1
  242. package/dist/vega/{p-497f2f86.entry.js → p-fc49a98e.entry.js} +1 -1
  243. package/dist/vega/vega.esm.js +1 -1
  244. package/package.json +1 -1
  245. package/dist/cjs/content-state-f97d3278.js +0 -2990
  246. package/dist/cjs/node-annotation.abstract-4f6df9cf.js +0 -3223
  247. package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.js +0 -12
  248. package/dist/collection/components/vega-rich-text-editor/dto/helper/block-base-operator.js +0 -47
  249. package/dist/esm/content-state-ccf5f960.js +0 -2954
  250. package/dist/esm/node-annotation.abstract-b2e36bc4.js +0 -3214
  251. package/dist/types/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.d.ts +0 -9
  252. package/dist/types/components/vega-rich-text-editor/dto/helper/block-base-operator.d.ts +0 -24
  253. package/dist/vega/p-0461e318.js +0 -1
  254. package/dist/vega/p-1d93b3a9.js +0 -1
  255. package/dist/vega/p-2fecbcf9.entry.js +0 -1
  256. package/dist/vega/p-52a8a4f8.js +0 -1
  257. package/dist/vega/p-7edcb8d0.entry.js +0 -1
  258. package/dist/vega/p-9728d571.entry.js +0 -1
  259. package/dist/vega/p-a7f40a65.entry.js +0 -1
  260. package/dist/vega/p-a8b16ff2.js +0 -1
  261. package/dist/vega/p-aed80794.entry.js +0 -1
  262. package/dist/vega/p-f86ec91b.js +0 -1
@@ -0,0 +1,92 @@
1
+ import { generateUUID } from '../../../../../utils/misc';
2
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
3
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
4
+ import { InsertBlocksBeforeAction } from '../../actions/insert-blocks-before-block';
5
+ import { RemoveChildAction } from '../../actions/remove-child-action';
6
+ import { SplitBlockWithNodeAction } from '../../actions/split-block-with-node-action';
7
+ import { NodeAnnotationTypeEnum } from '../../annotations/node-annotation.abstract';
8
+ import { RTETextBlock } from '../../blocks/text-block';
9
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
10
+ /**
11
+ * Insert new paragraph into current list item block at special position.
12
+ */
13
+ export class ListItemInsertNewParagraphStrategy extends ActionHandleStrategy {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ handleAction(action, target) {
18
+ action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset, target);
19
+ }
20
+ /**
21
+ * Breaks a single list item block at a specific position.
22
+ *
23
+ * @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
24
+ * @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
25
+ * @param {RTEListItemBlock} target - The list item block.
26
+ * @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
27
+ * position is at the end of the `splitNode`, or it returns the result of splitting the block at the
28
+ * caret position if it is neither at the start nor at the end.
29
+ */
30
+ breakSingleListItemBlock(splitNode, startOffsetOfNode, target) {
31
+ const newListItem = target.createNewListItem();
32
+ const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
33
+ newListItem.apply(new AppendChildNodesAction([newBreakNode]));
34
+ if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
35
+ return this.breakListItemAtEnd(newListItem, target);
36
+ }
37
+ else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
38
+ target.parent.apply(new InsertBlocksBeforeAction(target, newListItem));
39
+ }
40
+ else {
41
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
42
+ target.apply(splitBlockAction);
43
+ return splitBlockAction.newBlock;
44
+ }
45
+ return newListItem;
46
+ }
47
+ /**
48
+ * Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
49
+ *
50
+ * @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
51
+ * @param {RTEListItemBlock} target - The list item block.
52
+ * @returns {RTEBlock} Returns a `RTEBlock`.
53
+ */
54
+ breakListItemAtEnd(newListItem, target) {
55
+ const lastItem = target.parent.blocks[target.parent.blocks.length - 1];
56
+ const currentItemIsEmpty = target.nodes.length === 1 && target.nodes[0].isEmpty();
57
+ if (target === lastItem && currentItemIsEmpty) {
58
+ const parentParent = target.parent.parent;
59
+ if (parentParent['type'] !== 'list-item') {
60
+ const newParagraph = RTETextBlock.from({
61
+ id: generateUUID(),
62
+ type: 'paragraph',
63
+ nodes: [],
64
+ });
65
+ newParagraph.apply(new AppendChildNodesAction(newListItem.nodes));
66
+ parentParent.apply(new InsertBlocksAfterAction(target.parent, newParagraph));
67
+ target.parent.apply(new RemoveChildAction(target));
68
+ return newParagraph;
69
+ }
70
+ else {
71
+ parentParent.parent.apply(new InsertBlocksAfterAction(parentParent, newListItem));
72
+ target.parent.apply(new RemoveChildAction(target));
73
+ }
74
+ }
75
+ else {
76
+ target.parent.apply(new InsertBlocksAfterAction(target, newListItem));
77
+ }
78
+ return newListItem;
79
+ }
80
+ /**
81
+ * Copy the inline style to new node
82
+ *
83
+ * @param {RTETextNode} needCopedNode - The node that needed to be copied to
84
+ * @returns {RTETextNode} Returns a `RTETextNode`.
85
+ */
86
+ copyInlineStyleToNewNode(needCopedNode) {
87
+ const textNode = needCopedNode.cloneWithText('');
88
+ // The link annotation doesn't need to inherit
89
+ textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
90
+ return textNode;
91
+ }
92
+ }
@@ -0,0 +1,22 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Remove list item nest list block strategy.
4
+ */
5
+ export class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * Remove the nest list block from the list item, clear the property children when the children is empty.
8
+ *
9
+ * @param {RemoveNestListAction} action - The action instance.
10
+ * @param {RTEListItemBlock} target - The list item block.
11
+ */
12
+ handleAction(action, target) {
13
+ if (target.children) {
14
+ if (target.children.length > 1) {
15
+ target.children = target.children.filter((child) => child !== action.nestListBlockToBeRemoved);
16
+ }
17
+ else {
18
+ target.children = undefined;
19
+ }
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,19 @@
1
+ import { RemoveChildAction } from '../../actions/remove-child-action';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * Remove list item child node strategy.
5
+ */
6
+ export class ListItemRemoveNodeStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * Remove child node from the list item, remove the list item if the list item is empty.
9
+ *
10
+ * @param {RemoveChildAction} action - The remove child action instance.
11
+ * @param {RTEListItemBlock} target - The list item block.
12
+ */
13
+ handleAction(action, target) {
14
+ target.nodes = target.nodes.filter((node) => node !== action.entityToBeRemoved);
15
+ if (target.nodes.length === 0 && (!target.children || !target.children.length)) {
16
+ target.parent.apply(new RemoveChildAction(target));
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Replace list item nest list strategy.
4
+ */
5
+ export class ListItemReplaceNestListStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ action.newList.forEach((listBlock) => {
11
+ listBlock.parent = target;
12
+ });
13
+ target.children = action.newList;
14
+ }
15
+ }
@@ -0,0 +1,27 @@
1
+ import { RemoveChildAction } from '../../actions/remove-child-action';
2
+ import { RemoveNestListAction } from '../../actions/remove-nest-list-action';
3
+ import { BlockRemoveChildBlockStrategy } from './block-remove-child-block-strategy';
4
+ /**
5
+ * List remove list item strategy.
6
+ */
7
+ export class ListRemoveListItemStrategy extends BlockRemoveChildBlockStrategy {
8
+ /**
9
+ * Remove the list item, check the list item and remove self if the list item is empty.
10
+ *
11
+ * @param {RemoveChildAction} action - The remove action instance.
12
+ * @param {RTEListBlock} target - The list block.
13
+ */
14
+ handleAction(action, target) {
15
+ super.handleAction(action, target);
16
+ const parent = target.parent;
17
+ if (target.blocks.length === 0 && parent) {
18
+ // The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
19
+ if (parent['type'] === 'list-item') {
20
+ parent.apply(new RemoveNestListAction(target));
21
+ }
22
+ else {
23
+ parent.apply(new RemoveChildAction(target));
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,36 @@
1
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
2
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
3
+ import { RemoveChildAction } from '../../actions/remove-child-action';
4
+ import { SyncUpSelectionAction } from '../../actions/sync-up-selection-action';
5
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
6
+ /**
7
+ * Convert the selected blocks to list strategy.
8
+ */
9
+ export class ListTransformToListStrategy extends ActionHandleStrategy {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ handleAction(action, target) {
14
+ const selectedBlocks = action.selectedBlocks;
15
+ const bulletList = target.parent.createList(action.listType);
16
+ const isSameList = selectedBlocks.every((block) => block.parent === target);
17
+ if (isSameList) {
18
+ // Select one or more list items belonging to the same list, and all items in this list should be updated
19
+ bulletList.apply(new AppendChildNodesAction(target.blocks));
20
+ target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
21
+ target.parent.apply(new RemoveChildAction(target));
22
+ selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new SyncUpSelectionAction())));
23
+ }
24
+ else {
25
+ const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
26
+ bulletList.apply(new AppendChildNodesAction(listItems));
27
+ target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
28
+ action.selectedBlocks.forEach((block) => {
29
+ block.parent.apply(new RemoveChildAction(block));
30
+ });
31
+ if (target.blocks.length === 0) {
32
+ target.parent.apply(new RemoveChildAction(target));
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,63 @@
1
+ import { generateUUID } from '../../../../../utils/misc';
2
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
3
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
4
+ import { InsertBlocksBeforeAction } from '../../actions/insert-blocks-before-block';
5
+ import { RemoveChildAction } from '../../actions/remove-child-action';
6
+ import { SyncUpSelectionAction } from '../../actions/sync-up-selection-action';
7
+ import { RTETextBlock } from '../../blocks/text-block';
8
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
9
+ /**
10
+ * Convert the selected list block to paragraph strategy.
11
+ */
12
+ export class ListTransformToParagraphStrategy extends ActionHandleStrategy {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ handleAction(action, target) {
17
+ let isSelectedFirstBlock = false;
18
+ let isSelectedLastBlock = false;
19
+ const selectedBlocks = action.selectedBlocks;
20
+ const currentParagraph = selectedBlocks.map((block) => {
21
+ block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
22
+ if (block === target.blocks[0])
23
+ isSelectedFirstBlock = true;
24
+ if (block === target.blocks[target.blocks.length - 1])
25
+ isSelectedLastBlock = true;
26
+ return this.toParagraph(block);
27
+ });
28
+ if (isSelectedFirstBlock) {
29
+ target.parent.apply(new InsertBlocksBeforeAction(target, ...currentParagraph));
30
+ }
31
+ else if (isSelectedLastBlock) {
32
+ target.parent.apply(new InsertBlocksAfterAction(target, ...currentParagraph));
33
+ }
34
+ else {
35
+ const startIndex = target.blocks.indexOf(selectedBlocks[0]);
36
+ const lastIndex = target.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
37
+ const firstBulletList = target.parent.createList(target.type);
38
+ firstBulletList.apply(new AppendChildNodesAction(target.blocks.slice(0, startIndex)));
39
+ const lastBulletList = target.parent.createList(target.type);
40
+ lastBulletList.apply(new AppendChildNodesAction(target.blocks.slice(lastIndex + 1)));
41
+ target.parent.apply(new InsertBlocksBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
42
+ target.parent.apply(new RemoveChildAction(target));
43
+ }
44
+ selectedBlocks.map((block) => {
45
+ target.apply(new RemoveChildAction(block));
46
+ });
47
+ if (target.blocks.length === 0) {
48
+ target.parent.apply(new RemoveChildAction(target));
49
+ }
50
+ }
51
+ /**
52
+ * Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
53
+ *
54
+ * @param {RTEListItemBlock} block - The block that will be covered
55
+ * @returns {RTETextBlock} Returns a `RTETextBlock`.
56
+ */
57
+ toParagraph(block) {
58
+ const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
59
+ textBlock.apply(new AppendChildNodesAction(block['nodes']));
60
+ textBlock['annotationMap'] = block['annotationMap'];
61
+ return textBlock;
62
+ }
63
+ }
@@ -0,0 +1,46 @@
1
+ import stateEntityRenderingRegistry from '../../../slimmers/controllers/state-entity-rendering-registry';
2
+ import { UpdateTextAction } from '../../actions/update-text-action';
3
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
4
+ /**
5
+ * Replaces the rich text node selected text strategy.
6
+ */
7
+ export class NodeReplaceSelectedTextStrategy extends ActionHandleStrategy {
8
+ /**
9
+ * @inheritDoc
10
+ */
11
+ handleAction(action, target) {
12
+ this.replaceSelectedText(action.textToBeInsert, action.currentRange, target);
13
+ }
14
+ /**
15
+ * Replaces the selected text within a given range with a new text in a TypeScript class.
16
+ *
17
+ * @param {string} text - The new text that will replace the currently selected text within the specified range.
18
+ * @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
19
+ * @param {RTETextNode} target - The RTE text node instance.
20
+ */
21
+ replaceSelectedText(text, currentRange, target) {
22
+ if (currentRange && currentRange.startContainer && currentRange.endContainer) {
23
+ const { startContainer, endContainer, startOffset, endOffset } = currentRange;
24
+ let newText = target.text;
25
+ if (startContainer === endContainer && startOffset === endOffset && text) {
26
+ newText = target.text.slice(0, startOffset) + text + target.text.slice(startOffset);
27
+ }
28
+ else {
29
+ const startNode = startContainer.parentElement;
30
+ const endNode = endContainer.parentElement;
31
+ const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
32
+ const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
33
+ let startIndex = 0, endIndex = target.text.length;
34
+ if (startItemDto && startItemDto === target) {
35
+ startIndex = startOffset;
36
+ endIndex = startContainer === endContainer ? endOffset : endIndex;
37
+ }
38
+ else if (endItemDto && endItemDto === target) {
39
+ endIndex = endOffset;
40
+ }
41
+ newText = target.text.slice(0, startIndex) + text + target.text.slice(endIndex);
42
+ }
43
+ target.apply(new UpdateTextAction(newText));
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,20 @@
1
+ import { NodeAnnotationTypeEnum } from '../../annotations/node-annotation.abstract';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * Update the editor text node text content strategy.
5
+ */
6
+ export class NodeUpdateTextStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
9
+ *
10
+ * @param {UpdateTextAction} action - The update text action instance.
11
+ * @param {RTETextNode} target - The text node instance which need update the text.
12
+ */
13
+ handleAction(action, target) {
14
+ target.text = action.newTextContent;
15
+ // The link node should unlink when delete all text
16
+ if (!target.text && target.annotationMap.has('LINK')) {
17
+ target.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,13 @@
1
+ import { ModifyContentAction, ModifyContentActionType } from './modify-content-action.abstract';
2
+ /**
3
+ * Update the image node property url after the image uploaded.
4
+ *
5
+ * @example currentImageNode.apply(new ImageUpdateUrlAction(url))
6
+ */
7
+ export class ImageUpdateUrlAction extends ModifyContentAction {
8
+ constructor(newUrl) {
9
+ super();
10
+ this.type = ModifyContentActionType.UPDATE_IMAGE_NODE_URL;
11
+ this.url = newUrl;
12
+ }
13
+ }
@@ -5,7 +5,6 @@ export var ModifyContentActionType;
5
5
  ModifyContentActionType["UPDATE_TEXT"] = "UPDATE_TEXT";
6
6
  ModifyContentActionType["REPLACE_SELECTED_TEXT"] = "REPLACE_SELECTED_TEXT";
7
7
  ModifyContentActionType["APPEND_CHILD_NODES"] = "APPEND_CHILD_NODES";
8
- ModifyContentActionType["CLEAR_CHILD_NODES"] = "CLEAR_CHILD_NODES";
9
8
  ModifyContentActionType["INSERT_BLOCKS_AFTER"] = "INSERT_BLOCKS_AFTER";
10
9
  ModifyContentActionType["INSERT_BLOCKS_BEFORE"] = "INSERT_BLOCKS_BEFORE";
11
10
  ModifyContentActionType["INSERT_NODES_AFTER"] = "INSERT_NODES_AFTER";
@@ -21,6 +20,7 @@ export var ModifyContentActionType;
21
20
  ModifyContentActionType["TRANSFORM_PARAGRAPH_BLOCK"] = "TRANSFORM_PARAGRAPH_BLOCK";
22
21
  ModifyContentActionType["DELETE_BLOCK_CONTENT"] = "DELETE_BLOCK_CONTENT";
23
22
  ModifyContentActionType["INSERT_IMAGE_TO_BLOCK"] = "INSERT_IMAGE_TO_BLOCK";
23
+ ModifyContentActionType["UPDATE_IMAGE_NODE_URL"] = "UPDATE_IMAGE_NODE_URL";
24
24
  })(ModifyContentActionType || (ModifyContentActionType = {}));
25
25
  /**
26
26
  * Abstract class for update node content, delete node, insert node
@@ -6,16 +6,12 @@ import { VegaInternalRichTextEditorFlushChanges } from '../../../../helpers/even
6
6
  import { ModifyContentAction } from '../actions/modify-content-action.abstract';
7
7
  import { HorizontalAlignmentAnnotation } from '../annotations/horizontal-alignment-annotation';
8
8
  import { IndentAnnotation } from '../annotations/indent-annotation';
9
- import { BlockBaseOperator } from '../helper/block-base-operator';
10
- import { AppendChildNodesAction } from '../actions/append-child-nodes-action';
11
- import { RemoveChildAction } from '../actions/remove-child-action';
12
- import { ZERO_WIDTH_SPACE } from '../../constants/constant';
9
+ import { ActionHandleStrategyRegistry } from '../action-handle-strategies/action-handle-strategy-registry';
13
10
  /**
14
11
  * Abstract class for block
15
12
  */
16
- export class RTEBlock extends BlockBaseOperator {
13
+ export class RTEBlock {
17
14
  constructor(id) {
18
- super();
19
15
  this.annotationMap = new Map();
20
16
  this.id = id;
21
17
  }
@@ -85,7 +81,7 @@ export class RTEBlock extends BlockBaseOperator {
85
81
  */
86
82
  doApply(action) {
87
83
  if (action instanceof ModifyContentAction) {
88
- this.doModifyActionApply(action);
84
+ ActionHandleStrategyRegistry.executeTheStrategy(action, this);
89
85
  }
90
86
  else {
91
87
  this.applyAnnotationAction(action);
@@ -101,212 +97,4 @@ export class RTEBlock extends BlockBaseOperator {
101
97
  this.annotationMap.set(annotation.type, annotation);
102
98
  typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
103
99
  }
104
- /**
105
- * Appends a list of RTENode objects to the current node's child nodes and sets the parent block of each node to the current node.
106
- *
107
- * @param {RTENode[]} nodesToBeAppended - An array of `RTENode` objects that you want to append to the current block.
108
- */
109
- appendChildNodes(nodesToBeAppended) {
110
- nodesToBeAppended.forEach((node) => {
111
- node.parentBlock = this;
112
- });
113
- this['nodes'] = this['nodes'].concat(nodesToBeAppended);
114
- }
115
- /**
116
- * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
117
- *
118
- * @param {RTEBlock} secondBlock - A block of content in a rich text editor, such as a paragraph, heading, image, etc.
119
- */
120
- mergeTwoBlocksNodes(secondBlock) {
121
- if (this.type === secondBlock.type || (this.type !== 'image' && secondBlock.type !== 'image')) {
122
- let shouldMergeNodes = secondBlock['nodes'];
123
- if (this.type !== 'image') {
124
- shouldMergeNodes = secondBlock['nodes'].filter((node) => node['text'] && node['text'] !== ZERO_WIDTH_SPACE);
125
- }
126
- this.apply(new AppendChildNodesAction(shouldMergeNodes));
127
- secondBlock.parent.apply(new RemoveChildAction(secondBlock));
128
- }
129
- }
130
- /**
131
- * Concat the child nodes of multiple RTEBlocks if both are not images.
132
- *
133
- * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
134
- * @returns {RTENode[]} Array of connected block nodes
135
- */
136
- concatBlocksNodes(blocks) {
137
- const nodes = [];
138
- blocks.map((block) => {
139
- if (block.type !== 'image') {
140
- nodes.push(...block['nodes']);
141
- block.parent.apply(new RemoveChildAction(block));
142
- }
143
- });
144
- return nodes;
145
- }
146
- /**
147
- * Returns the previous node relative to the current node in a rich text editor structure.
148
- *
149
- * @param {RTENode} currentNode - An object of type `RTENode`.
150
- * @returns {Nullable<RTENode>} the previous block last node
151
- */
152
- getPreviousNode(currentNode) {
153
- const currentBlock = currentNode.parentBlock;
154
- const currentIndex = currentBlock['nodes'].indexOf(currentNode);
155
- if (currentIndex > 0) {
156
- return currentBlock['nodes'][currentIndex - 1];
157
- }
158
- else if (currentBlock.parent) {
159
- const previousBlock = this.getPreviousBlock(currentBlock);
160
- if (previousBlock) {
161
- return this.getBlockLastNode(previousBlock);
162
- }
163
- }
164
- }
165
- /**
166
- * Returns the next node relative to the current node in a rich text editor structure.
167
- *
168
- * @param {RTENode} currentNode - An object of type `RTENode`.
169
- * @returns {Nullable<RTENode>} the next block first node
170
- */
171
- getNextNode(currentNode) {
172
- const currentBlock = currentNode.parentBlock;
173
- const currentIndex = currentBlock['nodes'].indexOf(currentNode);
174
- if (currentBlock['nodes'][currentIndex + 1]) {
175
- return currentBlock['nodes'][currentIndex + 1];
176
- }
177
- else if (currentBlock.parent) {
178
- const nextBlock = this.getNextBlock(currentBlock);
179
- if (nextBlock) {
180
- return this.getBlockFirstNode(nextBlock);
181
- }
182
- }
183
- }
184
- /**
185
- * Determines if a given node is the first node within the current state.
186
- *
187
- * @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
188
- * @returns {boolean} True or false;
189
- */
190
- isContentFirstNode(currentNode) {
191
- const currentBlock = currentNode.parentBlock;
192
- const currentIndex = currentBlock['nodes'].indexOf(currentNode);
193
- const parent = currentBlock.parent;
194
- if (currentBlock.type === 'list-item') {
195
- const listParent = parent.parent;
196
- return (currentIndex === 0 &&
197
- Array.isArray(parent.blocks) &&
198
- parent.blocks[0] === currentBlock &&
199
- listParent['type'] !== 'list-item' &&
200
- Array.isArray(listParent.blocks) &&
201
- listParent.blocks[0] === parent);
202
- }
203
- else {
204
- return currentIndex === 0 && Array.isArray(parent.blocks) && parent.blocks[0] === currentBlock;
205
- }
206
- }
207
- /**
208
- * Returns the last node within a given RTE block, handling different block types accordingly.
209
- *
210
- * @param {RTEBlock} currentBlock - Returns the last node within that block.
211
- * @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
212
- */
213
- getBlockLastNode(currentBlock) {
214
- if (currentBlock.type === 'list-item') {
215
- if (currentBlock['children'] && currentBlock['children'].length > 0) {
216
- return this.getBlockLastNode(currentBlock['children'][currentBlock['children'].length - 1]);
217
- }
218
- else {
219
- return currentBlock['nodes'][currentBlock['nodes'].length - 1];
220
- }
221
- }
222
- else if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
223
- if (currentBlock.blocks) {
224
- const lastListItem = currentBlock.blocks[currentBlock.blocks.length - 1];
225
- return this.getBlockLastNode(lastListItem);
226
- }
227
- }
228
- else {
229
- if (currentBlock['nodes']) {
230
- return currentBlock['nodes'][currentBlock['nodes'].length - 1];
231
- }
232
- }
233
- }
234
- /**
235
- * Returns the first node within a given RTE block, handling different block types accordingly.
236
- *
237
- * @param {RTEBlock} currentBlock - Returns the first node within that block.
238
- * @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
239
- */
240
- getBlockFirstNode(currentBlock) {
241
- if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
242
- if (currentBlock.blocks) {
243
- const firstListItem = currentBlock.blocks[0];
244
- return this.getBlockFirstNode(firstListItem);
245
- }
246
- }
247
- else {
248
- if (currentBlock['nodes']) {
249
- return currentBlock['nodes'][0];
250
- }
251
- }
252
- }
253
- /**
254
- * TODO: The getPreviousBlock add nest list support
255
- * This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
256
- *
257
- * @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
258
- * @returns {Nullable<RTEBlock>} The previous block if existing
259
- */
260
- getPreviousBlock(currentBlock) {
261
- if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
262
- const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
263
- if (currentBlockIndex > 0) {
264
- return currentBlock.parent.blocks[currentBlockIndex - 1];
265
- }
266
- else if ((currentBlock.parent['type'] === 'number-list' ||
267
- currentBlock.parent['type'] === 'bullet-list') &&
268
- currentBlockIndex === 0) {
269
- return this.getPreviousBlock(currentBlock.parent);
270
- }
271
- }
272
- }
273
- /**
274
- * This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
275
- *
276
- * @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
277
- * @returns {Nullable<RTEBlock>} The next block if existing
278
- */
279
- getNextBlock(currentBlock) {
280
- if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
281
- const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
282
- if (currentBlock.parent.blocks[currentBlockIndex + 1]) {
283
- return currentBlock.parent.blocks[currentBlockIndex + 1];
284
- }
285
- else if (currentBlock.type === 'list-item' &&
286
- currentBlock.parent.blocks.length === currentBlockIndex + 1) {
287
- return this.getNextBlock(currentBlock.parent);
288
- }
289
- }
290
- }
291
- /**
292
- * Replaces a specific node with an array of nodes within a RTENode array.
293
- *
294
- * @param {RTENode} referNode - Used as a reference node to identify the node that needs to be replaced in the `nodes` array.
295
- * @param {RTENode[]} nodes - An array of RTENode objects that you want to replace the `referNode` with in the `nodes` array.
296
- */
297
- replaceNodeWithNodes(referNode, nodes) {
298
- if (this['nodes']) {
299
- nodes.forEach((node) => {
300
- node.parentBlock = this;
301
- });
302
- this['nodes'] = this['nodes'].flatMap((node) => {
303
- if (node === referNode) {
304
- return nodes;
305
- }
306
- else {
307
- return node;
308
- }
309
- });
310
- }
311
- }
312
100
  }