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