@globalpayments/vega 2.49.1 → 2.51.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/LICENSE +9 -17
- package/dist/cjs/{app-globals-65622aeb.js → app-globals-4ecf85bb.js} +11 -8
- package/dist/cjs/{child-nodes-event-prevent-slimmer-cc193ee1.js → child-nodes-event-prevent-slimmer-29020cc8.js} +1 -1
- package/dist/cjs/{child-nodes-notify-observer-slimmer-5817a53b.js → child-nodes-notify-observer-slimmer-30ba81ac.js} +1 -1
- package/dist/cjs/{content-state-6a48bcb5.js → code-block-2d014e17.js} +212 -975
- package/dist/cjs/{component-73a88c4e.js → component-1e352960.js} +1 -0
- package/dist/cjs/{component-global-style-slimmer-6749808c.js → component-global-style-slimmer-b0b4b997.js} +3 -0
- package/dist/cjs/content-state-6a5da7ec.js +1146 -0
- package/dist/cjs/{dark-mode-style-controller-4adb7fb2.js → dark-mode-style-controller-f9a32d68.js} +8 -0
- package/dist/cjs/{design-token-cba4222e.js → design-token-3f4f0bc3.js} +1 -1
- package/dist/cjs/{dom-node-subject-factory-d5826bff.js → dom-node-subject-factory-769dd00f.js} +1 -1
- package/dist/cjs/{dom-node-subject-observer-factory-a7a3b196.js → dom-node-subject-observer-factory-5aa4cc83.js} +1 -1
- package/dist/cjs/{effect-37695d3d.js → effect-98e88068.js} +2 -8
- package/dist/cjs/{element-appender-slimmer-4a26ecb2.js → element-appender-slimmer-5b1d8ffb.js} +13 -8
- package/dist/cjs/{event-emit-slimmer-8247249c.js → event-emit-slimmer-36036ef7.js} +15 -4
- package/dist/cjs/{form-field-controller-slimmer-4b0af5bc.js → form-field-controller-slimmer-01c01946.js} +9 -7
- package/dist/cjs/{image-annotation-action-9c2b9c8e.js → image-annotation-action-617bbb13.js} +19 -18
- package/dist/cjs/{index-09acd3c9.js → index-7700600c.js} +9 -0
- package/dist/cjs/{index-c4dec3aa.js → index-ebb1bb17.js} +3 -3
- package/dist/cjs/index.cjs.js +21 -20
- package/dist/cjs/{inject-keyboard-manager-b301e887.js → inject-keyboard-manager-dd628ccc.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-c9948b59.js → internal-vega-event-manager-e98944ac.js} +8 -1
- package/dist/cjs/{keyboard-manager-2ccf4b16.js → keyboard-manager-8c74eeb9.js} +3 -1
- package/dist/cjs/{keyboard-manager-slimmer-900cf2f5.js → keyboard-manager-slimmer-eb364bee.js} +1 -1
- package/dist/cjs/{legend-input-processor-8bcce3bf.js → legend-input-processor-b1f323fa.js} +2 -0
- package/dist/cjs/loader.cjs.js +15 -14
- package/dist/cjs/{page-resize-observer-slimmer-44e08878.js → page-resize-observer-slimmer-efa79728.js} +1 -0
- package/dist/cjs/{public-rules-10ec636d.js → public-rules-a3b7e267.js} +8 -7
- package/dist/cjs/{responsive-format-facade-263d49f6.js → responsive-format-facade-6b81192d.js} +6 -6
- package/dist/cjs/{rich-text-editor-required-rule-5faded94.js → rich-text-editor-required-rule-e9c7c379.js} +1 -1
- package/dist/cjs/selection-controller-1d7c0999.js +762 -0
- package/dist/cjs/{string-input-formatter-slimmer-50322824.js → string-input-formatter-slimmer-a5feb2ed.js} +3 -3
- package/dist/cjs/{style-formatter-ae0ef7fc.js → style-formatter-497d0fa4.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-7f437b19.js → sub-state-notify-slimmer-f68fbf29.js} +2 -2
- package/dist/cjs/{sub-state-observer-slimmer-e90362cd.js → sub-state-observer-slimmer-e06cdf7e.js} +3 -3
- package/dist/cjs/{translation-212b1875.js → translation-e5003a00.js} +5 -0
- package/dist/cjs/{translation-slimmer-d1512c6d.js → translation-slimmer-127a0f83.js} +1 -1
- package/dist/cjs/{ui-13b42af0.js → ui-6c069604.js} +2 -0
- package/dist/cjs/vega-accordion.cjs.entry.js +17 -16
- package/dist/cjs/vega-app-footer.cjs.entry.js +3 -3
- package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -17
- package/dist/cjs/vega-backdrop.cjs.entry.js +3 -3
- package/dist/cjs/vega-banner.cjs.entry.js +7 -7
- package/dist/cjs/vega-bar-chart.cjs.entry.js +3 -3
- package/dist/cjs/vega-box.cjs.entry.js +18 -15
- package/dist/cjs/vega-brand-logo.cjs.entry.js +3 -3
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +8 -8
- package/dist/cjs/vega-button-circle.cjs.entry.js +18 -17
- package/dist/cjs/vega-button-group_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-button-link.cjs.entry.js +8 -8
- package/dist/cjs/vega-button.cjs.entry.js +17 -16
- package/dist/cjs/vega-calendar_3.cjs.entry.js +14 -14
- package/dist/cjs/vega-card.cjs.entry.js +15 -14
- package/dist/cjs/vega-carousel.cjs.entry.js +20 -16
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +14 -14
- package/dist/cjs/vega-chip.cjs.entry.js +18 -17
- package/dist/cjs/vega-code-block.cjs.entry.js +4160 -0
- package/dist/cjs/vega-color-picker.cjs.entry.js +12 -12
- package/dist/cjs/vega-combo-box.cjs.entry.js +15 -15
- package/dist/cjs/vega-counter-badge.cjs.entry.js +2 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +34 -24
- package/dist/cjs/vega-dialog_2.cjs.entry.js +25 -18
- package/dist/cjs/vega-divider.cjs.entry.js +15 -14
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +25 -24
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +7 -7
- package/dist/cjs/vega-file-uploader.cjs.entry.js +13 -13
- package/dist/cjs/vega-flag-icon.cjs.entry.js +15 -14
- package/dist/cjs/vega-flex.cjs.entry.js +16 -15
- package/dist/cjs/vega-font.cjs.entry.js +15 -14
- package/dist/cjs/vega-form.cjs.entry.js +15 -15
- package/dist/cjs/vega-grid.cjs.entry.js +15 -14
- package/dist/cjs/vega-hint.cjs.entry.js +2 -2
- package/dist/cjs/vega-icon.cjs.entry.js +19 -15
- package/dist/cjs/vega-image-uploader.cjs.entry.js +22 -19
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +13 -13
- package/dist/cjs/vega-input-numeric.cjs.entry.js +16 -16
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +18 -17
- package/dist/cjs/vega-input-range.cjs.entry.js +16 -16
- package/dist/cjs/vega-input-select.cjs.entry.js +25 -24
- package/dist/cjs/vega-input.cjs.entry.js +35 -17
- package/dist/cjs/{vega-internal-event-id-bfea9b93.js → vega-internal-event-id-6cdc95fe.js} +4 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +7 -7
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +26 -20
- package/dist/cjs/vega-line-chart.cjs.entry.js +4 -4
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +15 -13
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +8 -8
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +8 -8
- package/dist/cjs/vega-pagination.cjs.entry.js +18 -17
- package/dist/cjs/vega-pie-chart.cjs.entry.js +3 -3
- package/dist/cjs/vega-popover_2.cjs.entry.js +19 -18
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +7 -7
- package/dist/cjs/vega-radio_2.cjs.entry.js +16 -16
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +189 -32
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +814 -1181
- package/dist/cjs/vega-section-title.cjs.entry.js +2 -2
- package/dist/cjs/vega-segment-control.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +20 -19
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +23 -18
- package/dist/cjs/vega-signature-capture.cjs.entry.js +21 -19
- package/dist/cjs/{vega-skeleton-loader-controller-db868c98.js → vega-skeleton-loader-controller-ae2ab090.js} +15 -5
- package/dist/cjs/vega-skeleton.cjs.entry.js +2 -2
- package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
- package/dist/cjs/vega-stepper.cjs.entry.js +13 -13
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-table_8.cjs.entry.js +377 -286
- package/dist/cjs/vega-text.cjs.entry.js +5 -3
- package/dist/cjs/vega-textarea.cjs.entry.js +13 -13
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +25 -24
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +12 -12
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +18 -17
- package/dist/cjs/vega.cjs.js +15 -14
- package/dist/cjs/{wait-for-vega-handler-0a0738ac.js → wait-for-vega-handler-4491efc9.js} +3 -1
- package/dist/cjs/{y-axis-input-processor-e371c142.js → y-axis-input-processor-19a07af5.js} +1 -1
- package/dist/collection/collection-manifest.json +7 -1
- package/dist/collection/components/vega-box/slimmers/controllers/vega-box-responsive-style-controller.js +1 -0
- package/dist/collection/components/vega-box/slimmers/controllers/vega-box-state-styles-controller.js +1 -0
- package/dist/collection/components/vega-carousel/vega-carousel.js +3 -0
- package/dist/collection/components/vega-code-block/assets/copy.js +3 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/code-block-range.js +129 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.js +87 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.js +34 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/insert-composition-text-controller.js +100 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.js +86 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.js +50 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.js +57 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +240 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.js +133 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.js +44 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.js +117 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +67 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.js +122 -0
- package/dist/collection/components/vega-code-block/test/code-block-range.test.js +81 -0
- package/dist/collection/components/vega-code-block/types.js +10 -0
- package/dist/collection/components/vega-code-block/vega-code-block.css +160 -0
- package/dist/collection/components/vega-code-block/vega-code-block.js +404 -0
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-month-year-dropdown-renderer.js +5 -0
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +4 -0
- package/dist/collection/components/vega-icon/vega-icon.js +4 -1
- package/dist/collection/components/vega-image-uploader/slimmers/controllers/vega-image-uploader-preview-controller.js +2 -0
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-compact-width-controller.js +1 -0
- package/dist/collection/components/vega-input/vega-input.css +12 -2
- package/dist/collection/components/vega-input/vega-input.js +27 -3
- package/dist/collection/components/vega-input-range/slimmers/renderers/vega-input-range-clear-icon-renderer.js +1 -1
- package/dist/collection/components/vega-input-range/vega-input-range.css +10 -0
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +5 -5
- package/dist/collection/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.js +1 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-backdrop-controller.js +3 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-open-state-controller.js +2 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-nested-modal-controller.js +1 -0
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-backdrop-controller.js +3 -0
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.js +2 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +2 -0
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +7 -0
- package/dist/collection/components/vega-rich-text-editor/assets/rectangle-code.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +77 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-code-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-code-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +98 -0
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +62 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.js +78 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +19 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +7 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +7 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +24 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.js +64 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +56 -52
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +21 -8
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +65 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/code-block.test.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/test/e2e-utils.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.js +61 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +10 -0
- package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-backdrop-controller.js +3 -0
- package/dist/collection/components/vega-sidenav/slimmers/controllers/vega-sidenav-open-status-controller.js +1 -0
- package/dist/collection/components/vega-signature-capture/slimmers/written-mode/controllers/written-mode-svg-controller.js +1 -0
- package/dist/collection/components/vega-table/vega-table-head-cell/slimmers/controllers/vega-table-head-cell-sort-config-controller.js +92 -0
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.js +6 -0
- package/dist/collection/components/vega-text/slimmers/renderers/vega-text-tooltip-renderer.js +2 -0
- package/dist/collection/components/vega-time-picker/slimmers/renderers/vega-time-picker-range-clear-button-renderer.js +1 -1
- package/dist/collection/components/vega-time-picker/vega-time-picker.css +10 -0
- package/dist/collection/global/scripts/before-vega-load.js +3 -0
- package/dist/collection/helpers/chart/graph-context-factory.js +2 -0
- package/dist/collection/helpers/common/wait-for-vega-handler.js +3 -1
- package/dist/collection/helpers/dialog/vega-dialog-controller.js +2 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-button-click-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-checkbox-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-input-select-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-input-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-radio-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-delegated/vega-textarea-change-strategy.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +2 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +2 -0
- package/dist/collection/helpers/event-manager/slimmers/event-emit-slimmer.js +3 -1
- package/dist/collection/helpers/event-manager/test/event-emit-slimmer.test.js +11 -1
- package/dist/collection/helpers/keyboard/keyboard-manager.js +2 -0
- package/dist/collection/helpers/notify/vega-notify-controller.js +6 -1
- package/dist/collection/helpers/skeleton-loader/vega-skeleton-loader-controller.js +3 -0
- package/dist/collection/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.js +47 -0
- package/dist/collection/helpers/slimmers/component-global-style-slimmer.js +3 -0
- package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/default-wrapper.js +1 -0
- package/dist/collection/helpers/slimmers/element-appender/body-positioned-wrapper/position-relative-to-wrapper.js +2 -0
- package/dist/collection/helpers/slimmers/element-appender/element-appender-slimmer.js +2 -0
- package/dist/collection/helpers/slimmers/field-error-ui-controller-strategies/sibling-container-error-label-container-retrieval-strategy.js +1 -0
- package/dist/collection/helpers/slimmers/field-error-ui-controller-strategies/sibling-container-self-retrieval-strategy.js +1 -0
- package/dist/collection/helpers/slimmers/page-resize-observer-slimmer.js +1 -0
- package/dist/collection/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.js +46 -0
- package/dist/collection/helpers/theme/controllers/color-schema-overriding-controller.js +2 -0
- package/dist/collection/helpers/theme/controllers/style-controller.abstract.js +3 -0
- package/dist/collection/helpers/theme/internal-theme-manager.js +3 -0
- package/dist/collection/helpers/translation/locales/en.js +5 -0
- package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +5 -0
- package/dist/collection/helpers/ui/element-appender.js +1 -1
- package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +3 -1
- package/dist/collection/utils/component.js +1 -0
- package/dist/collection/utils/e2e-utils.js +3 -0
- package/dist/collection/utils/effect.js +2 -0
- package/dist/collection/utils/safe-document.js +9 -0
- package/dist/collection/utils/test/safe-document.test.js +13 -0
- package/dist/collection/utils/test-utils.js +1 -0
- package/dist/collection/utils/ui.js +3 -0
- package/dist/esm/{app-globals-1f8c30e9.js → app-globals-d96d623d.js} +11 -8
- package/dist/esm/{child-nodes-event-prevent-slimmer-5d45361e.js → child-nodes-event-prevent-slimmer-2b975cbf.js} +1 -1
- package/dist/esm/{child-nodes-notify-observer-slimmer-ddaad39a.js → child-nodes-notify-observer-slimmer-eeed5986.js} +1 -1
- package/dist/esm/{content-state-dbc9f635.js → code-block-ef2f04ca.js} +195 -970
- package/dist/esm/{component-cae24190.js → component-7d906393.js} +1 -0
- package/dist/esm/{component-global-style-slimmer-000e0c11.js → component-global-style-slimmer-dad40b64.js} +3 -0
- package/dist/esm/content-state-69d29a07.js +1140 -0
- package/dist/esm/{dark-mode-style-controller-2ada8e22.js → dark-mode-style-controller-ea798fc8.js} +8 -0
- package/dist/esm/{design-token-0699f0ca.js → design-token-2060cd0d.js} +1 -1
- package/dist/esm/{dom-node-subject-factory-f77cf9cc.js → dom-node-subject-factory-6374611f.js} +2 -2
- package/dist/esm/{dom-node-subject-observer-factory-715dccf9.js → dom-node-subject-observer-factory-c345ca2e.js} +1 -1
- package/dist/esm/{effect-8efd2c3c.js → effect-f50e072d.js} +2 -8
- package/dist/esm/{element-appender-slimmer-96cb54e2.js → element-appender-slimmer-64a77b7f.js} +13 -8
- package/dist/esm/{event-emit-slimmer-b7d511f6.js → event-emit-slimmer-7428cc01.js} +15 -4
- package/dist/esm/{form-field-controller-slimmer-89a72ee7.js → form-field-controller-slimmer-87d80e46.js} +9 -7
- package/dist/esm/{image-annotation-action-1aa938ab.js → image-annotation-action-1497f70e.js} +7 -6
- package/dist/esm/{index-187f71d1.js → index-d0a47531.js} +9 -0
- package/dist/esm/{index-4aa167d6.js → index-f5d2fe61.js} +3 -3
- package/dist/esm/index.js +15 -14
- package/dist/esm/{inject-keyboard-manager-f513be4a.js → inject-keyboard-manager-e39c0fd9.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-87dc436c.js → internal-vega-event-manager-d80c53c5.js} +8 -1
- package/dist/esm/{keyboard-manager-262be5ce.js → keyboard-manager-9564ad83.js} +3 -1
- package/dist/esm/{keyboard-manager-slimmer-42bf9773.js → keyboard-manager-slimmer-2218e6ba.js} +1 -1
- package/dist/esm/{legend-input-processor-8f76ce8a.js → legend-input-processor-1d266967.js} +2 -0
- package/dist/esm/loader.js +15 -14
- package/dist/esm/{page-resize-observer-slimmer-15a84d26.js → page-resize-observer-slimmer-c51f1912.js} +1 -0
- package/dist/esm/{public-rules-5cf6aa95.js → public-rules-3436034b.js} +8 -7
- package/dist/esm/{responsive-format-facade-42f3fcfa.js → responsive-format-facade-8c0ce819.js} +6 -6
- package/dist/esm/{rich-text-editor-required-rule-6a7cd3ee.js → rich-text-editor-required-rule-cc5b6a2d.js} +1 -1
- package/dist/esm/selection-controller-3d6dfc87.js +757 -0
- package/dist/esm/{string-input-formatter-slimmer-c61f82d6.js → string-input-formatter-slimmer-e53b6412.js} +3 -3
- package/dist/esm/{style-formatter-cb00c709.js → style-formatter-1eca1299.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-4e3cf09d.js → sub-state-notify-slimmer-b6c8051c.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-be7a6ce3.js → sub-state-observer-slimmer-93eeb87d.js} +3 -3
- package/dist/esm/{translation-cf7f020a.js → translation-71e0711d.js} +5 -0
- package/dist/esm/{translation-slimmer-88966d5c.js → translation-slimmer-e6b130bf.js} +1 -1
- package/dist/esm/{ui-ed1283bb.js → ui-7d177fb0.js} +2 -0
- package/dist/esm/vega-accordion.entry.js +17 -16
- package/dist/esm/vega-app-footer.entry.js +3 -3
- package/dist/esm/vega-app-header-button.entry.js +18 -17
- package/dist/esm/vega-backdrop.entry.js +3 -3
- package/dist/esm/vega-banner.entry.js +7 -7
- package/dist/esm/vega-bar-chart.entry.js +3 -3
- package/dist/esm/vega-box.entry.js +18 -15
- package/dist/esm/vega-brand-logo.entry.js +3 -3
- package/dist/esm/vega-breadcrumb.entry.js +8 -8
- package/dist/esm/vega-button-circle.entry.js +18 -17
- package/dist/esm/vega-button-group_2.entry.js +11 -11
- package/dist/esm/vega-button-link.entry.js +8 -8
- package/dist/esm/vega-button.entry.js +17 -16
- package/dist/esm/vega-calendar_3.entry.js +14 -14
- package/dist/esm/vega-card.entry.js +15 -14
- package/dist/esm/vega-carousel.entry.js +20 -16
- package/dist/esm/vega-checkbox_2.entry.js +14 -14
- package/dist/esm/vega-chip.entry.js +18 -17
- package/dist/esm/vega-code-block.entry.js +4156 -0
- package/dist/esm/vega-color-picker.entry.js +12 -12
- package/dist/esm/vega-combo-box.entry.js +15 -15
- package/dist/esm/vega-counter-badge.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +34 -24
- package/dist/esm/vega-dialog_2.entry.js +25 -18
- package/dist/esm/vega-divider.entry.js +15 -14
- package/dist/esm/vega-dropdown_5.entry.js +25 -24
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +2 -2
- package/dist/esm/vega-field-label.entry.js +7 -7
- package/dist/esm/vega-file-uploader.entry.js +13 -13
- package/dist/esm/vega-flag-icon.entry.js +15 -14
- package/dist/esm/vega-flex.entry.js +16 -15
- package/dist/esm/vega-font.entry.js +15 -14
- package/dist/esm/vega-form.entry.js +15 -15
- package/dist/esm/vega-grid.entry.js +15 -14
- package/dist/esm/vega-hint.entry.js +2 -2
- package/dist/esm/vega-icon.entry.js +19 -15
- package/dist/esm/vega-image-uploader.entry.js +22 -19
- package/dist/esm/vega-input-credit-card.entry.js +13 -13
- package/dist/esm/vega-input-numeric.entry.js +16 -16
- package/dist/esm/vega-input-phone-number.entry.js +18 -17
- package/dist/esm/vega-input-range.entry.js +16 -16
- package/dist/esm/vega-input-select.entry.js +25 -24
- package/dist/esm/vega-input.entry.js +35 -17
- package/dist/esm/{vega-internal-event-id-85ad403f.js → vega-internal-event-id-178b2743.js} +3 -1
- package/dist/esm/vega-item-toggle.entry.js +7 -7
- package/dist/esm/vega-left-nav_5.entry.js +26 -20
- package/dist/esm/vega-line-chart.entry.js +4 -4
- package/dist/esm/vega-loader-wrapper_2.entry.js +15 -13
- package/dist/esm/vega-page-notification_2.entry.js +5 -5
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +8 -8
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +8 -8
- package/dist/esm/vega-pagination.entry.js +18 -17
- package/dist/esm/vega-pie-chart.entry.js +3 -3
- package/dist/esm/vega-popover_2.entry.js +19 -18
- package/dist/esm/vega-progress-tracker.entry.js +7 -7
- package/dist/esm/vega-radio_2.entry.js +16 -16
- package/dist/esm/vega-rich-text-content.entry.js +170 -13
- package/dist/esm/vega-rich-text-editor_4.entry.js +679 -1046
- package/dist/esm/vega-section-title.entry.js +2 -2
- package/dist/esm/vega-segment-control.entry.js +8 -8
- package/dist/esm/vega-selection-chip_2.entry.js +20 -19
- package/dist/esm/vega-selection-tile_2.entry.js +15 -15
- package/dist/esm/vega-sidenav_3.entry.js +23 -18
- package/dist/esm/vega-signature-capture.entry.js +21 -19
- package/dist/esm/{vega-skeleton-loader-controller-c2a8bd27.js → vega-skeleton-loader-controller-06f48dd2.js} +15 -5
- package/dist/esm/vega-skeleton.entry.js +2 -2
- package/dist/esm/vega-slot-container.entry.js +1 -1
- package/dist/esm/vega-stepper.entry.js +13 -13
- package/dist/esm/vega-tab-group_2.entry.js +9 -9
- package/dist/esm/vega-table_8.entry.js +377 -286
- package/dist/esm/vega-text.entry.js +5 -3
- package/dist/esm/vega-textarea.entry.js +13 -13
- package/dist/esm/vega-time-picker_2.entry.js +25 -24
- package/dist/esm/vega-toggle-switch.entry.js +12 -12
- package/dist/esm/vega-tooltip_2.entry.js +18 -17
- package/dist/esm/vega.js +15 -14
- package/dist/esm/{wait-for-vega-handler-b18eb955.js → wait-for-vega-handler-e0a928cd.js} +3 -1
- package/dist/esm/{y-axis-input-processor-e090b01c.js → y-axis-input-processor-95995d34.js} +1 -1
- package/dist/types/components/vega-code-block/assets/copy.d.ts +3 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/code-block-range.d.ts +64 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.d.ts +47 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.d.ts +19 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/insert-composition-text-controller.d.ts +50 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.d.ts +43 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.d.ts +23 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.d.ts +21 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.d.ts +92 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.d.ts +63 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.d.ts +21 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.d.ts +55 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.d.ts +23 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.d.ts +50 -0
- package/dist/types/components/vega-code-block/test/code-block-range.test.d.ts +1 -0
- package/dist/types/components/vega-code-block/types.d.ts +19 -0
- package/dist/types/components/vega-code-block/vega-code-block.d.ts +118 -0
- package/dist/types/components/vega-input/types.d.ts +2 -0
- package/dist/types/components/vega-input/vega-input.d.ts +9 -2
- package/dist/types/components/vega-rich-text-editor/assets/rectangle-code.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +4 -5
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/remove-code-block-action.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +52 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +41 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +39 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +16 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +16 -23
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +6 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/code-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +4 -0
- package/dist/types/components/vega-table/interface.d.ts +3 -0
- package/dist/types/components/vega-table/vega-table-head-cell/slimmers/controllers/vega-table-head-cell-sort-config-controller.d.ts +42 -0
- package/dist/types/components/vega-table/vega-table-head-cell/vega-table-head-cell.d.ts +2 -0
- package/dist/types/components.d.ts +98 -3
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +2 -0
- package/dist/types/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.d.ts +20 -0
- package/dist/types/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.d.ts +1 -0
- package/dist/types/helpers/translation/interface.d.ts +6 -1
- package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +26 -0
- package/dist/types/types/components.type.d.ts +2 -1
- package/dist/types/utils/safe-document.d.ts +7 -0
- package/dist/types/utils/test/safe-document.test.d.ts +1 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-a46bc9f1.entry.js → p-06cd4a19.entry.js} +1 -1
- package/dist/vega/p-06fb002a.js +1 -0
- package/dist/vega/{p-b351ace3.entry.js → p-07cdaf74.entry.js} +1 -1
- package/dist/vega/{p-b847a143.entry.js → p-07e40eea.entry.js} +1 -1
- package/dist/vega/{p-913eb7f9.entry.js → p-0ce88865.entry.js} +1 -1
- package/dist/vega/{p-ec1f2d21.entry.js → p-1071f790.entry.js} +1 -1
- package/dist/vega/{p-45e28b9b.js → p-111d41fe.js} +1 -1
- package/dist/vega/p-12929d20.entry.js +1 -0
- package/dist/vega/{p-72ecfd40.js → p-138fcf6e.js} +1 -1
- package/dist/vega/{p-a01f149d.entry.js → p-151dec6a.entry.js} +1 -1
- package/dist/vega/{p-06adb37e.entry.js → p-1b81fc7a.entry.js} +1 -1
- package/dist/vega/{p-56a0b13d.js → p-1df029c2.js} +1 -1
- package/dist/vega/p-21d26bb4.js +2 -0
- package/dist/vega/p-21d4f12e.entry.js +1 -0
- package/dist/vega/{p-4a32a6c0.entry.js → p-21d5656d.entry.js} +1 -1
- package/dist/vega/{p-a7dcb2a3.js → p-21e180f2.js} +1 -1
- package/dist/vega/{p-0079088b.entry.js → p-2329cb73.entry.js} +1 -1
- package/dist/vega/{p-8c388b58.entry.js → p-29fe94b6.entry.js} +1 -1
- package/dist/vega/p-2f5d9aab.js +1 -0
- package/dist/vega/p-30c363d8.entry.js +9 -0
- package/dist/vega/{p-5e34ea25.entry.js → p-32a24ef1.entry.js} +1 -1
- package/dist/vega/p-33bd7e31.js +1 -0
- package/dist/vega/{p-46714da3.entry.js → p-36827489.entry.js} +1 -1
- package/dist/vega/{p-81fbfb6d.entry.js → p-388abe56.entry.js} +1 -1
- package/dist/vega/p-3b34389d.js +1 -0
- package/dist/vega/p-3eb2d433.js +1 -0
- package/dist/vega/{p-2da83c2a.js → p-3fa7d356.js} +1 -1
- package/dist/vega/p-425ba7d6.js +1 -0
- package/dist/vega/p-447a2b18.entry.js +1 -0
- package/dist/vega/{p-8d283666.js → p-4ab3df00.js} +1 -1
- package/dist/vega/{p-b649e86e.entry.js → p-4bca12ee.entry.js} +1 -1
- package/dist/vega/{p-b2bca332.entry.js → p-5016b57e.entry.js} +1 -1
- package/dist/vega/p-52905c68.entry.js +1 -0
- package/dist/vega/p-52bdeea0.entry.js +1 -0
- package/dist/vega/p-53803447.entry.js +1 -0
- package/dist/vega/{p-54f17c2e.entry.js → p-53815555.entry.js} +1 -1
- package/dist/vega/{p-d7937711.js → p-55563f5f.js} +1 -1
- package/dist/vega/{p-48517a5d.entry.js → p-578ac47f.entry.js} +1 -1
- package/dist/vega/p-586139ce.entry.js +1 -0
- package/dist/vega/p-597732e9.entry.js +1 -0
- package/dist/vega/{p-0969877b.entry.js → p-5c9efff8.entry.js} +1 -1
- package/dist/vega/{p-5e3a15a1.js → p-5e530257.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-60164904.entry.js +1 -0
- package/dist/vega/p-613ee009.js +1 -0
- package/dist/vega/p-61b72038.entry.js +1 -0
- package/dist/vega/p-642da014.entry.js +1 -0
- package/dist/vega/{p-9803042f.entry.js → p-647734d1.entry.js} +1 -1
- package/dist/vega/{p-cd205d96.js → p-65cca90f.js} +1 -1
- package/dist/vega/{p-6586e2a2.entry.js → p-66145767.entry.js} +1 -1
- package/dist/vega/p-6681efd5.js +1 -0
- package/dist/vega/{p-45f696b4.js → p-6b7dca3e.js} +1 -1
- package/dist/vega/{p-5160a6b9.entry.js → p-6ceb2d26.entry.js} +1 -1
- package/dist/vega/{p-6f81fe1e.js → p-6e01f0a2.js} +1 -1
- package/dist/vega/p-6f3dd430.entry.js +1 -0
- package/dist/vega/p-71d897e5.entry.js +1 -0
- package/dist/vega/{p-8ba43640.entry.js → p-72a4edf2.entry.js} +1 -1
- package/dist/vega/{p-bcb10ae3.entry.js → p-7503fe08.entry.js} +1 -1
- package/dist/vega/p-7add21f8.entry.js +1 -0
- package/dist/vega/{p-bfb344e1.entry.js → p-7df1ad72.entry.js} +1 -1
- package/dist/vega/{p-aea89be5.entry.js → p-7e70938a.entry.js} +1 -1
- package/dist/vega/{p-5064a804.js → p-864de9a1.js} +1 -1
- package/dist/vega/{p-10a40dfb.entry.js → p-86713a15.entry.js} +1 -1
- package/dist/vega/p-8a0d7805.entry.js +1 -0
- package/dist/vega/{p-89ab72e3.js → p-8bdc9e75.js} +1 -1
- package/dist/vega/{p-6cabdb36.js → p-8e31e7ea.js} +1 -1
- package/dist/vega/p-901b20d6.entry.js +1 -0
- package/dist/vega/p-90954fe4.entry.js +1 -0
- package/dist/vega/{p-6d7d923b.js → p-9c0cda62.js} +1 -1
- package/dist/vega/p-9d3292b7.entry.js +1 -0
- package/dist/vega/p-9eab97ee.entry.js +1 -0
- package/dist/vega/p-a0bd5bd7.entry.js +1 -0
- package/dist/vega/{p-54add0d2.js → p-a0dab2d0.js} +1 -1
- package/dist/vega/{p-83ef9e7d.entry.js → p-a1fbf49b.entry.js} +1 -1
- package/dist/vega/{p-d0007822.entry.js → p-aab6f547.entry.js} +1 -1
- package/dist/vega/p-b264d92e.entry.js +1 -0
- package/dist/vega/p-b51fa6ac.entry.js +1 -0
- package/dist/vega/p-b7594b78.entry.js +1 -0
- package/dist/vega/{p-6a830bc5.entry.js → p-c192c2d2.entry.js} +1 -1
- package/dist/vega/p-c4447540.entry.js +1 -0
- package/dist/vega/p-c8023434.entry.js +1 -0
- package/dist/vega/p-c91190df.entry.js +1 -0
- package/dist/vega/{p-647025dd.entry.js → p-cada532e.entry.js} +1 -1
- package/dist/vega/p-d0f0a908.entry.js +1 -0
- package/dist/vega/{p-02d7d948.entry.js → p-d53b262c.entry.js} +1 -1
- package/dist/vega/p-d64b20c2.js +1 -0
- package/dist/vega/{p-a5c39ba2.entry.js → p-d9cb6ec4.entry.js} +1 -1
- package/dist/vega/p-e16e23b7.entry.js +1 -0
- package/dist/vega/{p-1971d980.entry.js → p-e37ac14f.entry.js} +1 -1
- package/dist/vega/p-e5f1fd0b.entry.js +1 -0
- package/dist/vega/p-e7b00bf0.js +1 -0
- package/dist/vega/{p-147e3cbd.entry.js → p-e81b672b.entry.js} +1 -1
- package/dist/vega/{p-cfda64fd.entry.js → p-e860318d.entry.js} +1 -1
- package/dist/vega/p-ea723616.entry.js +1 -0
- package/dist/vega/{p-8ade44bf.js → p-eb832119.js} +1 -1
- package/dist/vega/{p-27003a81.entry.js → p-ec7d98f0.entry.js} +1 -1
- package/dist/vega/{p-a821bcf3.js → p-eea36d3c.js} +1 -1
- package/dist/vega/{p-252e42c7.entry.js → p-f0f787a2.entry.js} +1 -1
- package/dist/vega/p-f2f31686.entry.js +1 -0
- package/dist/vega/{p-27e56c67.entry.js → p-f41ae5e0.entry.js} +1 -1
- package/dist/vega/p-f4a13f3f.js +1 -0
- package/dist/vega/p-f9a9fca6.entry.js +1 -0
- package/dist/vega/{p-2fadef27.entry.js → p-fac5990f.entry.js} +1 -1
- package/dist/vega/p-fd0b2509.entry.js +1 -0
- package/dist/vega/p-fecb4044.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +3 -2
- package/dist/vega/p-06c5fe97.entry.js +0 -1
- package/dist/vega/p-0ed7a098.entry.js +0 -1
- package/dist/vega/p-0f6b3a89.entry.js +0 -1
- package/dist/vega/p-136f665b.entry.js +0 -1
- package/dist/vega/p-1503f791.js +0 -1
- package/dist/vega/p-16fd7c32.js +0 -1
- package/dist/vega/p-1a263af1.entry.js +0 -1
- package/dist/vega/p-1af4771a.entry.js +0 -1
- package/dist/vega/p-1c298d5a.js +0 -2
- package/dist/vega/p-1c63afd2.entry.js +0 -1
- package/dist/vega/p-1e05b7b4.entry.js +0 -1
- package/dist/vega/p-1ea863a6.entry.js +0 -1
- package/dist/vega/p-271b30b9.entry.js +0 -1
- package/dist/vega/p-2d1d4f33.entry.js +0 -1
- package/dist/vega/p-353b3ded.entry.js +0 -1
- package/dist/vega/p-44b0a005.js +0 -1
- package/dist/vega/p-47ff95ba.entry.js +0 -1
- package/dist/vega/p-4e76904e.entry.js +0 -1
- package/dist/vega/p-4ec0d36f.entry.js +0 -1
- package/dist/vega/p-5c954088.entry.js +0 -1
- package/dist/vega/p-61eb7f32.entry.js +0 -1
- package/dist/vega/p-646a9198.entry.js +0 -1
- package/dist/vega/p-6e898779.js +0 -1
- package/dist/vega/p-7088ead9.entry.js +0 -1
- package/dist/vega/p-77492977.entry.js +0 -1
- package/dist/vega/p-804f71b3.js +0 -1
- package/dist/vega/p-8789d34d.entry.js +0 -1
- package/dist/vega/p-8813c0ac.entry.js +0 -1
- package/dist/vega/p-8a85c7af.entry.js +0 -1
- package/dist/vega/p-98c64d77.entry.js +0 -1
- package/dist/vega/p-9f3539a4.entry.js +0 -1
- package/dist/vega/p-b42aea55.entry.js +0 -1
- package/dist/vega/p-b5d70ee0.entry.js +0 -1
- package/dist/vega/p-bc2dd43d.js +0 -1
- package/dist/vega/p-bf1894ec.js +0 -1
- package/dist/vega/p-c754b32c.js +0 -1
- package/dist/vega/p-c9a4e79a.entry.js +0 -1
- package/dist/vega/p-dbc82247.js +0 -1
- package/dist/vega/p-e2e36d2b.entry.js +0 -1
- package/dist/vega/p-ef8272b5.entry.js +0 -1
- package/dist/vega/p-f4c1d961.js +0 -1
- package/dist/vega/p-f5279deb.entry.js +0 -1
- package/dist/vega/p-f8033cd3.entry.js +0 -1
- package/dist/vega/p-fe63bd50.entry.js +0 -1
- /package/dist/vega/{p-eda5b7fd.js → p-05b10af4.js} +0 -0
- /package/dist/vega/{p-50677c8e.js → p-0c8bd757.js} +0 -0
- /package/dist/vega/{p-af7a3154.js → p-13effc6b.js} +0 -0
- /package/dist/vega/{p-ecfa7534.js → p-272440e8.js} +0 -0
- /package/dist/vega/{p-9b797118.js → p-519a7d55.js} +0 -0
- /package/dist/vega/{p-c0291e2e.js → p-834434d5.js} +0 -0
- /package/dist/vega/{p-bf953152.js → p-d5776087.js} +0 -0
- /package/dist/vega/{p-0fd6c35b.js → p-fa5eb496.js} +0 -0
|
@@ -0,0 +1,1146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const codeBlock = require('./code-block-2d014e17.js');
|
|
4
|
+
const typeGuard = require('./type-guard-4ba85fdc.js');
|
|
5
|
+
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-a3d17afb.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The image block delete the image node strategy.
|
|
9
|
+
*/
|
|
10
|
+
class BlockDeleteImageStrategy extends codeBlock.BlockDeleteNodeContentStrategy {
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
handleAction(action, target) {
|
|
15
|
+
this.deleteNodeContent(action, target);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Deletes content from a block node based on specific conditions.
|
|
19
|
+
*
|
|
20
|
+
* @param {DeleteBlockContentAction} action - Delete block content action
|
|
21
|
+
* @param {RTEImageBlock} target - The image block.
|
|
22
|
+
*/
|
|
23
|
+
deleteNodeContent(action, target) {
|
|
24
|
+
const startContainerNode = action
|
|
25
|
+
.startContainerNode, startOffset = action.startOffset;
|
|
26
|
+
let previousNode = this.getPreviousNode(startContainerNode);
|
|
27
|
+
let nextNode = null;
|
|
28
|
+
if (startOffset === 1) {
|
|
29
|
+
const parentBlock = target;
|
|
30
|
+
if (this.isContentFirstNode(startContainerNode)) {
|
|
31
|
+
nextNode = this.getNextNode(startContainerNode);
|
|
32
|
+
}
|
|
33
|
+
if (parentBlock.nodes.length === 1) {
|
|
34
|
+
parentBlock.parent.apply(new codeBlock.RemoveChildAction(parentBlock));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
parentBlock.apply(new codeBlock.RemoveChildAction(startContainerNode));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const shouldRemoveNode = previousNode;
|
|
42
|
+
if (shouldRemoveNode && shouldRemoveNode instanceof codeBlock.RTEImageNode) {
|
|
43
|
+
previousNode = this.getPreviousNode(shouldRemoveNode);
|
|
44
|
+
shouldRemoveNode.parentBlock.apply(new codeBlock.RemoveChildAction(shouldRemoveNode));
|
|
45
|
+
if (!previousNode) {
|
|
46
|
+
action.nextNode = startContainerNode;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (previousNode) {
|
|
51
|
+
action.previousNode = previousNode;
|
|
52
|
+
}
|
|
53
|
+
else if (nextNode) {
|
|
54
|
+
action.nextNode = nextNode;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Split the current image block with a special position strategy.
|
|
61
|
+
*/
|
|
62
|
+
class BlockSplitWithImageNodeStrategy extends codeBlock.ActionHandleStrategy {
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
handleAction(action, target) {
|
|
67
|
+
action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The image offset should be 0 or 1
|
|
71
|
+
* <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
|
|
72
|
+
*
|
|
73
|
+
* @param {RTEImageNode} imageNode The split point image node.
|
|
74
|
+
* @param {number} imageOffset The cursor point 0 | 1.
|
|
75
|
+
* @param {RTEImageBlock} target The image block.
|
|
76
|
+
* @returns {Nullable<RTEBlock>} The new block after split
|
|
77
|
+
*/
|
|
78
|
+
splitImageNodes(imageNode, imageOffset, target) {
|
|
79
|
+
const nodesSplitIndex = target.nodes.indexOf(imageNode);
|
|
80
|
+
if (nodesSplitIndex > -1) {
|
|
81
|
+
const beforeNodes = target.nodes.slice(0, nodesSplitIndex + imageOffset);
|
|
82
|
+
const afterNodes = target.nodes.slice(nodesSplitIndex + imageOffset);
|
|
83
|
+
target.apply(new codeBlock.ReplaceChildNodesAction(beforeNodes));
|
|
84
|
+
const newBlock = this.cloneWithNodes(afterNodes, target);
|
|
85
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, newBlock));
|
|
86
|
+
return newBlock;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
|
|
91
|
+
*
|
|
92
|
+
* @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
|
|
93
|
+
* @param {RTEImageBlock} target The image block.
|
|
94
|
+
* @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
|
|
95
|
+
*/
|
|
96
|
+
cloneWithNodes(nodes, target) {
|
|
97
|
+
const block = target.createNewImageBlock();
|
|
98
|
+
block.nodes = [];
|
|
99
|
+
block.apply(new codeBlock.AppendChildNodesAction(nodes));
|
|
100
|
+
return block;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Insert a new paragraph at the image block special position strategy.
|
|
106
|
+
*/
|
|
107
|
+
class ImageInsertNewParagraphStrategy extends codeBlock.ActionHandleStrategy {
|
|
108
|
+
/**
|
|
109
|
+
* @inheritDoc
|
|
110
|
+
*/
|
|
111
|
+
handleAction(action, target) {
|
|
112
|
+
action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset, target);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Used to split a block of text at a specific position and insert a new paragraph block.
|
|
116
|
+
*
|
|
117
|
+
* @param {RTEImageNode} splitNode - The node that needs to be split into separate blocks.
|
|
118
|
+
* @param {number} startOffsetOfNode - The index or position within the `splitNode` where the block should be broken or split.
|
|
119
|
+
* @param {RTEImageBlock} target - The image block.
|
|
120
|
+
* @returns {Nullable<RTEBlock>} Returns either a new paragraph block or the new block created after splitting the original block.
|
|
121
|
+
*/
|
|
122
|
+
breakSingleBlock(splitNode, startOffsetOfNode, target) {
|
|
123
|
+
const newParagraph = codeBlock.RTETextBlock.from({
|
|
124
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
125
|
+
type: 'paragraph',
|
|
126
|
+
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '' }],
|
|
127
|
+
});
|
|
128
|
+
if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
129
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, newParagraph));
|
|
130
|
+
}
|
|
131
|
+
else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
132
|
+
target.parent.apply(new codeBlock.InsertBlocksBeforeAction(target, newParagraph));
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
const splitBlockAction = new codeBlock.SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
136
|
+
target.apply(splitBlockAction);
|
|
137
|
+
return splitBlockAction.newBlock;
|
|
138
|
+
}
|
|
139
|
+
return newParagraph;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Break the current block after press enter, this action is similar with the SplitBlockWithNodeAction,
|
|
145
|
+
* The SplitBlockWithNodeAction split the current block to two same type blocks, but this action will create new paragraph or list item when break at start or end.
|
|
146
|
+
* The property `newBlock` use to store the new create block if need.
|
|
147
|
+
*
|
|
148
|
+
* @example currentBlock.apply(new BreakSingleBlockAction(startContainerNode, startOffset))
|
|
149
|
+
*/
|
|
150
|
+
class BreakSingleBlockAction extends codeBlock.ModifyContentAction {
|
|
151
|
+
constructor(startContainerNode, startOffset) {
|
|
152
|
+
super();
|
|
153
|
+
this.type = codeBlock.ModifyContentActionType.BREAK_SINGLE_BLOCK;
|
|
154
|
+
this.startContainerNode = startContainerNode;
|
|
155
|
+
this.startOffset = startOffset;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The image block insert line break strategy.
|
|
161
|
+
*/
|
|
162
|
+
class ImageInsertLineBreakStrategy extends codeBlock.ActionHandleStrategy {
|
|
163
|
+
/**
|
|
164
|
+
* The image block not support insert the line break node, so invoke the insert new paragraph logic directly.
|
|
165
|
+
*
|
|
166
|
+
* @param {LineBreakSingleBlockAction} action - The action instance.
|
|
167
|
+
* @param {RTEImageBlock} target - The image block.
|
|
168
|
+
*/
|
|
169
|
+
handleAction(action, target) {
|
|
170
|
+
const insertNewParagraphAction = new BreakSingleBlockAction(action.startContainerNode, action.startOffset);
|
|
171
|
+
target.apply(insertNewParagraphAction);
|
|
172
|
+
const newBlock = insertNewParagraphAction.newBlock;
|
|
173
|
+
if (newBlock) {
|
|
174
|
+
action.lineBreakNode = newBlock.nodes[0];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Insert a line break node into multiple blocks selection at special position strategy.
|
|
181
|
+
*/
|
|
182
|
+
class ImageInsertLineBreakWithBlocksStrategy extends codeBlock.ActionHandleStrategy {
|
|
183
|
+
/**
|
|
184
|
+
* @inheritDoc
|
|
185
|
+
*/
|
|
186
|
+
handleAction(action, target) {
|
|
187
|
+
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks, target);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
|
|
191
|
+
*
|
|
192
|
+
* @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.
|
|
193
|
+
* @param {RTEImageBlock} target - The image block.
|
|
194
|
+
* @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
|
|
195
|
+
*/
|
|
196
|
+
lineBreakMultipleBlocks(selectedBlocks, target) {
|
|
197
|
+
const newParagraph = codeBlock.RTETextBlock.from({
|
|
198
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
199
|
+
type: 'paragraph',
|
|
200
|
+
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '\n' }],
|
|
201
|
+
});
|
|
202
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, newParagraph));
|
|
203
|
+
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
204
|
+
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
205
|
+
afterNodes.push(new codeBlock.RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', newParagraph));
|
|
206
|
+
}
|
|
207
|
+
newParagraph.apply(new codeBlock.AppendChildNodesAction(afterNodes));
|
|
208
|
+
return newParagraph['nodes'][0];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Concat the child nodes of multiple RTEBlocks if both are not images.
|
|
212
|
+
*
|
|
213
|
+
* @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
214
|
+
* @returns {RTENode[]} Array of connected block nodes
|
|
215
|
+
*/
|
|
216
|
+
concatBlocksNodes(blocks) {
|
|
217
|
+
const nodes = [];
|
|
218
|
+
blocks.map((block) => {
|
|
219
|
+
if (block.type !== 'image') {
|
|
220
|
+
nodes.push(...block['nodes']);
|
|
221
|
+
block.parent.apply(new codeBlock.RemoveChildAction(block));
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return nodes;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Insert a image node at the special position of image block.
|
|
230
|
+
*/
|
|
231
|
+
class ImageBlockInsertImageStrategy extends codeBlock.ActionHandleStrategy {
|
|
232
|
+
/**
|
|
233
|
+
* @inheritDoc
|
|
234
|
+
*/
|
|
235
|
+
handleAction(action, target) {
|
|
236
|
+
const splitNode = action.splitPointNode;
|
|
237
|
+
const startOffsetOfNode = action.startOffsetOfNode;
|
|
238
|
+
const newImageBlock = action.imageBlockToBeInserted;
|
|
239
|
+
const newImageNodes = newImageBlock.nodes;
|
|
240
|
+
if (target.nodes.length < 1) {
|
|
241
|
+
target.apply(new codeBlock.AppendChildNodesAction(newImageNodes));
|
|
242
|
+
}
|
|
243
|
+
else if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
244
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, newImageBlock));
|
|
245
|
+
}
|
|
246
|
+
else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
247
|
+
target.parent.apply(new codeBlock.InsertBlocksBeforeAction(target, newImageBlock));
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
target.apply(new codeBlock.SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
|
|
251
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, newImageBlock));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Insert some text nodes at the behind of the node strategy.
|
|
258
|
+
*/
|
|
259
|
+
class BlockInsertNodesAfterNodeStrategy extends codeBlock.BlockReplaceNodeWithNodesStrategy {
|
|
260
|
+
/**
|
|
261
|
+
* @inheritDoc
|
|
262
|
+
*/
|
|
263
|
+
handleAction(action, target) {
|
|
264
|
+
const referNode = action.referNode;
|
|
265
|
+
const nodes = [referNode, ...action.nodesToBeInserted];
|
|
266
|
+
this.replaceNodeWithNodes(target, referNode, nodes);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Image block
|
|
272
|
+
*/
|
|
273
|
+
class RTEImageBlock extends codeBlock.RTEBlock {
|
|
274
|
+
constructor(id) {
|
|
275
|
+
super(id);
|
|
276
|
+
this.type = 'image';
|
|
277
|
+
this.nodes = [];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Converts a VegaRTEImageBlock object into an RTEImageBlock object by mapping nodes and creating annotations.
|
|
281
|
+
*
|
|
282
|
+
* @param {VegaRTEImageBlock} block - The block object to be converted.
|
|
283
|
+
* @returns {RTEImageBlock} An instance of `RTEImageBlock`
|
|
284
|
+
*/
|
|
285
|
+
static from(block) {
|
|
286
|
+
const imageBlock = new RTEImageBlock(block.id);
|
|
287
|
+
const { annotations } = block;
|
|
288
|
+
imageBlock.nodes = block.nodes.map((image) => codeBlock.RTEImageNode.from(image, imageBlock));
|
|
289
|
+
if (annotations) {
|
|
290
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
291
|
+
const item = this.createAnnotationEntity(type, value);
|
|
292
|
+
if (typeGuard.isNonNullable(item)) {
|
|
293
|
+
imageBlock.annotationMap.set(...item);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return imageBlock;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* @inheritDoc
|
|
301
|
+
*/
|
|
302
|
+
toJSON() {
|
|
303
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* @inheritDoc
|
|
307
|
+
*/
|
|
308
|
+
isNotEmpty() {
|
|
309
|
+
return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @inheritDoc
|
|
313
|
+
*/
|
|
314
|
+
getLastNode() {
|
|
315
|
+
return this.nodes[this.nodes.length - 1];
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Create a new image block.
|
|
319
|
+
*
|
|
320
|
+
* @returns {RTEImageBlock} - The empty image block.
|
|
321
|
+
*/
|
|
322
|
+
createNewImageBlock() {
|
|
323
|
+
return new RTEImageBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* @inheritDoc
|
|
327
|
+
*/
|
|
328
|
+
clone() {
|
|
329
|
+
const clonedBlock = new RTEImageBlock(this.id);
|
|
330
|
+
clonedBlock.nodes = this.nodes.map((node) => {
|
|
331
|
+
const clonedNode = node.clone();
|
|
332
|
+
clonedNode.parentBlock = clonedBlock;
|
|
333
|
+
return clonedNode;
|
|
334
|
+
});
|
|
335
|
+
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
336
|
+
clonedBlock.parent = this.parent;
|
|
337
|
+
return clonedBlock;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
(() => {
|
|
341
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEImageBlock.name, new BlockDeleteImageStrategy());
|
|
342
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEImageBlock.name, new codeBlock.BlockMergeNodesStrategy());
|
|
343
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_CHILD, RTEImageBlock.name, new codeBlock.BlockRemoveNodeStrategy());
|
|
344
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.APPEND_CHILD_NODES, RTEImageBlock.name, new codeBlock.BlockAppendNodesStrategy());
|
|
345
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new codeBlock.BlockReplaceNodesStrategy());
|
|
346
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
|
|
347
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertNewParagraphStrategy());
|
|
348
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
|
|
349
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
|
|
350
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
|
|
351
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_NODES_BEFORE, RTEImageBlock.name, new codeBlock.BlockInsertNodesBeforeNodeStrategy());
|
|
352
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_NODES_AFTER, RTEImageBlock.name, new BlockInsertNodesAfterNodeStrategy());
|
|
353
|
+
})();
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* The list item block block delete text content strategy.
|
|
357
|
+
*/
|
|
358
|
+
class ListItemDeleteTextContentStrategy extends codeBlock.BlockDeleteTextContentStrategy {
|
|
359
|
+
/**
|
|
360
|
+
* Delete the list item content and delete the parent list after delete the last item.
|
|
361
|
+
*
|
|
362
|
+
* @param {DeleteBlockContentAction} action - The delete block content action instance.
|
|
363
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
364
|
+
*/
|
|
365
|
+
handleAction(action, target) {
|
|
366
|
+
const listBlock = target.parent;
|
|
367
|
+
this.deleteNodeContent(action, target);
|
|
368
|
+
if (listBlock.blocks.length === 0) {
|
|
369
|
+
listBlock.parent.apply(new codeBlock.RemoveChildAction(listBlock));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Remove list item child node strategy.
|
|
376
|
+
*/
|
|
377
|
+
class ListItemRemoveNodeStrategy extends codeBlock.ActionHandleStrategy {
|
|
378
|
+
/**
|
|
379
|
+
* Remove child node from the list item, remove the list item if the list item is empty.
|
|
380
|
+
*
|
|
381
|
+
* @param {RemoveChildAction} action - The remove child action instance.
|
|
382
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
383
|
+
*/
|
|
384
|
+
handleAction(action, target) {
|
|
385
|
+
target.nodes = target.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
386
|
+
if (target.nodes.length === 0 && (!target.children || !target.children.length)) {
|
|
387
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Remove list item nest list block strategy.
|
|
394
|
+
*/
|
|
395
|
+
class ListItemRemoveNestListStrategy extends codeBlock.ActionHandleStrategy {
|
|
396
|
+
/**
|
|
397
|
+
* Remove the nest list block from the list item, clear the property children when the children is empty.
|
|
398
|
+
*
|
|
399
|
+
* @param {RemoveNestListAction} action - The action instance.
|
|
400
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
401
|
+
*/
|
|
402
|
+
handleAction(action, target) {
|
|
403
|
+
if (target.children) {
|
|
404
|
+
if (target.children.length > 1) {
|
|
405
|
+
target.children = target.children.filter((child) => child !== action.nestListBlockToBeRemoved);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
target.children = undefined;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Replace list item nest list strategy.
|
|
416
|
+
*/
|
|
417
|
+
class ListItemReplaceNestListStrategy extends codeBlock.ActionHandleStrategy {
|
|
418
|
+
/**
|
|
419
|
+
* @inheritDoc
|
|
420
|
+
*/
|
|
421
|
+
handleAction(action, target) {
|
|
422
|
+
action.newList.forEach((listBlock) => {
|
|
423
|
+
listBlock.parent = target;
|
|
424
|
+
});
|
|
425
|
+
target.children = action.newList;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Insert new paragraph into current list item block at special position.
|
|
431
|
+
*/
|
|
432
|
+
class ListItemInsertNewParagraphStrategy extends codeBlock.ActionHandleStrategy {
|
|
433
|
+
/**
|
|
434
|
+
* @inheritDoc
|
|
435
|
+
*/
|
|
436
|
+
handleAction(action, target) {
|
|
437
|
+
action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset, target);
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Breaks a single list item block at a specific position.
|
|
441
|
+
*
|
|
442
|
+
* @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
|
|
443
|
+
* @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
|
|
444
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
445
|
+
* @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
|
|
446
|
+
* position is at the end of the `splitNode`, or it returns the result of splitting the block at the
|
|
447
|
+
* caret position if it is neither at the start nor at the end.
|
|
448
|
+
*/
|
|
449
|
+
breakSingleListItemBlock(splitNode, startOffsetOfNode, target) {
|
|
450
|
+
const newListItem = target.createNewListItem();
|
|
451
|
+
const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
|
|
452
|
+
newListItem.apply(new codeBlock.AppendChildNodesAction([newBreakNode]));
|
|
453
|
+
if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
454
|
+
return this.breakListItemAtEnd(newListItem, target);
|
|
455
|
+
}
|
|
456
|
+
else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
457
|
+
target.parent.apply(new codeBlock.InsertBlocksBeforeAction(target, newListItem));
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
const splitBlockAction = new codeBlock.SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
461
|
+
target.apply(splitBlockAction);
|
|
462
|
+
return splitBlockAction.newBlock;
|
|
463
|
+
}
|
|
464
|
+
return newListItem;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
|
|
468
|
+
*
|
|
469
|
+
* @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
|
|
470
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
471
|
+
* @returns {RTEBlock} Returns a `RTEBlock`.
|
|
472
|
+
*/
|
|
473
|
+
breakListItemAtEnd(newListItem, target) {
|
|
474
|
+
const lastItem = target.parent.blocks[target.parent.blocks.length - 1];
|
|
475
|
+
const currentItemIsEmpty = target.nodes.length === 1 && target.nodes[0].isEmpty();
|
|
476
|
+
if (target === lastItem && currentItemIsEmpty) {
|
|
477
|
+
const parentParent = target.parent.parent;
|
|
478
|
+
if (parentParent['type'] !== 'list-item') {
|
|
479
|
+
const newParagraph = codeBlock.RTETextBlock.from({
|
|
480
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
481
|
+
type: 'paragraph',
|
|
482
|
+
nodes: [],
|
|
483
|
+
});
|
|
484
|
+
newParagraph.apply(new codeBlock.AppendChildNodesAction(newListItem.nodes));
|
|
485
|
+
parentParent.apply(new codeBlock.InsertBlocksAfterAction(target.parent, newParagraph));
|
|
486
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
487
|
+
return newParagraph;
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
parentParent.parent.apply(new codeBlock.InsertBlocksAfterAction(parentParent, newListItem));
|
|
491
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, newListItem));
|
|
496
|
+
}
|
|
497
|
+
return newListItem;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Copy the inline style to new node
|
|
501
|
+
*
|
|
502
|
+
* @param {RTETextNode} needCopedNode - The node that needed to be copied to
|
|
503
|
+
* @returns {RTETextNode} Returns a `RTETextNode`.
|
|
504
|
+
*/
|
|
505
|
+
copyInlineStyleToNewNode(needCopedNode) {
|
|
506
|
+
const textNode = needCopedNode.cloneWithText('');
|
|
507
|
+
// The link annotation doesn't need to inherit
|
|
508
|
+
textNode.annotationMap.delete(codeBlock.NodeAnnotationTypeEnum.LINK);
|
|
509
|
+
return textNode;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Insert image node to list item block strategy.
|
|
515
|
+
*/
|
|
516
|
+
class ListItemInsertImageStrategy extends codeBlock.ActionHandleStrategy {
|
|
517
|
+
/**
|
|
518
|
+
* The image node can not insert into list item block, so insert image after parent list block.
|
|
519
|
+
*
|
|
520
|
+
* @param {InsertImageToBlockAction} action - The action instance.
|
|
521
|
+
* @param {RTEListItemBlock} target - The list item block.
|
|
522
|
+
*/
|
|
523
|
+
handleAction(action, target) {
|
|
524
|
+
target.parent.apply(action);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* List item block
|
|
530
|
+
*/
|
|
531
|
+
class RTEListItemBlock extends codeBlock.RTETextBlock {
|
|
532
|
+
constructor(id, children) {
|
|
533
|
+
super(id, 'list-item');
|
|
534
|
+
this.children = [];
|
|
535
|
+
this.children = children;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Converts a VegaRTEListItemBlock object to an RTEListItemBlock
|
|
539
|
+
*
|
|
540
|
+
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
|
|
541
|
+
* @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
|
|
542
|
+
*/
|
|
543
|
+
static from(block) {
|
|
544
|
+
const listItemBlock = new RTEListItemBlock(block.id);
|
|
545
|
+
listItemBlock.nodes = block.nodes.map((richText) => codeBlock.RTETextNode.from(richText, listItemBlock));
|
|
546
|
+
if (block.children) {
|
|
547
|
+
listItemBlock.children = block.children.map((child) => {
|
|
548
|
+
const listBlock = RTEListBlock.from(child);
|
|
549
|
+
listBlock.parent = listItemBlock;
|
|
550
|
+
return listBlock;
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
const { annotations } = block;
|
|
554
|
+
if (annotations) {
|
|
555
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
556
|
+
const item = this.createAnnotationEntity(type, value);
|
|
557
|
+
if (typeGuard.isNonNullable(item)) {
|
|
558
|
+
listItemBlock.annotationMap.set(...item);
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
return listItemBlock;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* @inheritDoc
|
|
566
|
+
*/
|
|
567
|
+
toJSON() {
|
|
568
|
+
var _a;
|
|
569
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* @inheritDoc
|
|
573
|
+
*/
|
|
574
|
+
cloneWithNodes(nodes) {
|
|
575
|
+
const block = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
576
|
+
block.nodes = [];
|
|
577
|
+
block.apply(new codeBlock.AppendChildNodesAction(nodes));
|
|
578
|
+
return block;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* @inheritDoc
|
|
582
|
+
*/
|
|
583
|
+
getLastNode() {
|
|
584
|
+
if (this.children && this.children.length > 0) {
|
|
585
|
+
const childListBlock = this.children[this.children.length - 1];
|
|
586
|
+
return childListBlock.getLastNode();
|
|
587
|
+
}
|
|
588
|
+
return super.getLastNode();
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Create a new list item block.
|
|
592
|
+
*
|
|
593
|
+
* @returns {RTEListItemBlock} - A list item block.
|
|
594
|
+
*/
|
|
595
|
+
createNewListItem() {
|
|
596
|
+
return new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* @inheritDoc
|
|
600
|
+
*/
|
|
601
|
+
clone() {
|
|
602
|
+
var _a;
|
|
603
|
+
const block = new RTEListItemBlock(this.id);
|
|
604
|
+
block.nodes = this.nodes.map((node) => {
|
|
605
|
+
const clonedNode = node.clone();
|
|
606
|
+
clonedNode.parentBlock = block;
|
|
607
|
+
return clonedNode;
|
|
608
|
+
});
|
|
609
|
+
block.annotationMap = super.cloneAnnotations();
|
|
610
|
+
block.children = (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((child) => {
|
|
611
|
+
const clonedChild = child.clone();
|
|
612
|
+
clonedChild.parent = block;
|
|
613
|
+
return clonedChild;
|
|
614
|
+
});
|
|
615
|
+
block.parent = this.parent;
|
|
616
|
+
return block;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
(() => {
|
|
620
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEListItemBlock.name, new ListItemDeleteTextContentStrategy());
|
|
621
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new codeBlock.BlockInsertLineBreakStrategy());
|
|
622
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new codeBlock.BlockInsertLineBreakWithBlocksStrategy());
|
|
623
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_CHILD, RTEListItemBlock.name, new ListItemRemoveNodeStrategy());
|
|
624
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
|
|
625
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.APPEND_CHILD_NODES, RTEListItemBlock.name, new codeBlock.BlockAppendNodesStrategy());
|
|
626
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new codeBlock.BlockSplitWithTextNodeStrategy());
|
|
627
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new codeBlock.BlockReplaceNodesStrategy());
|
|
628
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
|
|
629
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new codeBlock.BlockMergeNodesStrategy());
|
|
630
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new ListItemInsertNewParagraphStrategy());
|
|
631
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
|
|
632
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_NODES_BEFORE, RTEListItemBlock.name, new codeBlock.BlockInsertNodesBeforeNodeStrategy());
|
|
633
|
+
})();
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Insert block array at the front of the block strategy.
|
|
637
|
+
*/
|
|
638
|
+
class BlockInsertBlocksBeforeStrategy extends codeBlock.ActionHandleStrategy {
|
|
639
|
+
/**
|
|
640
|
+
* @inheritDoc
|
|
641
|
+
*/
|
|
642
|
+
handleAction(action, target) {
|
|
643
|
+
this.replaceBlockWithBlocks(target, action.referBlock, [
|
|
644
|
+
...action.blocksToBeInserted,
|
|
645
|
+
action.referBlock,
|
|
646
|
+
]);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Replaces a specific block with an array of blocks within a RTEContentBlock array.
|
|
650
|
+
*
|
|
651
|
+
* @param {RTEListBlock|VegaRTEContent} target - The list block or the VegaRTEContent instance.
|
|
652
|
+
* @param {RTEBlock} referBlock - Used as a reference block to identify the block that needs to be replaced in the `blocks` array.
|
|
653
|
+
* @param {RTEBlock[]} blocks - An array of RTEBlock objects that you want to replace the `referBlock` with in the `blocks` array.
|
|
654
|
+
*/
|
|
655
|
+
replaceBlockWithBlocks(target, referBlock, blocks) {
|
|
656
|
+
if (target.blocks) {
|
|
657
|
+
blocks.forEach((block) => {
|
|
658
|
+
block.parent = target;
|
|
659
|
+
});
|
|
660
|
+
const arrayFixed = target.blocks;
|
|
661
|
+
target.blocks = arrayFixed.flatMap((block) => {
|
|
662
|
+
if (block === referBlock) {
|
|
663
|
+
return blocks;
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
return block;
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Insert block array at the behind of the block strategy.
|
|
675
|
+
*/
|
|
676
|
+
class BlockInsertBlocksAfterStrategy extends BlockInsertBlocksBeforeStrategy {
|
|
677
|
+
/**
|
|
678
|
+
* @inheritDoc
|
|
679
|
+
*/
|
|
680
|
+
handleAction(action, target) {
|
|
681
|
+
this.replaceBlockWithBlocks(target, action.referBlock, [
|
|
682
|
+
action.referBlock,
|
|
683
|
+
...action.blocksToBeInserted,
|
|
684
|
+
]);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Append new block array to list block or VegaRTEContent instance strategy.
|
|
690
|
+
*/
|
|
691
|
+
class BlockAppendBlocksStrategy extends codeBlock.ActionHandleStrategy {
|
|
692
|
+
/**
|
|
693
|
+
* @inheritDoc
|
|
694
|
+
*/
|
|
695
|
+
handleAction(action, target) {
|
|
696
|
+
const newBlocks = action.entityToBeAppended;
|
|
697
|
+
if (target.blocks) {
|
|
698
|
+
newBlocks.forEach((block) => {
|
|
699
|
+
block.parent = target;
|
|
700
|
+
});
|
|
701
|
+
const arrayFixed = target.blocks;
|
|
702
|
+
target.blocks = arrayFixed.concat(newBlocks);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Delete the nest list block action
|
|
709
|
+
*
|
|
710
|
+
* @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
|
|
711
|
+
*/
|
|
712
|
+
class RemoveNestListAction extends codeBlock.ModifyContentAction {
|
|
713
|
+
constructor(childList) {
|
|
714
|
+
super();
|
|
715
|
+
this.type = codeBlock.ModifyContentActionType.DELETE_NEST_LIST;
|
|
716
|
+
this.nestListBlockToBeRemoved = childList;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* List block or VegaRTEContent remove child block strategy.
|
|
722
|
+
*/
|
|
723
|
+
class BlockRemoveChildBlockStrategy extends codeBlock.ActionHandleStrategy {
|
|
724
|
+
/**
|
|
725
|
+
* @inheritDoc
|
|
726
|
+
*/
|
|
727
|
+
handleAction(action, target) {
|
|
728
|
+
const blockToBeRemoved = action.entityToBeRemoved;
|
|
729
|
+
if (target.blocks) {
|
|
730
|
+
target.blocks = target.blocks.filter((block) => block !== blockToBeRemoved);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* List remove list item strategy.
|
|
737
|
+
*/
|
|
738
|
+
class ListRemoveListItemStrategy extends BlockRemoveChildBlockStrategy {
|
|
739
|
+
/**
|
|
740
|
+
* Remove the list item, check the list item and remove self if the list item is empty.
|
|
741
|
+
*
|
|
742
|
+
* @param {RemoveChildAction} action - The remove action instance.
|
|
743
|
+
* @param {RTEListBlock} target - The list block.
|
|
744
|
+
*/
|
|
745
|
+
handleAction(action, target) {
|
|
746
|
+
super.handleAction(action, target);
|
|
747
|
+
const parent = target.parent;
|
|
748
|
+
if (target.blocks.length === 0 && parent) {
|
|
749
|
+
// The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
|
|
750
|
+
if (parent['type'] === 'list-item') {
|
|
751
|
+
parent.apply(new RemoveNestListAction(target));
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
parent.apply(new codeBlock.RemoveChildAction(target));
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* Convert the selected blocks to list strategy.
|
|
762
|
+
*/
|
|
763
|
+
class ListTransformToListStrategy extends codeBlock.ActionHandleStrategy {
|
|
764
|
+
/**
|
|
765
|
+
* @inheritDoc
|
|
766
|
+
*/
|
|
767
|
+
handleAction(action, target) {
|
|
768
|
+
const selectedBlocks = action.selectedBlocks;
|
|
769
|
+
const bulletList = target.parent.createList(action.listType);
|
|
770
|
+
const isSameList = selectedBlocks.every((block) => block.parent === target);
|
|
771
|
+
if (isSameList) {
|
|
772
|
+
// Select one or more list items belonging to the same list, and all items in this list should be updated
|
|
773
|
+
bulletList.apply(new codeBlock.AppendChildNodesAction(target.blocks));
|
|
774
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, bulletList));
|
|
775
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
776
|
+
selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new codeBlock.SyncUpSelectionAction())));
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
|
|
780
|
+
bulletList.apply(new codeBlock.AppendChildNodesAction(listItems));
|
|
781
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, bulletList));
|
|
782
|
+
action.selectedBlocks.forEach((block) => {
|
|
783
|
+
block.parent.apply(new codeBlock.RemoveChildAction(block));
|
|
784
|
+
});
|
|
785
|
+
if (target.blocks.length === 0) {
|
|
786
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Convert the selected list block to paragraph strategy.
|
|
794
|
+
*/
|
|
795
|
+
class ListTransformToParagraphStrategy extends codeBlock.ActionHandleStrategy {
|
|
796
|
+
/**
|
|
797
|
+
* @inheritDoc
|
|
798
|
+
*/
|
|
799
|
+
handleAction(action, target) {
|
|
800
|
+
let isSelectedFirstBlock = false;
|
|
801
|
+
let isSelectedLastBlock = false;
|
|
802
|
+
const selectedBlocks = action.selectedBlocks;
|
|
803
|
+
const currentParagraph = selectedBlocks.map((block) => {
|
|
804
|
+
block.nodes.map((node) => node.apply(new codeBlock.SyncUpSelectionAction()));
|
|
805
|
+
if (block === target.blocks[0])
|
|
806
|
+
isSelectedFirstBlock = true;
|
|
807
|
+
if (block === target.blocks[target.blocks.length - 1])
|
|
808
|
+
isSelectedLastBlock = true;
|
|
809
|
+
return this.toParagraph(block);
|
|
810
|
+
});
|
|
811
|
+
if (isSelectedFirstBlock) {
|
|
812
|
+
target.parent.apply(new codeBlock.InsertBlocksBeforeAction(target, ...currentParagraph));
|
|
813
|
+
}
|
|
814
|
+
else if (isSelectedLastBlock) {
|
|
815
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, ...currentParagraph));
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
const startIndex = target.blocks.indexOf(selectedBlocks[0]);
|
|
819
|
+
const lastIndex = target.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
|
|
820
|
+
const firstBulletList = target.parent.createList(target.type);
|
|
821
|
+
firstBulletList.apply(new codeBlock.AppendChildNodesAction(target.blocks.slice(0, startIndex)));
|
|
822
|
+
const lastBulletList = target.parent.createList(target.type);
|
|
823
|
+
lastBulletList.apply(new codeBlock.AppendChildNodesAction(target.blocks.slice(lastIndex + 1)));
|
|
824
|
+
target.parent.apply(new codeBlock.InsertBlocksBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
|
|
825
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
826
|
+
}
|
|
827
|
+
selectedBlocks.map((block) => {
|
|
828
|
+
target.apply(new codeBlock.RemoveChildAction(block));
|
|
829
|
+
});
|
|
830
|
+
if (target.blocks.length === 0) {
|
|
831
|
+
target.parent.apply(new codeBlock.RemoveChildAction(target));
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
|
|
836
|
+
*
|
|
837
|
+
* @param {RTEListItemBlock} block - The block that will be covered
|
|
838
|
+
* @returns {RTETextBlock} Returns a `RTETextBlock`.
|
|
839
|
+
*/
|
|
840
|
+
toParagraph(block) {
|
|
841
|
+
const textBlock = new codeBlock.RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), 'paragraph');
|
|
842
|
+
textBlock.apply(new codeBlock.AppendChildNodesAction(block['nodes']));
|
|
843
|
+
textBlock['annotationMap'] = block['annotationMap'];
|
|
844
|
+
return textBlock;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Insert image to list block strategy.
|
|
850
|
+
*/
|
|
851
|
+
class ListInsertImageStrategy extends codeBlock.ActionHandleStrategy {
|
|
852
|
+
/**
|
|
853
|
+
* Insert image block at behind of the list item block.
|
|
854
|
+
*
|
|
855
|
+
* @param {InsertImageToBlockAction} action - The insert image action instance.
|
|
856
|
+
* @param {RTEListBlock} target - The list block.
|
|
857
|
+
*/
|
|
858
|
+
handleAction(action, target) {
|
|
859
|
+
const imageBlock = action.imageBlockToBeInserted;
|
|
860
|
+
if (target.parent['type'] !== 'list-item') {
|
|
861
|
+
target.parent.apply(new codeBlock.InsertBlocksAfterAction(target, imageBlock));
|
|
862
|
+
}
|
|
863
|
+
else {
|
|
864
|
+
target.parent.apply(action);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* List block
|
|
871
|
+
*/
|
|
872
|
+
class RTEListBlock extends codeBlock.RTEBlock {
|
|
873
|
+
constructor(id, type) {
|
|
874
|
+
super(id);
|
|
875
|
+
this.type = 'bullet-list';
|
|
876
|
+
this.blocks = [];
|
|
877
|
+
this.type = type;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Converts a VegaRTEListBlock object to an RTEListBlock
|
|
881
|
+
*
|
|
882
|
+
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
|
|
883
|
+
* @returns {RTEListBlock} Return an instance of `RTEListBlock`
|
|
884
|
+
*/
|
|
885
|
+
static from(block) {
|
|
886
|
+
const listBlock = new RTEListBlock(block.id, block.type);
|
|
887
|
+
listBlock.blocks = block.blocks.map((item) => {
|
|
888
|
+
const listItemBlock = RTEListItemBlock.from(item);
|
|
889
|
+
listItemBlock.parent = listBlock;
|
|
890
|
+
return listItemBlock;
|
|
891
|
+
});
|
|
892
|
+
return listBlock;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* @inheritDoc
|
|
896
|
+
*/
|
|
897
|
+
toJSON() {
|
|
898
|
+
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* @inheritDoc
|
|
902
|
+
*/
|
|
903
|
+
isNotEmpty() {
|
|
904
|
+
return this.blocks.length > 0;
|
|
905
|
+
}
|
|
906
|
+
/**
|
|
907
|
+
* @inheritDoc
|
|
908
|
+
*/
|
|
909
|
+
getLastNode() {
|
|
910
|
+
return this.blocks[this.blocks.length - 1].getLastNode();
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* @inheritDoc
|
|
914
|
+
*/
|
|
915
|
+
clone() {
|
|
916
|
+
const clonedListBlock = new RTEListBlock(this.id, this.type);
|
|
917
|
+
clonedListBlock.blocks = this.blocks.map((item) => {
|
|
918
|
+
const clonedListItemBlock = item.clone();
|
|
919
|
+
clonedListItemBlock.parent = clonedListBlock;
|
|
920
|
+
return clonedListItemBlock;
|
|
921
|
+
});
|
|
922
|
+
clonedListBlock.annotationMap = super.cloneAnnotations();
|
|
923
|
+
clonedListBlock.parent = this.parent;
|
|
924
|
+
return clonedListBlock;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
(() => {
|
|
928
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_CHILD, RTEListBlock.name, new ListRemoveListItemStrategy());
|
|
929
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_BLOCKS_BEFORE, RTEListBlock.name, new BlockInsertBlocksBeforeStrategy());
|
|
930
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_BLOCKS_AFTER, RTEListBlock.name, new BlockInsertBlocksAfterStrategy());
|
|
931
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.APPEND_CHILD_NODES, RTEListBlock.name, new BlockAppendBlocksStrategy());
|
|
932
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
|
|
933
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
|
|
934
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
|
|
935
|
+
})();
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Transform the selected text blocks to a code block strategy.
|
|
939
|
+
*/
|
|
940
|
+
class BlockTransformToCodeBlockStrategy extends codeBlock.ActionHandleStrategy {
|
|
941
|
+
/**
|
|
942
|
+
* Get the all select text and create a new code block.
|
|
943
|
+
*
|
|
944
|
+
* @param {TransformToCodeBlockAction} action - The action instance.
|
|
945
|
+
* @param {VegaRTEContent} target - The block top parent instance.
|
|
946
|
+
*/
|
|
947
|
+
handleAction(action, target) {
|
|
948
|
+
const selectedBlocks = action.selectedBlocks;
|
|
949
|
+
const codeBlock$1 = new codeBlock.RTECodeBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), this.getCodeContent(selectedBlocks), 'plainText');
|
|
950
|
+
target.apply(new codeBlock.InsertBlocksBeforeAction(selectedBlocks[0], codeBlock$1));
|
|
951
|
+
action.newCodeBlock = codeBlock$1;
|
|
952
|
+
this.removeSelectBlocks(selectedBlocks, target);
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Get the selected text block text content.
|
|
956
|
+
*
|
|
957
|
+
* @param {RTEBlock[]} selectedBlocks - The selected blocks.
|
|
958
|
+
* @returns {string} - The selected text content.
|
|
959
|
+
*/
|
|
960
|
+
getCodeContent(selectedBlocks) {
|
|
961
|
+
const selectedTextBlocks = selectedBlocks.filter((item) => item.type !== 'image' && item.type !== 'list-item');
|
|
962
|
+
return selectedTextBlocks
|
|
963
|
+
.map((block) => {
|
|
964
|
+
return block.nodes.map((node) => node.text).join('');
|
|
965
|
+
})
|
|
966
|
+
.join('\n');
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Remove the selected blocks after append new code block.
|
|
970
|
+
*
|
|
971
|
+
* @param {RTEBlock[]} selectedBlocks - The selected blocks.
|
|
972
|
+
* @param {VegaRTEContent} target - The selected block top parent object.
|
|
973
|
+
*/
|
|
974
|
+
removeSelectBlocks(selectedBlocks, target) {
|
|
975
|
+
for (let i = 0; i < selectedBlocks.length; i++) {
|
|
976
|
+
target.apply(new codeBlock.RemoveChildAction(selectedBlocks[i]));
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Class representing the content state of the rich text editor.
|
|
983
|
+
*/
|
|
984
|
+
class VegaRTEContent {
|
|
985
|
+
constructor(blocks) {
|
|
986
|
+
blocks.forEach((block) => {
|
|
987
|
+
block.parent = this;
|
|
988
|
+
});
|
|
989
|
+
this.blocks = blocks;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Converts a JSON array of blocks to a class array of RTEContentBlock.
|
|
993
|
+
*
|
|
994
|
+
* @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
|
|
995
|
+
* @returns {VegaRTEContent} The converted array of RTEContentBlock.
|
|
996
|
+
*/
|
|
997
|
+
static fromJSON(value) {
|
|
998
|
+
const blocks = value.map((block) => {
|
|
999
|
+
switch (block.type) {
|
|
1000
|
+
case 'paragraph':
|
|
1001
|
+
case 'title':
|
|
1002
|
+
case 'subtitle':
|
|
1003
|
+
case 'heading-1':
|
|
1004
|
+
case 'heading-2':
|
|
1005
|
+
case 'heading-3': {
|
|
1006
|
+
return codeBlock.RTETextBlock.from(block);
|
|
1007
|
+
}
|
|
1008
|
+
case 'image':
|
|
1009
|
+
return RTEImageBlock.from(block);
|
|
1010
|
+
case 'bullet-list':
|
|
1011
|
+
case 'number-list':
|
|
1012
|
+
return RTEListBlock.from(block);
|
|
1013
|
+
case 'code-block':
|
|
1014
|
+
return codeBlock.RTECodeBlock.from(block);
|
|
1015
|
+
default: {
|
|
1016
|
+
throw new Error(`[Vega] Unknown block type: ${block.type}`);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
});
|
|
1020
|
+
return new VegaRTEContent(blocks);
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* Create an empty content state
|
|
1024
|
+
*
|
|
1025
|
+
* @returns {VegaRTEContent} An empty content state
|
|
1026
|
+
*/
|
|
1027
|
+
static createEmptyContent() {
|
|
1028
|
+
return VegaRTEContent.fromJSON([
|
|
1029
|
+
{
|
|
1030
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
1031
|
+
type: 'paragraph',
|
|
1032
|
+
nodes: [
|
|
1033
|
+
{
|
|
1034
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
1035
|
+
type: 'text',
|
|
1036
|
+
text: '',
|
|
1037
|
+
},
|
|
1038
|
+
],
|
|
1039
|
+
},
|
|
1040
|
+
]);
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Clones the content state.
|
|
1044
|
+
*
|
|
1045
|
+
* @param {boolean} deep - If true, performs a deep clone of the content state.
|
|
1046
|
+
* @returns {VegaRTEContent} The cloned content state.
|
|
1047
|
+
*/
|
|
1048
|
+
clone(deep = false) {
|
|
1049
|
+
return deep
|
|
1050
|
+
? new VegaRTEContent(this.blocks.map((block) => block.clone()))
|
|
1051
|
+
: new VegaRTEContent([...this.blocks]);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Converts the content state to a JSON array of blocks.
|
|
1055
|
+
*
|
|
1056
|
+
* @returns {VegaRTEContentBlock[]} The JSON array of blocks.
|
|
1057
|
+
*/
|
|
1058
|
+
toJSON() {
|
|
1059
|
+
return this.blocks.map((block) => block.toJSON());
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Internal method to add the block item, remove the block item
|
|
1063
|
+
*
|
|
1064
|
+
* @param {ModifyContentAction} action - Modify content action
|
|
1065
|
+
*/
|
|
1066
|
+
apply(action) {
|
|
1067
|
+
codeBlock.ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Convert text to list.
|
|
1071
|
+
*
|
|
1072
|
+
* @param {RTETextBlock} block - block
|
|
1073
|
+
* @returns {RTEListItemBlock} list item block dto.
|
|
1074
|
+
*/
|
|
1075
|
+
toListItem(block) {
|
|
1076
|
+
block.nodes.map((node) => node.apply(new codeBlock.SyncUpSelectionAction()));
|
|
1077
|
+
const listItemBlock = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1078
|
+
listItemBlock.apply(new codeBlock.AppendChildNodesAction(block['nodes']));
|
|
1079
|
+
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
1080
|
+
return listItemBlock;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* create list.
|
|
1084
|
+
*
|
|
1085
|
+
* @param {ListType} type - type
|
|
1086
|
+
* @returns {RTEListBlock} list block dto.
|
|
1087
|
+
*/
|
|
1088
|
+
createList(type) {
|
|
1089
|
+
return new RTEListBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), type);
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* Finds a node by its ID in the content.
|
|
1093
|
+
*
|
|
1094
|
+
* @param {string} id - The ID of the node to find.
|
|
1095
|
+
* @returns {Nullable<RTENode>} The found node or null if not found.
|
|
1096
|
+
*/
|
|
1097
|
+
findNodeById(id) {
|
|
1098
|
+
return this.findNodeInBlocksById(id, this.blocks);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Recursively searches for a node by its ID in the given blocks.
|
|
1102
|
+
*
|
|
1103
|
+
* @param {string} id - The ID of the node to find.
|
|
1104
|
+
* @param {RTEContentBlock[]} blocks - The blocks to search within.
|
|
1105
|
+
* @returns {Nullable<RTENode>} The found node or null if not found.
|
|
1106
|
+
*/
|
|
1107
|
+
findNodeInBlocksById(id, blocks) {
|
|
1108
|
+
for (const block of blocks) {
|
|
1109
|
+
if ('nodes' in block) {
|
|
1110
|
+
for (const node of block.nodes) {
|
|
1111
|
+
if (node.id === id) {
|
|
1112
|
+
return node;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
if (block instanceof RTEListItemBlock && block.children) {
|
|
1117
|
+
for (const cBlock of block.children) {
|
|
1118
|
+
const foundNode = this.findNodeInBlocksById(id, cBlock.blocks);
|
|
1119
|
+
if (foundNode) {
|
|
1120
|
+
return foundNode;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
if (block instanceof RTEListBlock && block.blocks) {
|
|
1125
|
+
const foundNode = this.findNodeInBlocksById(id, block.blocks);
|
|
1126
|
+
if (foundNode) {
|
|
1127
|
+
return foundNode;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
return null;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
(() => {
|
|
1135
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.DELETE_CHILD, VegaRTEContent.name, new BlockRemoveChildBlockStrategy());
|
|
1136
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.APPEND_CHILD_NODES, VegaRTEContent.name, new BlockAppendBlocksStrategy());
|
|
1137
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_BLOCKS_BEFORE, VegaRTEContent.name, new BlockInsertBlocksBeforeStrategy());
|
|
1138
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.INSERT_BLOCKS_AFTER, VegaRTEContent.name, new BlockInsertBlocksAfterStrategy());
|
|
1139
|
+
codeBlock.ActionHandleStrategyRegistry.register(codeBlock.ModifyContentActionType.TRANSFORM_TO_CODE_BLOCK, VegaRTEContent.name, new BlockTransformToCodeBlockStrategy());
|
|
1140
|
+
})();
|
|
1141
|
+
|
|
1142
|
+
exports.BreakSingleBlockAction = BreakSingleBlockAction;
|
|
1143
|
+
exports.RTEImageBlock = RTEImageBlock;
|
|
1144
|
+
exports.RTEListBlock = RTEListBlock;
|
|
1145
|
+
exports.RTEListItemBlock = RTEListItemBlock;
|
|
1146
|
+
exports.VegaRTEContent = VegaRTEContent;
|