@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,60 @@
1
+ import { generateUUID } from '../../../../../utils/misc';
2
+ import { RemoveChildAction } from '../../actions/remove-child-action';
3
+ import { ReplaceChildNodesAction } from '../../actions/replace-child-nodes-action';
4
+ import { RTETextNode } from '../../nodes/text-node';
5
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
6
+ /**
7
+ * Insert a line break node into multiple blocks selection at special position strategy.
8
+ */
9
+ export class BlockInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ handleAction(action, target) {
14
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
15
+ }
16
+ /**
17
+ * lineBreakMultipleBlocks
18
+ *
19
+ * @param {RTEBlock[]} selectedBlocks -
20
+ * @param {RTETextBlock} target -
21
+ * @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
22
+ */
23
+ lineBreakMultipleBlocks(selectedBlocks, target) {
24
+ const beforeNodes = target.nodes;
25
+ const lineBreakNode = new RTETextNode(generateUUID(), '\n', target);
26
+ const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
27
+ this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes, target);
28
+ return lineBreakNode;
29
+ }
30
+ /**
31
+ * Concat the child nodes of multiple RTEBlocks if both are not images.
32
+ *
33
+ * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
34
+ * @returns {RTENode[]} Array of connected block nodes
35
+ */
36
+ concatBlocksNodes(blocks) {
37
+ const nodes = [];
38
+ blocks.map((block) => {
39
+ if (block.type !== 'image') {
40
+ nodes.push(...block['nodes']);
41
+ block.parent.apply(new RemoveChildAction(block));
42
+ }
43
+ });
44
+ return nodes;
45
+ }
46
+ /**
47
+ * mergeLineBreakNodes
48
+ *
49
+ * @param {RTENode[]} beforeNodes -
50
+ * @param {RTETextNode} lineBreakNode -
51
+ * @param {RTENode[]} afterNodes -
52
+ * @param {RTETextBlock} target -
53
+ */
54
+ mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes, target) {
55
+ if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
56
+ afterNodes.push(new RTETextNode(generateUUID(), '\n', target, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
57
+ }
58
+ target.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
59
+ }
60
+ }
@@ -0,0 +1,55 @@
1
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
2
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
3
+ import { InsertBlocksBeforeAction } from '../../actions/insert-blocks-before-block';
4
+ import { SplitBlockWithNodeAction } from '../../actions/split-block-with-node-action';
5
+ import { NodeAnnotationTypeEnum } from '../../annotations/node-annotation.abstract';
6
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
7
+ /**
8
+ * Insert new paragraph into current text block at special position.
9
+ */
10
+ export class BlockInsertNewParagraphStrategy extends ActionHandleStrategy {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ handleAction(action, target) {
15
+ action.newBlock = this.breakSingleTextBlock(action.startContainerNode, action.startOffset, target);
16
+ }
17
+ /**
18
+ * breakSingleTextBlock
19
+ *
20
+ * @param {RTETextNode} splitNode -
21
+ * @param {number} startOffsetOfNode -
22
+ * @param {RTETextBlock} target -
23
+ * @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
24
+ */
25
+ breakSingleTextBlock(splitNode, startOffsetOfNode, target) {
26
+ const newParagraph = this.copyInlineStyleToNewParagraph(splitNode, target);
27
+ if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
28
+ target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
29
+ }
30
+ else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
31
+ target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
32
+ }
33
+ else {
34
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
35
+ target.apply(splitBlockAction);
36
+ return splitBlockAction.newBlock;
37
+ }
38
+ return newParagraph;
39
+ }
40
+ /**
41
+ * copyInlineStyleToNewParagraph
42
+ *
43
+ * @param {RTETextNode} needCopedNode - The text node.
44
+ * @param {RTETextBlock} target - The text block.
45
+ * @returns {RTETextBlock} - The new paragraph.
46
+ */
47
+ copyInlineStyleToNewParagraph(needCopedNode, target) {
48
+ const textNode = needCopedNode.cloneWithText('');
49
+ // The link annotation don't need inherited
50
+ textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
51
+ const newParagraph = target.createNewParagraph();
52
+ newParagraph.apply(new AppendChildNodesAction([textNode]));
53
+ return newParagraph;
54
+ }
55
+ }
@@ -0,0 +1,14 @@
1
+ import { BlockReplaceNodeWithNodesStrategy } from './block-replace-node-with-nodes-strategy';
2
+ /**
3
+ * Insert some text nodes at the behind of the node strategy.
4
+ */
5
+ export class BlockInsertNodesAfterNodeStrategy extends BlockReplaceNodeWithNodesStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ const referNode = action.referNode;
11
+ const nodes = [referNode, ...action.nodesToBeInserted];
12
+ this.replaceNodeWithNodes(target, referNode, nodes);
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ import { BlockReplaceNodeWithNodesStrategy } from './block-replace-node-with-nodes-strategy';
2
+ /**
3
+ * Insert some text nodes at the before of the node strategy.
4
+ */
5
+ export class BlockInsertNodesBeforeNodeStrategy extends BlockReplaceNodeWithNodesStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ const referNode = action.referNode;
11
+ const nodes = [...action.nodesToBeInserted, referNode];
12
+ this.replaceNodeWithNodes(target, referNode, nodes);
13
+ }
14
+ }
@@ -0,0 +1,25 @@
1
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
2
+ import { RemoveChildAction } from '../../actions/remove-child-action';
3
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
4
+ /**
5
+ * Append the second block child nodes to the first block child nodes and remove the second block strategy.
6
+ */
7
+ export class BlockMergeNodesStrategy extends ActionHandleStrategy {
8
+ /**
9
+ * Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
10
+ *
11
+ * @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
12
+ * @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
13
+ */
14
+ handleAction(action, target) {
15
+ const anotherBlock = action.blockNeedToBeMerged;
16
+ if (target.type === anotherBlock.type || (target.type !== 'image' && anotherBlock.type !== 'image')) {
17
+ let shouldMergeNodes = anotherBlock['nodes'];
18
+ if (anotherBlock['type'] !== 'image') {
19
+ shouldMergeNodes = anotherBlock['nodes'].filter((node) => node.text);
20
+ }
21
+ target.apply(new AppendChildNodesAction(shouldMergeNodes));
22
+ anotherBlock.parent.apply(new RemoveChildAction(anotherBlock));
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,15 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * List block or VegaRTEContent remove child block strategy.
4
+ */
5
+ export class BlockRemoveChildBlockStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ const blockToBeRemoved = action.entityToBeRemoved;
11
+ if (target.blocks) {
12
+ target.blocks = target.blocks.filter((block) => block !== blockToBeRemoved);
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ import { RemoveChildAction } from '../../actions/remove-child-action';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * Remove the node from the text block or image block strategy.
5
+ */
6
+ export class BlockRemoveNodeStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * Remove the text node from the parent text block or remove the image node from the parent image block.
9
+ * Remove the block if the block nodes is empty after delete the current node.
10
+ *
11
+ * @param {RemoveChildAction} action - The remove child action instance.
12
+ * @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
13
+ */
14
+ handleAction(action, target) {
15
+ const arrayFixed = target.nodes;
16
+ target.nodes = arrayFixed.filter((node) => node !== action.entityToBeRemoved);
17
+ if (target.nodes.length === 0 && target.parent) {
18
+ target.parent.apply(new RemoveChildAction(target));
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,28 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Replace the node with new node array strategy.
4
+ */
5
+ export class BlockReplaceNodeWithNodesStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * Replace the current node to the new node array.
8
+ *
9
+ * @param {RTEBlock} target - The image block or the text block.
10
+ * @param {RTENode} referNode - The text node or the image node.
11
+ * @param {RTENode[]} newNodes - The array of the text node or the image node.
12
+ */
13
+ replaceNodeWithNodes(target, referNode, newNodes) {
14
+ if (target['nodes']) {
15
+ newNodes.forEach((node) => {
16
+ node.parentBlock = target;
17
+ });
18
+ target['nodes'] = target['nodes'].flatMap((node) => {
19
+ if (node === referNode) {
20
+ return newNodes;
21
+ }
22
+ else {
23
+ return node;
24
+ }
25
+ });
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,17 @@
1
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * Remove all nodes and append new nodes strategy.
5
+ */
6
+ export class BlockReplaceNodesStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * Empty the text block or image block nodes and add new nodes.
9
+ *
10
+ * @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
11
+ * @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
12
+ */
13
+ handleAction(action, target) {
14
+ target.nodes = [];
15
+ target.apply(new AppendChildNodesAction(action.newChildNodes));
16
+ }
17
+ }
@@ -0,0 +1,48 @@
1
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
2
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
3
+ import { ReplaceChildNodesAction } from '../../actions/replace-child-nodes-action';
4
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
5
+ /**
6
+ * Split the current image block with a special position strategy.
7
+ */
8
+ export class BlockSplitWithImageNodeStrategy extends ActionHandleStrategy {
9
+ /**
10
+ * @inheritDoc
11
+ */
12
+ handleAction(action, target) {
13
+ action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
14
+ }
15
+ /**
16
+ * The image offset should be 0 or 1
17
+ * <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
18
+ *
19
+ * @param {RTEImageNode} imageNode The split point image node.
20
+ * @param {number} imageOffset The cursor point 0 | 1.
21
+ * @param {RTEImageBlock} target The image block.
22
+ * @returns {Nullable<RTEBlock>} The new block after split
23
+ */
24
+ splitImageNodes(imageNode, imageOffset, target) {
25
+ const nodesSplitIndex = target.nodes.indexOf(imageNode);
26
+ if (nodesSplitIndex > -1) {
27
+ const beforeNodes = target.nodes.slice(0, nodesSplitIndex + imageOffset);
28
+ const afterNodes = target.nodes.slice(nodesSplitIndex + imageOffset);
29
+ target.apply(new ReplaceChildNodesAction(beforeNodes));
30
+ const newBlock = this.cloneWithNodes(afterNodes, target);
31
+ target.parent.apply(new InsertBlocksAfterAction(target, newBlock));
32
+ return newBlock;
33
+ }
34
+ }
35
+ /**
36
+ * Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
37
+ *
38
+ * @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
39
+ * @param {RTEImageBlock} target The image block.
40
+ * @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
41
+ */
42
+ cloneWithNodes(nodes, target) {
43
+ const block = target.createNewImageBlock();
44
+ block.nodes = [];
45
+ block.apply(new AppendChildNodesAction(nodes));
46
+ return block;
47
+ }
48
+ }
@@ -0,0 +1,43 @@
1
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
2
+ import { ReplaceChildNodesAction } from '../../actions/replace-child-nodes-action';
3
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
4
+ /**
5
+ * Split the current node with a special position strategy.
6
+ */
7
+ export class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
8
+ /**
9
+ * @inheritDoc
10
+ */
11
+ handleAction(action, target) {
12
+ action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode, target);
13
+ }
14
+ /**
15
+ * Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
16
+ *
17
+ * @param {RTETextNode} splitNode - The text node that will be split
18
+ * @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
19
+ * @param {RTETextBlock} textBlock - The text block need to be splited.
20
+ * @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
21
+ */
22
+ splitTextNodeBlock(splitNode, startOffsetOfNode, textBlock) {
23
+ if (splitNode) {
24
+ const beforeText = splitNode.text.slice(0, startOffsetOfNode);
25
+ const afterText = splitNode.text.slice(startOffsetOfNode);
26
+ const nodesSplitIndex = textBlock.nodes.indexOf(splitNode);
27
+ if (nodesSplitIndex > -1) {
28
+ const beforeNodes = textBlock.nodes.slice(0, nodesSplitIndex);
29
+ const afterNodes = textBlock.nodes.slice(nodesSplitIndex + 1);
30
+ if (beforeText) {
31
+ beforeNodes.push(splitNode.cloneWithText(beforeText));
32
+ }
33
+ if (afterText) {
34
+ afterNodes.unshift(splitNode.cloneWithText(afterText));
35
+ }
36
+ textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
37
+ const newBlock = textBlock.cloneWithNodes(afterNodes);
38
+ textBlock.parent.apply(new InsertBlocksAfterAction(textBlock, newBlock));
39
+ return newBlock;
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,26 @@
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 { ActionHandleStrategy } from '../action-handle-strategy.abstract';
5
+ /**
6
+ * Convert the selected blocks to list strategy.
7
+ */
8
+ export class BlockTransformToListStrategy extends ActionHandleStrategy {
9
+ /**
10
+ * This method will create a empty list block and append all selected blocks as list item block.
11
+ *
12
+ * @param {TransformListAction} action - The transform list action instance.
13
+ * @param {RTETextBlock} target - The first item of the selected block.
14
+ */
15
+ handleAction(action, target) {
16
+ const contentState = target.parent;
17
+ const bulletList = contentState.createList(action.listType);
18
+ const selectedBlocks = action.selectedBlocks;
19
+ const listItems = selectedBlocks.map((block) => contentState.toListItem(block));
20
+ bulletList.apply(new AppendChildNodesAction(listItems));
21
+ contentState.apply(new InsertBlocksAfterAction(action.selectedBlocks[0], bulletList));
22
+ selectedBlocks.forEach((block) => {
23
+ block.parent.apply(new RemoveChildAction(block));
24
+ });
25
+ }
26
+ }
@@ -0,0 +1,32 @@
1
+ import { AppendChildNodesAction } from '../../actions/append-child-nodes-action';
2
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
3
+ import { InsertBlocksBeforeAction } from '../../actions/insert-blocks-before-block';
4
+ import { SplitBlockWithNodeAction } from '../../actions/split-block-with-node-action';
5
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
6
+ /**
7
+ * Insert a image node at the special position of image block.
8
+ */
9
+ export class ImageBlockInsertImageStrategy extends ActionHandleStrategy {
10
+ /**
11
+ * @inheritDoc
12
+ */
13
+ handleAction(action, target) {
14
+ const splitNode = action.splitPointNode;
15
+ const startOffsetOfNode = action.startOffsetOfNode;
16
+ const newImageBlock = action.imageBlockToBeInserted;
17
+ const newImageNodes = newImageBlock.nodes;
18
+ if (target.nodes.length < 1) {
19
+ target.apply(new AppendChildNodesAction(newImageNodes));
20
+ }
21
+ else if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
22
+ target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
23
+ }
24
+ else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
25
+ target.parent.apply(new InsertBlocksBeforeAction(target, newImageBlock));
26
+ }
27
+ else {
28
+ target.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
29
+ target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,21 @@
1
+ import { BreakSingleBlockAction } from '../../actions/break-single-block-action';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * The image block insert line break strategy.
5
+ */
6
+ export class ImageInsertLineBreakStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * The image block not support insert the line break node, so invoke the insert new paragraph logic directly.
9
+ *
10
+ * @param {LineBreakSingleBlockAction} action - The action instance.
11
+ * @param {RTEImageBlock} target - The image block.
12
+ */
13
+ handleAction(action, target) {
14
+ const insertNewParagraphAction = new BreakSingleBlockAction(action.startContainerNode, action.startOffset);
15
+ target.apply(insertNewParagraphAction);
16
+ const newBlock = insertNewParagraphAction.newBlock;
17
+ if (newBlock) {
18
+ action.lineBreakNode = newBlock.nodes[0];
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,55 @@
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 { RemoveChildAction } from '../../actions/remove-child-action';
5
+ import { RTETextBlock } from '../../blocks/text-block';
6
+ import { RTETextNode } from '../../nodes/text-node';
7
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
8
+ /**
9
+ * Insert a line break node into multiple blocks selection at special position strategy.
10
+ */
11
+ export class ImageInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
12
+ /**
13
+ * @inheritDoc
14
+ */
15
+ handleAction(action, target) {
16
+ action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
17
+ }
18
+ /**
19
+ * Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
20
+ *
21
+ * @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
22
+ * @param {RTEImageBlock} target - The image block.
23
+ * @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
24
+ */
25
+ lineBreakMultipleBlocks(selectedBlocks, target) {
26
+ const newParagraph = RTETextBlock.from({
27
+ id: generateUUID(),
28
+ type: 'paragraph',
29
+ nodes: [{ id: generateUUID(), type: 'text', text: '\n' }],
30
+ });
31
+ target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
32
+ const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
33
+ if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
34
+ afterNodes.push(new RTETextNode(generateUUID(), '\n', newParagraph));
35
+ }
36
+ newParagraph.apply(new AppendChildNodesAction(afterNodes));
37
+ return newParagraph['nodes'][0];
38
+ }
39
+ /**
40
+ * Concat the child nodes of multiple RTEBlocks if both are not images.
41
+ *
42
+ * @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
43
+ * @returns {RTENode[]} Array of connected block nodes
44
+ */
45
+ concatBlocksNodes(blocks) {
46
+ const nodes = [];
47
+ blocks.map((block) => {
48
+ if (block.type !== 'image') {
49
+ nodes.push(...block['nodes']);
50
+ block.parent.apply(new RemoveChildAction(block));
51
+ }
52
+ });
53
+ return nodes;
54
+ }
55
+ }
@@ -0,0 +1,44 @@
1
+ import { generateUUID } from '../../../../../utils/misc';
2
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
3
+ import { InsertBlocksBeforeAction } from '../../actions/insert-blocks-before-block';
4
+ import { SplitBlockWithNodeAction } from '../../actions/split-block-with-node-action';
5
+ import { RTETextBlock } from '../../blocks/text-block';
6
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
7
+ /**
8
+ * Insert a new paragraph at the image block special position strategy.
9
+ */
10
+ export class ImageInsertNewParagraphStrategy extends ActionHandleStrategy {
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ handleAction(action, target) {
15
+ action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset, target);
16
+ }
17
+ /**
18
+ * Used to split a block of text at a specific position and insert a new paragraph block.
19
+ *
20
+ * @param {RTEImageNode} splitNode - The node that needs to be split into separate blocks.
21
+ * @param {number} startOffsetOfNode - The index or position within the `splitNode` where the block should be broken or split.
22
+ * @param {RTEImageBlock} target - The image block.
23
+ * @returns {Nullable<RTEBlock>} Returns either a new paragraph block or the new block created after splitting the original block.
24
+ */
25
+ breakSingleBlock(splitNode, startOffsetOfNode, target) {
26
+ const newParagraph = RTETextBlock.from({
27
+ id: generateUUID(),
28
+ type: 'paragraph',
29
+ nodes: [{ id: generateUUID(), type: 'text', text: '' }],
30
+ });
31
+ if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
32
+ target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
33
+ }
34
+ else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
35
+ target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
36
+ }
37
+ else {
38
+ const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
39
+ target.apply(splitBlockAction);
40
+ return splitBlockAction.newBlock;
41
+ }
42
+ return newParagraph;
43
+ }
44
+ }
@@ -0,0 +1,12 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * The image node update property url strategy.
4
+ */
5
+ export class ImageUpdateUrlStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ handleAction(action, target) {
10
+ target.url = action.url;
11
+ }
12
+ }
@@ -0,0 +1,22 @@
1
+ import { InsertBlocksAfterAction } from '../../actions/insert-blocks-after-block';
2
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
3
+ /**
4
+ * Insert image to list block strategy.
5
+ */
6
+ export class ListInsertImageStrategy extends ActionHandleStrategy {
7
+ /**
8
+ * Insert image block at behind of the list item block.
9
+ *
10
+ * @param {InsertImageToBlockAction} action - The insert image action instance.
11
+ * @param {RTEListBlock} target - The list block.
12
+ */
13
+ handleAction(action, target) {
14
+ const imageBlock = action.imageBlockToBeInserted;
15
+ if (target.parent['type'] !== 'list-item') {
16
+ target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
17
+ }
18
+ else {
19
+ target.parent.apply(action);
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,20 @@
1
+ import { RemoveChildAction } from '../../actions/remove-child-action';
2
+ import { BlockDeleteTextContentStrategy } from './block-delete-text-content-strategy';
3
+ /**
4
+ * The list item block block delete text content strategy.
5
+ */
6
+ export class ListItemDeleteTextContentStrategy extends BlockDeleteTextContentStrategy {
7
+ /**
8
+ * Delete the list item content and delete the parent list after delete the last item.
9
+ *
10
+ * @param {DeleteBlockContentAction} action - The delete block content action instance.
11
+ * @param {RTEListItemBlock} target - The list item block.
12
+ */
13
+ handleAction(action, target) {
14
+ const listBlock = target.parent;
15
+ this.deleteNodeContent(action, target);
16
+ if (listBlock.blocks.length === 0) {
17
+ listBlock.parent.apply(new RemoveChildAction(listBlock));
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,15 @@
1
+ import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
2
+ /**
3
+ * Insert image node to list item block strategy.
4
+ */
5
+ export class ListItemInsertImageStrategy extends ActionHandleStrategy {
6
+ /**
7
+ * The image node can not insert into list item block, so insert image after parent list block.
8
+ *
9
+ * @param {InsertImageToBlockAction} action - The action instance.
10
+ * @param {RTEListItemBlock} target - The list item block.
11
+ */
12
+ handleAction(action, target) {
13
+ target.parent.apply(action);
14
+ }
15
+ }