@heartlandone/vega 2.102.0 → 2.103.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 (387) hide show
  1. package/dist/cjs/{app-globals-49c2a999.js → app-globals-85986306.js} +10 -10
  2. package/dist/cjs/{code-block-06e6591f.js → code-block-72de6c4d.js} +80 -1
  3. package/dist/cjs/{component-value-history-controller-slimmer.abstract-f29908f8.js → component-value-history-controller-slimmer.abstract-23d2b3d8.js} +3 -3
  4. package/dist/cjs/{content-state-8c862e5e.js → content-state-ff40bdc6.js} +38 -5
  5. package/dist/cjs/{date-required-rule-b672c432.js → date-required-rule-608e704b.js} +1 -1
  6. package/dist/cjs/{design-token-351ffd2c.js → design-token-a101a8d0.js} +3 -3
  7. package/dist/cjs/{element-appender-slimmer-f932b166.js → element-appender-slimmer-b93cc564.js} +2 -2
  8. package/dist/cjs/{form-field-controller-slimmer-5adb86ae.js → form-field-controller-slimmer-124d54ea.js} +1 -1
  9. package/dist/cjs/{image-annotation-action-25907d6b.js → image-annotation-action-1ee41bc7.js} +2 -2
  10. package/dist/cjs/{image-extension-1cf84f27.js → image-extension-6a92c524.js} +247 -5
  11. package/dist/cjs/index.cjs.js +17 -17
  12. package/dist/cjs/{inject-keyboard-manager-84d33920.js → inject-keyboard-manager-32d7dd0e.js} +1 -1
  13. package/dist/cjs/{internal-calendar-period-factory-3c5236be.js → internal-calendar-period-factory-c3198ea7.js} +1 -1
  14. package/dist/cjs/{internal-translation-controller-eae8a8de.js → internal-translation-controller-0d67ca4d.js} +1 -0
  15. package/dist/cjs/{keyboard-manager-baa83a61.js → keyboard-manager-332eec89.js} +1 -1
  16. package/dist/cjs/{keyboard-manager-slimmer-d1974b28.js → keyboard-manager-slimmer-a2872981.js} +1 -1
  17. package/dist/cjs/{link-extension-2a6133b7.js → link-extension-1b4ed437.js} +3 -3
  18. package/dist/cjs/loader.cjs.js +12 -12
  19. package/dist/cjs/{month-view-generator-a6827548.js → month-view-generator-b6a2b8be.js} +1 -1
  20. package/dist/cjs/{public-rules-7f26e0ae.js → public-rules-2066613c.js} +7 -7
  21. package/dist/cjs/{range-518b95a2.js → range-712fe703.js} +1 -1
  22. package/dist/cjs/{responsive-format-facade-95c54444.js → responsive-format-facade-44d33457.js} +1 -1
  23. package/dist/cjs/{rich-text-editor-required-rule-5d0c76ec.js → rich-text-editor-required-rule-1aa75d22.js} +1 -1
  24. package/dist/cjs/{split-cell-operation-28f6f8d9.js → split-cell-operation-afc82323.js} +3 -3
  25. package/dist/cjs/{state-border-formatter-6c284859.js → state-border-formatter-49984fd6.js} +1 -1
  26. package/dist/cjs/{string-format-strategy.abstract-f15b6196.js → string-format-strategy.abstract-bd563c01.js} +1 -1
  27. package/dist/cjs/{string-input-formatter-slimmer-5a3f1b55.js → string-input-formatter-slimmer-4faebac9.js} +1 -1
  28. package/dist/cjs/{string-mask-strategy-af6f3ba0.js → string-mask-strategy-624c4398.js} +2 -2
  29. package/dist/cjs/{style-formatter-324211fd.js → style-formatter-151d89a3.js} +2 -2
  30. package/dist/cjs/{time-required-rule-9e714442.js → time-required-rule-8cd8f9b9.js} +1 -1
  31. package/dist/cjs/{token-extension-86723cad.js → token-extension-72d0cb08.js} +1011 -767
  32. package/dist/cjs/{translation-slimmer-0227ee24.js → translation-slimmer-1771d01f.js} +1 -1
  33. package/dist/cjs/{type-guard-29e01bd4.js → type-guard-cce6fe1f.js} +1 -1
  34. package/dist/cjs/{valid-credit-card-number-rule-4ec364af.js → valid-credit-card-number-rule-b13c2fc4.js} +1 -1
  35. package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
  36. package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
  37. package/dist/cjs/vega-box.cjs.entry.js +6 -6
  38. package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
  39. package/dist/cjs/vega-button.cjs.entry.js +3 -3
  40. package/dist/cjs/vega-calendar_5.cjs.entry.js +7 -7
  41. package/dist/cjs/vega-card.cjs.entry.js +5 -5
  42. package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
  43. package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
  44. package/dist/cjs/vega-chip.cjs.entry.js +5 -5
  45. package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
  46. package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
  47. package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +3 -3
  48. package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
  49. package/dist/cjs/vega-combo-box.cjs.entry.js +8 -8
  50. package/dist/cjs/vega-date-picker_2.cjs.entry.js +13 -13
  51. package/dist/cjs/vega-dialog_2.cjs.entry.js +3 -3
  52. package/dist/cjs/vega-divider.cjs.entry.js +5 -5
  53. package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -7
  54. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  55. package/dist/cjs/vega-field-label.cjs.entry.js +2 -2
  56. package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
  57. package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
  58. package/dist/cjs/vega-flex.cjs.entry.js +6 -6
  59. package/dist/cjs/vega-font.cjs.entry.js +5 -5
  60. package/dist/cjs/vega-form.cjs.entry.js +2 -2
  61. package/dist/cjs/vega-grid.cjs.entry.js +5 -5
  62. package/dist/cjs/vega-icon.cjs.entry.js +5 -5
  63. package/dist/cjs/vega-image-uploader.cjs.entry.js +5 -5
  64. package/dist/cjs/vega-input-credit-card.cjs.entry.js +6 -6
  65. package/dist/cjs/vega-input-numeric.cjs.entry.js +12 -14
  66. package/dist/cjs/vega-input-passcode.cjs.entry.js +5 -5
  67. package/dist/cjs/vega-input-phone-number.cjs.entry.js +4 -4
  68. package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
  69. package/dist/cjs/vega-input-select.cjs.entry.js +5 -5
  70. package/dist/cjs/vega-input.cjs.entry.js +31 -27
  71. package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
  72. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
  73. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
  74. package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
  75. package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
  76. package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
  77. package/dist/cjs/vega-radio_2.cjs.entry.js +5 -5
  78. package/dist/cjs/vega-rich-text-bookmark-editor.cjs.entry.js +2 -2
  79. package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
  80. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +474 -207
  81. package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +1 -1
  82. package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
  83. package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
  84. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
  85. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
  86. package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
  87. package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
  88. package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
  89. package/dist/cjs/vega-tab-group_2.cjs.entry.js +6 -6
  90. package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
  91. package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
  92. package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
  93. package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
  94. package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
  95. package/dist/cjs/vega.cjs.js +12 -12
  96. package/dist/collection/components/vega-input/slimmers/controllers/vega-input-state-controller.js +0 -14
  97. package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.js +11 -2
  98. package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-renderer.js +11 -1
  99. package/dist/collection/components/vega-input/vega-input.js +52 -8
  100. package/dist/collection/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.js +7 -1
  101. package/dist/collection/components/vega-input-numeric/vega-input-numeric.js +0 -8
  102. package/dist/collection/components/vega-rich-text-editor/constants/constant.js +4 -0
  103. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/sequential-composition-strategy.js +31 -0
  104. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
  105. package/dist/collection/components/vega-rich-text-editor/dto/actions/sequential-composition-action.js +14 -0
  106. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +4 -1
  107. package/dist/collection/components/vega-rich-text-editor/dto/flush-changes-payload.js +1 -0
  108. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +3 -2
  109. package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +30 -0
  110. package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +1 -0
  111. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/chooser-positioner.js +107 -0
  112. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/paste-chooser-controller.js +91 -0
  113. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/paste-event-interceptor.js +47 -0
  114. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/selection-snapshot-service.js +54 -0
  115. package/dist/collection/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/image-extractor.js +17 -0
  116. package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.js +3 -1
  117. package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-extension.js +41 -354
  118. package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/data-transfer-builder.js +36 -0
  119. package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/paste-dispatcher.js +23 -0
  120. package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/paste-processing-pipeline.js +30 -0
  121. package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.js +34 -0
  122. package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.js +19 -0
  123. package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/plain-paste-strategy.js +74 -0
  124. package/dist/collection/components/vega-rich-text-editor/extensions/paste/type.js +1 -0
  125. package/dist/collection/components/vega-rich-text-editor/helpers/utils.js +67 -0
  126. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +67 -11
  127. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.js +4 -17
  128. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +34 -1
  129. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.js +13 -32
  130. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +60 -25
  131. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +55 -19
  132. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +165 -59
  133. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +55 -21
  134. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +2 -16
  135. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +11 -1
  136. package/dist/collection/components/vega-rich-text-editor/utils/html-to-plain-text-utils.js +240 -0
  137. package/dist/collection/helpers/translation/locales/en.js +1 -0
  138. package/dist/esm/{app-globals-da5c83c2.js → app-globals-8cdfc5c9.js} +10 -10
  139. package/dist/esm/{code-block-d8f83d85.js → code-block-9360c331.js} +74 -2
  140. package/dist/esm/{component-value-history-controller-slimmer.abstract-642e7147.js → component-value-history-controller-slimmer.abstract-9ea58806.js} +3 -3
  141. package/dist/esm/{content-state-486eae1d.js → content-state-67a12e74.js} +38 -5
  142. package/dist/esm/{date-required-rule-08695d25.js → date-required-rule-66b5bf02.js} +1 -1
  143. package/dist/esm/{design-token-df3331d9.js → design-token-acd1efeb.js} +3 -3
  144. package/dist/esm/{element-appender-slimmer-f02a227f.js → element-appender-slimmer-7e5bc1e9.js} +2 -2
  145. package/dist/esm/{form-field-controller-slimmer-a7c0a0f8.js → form-field-controller-slimmer-d653c494.js} +1 -1
  146. package/dist/esm/{image-annotation-action-df744ba5.js → image-annotation-action-9525be48.js} +2 -2
  147. package/dist/esm/{image-extension-20b39140.js → image-extension-aea75132.js} +246 -6
  148. package/dist/esm/index.js +17 -17
  149. package/dist/esm/{inject-keyboard-manager-399ed867.js → inject-keyboard-manager-f6522d2f.js} +1 -1
  150. package/dist/esm/{internal-calendar-period-factory-7b866c3b.js → internal-calendar-period-factory-261df2f2.js} +1 -1
  151. package/dist/esm/{internal-translation-controller-4a7ee4d5.js → internal-translation-controller-3637e47e.js} +1 -0
  152. package/dist/esm/{keyboard-manager-f5d13a34.js → keyboard-manager-53e8d8d0.js} +1 -1
  153. package/dist/esm/{keyboard-manager-slimmer-f40dcb54.js → keyboard-manager-slimmer-b3de042d.js} +1 -1
  154. package/dist/esm/{link-extension-3f93d70d.js → link-extension-57ba9520.js} +3 -3
  155. package/dist/esm/loader.js +12 -12
  156. package/dist/esm/{month-view-generator-0c665987.js → month-view-generator-15215a09.js} +1 -1
  157. package/dist/esm/{public-rules-470a1dac.js → public-rules-c77a1550.js} +7 -7
  158. package/dist/esm/{range-8e89fb54.js → range-3c74e1c8.js} +1 -1
  159. package/dist/esm/{responsive-format-facade-55131a33.js → responsive-format-facade-1b325d06.js} +1 -1
  160. package/dist/esm/{rich-text-editor-required-rule-06caf383.js → rich-text-editor-required-rule-cfd32ba2.js} +1 -1
  161. package/dist/esm/{split-cell-operation-e158366a.js → split-cell-operation-85a036f9.js} +3 -3
  162. package/dist/esm/{state-border-formatter-2b73fa08.js → state-border-formatter-ce3495b0.js} +1 -1
  163. package/dist/esm/{string-format-strategy.abstract-8c7937e3.js → string-format-strategy.abstract-8ce04558.js} +1 -1
  164. package/dist/esm/{string-input-formatter-slimmer-681c6b71.js → string-input-formatter-slimmer-0d60ba7d.js} +1 -1
  165. package/dist/esm/{string-mask-strategy-b8cceee6.js → string-mask-strategy-cabc1d50.js} +2 -2
  166. package/dist/esm/{style-formatter-fcd70869.js → style-formatter-00fe4f1c.js} +2 -2
  167. package/dist/esm/{time-required-rule-ce50859b.js → time-required-rule-57ceeae9.js} +1 -1
  168. package/dist/esm/{token-extension-2401e753.js → token-extension-645a9520.js} +1011 -767
  169. package/dist/esm/{translation-slimmer-b3f3cf65.js → translation-slimmer-b69057eb.js} +1 -1
  170. package/dist/esm/{type-guard-08c82e08.js → type-guard-204094c6.js} +1 -1
  171. package/dist/esm/{valid-credit-card-number-rule-66bad519.js → valid-credit-card-number-rule-0874e19f.js} +1 -1
  172. package/dist/esm/vega-accordion.entry.js +6 -6
  173. package/dist/esm/vega-app-header-button.entry.js +5 -5
  174. package/dist/esm/vega-box.entry.js +6 -6
  175. package/dist/esm/vega-button-circle.entry.js +5 -5
  176. package/dist/esm/vega-button.entry.js +3 -3
  177. package/dist/esm/vega-calendar_5.entry.js +7 -7
  178. package/dist/esm/vega-card.entry.js +5 -5
  179. package/dist/esm/vega-carousel.entry.js +3 -3
  180. package/dist/esm/vega-checkbox_2.entry.js +2 -2
  181. package/dist/esm/vega-chip.entry.js +5 -5
  182. package/dist/esm/vega-code-block.entry.js +8 -8
  183. package/dist/esm/vega-color-picker.entry.js +2 -2
  184. package/dist/esm/vega-color-swatch-picker.entry.js +3 -3
  185. package/dist/esm/vega-color-swatch.entry.js +2 -2
  186. package/dist/esm/vega-combo-box.entry.js +8 -8
  187. package/dist/esm/vega-date-picker_2.entry.js +13 -13
  188. package/dist/esm/vega-dialog_2.entry.js +3 -3
  189. package/dist/esm/vega-divider.entry.js +5 -5
  190. package/dist/esm/vega-dropdown_5.entry.js +7 -7
  191. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  192. package/dist/esm/vega-field-label.entry.js +2 -2
  193. package/dist/esm/vega-file-uploader.entry.js +3 -3
  194. package/dist/esm/vega-flag-icon.entry.js +5 -5
  195. package/dist/esm/vega-flex.entry.js +6 -6
  196. package/dist/esm/vega-font.entry.js +5 -5
  197. package/dist/esm/vega-form.entry.js +2 -2
  198. package/dist/esm/vega-grid.entry.js +5 -5
  199. package/dist/esm/vega-icon.entry.js +5 -5
  200. package/dist/esm/vega-image-uploader.entry.js +5 -5
  201. package/dist/esm/vega-input-credit-card.entry.js +6 -6
  202. package/dist/esm/vega-input-numeric.entry.js +12 -14
  203. package/dist/esm/vega-input-passcode.entry.js +5 -5
  204. package/dist/esm/vega-input-phone-number.entry.js +4 -4
  205. package/dist/esm/vega-input-range.entry.js +3 -3
  206. package/dist/esm/vega-input-select.entry.js +5 -5
  207. package/dist/esm/vega-input.entry.js +31 -27
  208. package/dist/esm/vega-left-nav_5.entry.js +7 -7
  209. package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
  210. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
  211. package/dist/esm/vega-pagination.entry.js +4 -4
  212. package/dist/esm/vega-popover_2.entry.js +8 -8
  213. package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
  214. package/dist/esm/vega-radio_2.entry.js +5 -5
  215. package/dist/esm/vega-rich-text-bookmark-editor.entry.js +2 -2
  216. package/dist/esm/vega-rich-text-content.entry.js +6 -6
  217. package/dist/esm/vega-rich-text-editor_4.entry.js +474 -207
  218. package/dist/esm/vega-rich-text-find-replace-panel.entry.js +1 -1
  219. package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
  220. package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
  221. package/dist/esm/vega-selection-chip_2.entry.js +4 -4
  222. package/dist/esm/vega-selection-tile_2.entry.js +2 -2
  223. package/dist/esm/vega-sidenav_3.entry.js +3 -3
  224. package/dist/esm/vega-signature-capture.entry.js +7 -7
  225. package/dist/esm/vega-stepper.entry.js +2 -2
  226. package/dist/esm/vega-tab-group_2.entry.js +6 -6
  227. package/dist/esm/vega-table_11.entry.js +4 -4
  228. package/dist/esm/vega-textarea.entry.js +2 -2
  229. package/dist/esm/vega-time-picker_2.entry.js +9 -9
  230. package/dist/esm/vega-toggle-switch.entry.js +2 -2
  231. package/dist/esm/vega-tooltip_2.entry.js +6 -6
  232. package/dist/esm/vega.js +12 -12
  233. package/dist/sri/vega-sri-manifest.json +321 -321
  234. package/dist/types/components/vega-input/slimmers/controllers/vega-input-state-controller.d.ts +0 -2
  235. package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.d.ts +4 -0
  236. package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-renderer.d.ts +2 -0
  237. package/dist/types/components/vega-input/vega-input.d.ts +15 -3
  238. package/dist/types/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.d.ts +2 -0
  239. package/dist/types/components/vega-input-numeric/vega-input-numeric.d.ts +0 -2
  240. package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +4 -0
  241. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/sequential-composition-strategy.d.ts +14 -0
  242. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +4 -1
  243. package/dist/types/components/vega-rich-text-editor/dto/actions/sequential-composition-action.d.ts +30 -0
  244. package/dist/types/components/vega-rich-text-editor/dto/flush-changes-payload.d.ts +16 -0
  245. package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +7 -0
  246. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/chooser-positioner.d.ts +33 -0
  247. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/paste-chooser-controller.d.ts +43 -0
  248. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/paste-event-interceptor.d.ts +22 -0
  249. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/selection-snapshot-service.d.ts +29 -0
  250. package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/image-extractor.d.ts +13 -0
  251. package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/paste-image-parser.d.ts +1 -1
  252. package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/pending-image-registry.d.ts +1 -1
  253. package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.d.ts +1 -0
  254. package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-extension.d.ts +28 -93
  255. package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/data-transfer-builder.d.ts +10 -0
  256. package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/paste-dispatcher.d.ts +8 -0
  257. package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/paste-processing-pipeline.d.ts +18 -0
  258. package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.d.ts +28 -6
  259. package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.d.ts +13 -0
  260. package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/plain-paste-strategy.d.ts +29 -0
  261. package/dist/types/components/vega-rich-text-editor/extensions/paste/type.d.ts +35 -0
  262. package/dist/types/components/vega-rich-text-editor/helpers/utils.d.ts +47 -0
  263. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.d.ts +17 -6
  264. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.d.ts +5 -1
  265. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +30 -1
  266. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.d.ts +5 -1
  267. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +21 -4
  268. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.d.ts +12 -4
  269. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +38 -5
  270. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.d.ts +7 -2
  271. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -0
  272. package/dist/types/components/vega-rich-text-editor/utils/html-to-plain-text-utils.d.ts +31 -0
  273. package/dist/types/components.d.ts +24 -0
  274. package/dist/types/helpers/translation/interface.d.ts +1 -0
  275. package/dist/types/types/public-api.d.ts +2 -1
  276. package/dist/vega/index.esm.js +1 -1
  277. package/dist/vega/{p-8a4cc7c2.entry.js → p-0169f71c.entry.js} +1 -1
  278. package/dist/vega/p-018bb83b.entry.js +1 -0
  279. package/dist/vega/{p-25e51acb.js → p-08bf08d2.js} +1 -1
  280. package/dist/vega/{p-85a940c0.entry.js → p-0b33753f.entry.js} +1 -1
  281. package/dist/vega/{p-a5fa260b.js → p-1537b1e4.js} +1 -1
  282. package/dist/vega/{p-7dfb1481.entry.js → p-17f6dc94.entry.js} +1 -1
  283. package/dist/vega/{p-dd673eb4.entry.js → p-1a4d1991.entry.js} +1 -1
  284. package/dist/vega/{p-557b64bd.js → p-1b2e5898.js} +1 -1
  285. package/dist/vega/{p-2256eb09.entry.js → p-1f1f93bf.entry.js} +1 -1
  286. package/dist/vega/{p-d86e0b01.js → p-1fb953f8.js} +1 -1
  287. package/dist/vega/{p-03efc67a.entry.js → p-2171b571.entry.js} +1 -1
  288. package/dist/vega/p-255fe20b.js +1 -0
  289. package/dist/vega/{p-cf5c5515.js → p-261cf764.js} +1 -1
  290. package/dist/vega/{p-f0b49ae4.entry.js → p-27e77ea1.entry.js} +1 -1
  291. package/dist/vega/{p-109f0e33.entry.js → p-28acbe42.entry.js} +1 -1
  292. package/dist/vega/{p-27c9c2a5.entry.js → p-2acc600a.entry.js} +1 -1
  293. package/dist/vega/p-2fc2299f.js +1 -0
  294. package/dist/vega/{p-b48caf90.entry.js → p-2ff659a1.entry.js} +1 -1
  295. package/dist/vega/{p-527c3211.entry.js → p-322da1eb.entry.js} +1 -1
  296. package/dist/vega/{p-dffe47db.js → p-3283fa2f.js} +1 -1
  297. package/dist/vega/p-3567dc55.entry.js +1 -0
  298. package/dist/vega/{p-c6419eb3.entry.js → p-36b795c6.entry.js} +1 -1
  299. package/dist/vega/p-37714a3a.js +1 -0
  300. package/dist/vega/{p-d7e59f31.js → p-3b4e2ba0.js} +1 -1
  301. package/dist/vega/{p-3d060d2f.entry.js → p-3b911043.entry.js} +1 -1
  302. package/dist/vega/{p-5c6d36ef.entry.js → p-3e270b65.entry.js} +1 -1
  303. package/dist/vega/{p-b68f55e2.js → p-4043508a.js} +1 -1
  304. package/dist/vega/p-4151d4a8.js +1 -0
  305. package/dist/vega/{p-c6b6987e.js → p-45af801f.js} +1 -1
  306. package/dist/vega/p-48c2150b.entry.js +1 -0
  307. package/dist/vega/p-4b253f74.entry.js +1 -0
  308. package/dist/vega/{p-75c7f8ea.entry.js → p-4cdc064d.entry.js} +1 -1
  309. package/dist/vega/{p-1d8a8507.entry.js → p-4e4b50f3.entry.js} +1 -1
  310. package/dist/vega/{p-d8fa2f19.entry.js → p-564110ba.entry.js} +1 -1
  311. package/dist/vega/p-5f377954.js +1 -1
  312. package/dist/vega/{p-bec31ffc.entry.js → p-608d3559.entry.js} +1 -1
  313. package/dist/vega/{p-3ce7521e.entry.js → p-64eb05d3.entry.js} +1 -1
  314. package/dist/vega/{p-2f5c4b61.entry.js → p-66bf209b.entry.js} +1 -1
  315. package/dist/vega/{p-83f5ef3a.entry.js → p-69eadbd8.entry.js} +1 -1
  316. package/dist/vega/{p-c66c6fd2.entry.js → p-6c4edee8.entry.js} +1 -1
  317. package/dist/vega/p-6e16bb3a.js +1 -0
  318. package/dist/vega/{p-7d748545.entry.js → p-76f4fdba.entry.js} +1 -1
  319. package/dist/vega/{p-4c6989ae.entry.js → p-7874055b.entry.js} +1 -1
  320. package/dist/vega/{p-ca60a74b.entry.js → p-7d3d24f6.entry.js} +1 -1
  321. package/dist/vega/{p-3bfb53e3.js → p-7f9ad7bc.js} +1 -1
  322. package/dist/vega/{p-18ddc6a4.entry.js → p-8193f4ef.entry.js} +1 -1
  323. package/dist/vega/{p-816064f2.entry.js → p-8197d172.entry.js} +1 -1
  324. package/dist/vega/{p-634b138c.entry.js → p-8ac0b1b2.entry.js} +1 -1
  325. package/dist/vega/{p-553510d8.entry.js → p-8c61db9d.entry.js} +1 -1
  326. package/dist/vega/{p-061a76c3.entry.js → p-8de29082.entry.js} +1 -1
  327. package/dist/vega/{p-325b804d.entry.js → p-8e59606f.entry.js} +1 -1
  328. package/dist/vega/p-8ea41806.js +1 -0
  329. package/dist/vega/{p-ff9090af.entry.js → p-9153c2f5.entry.js} +1 -1
  330. package/dist/vega/{p-a0c87e88.entry.js → p-92411f56.entry.js} +1 -1
  331. package/dist/vega/{p-049e64b1.entry.js → p-94d65dcf.entry.js} +1 -1
  332. package/dist/vega/{p-a261a675.entry.js → p-9a96fb05.entry.js} +1 -1
  333. package/dist/vega/{p-7044bb48.js → p-9fcfd738.js} +1 -1
  334. package/dist/vega/{p-b1e1c7d0.js → p-a2c7a3bc.js} +1 -1
  335. package/dist/vega/p-a2dcde12.js +1 -0
  336. package/dist/vega/{p-be0eb72f.js → p-a60d75d9.js} +1 -1
  337. package/dist/vega/{p-5a347a15.js → p-a9fc4043.js} +1 -1
  338. package/dist/vega/{p-efef0dfe.entry.js → p-abe5f7f0.entry.js} +1 -1
  339. package/dist/vega/{p-197388a5.entry.js → p-ac98c189.entry.js} +1 -1
  340. package/dist/vega/{p-dd273d89.entry.js → p-ade903b3.entry.js} +1 -1
  341. package/dist/vega/{p-c0eb8c58.js → p-affb40e8.js} +1 -1
  342. package/dist/vega/{p-277aab9b.js → p-b3a1cd22.js} +1 -1
  343. package/dist/vega/p-b63a90b3.entry.js +1 -0
  344. package/dist/vega/{p-f9f96030.entry.js → p-ba050d63.entry.js} +1 -1
  345. package/dist/vega/{p-bf0b46c1.js → p-ba67eb96.js} +1 -1
  346. package/dist/vega/{p-f0c6e9c5.entry.js → p-c08ac33f.entry.js} +1 -1
  347. package/dist/vega/{p-46be74fc.entry.js → p-c7ec97d1.entry.js} +1 -1
  348. package/dist/vega/{p-effbfc50.entry.js → p-ca1fe571.entry.js} +1 -1
  349. package/dist/vega/{p-408c3ad4.entry.js → p-cc9fc36a.entry.js} +1 -1
  350. package/dist/vega/{p-741e064e.entry.js → p-d044d54f.entry.js} +1 -1
  351. package/dist/vega/{p-0e0e66c9.entry.js → p-d3a9355c.entry.js} +1 -1
  352. package/dist/vega/p-d5a75228.js +1 -0
  353. package/dist/vega/{p-76135e80.entry.js → p-dc83fa6b.entry.js} +1 -1
  354. package/dist/vega/{p-92efdbf0.entry.js → p-dcfce26e.entry.js} +1 -1
  355. package/dist/vega/p-df9585f6.js +3 -0
  356. package/dist/vega/{p-f5f26b44.entry.js → p-e2c8a470.entry.js} +1 -1
  357. package/dist/vega/{p-23781e76.js → p-e33a954f.js} +1 -1
  358. package/dist/vega/{p-e577dda8.entry.js → p-e5fc6583.entry.js} +1 -1
  359. package/dist/vega/p-e668cf11.js +1 -0
  360. package/dist/vega/{p-0338f621.entry.js → p-e6b0a292.entry.js} +1 -1
  361. package/dist/vega/{p-381d8781.js → p-e84c2589.js} +1 -1
  362. package/dist/vega/{p-1b97e751.entry.js → p-eb945d34.entry.js} +1 -1
  363. package/dist/vega/{p-d8a0e3e0.entry.js → p-ebe1dd2b.entry.js} +1 -1
  364. package/dist/vega/{p-6beaf1c8.entry.js → p-f818bb20.entry.js} +1 -1
  365. package/dist/vega/p-f981cf2c.js +1 -0
  366. package/dist/vega/p-f9d09b0c.js +1 -0
  367. package/dist/vega/{p-4d20a56f.js → p-fdbdf12f.js} +1 -1
  368. package/dist/vega/{p-48100d38.entry.js → p-fee080b9.entry.js} +1 -1
  369. package/dist/vega/vega.esm.js +1 -1
  370. package/package.json +1 -1
  371. package/dist/vega/p-040bd9ca.js +0 -1
  372. package/dist/vega/p-087240db.js +0 -1
  373. package/dist/vega/p-15052b2e.entry.js +0 -1
  374. package/dist/vega/p-28c16885.js +0 -1
  375. package/dist/vega/p-30cc31dd.entry.js +0 -1
  376. package/dist/vega/p-3ec4d710.js +0 -1
  377. package/dist/vega/p-43ea1e86.js +0 -1
  378. package/dist/vega/p-7228088b.entry.js +0 -1
  379. package/dist/vega/p-7f711049.js +0 -1
  380. package/dist/vega/p-7fd15dd1.js +0 -1
  381. package/dist/vega/p-85695819.js +0 -1
  382. package/dist/vega/p-8e1f30ec.entry.js +0 -1
  383. package/dist/vega/p-9680dfe6.js +0 -1
  384. package/dist/vega/p-ae12cc3f.js +0 -3
  385. package/dist/vega/p-c0823f32.js +0 -1
  386. package/dist/vega/p-c5af2ecc.entry.js +0 -1
  387. package/dist/vega/p-fa43272c.js +0 -1
