@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
|
@@ -6,16 +6,12 @@ import { VegaInternalRichTextEditorFlushChanges } from '../../../../helpers/even
|
|
|
6
6
|
import { ModifyContentAction } from '../actions/modify-content-action.abstract';
|
|
7
7
|
import { HorizontalAlignmentAnnotation } from '../annotations/horizontal-alignment-annotation';
|
|
8
8
|
import { IndentAnnotation } from '../annotations/indent-annotation';
|
|
9
|
-
import {
|
|
10
|
-
import { AppendChildNodesAction } from '../actions/append-child-nodes-action';
|
|
11
|
-
import { RemoveChildAction } from '../actions/remove-child-action';
|
|
12
|
-
import { ZERO_WIDTH_SPACE } from '../../constants/constant';
|
|
9
|
+
import { ActionHandleStrategyRegistry } from '../action-handle-strategies/action-handle-strategy-registry';
|
|
13
10
|
/**
|
|
14
11
|
* Abstract class for block
|
|
15
12
|
*/
|
|
16
|
-
export class RTEBlock
|
|
13
|
+
export class RTEBlock {
|
|
17
14
|
constructor(id) {
|
|
18
|
-
super();
|
|
19
15
|
this.annotationMap = new Map();
|
|
20
16
|
this.id = id;
|
|
21
17
|
}
|
|
@@ -85,7 +81,7 @@ export class RTEBlock extends BlockBaseOperator {
|
|
|
85
81
|
*/
|
|
86
82
|
doApply(action) {
|
|
87
83
|
if (action instanceof ModifyContentAction) {
|
|
88
|
-
|
|
84
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
89
85
|
}
|
|
90
86
|
else {
|
|
91
87
|
this.applyAnnotationAction(action);
|
|
@@ -101,212 +97,4 @@ export class RTEBlock extends BlockBaseOperator {
|
|
|
101
97
|
this.annotationMap.set(annotation.type, annotation);
|
|
102
98
|
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
103
99
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Appends a list of RTENode objects to the current node's child nodes and sets the parent block of each node to the current node.
|
|
106
|
-
*
|
|
107
|
-
* @param {RTENode[]} nodesToBeAppended - An array of `RTENode` objects that you want to append to the current block.
|
|
108
|
-
*/
|
|
109
|
-
appendChildNodes(nodesToBeAppended) {
|
|
110
|
-
nodesToBeAppended.forEach((node) => {
|
|
111
|
-
node.parentBlock = this;
|
|
112
|
-
});
|
|
113
|
-
this['nodes'] = this['nodes'].concat(nodesToBeAppended);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
|
|
117
|
-
*
|
|
118
|
-
* @param {RTEBlock} secondBlock - A block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
119
|
-
*/
|
|
120
|
-
mergeTwoBlocksNodes(secondBlock) {
|
|
121
|
-
if (this.type === secondBlock.type || (this.type !== 'image' && secondBlock.type !== 'image')) {
|
|
122
|
-
let shouldMergeNodes = secondBlock['nodes'];
|
|
123
|
-
if (this.type !== 'image') {
|
|
124
|
-
shouldMergeNodes = secondBlock['nodes'].filter((node) => node['text'] && node['text'] !== ZERO_WIDTH_SPACE);
|
|
125
|
-
}
|
|
126
|
-
this.apply(new AppendChildNodesAction(shouldMergeNodes));
|
|
127
|
-
secondBlock.parent.apply(new RemoveChildAction(secondBlock));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Concat the child nodes of multiple RTEBlocks if both are not images.
|
|
132
|
-
*
|
|
133
|
-
* @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
134
|
-
* @returns {RTENode[]} Array of connected block nodes
|
|
135
|
-
*/
|
|
136
|
-
concatBlocksNodes(blocks) {
|
|
137
|
-
const nodes = [];
|
|
138
|
-
blocks.map((block) => {
|
|
139
|
-
if (block.type !== 'image') {
|
|
140
|
-
nodes.push(...block['nodes']);
|
|
141
|
-
block.parent.apply(new RemoveChildAction(block));
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return nodes;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Returns the previous node relative to the current node in a rich text editor structure.
|
|
148
|
-
*
|
|
149
|
-
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
150
|
-
* @returns {Nullable<RTENode>} the previous block last node
|
|
151
|
-
*/
|
|
152
|
-
getPreviousNode(currentNode) {
|
|
153
|
-
const currentBlock = currentNode.parentBlock;
|
|
154
|
-
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
155
|
-
if (currentIndex > 0) {
|
|
156
|
-
return currentBlock['nodes'][currentIndex - 1];
|
|
157
|
-
}
|
|
158
|
-
else if (currentBlock.parent) {
|
|
159
|
-
const previousBlock = this.getPreviousBlock(currentBlock);
|
|
160
|
-
if (previousBlock) {
|
|
161
|
-
return this.getBlockLastNode(previousBlock);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Returns the next node relative to the current node in a rich text editor structure.
|
|
167
|
-
*
|
|
168
|
-
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
169
|
-
* @returns {Nullable<RTENode>} the next block first node
|
|
170
|
-
*/
|
|
171
|
-
getNextNode(currentNode) {
|
|
172
|
-
const currentBlock = currentNode.parentBlock;
|
|
173
|
-
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
174
|
-
if (currentBlock['nodes'][currentIndex + 1]) {
|
|
175
|
-
return currentBlock['nodes'][currentIndex + 1];
|
|
176
|
-
}
|
|
177
|
-
else if (currentBlock.parent) {
|
|
178
|
-
const nextBlock = this.getNextBlock(currentBlock);
|
|
179
|
-
if (nextBlock) {
|
|
180
|
-
return this.getBlockFirstNode(nextBlock);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Determines if a given node is the first node within the current state.
|
|
186
|
-
*
|
|
187
|
-
* @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
|
|
188
|
-
* @returns {boolean} True or false;
|
|
189
|
-
*/
|
|
190
|
-
isContentFirstNode(currentNode) {
|
|
191
|
-
const currentBlock = currentNode.parentBlock;
|
|
192
|
-
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
193
|
-
const parent = currentBlock.parent;
|
|
194
|
-
if (currentBlock.type === 'list-item') {
|
|
195
|
-
const listParent = parent.parent;
|
|
196
|
-
return (currentIndex === 0 &&
|
|
197
|
-
Array.isArray(parent.blocks) &&
|
|
198
|
-
parent.blocks[0] === currentBlock &&
|
|
199
|
-
listParent['type'] !== 'list-item' &&
|
|
200
|
-
Array.isArray(listParent.blocks) &&
|
|
201
|
-
listParent.blocks[0] === parent);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
return currentIndex === 0 && Array.isArray(parent.blocks) && parent.blocks[0] === currentBlock;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Returns the last node within a given RTE block, handling different block types accordingly.
|
|
209
|
-
*
|
|
210
|
-
* @param {RTEBlock} currentBlock - Returns the last node within that block.
|
|
211
|
-
* @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
|
|
212
|
-
*/
|
|
213
|
-
getBlockLastNode(currentBlock) {
|
|
214
|
-
if (currentBlock.type === 'list-item') {
|
|
215
|
-
if (currentBlock['children'] && currentBlock['children'].length > 0) {
|
|
216
|
-
return this.getBlockLastNode(currentBlock['children'][currentBlock['children'].length - 1]);
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
return currentBlock['nodes'][currentBlock['nodes'].length - 1];
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
else if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
223
|
-
if (currentBlock.blocks) {
|
|
224
|
-
const lastListItem = currentBlock.blocks[currentBlock.blocks.length - 1];
|
|
225
|
-
return this.getBlockLastNode(lastListItem);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
if (currentBlock['nodes']) {
|
|
230
|
-
return currentBlock['nodes'][currentBlock['nodes'].length - 1];
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Returns the first node within a given RTE block, handling different block types accordingly.
|
|
236
|
-
*
|
|
237
|
-
* @param {RTEBlock} currentBlock - Returns the first node within that block.
|
|
238
|
-
* @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
|
|
239
|
-
*/
|
|
240
|
-
getBlockFirstNode(currentBlock) {
|
|
241
|
-
if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
242
|
-
if (currentBlock.blocks) {
|
|
243
|
-
const firstListItem = currentBlock.blocks[0];
|
|
244
|
-
return this.getBlockFirstNode(firstListItem);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
if (currentBlock['nodes']) {
|
|
249
|
-
return currentBlock['nodes'][0];
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* TODO: The getPreviousBlock add nest list support
|
|
255
|
-
* This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
256
|
-
*
|
|
257
|
-
* @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
|
|
258
|
-
* @returns {Nullable<RTEBlock>} The previous block if existing
|
|
259
|
-
*/
|
|
260
|
-
getPreviousBlock(currentBlock) {
|
|
261
|
-
if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
|
|
262
|
-
const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
|
|
263
|
-
if (currentBlockIndex > 0) {
|
|
264
|
-
return currentBlock.parent.blocks[currentBlockIndex - 1];
|
|
265
|
-
}
|
|
266
|
-
else if ((currentBlock.parent['type'] === 'number-list' ||
|
|
267
|
-
currentBlock.parent['type'] === 'bullet-list') &&
|
|
268
|
-
currentBlockIndex === 0) {
|
|
269
|
-
return this.getPreviousBlock(currentBlock.parent);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
275
|
-
*
|
|
276
|
-
* @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
|
|
277
|
-
* @returns {Nullable<RTEBlock>} The next block if existing
|
|
278
|
-
*/
|
|
279
|
-
getNextBlock(currentBlock) {
|
|
280
|
-
if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
|
|
281
|
-
const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
|
|
282
|
-
if (currentBlock.parent.blocks[currentBlockIndex + 1]) {
|
|
283
|
-
return currentBlock.parent.blocks[currentBlockIndex + 1];
|
|
284
|
-
}
|
|
285
|
-
else if (currentBlock.type === 'list-item' &&
|
|
286
|
-
currentBlock.parent.blocks.length === currentBlockIndex + 1) {
|
|
287
|
-
return this.getNextBlock(currentBlock.parent);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Replaces a specific node with an array of nodes within a RTENode array.
|
|
293
|
-
*
|
|
294
|
-
* @param {RTENode} referNode - Used as a reference node to identify the node that needs to be replaced in the `nodes` array.
|
|
295
|
-
* @param {RTENode[]} nodes - An array of RTENode objects that you want to replace the `referNode` with in the `nodes` array.
|
|
296
|
-
*/
|
|
297
|
-
replaceNodeWithNodes(referNode, nodes) {
|
|
298
|
-
if (this['nodes']) {
|
|
299
|
-
nodes.forEach((node) => {
|
|
300
|
-
node.parentBlock = this;
|
|
301
|
-
});
|
|
302
|
-
this['nodes'] = this['nodes'].flatMap((node) => {
|
|
303
|
-
if (node === referNode) {
|
|
304
|
-
return nodes;
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
return node;
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
100
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { RTEBlock } from './block.abstract';
|
|
2
2
|
import { RTEImageNode } from '../nodes/image-node';
|
|
3
3
|
import { ModifyContentActionType } from '../actions/modify-content-action.abstract';
|
|
4
|
-
import { RemoveChildAction } from '../actions/remove-child-action';
|
|
5
4
|
import { isNonNullable } from '../../../../types/type-guard';
|
|
6
|
-
import { AppendChildNodesAction } from '../actions/append-child-nodes-action';
|
|
7
|
-
import { ReplaceChildNodesAction } from '../actions/replace-child-nodes-action';
|
|
8
5
|
import { generateUUID } from '../../../../utils/misc';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { ActionHandleStrategyRegistry } from '../action-handle-strategies/action-handle-strategy-registry';
|
|
7
|
+
import { BlockDeleteImageStrategy } from '../action-handle-strategies/modify-content-strategies/block-delete-image-strategy';
|
|
8
|
+
import { BlockMergeNodesStrategy } from '../action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy';
|
|
9
|
+
import { BlockRemoveNodeStrategy } from '../action-handle-strategies/modify-content-strategies/block-remove-node-strategy';
|
|
10
|
+
import { BlockAppendNodesStrategy } from '../action-handle-strategies/modify-content-strategies/block-append-nodes-strategy';
|
|
11
|
+
import { BlockReplaceNodesStrategy } from '../action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy';
|
|
12
|
+
import { BlockSplitWithImageNodeStrategy } from '../action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy';
|
|
13
|
+
import { ImageInsertNewParagraphStrategy } from '../action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy';
|
|
14
|
+
import { ImageInsertLineBreakStrategy } from '../action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy';
|
|
15
|
+
import { ImageInsertLineBreakWithBlocksStrategy } from '../action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy';
|
|
16
|
+
import { ImageBlockInsertImageStrategy } from '../action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy';
|
|
17
|
+
import { BlockInsertNodesBeforeNodeStrategy } from '../action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy';
|
|
18
|
+
import { BlockInsertNodesAfterNodeStrategy } from '../action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy';
|
|
14
19
|
/**
|
|
15
20
|
* Image block
|
|
16
21
|
*/
|
|
@@ -59,243 +64,25 @@ export class RTEImageBlock extends RTEBlock {
|
|
|
59
64
|
return this.nodes[this.nodes.length - 1];
|
|
60
65
|
}
|
|
61
66
|
/**
|
|
62
|
-
*
|
|
67
|
+
* Create a new image block.
|
|
63
68
|
*
|
|
64
|
-
* @
|
|
69
|
+
* @returns {RTEImageBlock} - The empty image block.
|
|
65
70
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
case ModifyContentActionType.DELETE_CHILD:
|
|
69
|
-
this.removeChildNode(action);
|
|
70
|
-
break;
|
|
71
|
-
case ModifyContentActionType.CLEAR_CHILD_NODES:
|
|
72
|
-
this.nodes = [];
|
|
73
|
-
break;
|
|
74
|
-
case ModifyContentActionType.APPEND_CHILD_NODES:
|
|
75
|
-
this.appendChildNodes(action.entityToBeAppended);
|
|
76
|
-
break;
|
|
77
|
-
case ModifyContentActionType.REPLACE_CHILD_NODES:
|
|
78
|
-
this.nodes = [];
|
|
79
|
-
this.appendChildNodes(action.newChildNodes);
|
|
80
|
-
break;
|
|
81
|
-
case ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
|
|
82
|
-
action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode);
|
|
83
|
-
break;
|
|
84
|
-
case ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
|
|
85
|
-
this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
|
|
86
|
-
break;
|
|
87
|
-
case ModifyContentActionType.BREAK_SINGLE_BLOCK:
|
|
88
|
-
action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset);
|
|
89
|
-
break;
|
|
90
|
-
case ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
|
|
91
|
-
action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
|
|
92
|
-
break;
|
|
93
|
-
case ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
|
|
94
|
-
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
|
|
95
|
-
break;
|
|
96
|
-
case ModifyContentActionType.DELETE_BLOCK_CONTENT:
|
|
97
|
-
this.deleteNodeContent(action);
|
|
98
|
-
break;
|
|
99
|
-
case ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
|
|
100
|
-
this.insertImage(action);
|
|
101
|
-
break;
|
|
102
|
-
case ModifyContentActionType.INSERT_NODES_AFTER:
|
|
103
|
-
this.replaceNodeWithNodes(action.referNode, [
|
|
104
|
-
action.referNode,
|
|
105
|
-
...action.nodesToBeInserted,
|
|
106
|
-
]);
|
|
107
|
-
break;
|
|
108
|
-
case ModifyContentActionType.INSERT_NODES_BEFORE:
|
|
109
|
-
this.replaceNodeWithNodes(action.referNode, [
|
|
110
|
-
...action.nodesToBeInserted,
|
|
111
|
-
action.referNode,
|
|
112
|
-
]);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Removes a specified child node from a list of nodes and triggers a parent action if the list becomes empty.
|
|
118
|
-
*
|
|
119
|
-
* @param {RemoveChildAction} action - Action to be performed when removing a child node from the list of nodes.
|
|
120
|
-
*/
|
|
121
|
-
removeChildNode(action) {
|
|
122
|
-
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
123
|
-
if (this.nodes.length === 0) {
|
|
124
|
-
this.parent.apply(new RemoveChildAction(this));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* The image offset should be 0 or 1
|
|
129
|
-
* <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
|
|
130
|
-
*
|
|
131
|
-
* @param {RTEImageNode} imageNode The split point image node
|
|
132
|
-
* @param {number} imageOffset The cursor point 0 | 1
|
|
133
|
-
* @returns {Nullable<RTEBlock>} The new block after split
|
|
134
|
-
*/
|
|
135
|
-
splitImageNodes(imageNode, imageOffset) {
|
|
136
|
-
const nodesSplitIndex = this.nodes.indexOf(imageNode);
|
|
137
|
-
if (nodesSplitIndex > -1) {
|
|
138
|
-
const beforeNodes = this.nodes.slice(0, nodesSplitIndex + imageOffset);
|
|
139
|
-
const afterNodes = this.nodes.slice(nodesSplitIndex + imageOffset);
|
|
140
|
-
this.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
141
|
-
const newBlock = this.cloneWithNodes(afterNodes);
|
|
142
|
-
this.parent.apply(new InsertBlocksAfterAction(this, newBlock));
|
|
143
|
-
return newBlock;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
|
|
148
|
-
*
|
|
149
|
-
* @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
|
|
150
|
-
* @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
|
|
151
|
-
*/
|
|
152
|
-
cloneWithNodes(nodes) {
|
|
153
|
-
const block = new RTEImageBlock(generateUUID());
|
|
154
|
-
block.nodes = [];
|
|
155
|
-
block.apply(new AppendChildNodesAction(nodes));
|
|
156
|
-
return block;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Used to split a block of text at a specific position and insert a new paragraph block.
|
|
160
|
-
*
|
|
161
|
-
* @param {RTEImageNode} splitNode - The node that needs to be split into separate blocks.
|
|
162
|
-
* @param {number} startOffsetOfNode - The index or position within the `splitNode` where the block should be broken or split.
|
|
163
|
-
* @returns {Nullable<RTEBlock>} Returns either a new paragraph block or the new block created after splitting the original block.
|
|
164
|
-
*/
|
|
165
|
-
breakSingleBlock(splitNode, startOffsetOfNode) {
|
|
166
|
-
const newParagraph = RTETextBlock.from({
|
|
167
|
-
id: generateUUID(),
|
|
168
|
-
type: 'paragraph',
|
|
169
|
-
nodes: [{ id: generateUUID(), type: 'text', text: '' }],
|
|
170
|
-
});
|
|
171
|
-
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
172
|
-
this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
|
|
173
|
-
}
|
|
174
|
-
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
175
|
-
this.parent.apply(new InsertBlocksBeforeAction(this, newParagraph));
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
179
|
-
this.apply(splitBlockAction);
|
|
180
|
-
return splitBlockAction.newBlock;
|
|
181
|
-
}
|
|
182
|
-
return newParagraph;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Breaks a single block of text at a specified offset and returns the first node of the new paragraph if created.
|
|
186
|
-
*
|
|
187
|
-
* @param {RTEImageNode} splitNode - It represents a node in a rich text editor that contains an image.
|
|
188
|
-
* @param {number} startOffset - The index at which the line break should occur within the `RTEImageNode` block.
|
|
189
|
-
* @returns {Nullable<RTETextNode>} Returning the first node of the `newParagraph` block if `newParagraph` is not null.
|
|
190
|
-
*/
|
|
191
|
-
lineBreakSingleBlock(splitNode, startOffset) {
|
|
192
|
-
const newParagraph = this.breakSingleBlock(splitNode, startOffset);
|
|
193
|
-
if (newParagraph) {
|
|
194
|
-
return newParagraph['nodes'][0];
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Checks if the caret position is at the start of a specified RTEImageNode.
|
|
199
|
-
*
|
|
200
|
-
* @param {RTEImageNode} node - `RTEImageNode` - a node representing an image in a rich text editor.
|
|
201
|
-
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
202
|
-
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTEImageNode.
|
|
203
|
-
*/
|
|
204
|
-
isCaretPositionAtStart(node, startOffset) {
|
|
205
|
-
return node === this.nodes[0] && startOffset === 0;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Checks if the caret position is at the end of a given RTEImageNode.
|
|
209
|
-
*
|
|
210
|
-
* @param {RTEImageNode} node - `node` is a RTEImageNode
|
|
211
|
-
* @param {number} startOffset - The position within the `RTEImageNode` where the caret is located.
|
|
212
|
-
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEImageNode`.
|
|
213
|
-
*/
|
|
214
|
-
isCaretPositionAtEnd(node, startOffset) {
|
|
215
|
-
const lastNode = this.nodes[this.nodes.length - 1];
|
|
216
|
-
return node === lastNode && startOffset === 1;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
|
|
220
|
-
*
|
|
221
|
-
* @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
|
|
222
|
-
* @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
|
|
223
|
-
*/
|
|
224
|
-
lineBreakMultipleBlocks(selectedBlocks) {
|
|
225
|
-
const newParagraph = RTETextBlock.from({
|
|
226
|
-
id: generateUUID(),
|
|
227
|
-
type: 'paragraph',
|
|
228
|
-
nodes: [{ id: generateUUID(), type: 'text', text: '\n' }],
|
|
229
|
-
});
|
|
230
|
-
this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
|
|
231
|
-
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
232
|
-
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
233
|
-
afterNodes.push(new RTETextNode(generateUUID(), '\n', newParagraph));
|
|
234
|
-
}
|
|
235
|
-
newParagraph.apply(new AppendChildNodesAction(afterNodes));
|
|
236
|
-
return newParagraph['nodes'][0];
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Deletes content from a block node based on specific conditions.
|
|
240
|
-
*
|
|
241
|
-
* @param {DeleteBlockContentAction} action - Delete block content action
|
|
242
|
-
*/
|
|
243
|
-
deleteNodeContent(action) {
|
|
244
|
-
const startContainerNode = action
|
|
245
|
-
.startContainerNode, startOffset = action.startOffset;
|
|
246
|
-
let previousNode = this.getPreviousNode(startContainerNode);
|
|
247
|
-
let nextNode = null;
|
|
248
|
-
if (startOffset === 1) {
|
|
249
|
-
const parentBlock = startContainerNode.parentBlock;
|
|
250
|
-
if (this.isContentFirstNode(startContainerNode)) {
|
|
251
|
-
nextNode = this.getNextNode(startContainerNode);
|
|
252
|
-
}
|
|
253
|
-
if (parentBlock.nodes.length === 1) {
|
|
254
|
-
parentBlock.parent.apply(new RemoveChildAction(parentBlock));
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
startContainerNode.parentBlock.apply(new RemoveChildAction(startContainerNode));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
const shouldRemoveNode = previousNode;
|
|
262
|
-
if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
|
|
263
|
-
previousNode = this.getPreviousNode(shouldRemoveNode);
|
|
264
|
-
shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
|
|
265
|
-
if (!previousNode) {
|
|
266
|
-
action.nextNode = startContainerNode;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (previousNode) {
|
|
271
|
-
action.previousNode = previousNode;
|
|
272
|
-
}
|
|
273
|
-
else if (nextNode) {
|
|
274
|
-
action.nextNode = nextNode;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Image will always create new image block
|
|
279
|
-
*
|
|
280
|
-
* @param {InsertImageToBlockAction} action insert image to current block
|
|
281
|
-
*/
|
|
282
|
-
insertImage(action) {
|
|
283
|
-
const splitNode = action.splitPointNode;
|
|
284
|
-
const startOffsetOfNode = action.startOffsetOfNode;
|
|
285
|
-
const newImageNodes = action.imageBlockToBeInserted.nodes;
|
|
286
|
-
const newImageBlock = action.imageBlockToBeInserted;
|
|
287
|
-
if (this.nodes.length < 1) {
|
|
288
|
-
this.apply(new AppendChildNodesAction(newImageNodes));
|
|
289
|
-
}
|
|
290
|
-
else if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
291
|
-
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
292
|
-
}
|
|
293
|
-
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
294
|
-
this.parent.apply(new InsertBlocksBeforeAction(this, newImageBlock));
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
this.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
|
|
298
|
-
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
299
|
-
}
|
|
71
|
+
createNewImageBlock() {
|
|
72
|
+
return new RTEImageBlock(generateUUID());
|
|
300
73
|
}
|
|
301
74
|
}
|
|
75
|
+
(() => {
|
|
76
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEImageBlock.name, new BlockDeleteImageStrategy());
|
|
77
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name, new BlockMergeNodesStrategy());
|
|
78
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEImageBlock.name, new BlockRemoveNodeStrategy());
|
|
79
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEImageBlock.name, new BlockAppendNodesStrategy());
|
|
80
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new BlockReplaceNodesStrategy());
|
|
81
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
|
|
82
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertNewParagraphStrategy());
|
|
83
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
|
|
84
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
|
|
85
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
|
|
86
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTEImageBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
87
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_AFTER, RTEImageBlock.name, new BlockInsertNodesAfterNodeStrategy());
|
|
88
|
+
})();
|