@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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { i as isNonNullable } from './type-guard-158f6d7a.js';
|
|
1
2
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
2
|
-
import { d as domNodeSubjectFactory } from './dom-node-subject-factory-
|
|
3
|
-
import { a as VegaInternalRichTextEditorFlushChanges, b as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-
|
|
3
|
+
import { d as domNodeSubjectFactory } from './dom-node-subject-factory-6374611f.js';
|
|
4
|
+
import { a as VegaInternalRichTextEditorFlushChanges, b as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-178b2743.js';
|
|
4
5
|
import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
|
|
5
|
-
import { i as isNonNullable } from './type-guard-158f6d7a.js';
|
|
6
6
|
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-8ada793f.js';
|
|
7
|
-
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-
|
|
7
|
+
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-ea798fc8.js';
|
|
8
8
|
|
|
9
9
|
var InternalAnnotationTypeEnum;
|
|
10
10
|
(function (InternalAnnotationTypeEnum) {
|
|
@@ -101,6 +101,10 @@ var ModifyContentActionType;
|
|
|
101
101
|
ModifyContentActionType["DELETE_BLOCK_CONTENT"] = "DELETE_BLOCK_CONTENT";
|
|
102
102
|
ModifyContentActionType["INSERT_IMAGE_TO_BLOCK"] = "INSERT_IMAGE_TO_BLOCK";
|
|
103
103
|
ModifyContentActionType["UPDATE_IMAGE_NODE_URL"] = "UPDATE_IMAGE_NODE_URL";
|
|
104
|
+
ModifyContentActionType["TRANSFORM_TO_CODE_BLOCK"] = "TRANSFORM_TO_CODE_BLOCK";
|
|
105
|
+
ModifyContentActionType["UPDATE_CODE_BLOCK"] = "UPDATE_CODE_BLOCK";
|
|
106
|
+
ModifyContentActionType["SWITCH_OUT_FROM_CODE_BLOCK"] = "SWITCH_OUT_FROM_CODE_BLOCK";
|
|
107
|
+
ModifyContentActionType["DELETE_CODE_BLOCK"] = "DELETE_CODE_BLOCK";
|
|
104
108
|
})(ModifyContentActionType || (ModifyContentActionType = {}));
|
|
105
109
|
/**
|
|
106
110
|
* Abstract class for update node content, delete node, insert node
|
|
@@ -365,6 +369,7 @@ var NodeTypeEnum;
|
|
|
365
369
|
(function (NodeTypeEnum) {
|
|
366
370
|
NodeTypeEnum["TEXT"] = "TEXT";
|
|
367
371
|
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
372
|
+
NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
|
|
368
373
|
})(NodeTypeEnum || (NodeTypeEnum = {}));
|
|
369
374
|
/**
|
|
370
375
|
* Abstract class for all nodes
|
|
@@ -856,58 +861,6 @@ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
|
856
861
|
}
|
|
857
862
|
}
|
|
858
863
|
|
|
859
|
-
/**
|
|
860
|
-
* The image block delete the image node strategy.
|
|
861
|
-
*/
|
|
862
|
-
class BlockDeleteImageStrategy extends BlockDeleteNodeContentStrategy {
|
|
863
|
-
/**
|
|
864
|
-
* @inheritDoc
|
|
865
|
-
*/
|
|
866
|
-
handleAction(action, target) {
|
|
867
|
-
this.deleteNodeContent(action, target);
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* Deletes content from a block node based on specific conditions.
|
|
871
|
-
*
|
|
872
|
-
* @param {DeleteBlockContentAction} action - Delete block content action
|
|
873
|
-
* @param {RTEImageBlock} target - The image block.
|
|
874
|
-
*/
|
|
875
|
-
deleteNodeContent(action, target) {
|
|
876
|
-
const startContainerNode = action
|
|
877
|
-
.startContainerNode, startOffset = action.startOffset;
|
|
878
|
-
let previousNode = this.getPreviousNode(startContainerNode);
|
|
879
|
-
let nextNode = null;
|
|
880
|
-
if (startOffset === 1) {
|
|
881
|
-
const parentBlock = target;
|
|
882
|
-
if (this.isContentFirstNode(startContainerNode)) {
|
|
883
|
-
nextNode = this.getNextNode(startContainerNode);
|
|
884
|
-
}
|
|
885
|
-
if (parentBlock.nodes.length === 1) {
|
|
886
|
-
parentBlock.parent.apply(new RemoveChildAction(parentBlock));
|
|
887
|
-
}
|
|
888
|
-
else {
|
|
889
|
-
parentBlock.apply(new RemoveChildAction(startContainerNode));
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
else {
|
|
893
|
-
const shouldRemoveNode = previousNode;
|
|
894
|
-
if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
|
|
895
|
-
previousNode = this.getPreviousNode(shouldRemoveNode);
|
|
896
|
-
shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
|
|
897
|
-
if (!previousNode) {
|
|
898
|
-
action.nextNode = startContainerNode;
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
if (previousNode) {
|
|
903
|
-
action.previousNode = previousNode;
|
|
904
|
-
}
|
|
905
|
-
else if (nextNode) {
|
|
906
|
-
action.nextNode = nextNode;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
|
|
911
864
|
/** Append blocks or nodes to a block */
|
|
912
865
|
class AppendChildNodesAction extends ModifyContentAction {
|
|
913
866
|
constructor(childNodes) {
|
|
@@ -949,7 +902,7 @@ class BlockRemoveNodeStrategy extends ActionHandleStrategy {
|
|
|
949
902
|
* Remove the block if the block nodes is empty after delete the current node.
|
|
950
903
|
*
|
|
951
904
|
* @param {RemoveChildAction} action - The remove child action instance.
|
|
952
|
-
* @param {
|
|
905
|
+
* @param {RTEBlockWithNodes} target - The parent block of the node that will be removed.
|
|
953
906
|
*/
|
|
954
907
|
handleAction(action, target) {
|
|
955
908
|
const arrayFixed = target.nodes;
|
|
@@ -1024,51 +977,6 @@ class ReplaceChildNodesAction extends ModifyContentAction {
|
|
|
1024
977
|
}
|
|
1025
978
|
}
|
|
1026
979
|
|
|
1027
|
-
/**
|
|
1028
|
-
* Split the current image block with a special position strategy.
|
|
1029
|
-
*/
|
|
1030
|
-
class BlockSplitWithImageNodeStrategy extends ActionHandleStrategy {
|
|
1031
|
-
/**
|
|
1032
|
-
* @inheritDoc
|
|
1033
|
-
*/
|
|
1034
|
-
handleAction(action, target) {
|
|
1035
|
-
action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode, target);
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* The image offset should be 0 or 1
|
|
1039
|
-
* <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
|
|
1040
|
-
*
|
|
1041
|
-
* @param {RTEImageNode} imageNode The split point image node.
|
|
1042
|
-
* @param {number} imageOffset The cursor point 0 | 1.
|
|
1043
|
-
* @param {RTEImageBlock} target The image block.
|
|
1044
|
-
* @returns {Nullable<RTEBlock>} The new block after split
|
|
1045
|
-
*/
|
|
1046
|
-
splitImageNodes(imageNode, imageOffset, target) {
|
|
1047
|
-
const nodesSplitIndex = target.nodes.indexOf(imageNode);
|
|
1048
|
-
if (nodesSplitIndex > -1) {
|
|
1049
|
-
const beforeNodes = target.nodes.slice(0, nodesSplitIndex + imageOffset);
|
|
1050
|
-
const afterNodes = target.nodes.slice(nodesSplitIndex + imageOffset);
|
|
1051
|
-
target.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
1052
|
-
const newBlock = this.cloneWithNodes(afterNodes, target);
|
|
1053
|
-
target.parent.apply(new InsertBlocksAfterAction(target, newBlock));
|
|
1054
|
-
return newBlock;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
|
|
1059
|
-
*
|
|
1060
|
-
* @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
|
|
1061
|
-
* @param {RTEImageBlock} target The image block.
|
|
1062
|
-
* @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
|
|
1063
|
-
*/
|
|
1064
|
-
cloneWithNodes(nodes, target) {
|
|
1065
|
-
const block = target.createNewImageBlock();
|
|
1066
|
-
block.nodes = [];
|
|
1067
|
-
block.apply(new AppendChildNodesAction(nodes));
|
|
1068
|
-
return block;
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
980
|
/**
|
|
1073
981
|
* Insert a new block before a existing block
|
|
1074
982
|
*
|
|
@@ -2514,7 +2422,9 @@ class BlockDeleteTextContentStrategy extends BlockDeleteNodeContentStrategy {
|
|
|
2514
2422
|
if (startContainerNode.isEmpty()) {
|
|
2515
2423
|
target.apply(new RemoveChildAction(startContainerNode));
|
|
2516
2424
|
}
|
|
2517
|
-
previousNode.parentBlock.
|
|
2425
|
+
if (target.type === previousNode.parentBlock.type) {
|
|
2426
|
+
previousNode.parentBlock.apply(new MergeTwoBlocksNodesAction(target));
|
|
2427
|
+
}
|
|
2518
2428
|
}
|
|
2519
2429
|
else {
|
|
2520
2430
|
if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
|
|
@@ -2828,994 +2738,309 @@ class RTETextBlock extends RTEBlock {
|
|
|
2828
2738
|
})();
|
|
2829
2739
|
|
|
2830
2740
|
/**
|
|
2831
|
-
*
|
|
2741
|
+
* Remove the code block from the value, call this action if want to flush value after action.
|
|
2832
2742
|
*/
|
|
2833
|
-
class
|
|
2743
|
+
class CodeBlockRemoveSelfStrategy extends BlockDeleteNodeContentStrategy {
|
|
2834
2744
|
/**
|
|
2835
2745
|
* @inheritDoc
|
|
2836
2746
|
*/
|
|
2837
|
-
handleAction(
|
|
2838
|
-
|
|
2747
|
+
handleAction(_action, target) {
|
|
2748
|
+
const node = target.nodes[0];
|
|
2749
|
+
const parent = target.parent;
|
|
2750
|
+
if (parent) {
|
|
2751
|
+
let focusNode = this.getPreviousNode(node);
|
|
2752
|
+
let offset = this.getRTENodeEndOffset(focusNode);
|
|
2753
|
+
if (!focusNode) {
|
|
2754
|
+
focusNode = this.getNextNode(node);
|
|
2755
|
+
offset = 0;
|
|
2756
|
+
}
|
|
2757
|
+
parent.apply(new RemoveChildAction(target));
|
|
2758
|
+
const focusElement = focusNode
|
|
2759
|
+
? stateEntityRenderingRegistry.getDOMByEntity(focusNode)
|
|
2760
|
+
: null;
|
|
2761
|
+
if (parent.blocks.length === 0) {
|
|
2762
|
+
const defaultParagraph = RTETextBlock.from({
|
|
2763
|
+
id: generateUUID(),
|
|
2764
|
+
type: 'paragraph',
|
|
2765
|
+
nodes: [{ id: generateUUID(), type: 'text', text: '' }],
|
|
2766
|
+
});
|
|
2767
|
+
target.parent.apply(new AppendChildNodesAction([defaultParagraph]));
|
|
2768
|
+
focusNode = defaultParagraph.nodes[0];
|
|
2769
|
+
offset = 0;
|
|
2770
|
+
}
|
|
2771
|
+
this.notifyUpdateSelection(focusNode, focusElement, offset, target);
|
|
2772
|
+
}
|
|
2839
2773
|
}
|
|
2840
2774
|
/**
|
|
2841
|
-
*
|
|
2775
|
+
* Update the rich text next selection range.
|
|
2842
2776
|
*
|
|
2843
|
-
* @param {
|
|
2844
|
-
* @param {
|
|
2845
|
-
* @param {
|
|
2846
|
-
* @
|
|
2777
|
+
* @param {RTENode} focusNode - The next focus node dto.
|
|
2778
|
+
* @param {Nullable<HTMLElement>} focusElement - The next focus element. The update selection task could run directly when the element is exist.
|
|
2779
|
+
* @param {number} offset - The next focus text offset.
|
|
2780
|
+
* @param {RTECodeBlock} target - The code block dto.
|
|
2847
2781
|
*/
|
|
2848
|
-
|
|
2849
|
-
const
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2782
|
+
notifyUpdateSelection(focusNode, focusElement, offset, target) {
|
|
2783
|
+
const targetDom = stateEntityRenderingRegistry.getDOMByEntity(target);
|
|
2784
|
+
if (targetDom) {
|
|
2785
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(targetDom, VegaInternalRichTextEditorSelectionRangeChange);
|
|
2786
|
+
if (nodeSubject) {
|
|
2787
|
+
ChangeManager.notify(nodeSubject, {
|
|
2788
|
+
node: focusNode,
|
|
2789
|
+
updateDirectly: focusElement ? true : false,
|
|
2790
|
+
offset,
|
|
2791
|
+
});
|
|
2792
|
+
}
|
|
2859
2793
|
}
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* Get the node content end offset.
|
|
2797
|
+
*
|
|
2798
|
+
* @param {Nullable<RTENode>} node - The RTENode.
|
|
2799
|
+
* @returns {number} - The number value.
|
|
2800
|
+
*/
|
|
2801
|
+
getRTENodeEndOffset(node) {
|
|
2802
|
+
if (node && node.type !== 'CODE_BLOCK_NODE') {
|
|
2803
|
+
return node['type'] !== 'IMAGE' ? node['text'].length : 1;
|
|
2864
2804
|
}
|
|
2865
|
-
return
|
|
2805
|
+
return 0;
|
|
2866
2806
|
}
|
|
2867
2807
|
}
|
|
2868
2808
|
|
|
2869
2809
|
/**
|
|
2870
|
-
*
|
|
2871
|
-
* 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.
|
|
2872
|
-
* The property `newBlock` use to store the new create block if need.
|
|
2810
|
+
* Update the code block content or language action.
|
|
2873
2811
|
*
|
|
2874
|
-
* @example
|
|
2812
|
+
* @example codeNode.apply(new UpdateCodeBlockAction(content, language))
|
|
2875
2813
|
*/
|
|
2876
|
-
class
|
|
2877
|
-
constructor(
|
|
2814
|
+
class UpdateCodeBlockAction extends ModifyContentAction {
|
|
2815
|
+
constructor(content, language) {
|
|
2878
2816
|
super();
|
|
2879
|
-
this.
|
|
2880
|
-
this.
|
|
2881
|
-
this.
|
|
2817
|
+
this.isFlushable = true;
|
|
2818
|
+
this.type = ModifyContentActionType.UPDATE_CODE_BLOCK;
|
|
2819
|
+
this.content = content;
|
|
2820
|
+
this.language = language;
|
|
2882
2821
|
}
|
|
2883
2822
|
}
|
|
2884
2823
|
|
|
2885
2824
|
/**
|
|
2886
|
-
*
|
|
2825
|
+
* Remove the line break and insert new paragraph after code block.
|
|
2887
2826
|
*/
|
|
2888
|
-
class
|
|
2827
|
+
class SwitchOutFromCodeBlockStrategy extends ActionHandleStrategy {
|
|
2889
2828
|
/**
|
|
2890
|
-
*
|
|
2891
|
-
*
|
|
2892
|
-
* @param {LineBreakSingleBlockAction} action - The action instance.
|
|
2893
|
-
* @param {RTEImageBlock} target - The image block.
|
|
2829
|
+
* @inheritDoc
|
|
2894
2830
|
*/
|
|
2895
2831
|
handleAction(action, target) {
|
|
2896
|
-
const
|
|
2897
|
-
|
|
2898
|
-
const
|
|
2899
|
-
|
|
2900
|
-
|
|
2832
|
+
const { content, language } = action;
|
|
2833
|
+
const textArray = content.split('\n');
|
|
2834
|
+
const updateAction = new UpdateCodeBlockAction(textArray.slice(0, textArray.length - 2).join('\n'), language);
|
|
2835
|
+
updateAction.isFlushable = false;
|
|
2836
|
+
target.nodes[0].apply(updateAction);
|
|
2837
|
+
const textBlock = RTETextBlock.from({
|
|
2838
|
+
id: generateUUID(),
|
|
2839
|
+
type: 'paragraph',
|
|
2840
|
+
nodes: [{ id: generateUUID(), text: '', type: 'text' }],
|
|
2841
|
+
});
|
|
2842
|
+
target.parent.apply(new InsertBlocksAfterAction(target, textBlock));
|
|
2843
|
+
// Focus the next text node after value update.
|
|
2844
|
+
const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(target);
|
|
2845
|
+
if (currentNodeDom) {
|
|
2846
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, VegaInternalRichTextEditorSelectionRangeChange);
|
|
2847
|
+
if (nodeSubject) {
|
|
2848
|
+
ChangeManager.notify(nodeSubject, { node: textBlock.nodes[0] });
|
|
2849
|
+
}
|
|
2901
2850
|
}
|
|
2902
2851
|
}
|
|
2903
2852
|
}
|
|
2904
2853
|
|
|
2905
2854
|
/**
|
|
2906
|
-
*
|
|
2855
|
+
* Update the language or content of code block strategy.
|
|
2907
2856
|
*/
|
|
2908
|
-
class
|
|
2857
|
+
class UpdateCodeBlockStrategy extends ActionHandleStrategy {
|
|
2909
2858
|
/**
|
|
2910
2859
|
* @inheritDoc
|
|
2911
2860
|
*/
|
|
2912
2861
|
handleAction(action, target) {
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
* Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
|
|
2917
|
-
*
|
|
2918
|
-
* @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.
|
|
2919
|
-
* @param {RTEImageBlock} target - The image block.
|
|
2920
|
-
* @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
|
|
2921
|
-
*/
|
|
2922
|
-
lineBreakMultipleBlocks(selectedBlocks, target) {
|
|
2923
|
-
const newParagraph = RTETextBlock.from({
|
|
2924
|
-
id: generateUUID(),
|
|
2925
|
-
type: 'paragraph',
|
|
2926
|
-
nodes: [{ id: generateUUID(), type: 'text', text: '\n' }],
|
|
2927
|
-
});
|
|
2928
|
-
target.parent.apply(new InsertBlocksAfterAction(target, newParagraph));
|
|
2929
|
-
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
2930
|
-
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
2931
|
-
afterNodes.push(new RTETextNode(generateUUID(), '\n', newParagraph));
|
|
2932
|
-
}
|
|
2933
|
-
newParagraph.apply(new AppendChildNodesAction(afterNodes));
|
|
2934
|
-
return newParagraph['nodes'][0];
|
|
2935
|
-
}
|
|
2936
|
-
/**
|
|
2937
|
-
* Concat the child nodes of multiple RTEBlocks if both are not images.
|
|
2938
|
-
*
|
|
2939
|
-
* @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
2940
|
-
* @returns {RTENode[]} Array of connected block nodes
|
|
2941
|
-
*/
|
|
2942
|
-
concatBlocksNodes(blocks) {
|
|
2943
|
-
const nodes = [];
|
|
2944
|
-
blocks.map((block) => {
|
|
2945
|
-
if (block.type !== 'image') {
|
|
2946
|
-
nodes.push(...block['nodes']);
|
|
2947
|
-
block.parent.apply(new RemoveChildAction(block));
|
|
2948
|
-
}
|
|
2949
|
-
});
|
|
2950
|
-
return nodes;
|
|
2862
|
+
const { content, language } = action;
|
|
2863
|
+
target.language = language;
|
|
2864
|
+
target.text = content;
|
|
2951
2865
|
}
|
|
2952
2866
|
}
|
|
2953
2867
|
|
|
2954
2868
|
/**
|
|
2955
|
-
*
|
|
2869
|
+
* Action to change the selection range
|
|
2956
2870
|
*/
|
|
2957
|
-
class
|
|
2871
|
+
class SelectionChangeAction extends AnnotationAction {
|
|
2872
|
+
constructor(range) {
|
|
2873
|
+
super();
|
|
2874
|
+
this.isFlushable = false;
|
|
2875
|
+
this.range = range;
|
|
2876
|
+
}
|
|
2958
2877
|
/**
|
|
2959
|
-
*
|
|
2878
|
+
* Converts the action to an annotation
|
|
2879
|
+
*
|
|
2880
|
+
* @returns {SelectionRangeAnnotation} The annotation
|
|
2960
2881
|
*/
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
const startOffsetOfNode = action.startOffsetOfNode;
|
|
2964
|
-
const newImageBlock = action.imageBlockToBeInserted;
|
|
2965
|
-
const newImageNodes = newImageBlock.nodes;
|
|
2966
|
-
if (target.nodes.length < 1) {
|
|
2967
|
-
target.apply(new AppendChildNodesAction(newImageNodes));
|
|
2968
|
-
}
|
|
2969
|
-
else if (this.isCaretPositionAtImageBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
2970
|
-
target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
|
|
2971
|
-
}
|
|
2972
|
-
else if (this.isCaretPositionAtImageBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
2973
|
-
target.parent.apply(new InsertBlocksBeforeAction(target, newImageBlock));
|
|
2974
|
-
}
|
|
2975
|
-
else {
|
|
2976
|
-
target.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
|
|
2977
|
-
target.parent.apply(new InsertBlocksAfterAction(target, newImageBlock));
|
|
2978
|
-
}
|
|
2882
|
+
toAnnotation() {
|
|
2883
|
+
return new SelectionRangeAnnotation(this.range);
|
|
2979
2884
|
}
|
|
2980
2885
|
}
|
|
2981
2886
|
|
|
2982
2887
|
/**
|
|
2983
|
-
*
|
|
2888
|
+
* Update the code block node annotation map strategy.
|
|
2984
2889
|
*/
|
|
2985
|
-
class
|
|
2890
|
+
class CodeNodeSetSelectionRangeAnnotationStrategy extends ActionHandleStrategy {
|
|
2986
2891
|
/**
|
|
2987
2892
|
* @inheritDoc
|
|
2988
2893
|
*/
|
|
2989
2894
|
handleAction(action, target) {
|
|
2990
|
-
|
|
2991
|
-
const nodes = [referNode, ...action.nodesToBeInserted];
|
|
2992
|
-
this.replaceNodeWithNodes(target, referNode, nodes);
|
|
2895
|
+
target.annotationMap.set(InternalAnnotationTypeEnum.SELECTION_RANGE, action.toAnnotation());
|
|
2993
2896
|
}
|
|
2994
2897
|
}
|
|
2995
2898
|
|
|
2996
2899
|
/**
|
|
2997
|
-
*
|
|
2900
|
+
* RTE code node DTO class.
|
|
2998
2901
|
*/
|
|
2999
|
-
class
|
|
3000
|
-
constructor(id) {
|
|
2902
|
+
class RTECodeBlockNode extends RTENode {
|
|
2903
|
+
constructor(id, content, language, parentBlock) {
|
|
3001
2904
|
super(id);
|
|
3002
|
-
this.type =
|
|
3003
|
-
this.
|
|
2905
|
+
this.type = NodeTypeEnum.CODE_BLOCK_NODE;
|
|
2906
|
+
this.text = '';
|
|
2907
|
+
this.annotationMap = new Map();
|
|
2908
|
+
this.text = content;
|
|
2909
|
+
this.parentBlock = parentBlock;
|
|
2910
|
+
this.language = language;
|
|
3004
2911
|
}
|
|
3005
2912
|
/**
|
|
3006
|
-
*
|
|
2913
|
+
* The code node toJSON method will called internal.
|
|
3007
2914
|
*
|
|
3008
|
-
* @
|
|
3009
|
-
* @returns {RTEImageBlock} An instance of `RTEImageBlock`
|
|
3010
|
-
*/
|
|
3011
|
-
static from(block) {
|
|
3012
|
-
const imageBlock = new RTEImageBlock(block.id);
|
|
3013
|
-
const { annotations } = block;
|
|
3014
|
-
imageBlock.nodes = block.nodes.map((image) => RTEImageNode.from(image, imageBlock));
|
|
3015
|
-
if (annotations) {
|
|
3016
|
-
Object.entries(annotations).forEach(([type, value]) => {
|
|
3017
|
-
const item = this.createAnnotationEntity(type, value);
|
|
3018
|
-
if (isNonNullable(item)) {
|
|
3019
|
-
imageBlock.annotationMap.set(...item);
|
|
3020
|
-
}
|
|
3021
|
-
});
|
|
3022
|
-
}
|
|
3023
|
-
return imageBlock;
|
|
3024
|
-
}
|
|
3025
|
-
/**
|
|
3026
|
-
* @inheritDoc
|
|
2915
|
+
* @returns {VegaRTECodeNode} - An object contains content property.
|
|
3027
2916
|
*/
|
|
3028
2917
|
toJSON() {
|
|
3029
|
-
return
|
|
2918
|
+
return { id: this.id, type: 'text', text: this.text, language: this.language };
|
|
3030
2919
|
}
|
|
3031
2920
|
/**
|
|
3032
2921
|
* @inheritDoc
|
|
3033
2922
|
*/
|
|
3034
|
-
|
|
3035
|
-
return this.
|
|
2923
|
+
clone() {
|
|
2924
|
+
return new RTECodeBlockNode(this.id, this.text, this.language, this.parentBlock);
|
|
3036
2925
|
}
|
|
3037
2926
|
/**
|
|
3038
2927
|
* @inheritDoc
|
|
3039
2928
|
*/
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
}
|
|
3043
|
-
/**
|
|
3044
|
-
* Create a new image block.
|
|
3045
|
-
*
|
|
3046
|
-
* @returns {RTEImageBlock} - The empty image block.
|
|
3047
|
-
*/
|
|
3048
|
-
createNewImageBlock() {
|
|
3049
|
-
return new RTEImageBlock(generateUUID());
|
|
2929
|
+
doAnnotationActionApply(action) {
|
|
2930
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3050
2931
|
}
|
|
3051
2932
|
/**
|
|
3052
2933
|
* @inheritDoc
|
|
3053
2934
|
*/
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
clonedBlock.nodes = this.nodes.map((node) => {
|
|
3057
|
-
const clonedNode = node.clone();
|
|
3058
|
-
clonedNode.parentBlock = clonedBlock;
|
|
3059
|
-
return clonedNode;
|
|
3060
|
-
});
|
|
3061
|
-
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
3062
|
-
clonedBlock.parent = this.parent;
|
|
3063
|
-
return clonedBlock;
|
|
2935
|
+
doModifyActionApply(action) {
|
|
2936
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3064
2937
|
}
|
|
3065
2938
|
}
|
|
3066
2939
|
(() => {
|
|
3067
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.
|
|
3068
|
-
ActionHandleStrategyRegistry.register(
|
|
3069
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEImageBlock.name, new BlockRemoveNodeStrategy());
|
|
3070
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEImageBlock.name, new BlockAppendNodesStrategy());
|
|
3071
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEImageBlock.name, new BlockReplaceNodesStrategy());
|
|
3072
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEImageBlock.name, new BlockSplitWithImageNodeStrategy());
|
|
3073
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertNewParagraphStrategy());
|
|
3074
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEImageBlock.name, new ImageInsertLineBreakStrategy());
|
|
3075
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEImageBlock.name, new ImageInsertLineBreakWithBlocksStrategy());
|
|
3076
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEImageBlock.name, new ImageBlockInsertImageStrategy());
|
|
3077
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTEImageBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
3078
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_AFTER, RTEImageBlock.name, new BlockInsertNodesAfterNodeStrategy());
|
|
2940
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.UPDATE_CODE_BLOCK, RTECodeBlockNode.name, new UpdateCodeBlockStrategy());
|
|
2941
|
+
ActionHandleStrategyRegistry.register(SelectionChangeAction.name, RTECodeBlockNode.name, new CodeNodeSetSelectionRangeAnnotationStrategy());
|
|
3079
2942
|
})();
|
|
3080
2943
|
|
|
3081
2944
|
/**
|
|
3082
|
-
*
|
|
2945
|
+
* Insert image behind after code block strategy.
|
|
3083
2946
|
*/
|
|
3084
|
-
class
|
|
2947
|
+
class CodeBlockInsertImageStrategy extends ActionHandleStrategy {
|
|
3085
2948
|
/**
|
|
3086
|
-
*
|
|
2949
|
+
* Insert image block at behind of the RTE code block.
|
|
3087
2950
|
*
|
|
3088
|
-
* @param {
|
|
3089
|
-
* @param {
|
|
2951
|
+
* @param {InsertImageToBlockAction} action - The insert image action instance.
|
|
2952
|
+
* @param {RTECodeBlock} target - The code block.
|
|
3090
2953
|
*/
|
|
3091
2954
|
handleAction(action, target) {
|
|
3092
|
-
const
|
|
3093
|
-
|
|
3094
|
-
if (listBlock.blocks.length === 0) {
|
|
3095
|
-
listBlock.parent.apply(new RemoveChildAction(listBlock));
|
|
3096
|
-
}
|
|
2955
|
+
const imageBlock = action.imageBlockToBeInserted;
|
|
2956
|
+
target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
|
|
3097
2957
|
}
|
|
3098
2958
|
}
|
|
3099
2959
|
|
|
3100
2960
|
/**
|
|
3101
|
-
*
|
|
2961
|
+
* The code block DTO class.
|
|
3102
2962
|
*/
|
|
3103
|
-
class
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
* @param {RTEListItemBlock} target - The list item block.
|
|
3109
|
-
*/
|
|
3110
|
-
handleAction(action, target) {
|
|
3111
|
-
target.nodes = target.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
3112
|
-
if (target.nodes.length === 0 && (!target.children || !target.children.length)) {
|
|
3113
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3114
|
-
}
|
|
2963
|
+
class RTECodeBlock extends RTEBlock {
|
|
2964
|
+
constructor(id, content, language) {
|
|
2965
|
+
super(id);
|
|
2966
|
+
this.type = 'code-block';
|
|
2967
|
+
this.nodes = [new RTECodeBlockNode(`${id}-1`, content, language, this)];
|
|
3115
2968
|
}
|
|
3116
|
-
}
|
|
3117
|
-
|
|
3118
|
-
/**
|
|
3119
|
-
* Remove list item nest list block strategy.
|
|
3120
|
-
*/
|
|
3121
|
-
class ListItemRemoveNestListStrategy extends ActionHandleStrategy {
|
|
3122
2969
|
/**
|
|
3123
|
-
*
|
|
2970
|
+
* Converts a VegaRTECodeBlock into an RTECodeBlock.
|
|
3124
2971
|
*
|
|
3125
|
-
* @param {
|
|
3126
|
-
* @
|
|
2972
|
+
* @param {VegaRTECodeBlock} block - The block object
|
|
2973
|
+
* @returns {RTECodeBlock} A RTECodeBlock class
|
|
3127
2974
|
*/
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
if (target.children.length > 1) {
|
|
3131
|
-
target.children = target.children.filter((child) => child !== action.nestListBlockToBeRemoved);
|
|
3132
|
-
}
|
|
3133
|
-
else {
|
|
3134
|
-
target.children = undefined;
|
|
3135
|
-
}
|
|
3136
|
-
}
|
|
2975
|
+
static from(block) {
|
|
2976
|
+
return new RTECodeBlock(block.id, block.content, block.language);
|
|
3137
2977
|
}
|
|
3138
|
-
}
|
|
3139
|
-
|
|
3140
|
-
/**
|
|
3141
|
-
* Replace list item nest list strategy.
|
|
3142
|
-
*/
|
|
3143
|
-
class ListItemReplaceNestListStrategy extends ActionHandleStrategy {
|
|
3144
2978
|
/**
|
|
3145
2979
|
* @inheritDoc
|
|
3146
2980
|
*/
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
2981
|
+
toJSON() {
|
|
2982
|
+
const { language, text } = this.nodes[0];
|
|
2983
|
+
return {
|
|
2984
|
+
id: this.id,
|
|
2985
|
+
type: 'code-block',
|
|
2986
|
+
content: text,
|
|
2987
|
+
language,
|
|
2988
|
+
};
|
|
3152
2989
|
}
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
/**
|
|
3156
|
-
* Insert new paragraph into current list item block at special position.
|
|
3157
|
-
*/
|
|
3158
|
-
class ListItemInsertNewParagraphStrategy extends ActionHandleStrategy {
|
|
3159
2990
|
/**
|
|
3160
2991
|
* @inheritDoc
|
|
3161
2992
|
*/
|
|
3162
|
-
|
|
3163
|
-
|
|
2993
|
+
clone() {
|
|
2994
|
+
const cloneCodeBlock = RTECodeBlock.from(this.toJSON());
|
|
2995
|
+
cloneCodeBlock.parent = this.parent;
|
|
2996
|
+
return cloneCodeBlock;
|
|
3164
2997
|
}
|
|
3165
2998
|
/**
|
|
3166
|
-
*
|
|
2999
|
+
* Apply action to block
|
|
3167
3000
|
*
|
|
3168
|
-
* @param {
|
|
3169
|
-
* @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
|
|
3170
|
-
* @param {RTEListItemBlock} target - The list item block.
|
|
3171
|
-
* @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
|
|
3172
|
-
* position is at the end of the `splitNode`, or it returns the result of splitting the block at the
|
|
3173
|
-
* caret position if it is neither at the start nor at the end.
|
|
3001
|
+
* @param {ModifyContentAction} action - modify content action.
|
|
3174
3002
|
*/
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
newListItem.apply(new AppendChildNodesAction([newBreakNode]));
|
|
3179
|
-
if (this.isCaretPositionAtTextBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
3180
|
-
return this.breakListItemAtEnd(newListItem, target);
|
|
3181
|
-
}
|
|
3182
|
-
else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
3183
|
-
target.parent.apply(new InsertBlocksBeforeAction(target, newListItem));
|
|
3003
|
+
apply(action) {
|
|
3004
|
+
if (action instanceof ModifyContentAction) {
|
|
3005
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3184
3006
|
}
|
|
3185
|
-
|
|
3186
|
-
const
|
|
3187
|
-
|
|
3188
|
-
|
|
3007
|
+
if (action.isFlushable) {
|
|
3008
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
3009
|
+
if (domNode) {
|
|
3010
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
|
|
3011
|
+
if (nodeSubject) {
|
|
3012
|
+
ChangeManager.notify(nodeSubject, {});
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3189
3015
|
}
|
|
3190
|
-
return newListItem;
|
|
3191
3016
|
}
|
|
3192
3017
|
/**
|
|
3193
|
-
*
|
|
3194
|
-
*
|
|
3195
|
-
* @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
|
|
3196
|
-
* @param {RTEListItemBlock} target - The list item block.
|
|
3197
|
-
* @returns {RTEBlock} Returns a `RTEBlock`.
|
|
3018
|
+
* @inheritDoc
|
|
3198
3019
|
*/
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
const currentItemIsEmpty = target.nodes.length === 1 && target.nodes[0].isEmpty();
|
|
3202
|
-
if (target === lastItem && currentItemIsEmpty) {
|
|
3203
|
-
const parentParent = target.parent.parent;
|
|
3204
|
-
if (parentParent['type'] !== 'list-item') {
|
|
3205
|
-
const newParagraph = RTETextBlock.from({
|
|
3206
|
-
id: generateUUID(),
|
|
3207
|
-
type: 'paragraph',
|
|
3208
|
-
nodes: [],
|
|
3209
|
-
});
|
|
3210
|
-
newParagraph.apply(new AppendChildNodesAction(newListItem.nodes));
|
|
3211
|
-
parentParent.apply(new InsertBlocksAfterAction(target.parent, newParagraph));
|
|
3212
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3213
|
-
return newParagraph;
|
|
3214
|
-
}
|
|
3215
|
-
else {
|
|
3216
|
-
parentParent.parent.apply(new InsertBlocksAfterAction(parentParent, newListItem));
|
|
3217
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3218
|
-
}
|
|
3219
|
-
}
|
|
3220
|
-
else {
|
|
3221
|
-
target.parent.apply(new InsertBlocksAfterAction(target, newListItem));
|
|
3222
|
-
}
|
|
3223
|
-
return newListItem;
|
|
3020
|
+
isNotEmpty() {
|
|
3021
|
+
return !!this.nodes.length;
|
|
3224
3022
|
}
|
|
3225
3023
|
/**
|
|
3226
|
-
*
|
|
3227
|
-
*
|
|
3228
|
-
* @param {RTETextNode} needCopedNode - The node that needed to be copied to
|
|
3229
|
-
* @returns {RTETextNode} Returns a `RTETextNode`.
|
|
3230
|
-
*/
|
|
3231
|
-
copyInlineStyleToNewNode(needCopedNode) {
|
|
3232
|
-
const textNode = needCopedNode.cloneWithText('');
|
|
3233
|
-
// The link annotation doesn't need to inherit
|
|
3234
|
-
textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
3235
|
-
return textNode;
|
|
3236
|
-
}
|
|
3237
|
-
}
|
|
3238
|
-
|
|
3239
|
-
/**
|
|
3240
|
-
* Insert image node to list item block strategy.
|
|
3241
|
-
*/
|
|
3242
|
-
class ListItemInsertImageStrategy extends ActionHandleStrategy {
|
|
3243
|
-
/**
|
|
3244
|
-
* The image node can not insert into list item block, so insert image after parent list block.
|
|
3245
|
-
*
|
|
3246
|
-
* @param {InsertImageToBlockAction} action - The action instance.
|
|
3247
|
-
* @param {RTEListItemBlock} target - The list item block.
|
|
3248
|
-
*/
|
|
3249
|
-
handleAction(action, target) {
|
|
3250
|
-
target.parent.apply(action);
|
|
3251
|
-
}
|
|
3252
|
-
}
|
|
3253
|
-
|
|
3254
|
-
/**
|
|
3255
|
-
* List item block
|
|
3256
|
-
*/
|
|
3257
|
-
class RTEListItemBlock extends RTETextBlock {
|
|
3258
|
-
constructor(id, children) {
|
|
3259
|
-
super(id, 'list-item');
|
|
3260
|
-
this.children = [];
|
|
3261
|
-
this.children = children;
|
|
3262
|
-
}
|
|
3263
|
-
/**
|
|
3264
|
-
* Converts a VegaRTEListItemBlock object to an RTEListItemBlock
|
|
3265
|
-
*
|
|
3266
|
-
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
|
|
3267
|
-
* @returns {RTEListItemBlock} Return an instance of `RTEListItemBlock`
|
|
3268
|
-
*/
|
|
3269
|
-
static from(block) {
|
|
3270
|
-
const listItemBlock = new RTEListItemBlock(block.id);
|
|
3271
|
-
listItemBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock));
|
|
3272
|
-
if (block.children) {
|
|
3273
|
-
listItemBlock.children = block.children.map((child) => {
|
|
3274
|
-
const listBlock = RTEListBlock.from(child);
|
|
3275
|
-
listBlock.parent = listItemBlock;
|
|
3276
|
-
return listBlock;
|
|
3277
|
-
});
|
|
3278
|
-
}
|
|
3279
|
-
const { annotations } = block;
|
|
3280
|
-
if (annotations) {
|
|
3281
|
-
Object.entries(annotations).forEach(([type, value]) => {
|
|
3282
|
-
const item = this.createAnnotationEntity(type, value);
|
|
3283
|
-
if (isNonNullable(item)) {
|
|
3284
|
-
listItemBlock.annotationMap.set(...item);
|
|
3285
|
-
}
|
|
3286
|
-
});
|
|
3287
|
-
}
|
|
3288
|
-
return listItemBlock;
|
|
3289
|
-
}
|
|
3290
|
-
/**
|
|
3291
|
-
* @inheritDoc
|
|
3292
|
-
*/
|
|
3293
|
-
toJSON() {
|
|
3294
|
-
var _a;
|
|
3295
|
-
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()) });
|
|
3296
|
-
}
|
|
3297
|
-
/**
|
|
3298
|
-
* @inheritDoc
|
|
3299
|
-
*/
|
|
3300
|
-
cloneWithNodes(nodes) {
|
|
3301
|
-
const block = new RTEListItemBlock(generateUUID());
|
|
3302
|
-
block.nodes = [];
|
|
3303
|
-
block.apply(new AppendChildNodesAction(nodes));
|
|
3304
|
-
return block;
|
|
3305
|
-
}
|
|
3306
|
-
/**
|
|
3307
|
-
* @inheritDoc
|
|
3308
|
-
*/
|
|
3309
|
-
getLastNode() {
|
|
3310
|
-
if (this.children && this.children.length > 0) {
|
|
3311
|
-
const childListBlock = this.children[this.children.length - 1];
|
|
3312
|
-
return childListBlock.getLastNode();
|
|
3313
|
-
}
|
|
3314
|
-
return super.getLastNode();
|
|
3315
|
-
}
|
|
3316
|
-
/**
|
|
3317
|
-
* Create a new list item block.
|
|
3318
|
-
*
|
|
3319
|
-
* @returns {RTEListItemBlock} - A list item block.
|
|
3320
|
-
*/
|
|
3321
|
-
createNewListItem() {
|
|
3322
|
-
return new RTEListItemBlock(generateUUID());
|
|
3323
|
-
}
|
|
3324
|
-
/**
|
|
3325
|
-
* @inheritDoc
|
|
3326
|
-
*/
|
|
3327
|
-
clone() {
|
|
3328
|
-
var _a;
|
|
3329
|
-
const block = new RTEListItemBlock(this.id);
|
|
3330
|
-
block.nodes = this.nodes.map((node) => {
|
|
3331
|
-
const clonedNode = node.clone();
|
|
3332
|
-
clonedNode.parentBlock = block;
|
|
3333
|
-
return clonedNode;
|
|
3334
|
-
});
|
|
3335
|
-
block.annotationMap = super.cloneAnnotations();
|
|
3336
|
-
block.children = (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((child) => {
|
|
3337
|
-
const clonedChild = child.clone();
|
|
3338
|
-
clonedChild.parent = block;
|
|
3339
|
-
return clonedChild;
|
|
3340
|
-
});
|
|
3341
|
-
block.parent = this.parent;
|
|
3342
|
-
return block;
|
|
3343
|
-
}
|
|
3344
|
-
}
|
|
3345
|
-
(() => {
|
|
3346
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_BLOCK_CONTENT, RTEListItemBlock.name, new ListItemDeleteTextContentStrategy());
|
|
3347
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new BlockInsertLineBreakStrategy());
|
|
3348
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTEListItemBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
|
|
3349
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEListItemBlock.name, new ListItemRemoveNodeStrategy());
|
|
3350
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_NEST_LIST, RTEListItemBlock.name, new ListItemRemoveNestListStrategy());
|
|
3351
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEListItemBlock.name, new BlockAppendNodesStrategy());
|
|
3352
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTEListItemBlock.name, new BlockSplitWithTextNodeStrategy());
|
|
3353
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_CHILD_NODES, RTEListItemBlock.name, new BlockReplaceNodesStrategy());
|
|
3354
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.REPLACE_NEST_LIST, RTEListItemBlock.name, new ListItemReplaceNestListStrategy());
|
|
3355
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTEListItemBlock.name, new BlockMergeNodesStrategy());
|
|
3356
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.BREAK_SINGLE_BLOCK, RTEListItemBlock.name, new ListItemInsertNewParagraphStrategy());
|
|
3357
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListItemBlock.name, new ListItemInsertImageStrategy());
|
|
3358
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_NODES_BEFORE, RTEListItemBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
3359
|
-
})();
|
|
3360
|
-
|
|
3361
|
-
/**
|
|
3362
|
-
* Insert block array at the front of the block strategy.
|
|
3363
|
-
*/
|
|
3364
|
-
class BlockInsertBlocksBeforeStrategy extends ActionHandleStrategy {
|
|
3365
|
-
/**
|
|
3366
|
-
* @inheritDoc
|
|
3367
|
-
*/
|
|
3368
|
-
handleAction(action, target) {
|
|
3369
|
-
this.replaceBlockWithBlocks(target, action.referBlock, [
|
|
3370
|
-
...action.blocksToBeInserted,
|
|
3371
|
-
action.referBlock,
|
|
3372
|
-
]);
|
|
3373
|
-
}
|
|
3374
|
-
/**
|
|
3375
|
-
* Replaces a specific block with an array of blocks within a RTEContentBlock array.
|
|
3376
|
-
*
|
|
3377
|
-
* @param {RTEListBlock|VegaRTEContent} target - The list block or the VegaRTEContent instance.
|
|
3378
|
-
* @param {RTEBlock} referBlock - Used as a reference block to identify the block that needs to be replaced in the `blocks` array.
|
|
3379
|
-
* @param {RTEBlock[]} blocks - An array of RTEBlock objects that you want to replace the `referBlock` with in the `blocks` array.
|
|
3380
|
-
*/
|
|
3381
|
-
replaceBlockWithBlocks(target, referBlock, blocks) {
|
|
3382
|
-
if (target.blocks) {
|
|
3383
|
-
blocks.forEach((block) => {
|
|
3384
|
-
block.parent = target;
|
|
3385
|
-
});
|
|
3386
|
-
const arrayFixed = target.blocks;
|
|
3387
|
-
target.blocks = arrayFixed.flatMap((block) => {
|
|
3388
|
-
if (block === referBlock) {
|
|
3389
|
-
return blocks;
|
|
3390
|
-
}
|
|
3391
|
-
else {
|
|
3392
|
-
return block;
|
|
3393
|
-
}
|
|
3394
|
-
});
|
|
3395
|
-
}
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
|
|
3399
|
-
/**
|
|
3400
|
-
* Insert block array at the behind of the block strategy.
|
|
3401
|
-
*/
|
|
3402
|
-
class BlockInsertBlocksAfterStrategy extends BlockInsertBlocksBeforeStrategy {
|
|
3403
|
-
/**
|
|
3404
|
-
* @inheritDoc
|
|
3405
|
-
*/
|
|
3406
|
-
handleAction(action, target) {
|
|
3407
|
-
this.replaceBlockWithBlocks(target, action.referBlock, [
|
|
3408
|
-
action.referBlock,
|
|
3409
|
-
...action.blocksToBeInserted,
|
|
3410
|
-
]);
|
|
3411
|
-
}
|
|
3412
|
-
}
|
|
3413
|
-
|
|
3414
|
-
/**
|
|
3415
|
-
* Append new block array to list block or VegaRTEContent instance strategy.
|
|
3416
|
-
*/
|
|
3417
|
-
class BlockAppendBlocksStrategy extends ActionHandleStrategy {
|
|
3418
|
-
/**
|
|
3419
|
-
* @inheritDoc
|
|
3420
|
-
*/
|
|
3421
|
-
handleAction(action, target) {
|
|
3422
|
-
const newBlocks = action.entityToBeAppended;
|
|
3423
|
-
if (target.blocks) {
|
|
3424
|
-
newBlocks.forEach((block) => {
|
|
3425
|
-
block.parent = target;
|
|
3426
|
-
});
|
|
3427
|
-
const arrayFixed = target.blocks;
|
|
3428
|
-
target.blocks = arrayFixed.concat(newBlocks);
|
|
3429
|
-
}
|
|
3430
|
-
}
|
|
3431
|
-
}
|
|
3432
|
-
|
|
3433
|
-
/**
|
|
3434
|
-
* Delete the nest list block action
|
|
3435
|
-
*
|
|
3436
|
-
* @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
|
|
3437
|
-
*/
|
|
3438
|
-
class RemoveNestListAction extends ModifyContentAction {
|
|
3439
|
-
constructor(childList) {
|
|
3440
|
-
super();
|
|
3441
|
-
this.type = ModifyContentActionType.DELETE_NEST_LIST;
|
|
3442
|
-
this.nestListBlockToBeRemoved = childList;
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
|
|
3446
|
-
/**
|
|
3447
|
-
* List block or VegaRTEContent remove child block strategy.
|
|
3448
|
-
*/
|
|
3449
|
-
class BlockRemoveChildBlockStrategy extends ActionHandleStrategy {
|
|
3450
|
-
/**
|
|
3451
|
-
* @inheritDoc
|
|
3452
|
-
*/
|
|
3453
|
-
handleAction(action, target) {
|
|
3454
|
-
const blockToBeRemoved = action.entityToBeRemoved;
|
|
3455
|
-
if (target.blocks) {
|
|
3456
|
-
target.blocks = target.blocks.filter((block) => block !== blockToBeRemoved);
|
|
3457
|
-
}
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3460
|
-
|
|
3461
|
-
/**
|
|
3462
|
-
* List remove list item strategy.
|
|
3463
|
-
*/
|
|
3464
|
-
class ListRemoveListItemStrategy extends BlockRemoveChildBlockStrategy {
|
|
3465
|
-
/**
|
|
3466
|
-
* Remove the list item, check the list item and remove self if the list item is empty.
|
|
3467
|
-
*
|
|
3468
|
-
* @param {RemoveChildAction} action - The remove action instance.
|
|
3469
|
-
* @param {RTEListBlock} target - The list block.
|
|
3470
|
-
*/
|
|
3471
|
-
handleAction(action, target) {
|
|
3472
|
-
super.handleAction(action, target);
|
|
3473
|
-
const parent = target.parent;
|
|
3474
|
-
if (target.blocks.length === 0 && parent) {
|
|
3475
|
-
// The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
|
|
3476
|
-
if (parent['type'] === 'list-item') {
|
|
3477
|
-
parent.apply(new RemoveNestListAction(target));
|
|
3478
|
-
}
|
|
3479
|
-
else {
|
|
3480
|
-
parent.apply(new RemoveChildAction(target));
|
|
3481
|
-
}
|
|
3482
|
-
}
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
|
-
|
|
3486
|
-
/**
|
|
3487
|
-
* Convert the selected blocks to list strategy.
|
|
3488
|
-
*/
|
|
3489
|
-
class ListTransformToListStrategy extends ActionHandleStrategy {
|
|
3490
|
-
/**
|
|
3491
|
-
* @inheritDoc
|
|
3492
|
-
*/
|
|
3493
|
-
handleAction(action, target) {
|
|
3494
|
-
const selectedBlocks = action.selectedBlocks;
|
|
3495
|
-
const bulletList = target.parent.createList(action.listType);
|
|
3496
|
-
const isSameList = selectedBlocks.every((block) => block.parent === target);
|
|
3497
|
-
if (isSameList) {
|
|
3498
|
-
// Select one or more list items belonging to the same list, and all items in this list should be updated
|
|
3499
|
-
bulletList.apply(new AppendChildNodesAction(target.blocks));
|
|
3500
|
-
target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
|
|
3501
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3502
|
-
selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new SyncUpSelectionAction())));
|
|
3503
|
-
}
|
|
3504
|
-
else {
|
|
3505
|
-
const listItems = action.selectedBlocks.map((block) => target.parent.toListItem(block));
|
|
3506
|
-
bulletList.apply(new AppendChildNodesAction(listItems));
|
|
3507
|
-
target.parent.apply(new InsertBlocksAfterAction(target, bulletList));
|
|
3508
|
-
action.selectedBlocks.forEach((block) => {
|
|
3509
|
-
block.parent.apply(new RemoveChildAction(block));
|
|
3510
|
-
});
|
|
3511
|
-
if (target.blocks.length === 0) {
|
|
3512
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3513
|
-
}
|
|
3514
|
-
}
|
|
3515
|
-
}
|
|
3516
|
-
}
|
|
3517
|
-
|
|
3518
|
-
/**
|
|
3519
|
-
* Convert the selected list block to paragraph strategy.
|
|
3520
|
-
*/
|
|
3521
|
-
class ListTransformToParagraphStrategy extends ActionHandleStrategy {
|
|
3522
|
-
/**
|
|
3523
|
-
* @inheritDoc
|
|
3524
|
-
*/
|
|
3525
|
-
handleAction(action, target) {
|
|
3526
|
-
let isSelectedFirstBlock = false;
|
|
3527
|
-
let isSelectedLastBlock = false;
|
|
3528
|
-
const selectedBlocks = action.selectedBlocks;
|
|
3529
|
-
const currentParagraph = selectedBlocks.map((block) => {
|
|
3530
|
-
block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
3531
|
-
if (block === target.blocks[0])
|
|
3532
|
-
isSelectedFirstBlock = true;
|
|
3533
|
-
if (block === target.blocks[target.blocks.length - 1])
|
|
3534
|
-
isSelectedLastBlock = true;
|
|
3535
|
-
return this.toParagraph(block);
|
|
3536
|
-
});
|
|
3537
|
-
if (isSelectedFirstBlock) {
|
|
3538
|
-
target.parent.apply(new InsertBlocksBeforeAction(target, ...currentParagraph));
|
|
3539
|
-
}
|
|
3540
|
-
else if (isSelectedLastBlock) {
|
|
3541
|
-
target.parent.apply(new InsertBlocksAfterAction(target, ...currentParagraph));
|
|
3542
|
-
}
|
|
3543
|
-
else {
|
|
3544
|
-
const startIndex = target.blocks.indexOf(selectedBlocks[0]);
|
|
3545
|
-
const lastIndex = target.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
|
|
3546
|
-
const firstBulletList = target.parent.createList(target.type);
|
|
3547
|
-
firstBulletList.apply(new AppendChildNodesAction(target.blocks.slice(0, startIndex)));
|
|
3548
|
-
const lastBulletList = target.parent.createList(target.type);
|
|
3549
|
-
lastBulletList.apply(new AppendChildNodesAction(target.blocks.slice(lastIndex + 1)));
|
|
3550
|
-
target.parent.apply(new InsertBlocksBeforeAction(target, firstBulletList, ...currentParagraph, lastBulletList));
|
|
3551
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3552
|
-
}
|
|
3553
|
-
selectedBlocks.map((block) => {
|
|
3554
|
-
target.apply(new RemoveChildAction(block));
|
|
3555
|
-
});
|
|
3556
|
-
if (target.blocks.length === 0) {
|
|
3557
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
3558
|
-
}
|
|
3559
|
-
}
|
|
3560
|
-
/**
|
|
3561
|
-
* Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
|
|
3562
|
-
*
|
|
3563
|
-
* @param {RTEListItemBlock} block - The block that will be covered
|
|
3564
|
-
* @returns {RTETextBlock} Returns a `RTETextBlock`.
|
|
3565
|
-
*/
|
|
3566
|
-
toParagraph(block) {
|
|
3567
|
-
const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
|
|
3568
|
-
textBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
3569
|
-
textBlock['annotationMap'] = block['annotationMap'];
|
|
3570
|
-
return textBlock;
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
|
|
3574
|
-
/**
|
|
3575
|
-
* Insert image to list block strategy.
|
|
3576
|
-
*/
|
|
3577
|
-
class ListInsertImageStrategy extends ActionHandleStrategy {
|
|
3578
|
-
/**
|
|
3579
|
-
* Insert image block at behind of the list item block.
|
|
3580
|
-
*
|
|
3581
|
-
* @param {InsertImageToBlockAction} action - The insert image action instance.
|
|
3582
|
-
* @param {RTEListBlock} target - The list block.
|
|
3583
|
-
*/
|
|
3584
|
-
handleAction(action, target) {
|
|
3585
|
-
const imageBlock = action.imageBlockToBeInserted;
|
|
3586
|
-
if (target.parent['type'] !== 'list-item') {
|
|
3587
|
-
target.parent.apply(new InsertBlocksAfterAction(target, imageBlock));
|
|
3588
|
-
}
|
|
3589
|
-
else {
|
|
3590
|
-
target.parent.apply(action);
|
|
3591
|
-
}
|
|
3592
|
-
}
|
|
3593
|
-
}
|
|
3594
|
-
|
|
3595
|
-
/**
|
|
3596
|
-
* List block
|
|
3597
|
-
*/
|
|
3598
|
-
class RTEListBlock extends RTEBlock {
|
|
3599
|
-
constructor(id, type) {
|
|
3600
|
-
super(id);
|
|
3601
|
-
this.type = 'bullet-list';
|
|
3602
|
-
this.blocks = [];
|
|
3603
|
-
this.type = type;
|
|
3604
|
-
}
|
|
3605
|
-
/**
|
|
3606
|
-
* Converts a VegaRTEListBlock object to an RTEListBlock
|
|
3607
|
-
*
|
|
3608
|
-
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
|
|
3609
|
-
* @returns {RTEListBlock} Return an instance of `RTEListBlock`
|
|
3610
|
-
*/
|
|
3611
|
-
static from(block) {
|
|
3612
|
-
const listBlock = new RTEListBlock(block.id, block.type);
|
|
3613
|
-
listBlock.blocks = block.blocks.map((item) => {
|
|
3614
|
-
const listItemBlock = RTEListItemBlock.from(item);
|
|
3615
|
-
listItemBlock.parent = listBlock;
|
|
3616
|
-
return listItemBlock;
|
|
3617
|
-
});
|
|
3618
|
-
return listBlock;
|
|
3619
|
-
}
|
|
3620
|
-
/**
|
|
3621
|
-
* @inheritDoc
|
|
3622
|
-
*/
|
|
3623
|
-
toJSON() {
|
|
3624
|
-
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
3625
|
-
}
|
|
3626
|
-
/**
|
|
3627
|
-
* @inheritDoc
|
|
3628
|
-
*/
|
|
3629
|
-
isNotEmpty() {
|
|
3630
|
-
return this.blocks.length > 0;
|
|
3631
|
-
}
|
|
3632
|
-
/**
|
|
3633
|
-
* @inheritDoc
|
|
3024
|
+
* @inheritDoc
|
|
3634
3025
|
*/
|
|
3635
3026
|
getLastNode() {
|
|
3636
|
-
return this.
|
|
3637
|
-
}
|
|
3638
|
-
/**
|
|
3639
|
-
* @inheritDoc
|
|
3640
|
-
*/
|
|
3641
|
-
clone() {
|
|
3642
|
-
const clonedListBlock = new RTEListBlock(this.id, this.type);
|
|
3643
|
-
clonedListBlock.blocks = this.blocks.map((item) => {
|
|
3644
|
-
const clonedListItemBlock = item.clone();
|
|
3645
|
-
clonedListItemBlock.parent = clonedListBlock;
|
|
3646
|
-
return clonedListItemBlock;
|
|
3647
|
-
});
|
|
3648
|
-
clonedListBlock.annotationMap = super.cloneAnnotations();
|
|
3649
|
-
clonedListBlock.parent = this.parent;
|
|
3650
|
-
return clonedListBlock;
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
|
-
(() => {
|
|
3654
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTEListBlock.name, new ListRemoveListItemStrategy());
|
|
3655
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_BLOCKS_BEFORE, RTEListBlock.name, new BlockInsertBlocksBeforeStrategy());
|
|
3656
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_BLOCKS_AFTER, RTEListBlock.name, new BlockInsertBlocksAfterStrategy());
|
|
3657
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.APPEND_CHILD_NODES, RTEListBlock.name, new BlockAppendBlocksStrategy());
|
|
3658
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTEListBlock.name, new ListTransformToListStrategy());
|
|
3659
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, RTEListBlock.name, new ListTransformToParagraphStrategy());
|
|
3660
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTEListBlock.name, new ListInsertImageStrategy());
|
|
3661
|
-
})();
|
|
3662
|
-
|
|
3663
|
-
/**
|
|
3664
|
-
* Class representing the content state of the rich text editor.
|
|
3665
|
-
*/
|
|
3666
|
-
class VegaRTEContent {
|
|
3667
|
-
constructor(blocks) {
|
|
3668
|
-
blocks.forEach((block) => {
|
|
3669
|
-
block.parent = this;
|
|
3670
|
-
});
|
|
3671
|
-
this.blocks = blocks;
|
|
3672
|
-
}
|
|
3673
|
-
/**
|
|
3674
|
-
* Converts a JSON array of blocks to a class array of RTEContentBlock.
|
|
3675
|
-
*
|
|
3676
|
-
* @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
|
|
3677
|
-
* @returns {VegaRTEContent} The converted array of RTEContentBlock.
|
|
3678
|
-
*/
|
|
3679
|
-
static fromJSON(value) {
|
|
3680
|
-
const blocks = value.map((block) => {
|
|
3681
|
-
switch (block.type) {
|
|
3682
|
-
case 'paragraph':
|
|
3683
|
-
case 'title':
|
|
3684
|
-
case 'subtitle':
|
|
3685
|
-
case 'heading-1':
|
|
3686
|
-
case 'heading-2':
|
|
3687
|
-
case 'heading-3': {
|
|
3688
|
-
return RTETextBlock.from(block);
|
|
3689
|
-
}
|
|
3690
|
-
case 'image':
|
|
3691
|
-
return RTEImageBlock.from(block);
|
|
3692
|
-
case 'bullet-list':
|
|
3693
|
-
case 'number-list':
|
|
3694
|
-
return RTEListBlock.from(block);
|
|
3695
|
-
default: {
|
|
3696
|
-
throw new Error(`[Vega] Unknown block type: ${block.type}`);
|
|
3697
|
-
}
|
|
3698
|
-
}
|
|
3699
|
-
});
|
|
3700
|
-
return new VegaRTEContent(blocks);
|
|
3027
|
+
return this.nodes[0];
|
|
3701
3028
|
}
|
|
3702
3029
|
/**
|
|
3703
|
-
*
|
|
3030
|
+
* The code block is selected or not.
|
|
3704
3031
|
*
|
|
3705
|
-
* @returns {
|
|
3032
|
+
* @returns {boolean} - The boolean result.
|
|
3706
3033
|
*/
|
|
3707
|
-
|
|
3708
|
-
return
|
|
3709
|
-
{
|
|
3710
|
-
id: generateUUID(),
|
|
3711
|
-
type: 'paragraph',
|
|
3712
|
-
nodes: [
|
|
3713
|
-
{
|
|
3714
|
-
id: generateUUID(),
|
|
3715
|
-
type: 'text',
|
|
3716
|
-
text: '',
|
|
3717
|
-
},
|
|
3718
|
-
],
|
|
3719
|
-
},
|
|
3720
|
-
]);
|
|
3721
|
-
}
|
|
3722
|
-
/**
|
|
3723
|
-
* Clones the content state.
|
|
3724
|
-
*
|
|
3725
|
-
* @param {boolean} deep - If true, performs a deep clone of the content state.
|
|
3726
|
-
* @returns {VegaRTEContent} The cloned content state.
|
|
3727
|
-
*/
|
|
3728
|
-
clone(deep = false) {
|
|
3729
|
-
return deep
|
|
3730
|
-
? new VegaRTEContent(this.blocks.map((block) => block.clone()))
|
|
3731
|
-
: new VegaRTEContent([...this.blocks]);
|
|
3732
|
-
}
|
|
3733
|
-
/**
|
|
3734
|
-
* Converts the content state to a JSON array of blocks.
|
|
3735
|
-
*
|
|
3736
|
-
* @returns {VegaRTEContentBlock[]} The JSON array of blocks.
|
|
3737
|
-
*/
|
|
3738
|
-
toJSON() {
|
|
3739
|
-
return this.blocks.map((block) => block.toJSON());
|
|
3740
|
-
}
|
|
3741
|
-
/**
|
|
3742
|
-
* Internal method to add the block item, remove the block item
|
|
3743
|
-
*
|
|
3744
|
-
* @param {ModifyContentAction} action - Modify content action
|
|
3745
|
-
*/
|
|
3746
|
-
apply(action) {
|
|
3747
|
-
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3748
|
-
}
|
|
3749
|
-
/**
|
|
3750
|
-
* Convert text to list.
|
|
3751
|
-
*
|
|
3752
|
-
* @param {RTETextBlock} block - block
|
|
3753
|
-
* @returns {RTEListItemBlock} list item block dto.
|
|
3754
|
-
*/
|
|
3755
|
-
toListItem(block) {
|
|
3756
|
-
block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
3757
|
-
const listItemBlock = new RTEListItemBlock(generateUUID());
|
|
3758
|
-
listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
3759
|
-
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
3760
|
-
return listItemBlock;
|
|
3761
|
-
}
|
|
3762
|
-
/**
|
|
3763
|
-
* create list.
|
|
3764
|
-
*
|
|
3765
|
-
* @param {ListType} type - type
|
|
3766
|
-
* @returns {RTEListBlock} list block dto.
|
|
3767
|
-
*/
|
|
3768
|
-
createList(type) {
|
|
3769
|
-
return new RTEListBlock(generateUUID(), type);
|
|
3770
|
-
}
|
|
3771
|
-
/**
|
|
3772
|
-
* Finds a node by its ID in the content.
|
|
3773
|
-
*
|
|
3774
|
-
* @param {string} id - The ID of the node to find.
|
|
3775
|
-
* @returns {Nullable<RTENode>} The found node or null if not found.
|
|
3776
|
-
*/
|
|
3777
|
-
findNodeById(id) {
|
|
3778
|
-
return this.findNodeInBlocksById(id, this.blocks);
|
|
3779
|
-
}
|
|
3780
|
-
/**
|
|
3781
|
-
* Recursively searches for a node by its ID in the given blocks.
|
|
3782
|
-
*
|
|
3783
|
-
* @param {string} id - The ID of the node to find.
|
|
3784
|
-
* @param {RTEContentBlock[]} blocks - The blocks to search within.
|
|
3785
|
-
* @returns {Nullable<RTENode>} The found node or null if not found.
|
|
3786
|
-
*/
|
|
3787
|
-
findNodeInBlocksById(id, blocks) {
|
|
3788
|
-
for (const block of blocks) {
|
|
3789
|
-
if ('nodes' in block) {
|
|
3790
|
-
for (const node of block.nodes) {
|
|
3791
|
-
if (node.id === id) {
|
|
3792
|
-
return node;
|
|
3793
|
-
}
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3796
|
-
if (block instanceof RTEListItemBlock && block.children) {
|
|
3797
|
-
for (const cBlock of block.children) {
|
|
3798
|
-
const foundNode = this.findNodeInBlocksById(id, cBlock.blocks);
|
|
3799
|
-
if (foundNode) {
|
|
3800
|
-
return foundNode;
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
}
|
|
3804
|
-
if (block instanceof RTEListBlock && block.blocks) {
|
|
3805
|
-
const foundNode = this.findNodeInBlocksById(id, block.blocks);
|
|
3806
|
-
if (foundNode) {
|
|
3807
|
-
return foundNode;
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3810
|
-
}
|
|
3811
|
-
return null;
|
|
3034
|
+
isSelected() {
|
|
3035
|
+
return this.nodes[0].annotationMap.has(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
3812
3036
|
}
|
|
3813
3037
|
}
|
|
3814
3038
|
(() => {
|
|
3815
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.
|
|
3816
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.
|
|
3817
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.
|
|
3818
|
-
ActionHandleStrategyRegistry.register(ModifyContentActionType.
|
|
3039
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CODE_BLOCK, RTECodeBlock.name, new CodeBlockRemoveSelfStrategy());
|
|
3040
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_CHILD, RTECodeBlock.name, new BlockRemoveNodeStrategy());
|
|
3041
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.SWITCH_OUT_FROM_CODE_BLOCK, RTECodeBlock.name, new SwitchOutFromCodeBlockStrategy());
|
|
3042
|
+
ActionHandleStrategyRegistry.register(ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTECodeBlock.name, new CodeBlockInsertImageStrategy());
|
|
3819
3043
|
})();
|
|
3044
|
+
RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element';
|
|
3820
3045
|
|
|
3821
|
-
export {
|
|
3046
|
+
export { IndentAnnotation as $, ActionHandleStrategy as A, BlockDeleteNodeContentStrategy as B, ImageAnnotation as C, SelectionChangeAction as D, TextColorAnnotation as E, RTE_TEXT_COLORS as F, RTECodeBlockNode as G, AnnotationAction as H, InsertBlocksAfterAction as I, BoldAnnotationAction as J, ItalicAnnotation as K, LinkAnnotationAction as L, ModifyContentAction as M, NodeAnnotationTypeEnum as N, UnderlineAnnotation as O, TextStyleAnnotationAction as P, TextStyleAnnotation as Q, RemoveChildAction as R, SplitBlockWithNodeAction as S, TextSplittableAction as T, UpdateCodeBlockAction as U, BoldAnnotation as V, BlockAnnotationTypeEnum as W, ClearFormattingAnnotationAction as X, CodeAnnotationAction as Y, ZERO_WIDTH_SPACE as Z, StrikethroughAnnotation as _, RTEImageNode as a, HorizontalAlignmentAnnotation as a0, UpdateTextAction as a1, MergeTwoBlocksNodesAction as a2, ReplaceChildNodesAction as b, AppendChildNodesAction as c, RTETextBlock as d, InsertBlocksBeforeAction as e, ModifyContentActionType as f, RTETextNode as g, BlockReplaceNodeWithNodesStrategy as h, RTEBlock as i, ActionHandleStrategyRegistry as j, BlockMergeNodesStrategy as k, BlockRemoveNodeStrategy as l, BlockAppendNodesStrategy as m, BlockReplaceNodesStrategy as n, BlockInsertNodesBeforeNodeStrategy as o, BlockDeleteTextContentStrategy as p, BlockInsertLineBreakStrategy as q, BlockInsertLineBreakWithBlocksStrategy as r, BlockSplitWithTextNodeStrategy as s, SyncUpSelectionAction as t, RTECodeBlock as u, RTENode as v, stateEntityRenderingRegistry as w, BlockAnnotation as x, NodeAnnotation as y, InternalAnnotationTypeEnum as z };
|