@globalpayments/vega 2.38.0 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-7087f121.js → app-globals-cdd0972c.js} +14 -4
- package/dist/cjs/check-box-required-rule-1ee54b9a.js +70 -0
- package/dist/cjs/content-state-c5b47ca1.js +6644 -0
- package/dist/cjs/date-required-rule-4e1f84fd.js +92 -0
- package/dist/cjs/{element-appender-slimmer-c6e0f4ca.js → element-appender-slimmer-4f0dc8c6.js} +9 -5
- package/dist/cjs/file-uploader-required-rule-313ec9e3.js +21 -0
- package/dist/cjs/{form-field-controller-slimmer-48c0ad0b.js → form-field-controller-slimmer-d92e8212.js} +28 -1
- package/dist/cjs/{image-annotation-action-7d82f7e1.js → image-annotation-action-75b9c0d3.js} +5 -6
- package/dist/cjs/index.cjs.js +35 -15
- package/dist/cjs/input-phone-number-required-rule-2668fdf1.js +65 -0
- package/dist/cjs/input-range-required-rule-5b9c2a95.js +63 -0
- package/dist/cjs/internal-form-field-validation-rule.abstract-07cdff46.js +15 -0
- package/dist/cjs/loader.cjs.js +10 -10
- package/dist/cjs/{min-number-rule-115c5a3b.js → min-number-rule-5bcccc8f.js} +7 -4
- package/dist/cjs/{min-string-length-rule-75f24a48.js → min-string-length-rule-af215976.js} +8 -4
- package/dist/cjs/public-rules-90b972e5.js +42 -0
- package/dist/cjs/{required-field-rule-7f9945fa.js → required-field-rule-d73c1d8c.js} +6 -3
- package/dist/cjs/rich-text-editor-required-rule-cacc5fe0.js +64 -0
- package/dist/cjs/time-required-rule-ccf178e7.js +141 -0
- package/dist/cjs/toggle-switch-required-rule-88a51b36.js +66 -0
- package/dist/cjs/{valid-credit-card-number-rule-4a9ae5d9.js → valid-credit-card-number-rule-4a1b00b8.js} +3 -2
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +11 -79
- package/dist/cjs/vega-color-picker.cjs.entry.js +3 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +9 -91
- package/dist/cjs/vega-dialog_2.cjs.entry.js +29 -1
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +1 -1
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +5 -19
- package/dist/cjs/vega-form.cjs.entry.js +2 -1
- package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -2
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +4 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -2
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +38 -70
- package/dist/cjs/vega-input-range.cjs.entry.js +6 -61
- package/dist/cjs/vega-input-select.cjs.entry.js +3 -2
- package/dist/cjs/vega-input.cjs.entry.js +7 -6
- package/dist/cjs/vega-popover_2.cjs.entry.js +15 -1
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +18 -19
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +79 -139
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -2
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -2
- package/dist/cjs/vega-textarea.cjs.entry.js +4 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -140
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +4 -63
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +53 -12
- package/dist/cjs/vega.cjs.js +10 -10
- package/dist/collection/components/vega-checkbox/vega-checkbox.css +82 -33
- package/dist/collection/components/vega-checkbox/vega-checkbox.js +8 -13
- package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +2 -2
- package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +18 -2
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +7 -4
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.js +9 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-scroll-controller.js +16 -0
- package/dist/collection/components/vega-modal/vega-modal.js +6 -0
- package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +4 -0
- package/dist/collection/components/vega-popover/vega-popover.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +52 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +63 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.js +134 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +152 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.js +43 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.js +44 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.js +92 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +63 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.js +46 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/image-update-url-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +3 -215
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +31 -244
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +17 -155
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +33 -184
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +40 -352
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +13 -23
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +14 -6
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +23 -182
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +2 -2
- package/dist/collection/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.js +45 -11
- package/dist/collection/components/vega-tooltip/vega-tooltip.js +12 -0
- package/dist/collection/global/scripts/before-vega-load.js +11 -0
- package/dist/collection/helpers/slimmers/element-appender-slimmer.js +8 -5
- package/dist/collection/helpers/slimmers/test/element-appender-slimmer.test.js +2 -0
- package/dist/collection/helpers/ui/element-appender.js +1 -0
- package/dist/collection/helpers/ui/test/element-appender.test.js +1 -0
- package/dist/collection/helpers/validator/form-field-controller.js +28 -1
- package/dist/collection/helpers/validator/public-rules.js +10 -0
- package/dist/collection/helpers/validator/rules/check-box-required-rule.js +4 -3
- package/dist/collection/helpers/validator/rules/date-range-rule.js +2 -1
- package/dist/collection/helpers/validator/rules/date-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/email-field-rule.js +3 -2
- package/dist/collection/helpers/validator/rules/{object-array-required-rule.js → file-uploader-required-rule.js} +1 -1
- package/dist/collection/helpers/validator/rules/input-phone-number-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/input-range-min-and-max-rule.js +3 -1
- package/dist/collection/helpers/validator/rules/input-range-required-rule.js +5 -4
- package/dist/collection/helpers/validator/rules/internal-form-field-validation-rule.abstract.js +11 -0
- package/dist/collection/helpers/validator/rules/max-number-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/max-string-length-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/min-and-max-date-rule.js +3 -1
- package/dist/collection/helpers/validator/rules/min-number-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/min-string-length-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/required-field-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/rich-text-editor-required-rule.js +4 -3
- package/dist/collection/helpers/validator/rules/time-range-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/time-range-rule.js +3 -1
- package/dist/collection/helpers/validator/rules/time-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/toggle-switch-required-rule.js +4 -3
- package/dist/collection/helpers/validator/rules/valid-credit-card-number-rule.js +3 -2
- package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +11 -4
- package/dist/collection/helpers/validator/test/rules/file-uploader-required-rule.test.js +7 -0
- package/dist/collection/helpers/validator/test/rules/public-rules.test.js +80 -0
- package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +8 -0
- package/dist/collection/index.js +1 -0
- package/dist/esm/{app-globals-4cca4a96.js → app-globals-88fa3549.js} +14 -4
- package/dist/esm/check-box-required-rule-cb0aa339.js +68 -0
- package/dist/esm/content-state-2edba4ec.js +6600 -0
- package/dist/esm/{date-732bc749.js → date-c55b97f0.js} +1 -1
- package/dist/esm/date-required-rule-8944f3bf.js +90 -0
- package/dist/esm/{element-appender-slimmer-f5e703f3.js → element-appender-slimmer-d9155ee0.js} +9 -5
- package/dist/esm/file-uploader-required-rule-ad886d01.js +19 -0
- package/dist/esm/{form-field-controller-slimmer-3535e76a.js → form-field-controller-slimmer-bb64dec7.js} +29 -2
- package/dist/esm/{image-annotation-action-3da42221.js → image-annotation-action-b6668f48.js} +1 -2
- package/dist/esm/{index-6e05b241.js → index-d172bafa.js} +1 -1
- package/dist/esm/index.js +17 -7
- package/dist/esm/input-phone-number-required-rule-be6a5572.js +63 -0
- package/dist/esm/input-range-required-rule-3ad74776.js +61 -0
- package/dist/esm/internal-form-field-validation-rule.abstract-f5b6bdbf.js +13 -0
- package/dist/esm/loader.js +11 -11
- package/dist/esm/{min-number-rule-31d48b22.js → min-number-rule-a6082418.js} +7 -4
- package/dist/esm/{min-string-length-rule-c6a69eeb.js → min-string-length-rule-c31c89f4.js} +8 -4
- package/dist/esm/public-rules-413f6a17.js +27 -0
- package/dist/esm/{required-field-rule-368b31fa.js → required-field-rule-ab4bdc47.js} +6 -3
- package/dist/esm/rich-text-editor-required-rule-75cc2db0.js +62 -0
- package/dist/esm/{string-input-formatter-slimmer-d4132497.js → string-input-formatter-slimmer-418b54f0.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-51151fc3.js → sub-state-notify-slimmer-b36fd081.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-d77a1c46.js → sub-state-observer-slimmer-09452523.js} +1 -1
- package/dist/esm/time-required-rule-a01163b5.js +138 -0
- package/dist/esm/toggle-switch-required-rule-b3cf4302.js +64 -0
- package/dist/esm/{valid-credit-card-number-rule-2aef3ad5.js → valid-credit-card-number-rule-cc497bec.js} +3 -2
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-calendar_3.entry.js +4 -4
- package/dist/esm/vega-checkbox_2.entry.js +12 -80
- package/dist/esm/vega-color-picker.entry.js +4 -3
- package/dist/esm/vega-combo-box.entry.js +4 -3
- package/dist/esm/vega-date-picker_2.entry.js +12 -94
- package/dist/esm/vega-dialog_2.entry.js +29 -1
- package/dist/esm/vega-dropdown_5.entry.js +4 -4
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +6 -20
- package/dist/esm/vega-form.entry.js +3 -2
- package/dist/esm/vega-image-uploader.entry.js +4 -3
- package/dist/esm/vega-input-credit-card.entry.js +5 -4
- package/dist/esm/vega-input-numeric.entry.js +5 -4
- package/dist/esm/vega-input-phone-number.entry.js +38 -70
- package/dist/esm/vega-input-range.entry.js +6 -61
- package/dist/esm/vega-input-select.entry.js +4 -3
- package/dist/esm/vega-input.entry.js +11 -10
- package/dist/esm/{vega-internal-event-id-d0690d0d.js → vega-internal-event-id-f269c42f.js} +1 -1
- package/dist/esm/vega-left-nav_5.entry.js +3 -3
- package/dist/esm/vega-popover_2.entry.js +16 -2
- package/dist/esm/vega-radio_2.entry.js +4 -3
- package/dist/esm/vega-rich-text-content.entry.js +6 -7
- package/dist/esm/vega-rich-text-editor_4.entry.js +23 -83
- package/dist/esm/vega-selection-chip_2.entry.js +6 -5
- package/dist/esm/vega-selection-tile_2.entry.js +6 -5
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +4 -3
- package/dist/esm/vega-stepper.entry.js +4 -3
- package/dist/esm/vega-table_8.entry.js +3 -3
- package/dist/esm/vega-textarea.entry.js +5 -4
- package/dist/esm/vega-time-picker_2.entry.js +8 -137
- package/dist/esm/vega-toggle-switch.entry.js +4 -63
- package/dist/esm/vega-tooltip_2.entry.js +53 -12
- package/dist/esm/vega.js +11 -11
- package/dist/types/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.d.ts +7 -0
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.d.ts +4 -0
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-scroll-controller.d.ts +5 -0
- package/dist/types/components/vega-modal/vega-modal.d.ts +1 -0
- package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +1 -0
- package/dist/types/components/vega-popover/vega-popover.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +66 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.d.ts +47 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +61 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.d.ts +23 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.d.ts +38 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/image-update-url-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +1 -79
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +3 -77
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -38
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +3 -58
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +5 -93
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +1 -2
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -43
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.d.ts +18 -0
- package/dist/types/components/vega-tooltip/vega-tooltip.d.ts +4 -0
- package/dist/types/components.d.ts +14 -0
- package/dist/types/helpers/slimmers/element-appender-slimmer.d.ts +1 -0
- package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +2 -1
- package/dist/types/helpers/validator/form-field-controller.d.ts +10 -0
- package/dist/types/helpers/validator/public-rules.d.ts +10 -0
- package/dist/types/helpers/validator/rules/check-box-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/date-range-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/date-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/email-field-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/{object-array-required-rule.d.ts → file-uploader-required-rule.d.ts} +1 -1
- package/dist/types/helpers/validator/rules/input-phone-number-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/input-range-min-and-max-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/input-range-required-rule.d.ts +8 -7
- package/dist/types/helpers/validator/rules/internal-form-field-validation-rule.abstract.d.ts +19 -0
- package/dist/types/helpers/validator/rules/max-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/max-string-length-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/min-and-max-date-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/min-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/min-string-length-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/required-field-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/rich-text-editor-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/time-range-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/time-range-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/time-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/toggle-switch-required-rule.d.ts +5 -4
- package/dist/types/helpers/validator/rules/valid-credit-card-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/valid-phone-number-rule.d.ts +7 -4
- package/dist/types/helpers/validator/test/rules/file-uploader-required-rule.test.d.ts +1 -0
- package/dist/types/helpers/validator/test/rules/public-rules.test.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/public-api.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-04c72f30.entry.js +1 -0
- package/dist/vega/{p-ba077ca8.entry.js → p-073beb31.entry.js} +1 -1
- package/dist/vega/p-07c2725a.js +1 -0
- package/dist/vega/{p-b5990090.js → p-08835909.js} +1 -1
- package/dist/vega/p-0b6d4561.entry.js +1 -0
- package/dist/vega/p-0bb860cc.js +1 -0
- package/dist/vega/p-0cc1ad76.js +1 -0
- package/dist/vega/p-113cd659.entry.js +1 -0
- package/dist/vega/{p-b9a0f136.entry.js → p-154d262e.entry.js} +1 -1
- package/dist/vega/p-17598aac.entry.js +1 -0
- package/dist/vega/p-23130825.entry.js +1 -0
- package/dist/vega/{p-29d6ec6c.js → p-239bae84.js} +1 -1
- package/dist/vega/{p-7198d675.entry.js → p-24ac5151.entry.js} +1 -1
- package/dist/vega/p-280cbcdb.js +1 -0
- package/dist/vega/p-3299c30b.entry.js +1 -0
- package/dist/vega/p-3fd9d39f.entry.js +1 -0
- package/dist/vega/p-42a949f5.entry.js +1 -0
- package/dist/vega/p-4bd1b877.entry.js +1 -0
- package/dist/vega/p-590fd123.js +1 -0
- package/dist/vega/p-5a7eabcc.js +1 -0
- package/dist/vega/p-5e56f3bd.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-612c9374.entry.js +1 -0
- package/dist/vega/p-6408d3dc.entry.js +1 -0
- package/dist/vega/{p-a2a34239.entry.js → p-6585bddc.entry.js} +2 -2
- package/dist/vega/p-6603081a.entry.js +1 -0
- package/dist/vega/p-6e5db02b.js +1 -0
- package/dist/vega/p-6f90d444.js +1 -0
- package/dist/vega/p-7303fff2.entry.js +1 -0
- package/dist/vega/p-7b648a05.entry.js +1 -0
- package/dist/vega/p-7c0b4c36.js +1 -0
- package/dist/vega/p-81b21503.entry.js +1 -0
- package/dist/vega/p-8fae8f9e.js +1 -0
- package/dist/vega/p-924b4e24.js +1 -0
- package/dist/vega/{p-ee2e4bff.entry.js → p-94459733.entry.js} +1 -1
- package/dist/vega/p-a05ca459.entry.js +1 -0
- package/dist/vega/p-a3e80fb2.entry.js +1 -0
- package/dist/vega/p-a7a46358.entry.js +1 -0
- package/dist/vega/{p-34bd9204.js → p-a9e1123a.js} +1 -1
- package/dist/vega/p-abd7aeaa.js +1 -0
- package/dist/vega/{p-267cde46.entry.js → p-b071be5c.entry.js} +1 -1
- package/dist/vega/p-b24da503.entry.js +1 -0
- package/dist/vega/p-b44f3309.js +1 -0
- package/dist/vega/p-b9051ad2.js +1 -0
- package/dist/vega/{p-20326c64.js → p-bd0116f9.js} +1 -1
- package/dist/vega/{p-4ab0d645.js → p-c253d09c.js} +1 -1
- package/dist/vega/p-c56acdd5.entry.js +1 -0
- package/dist/vega/p-cdbbdcc2.js +1 -0
- package/dist/vega/p-d1a06058.entry.js +1 -0
- package/dist/vega/{p-348e95ba.js → p-d2ff56d8.js} +1 -1
- package/dist/vega/p-d51b04ce.entry.js +1 -0
- package/dist/vega/p-e0446879.js +1 -0
- package/dist/vega/p-e08b6542.entry.js +1 -0
- package/dist/vega/p-e0d3ca2d.js +1 -0
- package/dist/vega/{p-e9a5bd12.entry.js → p-f1ebe86b.entry.js} +1 -1
- package/dist/vega/p-f396c69a.js +1 -0
- package/dist/vega/p-fda6c178.entry.js +1 -0
- package/dist/vega/p-ffac4b8c.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/content-state-f97d3278.js +0 -2990
- package/dist/cjs/node-annotation.abstract-4f6df9cf.js +0 -3223
- package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.js +0 -12
- package/dist/collection/components/vega-rich-text-editor/dto/helper/block-base-operator.js +0 -47
- package/dist/collection/helpers/validator/test/rules/object-array-required-rule.test.js +0 -7
- package/dist/esm/content-state-ccf5f960.js +0 -2954
- package/dist/esm/node-annotation.abstract-b2e36bc4.js +0 -3214
- package/dist/types/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.d.ts +0 -9
- package/dist/types/components/vega-rich-text-editor/dto/helper/block-base-operator.d.ts +0 -24
- package/dist/vega/p-0461e318.js +0 -1
- package/dist/vega/p-12fe63c1.entry.js +0 -1
- package/dist/vega/p-1b67c443.entry.js +0 -1
- package/dist/vega/p-1d93b3a9.js +0 -1
- package/dist/vega/p-23fd9401.entry.js +0 -1
- package/dist/vega/p-2fecbcf9.entry.js +0 -1
- package/dist/vega/p-3152031c.js +0 -1
- package/dist/vega/p-3cb90bdf.entry.js +0 -1
- package/dist/vega/p-3e8f9fcf.entry.js +0 -1
- package/dist/vega/p-497f2f86.entry.js +0 -1
- package/dist/vega/p-50eabdca.entry.js +0 -1
- package/dist/vega/p-52a8a4f8.js +0 -1
- package/dist/vega/p-6419e13e.entry.js +0 -1
- package/dist/vega/p-66b9e86d.entry.js +0 -1
- package/dist/vega/p-74958b1a.js +0 -1
- package/dist/vega/p-7baa4fae.entry.js +0 -1
- package/dist/vega/p-7edcb8d0.entry.js +0 -1
- package/dist/vega/p-904b489a.entry.js +0 -1
- package/dist/vega/p-9689ad99.entry.js +0 -1
- package/dist/vega/p-9728d571.entry.js +0 -1
- package/dist/vega/p-a7e078ac.entry.js +0 -1
- package/dist/vega/p-a7f40a65.entry.js +0 -1
- package/dist/vega/p-a8a809e1.entry.js +0 -1
- package/dist/vega/p-a8b16ff2.js +0 -1
- package/dist/vega/p-aed80794.entry.js +0 -1
- package/dist/vega/p-b517ed15.js +0 -1
- package/dist/vega/p-b809f3d7.entry.js +0 -1
- package/dist/vega/p-ba2833c0.entry.js +0 -1
- package/dist/vega/p-bf4996d5.entry.js +0 -1
- package/dist/vega/p-cb4fd6e1.entry.js +0 -1
- package/dist/vega/p-e9785742.entry.js +0 -1
- package/dist/vega/p-ecaf4cfa.entry.js +0 -1
- package/dist/vega/p-f41102cd.js +0 -1
- package/dist/vega/p-f5b0ce61.js +0 -1
- package/dist/vega/p-f86ec91b.js +0 -1
- /package/dist/types/{helpers/validator/test/rules/object-array-required-rule.test.d.ts → components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NodeTypeEnum, RTENode } from './node.abstract';
|
|
2
|
-
import { NodeAnnotation
|
|
2
|
+
import { NodeAnnotation } from '../annotations/node-annotation.abstract';
|
|
3
|
+
import { AnnotationAction } from '../actions/annotation-action.abstract';
|
|
3
4
|
import { TextSplittableAction } from '../actions/splittable-action.abstract';
|
|
4
5
|
import { SelectionRangeAnnotation } from '../annotations/selection-range-annotation';
|
|
5
6
|
import stateEntityRenderingRegistry from '../../slimmers/controllers/state-entity-rendering-registry';
|
|
@@ -10,22 +11,21 @@ import { UnderlineAnnotation } from '../annotations/underline-annotation';
|
|
|
10
11
|
import { ItalicAnnotation } from '../annotations/italic-annotation';
|
|
11
12
|
import { BoldAnnotation } from '../annotations/bold-annotation';
|
|
12
13
|
import { isNonNullable } from '../../../../types/type-guard';
|
|
13
|
-
import { ClearFormattingAnnotation } from '../annotations/clear-formatting-annotation';
|
|
14
14
|
import { CodeAnnotation } from '../annotations/code-annotation';
|
|
15
15
|
import { TextColorAnnotation } from '../annotations/text-color-annotation';
|
|
16
16
|
import { LinkAnnotation } from '../annotations/link-annotation';
|
|
17
|
-
import { LinkAnnotationAction } from '../actions/link-annotation-action';
|
|
18
|
-
import { CodeAnnotationAction } from '../actions/code-annotation-action';
|
|
19
|
-
import { ClearFormattingAnnotationAction } from '../actions/clear-formatting-annotation-action';
|
|
20
17
|
import { ModifyContentActionType } from '../actions/modify-content-action.abstract';
|
|
21
|
-
import { UpdateTextAction } from '../actions/update-text-action';
|
|
22
18
|
import { LinkGroupAnnotationAction } from '../actions/link-group-annotation-action';
|
|
23
19
|
import domNodeSubjectFactory from '../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-factory';
|
|
24
20
|
import { VegaInternalRichTextEditorSelectionRangeChange } from '../../../../helpers/event-manager/event-id/vega-internal-event-id';
|
|
25
21
|
import ChangeManager from '../../../../helpers/change-manager/change-manager';
|
|
26
22
|
import { ZERO_WIDTH_SPACE } from '../../constants/constant';
|
|
27
23
|
import { SyncUpSelectionAction } from '../actions/sync-up-selection-action';
|
|
28
|
-
import {
|
|
24
|
+
import { ActionHandleStrategyRegistry } from '../action-handle-strategies/action-handle-strategy-registry';
|
|
25
|
+
import { NodeUpdateTextStrategy } from '../action-handle-strategies/modify-content-strategies/node-update-text-strategy';
|
|
26
|
+
import { NodeReplaceSelectedTextStrategy } from '../action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy';
|
|
27
|
+
import { NodeSplitTextStrategy } from '../action-handle-strategies/apply-annotation-strategies/node-split-text-strategy';
|
|
28
|
+
import { NodeUpdateAnnotationMapStrategy } from '../action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy';
|
|
29
29
|
/**
|
|
30
30
|
* Text node
|
|
31
31
|
*/
|
|
@@ -118,23 +118,13 @@ export class RTETextNode extends RTENode {
|
|
|
118
118
|
doAnnotationActionApply(action) {
|
|
119
119
|
const selectionRangeAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
120
120
|
if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
return this.insertNewNode(startOffset, action);
|
|
127
|
-
}
|
|
128
|
-
if (this.shouldSplitSelection(selectionRangeAnnotation.range)) {
|
|
129
|
-
return this.splitTextNode(action, selectionRangeAnnotation.range);
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
this.applyActionToNode(this, action);
|
|
133
|
-
return this;
|
|
134
|
-
}
|
|
121
|
+
const splitStrategy = ActionHandleStrategyRegistry.get(TextSplittableAction.name, RTETextNode.name);
|
|
122
|
+
if (splitStrategy) {
|
|
123
|
+
const newNode = splitStrategy.execute(action, this);
|
|
124
|
+
if (newNode) {
|
|
125
|
+
this.applyActionToNode(newNode, action);
|
|
135
126
|
}
|
|
136
|
-
|
|
137
|
-
});
|
|
127
|
+
}
|
|
138
128
|
}
|
|
139
129
|
else {
|
|
140
130
|
this.applyActionToNode(this, action);
|
|
@@ -145,61 +135,7 @@ export class RTETextNode extends RTENode {
|
|
|
145
135
|
* @inheritDoc
|
|
146
136
|
*/
|
|
147
137
|
doModifyActionApply(action) {
|
|
148
|
-
|
|
149
|
-
case ModifyContentActionType.UPDATE_TEXT:
|
|
150
|
-
this.updateText(action.newTextContent);
|
|
151
|
-
break;
|
|
152
|
-
case ModifyContentActionType.REPLACE_SELECTED_TEXT:
|
|
153
|
-
this.replaceSelectedText(action.textToBeInsert, action.currentRange);
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Split text node with range
|
|
159
|
-
*
|
|
160
|
-
* @param {TextSplittableAction} action - Annotation action
|
|
161
|
-
* @param {Range} range - Selection range
|
|
162
|
-
* @returns {RTETextNode[] | this} RTETextNode array
|
|
163
|
-
*/
|
|
164
|
-
splitTextNode(action, range) {
|
|
165
|
-
const { startContainer, endContainer, startOffset } = range;
|
|
166
|
-
const startNode = startContainer.parentElement;
|
|
167
|
-
const endNode = endContainer.parentElement;
|
|
168
|
-
/**
|
|
169
|
-
* Split the text from the start offset to the end offset
|
|
170
|
-
*
|
|
171
|
-
* @param {string} text - The text string
|
|
172
|
-
* @param {number} startOffset - The start offset position
|
|
173
|
-
* @param {number} endOffset - The end offset position
|
|
174
|
-
* @returns {RTETextNode[]} - The split text node array
|
|
175
|
-
*/
|
|
176
|
-
const splitText = (text, startOffset, endOffset) => {
|
|
177
|
-
const beforeText = text.substring(0, startOffset);
|
|
178
|
-
const selectedText = text.substring(startOffset, endOffset);
|
|
179
|
-
const afterText = text.substring(endOffset);
|
|
180
|
-
return [
|
|
181
|
-
this.cloneWithText(beforeText),
|
|
182
|
-
this.cloneWithText(selectedText),
|
|
183
|
-
this.cloneWithText(afterText),
|
|
184
|
-
];
|
|
185
|
-
};
|
|
186
|
-
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
187
|
-
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
188
|
-
if (startItemDto && startItemDto.id === this.id) {
|
|
189
|
-
const endOffset = startContainer === endContainer ? range.endOffset : this.text.length;
|
|
190
|
-
const [beforeNode, selectedNode, afterNode] = splitText(this.text, startOffset, endOffset);
|
|
191
|
-
this.applyActionToNode(selectedNode, action);
|
|
192
|
-
return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
|
|
193
|
-
}
|
|
194
|
-
else if (endItemDto && endItemDto.id === this.id) {
|
|
195
|
-
const [beforeNode, selectedNode, afterNode] = splitText(this.text, 0, range.endOffset);
|
|
196
|
-
this.applyActionToNode(selectedNode, action);
|
|
197
|
-
return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
this.applyActionToNode(this, action);
|
|
201
|
-
return this;
|
|
202
|
-
}
|
|
138
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
203
139
|
}
|
|
204
140
|
/**
|
|
205
141
|
* Apply action to node
|
|
@@ -217,89 +153,12 @@ export class RTETextNode extends RTENode {
|
|
|
217
153
|
if (!(annotation instanceof SelectionRangeAnnotation)) {
|
|
218
154
|
this.syncUpSelectedNodes(node);
|
|
219
155
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
if (annotation instanceof ClearFormattingAnnotation) {
|
|
225
|
-
annotation.items.forEach((item) => {
|
|
226
|
-
node.deleteAnnotationByType(item);
|
|
227
|
-
});
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
if (annotation instanceof NodeAnnotation || annotation instanceof SelectionRangeAnnotation) {
|
|
231
|
-
if (action instanceof LinkAnnotationAction) {
|
|
232
|
-
if (isNonNullable(action.newText)) {
|
|
233
|
-
node.text = action.newText;
|
|
234
|
-
}
|
|
235
|
-
this.parentBlock.apply(new LinkGroupAnnotationAction(action.link.groupKey, [node]));
|
|
236
|
-
}
|
|
237
|
-
if (action instanceof CodeAnnotationAction) {
|
|
238
|
-
this.applyActionToNode(node, new ClearFormattingAnnotationAction());
|
|
239
|
-
}
|
|
240
|
-
node.annotationMap.set(annotation.type, annotation);
|
|
156
|
+
const updateAnnotationMapStrategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTETextNode.name);
|
|
157
|
+
if (updateAnnotationMapStrategy) {
|
|
158
|
+
updateAnnotationMapStrategy.execute(action, node);
|
|
241
159
|
return;
|
|
242
160
|
}
|
|
243
161
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Replaces the selected text within a given range with a new text in a TypeScript class.
|
|
246
|
-
*
|
|
247
|
-
* @param {string} text - The new text that will replace the currently selected text within the specified range.
|
|
248
|
-
* @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
|
|
249
|
-
*/
|
|
250
|
-
replaceSelectedText(text, currentRange) {
|
|
251
|
-
if (currentRange && currentRange.startContainer && currentRange.endContainer) {
|
|
252
|
-
const { startContainer, endContainer, startOffset, endOffset } = currentRange;
|
|
253
|
-
const startNode = startContainer.parentElement;
|
|
254
|
-
const endNode = endContainer.parentElement;
|
|
255
|
-
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
256
|
-
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
257
|
-
let startIndex = 0, endIndex = this.text.length;
|
|
258
|
-
if (startItemDto && startItemDto === this) {
|
|
259
|
-
startIndex = startOffset;
|
|
260
|
-
endIndex = startContainer === endContainer ? endOffset : endIndex;
|
|
261
|
-
}
|
|
262
|
-
else if (endItemDto && endItemDto === this) {
|
|
263
|
-
endIndex = endOffset;
|
|
264
|
-
}
|
|
265
|
-
this.apply(new UpdateTextAction(this.text.slice(0, startIndex) + text + this.text.slice(endIndex)));
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
|
|
270
|
-
*
|
|
271
|
-
* @param {string} newText - The new text string
|
|
272
|
-
*/
|
|
273
|
-
updateText(newText) {
|
|
274
|
-
this.text = newText;
|
|
275
|
-
// The link node should unlink when delete all text
|
|
276
|
-
if (!this.text && this.isLinkNode()) {
|
|
277
|
-
this.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Checks if a node has an annotation with the key 'LINK'.
|
|
282
|
-
*
|
|
283
|
-
* @returns {boolean} A boolean value indicating whether the `annotationMap` has a key 'LINK'.
|
|
284
|
-
*/
|
|
285
|
-
isLinkNode() {
|
|
286
|
-
return this.annotationMap.has('LINK');
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Whether a given range should be split based on various conditions within the range.
|
|
290
|
-
*
|
|
291
|
-
* @param {Range} range - Selection range
|
|
292
|
-
* @returns {boolean} Returns a boolean value indicating whether the
|
|
293
|
-
* selection range should be split.
|
|
294
|
-
*/
|
|
295
|
-
shouldSplitSelection(range) {
|
|
296
|
-
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
297
|
-
const isCrossNode = startContainer !== endContainer;
|
|
298
|
-
const isPartialStart = startOffset > 0;
|
|
299
|
-
const isPartialEnd = endOffset < (endContainer.textContent ? endContainer.textContent.length : 0);
|
|
300
|
-
const isPartialSelection = isPartialStart || isPartialEnd;
|
|
301
|
-
return isCrossNode || isPartialSelection;
|
|
302
|
-
}
|
|
303
162
|
/**
|
|
304
163
|
* Sync up the selected node by change manager
|
|
305
164
|
*
|
|
@@ -314,28 +173,10 @@ export class RTETextNode extends RTENode {
|
|
|
314
173
|
}
|
|
315
174
|
}
|
|
316
175
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Insert the new node at the start offset
|
|
319
|
-
*
|
|
320
|
-
* @param {number} startOffset - The start position offset
|
|
321
|
-
* @param {AnnotationAction} action - AnnotationAction
|
|
322
|
-
* @returns {RTETextNode[]} - RTETextNode array
|
|
323
|
-
*/
|
|
324
|
-
insertNewNode(startOffset, action) {
|
|
325
|
-
if (startOffset === 0) {
|
|
326
|
-
const newNode = this.cloneWithText('');
|
|
327
|
-
this.applyActionToNode(newNode, action);
|
|
328
|
-
return [newNode, this];
|
|
329
|
-
}
|
|
330
|
-
if (startOffset === this.text.length) {
|
|
331
|
-
const newNode = this.cloneWithText('');
|
|
332
|
-
this.applyActionToNode(newNode, action);
|
|
333
|
-
return [this, newNode];
|
|
334
|
-
}
|
|
335
|
-
const beforeNode = this.cloneWithText(this.text.substring(0, startOffset));
|
|
336
|
-
const newNode = this.cloneWithText('');
|
|
337
|
-
const afterNode = this.cloneWithText(this.text.substring(startOffset));
|
|
338
|
-
this.applyActionToNode(newNode, action);
|
|
339
|
-
return [beforeNode, newNode, afterNode];
|
|
340
|
-
}
|
|
341
176
|
}
|
|
177
|
+
(() => {
|
|
178
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_TEXT, RTETextNode.name, new NodeUpdateTextStrategy());
|
|
179
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_SELECTED_TEXT, RTETextNode.name, new NodeReplaceSelectedTextStrategy());
|
|
180
|
+
ActionHandleStrategyRegistry.register(TextSplittableAction.name, RTETextNode.name, new NodeSplitTextStrategy());
|
|
181
|
+
ActionHandleStrategyRegistry.register(AnnotationAction.name, RTETextNode.name, new NodeUpdateAnnotationMapStrategy());
|
|
182
|
+
})();
|
|
@@ -10,6 +10,7 @@ import image from '../../../assets/image';
|
|
|
10
10
|
import { h } from '@stencil/core';
|
|
11
11
|
import { MapToComponentField } from 'vega-slimmer/core';
|
|
12
12
|
import { NodeAnnotationTypeEnum } from '../../../dto/annotations/node-annotation.abstract';
|
|
13
|
+
import { ImageUpdateUrlAction } from '../../../dto/actions/image-update-url-action';
|
|
13
14
|
export class ImageToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
14
15
|
constructor() {
|
|
15
16
|
super({
|
|
@@ -35,7 +36,7 @@ export class ImageToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
35
36
|
this.updateNodeURLMap = new Map();
|
|
36
37
|
}
|
|
37
38
|
this.updateNodeURLMap.set(node, (url) => {
|
|
38
|
-
node.
|
|
39
|
+
node.apply(new ImageUpdateUrlAction(url));
|
|
39
40
|
});
|
|
40
41
|
const payload = {
|
|
41
42
|
file: input.files[0],
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LogUtility } from '../../../../../utils/log';
|
|
2
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
3
|
+
import { ActionHandleStrategy } from '../../../dto/action-handle-strategies/action-handle-strategy.abstract';
|
|
4
|
+
import { AnnotationAction } from '../../../dto/actions/annotation-action.abstract';
|
|
5
|
+
import { RTEImageNode } from '../../../dto/nodes/image-node';
|
|
6
|
+
import { RTETextNode } from '../../../dto/nodes/text-node';
|
|
7
|
+
class MockAnnotationAction extends AnnotationAction {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.isFlushable = false;
|
|
11
|
+
this.toAnnotation = jest.fn();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class MockStrategy extends ActionHandleStrategy {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.handleAction = jest.fn();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const strategy = new MockStrategy();
|
|
21
|
+
test('ActionHandleStrategyRegistry methods register and get should work properly', () => {
|
|
22
|
+
expect(ActionHandleStrategyRegistry.get(MockAnnotationAction.name, RTETextNode.name)).toBeUndefined();
|
|
23
|
+
ActionHandleStrategyRegistry.register(MockAnnotationAction.name, RTETextNode.name, strategy);
|
|
24
|
+
expect(ActionHandleStrategyRegistry.get('MockAnnotationAction', 'RTETextNode')).toEqual(strategy);
|
|
25
|
+
});
|
|
26
|
+
test('ActionHandleStrategyRegistry methods executeTheStrategy should work properly', () => {
|
|
27
|
+
spyOn(strategy, 'execute').and.callThrough();
|
|
28
|
+
spyOn(strategy, 'handleAction');
|
|
29
|
+
const action = new MockAnnotationAction();
|
|
30
|
+
const target = new RTETextNode('1', 'test', null);
|
|
31
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, target);
|
|
32
|
+
expect(strategy.execute).toBeCalledWith(action, target);
|
|
33
|
+
expect(strategy.handleAction).toBeCalledWith(action, target);
|
|
34
|
+
});
|
|
35
|
+
test('ActionHandleStrategyRegistry methods executeTheStrategy should log error if the strategy is not exist', () => {
|
|
36
|
+
spyOn(LogUtility, 'error');
|
|
37
|
+
const action = new MockAnnotationAction();
|
|
38
|
+
const target = new RTEImageNode('1', 'test url', null);
|
|
39
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, target);
|
|
40
|
+
expect(LogUtility.error).toBeCalledWith(`Type MockAnnotationAction action handle strategy is not registered in class RTEImageNode`);
|
|
41
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BlockInsertLineBreakWithBlocksStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy';
|
|
2
|
+
import { lineBreakMultipleBlocksAction } from '../../../dto/actions/line-break-multiple-block-action';
|
|
3
|
+
import { VegaRTEContent } from '../../../dto/content-state';
|
|
4
|
+
test('BlockInsertLineBreakWithBlocksStrategy should work properly', () => {
|
|
5
|
+
const strategy = new BlockInsertLineBreakWithBlocksStrategy();
|
|
6
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
7
|
+
{
|
|
8
|
+
id: '1',
|
|
9
|
+
type: 'paragraph',
|
|
10
|
+
nodes: [
|
|
11
|
+
{ id: '1-1', type: 'text', text: 'A' },
|
|
12
|
+
{ id: '1-1', type: 'text', text: 'B' },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '2',
|
|
17
|
+
type: 'paragraph',
|
|
18
|
+
nodes: [],
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
const action = new lineBreakMultipleBlocksAction(contentState.blocks);
|
|
22
|
+
strategy.execute(action, contentState.blocks[0]);
|
|
23
|
+
expect(contentState.blocks[0]['nodes'].length).toEqual(4);
|
|
24
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
2
|
+
import { BlockAppendBlocksStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy';
|
|
3
|
+
import { BlockInsertBlocksAfterStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy';
|
|
4
|
+
import { BlockInsertBlocksBeforeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy';
|
|
5
|
+
import { BlockRemoveChildBlockStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy';
|
|
6
|
+
import { ModifyContentActionType } from '../../../dto/actions/modify-content-action.abstract';
|
|
7
|
+
import { VegaRTEContent } from '../../../dto/content-state';
|
|
8
|
+
test('VegaRTEContent action strategy should register properly', () => {
|
|
9
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_CHILD, VegaRTEContent.name) instanceof
|
|
10
|
+
BlockRemoveChildBlockStrategy).toBeTruthy();
|
|
11
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.APPEND_CHILD_NODES, VegaRTEContent.name) instanceof BlockAppendBlocksStrategy).toBeTruthy();
|
|
12
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_BLOCKS_BEFORE, VegaRTEContent.name) instanceof BlockInsertBlocksBeforeStrategy).toBeTruthy();
|
|
13
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_BLOCKS_AFTER, VegaRTEContent.name) instanceof BlockInsertBlocksAfterStrategy).toBeTruthy();
|
|
14
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
2
|
+
import { BlockAppendNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy';
|
|
3
|
+
import { BlockDeleteImageStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy';
|
|
4
|
+
import { BlockInsertNodesAfterNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy';
|
|
5
|
+
import { BlockInsertNodesBeforeNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy';
|
|
6
|
+
import { BlockMergeNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy';
|
|
7
|
+
import { BlockRemoveNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy';
|
|
8
|
+
import { BlockReplaceNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy';
|
|
9
|
+
import { BlockSplitWithImageNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy';
|
|
10
|
+
import { ImageBlockInsertImageStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy';
|
|
11
|
+
import { ImageInsertLineBreakStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy';
|
|
12
|
+
import { ImageInsertLineBreakWithBlocksStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy';
|
|
13
|
+
import { ImageInsertNewParagraphStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy';
|
|
14
|
+
import { ModifyContentActionType } from '../../../dto/actions/modify-content-action.abstract';
|
|
15
|
+
import { RTEImageBlock } from '../../../dto/blocks/image-block';
|
|
16
|
+
test('RTEImageBlock should register action handle strategy properly', () => {
|
|
17
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEImageBlock.name) instanceof BlockDeleteImageStrategy).toBeTruthy();
|
|
18
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name) instanceof BlockMergeNodesStrategy).toBeTruthy();
|
|
19
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_CHILD, RTEImageBlock.name) instanceof
|
|
20
|
+
BlockRemoveNodeStrategy).toBeTruthy();
|
|
21
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.APPEND_CHILD_NODES, RTEImageBlock.name) instanceof BlockAppendNodesStrategy).toBeTruthy();
|
|
22
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name) instanceof BlockReplaceNodesStrategy).toBeTruthy();
|
|
23
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name) instanceof BlockSplitWithImageNodeStrategy).toBeTruthy();
|
|
24
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEImageBlock.name) instanceof ImageInsertNewParagraphStrategy).toBeTruthy();
|
|
25
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name) instanceof ImageInsertLineBreakStrategy).toBeTruthy();
|
|
26
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name) instanceof ImageInsertLineBreakWithBlocksStrategy).toBeTruthy();
|
|
27
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name) instanceof ImageBlockInsertImageStrategy).toBeTruthy();
|
|
28
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_NODES_BEFORE, RTEImageBlock.name) instanceof BlockInsertNodesBeforeNodeStrategy).toBeTruthy();
|
|
29
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_NODES_AFTER, RTEImageBlock.name) instanceof BlockInsertNodesAfterNodeStrategy).toBeTruthy();
|
|
30
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImageAnnotationAction } from '../../../dto/actions/image-annotation-action';
|
|
2
|
+
import { SelectionChangeAction } from '../../../dto/actions/selection-change-action';
|
|
3
|
+
import { RTEImageNode } from '../../../dto/nodes/image-node';
|
|
4
|
+
test('ImageSetAnnotationMapStrategy should register properly', () => {
|
|
5
|
+
const imageNode = new RTEImageNode('1', 'mock image url', null);
|
|
6
|
+
imageNode.apply(new ImageAnnotationAction('lg', 'alt'));
|
|
7
|
+
expect(imageNode.toJSON().annotations.size).toEqual('lg');
|
|
8
|
+
const mockRange = new Object();
|
|
9
|
+
imageNode.apply(new SelectionChangeAction(mockRange));
|
|
10
|
+
expect(imageNode.getAnnotationByType('SELECTION_RANGE')['range']).toEqual(mockRange);
|
|
11
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ImageUpdateUrlStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy';
|
|
2
|
+
import { ImageUpdateUrlAction } from '../../../dto/actions/image-update-url-action';
|
|
3
|
+
import { RTEImageNode } from '../../../dto/nodes/image-node';
|
|
4
|
+
const strategy = new ImageUpdateUrlStrategy();
|
|
5
|
+
test('ImageUpdateUrlStrategy should work properly', () => {
|
|
6
|
+
const imageNode = new RTEImageNode('1', 'default image url', null);
|
|
7
|
+
const newUrl = 'new image url';
|
|
8
|
+
strategy.execute(new ImageUpdateUrlAction(newUrl), imageNode);
|
|
9
|
+
expect(imageNode.url).toEqual(newUrl);
|
|
10
|
+
});
|
|
11
|
+
test('ImageUpdateUrlStrategy should register into image node properly', () => {
|
|
12
|
+
const imageNode = new RTEImageNode('1', 'default image url', null);
|
|
13
|
+
const newUrl = 'new image url';
|
|
14
|
+
imageNode.apply(new ImageUpdateUrlAction(newUrl));
|
|
15
|
+
expect(imageNode.url).toEqual(newUrl);
|
|
16
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
2
|
+
import { BlockAppendBlocksStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy';
|
|
3
|
+
import { BlockInsertBlocksAfterStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy';
|
|
4
|
+
import { BlockInsertBlocksBeforeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy';
|
|
5
|
+
import { ListInsertImageStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy';
|
|
6
|
+
import { ListRemoveListItemStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy';
|
|
7
|
+
import { ListTransformToListStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy';
|
|
8
|
+
import { ListTransformToParagraphStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy';
|
|
9
|
+
import { ModifyContentActionType } from '../../../dto/actions/modify-content-action.abstract';
|
|
10
|
+
import { RTEListBlock } from '../../../dto/blocks/list-block';
|
|
11
|
+
test('RTEListBlock strategy should register properly', () => {
|
|
12
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_CHILD, RTEListBlock.name) instanceof
|
|
13
|
+
ListRemoveListItemStrategy).toBeTruthy();
|
|
14
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_BLOCKS_BEFORE, RTEListBlock.name) instanceof BlockInsertBlocksBeforeStrategy).toBeTruthy();
|
|
15
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_BLOCKS_AFTER, RTEListBlock.name) instanceof BlockInsertBlocksAfterStrategy).toBeTruthy();
|
|
16
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.APPEND_CHILD_NODES, RTEListBlock.name) instanceof BlockAppendBlocksStrategy).toBeTruthy();
|
|
17
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name) instanceof ListTransformToListStrategy).toBeTruthy();
|
|
18
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name) instanceof ListTransformToParagraphStrategy).toBeTruthy();
|
|
19
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name) instanceof ListInsertImageStrategy).toBeTruthy();
|
|
20
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
2
|
+
import { BlockAppendNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy';
|
|
3
|
+
import { BlockInsertLineBreakStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy';
|
|
4
|
+
import { BlockInsertLineBreakWithBlocksStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy';
|
|
5
|
+
import { BlockInsertNodesBeforeNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy';
|
|
6
|
+
import { BlockMergeNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy';
|
|
7
|
+
import { BlockReplaceNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy';
|
|
8
|
+
import { BlockSplitWithTextNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy';
|
|
9
|
+
import { ListItemDeleteTextContentStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy';
|
|
10
|
+
import { ListItemInsertImageStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy';
|
|
11
|
+
import { ListItemInsertNewParagraphStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy';
|
|
12
|
+
import { ListItemRemoveNestListStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy';
|
|
13
|
+
import { ListItemRemoveNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy';
|
|
14
|
+
import { ListItemReplaceNestListStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy';
|
|
15
|
+
import { ModifyContentActionType } from '../../../dto/actions/modify-content-action.abstract';
|
|
16
|
+
import { RTEListItemBlock } from '../../../dto/blocks/list-item-block';
|
|
17
|
+
test('RTEListItemBlock should register action handle strategy properly', () => {
|
|
18
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEListItemBlock.name) instanceof ListItemDeleteTextContentStrategy).toBeTruthy();
|
|
19
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name) instanceof BlockInsertLineBreakStrategy).toBeTruthy();
|
|
20
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name) instanceof BlockInsertLineBreakWithBlocksStrategy).toBeTruthy();
|
|
21
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_CHILD, RTEListItemBlock.name) instanceof ListItemRemoveNodeStrategy).toBeTruthy();
|
|
22
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name) instanceof ListItemRemoveNestListStrategy).toBeTruthy();
|
|
23
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.APPEND_CHILD_NODES, RTEListItemBlock.name) instanceof BlockAppendNodesStrategy).toBeTruthy();
|
|
24
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name) instanceof BlockSplitWithTextNodeStrategy).toBeTruthy();
|
|
25
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name) instanceof BlockReplaceNodesStrategy).toBeTruthy();
|
|
26
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name) instanceof ListItemReplaceNestListStrategy).toBeTruthy();
|
|
27
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name) instanceof BlockMergeNodesStrategy).toBeTruthy();
|
|
28
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEListItemBlock.name) instanceof ListItemInsertNewParagraphStrategy).toBeTruthy();
|
|
29
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name) instanceof ListItemInsertImageStrategy).toBeTruthy();
|
|
30
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_NODES_BEFORE, RTEListItemBlock.name) instanceof BlockInsertNodesBeforeNodeStrategy).toBeTruthy();
|
|
31
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NodeSplitTextStrategy } from '../../../dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy';
|
|
2
|
+
import { AppendChildNodesAction } from '../../../dto/actions/append-child-nodes-action';
|
|
3
|
+
import { BoldAnnotationAction } from '../../../dto/actions/bold-annotation-action';
|
|
4
|
+
import { SelectionRangeAnnotation } from '../../../dto/annotations/selection-range-annotation';
|
|
5
|
+
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
6
|
+
import { RTETextNode } from '../../../dto/nodes/text-node';
|
|
7
|
+
import stateEntityRenderingRegistry from '../../../slimmers/controllers/state-entity-rendering-registry';
|
|
8
|
+
function getMockSelectionRange(startContainer, endContainer, startOffset, endOffset) {
|
|
9
|
+
return {
|
|
10
|
+
startContainer,
|
|
11
|
+
endContainer,
|
|
12
|
+
startOffset,
|
|
13
|
+
endOffset,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const splitTextStrategy = new NodeSplitTextStrategy();
|
|
17
|
+
test('NodeSplitTextStrategy execute method should return value properly', () => {
|
|
18
|
+
const p = document.createElement('p');
|
|
19
|
+
p.innerHTML = '<span>A Paragraph</span>';
|
|
20
|
+
const block = new RTETextBlock('1', 'paragraph');
|
|
21
|
+
const textNode = new RTETextNode('1-1', 'A Paragraph', block);
|
|
22
|
+
block.apply(new AppendChildNodesAction([textNode]));
|
|
23
|
+
let result = splitTextStrategy.execute(new BoldAnnotationAction(false), textNode);
|
|
24
|
+
expect(result).toBeNull;
|
|
25
|
+
const span = p.querySelector('span');
|
|
26
|
+
textNode.annotationMap.set('SELECTION_RANGE', new SelectionRangeAnnotation(getMockSelectionRange(span.firstChild, span.firstChild, 1, 1)));
|
|
27
|
+
stateEntityRenderingRegistry.register(span, textNode);
|
|
28
|
+
result = splitTextStrategy.execute(new BoldAnnotationAction(true), textNode);
|
|
29
|
+
expect(block.nodes.length).toEqual(3);
|
|
30
|
+
expect(result instanceof RTETextNode).toBeTruthy();
|
|
31
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NodeUpdateAnnotationMapStrategy } from '../../../dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy';
|
|
2
|
+
import { AppendChildNodesAction } from '../../../dto/actions/append-child-nodes-action';
|
|
3
|
+
import { BoldAnnotationAction } from '../../../dto/actions/bold-annotation-action';
|
|
4
|
+
import { CodeAnnotationAction } from '../../../dto/actions/code-annotation-action';
|
|
5
|
+
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
6
|
+
import { RTETextNode } from '../../../dto/nodes/text-node';
|
|
7
|
+
const updateAnnotationMapStrategy = new NodeUpdateAnnotationMapStrategy();
|
|
8
|
+
test('NodeUpdateAnnotationMapStrategy execute method should work properly', () => {
|
|
9
|
+
const block = new RTETextBlock('1', 'paragraph');
|
|
10
|
+
const textNode = new RTETextNode('1-1', 'A Paragraph', block);
|
|
11
|
+
block.apply(new AppendChildNodesAction([textNode]));
|
|
12
|
+
updateAnnotationMapStrategy.execute(new BoldAnnotationAction(true), textNode);
|
|
13
|
+
expect(textNode.getAnnotationByType('BOLD')['toJSON']()).toEqual({ bold: true });
|
|
14
|
+
updateAnnotationMapStrategy.execute(new CodeAnnotationAction(true), textNode);
|
|
15
|
+
expect(textNode.getAnnotationByType('CODE')['toJSON']()).toEqual({ code: true });
|
|
16
|
+
expect(textNode.annotationMap.has('BOLD')).toEqual(false);
|
|
17
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
2
|
+
import { BlockAppendNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy';
|
|
3
|
+
import { BlockDeleteTextContentStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy';
|
|
4
|
+
import { BlockInsertImageIntoTextStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy';
|
|
5
|
+
import { BlockInsertLineBreakStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy';
|
|
6
|
+
import { BlockInsertLineBreakWithBlocksStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy';
|
|
7
|
+
import { BlockInsertNewParagraphStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy';
|
|
8
|
+
import { BlockInsertNodesBeforeNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy';
|
|
9
|
+
import { BlockMergeNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy';
|
|
10
|
+
import { BlockRemoveNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy';
|
|
11
|
+
import { BlockReplaceNodesStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy';
|
|
12
|
+
import { BlockSplitWithTextNodeStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy';
|
|
13
|
+
import { BlockTransformToListStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy';
|
|
14
|
+
import { ModifyContentActionType } from '../../../dto/actions/modify-content-action.abstract';
|
|
15
|
+
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
16
|
+
import { BlockUpdateLinkGroupStrategy } from '../../../dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy';
|
|
17
|
+
import { BlockUpdateTextStyleStrategy } from '../../../dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy';
|
|
18
|
+
import { LinkGroupAnnotationAction } from '../../../dto/actions/link-group-annotation-action';
|
|
19
|
+
import { TextStyleAnnotationAction } from '../../../dto/actions/text-style-annotation-action';
|
|
20
|
+
import { InternalAnnotationTypeEnum } from '../../../dto/annotations/annotation.abstract';
|
|
21
|
+
test('RTETextBlock annotation strategy should register properly', () => {
|
|
22
|
+
expect(ActionHandleStrategyRegistry.get(TextStyleAnnotationAction.name, RTETextBlock.name) instanceof
|
|
23
|
+
BlockUpdateTextStyleStrategy).toBeTruthy();
|
|
24
|
+
expect(ActionHandleStrategyRegistry.get(LinkGroupAnnotationAction.name, RTETextBlock.name) instanceof
|
|
25
|
+
BlockUpdateLinkGroupStrategy).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
test('RTETextBlock apply annotation action should work properly', () => {
|
|
28
|
+
const textBlock = RTETextBlock.from({
|
|
29
|
+
id: '1',
|
|
30
|
+
type: 'subtitle',
|
|
31
|
+
nodes: [{ id: '1-1', type: 'text', text: 'Paragraph' }],
|
|
32
|
+
});
|
|
33
|
+
expect(textBlock.nodes[0].annotationMap.has('BOLD')).toBeFalsy();
|
|
34
|
+
textBlock.apply(new TextStyleAnnotationAction('paragraph', true));
|
|
35
|
+
expect(textBlock.type).toEqual('paragraph');
|
|
36
|
+
expect(textBlock.nodes[0].getAnnotationByType('BOLD')['toJSON']()['bold']).toBeTruthy();
|
|
37
|
+
expect(textBlock.annotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)).toBeFalsy();
|
|
38
|
+
textBlock.apply(new LinkGroupAnnotationAction('1', textBlock.nodes));
|
|
39
|
+
expect(textBlock.annotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
test('RTETextBlock should register action handle strategy properly', () => {
|
|
42
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_CHILD, RTETextBlock.name) instanceof
|
|
43
|
+
BlockRemoveNodeStrategy).toBeTruthy();
|
|
44
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.APPEND_CHILD_NODES, RTETextBlock.name) instanceof BlockAppendNodesStrategy).toBeTruthy();
|
|
45
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTETextBlock.name) instanceof BlockSplitWithTextNodeStrategy).toBeTruthy();
|
|
46
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.REPLACE_CHILD_NODES, RTETextBlock.name) instanceof BlockReplaceNodesStrategy).toBeTruthy();
|
|
47
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTETextBlock.name) instanceof BlockMergeNodesStrategy).toBeTruthy();
|
|
48
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTETextBlock.name) instanceof BlockInsertNewParagraphStrategy).toBeTruthy();
|
|
49
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTETextBlock.name) instanceof BlockInsertLineBreakStrategy).toBeTruthy();
|
|
50
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTETextBlock.name) instanceof BlockInsertLineBreakWithBlocksStrategy).toBeTruthy();
|
|
51
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTETextBlock.name) instanceof BlockDeleteTextContentStrategy).toBeTruthy();
|
|
52
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTETextBlock.name) instanceof BlockInsertImageIntoTextStrategy).toBeTruthy();
|
|
53
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.INSERT_NODES_BEFORE, RTETextBlock.name) instanceof BlockInsertNodesBeforeNodeStrategy).toBeTruthy();
|
|
54
|
+
expect(ActionHandleStrategyRegistry.get(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTETextBlock.name) instanceof BlockTransformToListStrategy).toBeTruthy();
|
|
55
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NodeReplaceSelectedTextStrategy } from '../../../dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy';
|
|
2
|
+
import { ReplaceSelectedTextAction } from '../../../dto/actions/replace-selected-text-action';
|
|
3
|
+
import { RTETextNode } from '../../../dto/nodes/text-node';
|
|
4
|
+
import { RTERange } from '../../../dto/range';
|
|
5
|
+
import stateEntityRenderingRegistry from '../../../slimmers/controllers/state-entity-rendering-registry';
|
|
6
|
+
test('UpdateSelectedNodeStrategy should update text properly', () => {
|
|
7
|
+
const span = document.createElement('span');
|
|
8
|
+
span.innerText = 'paragraph';
|
|
9
|
+
const textNode = new RTETextNode('1', span.innerText, null);
|
|
10
|
+
stateEntityRenderingRegistry.register(span, textNode);
|
|
11
|
+
const strategy = new NodeReplaceSelectedTextStrategy();
|
|
12
|
+
strategy.execute(new ReplaceSelectedTextAction('new text', new RTERange(span.firstChild, span.firstChild, 0, 9)), textNode);
|
|
13
|
+
expect(textNode.text).toEqual('new text');
|
|
14
|
+
});
|
|
15
|
+
test('UpdateSelectedNodeStrategy should update text properly if the range is collapsed', () => {
|
|
16
|
+
const span = document.createElement('span');
|
|
17
|
+
span.innerText = 'paragraph';
|
|
18
|
+
const textNode = new RTETextNode('1', span.innerText, null);
|
|
19
|
+
stateEntityRenderingRegistry.register(span, textNode);
|
|
20
|
+
const strategy = new NodeReplaceSelectedTextStrategy();
|
|
21
|
+
strategy.execute(new ReplaceSelectedTextAction('This is a ', new RTERange(span.firstChild, span.firstChild, 0, 0)), textNode);
|
|
22
|
+
expect(textNode.text).toEqual('This is a paragraph');
|
|
23
|
+
});
|