@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.
- package/dist/cjs/{app-globals-49c2a999.js → app-globals-85986306.js} +10 -10
- package/dist/cjs/{code-block-06e6591f.js → code-block-72de6c4d.js} +80 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-f29908f8.js → component-value-history-controller-slimmer.abstract-23d2b3d8.js} +3 -3
- package/dist/cjs/{content-state-8c862e5e.js → content-state-ff40bdc6.js} +38 -5
- package/dist/cjs/{date-required-rule-b672c432.js → date-required-rule-608e704b.js} +1 -1
- package/dist/cjs/{design-token-351ffd2c.js → design-token-a101a8d0.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-f932b166.js → element-appender-slimmer-b93cc564.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-5adb86ae.js → form-field-controller-slimmer-124d54ea.js} +1 -1
- package/dist/cjs/{image-annotation-action-25907d6b.js → image-annotation-action-1ee41bc7.js} +2 -2
- package/dist/cjs/{image-extension-1cf84f27.js → image-extension-6a92c524.js} +247 -5
- package/dist/cjs/index.cjs.js +17 -17
- package/dist/cjs/{inject-keyboard-manager-84d33920.js → inject-keyboard-manager-32d7dd0e.js} +1 -1
- package/dist/cjs/{internal-calendar-period-factory-3c5236be.js → internal-calendar-period-factory-c3198ea7.js} +1 -1
- package/dist/cjs/{internal-translation-controller-eae8a8de.js → internal-translation-controller-0d67ca4d.js} +1 -0
- package/dist/cjs/{keyboard-manager-baa83a61.js → keyboard-manager-332eec89.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-d1974b28.js → keyboard-manager-slimmer-a2872981.js} +1 -1
- package/dist/cjs/{link-extension-2a6133b7.js → link-extension-1b4ed437.js} +3 -3
- package/dist/cjs/loader.cjs.js +12 -12
- package/dist/cjs/{month-view-generator-a6827548.js → month-view-generator-b6a2b8be.js} +1 -1
- package/dist/cjs/{public-rules-7f26e0ae.js → public-rules-2066613c.js} +7 -7
- package/dist/cjs/{range-518b95a2.js → range-712fe703.js} +1 -1
- package/dist/cjs/{responsive-format-facade-95c54444.js → responsive-format-facade-44d33457.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-5d0c76ec.js → rich-text-editor-required-rule-1aa75d22.js} +1 -1
- package/dist/cjs/{split-cell-operation-28f6f8d9.js → split-cell-operation-afc82323.js} +3 -3
- package/dist/cjs/{state-border-formatter-6c284859.js → state-border-formatter-49984fd6.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-f15b6196.js → string-format-strategy.abstract-bd563c01.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-5a3f1b55.js → string-input-formatter-slimmer-4faebac9.js} +1 -1
- package/dist/cjs/{string-mask-strategy-af6f3ba0.js → string-mask-strategy-624c4398.js} +2 -2
- package/dist/cjs/{style-formatter-324211fd.js → style-formatter-151d89a3.js} +2 -2
- package/dist/cjs/{time-required-rule-9e714442.js → time-required-rule-8cd8f9b9.js} +1 -1
- package/dist/cjs/{token-extension-86723cad.js → token-extension-72d0cb08.js} +1011 -767
- package/dist/cjs/{translation-slimmer-0227ee24.js → translation-slimmer-1771d01f.js} +1 -1
- package/dist/cjs/{type-guard-29e01bd4.js → type-guard-cce6fe1f.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-4ec364af.js → valid-credit-card-number-rule-b13c2fc4.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
- package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-box.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +3 -3
- package/dist/cjs/vega-calendar_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +13 -13
- package/dist/cjs/vega-dialog_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-image-uploader.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-numeric.cjs.entry.js +12 -14
- package/dist/cjs/vega-input-passcode.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +5 -5
- package/dist/cjs/vega-input.cjs.entry.js +31 -27
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
- package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-bookmark-editor.cjs.entry.js +2 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +474 -207
- package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +1 -1
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
- package/dist/cjs/vega.cjs.js +12 -12
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-state-controller.js +0 -14
- package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.js +11 -2
- package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-renderer.js +11 -1
- package/dist/collection/components/vega-input/vega-input.js +52 -8
- package/dist/collection/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.js +7 -1
- package/dist/collection/components/vega-input-numeric/vega-input-numeric.js +0 -8
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/sequential-composition-strategy.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/sequential-composition-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/dto/flush-changes-payload.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/chooser-positioner.js +107 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/paste-chooser-controller.js +91 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/paste-event-interceptor.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/selection-snapshot-service.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/image-extractor.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-extension.js +41 -354
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/data-transfer-builder.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/paste-dispatcher.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/paste-processing-pipeline.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.js +34 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/plain-paste-strategy.js +74 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/type.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/helpers/utils.js +67 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +67 -11
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.js +4 -17
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +34 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.js +13 -32
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +60 -25
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +55 -19
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +165 -59
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +55 -21
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +2 -16
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +11 -1
- package/dist/collection/components/vega-rich-text-editor/utils/html-to-plain-text-utils.js +240 -0
- package/dist/collection/helpers/translation/locales/en.js +1 -0
- package/dist/esm/{app-globals-da5c83c2.js → app-globals-8cdfc5c9.js} +10 -10
- package/dist/esm/{code-block-d8f83d85.js → code-block-9360c331.js} +74 -2
- package/dist/esm/{component-value-history-controller-slimmer.abstract-642e7147.js → component-value-history-controller-slimmer.abstract-9ea58806.js} +3 -3
- package/dist/esm/{content-state-486eae1d.js → content-state-67a12e74.js} +38 -5
- package/dist/esm/{date-required-rule-08695d25.js → date-required-rule-66b5bf02.js} +1 -1
- package/dist/esm/{design-token-df3331d9.js → design-token-acd1efeb.js} +3 -3
- package/dist/esm/{element-appender-slimmer-f02a227f.js → element-appender-slimmer-7e5bc1e9.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-a7c0a0f8.js → form-field-controller-slimmer-d653c494.js} +1 -1
- package/dist/esm/{image-annotation-action-df744ba5.js → image-annotation-action-9525be48.js} +2 -2
- package/dist/esm/{image-extension-20b39140.js → image-extension-aea75132.js} +246 -6
- package/dist/esm/index.js +17 -17
- package/dist/esm/{inject-keyboard-manager-399ed867.js → inject-keyboard-manager-f6522d2f.js} +1 -1
- package/dist/esm/{internal-calendar-period-factory-7b866c3b.js → internal-calendar-period-factory-261df2f2.js} +1 -1
- package/dist/esm/{internal-translation-controller-4a7ee4d5.js → internal-translation-controller-3637e47e.js} +1 -0
- package/dist/esm/{keyboard-manager-f5d13a34.js → keyboard-manager-53e8d8d0.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-f40dcb54.js → keyboard-manager-slimmer-b3de042d.js} +1 -1
- package/dist/esm/{link-extension-3f93d70d.js → link-extension-57ba9520.js} +3 -3
- package/dist/esm/loader.js +12 -12
- package/dist/esm/{month-view-generator-0c665987.js → month-view-generator-15215a09.js} +1 -1
- package/dist/esm/{public-rules-470a1dac.js → public-rules-c77a1550.js} +7 -7
- package/dist/esm/{range-8e89fb54.js → range-3c74e1c8.js} +1 -1
- package/dist/esm/{responsive-format-facade-55131a33.js → responsive-format-facade-1b325d06.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-06caf383.js → rich-text-editor-required-rule-cfd32ba2.js} +1 -1
- package/dist/esm/{split-cell-operation-e158366a.js → split-cell-operation-85a036f9.js} +3 -3
- package/dist/esm/{state-border-formatter-2b73fa08.js → state-border-formatter-ce3495b0.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-8c7937e3.js → string-format-strategy.abstract-8ce04558.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-681c6b71.js → string-input-formatter-slimmer-0d60ba7d.js} +1 -1
- package/dist/esm/{string-mask-strategy-b8cceee6.js → string-mask-strategy-cabc1d50.js} +2 -2
- package/dist/esm/{style-formatter-fcd70869.js → style-formatter-00fe4f1c.js} +2 -2
- package/dist/esm/{time-required-rule-ce50859b.js → time-required-rule-57ceeae9.js} +1 -1
- package/dist/esm/{token-extension-2401e753.js → token-extension-645a9520.js} +1011 -767
- package/dist/esm/{translation-slimmer-b3f3cf65.js → translation-slimmer-b69057eb.js} +1 -1
- package/dist/esm/{type-guard-08c82e08.js → type-guard-204094c6.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-66bad519.js → valid-credit-card-number-rule-0874e19f.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -6
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +3 -3
- package/dist/esm/vega-calendar_5.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +2 -2
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-color-swatch-picker.entry.js +3 -3
- package/dist/esm/vega-color-swatch.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +8 -8
- package/dist/esm/vega-date-picker_2.entry.js +13 -13
- package/dist/esm/vega-dialog_2.entry.js +3 -3
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +7 -7
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +3 -3
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +5 -5
- package/dist/esm/vega-input-credit-card.entry.js +6 -6
- package/dist/esm/vega-input-numeric.entry.js +12 -14
- package/dist/esm/vega-input-passcode.entry.js +5 -5
- package/dist/esm/vega-input-phone-number.entry.js +4 -4
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +5 -5
- package/dist/esm/vega-input.entry.js +31 -27
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-popover_2.entry.js +8 -8
- package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
- package/dist/esm/vega-radio_2.entry.js +5 -5
- package/dist/esm/vega-rich-text-bookmark-editor.entry.js +2 -2
- package/dist/esm/vega-rich-text-content.entry.js +6 -6
- package/dist/esm/vega-rich-text-editor_4.entry.js +474 -207
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +1 -1
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
- package/dist/esm/vega-selection-chip_2.entry.js +4 -4
- package/dist/esm/vega-selection-tile_2.entry.js +2 -2
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-tab-group_2.entry.js +6 -6
- package/dist/esm/vega-table_11.entry.js +4 -4
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +9 -9
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +6 -6
- package/dist/esm/vega.js +12 -12
- package/dist/sri/vega-sri-manifest.json +321 -321
- package/dist/types/components/vega-input/slimmers/controllers/vega-input-state-controller.d.ts +0 -2
- package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.d.ts +4 -0
- package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-renderer.d.ts +2 -0
- package/dist/types/components/vega-input/vega-input.d.ts +15 -3
- package/dist/types/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.d.ts +2 -0
- package/dist/types/components/vega-input-numeric/vega-input-numeric.d.ts +0 -2
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/sequential-composition-strategy.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +4 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/sequential-composition-action.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/flush-changes-payload.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/chooser-positioner.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/paste-chooser-controller.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/paste-event-interceptor.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/selection-snapshot-service.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/image-extractor.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/paste-image-parser.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/pending-image-registry.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-extension.d.ts +28 -93
- package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/data-transfer-builder.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/paste-dispatcher.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/paste-processing-pipeline.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.d.ts +28 -6
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/plain-paste-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/type.d.ts +35 -0
- package/dist/types/components/vega-rich-text-editor/helpers/utils.d.ts +47 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.d.ts +17 -6
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +30 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +21 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.d.ts +12 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +38 -5
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.d.ts +7 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/utils/html-to-plain-text-utils.d.ts +31 -0
- package/dist/types/components.d.ts +24 -0
- package/dist/types/helpers/translation/interface.d.ts +1 -0
- package/dist/types/types/public-api.d.ts +2 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-8a4cc7c2.entry.js → p-0169f71c.entry.js} +1 -1
- package/dist/vega/p-018bb83b.entry.js +1 -0
- package/dist/vega/{p-25e51acb.js → p-08bf08d2.js} +1 -1
- package/dist/vega/{p-85a940c0.entry.js → p-0b33753f.entry.js} +1 -1
- package/dist/vega/{p-a5fa260b.js → p-1537b1e4.js} +1 -1
- package/dist/vega/{p-7dfb1481.entry.js → p-17f6dc94.entry.js} +1 -1
- package/dist/vega/{p-dd673eb4.entry.js → p-1a4d1991.entry.js} +1 -1
- package/dist/vega/{p-557b64bd.js → p-1b2e5898.js} +1 -1
- package/dist/vega/{p-2256eb09.entry.js → p-1f1f93bf.entry.js} +1 -1
- package/dist/vega/{p-d86e0b01.js → p-1fb953f8.js} +1 -1
- package/dist/vega/{p-03efc67a.entry.js → p-2171b571.entry.js} +1 -1
- package/dist/vega/p-255fe20b.js +1 -0
- package/dist/vega/{p-cf5c5515.js → p-261cf764.js} +1 -1
- package/dist/vega/{p-f0b49ae4.entry.js → p-27e77ea1.entry.js} +1 -1
- package/dist/vega/{p-109f0e33.entry.js → p-28acbe42.entry.js} +1 -1
- package/dist/vega/{p-27c9c2a5.entry.js → p-2acc600a.entry.js} +1 -1
- package/dist/vega/p-2fc2299f.js +1 -0
- package/dist/vega/{p-b48caf90.entry.js → p-2ff659a1.entry.js} +1 -1
- package/dist/vega/{p-527c3211.entry.js → p-322da1eb.entry.js} +1 -1
- package/dist/vega/{p-dffe47db.js → p-3283fa2f.js} +1 -1
- package/dist/vega/p-3567dc55.entry.js +1 -0
- package/dist/vega/{p-c6419eb3.entry.js → p-36b795c6.entry.js} +1 -1
- package/dist/vega/p-37714a3a.js +1 -0
- package/dist/vega/{p-d7e59f31.js → p-3b4e2ba0.js} +1 -1
- package/dist/vega/{p-3d060d2f.entry.js → p-3b911043.entry.js} +1 -1
- package/dist/vega/{p-5c6d36ef.entry.js → p-3e270b65.entry.js} +1 -1
- package/dist/vega/{p-b68f55e2.js → p-4043508a.js} +1 -1
- package/dist/vega/p-4151d4a8.js +1 -0
- package/dist/vega/{p-c6b6987e.js → p-45af801f.js} +1 -1
- package/dist/vega/p-48c2150b.entry.js +1 -0
- package/dist/vega/p-4b253f74.entry.js +1 -0
- package/dist/vega/{p-75c7f8ea.entry.js → p-4cdc064d.entry.js} +1 -1
- package/dist/vega/{p-1d8a8507.entry.js → p-4e4b50f3.entry.js} +1 -1
- package/dist/vega/{p-d8fa2f19.entry.js → p-564110ba.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-bec31ffc.entry.js → p-608d3559.entry.js} +1 -1
- package/dist/vega/{p-3ce7521e.entry.js → p-64eb05d3.entry.js} +1 -1
- package/dist/vega/{p-2f5c4b61.entry.js → p-66bf209b.entry.js} +1 -1
- package/dist/vega/{p-83f5ef3a.entry.js → p-69eadbd8.entry.js} +1 -1
- package/dist/vega/{p-c66c6fd2.entry.js → p-6c4edee8.entry.js} +1 -1
- package/dist/vega/p-6e16bb3a.js +1 -0
- package/dist/vega/{p-7d748545.entry.js → p-76f4fdba.entry.js} +1 -1
- package/dist/vega/{p-4c6989ae.entry.js → p-7874055b.entry.js} +1 -1
- package/dist/vega/{p-ca60a74b.entry.js → p-7d3d24f6.entry.js} +1 -1
- package/dist/vega/{p-3bfb53e3.js → p-7f9ad7bc.js} +1 -1
- package/dist/vega/{p-18ddc6a4.entry.js → p-8193f4ef.entry.js} +1 -1
- package/dist/vega/{p-816064f2.entry.js → p-8197d172.entry.js} +1 -1
- package/dist/vega/{p-634b138c.entry.js → p-8ac0b1b2.entry.js} +1 -1
- package/dist/vega/{p-553510d8.entry.js → p-8c61db9d.entry.js} +1 -1
- package/dist/vega/{p-061a76c3.entry.js → p-8de29082.entry.js} +1 -1
- package/dist/vega/{p-325b804d.entry.js → p-8e59606f.entry.js} +1 -1
- package/dist/vega/p-8ea41806.js +1 -0
- package/dist/vega/{p-ff9090af.entry.js → p-9153c2f5.entry.js} +1 -1
- package/dist/vega/{p-a0c87e88.entry.js → p-92411f56.entry.js} +1 -1
- package/dist/vega/{p-049e64b1.entry.js → p-94d65dcf.entry.js} +1 -1
- package/dist/vega/{p-a261a675.entry.js → p-9a96fb05.entry.js} +1 -1
- package/dist/vega/{p-7044bb48.js → p-9fcfd738.js} +1 -1
- package/dist/vega/{p-b1e1c7d0.js → p-a2c7a3bc.js} +1 -1
- package/dist/vega/p-a2dcde12.js +1 -0
- package/dist/vega/{p-be0eb72f.js → p-a60d75d9.js} +1 -1
- package/dist/vega/{p-5a347a15.js → p-a9fc4043.js} +1 -1
- package/dist/vega/{p-efef0dfe.entry.js → p-abe5f7f0.entry.js} +1 -1
- package/dist/vega/{p-197388a5.entry.js → p-ac98c189.entry.js} +1 -1
- package/dist/vega/{p-dd273d89.entry.js → p-ade903b3.entry.js} +1 -1
- package/dist/vega/{p-c0eb8c58.js → p-affb40e8.js} +1 -1
- package/dist/vega/{p-277aab9b.js → p-b3a1cd22.js} +1 -1
- package/dist/vega/p-b63a90b3.entry.js +1 -0
- package/dist/vega/{p-f9f96030.entry.js → p-ba050d63.entry.js} +1 -1
- package/dist/vega/{p-bf0b46c1.js → p-ba67eb96.js} +1 -1
- package/dist/vega/{p-f0c6e9c5.entry.js → p-c08ac33f.entry.js} +1 -1
- package/dist/vega/{p-46be74fc.entry.js → p-c7ec97d1.entry.js} +1 -1
- package/dist/vega/{p-effbfc50.entry.js → p-ca1fe571.entry.js} +1 -1
- package/dist/vega/{p-408c3ad4.entry.js → p-cc9fc36a.entry.js} +1 -1
- package/dist/vega/{p-741e064e.entry.js → p-d044d54f.entry.js} +1 -1
- package/dist/vega/{p-0e0e66c9.entry.js → p-d3a9355c.entry.js} +1 -1
- package/dist/vega/p-d5a75228.js +1 -0
- package/dist/vega/{p-76135e80.entry.js → p-dc83fa6b.entry.js} +1 -1
- package/dist/vega/{p-92efdbf0.entry.js → p-dcfce26e.entry.js} +1 -1
- package/dist/vega/p-df9585f6.js +3 -0
- package/dist/vega/{p-f5f26b44.entry.js → p-e2c8a470.entry.js} +1 -1
- package/dist/vega/{p-23781e76.js → p-e33a954f.js} +1 -1
- package/dist/vega/{p-e577dda8.entry.js → p-e5fc6583.entry.js} +1 -1
- package/dist/vega/p-e668cf11.js +1 -0
- package/dist/vega/{p-0338f621.entry.js → p-e6b0a292.entry.js} +1 -1
- package/dist/vega/{p-381d8781.js → p-e84c2589.js} +1 -1
- package/dist/vega/{p-1b97e751.entry.js → p-eb945d34.entry.js} +1 -1
- package/dist/vega/{p-d8a0e3e0.entry.js → p-ebe1dd2b.entry.js} +1 -1
- package/dist/vega/{p-6beaf1c8.entry.js → p-f818bb20.entry.js} +1 -1
- package/dist/vega/p-f981cf2c.js +1 -0
- package/dist/vega/p-f9d09b0c.js +1 -0
- package/dist/vega/{p-4d20a56f.js → p-fdbdf12f.js} +1 -1
- package/dist/vega/{p-48100d38.entry.js → p-fee080b9.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-040bd9ca.js +0 -1
- package/dist/vega/p-087240db.js +0 -1
- package/dist/vega/p-15052b2e.entry.js +0 -1
- package/dist/vega/p-28c16885.js +0 -1
- package/dist/vega/p-30cc31dd.entry.js +0 -1
- package/dist/vega/p-3ec4d710.js +0 -1
- package/dist/vega/p-43ea1e86.js +0 -1
- package/dist/vega/p-7228088b.entry.js +0 -1
- package/dist/vega/p-7f711049.js +0 -1
- package/dist/vega/p-7fd15dd1.js +0 -1
- package/dist/vega/p-85695819.js +0 -1
- package/dist/vega/p-8e1f30ec.entry.js +0 -1
- package/dist/vega/p-9680dfe6.js +0 -1
- package/dist/vega/p-ae12cc3f.js +0 -3
- package/dist/vega/p-c0823f32.js +0 -1
- package/dist/vega/p-c5af2ecc.entry.js +0 -1
- package/dist/vega/p-fa43272c.js +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { tryGetDocument } from '../../../../../utils/try-get-document';
|
|
2
|
+
import { RTE_PRESERVED_WHITESPACE_DATA_TYPE } from '../../../constants/constant';
|
|
3
|
+
import { plainPasteLinesToHtml, toPlainPasteLines } from '../../../helpers/utils';
|
|
4
|
+
import { AbstractPasteProcessingStrategy, RTEPasteMode } from './paste-processing-strategy.abstract';
|
|
5
|
+
import { htmlContainsTable, htmlToPlainText } from '../../../utils/html-to-plain-text-utils';
|
|
6
|
+
/** Converts plain-text clipboard to paragraph-per-line HTML. */
|
|
7
|
+
export class PlainPasteProcessingStrategy extends AbstractPasteProcessingStrategy {
|
|
8
|
+
/** @returns {RTEPasteMode} Plain-text paste mode. */
|
|
9
|
+
get type() {
|
|
10
|
+
return RTEPasteMode.PLAIN;
|
|
11
|
+
}
|
|
12
|
+
/** @returns {boolean} Always `true`; consumes `text/plain` instead of `text/html`. */
|
|
13
|
+
get consumesPlainText() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
/** @returns {boolean} Always `false`; never auto-selected. */
|
|
17
|
+
canHandle() {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Converts plain text to paragraph HTML; every `\n` starts a new paragraph.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} text - Clipboard `text/plain` payload.
|
|
24
|
+
* @param {boolean} decodeEncodedWhitespace - Decode markers emitted by HTML conversion.
|
|
25
|
+
* @returns {string} Paragraph HTML.
|
|
26
|
+
*/
|
|
27
|
+
process(text, decodeEncodedWhitespace = false) {
|
|
28
|
+
if (!text) {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
const safeDocument = tryGetDocument();
|
|
32
|
+
if (!safeDocument) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
// Line splitting and boundary whitespace handling live in `toPlainPasteLines` so the
|
|
36
|
+
// emitted HTML and the RTE nodes built by `InsertPasteHandler` share one conversion.
|
|
37
|
+
return plainPasteLinesToHtml(toPlainPasteLines(text, decodeEncodedWhitespace));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @param {PasteInput} input Complete clipboard payload.
|
|
41
|
+
* @returns {PasteOutput} Plain HTML, canonical text, and whitespace marker contract.
|
|
42
|
+
*/
|
|
43
|
+
transform(input) {
|
|
44
|
+
const source = this.getPlainTextSource(input);
|
|
45
|
+
return {
|
|
46
|
+
html: this.process(source.text, source.hasEncodedWhitespace),
|
|
47
|
+
text: source.text,
|
|
48
|
+
mode: this.type,
|
|
49
|
+
markers: source.hasEncodedWhitespace ? { [RTE_PRESERVED_WHITESPACE_DATA_TYPE]: 'true' } : {},
|
|
50
|
+
extractImages: false,
|
|
51
|
+
imagesToExtract: [],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* @param {PasteInput} input Clipboard content used to derive canonical plain text.
|
|
56
|
+
* @returns {PlainTextSource} Canonical text and whether it contains whitespace sentinels.
|
|
57
|
+
*/
|
|
58
|
+
getPlainTextSource(input) {
|
|
59
|
+
if (!input.html) {
|
|
60
|
+
return { text: input.text || '', hasEncodedWhitespace: false };
|
|
61
|
+
}
|
|
62
|
+
const containsTable = htmlContainsTable(input.html);
|
|
63
|
+
if (input.text && input.text.includes('\t') && containsTable) {
|
|
64
|
+
return { text: input.text, hasEncodedWhitespace: false };
|
|
65
|
+
}
|
|
66
|
+
const derived = htmlToPlainText(input.html, {
|
|
67
|
+
preserveBoundaryBlankLines: !containsTable,
|
|
68
|
+
keepPreservedWhitespaceMarkers: true,
|
|
69
|
+
});
|
|
70
|
+
return derived
|
|
71
|
+
? { text: derived, hasEncodedWhitespace: true }
|
|
72
|
+
: { text: input.text || '', hasEncodedWhitespace: false };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -96,3 +96,70 @@ export function escapeHtmlAttribute(value) {
|
|
|
96
96
|
.replace(/>/g, '>')
|
|
97
97
|
.replace(/"/g, '"'));
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Normalizes clipboard line endings and splits into lines. Low-level primitive behind
|
|
101
|
+
* `toPlainPasteLines`, which layers boundary-whitespace handling on top and is the single
|
|
102
|
+
* conversion source used by plain-mode paste.
|
|
103
|
+
*
|
|
104
|
+
* @param {string} text Raw clipboard plain text.
|
|
105
|
+
* @returns {string[]} Lines with `\r\n`/`\r` normalized to `\n` and split on `\n`.
|
|
106
|
+
*/
|
|
107
|
+
export function normalizePlainTextLines(text) {
|
|
108
|
+
return text.replace(/\r\n?/g, '\n').split('\n');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Sentinels for whitespace that must survive plain-mode boundary collapsing (e.g. code-block
|
|
112
|
+
* indentation derived from HTML). `htmlToPlainText` can emit these in place of real spaces/tabs so
|
|
113
|
+
* that `toPlainPasteLines` leaves them untouched — they are not matched by `\s` — and decodes them
|
|
114
|
+
* back to real characters after collapsing the paste's insignificant leading/trailing whitespace.
|
|
115
|
+
*/
|
|
116
|
+
export const PRESERVED_SPACE = '\u0001';
|
|
117
|
+
export const PRESERVED_TAB = '\u0002';
|
|
118
|
+
/**
|
|
119
|
+
* Restores {@link PRESERVED_SPACE}/{@link PRESERVED_TAB} sentinels back to real spaces/tabs.
|
|
120
|
+
*
|
|
121
|
+
* @param {string} text Text that may contain preserved-whitespace sentinels.
|
|
122
|
+
* @returns {string} Text with sentinels decoded to real whitespace.
|
|
123
|
+
*/
|
|
124
|
+
function decodePreservedWhitespace(text) {
|
|
125
|
+
return text.split(PRESERVED_SPACE).join(' ').split(PRESERVED_TAB).join('\t');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Single source of truth for plain-mode paste conversion: turns raw clipboard text into
|
|
129
|
+
* the canonical list of lines used by both representations of the pasted content — the
|
|
130
|
+
* `text/html` payload emitted by `PlainPasteProcessingStrategy` and the RTE text/newline
|
|
131
|
+
* nodes built by `InsertPasteHandler`. Both must derive from this helper so whitespace and
|
|
132
|
+
* boundary handling cannot drift apart.
|
|
133
|
+
*
|
|
134
|
+
* Per-paragraph handling: lines carrying {@link PRESERVED_SPACE}/{@link PRESERVED_TAB}
|
|
135
|
+
* sentinels come from code-block sources (via the preservation branch of
|
|
136
|
+
* `extractBlockAwareText`) and are kept verbatim so significant indentation survives;
|
|
137
|
+
* all other lines get a normal `String.prototype.trim()` (including NBSP) so
|
|
138
|
+
* paragraph-boundary whitespace from non-code sources is treated as noise.
|
|
139
|
+
* When `decodeEncodedWhitespace` is enabled, sentinels are decoded back to real
|
|
140
|
+
* space/tab characters after the per-line pass.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} text Raw clipboard plain text.
|
|
143
|
+
* @param {boolean} decodeEncodedWhitespace Whether HTML-derived sentinels should be decoded.
|
|
144
|
+
* @returns {string[]} Canonical plain-mode lines.
|
|
145
|
+
*/
|
|
146
|
+
export function toPlainPasteLines(text, decodeEncodedWhitespace = false) {
|
|
147
|
+
const lines = normalizePlainTextLines(text);
|
|
148
|
+
return lines.map((line) => {
|
|
149
|
+
const hasSentinel = line.includes(PRESERVED_SPACE) || line.includes(PRESERVED_TAB);
|
|
150
|
+
const normalized = hasSentinel ? line : line.trim();
|
|
151
|
+
return decodeEncodedWhitespace ? decodePreservedWhitespace(normalized) : normalized;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Serializes canonical plain-mode lines into paragraph-per-line HTML.
|
|
156
|
+
*
|
|
157
|
+
* Built as a string rather than via DOM `outerHTML` serialization, which collapses
|
|
158
|
+
* consecutive spaces in non-`<pre>` text nodes and would lose intentional whitespace.
|
|
159
|
+
*
|
|
160
|
+
* @param {string[]} lines Canonical plain-mode lines from {@link toPlainPasteLines}.
|
|
161
|
+
* @returns {string} Paragraph HTML where each line is an individual paragraph.
|
|
162
|
+
*/
|
|
163
|
+
export function plainPasteLinesToHtml(lines) {
|
|
164
|
+
return lines.map((line) => `<p>${escapeHtml(line)}</p>`).join('');
|
|
165
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AppendChildrenAction } from '../../../../dto/actions/append-child-nodes-action';
|
|
2
|
+
import { DeleteBlockContentAction } from '../../../../dto/actions/delete-block-content-action';
|
|
2
3
|
import { InsertChildrenBeforeAction } from '../../../../dto/actions/insert-children-before-block';
|
|
4
|
+
import { ModifyContentActionType } from '../../../../dto/actions/modify-content-action.abstract';
|
|
3
5
|
import { RemoveChildrenAction } from '../../../../dto/actions/remove-child-action';
|
|
4
6
|
import { ReplaceChildNodesAction } from '../../../../dto/actions/replace-child-nodes-action';
|
|
7
|
+
import { UpdateCursorPositionAction } from '../../../../dto/actions/update-cursor-position-action';
|
|
5
8
|
import { RTEBlock } from '../../../../dto/blocks/block.abstract';
|
|
6
9
|
import { RTETextBlock } from '../../../../dto/blocks/text-block';
|
|
7
10
|
import { RTETextNode } from '../../../../dto/nodes/text-node';
|
|
@@ -14,15 +17,76 @@ import { BaseHandler } from './base-handler';
|
|
|
14
17
|
export class AbstractDeleteContentHandler extends BaseHandler {
|
|
15
18
|
/**
|
|
16
19
|
* Delete the selected node(s) from the current state.
|
|
20
|
+
*
|
|
21
|
+
* @returns {CompositionStep[]} The content + caret steps applied atomically as one flushable composition.
|
|
17
22
|
*/
|
|
18
23
|
handleEvent() {
|
|
19
24
|
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
20
25
|
if (selectedBlocks.length >= 2) {
|
|
21
26
|
this.deleteContentWithMultipleNodes();
|
|
27
|
+
return [];
|
|
22
28
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
return this.deleteContentWithSingleBlock();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Builds the ordered steps for a single-block deletion: the delete runs first, then a caret step
|
|
33
|
+
* reads the delete action's post-apply `previousNode`/`nextNode` to decide where the caret lands.
|
|
34
|
+
*
|
|
35
|
+
* @param {RTENode} resolvedNode - The node the deletion is anchored on.
|
|
36
|
+
* @param {number} resolvedOffset - The caret offset within `resolvedNode` at deletion time.
|
|
37
|
+
* @param {Nullable<RTENode>} caretAnchor - A node the caret must stay on regardless of the delete result.
|
|
38
|
+
* @returns {CompositionStep[]} The delete step followed by the dependent caret step.
|
|
39
|
+
*/
|
|
40
|
+
buildDeleteSteps(resolvedNode, resolvedOffset, caretAnchor) {
|
|
41
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
42
|
+
const deleteStep = () => ({
|
|
43
|
+
target: resolvedNode.parent,
|
|
44
|
+
action: new DeleteBlockContentAction(resolvedNode, resolvedOffset),
|
|
45
|
+
});
|
|
46
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
47
|
+
const caretStep = (context) => {
|
|
48
|
+
if (caretAnchor) {
|
|
49
|
+
// A non-editable anchor (e.g. a token) expresses its caret position at the parent-block
|
|
50
|
+
// level, so use its index within the parent to land right before it instead of jumping
|
|
51
|
+
// to the block start.
|
|
52
|
+
const caretOffset = caretAnchor.isContentEditable()
|
|
53
|
+
? 0
|
|
54
|
+
: caretAnchor.parent.children.indexOf(caretAnchor);
|
|
55
|
+
return {
|
|
56
|
+
target: this.currentState,
|
|
57
|
+
action: new UpdateCursorPositionAction(caretAnchor, caretOffset),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const deleteAction = context.getAction(ModifyContentActionType.DELETE_BLOCK_CONTENT);
|
|
61
|
+
if (deleteAction && deleteAction.previousNode) {
|
|
62
|
+
const nextOffset = deleteAction.previousNode === resolvedNode
|
|
63
|
+
? Math.max(0, resolvedOffset - 1)
|
|
64
|
+
: deleteAction.previousNode.getRangeEndOffset();
|
|
65
|
+
return {
|
|
66
|
+
target: this.currentState,
|
|
67
|
+
action: new UpdateCursorPositionAction(deleteAction.previousNode, nextOffset),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (deleteAction && deleteAction.nextNode) {
|
|
71
|
+
return {
|
|
72
|
+
target: this.currentState,
|
|
73
|
+
action: new UpdateCursorPositionAction(deleteAction.nextNode, 0),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (this.currentState.children.length === 0) {
|
|
77
|
+
// Add an empty paragraph if the delete removed all content to keep a valid caret position.
|
|
78
|
+
const paragraph = this.createEmptyParagraph();
|
|
79
|
+
return [
|
|
80
|
+
{ target: this.currentState, action: new AppendChildrenAction([paragraph]) },
|
|
81
|
+
{
|
|
82
|
+
target: this.currentState,
|
|
83
|
+
action: new UpdateCursorPositionAction(paragraph.children[0], 1),
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
};
|
|
89
|
+
return [deleteStep, caretStep];
|
|
26
90
|
}
|
|
27
91
|
/**
|
|
28
92
|
* Computes the caret position one step to the right, used to translate a forward delete into a backspace.
|
|
@@ -151,12 +215,4 @@ export class AbstractDeleteContentHandler extends BaseHandler {
|
|
|
151
215
|
block.parent.apply(new RemoveChildrenAction(block));
|
|
152
216
|
}
|
|
153
217
|
}
|
|
154
|
-
/**
|
|
155
|
-
* Creates a new paragraph element with a text node and appends it to the current state.
|
|
156
|
-
*/
|
|
157
|
-
insertDefaultParagraph() {
|
|
158
|
-
const paragraph = this.createEmptyParagraph();
|
|
159
|
-
this.currentState.apply(new AppendChildrenAction([paragraph]));
|
|
160
|
-
this.selectionController.enqueueSelectionRangeFutureState(paragraph.children[0], 1);
|
|
161
|
-
}
|
|
162
218
|
}
|
|
@@ -1,35 +1,22 @@
|
|
|
1
|
-
import { DeleteBlockContentAction } from '../../../../dto/actions/delete-block-content-action';
|
|
2
1
|
import { AbstractDeleteContentHandler } from './abstract-delete-content-handler';
|
|
3
2
|
/** Handles a backspace (leftward) deletion of content within a VegaRTE editor. User press backspace will trigger this method */
|
|
4
3
|
export class BackwardDeleteContentHandler extends AbstractDeleteContentHandler {
|
|
5
4
|
/**
|
|
6
5
|
* Handles a backspace (leftward) deletion of content within a single block in an RTE editor.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Nullable<CompositionStep[]>} The delete + caret steps, empty when the deletion is delegated or a no-op.
|
|
7
8
|
*/
|
|
8
9
|
deleteContentWithSingleBlock() {
|
|
9
10
|
const range = this.selectionController.getCurrentRange();
|
|
10
11
|
const { startOffset, endOffset, startContainer, endContainer } = range;
|
|
11
12
|
if (startOffset !== endOffset || startContainer !== endContainer) {
|
|
12
13
|
this.deleteContentWithMultipleNodes();
|
|
13
|
-
return;
|
|
14
|
+
return [];
|
|
14
15
|
}
|
|
15
16
|
const targetNode = this.selectionController.getSelectedNodes()[0];
|
|
16
17
|
if (!targetNode) {
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
targetNode.parent.apply(deleteAction);
|
|
21
|
-
if (deleteAction.previousNode) {
|
|
22
|
-
const nextOffset = deleteAction.previousNode === targetNode
|
|
23
|
-
? Math.max(0, startOffset - 1)
|
|
24
|
-
: deleteAction.previousNode.getRangeEndOffset();
|
|
25
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.previousNode, nextOffset);
|
|
26
|
-
}
|
|
27
|
-
else if (deleteAction.nextNode) {
|
|
28
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.nextNode, 0);
|
|
29
|
-
}
|
|
30
|
-
else if (this.currentState.children.length === 0) {
|
|
31
|
-
// Add a empty paragraph if delete all content to make sure the caret position
|
|
32
|
-
this.insertDefaultParagraph();
|
|
33
|
-
}
|
|
20
|
+
return this.buildDeleteSteps(targetNode, startOffset, null);
|
|
34
21
|
}
|
|
35
22
|
}
|
|
@@ -2,15 +2,35 @@ import changeManager from '../../../../../../helpers/change-manager/change-manag
|
|
|
2
2
|
import domNodeSubjectFactory from '../../../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-factory';
|
|
3
3
|
import { VegaInternalRichTextEditDeleteSelectedNodes } from '../../../../../../helpers/event-manager/event-id/vega-internal-event-id';
|
|
4
4
|
import { generateUUID } from '../../../../../../utils/misc';
|
|
5
|
+
import { RTEUpdateSource } from '../../../../constants/constant';
|
|
5
6
|
import { AppendChildrenAction } from '../../../../dto/actions/append-child-nodes-action';
|
|
7
|
+
import { SequentialCompositionAction, } from '../../../../dto/actions/sequential-composition-action';
|
|
6
8
|
import { RTETextBlock } from '../../../../dto/blocks/text-block';
|
|
7
9
|
import { RTETextNode } from '../../../../dto/nodes/text-node';
|
|
8
10
|
const ROOT_CONTAINER_CLASS_NAME = 'rich-text-content';
|
|
9
11
|
/** This code snippet is defining an abstract class named `BaseHandler` with an abstract method `execute`. */
|
|
10
12
|
export class BaseHandler {
|
|
13
|
+
constructor() {
|
|
14
|
+
/**
|
|
15
|
+
* Default flush payload emitted after `handleEvent` completes. This is the single source of
|
|
16
|
+
* truth for the defaults — the observer does not re-apply any fallback values. Subclasses may override
|
|
17
|
+
* this field to opt out of flushing (assign `undefined`) or to change the defaults. Each instance
|
|
18
|
+
* owns its own copy so mutations from within `handleEvent` (e.g. `InsertTextHandler` updating
|
|
19
|
+
* `updateSource`) never leak across handler instances.
|
|
20
|
+
*/
|
|
21
|
+
this.flushOptions = {
|
|
22
|
+
bypassDebounce: true,
|
|
23
|
+
recordHistory: true,
|
|
24
|
+
updateSource: RTEUpdateSource.Default,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
11
27
|
/**
|
|
12
28
|
* The function `execute` initializes the current state and selection, and then handles an event if provided.
|
|
13
29
|
*
|
|
30
|
+
* Contract: `handleEvent` MUST be synchronous. A handler that mutates the value returns the
|
|
31
|
+
* `CompositionStep[]` it applied through `applyComposition`; the flush is then routed through the
|
|
32
|
+
* shared action pipeline. Handlers that do not mutate the value return nothing
|
|
33
|
+
*
|
|
14
34
|
* @param {VegaRTEContent} currentState - The current state of the VegaRTE content.
|
|
15
35
|
* @param {SelectionController} selectionController - Manages the selection of items in the user interface.
|
|
16
36
|
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
@@ -19,7 +39,20 @@ export class BaseHandler {
|
|
|
19
39
|
execute(currentState, selectionController, richTextEditor, event) {
|
|
20
40
|
this.initCurrentStateAndSelection(currentState, selectionController);
|
|
21
41
|
this.setCurrentRichTextEditor(richTextEditor);
|
|
22
|
-
this.handleEvent(event);
|
|
42
|
+
const steps = this.handleEvent(event);
|
|
43
|
+
this.applyComposition(steps);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Applies the collected leaf actions as a single flushable `SequentialCompositionAction`, so the value
|
|
47
|
+
* update and its flush run through the same action pipeline used by every other flushable operation.
|
|
48
|
+
* Handlers call this before enqueuing selection so caret math reads post-apply node state.
|
|
49
|
+
*
|
|
50
|
+
* @param {CompositionStep[]} steps - The ordered leaf actions to apply against their own targets.
|
|
51
|
+
*/
|
|
52
|
+
applyComposition(steps) {
|
|
53
|
+
if (Array.isArray(steps)) {
|
|
54
|
+
this.currentState.apply(new SequentialCompositionAction(steps, this.flushOptions));
|
|
55
|
+
}
|
|
23
56
|
}
|
|
24
57
|
/**
|
|
25
58
|
* The function `isRootContainer` checks if an HTML element is a root container with a class of 'rich-text-content'.
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpdateCursorPositionAction } from '../../../../dto/actions/update-cursor-position-action';
|
|
2
2
|
import { AbstractDeleteContentHandler } from './abstract-delete-content-handler';
|
|
3
3
|
/** Handles a delete (rightward) deletion of content within a VegaRTE editor. User press delete will trigger this method */
|
|
4
4
|
export class ForwardDeleteContentHandler extends AbstractDeleteContentHandler {
|
|
5
5
|
/**
|
|
6
6
|
* Handles a delete (rightward) deletion of content within a single block in an RTE editor.
|
|
7
|
+
*
|
|
8
|
+
* @returns {Nullable<CompositionStep[]>} The delete + caret steps, empty when the deletion is delegated or a no-op.
|
|
7
9
|
*/
|
|
8
10
|
deleteContentWithSingleBlock() {
|
|
9
11
|
const range = this.selectionController.getCurrentRange();
|
|
10
12
|
const { startOffset, endOffset, startContainer, endContainer } = range;
|
|
11
13
|
if (startOffset !== endOffset || startContainer !== endContainer) {
|
|
12
14
|
this.deleteContentWithMultipleNodes();
|
|
13
|
-
return;
|
|
15
|
+
return [];
|
|
14
16
|
}
|
|
15
17
|
const targetNode = this.selectionController.getSelectedNodes()[0];
|
|
16
18
|
// The node that should hold the caret after a forward delete removes a non-editable
|
|
@@ -34,7 +36,8 @@ export class ForwardDeleteContentHandler extends AbstractDeleteContentHandler {
|
|
|
34
36
|
const forwardPosition = this.getForwardDeletePosition(targetNode, startOffset);
|
|
35
37
|
// The caret is at the very end of the content, there is nothing to delete forward.
|
|
36
38
|
if (!forwardPosition) {
|
|
37
|
-
return
|
|
39
|
+
// Nothing changes, so we return undefined to indicate no composition steps are needed.
|
|
40
|
+
return undefined;
|
|
38
41
|
}
|
|
39
42
|
// Mirror backspace at heterogeneous block boundaries: a forward delete that crosses
|
|
40
43
|
// into a following block of a different type (e.g. paragraph → list-item, or into an
|
|
@@ -45,8 +48,11 @@ export class ForwardDeleteContentHandler extends AbstractDeleteContentHandler {
|
|
|
45
48
|
if (targetNode &&
|
|
46
49
|
forwardPosition.node.parent !== targetNode.parent &&
|
|
47
50
|
forwardPosition.node.parent.type !== targetNode.parent.type) {
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
const caretOperation = {
|
|
52
|
+
target: this.currentState,
|
|
53
|
+
action: new UpdateCursorPositionAction(forwardPosition.node, 0),
|
|
54
|
+
};
|
|
55
|
+
return [caretOperation];
|
|
50
56
|
}
|
|
51
57
|
// When the caret sits at the start of a non-editable leading node (e.g. a function
|
|
52
58
|
// keyword or a token), a forward delete removes that node. Visually the caret stays
|
|
@@ -61,33 +67,8 @@ export class ForwardDeleteContentHandler extends AbstractDeleteContentHandler {
|
|
|
61
67
|
}
|
|
62
68
|
/* istanbul ignore next */
|
|
63
69
|
if (!resolvedNode) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const deleteAction = new DeleteBlockContentAction(resolvedNode, resolvedOffset);
|
|
67
|
-
resolvedNode.parent.apply(deleteAction);
|
|
68
|
-
if (forwardCaretAnchor) {
|
|
69
|
-
// A non-editable anchor (e.g. a token) expresses its caret position at the
|
|
70
|
-
// parent-block level: its range container is the parent element, so an offset of
|
|
71
|
-
// 0 would put the caret at the very start of the block (jumping to the far left)
|
|
72
|
-
// instead of just before the anchor. Use the anchor's index within its parent so
|
|
73
|
-
// the caret lands right before it, on the spot the deleted node used to occupy.
|
|
74
|
-
const forwardCaretOffset = forwardCaretAnchor.isContentEditable()
|
|
75
|
-
? 0
|
|
76
|
-
: forwardCaretAnchor.parent.children.indexOf(forwardCaretAnchor);
|
|
77
|
-
this.selectionController.enqueueSelectionRangeFutureState(forwardCaretAnchor, forwardCaretOffset);
|
|
78
|
-
}
|
|
79
|
-
else if (deleteAction.previousNode) {
|
|
80
|
-
const nextOffset = deleteAction.previousNode === resolvedNode
|
|
81
|
-
? Math.max(0, resolvedOffset - 1)
|
|
82
|
-
: deleteAction.previousNode.getRangeEndOffset();
|
|
83
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.previousNode, nextOffset);
|
|
84
|
-
}
|
|
85
|
-
else if (deleteAction.nextNode) {
|
|
86
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.nextNode, 0);
|
|
87
|
-
}
|
|
88
|
-
else if (this.currentState.children.length === 0) {
|
|
89
|
-
// Add a empty paragraph if delete all content to make sure the caret position
|
|
90
|
-
this.insertDefaultParagraph();
|
|
70
|
+
return [];
|
|
91
71
|
}
|
|
72
|
+
return this.buildDeleteSteps(resolvedNode, resolvedOffset, forwardCaretAnchor);
|
|
92
73
|
}
|
|
93
74
|
}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import { BaseHandler } from './base-handler';
|
|
2
2
|
import { RTETextBlock } from '../../../../dto/blocks/text-block';
|
|
3
3
|
import { LineBreakSingleBlockAction } from '../../../../dto/actions/line-break-single-block-action';
|
|
4
|
+
import { ModifyContentActionType } from '../../../../dto/actions/modify-content-action.abstract';
|
|
5
|
+
import { UpdateCursorPositionAction } from '../../../../dto/actions/update-cursor-position-action';
|
|
4
6
|
import { lineBreakMultipleBlocksAction } from '../../../../dto/actions/line-break-multiple-block-action';
|
|
5
7
|
/** User press shift + enter will tigger this callback */
|
|
6
8
|
export class InsertLineBreakHandler extends BaseHandler {
|
|
7
9
|
/**
|
|
8
10
|
* Create new line break node and add node to state value
|
|
11
|
+
*
|
|
12
|
+
* @returns {Nullable<CompositionStep[]>} The content + caret steps applied atomically as one flushable composition.
|
|
9
13
|
*/
|
|
10
14
|
handleEvent() {
|
|
11
|
-
const range = this.selectionController.getCurrentRange();
|
|
12
15
|
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
13
|
-
if (this.isRootContainer(range.startContainer)) {
|
|
14
|
-
this.breakNewBlock();
|
|
15
|
-
}
|
|
16
16
|
if (selectedBlocks.length) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
this.breakMultipleBlocks();
|
|
22
|
-
}
|
|
17
|
+
return selectedBlocks.length < 2 ? this.breakSingleBlock() : this.breakMultipleBlocks();
|
|
18
|
+
}
|
|
19
|
+
else if (this.isRootContainer(this.selectionController.getCurrentRange().startContainer)) {
|
|
20
|
+
return this.breakNewBlock();
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
/**
|
|
@@ -28,14 +26,19 @@ export class InsertLineBreakHandler extends BaseHandler {
|
|
|
28
26
|
* <span></span>
|
|
29
27
|
* <span></span>
|
|
30
28
|
* </p>
|
|
29
|
+
*
|
|
30
|
+
* @returns {Nullable<CompositionStep[]>} The content + caret steps for the empty root break.
|
|
31
31
|
*/
|
|
32
32
|
breakNewBlock() {
|
|
33
33
|
if (this.currentState &&
|
|
34
34
|
this.currentState.children[0] &&
|
|
35
35
|
this.currentState.children[0] instanceof RTETextBlock) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const targetBlock = this.currentState.children[0];
|
|
37
|
+
const lineBreakStep = {
|
|
38
|
+
target: targetBlock,
|
|
39
|
+
action: new LineBreakSingleBlockAction(targetBlock.children[0], 0),
|
|
40
|
+
};
|
|
41
|
+
return [lineBreakStep, this.caretToSingleBlockNextNode()];
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
@@ -49,36 +52,68 @@ export class InsertLineBreakHandler extends BaseHandler {
|
|
|
49
52
|
* <br>
|
|
50
53
|
* <span>xt</span>
|
|
51
54
|
* </p>
|
|
55
|
+
*
|
|
56
|
+
* @returns {CompositionStep[]} The content + caret steps for the single-block break.
|
|
52
57
|
*/
|
|
53
58
|
breakSingleBlock() {
|
|
54
59
|
const range = this.selectionController.getCurrentRange();
|
|
55
60
|
const cursorNode = this.removeSelectionRange();
|
|
56
61
|
const currentBlock = cursorNode.parent;
|
|
62
|
+
let result = [];
|
|
57
63
|
if (currentBlock) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
const contentStep = {
|
|
65
|
+
target: currentBlock,
|
|
66
|
+
action: new LineBreakSingleBlockAction(cursorNode, range.startOffset),
|
|
67
|
+
};
|
|
68
|
+
result = [contentStep, this.caretToSingleBlockNextNode()];
|
|
63
69
|
}
|
|
70
|
+
return result;
|
|
64
71
|
}
|
|
65
72
|
/**
|
|
66
73
|
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
74
|
+
*
|
|
75
|
+
* @returns {CompositionStep[]} The content + caret steps for the multi-block break.
|
|
67
76
|
*/
|
|
68
77
|
breakMultipleBlocks() {
|
|
69
78
|
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
70
79
|
const cursorNode = this.removeSelectionRange();
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
const contentStep = {
|
|
81
|
+
target: cursorNode.parent,
|
|
82
|
+
action: new lineBreakMultipleBlocksAction(selectedBlocks),
|
|
83
|
+
};
|
|
84
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
85
|
+
const caretStep = (context) => {
|
|
86
|
+
const lineBreakAction = context.getAction(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS);
|
|
87
|
+
if (lineBreakAction && lineBreakAction.lineBreakNode) {
|
|
88
|
+
return this.caretOperationToNextNode(lineBreakAction.lineBreakNode);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return [contentStep, caretStep];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Builds the caret step that reads the applied single-block line break to place the caret after it.
|
|
95
|
+
*
|
|
96
|
+
* @returns {CompositionStep} The dependent caret step.
|
|
97
|
+
*/
|
|
98
|
+
caretToSingleBlockNextNode() {
|
|
99
|
+
return (context) => {
|
|
100
|
+
const lineBreakAction = context.getAction(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK);
|
|
101
|
+
if (lineBreakAction && lineBreakAction.lineBreakNode) {
|
|
102
|
+
return this.caretOperationToNextNode(lineBreakAction.lineBreakNode);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
74
105
|
}
|
|
75
106
|
/**
|
|
76
|
-
*
|
|
107
|
+
* Builds the caret operation that moves onto the node following the inserted line break.
|
|
77
108
|
*
|
|
78
|
-
* @param {RTENode} lineBreakNode -
|
|
109
|
+
* @param {RTENode} lineBreakNode - The inserted line break node.
|
|
110
|
+
* @returns {CompositionOperation} The caret operation.
|
|
79
111
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
112
|
+
caretOperationToNextNode(lineBreakNode) {
|
|
113
|
+
return {
|
|
114
|
+
target: this.currentState,
|
|
115
|
+
action: new UpdateCursorPositionAction(this.getNextRTENode(lineBreakNode), 0),
|
|
116
|
+
};
|
|
82
117
|
}
|
|
83
118
|
/**
|
|
84
119
|
* Returns the next sibling node of a given block element in a rich text editor.
|