@@ -3,24 +3,25 @@ import { BaseHandler } from './base-handler';
3
3
  import { SplitBlockWithNodeAction } from '../../../../dto/actions/split-block-with-node-action';
4
4
  import { MergeTwoBlocksNodesAction } from '../../../../dto/actions/merge-two-blocks-nodes-action';
5
5
  import { InsertNewParagraphAction } from '../../../../dto/actions/insert-new-paragraph-action';
6
+ import { ModifyContentActionType } from '../../../../dto/actions/modify-content-action.abstract';
7
+ import { UpdateCursorPositionAction } from '../../../../dto/actions/update-cursor-position-action';
6
8
  /** Insert a paragraph in a rich text editor based on the current selection and event. User type enter will trigger this callback */
7
9
  export class InsertParagraphHandler extends BaseHandler {
8
10
  /**
9
11
  * Create new paragraph node and add node to state value
12
+ *
13
+ * @returns {CompositionStep[] | void} The content + caret steps applied atomically as one flushable composition.
10
14
  */
11
15
  handleEvent() {
12
16
  const selectedBlocks = this.selectionController.getSelectedBlocks();
13
17
  if (selectedBlocks.length) {
14
- if (selectedBlocks.length < 2) {
15
- this.breakSingleBlock();
16
- }
17
- else {
18
- this.breakMultipleBlocks();
19
- }
18
+ return selectedBlocks.length < 2 ? this.breakSingleBlock() : this.breakMultipleBlocks();
20
19
  }
21
20
  }
22
21
  /**
23
22
  * Handles breaking blocks in an RTE editor based on the current selection and position.
23
+ *
24
+ * @returns {CompositionStep[]} The content + caret steps for the multi-block break.
24
25
  */
25
26
  breakMultipleBlocks() {
26
27
  const selectedBlocks = this.selectionController.getSelectedBlocks();
@@ -58,36 +59,71 @@ export class InsertParagraphHandler extends BaseHandler {
58
59
  */
59
60
  if (firstBlock.type !== lastBlock.type &&
60
61
  range.startContainer.nodeType === range.endContainer.nodeType) {
61
- firstBlock.apply(new MergeTwoBlocksNodesAction(lastBlock));
62
- const splitAction = new SplitBlockWithNodeAction(cursorNode, cursorNode['text'].length);
63
- firstBlock.apply(splitAction);
64
- this.switchCaretPositionToNextElement(splitAction.newBlock);
65
- return;
62
+ const mergeStep = {
63
+ target: firstBlock,
64
+ action: new MergeTwoBlocksNodesAction(lastBlock),
65
+ };
66
+ // Split offset is read at apply time, after the merge step has run.
67
+ // eslint-disable-next-line jsdoc/require-jsdoc
68
+ const splitStep = () => ({
69
+ target: firstBlock,
70
+ action: new SplitBlockWithNodeAction(cursorNode, cursorNode['text'].length),
71
+ });
72
+ // eslint-disable-next-line jsdoc/require-jsdoc
73
+ const caretStep = (context) => {
74
+ const splitAction = context.getAction(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE);
75
+ if (splitAction) {
76
+ return this.caretToNextElement(splitAction.newBlock);
77
+ }
78
+ };
79
+ return [mergeStep, splitStep, caretStep];
66
80
  }
67
81
  }
68
- this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
82
+ return [
83
+ {
84
+ target: this.currentState,
85
+ action: new UpdateCursorPositionAction(cursorNode, range.startOffset),
86
+ },
87
+ ];
69
88
  }
70
89
  /**
71
90
  * Handles breaking a single block in an RTE editor based on the current selection and position.
91
+ *
92
+ * @returns {CompositionStep[]} The content + caret steps for the single-block break.
72
93
  */
73
94
  breakSingleBlock() {
74
95
  const cursorNode = this.removeSelectionRange();
75
96
  const currentBlock = cursorNode instanceof RTENode ? cursorNode.parent : cursorNode;
76
97
  const { startOffset } = this.selectionController.getCurrentRange();
98
+ let result = [];
77
99
  if (currentBlock) {
78
- const breakAction = new InsertNewParagraphAction(cursorNode, startOffset);
79
- currentBlock.apply(breakAction);
80
- this.switchCaretPositionToNextElement(breakAction.newBlock);
100
+ const breakStep = {
101
+ target: currentBlock,
102
+ action: new InsertNewParagraphAction(cursorNode, startOffset),
103
+ };
104
+ // eslint-disable-next-line jsdoc/require-jsdoc
105
+ const caretStep = (context) => {
106
+ const breakAction = context.getAction(ModifyContentActionType.INSERT_NEW_PARAGRAPH);
107
+ if (breakAction) {
108
+ return this.caretToNextElement(breakAction.newBlock);
109
+ }
110
+ };
111
+ result = [breakStep, caretStep];
81
112
  }
113
+ return result;
82
114
  }
83
115
  /**
84
- * Moves the caret to the next block element in a rich text editor.
116
+ * Builds the caret operation that moves onto the first child of the newly created block.
85
117
  *
86
- * @param {RTEBlock} newBlock - Represents a new create block element in a rich text editor.
118
+ * @param {Nullable<RTEBlock>} newBlock - The block created by the break, or null when none was created.
119
+ * @returns {CompositionOperation | void} The caret operation, or nothing when there is no target block.
87
120
  */
88
- switchCaretPositionToNextElement(newBlock) {
121
+ caretToNextElement(newBlock) {
89
122
  if (newBlock && newBlock.children) {
90
- this.selectionController.enqueueSelectionRangeFutureState(newBlock.children[0], 0);
123
+ return {
124
+ target: this.currentState,
125
+ action: new UpdateCursorPositionAction(newBlock.children[0], 0),
126
+ };
91
127
  }
92
128
  }
93
129
  }
@@ -2,13 +2,16 @@ import { BaseHandler } from './base-handler';
2
2
  import { AppendChildrenAction } from '../../../../dto/actions/append-child-nodes-action';
3
3
  import ElementToDtoStrategyProcessor from '../element-to-dto-strategy/element-to-dto-strategy-processor';
4
4
  import { StylePreservator } from '../../../../../../helpers/csp/styles-preservator';
5
+ import { htmlContainsTable, htmlToPlainText } from '../../../../utils/html-to-plain-text-utils';
5
6
  import { PasteContentAction } from '../../../../dto/actions/paste-content-action';
6
7
  import { RTETextBlock } from '../../../../dto/blocks/text-block';
7
8
  import { RTETextNode } from '../../../../dto/nodes/text-node';
8
9
  import { generateUUID } from '../../../../../../utils/misc';
9
- import { escapeHtml } from '../../../../helpers/utils';
10
+ import { escapeHtml, normalizePlainTextLines, toPlainPasteLines } from '../../../../helpers/utils';
10
11
  import { ReplaceSelectedTextAction } from '../../../../dto/actions/replace-selected-text-action';
11
- import { RTE_PASTE_MODE_DATA_TYPE, RTE_PASTE_MODE_WORD } from '../../../../constants/constant';
12
+ import { RTE_PASTE_MODE_DATA_TYPE, RTE_PASTE_MODE_PLAIN, RTE_PASTE_MODE_WORD, RTE_PRESERVED_WHITESPACE_DATA_TYPE, } from '../../../../constants/constant';
13
+ import { ModifyContentActionType } from '../../../../dto/actions/modify-content-action.abstract';
14
+ import { UpdateCursorPositionAction } from '../../../../dto/actions/update-cursor-position-action';
12
15
  /**
13
16
  * Handle user paste
14
17
  */
@@ -17,53 +20,57 @@ export class InsertPasteHandler extends BaseHandler {
17
20
  * Update the state value when user paste html elements.
18
21
  *
19
22
  * @param {InputEvent} event - Paste event.
23
+ * @returns {CompositionStep[]} The content + caret steps applied atomically as one flushable composition.
20
24
  */
21
25
  handleEvent(event) {
22
26
  const currentRange = this.selectionController.getCurrentRange();
23
27
  const payload = this.getPastePayload(event);
24
- if (this.insertPlainTextInline(payload, currentRange)) {
25
- return;
28
+ const inlineSteps = this.insertPlainTextInline(payload, currentRange);
29
+ if (inlineSteps) {
30
+ return inlineSteps;
26
31
  }
27
- const blocks = this.parsePastedElements(event);
32
+ const blocks = this.parsePastedElements(event, currentRange);
28
33
  const startContainer = (currentRange === null || currentRange === void 0 ? void 0 : currentRange.startContainer) || undefined;
29
34
  if (!startContainer) {
30
35
  // When the selection/range is unavailable (e.g. the caret was lost while
31
36
  // the paste-mode chooser had focus), still append the pasted content to
32
37
  // the root so the paste is never silently dropped.
33
- this.insertBlocksToRoot(blocks);
38
+ return this.insertBlocksToRoot(blocks);
34
39
  }
35
- else if (this.isRootContainer(startContainer)) {
36
- this.insertBlocksToRoot(blocks);
40
+ if (this.isRootContainer(startContainer)) {
37
41
  // TODO: Need to check below logic, it seems not correct https://gethired.atlassian.net/browse/VD-7779
42
+ return this.insertBlocksToRoot(blocks);
38
43
  }
39
- else if (this.isEmptyParagraph(startContainer)) {
40
- this.insertBlocksBeforeEmptyBlock(blocks, currentRange);
41
- }
42
- else {
43
- this.insertBlocksToContent(blocks, currentRange);
44
+ if (this.isEmptyParagraph(startContainer)) {
45
+ return this.insertBlocksBeforeEmptyBlock(blocks, currentRange);
44
46
  }
47
+ return this.insertBlocksToContent(blocks, currentRange);
45
48
  }
46
49
  /**
47
50
  * Inserts plain-text paste content into the current text node at caret position.
48
51
  *
49
52
  * @param {RTEPastePayload} payload - Clipboard payload.
50
53
  * @param {RTERange} currentRange - Current selection range.
51
- * @returns {boolean} True when inline insertion is handled.
54
+ * @returns {CompositionStep[] | undefined} The content + caret steps when inline insertion applies, otherwise undefined.
52
55
  */
53
56
  insertPlainTextInline(payload, currentRange) {
54
57
  var _a, _b;
55
58
  const selectedNodes = ((_b = (_a = this.selectionController).getSelectedNodes) === null || _b === void 0 ? void 0 : _b.call(_a)) || [];
56
59
  if (!this.shouldPasteAsInlinePlainText(payload, currentRange, selectedNodes)) {
57
- return false;
60
+ return undefined;
58
61
  }
59
62
  const text = payload.text.replace(/\r\n?/g, '\n');
60
63
  const cursorNode = selectedNodes.find((node) => node instanceof RTETextNode) || currentRange.startNode;
61
64
  if (!(cursorNode instanceof RTETextNode)) {
62
- return false;
63
- }
64
- cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
65
- this.selectionController.enqueueSelectionRangeFutureState(cursorNode, currentRange.startOffset + text.length);
66
- return true;
65
+ return undefined;
66
+ }
67
+ return [
68
+ { target: cursorNode, action: new ReplaceSelectedTextAction(text, currentRange) },
69
+ {
70
+ target: this.currentState,
71
+ action: new UpdateCursorPositionAction(cursorNode, currentRange.startOffset + text.length),
72
+ },
73
+ ];
67
74
  }
68
75
  /**
69
76
  * Determines whether the payload should be inserted as inline plain text.
@@ -128,68 +135,116 @@ export class InsertPasteHandler extends BaseHandler {
128
135
  * Insert the blocks to root
129
136
  *
130
137
  * @param { RTEContentBlock[]} blocks - blocks
138
+ * @returns {CompositionStep[]} The append step for the root.
131
139
  */
132
140
  insertBlocksToRoot(blocks) {
133
- this.currentState.apply(new AppendChildrenAction(blocks));
141
+ return [{ target: this.currentState, action: new AppendChildrenAction(blocks) }];
134
142
  }
135
143
  /**
136
144
  * Insert the blocks into the current content block at the specified range.
137
145
  *
138
146
  * @param { RTEContentBlock[]} blocks - blocks
139
147
  * @param { RTERange } rteRange - rteRange
148
+ * @returns {CompositionStep[]} The content + caret steps for the content branch.
140
149
  */
141
150
  insertBlocksToContent(blocks, rteRange) {
142
- var _a;
143
151
  const isCollapsedRange = rteRange.startNode === rteRange.endNode && rteRange.startOffset === rteRange.endOffset;
144
152
  const cursorNode = isCollapsedRange
145
153
  ? rteRange.startNode
146
154
  : this.removeSelectionRange();
147
155
  if (cursorNode && cursorNode.parent) {
148
- const pasteAction = new PasteContentAction(blocks, cursorNode, rteRange.startOffset, rteRange);
149
- cursorNode.parent.apply(pasteAction);
150
- if (pasteAction.futureFocusNode) {
151
- this.selectionController.enqueueSelectionRangeFutureState(pasteAction.futureFocusNode, (_a = pasteAction.futureFocusNodeOffset) !== null && _a !== void 0 ? _a : 0);
152
- }
153
- else if (pasteAction.futureFocusBlock) {
154
- this.switchCaretPositionToNextElement(pasteAction.futureFocusBlock, pasteAction.futureFocusAtEnd);
155
- }
156
- }
157
- else {
158
- // No resolvable cursor position: fall back to appending at the root so
159
- // the pasted content is preserved instead of being discarded.
160
- this.insertBlocksToRoot(blocks);
161
- }
156
+ const contentStep = {
157
+ target: cursorNode.parent,
158
+ action: new PasteContentAction(blocks, cursorNode, rteRange.startOffset, rteRange),
159
+ };
160
+ // eslint-disable-next-line jsdoc/require-jsdoc
161
+ const caretStep = (context) => {
162
+ var _a;
163
+ const pasteAction = context.getAction(ModifyContentActionType.PASTE_CONTENT);
164
+ if (pasteAction && pasteAction.futureFocusNode) {
165
+ return {
166
+ target: this.currentState,
167
+ action: new UpdateCursorPositionAction(pasteAction.futureFocusNode, (_a = pasteAction.futureFocusNodeOffset) !== null && _a !== void 0 ? _a : 0),
168
+ };
169
+ }
170
+ if (pasteAction && pasteAction.futureFocusBlock) {
171
+ return this.caretToBlockOperation(pasteAction.futureFocusBlock, pasteAction.futureFocusAtEnd);
172
+ }
173
+ };
174
+ return [contentStep, caretStep];
175
+ }
176
+ // No resolvable cursor position: fall back to appending at the root so
177
+ // the pasted content is preserved instead of being discarded.
178
+ return this.insertBlocksToRoot(blocks);
162
179
  }
163
180
  /**
164
181
  * Insert the blocks before to current block
165
182
  *
166
183
  * @param { RTEContentBlock[]} blocks - blocks
167
184
  * @param { RTERange } rteRange - rteRange
185
+ * @returns {CompositionStep[]} The content + caret steps for the empty-paragraph branch.
168
186
  */
169
187
  insertBlocksBeforeEmptyBlock(blocks, rteRange) {
170
188
  const cursorNode = this.removeSelectionRange();
171
189
  const currentBlock = cursorNode === null || cursorNode === void 0 ? void 0 : cursorNode.parent;
172
190
  if (currentBlock) {
173
- const pasteAction = new PasteContentAction(blocks, cursorNode, 0, rteRange);
174
- currentBlock.apply(pasteAction);
175
- if (pasteAction.futureFocusBlock) {
176
- this.switchCaretPositionToNextElement(pasteAction.futureFocusBlock, pasteAction.futureFocusAtEnd);
177
- }
178
- }
179
- else {
180
- // No resolvable empty block: fall back to appending at the root so the
181
- // pasted content is preserved instead of being discarded.
182
- this.insertBlocksToRoot(blocks);
183
- }
191
+ const contentStep = {
192
+ target: currentBlock,
193
+ action: new PasteContentAction(blocks, cursorNode, 0, rteRange),
194
+ };
195
+ // eslint-disable-next-line jsdoc/require-jsdoc
196
+ const caretStep = (context) => {
197
+ const pasteAction = context.getAction(ModifyContentActionType.PASTE_CONTENT);
198
+ if (pasteAction && pasteAction.futureFocusBlock) {
199
+ return this.caretToBlockOperation(pasteAction.futureFocusBlock, pasteAction.futureFocusAtEnd);
200
+ }
201
+ };
202
+ return [contentStep, caretStep];
203
+ }
204
+ // No resolvable empty block: fall back to appending at the root so the
205
+ // pasted content is preserved instead of being discarded.
206
+ return this.insertBlocksToRoot(blocks);
184
207
  }
185
208
  /**
186
209
  * Format and parse elements from user paste with simple style preservation.
187
210
  *
188
211
  * @param {InputEvent} event - Paste event.
212
+ * @param {RTERange} [currentRange] - Optional range used to resolve the paste location.
189
213
  * @returns {RTEContentBlock[]} - RTEContentBlock.
190
214
  */
191
- parsePastedElements(event) {
215
+ parsePastedElements(event, currentRange) {
216
+ var _a;
192
217
  const payload = this.getPastePayload(event);
218
+ if (payload.type === RTE_PASTE_MODE_PLAIN) {
219
+ // Native tables encode their layout as tab-separated cells (one row per line) in
220
+ // text/plain, so pasting that verbatim keeps the rows/columns. Non-native tables (rich text
221
+ // editor tables) put a blank line between cells in text/plain, so they derive from HTML
222
+ // instead: htmlToPlainText puts each cell on its own line with no gaps while keeping in-cell breaks.
223
+ let plainText;
224
+ let hasEncodedWhitespace = (_a = payload.hasEncodedWhitespace) !== null && _a !== void 0 ? _a : false;
225
+ if (payload.html &&
226
+ payload.text &&
227
+ payload.text.includes('\t') &&
228
+ htmlContainsTable(payload.html)) {
229
+ plainText = payload.text;
230
+ }
231
+ else if (payload.html && htmlContainsTable(payload.html)) {
232
+ plainText = this.extractPlainTextFromHtml(payload.html, true);
233
+ hasEncodedWhitespace = true;
234
+ }
235
+ else {
236
+ plainText = '';
237
+ if (payload.text) {
238
+ plainText = payload.text;
239
+ }
240
+ else if (payload.html) {
241
+ plainText = this.extractPlainTextFromHtml(payload.html, true);
242
+ hasEncodedWhitespace = true;
243
+ }
244
+ }
245
+ const styleSource = (currentRange === null || currentRange === void 0 ? void 0 : currentRange.startNode) instanceof RTETextNode ? currentRange.startNode : undefined;
246
+ return this.buildPlainTextParagraph(plainText, styleSource, hasEncodedWhitespace);
247
+ }
193
248
  let pastedHTML = payload.html || '';
194
249
  if (!pastedHTML) {
195
250
  pastedHTML = this.parsePlainText(payload.text || '');
@@ -227,16 +282,21 @@ export class InsertPasteHandler extends BaseHandler {
227
282
  return resultBlocks;
228
283
  }
229
284
  /**
230
- * Extracts readable plain text from clipboard HTML.
285
+ * Extracts plain text from HTML when clipboard lacks `text/plain`.
231
286
  *
232
287
  * @param {string} html - Clipboard text/html payload.
288
+ * @param {boolean} keepPreservedWhitespaceMarkers - Keep code-block indentation as sentinels so
289
+ * the plain-mode boundary collapse in `toPlainPasteLines` does not strip it (that helper decodes
290
+ * the sentinels). Must stay `false` for the rich path, which feeds `parsePlainText` directly.
233
291
  * @returns {string} - Plain text extracted from HTML.
234
292
  */
235
- extractPlainTextFromHtml(html) {
293
+ extractPlainTextFromHtml(html, keepPreservedWhitespaceMarkers = false) {
236
294
  // Preserve inline styles before parsing to avoid style-src-attr CSP violations.
237
295
  const safeHtml = StylePreservator.preserve(html).getProcessedHtml();
238
- const parsedDoc = new DOMParser().parseFromString(safeHtml, 'text/html');
239
- return (parsedDoc.body.textContent || '').replace(/\r\n?/g, '\n');
296
+ return htmlToPlainText(safeHtml, {
297
+ preserveBoundaryBlankLines: true,
298
+ keepPreservedWhitespaceMarkers,
299
+ });
240
300
  }
241
301
  /**
242
302
  * Builds plain-text paragraph blocks when element strategy parsing returns no output.
@@ -245,7 +305,7 @@ export class InsertPasteHandler extends BaseHandler {
245
305
  * @returns {RTEContentBlock[]} Fallback text blocks.
246
306
  */
247
307
  buildPlainTextFallbackBlocks(text) {
248
- return text.split('\n').map((line) => {
308
+ return normalizePlainTextLines(text).map((line) => {
249
309
  const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
250
310
  const textNode = new RTETextNode(`${paragraph.id}1`, line, paragraph);
251
311
  paragraph.apply(new AppendChildrenAction([textNode]));
@@ -253,21 +313,66 @@ export class InsertPasteHandler extends BaseHandler {
253
313
  });
254
314
  }
255
315
  /**
256
- * Moves the caret to a block element in a rich text editor after paste.
316
+ * Builds plain-text paragraphs by splitting on `\n`.
317
+ *
318
+ * Shares `toPlainPasteLines` with `PlainPasteProcessingStrategy` so both
319
+ * representations of plain-mode content (HTML and RTE nodes) agree on line
320
+ * boundaries and boundary whitespace.
321
+ *
322
+ * @param {string} text - Plain text clipboard content.
323
+ * @param {RTETextNode} [styleSource] - Optional style to preserve in all nodes.
324
+ * @param {boolean} decodeEncodedWhitespace - Decode HTML-derived whitespace markers.
325
+ * @returns {RTEContentBlock[]} Paragraph-per-line blocks.
326
+ */
327
+ buildPlainTextParagraph(text, styleSource, decodeEncodedWhitespace = false) {
328
+ const lines = toPlainPasteLines(text, decodeEncodedWhitespace);
329
+ return lines.map((line, lineIndex) => {
330
+ const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
331
+ // Always attach a text node (empty for blank lines) so empty paragraphs
332
+ // render with a zero-width space and keep their visible line height,
333
+ // instead of collapsing to an invisible zero-height `<p></p>`.
334
+ const node = this.createPlainTextNode(paragraph, lineIndex, line, styleSource);
335
+ paragraph.apply(new AppendChildrenAction([node]));
336
+ return paragraph;
337
+ });
338
+ }
339
+ /**
340
+ * Creates a text node for plain paste; optionally inherits style from source node.
341
+ *
342
+ * @param {RTETextBlock} paragraph - Parent paragraph.
343
+ * @param {number} index - Character index for node ID generation.
344
+ * @param {string} text - Text content.
345
+ * @param {RTETextNode} [styleSource] - Optional style to inherit.
346
+ * @returns {RTETextNode} Created text node.
347
+ */
348
+ createPlainTextNode(paragraph, index, text, styleSource) {
349
+ const node = styleSource
350
+ ? styleSource.cloneWithText(text)
351
+ : new RTETextNode(`${paragraph.id}-${index}`, text, paragraph);
352
+ node.parent = paragraph;
353
+ return node;
354
+ }
355
+ /**
356
+ * Builds the caret operation that moves onto a block element in a rich text editor after paste.
257
357
  *
258
358
  * @param {RTEBlock} newBlock - Block element to move the caret to.
259
359
  * @param {boolean} atEnd - When true, places the caret after the last character of the block's last node; otherwise at offset 0 of the first node.
360
+ * @returns {CompositionOperation | void} The caret operation, or nothing when the block has no children.
260
361
  */
261
- switchCaretPositionToNextElement(newBlock, atEnd = false) {
362
+ caretToBlockOperation(newBlock, atEnd = false) {
262
363
  var _a, _b;
263
364
  if (newBlock && newBlock.children) {
264
365
  if (atEnd) {
265
366
  const lastNode = newBlock.children[newBlock.children.length - 1];
266
- this.selectionController.enqueueSelectionRangeFutureState(lastNode, (_b = (_a = lastNode.text) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0);
267
- }
268
- else {
269
- this.selectionController.enqueueSelectionRangeFutureState(newBlock.children[0], 0);
367
+ return {
368
+ target: this.currentState,
369
+ action: new UpdateCursorPositionAction(lastNode, (_b = (_a = lastNode.text) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0),
370
+ };
270
371
  }
372
+ return {
373
+ target: this.currentState,
374
+ action: new UpdateCursorPositionAction(newBlock.children[0], 0),
375
+ };
271
376
  }
272
377
  }
273
378
  /**
@@ -489,6 +594,7 @@ export class InsertPasteHandler extends BaseHandler {
489
594
  html: event.dataTransfer.getData('text/html') || eventPayload.html || '',
490
595
  text: event.dataTransfer.getData('text/plain') || eventPayload.text || '',
491
596
  type: event.dataTransfer.getData(RTE_PASTE_MODE_DATA_TYPE) || '',
597
+ hasEncodedWhitespace: event.dataTransfer.getData(RTE_PRESERVED_WHITESPACE_DATA_TYPE) === 'true',
492
598
  };
493
599
  }
494
600
  }
@@ -1,36 +1,52 @@
1
1
  import { BaseHandler } from './base-handler';
2
2
  import { RTETextBlock } from '../../../../dto/blocks/text-block';
3
- import { ZERO_WIDTH_SPACE } from '../../../../constants/constant';
3
+ import { RTE_UPDATE_SOURCE_KEY, RTEUpdateSource, ZERO_WIDTH_SPACE } from '../../../../constants/constant';
4
4
  import { RTETextNode } from '../../../../dto/nodes/text-node';
5
5
  import { UpdateTextAction } from '../../../../dto/actions/update-text-action';
6
6
  import { ReplaceSelectedTextAction } from '../../../../dto/actions/replace-selected-text-action';
7
7
  import { InsertChildrenBeforeAction } from '../../../../dto/actions/insert-children-before-block';
8
8
  import { InsertTextToDecoratorNodeAction } from '../../../../dto/actions/insert-text-to-decorator-node-action';
9
+ import { UpdateCursorPositionAction } from '../../../../dto/actions/update-cursor-position-action';
9
10
  /** Handles inserting text into a VegaRTEContent based on the current selection and input event. User input character will trigger this callback */
10
11
  export class InsertTextHandler extends BaseHandler {
11
12
  /**
12
13
  * Update the state value when user type character
13
14
  *
14
15
  * @param {InputEvent} event - The input event object
16
+ * @returns {Nullable<CompositionStep[]>} The content actions the base handler applies as one flushable unit.
15
17
  */
16
18
  handleEvent(event) {
19
+ // The composition input controller stamps its synthesized `beforeinput` events with the
20
+ // composition update source; pick that up so the flush notification carries the right
21
+ // source without the caller having to inspect the event.
22
+ if (this.flushOptions) {
23
+ this.flushOptions.updateSource =
24
+ event[RTE_UPDATE_SOURCE_KEY] === RTEUpdateSource.Composition
25
+ ? RTEUpdateSource.Composition
26
+ : RTEUpdateSource.Default;
27
+ }
17
28
  const text = event.data;
18
29
  const currentRange = this.selectionController.getCurrentRange();
19
30
  const { startContainer, startOffset } = currentRange;
20
31
  const selectedNodes = this.selectionController.getSelectedNodes();
32
+ const steps = [];
33
+ // The caret move is appended as the final composition step so content + caret apply and flush atomically.
34
+ let caretNode = null;
35
+ let caretOffset = 0;
36
+ let updateFlag = false;
21
37
  if (selectedNodes.length < 2) {
22
38
  if (!selectedNodes.length && this.isRootContainer(startContainer)) {
23
- const cursorNode = this.insertTextToRoot(text);
24
- this.selectionController.enqueueSelectionRangeFutureState(cursorNode, text.length);
39
+ caretNode = this.insertTextToRoot(text, steps);
40
+ caretOffset = text.length;
25
41
  }
26
42
  else if (selectedNodes[0] instanceof RTETextNode) {
27
43
  if (selectedNodes[0].isContentEditable()) {
28
44
  let nextOffset = startOffset + text.length;
29
- let updateFlag = false;
30
45
  let cursorNode = selectedNodes[0];
31
46
  if (cursorNode.text === '\n') {
32
- cursorNode = this.insertTextToLineBreakNode(cursorNode, text);
33
- updateFlag = true;
47
+ cursorNode = this.insertTextToLineBreakNode(cursorNode, text, steps);
48
+ // UpdateTextAction replaces the \n with the input, so the caret lands at the text end.
49
+ nextOffset = text.length;
34
50
  }
35
51
  else {
36
52
  if (startContainer.nodeValue === ZERO_WIDTH_SPACE &&
@@ -39,40 +55,54 @@ export class InsertTextHandler extends BaseHandler {
39
55
  startContainer.nodeValue = '';
40
56
  nextOffset = nextOffset - ZERO_WIDTH_SPACE.length;
41
57
  }
42
- if (cursorNode instanceof RTETextNode) {
43
- updateFlag = true;
44
- cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
45
- }
58
+ steps.push({
59
+ target: cursorNode,
60
+ action: new ReplaceSelectedTextAction(text, currentRange),
61
+ });
46
62
  }
47
- updateFlag &&
48
- this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(nextOffset, cursorNode['text'].length));
63
+ caretNode = cursorNode;
64
+ // Content applies later via the composition, so use the post-apply offset directly (no pre-apply clamp).
65
+ caretOffset = nextOffset;
49
66
  }
50
67
  else {
51
- selectedNodes[0].parent.apply(new InsertTextToDecoratorNodeAction(selectedNodes[0], text, startOffset));
68
+ steps.push({
69
+ target: selectedNodes[0].parent,
70
+ action: new InsertTextToDecoratorNodeAction(selectedNodes[0], text, startOffset),
71
+ });
52
72
  }
53
73
  }
54
74
  }
55
75
  else {
56
76
  // The selected nodes is multiple nodes
57
77
  const cursorNode = this.removeSelectionRange(true);
78
+ updateFlag = true;
58
79
  if (cursorNode instanceof RTETextNode) {
59
- cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
60
- this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(startOffset + text.length, cursorNode.text.length));
80
+ steps.push({ target: cursorNode, action: new ReplaceSelectedTextAction(text, currentRange) });
81
+ caretNode = cursorNode;
82
+ caretOffset = startOffset + text.length;
61
83
  }
62
84
  }
85
+ if (caretNode) {
86
+ steps.push({
87
+ target: this.currentState,
88
+ action: new UpdateCursorPositionAction(caretNode, caretOffset),
89
+ });
90
+ }
91
+ return updateFlag || steps.length > 0 ? steps : undefined;
63
92
  }
64
93
  /**
65
94
  * Insert the text in root element when root container is empty, should create text block and text node
66
95
  *
67
96
  * @param {string} text The insert text
68
- * @returns {RTETextNode} The new create text node
97
+ * @param {CompositionStep[]} steps The composition steps collector to append the update action to
98
+ * @returns {Nullable<RTETextNode>} The new create text node
69
99
  */
70
- insertTextToRoot(text) {
100
+ insertTextToRoot(text, steps) {
71
101
  if (this.currentState &&
72
102
  this.currentState.children[0] &&
73
103
  this.currentState.children[0] instanceof RTETextBlock) {
74
104
  const firstNode = this.currentState.children[0].children[0];
75
- firstNode.apply(new UpdateTextAction(text));
105
+ steps.push({ target: firstNode, action: new UpdateTextAction(text) });
76
106
  return firstNode;
77
107
  }
78
108
  }
@@ -81,20 +111,24 @@ export class InsertTextHandler extends BaseHandler {
81
111
  *
82
112
  * @param {RTETextNode} lineBreakNode The current line break node, the text value is \n
83
113
  * @param {string} text The text need to insert
114
+ * @param {CompositionStep[]} steps The composition steps collector to append the resulting action to
84
115
  * @returns {Nullable<RTETextNode>} The new text node or the current line break node
85
116
  */
86
- insertTextToLineBreakNode(lineBreakNode, text) {
117
+ insertTextToLineBreakNode(lineBreakNode, text, steps) {
87
118
  const { startOffset, endOffset } = this.selectionController.getCurrentRange();
88
119
  const textBlock = lineBreakNode.parent;
89
120
  if (textBlock instanceof RTETextBlock) {
90
121
  const index = textBlock.children.indexOf(lineBreakNode);
91
122
  if (startOffset === 0 && startOffset === endOffset && textBlock.children[index + 1]) {
92
123
  const newTextNode = lineBreakNode.cloneWithText(text);
93
- textBlock.apply(new InsertChildrenBeforeAction(lineBreakNode, newTextNode));
124
+ steps.push({
125
+ target: textBlock,
126
+ action: new InsertChildrenBeforeAction(lineBreakNode, newTextNode),
127
+ });
94
128
  return newTextNode;
95
129
  }
96
130
  else {
97
- lineBreakNode.apply(new UpdateTextAction(text));
131
+ steps.push({ target: lineBreakNode, action: new UpdateTextAction(text) });
98
132
  return lineBreakNode;
99
133
  }
100
134
  }