@globalpayments/vega 2.67.0 → 2.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-ab28f910.js → app-globals-f7106a22.js} +15 -14
- package/dist/cjs/{child-nodes-event-prevent-slimmer-eb803b14.js → child-nodes-event-prevent-slimmer-f8840f1b.js} +1 -1
- package/dist/cjs/{code-block-ab97a0a0.js → code-block-39074880.js} +514 -319
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-5630341e.js → component-value-history-controller-slimmer.abstract-ddedf543.js} +2 -2
- package/dist/cjs/{design-token-847739f1.js → design-token-e14a4e66.js} +1 -1
- package/dist/cjs/{dto-renderer-manager-d0f0f2c0.js → dto-renderer-manager-b7969d6c.js} +1587 -1563
- package/dist/cjs/{element-appender-slimmer-aead9bbb.js → element-appender-slimmer-7ee27ab3.js} +5 -5
- package/dist/cjs/{event-emit-slimmer-d21a0935.js → event-emit-slimmer-7afe8d78.js} +1 -1
- package/dist/cjs/{token-extension-aa8d5cce.js → function-extension-f0e845f2.js} +1019 -96
- package/dist/cjs/{image-annotation-action-d84de785.js → image-annotation-action-7f0626c8.js} +15 -25
- package/dist/cjs/index.cjs.js +36 -24
- package/dist/cjs/{internal-vega-event-manager-4d1ce667.js → internal-vega-event-manager-45d451de.js} +5 -2
- package/dist/cjs/{language-extension-d257e65d.js → language-extension-d0103d1a.js} +5 -5
- package/dist/cjs/loader.cjs.js +8 -8
- package/dist/cjs/{public-rules-d2b9b8f0.js → public-rules-8b67eaba.js} +3 -3
- package/dist/cjs/{range-d610028e.js → range-002671b6.js} +1 -1
- package/dist/cjs/{responsive-format-facade-71e7b74c.js → responsive-format-facade-347db035.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-a8fe5f50.js → rich-text-editor-required-rule-5392bd8a.js} +1 -1
- package/dist/cjs/{style-formatter-6facb42b.js → style-formatter-0a09f0dd.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +7 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-banner.cjs.entry.js +2 -2
- package/dist/cjs/vega-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-circle.cjs.entry.js +9 -9
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-link.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-calendar_4.cjs.entry.js +307 -269
- package/dist/cjs/vega-card.cjs.entry.js +7 -7
- package/dist/cjs/vega-carousel.cjs.entry.js +7 -7
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +9 -9
- package/dist/cjs/vega-code-block.cjs.entry.js +6 -6
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +12 -12
- package/dist/cjs/vega-dialog_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-divider.cjs.entry.js +7 -7
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +24 -5
- package/dist/cjs/vega-file-uploader.cjs.entry.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-flex.cjs.entry.js +8 -8
- package/dist/cjs/vega-font.cjs.entry.js +7 -7
- package/dist/cjs/vega-form.cjs.entry.js +3 -3
- package/dist/cjs/vega-grid.cjs.entry.js +7 -7
- package/dist/cjs/vega-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-passcode.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +38 -14
- package/dist/cjs/vega-input.cjs.entry.js +14 -3
- package/dist/cjs/vega-item-toggle.cjs.entry.js +2 -2
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +11 -11
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +7 -7
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +2 -2
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +93 -16
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +107 -54
- package/dist/cjs/vega-segment-control.cjs.entry.js +2 -2
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +10 -10
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_8.cjs.entry.js +11 -11
- package/dist/cjs/vega-textarea.cjs.entry.js +24 -4
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega.cjs.js +8 -8
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/calendar-event-sorter.js +3 -3
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/layout/day-view-timed-event-layout-column.js +1 -1
- package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +3 -4
- package/dist/collection/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.js +11 -3
- package/dist/collection/components/vega-field-label/vega-field-label.js +42 -0
- package/dist/collection/components/vega-input/vega-input.js +48 -2
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-renderer.js +16 -5
- package/dist/collection/components/vega-input-select/vega-input-select.css +2 -44
- package/dist/collection/components/vega-input-select/vega-input-select.js +81 -1
- package/dist/collection/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-extensions-styles-controller.js +60 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +7 -1
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.js +17 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor-registry.js +61 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor.abstract.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +30 -6
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +10 -3
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/paste-content-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/annotation-style.js +87 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +27 -9
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +1 -12
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +14 -5
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +7 -37
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +14 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +19 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +44 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +51 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-new-paragraph-interceptor.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-paste-content-interceptor.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/function-block-insert-paragraph-strategy.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/paste-plain-text-strategy.js +68 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/actions/insert-function-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/actions/paste-plain-text-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +97 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.js +73 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-node.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +75 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +71 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.js +5 -6
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/public-api.js +8 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +9 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +0 -12
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +12 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +30 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +10 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +2 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +32 -2
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-style.test.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +3 -0
- package/dist/collection/components/vega-selection-chip/vega-selection-chip.js +1 -1
- package/dist/collection/components/vega-table/vega-table.css +2 -1
- package/dist/collection/components/vega-textarea/vega-textarea.js +88 -2
- package/dist/collection/global/scripts/before-vega-load.js +2 -0
- package/dist/collection/helpers/calendar/calendar-date-time.js +136 -0
- package/dist/collection/helpers/calendar/calendar-date.js +10 -4
- package/dist/collection/helpers/calendar/calendar-event.js +38 -193
- package/dist/collection/helpers/calendar/calendar-time.js +120 -0
- package/dist/collection/helpers/calendar/index.js +2 -0
- package/dist/collection/helpers/calendar/test/calendar-date-time.test.js +27 -0
- package/dist/collection/helpers/calendar/test/calendar-event.test.js +24 -22
- package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +2 -2
- package/dist/collection/helpers/calendar/test/calendar-period/month-period.test.js +2 -2
- package/dist/collection/helpers/calendar/test/calendar-period/week-period.test.js +6 -6
- package/dist/collection/helpers/calendar/test/calendar-time.test.js +45 -0
- package/dist/collection/helpers/calendar/test/utils.test.js +1 -29
- package/dist/collection/helpers/calendar/utils.js +0 -66
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +5 -2
- package/dist/collection/helpers/rte-manager/dto-action-strategy-manager.js +2 -0
- package/dist/esm/{app-globals-37a60cc1.js → app-globals-2f689986.js} +6 -5
- package/dist/esm/{child-nodes-event-prevent-slimmer-735cb880.js → child-nodes-event-prevent-slimmer-76331524.js} +1 -1
- package/dist/esm/{code-block-11b2bc1c.js → code-block-e8839202.js} +511 -318
- package/dist/esm/{component-value-history-controller-slimmer.abstract-16c5cb96.js → component-value-history-controller-slimmer.abstract-c6f94113.js} +2 -2
- package/dist/esm/{design-token-297dc528.js → design-token-e9e6b011.js} +1 -1
- package/dist/esm/{dto-renderer-manager-a1a3b6d2.js → dto-renderer-manager-7abc53bf.js} +1587 -1565
- package/dist/esm/{element-appender-slimmer-f7233708.js → element-appender-slimmer-8dbc8387.js} +2 -2
- package/dist/esm/{event-emit-slimmer-28fd360c.js → event-emit-slimmer-4e28e9f8.js} +1 -1
- package/dist/esm/{token-extension-b690953f.js → function-extension-eb1d062f.js} +1018 -97
- package/dist/esm/{image-annotation-action-fc46c920.js → image-annotation-action-7957653a.js} +14 -24
- package/dist/esm/index.js +9 -9
- package/dist/esm/{internal-vega-event-manager-a5a5938d.js → internal-vega-event-manager-516aa721.js} +5 -2
- package/dist/esm/{language-extension-314a2b18.js → language-extension-3331131f.js} +3 -3
- package/dist/esm/loader.js +8 -8
- package/dist/esm/{public-rules-c6a6946d.js → public-rules-e613dead.js} +3 -3
- package/dist/esm/{range-b78254de.js → range-adf206fd.js} +1 -1
- package/dist/esm/{responsive-format-facade-a41e1be7.js → responsive-format-facade-b0712993.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-d50c24da.js → rich-text-editor-required-rule-43857573.js} +1 -1
- package/dist/esm/{style-formatter-f7effaac.js → style-formatter-a20a1ef4.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +7 -7
- package/dist/esm/vega-app-header-button.entry.js +8 -8
- package/dist/esm/vega-banner.entry.js +2 -2
- package/dist/esm/vega-box.entry.js +8 -8
- package/dist/esm/vega-breadcrumb.entry.js +3 -3
- package/dist/esm/vega-button-circle.entry.js +9 -9
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button-link.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +8 -8
- package/dist/esm/vega-calendar_4.entry.js +307 -269
- package/dist/esm/vega-card.entry.js +7 -7
- package/dist/esm/vega-carousel.entry.js +7 -7
- package/dist/esm/vega-checkbox_2.entry.js +3 -3
- package/dist/esm/vega-chip.entry.js +9 -9
- package/dist/esm/vega-code-block.entry.js +6 -6
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +3 -3
- package/dist/esm/vega-date-picker_2.entry.js +8 -8
- package/dist/esm/vega-dialog_2.entry.js +9 -9
- package/dist/esm/vega-divider.entry.js +7 -7
- package/dist/esm/vega-dropdown_5.entry.js +9 -9
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +24 -5
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +6 -6
- package/dist/esm/vega-flex.entry.js +8 -8
- package/dist/esm/vega-font.entry.js +7 -7
- package/dist/esm/vega-form.entry.js +3 -3
- package/dist/esm/vega-grid.entry.js +7 -7
- package/dist/esm/vega-icon.entry.js +6 -6
- package/dist/esm/vega-image-uploader.entry.js +7 -7
- package/dist/esm/vega-input-credit-card.entry.js +3 -3
- package/dist/esm/vega-input-numeric.entry.js +3 -3
- package/dist/esm/vega-input-passcode.entry.js +3 -3
- package/dist/esm/vega-input-phone-number.entry.js +6 -6
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +38 -14
- package/dist/esm/vega-input.entry.js +14 -3
- package/dist/esm/vega-item-toggle.entry.js +2 -2
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +6 -6
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +7 -7
- package/dist/esm/vega-popover_2.entry.js +9 -9
- package/dist/esm/vega-progress-tracker.entry.js +2 -2
- package/dist/esm/vega-radio_2.entry.js +3 -3
- package/dist/esm/vega-rich-text-content.entry.js +93 -16
- package/dist/esm/vega-rich-text-editor_4.entry.js +107 -54
- package/dist/esm/vega-segment-control.entry.js +2 -2
- package/dist/esm/vega-selection-chip_2.entry.js +8 -8
- package/dist/esm/vega-selection-tile_2.entry.js +3 -3
- package/dist/esm/vega-sidenav_3.entry.js +6 -6
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +3 -3
- package/dist/esm/vega-tab-group_2.entry.js +3 -3
- package/dist/esm/vega-table_8.entry.js +8 -8
- package/dist/esm/vega-textarea.entry.js +25 -5
- package/dist/esm/vega-time-picker_2.entry.js +9 -9
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +7 -7
- package/dist/esm/vega.js +8 -8
- package/dist/sri/vega-sri-manifest.json +273 -273
- package/dist/types/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.d.ts +1 -0
- package/dist/types/components/vega-field-label/types.d.ts +12 -0
- package/dist/types/components/vega-field-label/vega-field-label.d.ts +13 -1
- package/dist/types/components/vega-input/vega-input.d.ts +14 -2
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-renderer.d.ts +3 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +25 -0
- package/dist/types/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-extensions-styles-controller.d.ts +26 -0
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-content/vega-rich-text-content.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor-registry.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor.abstract.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +9 -2
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/paste-content-action.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation-style.d.ts +46 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +10 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +19 -3
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +36 -3
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-new-paragraph-interceptor.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-paste-content-interceptor.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/function-block-insert-paragraph-strategy.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/paste-plain-text-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/actions/insert-function-block-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/actions/paste-plain-text-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +58 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.d.ts +55 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/logic-control-node.d.ts +48 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-extension.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.d.ts +3 -4
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +8 -2
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +8 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +2 -11
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/annotation-style.test.d.ts +1 -0
- package/dist/types/components/vega-textarea/vega-textarea.d.ts +26 -0
- package/dist/types/components.d.ts +65 -3
- package/dist/types/helpers/calendar/calendar-date-time.d.ts +76 -0
- package/dist/types/helpers/calendar/calendar-event.d.ts +18 -57
- package/dist/types/helpers/calendar/calendar-time.d.ts +64 -0
- package/dist/types/helpers/calendar/index.d.ts +2 -0
- package/dist/types/helpers/calendar/test/calendar-date-time.test.d.ts +1 -0
- package/dist/types/helpers/calendar/test/calendar-time.test.d.ts +1 -0
- package/dist/types/helpers/calendar/utils.d.ts +0 -25
- package/dist/types/types/components.type.d.ts +1 -1
- package/dist/types/types/public-api.d.ts +2 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-6f7d42a0.entry.js → p-00376f71.entry.js} +1 -1
- package/dist/vega/p-018d70a5.js +1 -0
- package/dist/vega/p-0849f85e.js +1 -0
- package/dist/vega/{p-b431f9d5.entry.js → p-0a55f984.entry.js} +1 -1
- package/dist/vega/p-0f7dec29.entry.js +1 -0
- package/dist/vega/{p-47cae62d.entry.js → p-113d305b.entry.js} +1 -1
- package/dist/vega/{p-015cdbe7.entry.js → p-115b42e6.entry.js} +1 -1
- package/dist/vega/p-16358fec.entry.js +1 -0
- package/dist/vega/{p-af5bfe34.js → p-16d68187.js} +1 -1
- package/dist/vega/{p-92a22562.entry.js → p-18e8c54a.entry.js} +1 -1
- package/dist/vega/{p-6f6ccf67.entry.js → p-1922303e.entry.js} +1 -1
- package/dist/vega/{p-74d61782.entry.js → p-19256107.entry.js} +1 -1
- package/dist/vega/{p-59298f5e.entry.js → p-1dcb1fcd.entry.js} +2 -2
- package/dist/vega/{p-7f69081b.entry.js → p-1dd7f8b2.entry.js} +1 -1
- package/dist/vega/{p-d006e732.entry.js → p-22fe8c61.entry.js} +1 -1
- package/dist/vega/{p-524693d8.entry.js → p-238afe1b.entry.js} +1 -1
- package/dist/vega/p-240d9d35.entry.js +1 -0
- package/dist/vega/{p-b82d3915.entry.js → p-24419ebe.entry.js} +1 -1
- package/dist/vega/p-2478f65e.js +1 -0
- package/dist/vega/{p-358e9800.entry.js → p-2c945862.entry.js} +1 -1
- package/dist/vega/{p-5f58d1da.entry.js → p-2e32fbe6.entry.js} +1 -1
- package/dist/vega/p-2f04d2ac.js +1 -0
- package/dist/vega/{p-a73dc4b3.entry.js → p-30a8d9d6.entry.js} +1 -1
- package/dist/vega/{p-e6cccee4.js → p-369810ae.js} +1 -1
- package/dist/vega/p-3ad87199.entry.js +1 -0
- package/dist/vega/{p-fe2e859f.entry.js → p-3b800f1b.entry.js} +1 -1
- package/dist/vega/p-437f865f.js +1 -0
- package/dist/vega/{p-de624f7d.entry.js → p-48bc03fa.entry.js} +1 -1
- package/dist/vega/{p-46830028.entry.js → p-54ddd06f.entry.js} +1 -1
- package/dist/vega/{p-5a0524ab.entry.js → p-56636a58.entry.js} +1 -1
- package/dist/vega/{p-fc8c5869.entry.js → p-56f77466.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-ab1001f5.entry.js → p-61d9cdf9.entry.js} +1 -1
- package/dist/vega/{p-39b9c57b.entry.js → p-626246b4.entry.js} +1 -1
- package/dist/vega/{p-ff3bb4e2.entry.js → p-634499cb.entry.js} +1 -1
- package/dist/vega/p-6609d87e.entry.js +1 -0
- package/dist/vega/p-69d27eaf.entry.js +1 -0
- package/dist/vega/{p-7efb5ebe.entry.js → p-705dad87.entry.js} +1 -1
- package/dist/vega/{p-8d574fbd.entry.js → p-75b5894f.entry.js} +1 -1
- package/dist/vega/{p-00071542.entry.js → p-76b1dae4.entry.js} +1 -1
- package/dist/vega/{p-54b62ecf.js → p-7747c163.js} +1 -1
- package/dist/vega/{p-0ed53cce.entry.js → p-787caad3.entry.js} +1 -1
- package/dist/vega/{p-129c0ce1.js → p-79e6e12c.js} +1 -1
- package/dist/vega/{p-cc519f53.entry.js → p-7dde3be9.entry.js} +1 -1
- package/dist/vega/p-8233d814.entry.js +1 -0
- package/dist/vega/{p-5e32866d.entry.js → p-83a50ac2.entry.js} +1 -1
- package/dist/vega/p-8506e8c3.js +1 -0
- package/dist/vega/{p-47fa359b.js → p-85407fb9.js} +1 -1
- package/dist/vega/{p-892cbe7c.entry.js → p-880569ec.entry.js} +1 -1
- package/dist/vega/{p-0113a83c.entry.js → p-8dba59a6.entry.js} +1 -1
- package/dist/vega/p-94e167b8.entry.js +1 -0
- package/dist/vega/{p-b2aaab66.entry.js → p-98fb9eaa.entry.js} +1 -1
- package/dist/vega/{p-3288a65b.entry.js → p-99bf5993.entry.js} +1 -1
- package/dist/vega/p-a211ae63.js +1 -0
- package/dist/vega/{p-fef846d5.entry.js → p-a2506cb5.entry.js} +1 -1
- package/dist/vega/{p-4e33fff6.entry.js → p-a6fb5a40.entry.js} +1 -1
- package/dist/vega/{p-bee1cc34.entry.js → p-b5060e84.entry.js} +1 -1
- package/dist/vega/{p-616cd622.entry.js → p-b78670c9.entry.js} +1 -1
- package/dist/vega/{p-d5761532.entry.js → p-b8558278.entry.js} +1 -1
- package/dist/vega/{p-8d655fd2.entry.js → p-bb0f2b5f.entry.js} +1 -1
- package/dist/vega/{p-a7631c6b.js → p-bb37a401.js} +1 -1
- package/dist/vega/p-bccee21e.js +1 -0
- package/dist/vega/{p-2553031f.entry.js → p-bd0e55a2.entry.js} +1 -1
- package/dist/vega/{p-65693321.entry.js → p-c0223a17.entry.js} +1 -1
- package/dist/vega/{p-2d430dc4.entry.js → p-c26332ae.entry.js} +1 -1
- package/dist/vega/{p-7f9ec104.entry.js → p-c54148fb.entry.js} +1 -1
- package/dist/vega/{p-276b1163.entry.js → p-d3905af1.entry.js} +2 -2
- package/dist/vega/p-d4893487.js +1 -0
- package/dist/vega/{p-d1dacaeb.entry.js → p-d67200e8.entry.js} +1 -1
- package/dist/vega/{p-725f0a2c.js → p-db57dddc.js} +1 -1
- package/dist/vega/{p-ed8bc4f0.entry.js → p-de02f404.entry.js} +1 -1
- package/dist/vega/{p-d4452dbc.entry.js → p-de8c5fae.entry.js} +1 -1
- package/dist/vega/{p-7b145620.js → p-de97c6d9.js} +1 -1
- package/dist/vega/{p-34800282.entry.js → p-e0979451.entry.js} +1 -1
- package/dist/vega/{p-1a3cb65e.entry.js → p-e6351dab.entry.js} +1 -1
- package/dist/vega/{p-8d096fea.entry.js → p-f0fb3fdd.entry.js} +1 -1
- package/dist/vega/{p-ea05a2fc.entry.js → p-f3399ef1.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-019f7f95.js +0 -1
- package/dist/vega/p-03a1e82e.entry.js +0 -1
- package/dist/vega/p-0d1eca78.entry.js +0 -1
- package/dist/vega/p-16370cfb.js +0 -1
- package/dist/vega/p-3a7f177a.entry.js +0 -1
- package/dist/vega/p-41c3fcb4.js +0 -1
- package/dist/vega/p-81105691.entry.js +0 -1
- package/dist/vega/p-822c6092.js +0 -1
- package/dist/vega/p-8edf3513.js +0 -1
- package/dist/vega/p-a1b7a179.entry.js +0 -1
- package/dist/vega/p-ab8f99e9.entry.js +0 -1
- package/dist/vega/p-bf7f755b.js +0 -1
- package/dist/vega/p-bf9476cd.entry.js +0 -1
- package/dist/vega/p-c6ce2869.js +0 -1
- package/dist/vega/p-d0e6454e.entry.js +0 -1
- package/dist/vega/p-d88e88a7.js +0 -1
- package/dist/vega/p-f360c9ba.js +0 -1
|
@@ -149,6 +149,7 @@ var ModifyContentActionType;
|
|
|
149
149
|
ModifyContentActionType["UPDATE_CURSOR_POSITION"] = "UPDATE_CURSOR_POSITION";
|
|
150
150
|
ModifyContentActionType["INSERT_TEXT_TO_DECORATOR_NODE"] = "INSERT_TEXT_TO_DECORATOR_NODE";
|
|
151
151
|
ModifyContentActionType["INSERT_NODE_TO_NEAREST_ROOT"] = "INSERT_NODE_TO_NEAREST_ROOT";
|
|
152
|
+
ModifyContentActionType["PASTE_CONTENT"] = "PASTE_CONTENT";
|
|
152
153
|
})(ModifyContentActionType || (ModifyContentActionType = {}));
|
|
153
154
|
/**
|
|
154
155
|
* Abstract class for update node content, delete node, insert node
|
|
@@ -383,6 +384,67 @@ class IndentAnnotation extends BlockAnnotation {
|
|
|
383
384
|
}
|
|
384
385
|
}
|
|
385
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Registry for action handler interceptors, which can register and retrieve interceptors for specific actions and targets.
|
|
389
|
+
*/
|
|
390
|
+
class ActionHandlerInterceptorRegistry {
|
|
391
|
+
/**
|
|
392
|
+
* Bind a specific strategy to a special action type of the rich text node.
|
|
393
|
+
*
|
|
394
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
395
|
+
* @param {string} targetClass - The rich text node class name.
|
|
396
|
+
* @param {ActionHandlerInterceptor} strategy - The action handle strategy instance.
|
|
397
|
+
*/
|
|
398
|
+
static register(actionType, targetClass, strategy) {
|
|
399
|
+
if (!this.registry.has(targetClass)) {
|
|
400
|
+
this.registry.set(targetClass, new Map());
|
|
401
|
+
}
|
|
402
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
403
|
+
if (!this.registry.get(targetClass).has(actionType)) {
|
|
404
|
+
this.registry.get(targetClass).set(actionType, new Set());
|
|
405
|
+
}
|
|
406
|
+
this.registry.get(targetClass).get(actionType).add(strategy);
|
|
407
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Unregister the strategy for the specific action type and target class.
|
|
411
|
+
*
|
|
412
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
413
|
+
* @param {string} targetClass - The rich text node class name.
|
|
414
|
+
* @param {ActionHandlerInterceptor} strategy - The action handler interceptor instance.
|
|
415
|
+
*/
|
|
416
|
+
static unregister(actionType, targetClass, strategy) {
|
|
417
|
+
const strategyMap = this.registry.get(targetClass);
|
|
418
|
+
if (strategyMap) {
|
|
419
|
+
const strategySet = strategyMap.get(actionType);
|
|
420
|
+
if (strategySet) {
|
|
421
|
+
strategySet.delete(strategy);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Get the special interceptor strategy that before handle the action logic.
|
|
427
|
+
*
|
|
428
|
+
* @typedef T generic type
|
|
429
|
+
* @typedef target generic type
|
|
430
|
+
* @param {RTEActionType} action - The special action .
|
|
431
|
+
* @param {string} targetClass - The rich text node class name.
|
|
432
|
+
* @returns {Nullable<ActionHandlerInterceptor<T, target>>} - The action handler interceptor instance or null if not found.
|
|
433
|
+
*/
|
|
434
|
+
static get(action, targetClass) {
|
|
435
|
+
const targetClassName = targetClass.constructor.name;
|
|
436
|
+
const actionType = action instanceof ModifyContentAction ? action.type : action.constructor.name;
|
|
437
|
+
const strategyMap = this.registry.get(targetClassName);
|
|
438
|
+
if (strategyMap) {
|
|
439
|
+
const set = strategyMap.get(actionType);
|
|
440
|
+
if (set && set.size > 0) {
|
|
441
|
+
return Array.from(set).find((interceptor) => interceptor.canIntercept(action, targetClass));
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
ActionHandlerInterceptorRegistry.registry = new Map();
|
|
447
|
+
|
|
386
448
|
/**
|
|
387
449
|
* The strategies registry, contains static methods `register`, `get` and `getStrategyAndExecute`.
|
|
388
450
|
*/
|
|
@@ -401,6 +463,18 @@ class ActionHandleStrategyRegistry {
|
|
|
401
463
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
402
464
|
this.registry.get(targetClass).set(actionType, strategy);
|
|
403
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* Unregister the strategy for the specific action type and target class.
|
|
468
|
+
*
|
|
469
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
470
|
+
* @param {string} targetClass - The rich text node class name.
|
|
471
|
+
*/
|
|
472
|
+
static unregister(actionType, targetClass) {
|
|
473
|
+
const strategyMap = this.registry.get(targetClass);
|
|
474
|
+
if (strategyMap) {
|
|
475
|
+
strategyMap.delete(actionType);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
404
478
|
/**
|
|
405
479
|
* Get the special strategy that handle the action logic.
|
|
406
480
|
*
|
|
@@ -426,20 +500,31 @@ class ActionHandleStrategyRegistry {
|
|
|
426
500
|
* @returns {R | undefined} The return value of the strategy method execute invoke result.
|
|
427
501
|
*/
|
|
428
502
|
static executeTheStrategy(action, RTEInstance) {
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
503
|
+
const interceptor = ActionHandlerInterceptorRegistry.get(action, RTEInstance);
|
|
504
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
505
|
+
const executeStrategy = () => {
|
|
506
|
+
const actionType = action instanceof ModifyContentAction ? action.type : action.constructor.name;
|
|
507
|
+
const strategy = ActionHandleStrategyRegistry.get(actionType, RTEInstance.constructor.name);
|
|
508
|
+
if (strategy) {
|
|
509
|
+
action['executedFlag'] = true;
|
|
510
|
+
return strategy.execute(action, RTEInstance);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
LogUtility.warn(`Type ${actionType} action handle strategy is not registered in class ${RTEInstance.constructor.name}`);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
if (interceptor) {
|
|
517
|
+
return interceptor.intercept(executeStrategy, action, RTEInstance);
|
|
433
518
|
}
|
|
434
519
|
else {
|
|
435
|
-
|
|
520
|
+
return executeStrategy();
|
|
436
521
|
}
|
|
437
522
|
}
|
|
438
523
|
/**
|
|
439
524
|
* Check if the action type can be handled by strategy for the specific RTE instance.
|
|
440
525
|
*
|
|
441
526
|
* @param {string} actionType - The special action type or the action class name.
|
|
442
|
-
* @param {RTENode | RTEBlock} RTEInstance - The rich text editor node.
|
|
527
|
+
* @param {RTENode | RTEBlock | VegaRTEContent} RTEInstance - The rich text editor node.
|
|
443
528
|
* @returns {boolean} - Whether the action type can be handled by the strategy.
|
|
444
529
|
*/
|
|
445
530
|
static canHandle(actionType, RTEInstance) {
|
|
@@ -702,128 +787,184 @@ class InternalWrapperAnnotation extends BlockAnnotation {
|
|
|
702
787
|
}
|
|
703
788
|
}
|
|
704
789
|
|
|
790
|
+
var NodeAnnotationTypeEnum;
|
|
791
|
+
(function (NodeAnnotationTypeEnum) {
|
|
792
|
+
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
793
|
+
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
794
|
+
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
795
|
+
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
796
|
+
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
797
|
+
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
798
|
+
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
799
|
+
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
800
|
+
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
801
|
+
NodeAnnotationTypeEnum["INLINE_HTML"] = "INLINE_HTML";
|
|
802
|
+
NodeAnnotationTypeEnum["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
803
|
+
})(NodeAnnotationTypeEnum || (NodeAnnotationTypeEnum = {}));
|
|
705
804
|
/**
|
|
706
|
-
* Abstract class for
|
|
805
|
+
* Abstract class for all annotations
|
|
707
806
|
*/
|
|
708
|
-
class
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
807
|
+
class NodeAnnotation extends Annotation {
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Class to handle the style representation of annotations for RTE blocks and nodes.
|
|
812
|
+
*/
|
|
813
|
+
class RTEAnnotationStyle {
|
|
814
|
+
constructor(dto) {
|
|
815
|
+
this.dtoType = dto instanceof RTEBlock ? 'block' : 'node';
|
|
816
|
+
this.annotationMap = dto.annotationMap;
|
|
712
817
|
}
|
|
713
818
|
/**
|
|
714
|
-
*
|
|
819
|
+
* Convert an AnnotationStyle object to a CSS text string.
|
|
715
820
|
*
|
|
716
|
-
* @param {
|
|
717
|
-
* @param {
|
|
821
|
+
* @param {RTERenderContext} options - Rendering context options.
|
|
822
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
823
|
+
* @param {Nullable<AnnotationStyle>} annotationStyle - The annotation style object, if null, get from toJSON().
|
|
824
|
+
* @returns {string} A string representing the CSS text.
|
|
718
825
|
*/
|
|
719
|
-
|
|
720
|
-
|
|
826
|
+
toCssText(options = { standalone: false }, canMergeKeyList, annotationStyle) {
|
|
827
|
+
annotationStyle = annotationStyle ? annotationStyle : this.toJSON(options, canMergeKeyList);
|
|
828
|
+
return Object.entries(Object.assign({}, annotationStyle))
|
|
829
|
+
.map(([key, value]) => `${camelToDashCase(key)}: ${value};`)
|
|
830
|
+
.join('');
|
|
721
831
|
}
|
|
722
832
|
/**
|
|
723
|
-
*
|
|
724
|
-
* and value.
|
|
833
|
+
* Convert the annotation map to a JSON representation.
|
|
725
834
|
*
|
|
726
|
-
* @param {
|
|
727
|
-
*
|
|
728
|
-
* @
|
|
729
|
-
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
730
|
-
* annotation being created.
|
|
731
|
-
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
732
|
-
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
835
|
+
* @param {RTERenderContext} options - Rendering context options.
|
|
836
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
837
|
+
* @returns {AnnotationStyle} - The JSON representation of the annotation styles.
|
|
733
838
|
*/
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
case 'customStyle':
|
|
745
|
-
return CustomStyleAnnotation.from(value);
|
|
746
|
-
case 'internalWrapper':
|
|
747
|
-
return InternalWrapperAnnotation.from(value);
|
|
839
|
+
toJSON(options = { standalone: false }, canMergeKeyList) {
|
|
840
|
+
const styles = Array.from(this.annotationMap.values())
|
|
841
|
+
.filter((annotation) => this.filterAnnotation(annotation) || annotation instanceof CustomStyleAnnotation)
|
|
842
|
+
.map((annotation) => annotation.renderStyle(options))
|
|
843
|
+
.filter(isNonNullable);
|
|
844
|
+
if (canMergeKeyList && canMergeKeyList.length > 0) {
|
|
845
|
+
return this.mergeAnnotationStyles(styles, canMergeKeyList);
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
return styles.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
748
849
|
}
|
|
749
850
|
}
|
|
750
851
|
/**
|
|
751
|
-
*
|
|
852
|
+
* Filter annotations based on whether they are block or node annotations.
|
|
752
853
|
*
|
|
753
|
-
* @param {
|
|
754
|
-
* @
|
|
854
|
+
* @param {RTENodeAnnotationMapValue | RTEBlockAnnotationMapValue} annotation - The annotation to filter.
|
|
855
|
+
* @returns {boolean} - True if the annotation matches the DTO type, false otherwise.
|
|
755
856
|
*/
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
annotationMap.set(...item);
|
|
761
|
-
}
|
|
762
|
-
});
|
|
857
|
+
filterAnnotation(annotation) {
|
|
858
|
+
return this.dtoType === 'block'
|
|
859
|
+
? annotation instanceof BlockAnnotation
|
|
860
|
+
: annotation instanceof NodeAnnotation;
|
|
763
861
|
}
|
|
764
862
|
/**
|
|
765
|
-
*
|
|
863
|
+
* Merge an array of annotation styles into a single style object.
|
|
864
|
+
* e.g.,
|
|
865
|
+
* { textDecoration: 'underline', textDecoration: 'line-through' }
|
|
866
|
+
* -> { textDecoration: 'underline line-through' }
|
|
766
867
|
*
|
|
767
|
-
* @
|
|
868
|
+
* @param {AnnotationStyle[]} styles - Array of annotation style objects to merge.
|
|
869
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
870
|
+
* @returns {AnnotationStyle} - The merged annotation style object.
|
|
768
871
|
*/
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
872
|
+
mergeAnnotationStyles(styles, canMergeKeyList) {
|
|
873
|
+
const merged = {};
|
|
874
|
+
for (const style of styles) {
|
|
875
|
+
for (const key in style) {
|
|
876
|
+
const value = style[key];
|
|
877
|
+
const existing = merged[key];
|
|
878
|
+
if (typeof existing === 'string' &&
|
|
879
|
+
typeof value === 'string' &&
|
|
880
|
+
canMergeKeyList.includes(key)) {
|
|
881
|
+
merged[key] = Array.from(new Set(`${existing} ${value}`.split(/\s+/).filter(Boolean))).join(' ');
|
|
882
|
+
}
|
|
883
|
+
else {
|
|
884
|
+
merged[key] = value;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
775
887
|
}
|
|
776
|
-
|
|
777
|
-
|
|
888
|
+
return merged;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
var NodeTypeEnum;
|
|
893
|
+
(function (NodeTypeEnum) {
|
|
894
|
+
NodeTypeEnum["TEXT"] = "TEXT";
|
|
895
|
+
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
896
|
+
NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
|
|
897
|
+
})(NodeTypeEnum || (NodeTypeEnum = {}));
|
|
898
|
+
/**
|
|
899
|
+
* Abstract class for all nodes
|
|
900
|
+
*/
|
|
901
|
+
class RTENode {
|
|
902
|
+
constructor(id, annotationMap) {
|
|
903
|
+
this.annotationMap = new Map();
|
|
904
|
+
this.id = id;
|
|
905
|
+
if (annotationMap) {
|
|
906
|
+
this.annotationMap = annotationMap;
|
|
778
907
|
}
|
|
779
908
|
}
|
|
780
909
|
/**
|
|
781
|
-
*
|
|
910
|
+
* Creates a new instance of the RTENode from the given JSON data.
|
|
782
911
|
*
|
|
783
|
-
* @
|
|
912
|
+
* @param {unknown} json - The JSON data to create the node from.
|
|
913
|
+
* @param {RTEBlock} parentBlock - The parent block of the node.
|
|
914
|
+
* @param {VegaRTETransformOptions} options - Options for transforming the node.
|
|
784
915
|
*/
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
916
|
+
static from(json, parentBlock, options) {
|
|
917
|
+
throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${parentBlock}, ${options}) is not implemented. Please implement this method in the subclass.`);
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Creates different types of text annotations based on the provided type and value.
|
|
921
|
+
*
|
|
922
|
+
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
923
|
+
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
924
|
+
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
925
|
+
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
926
|
+
*/
|
|
927
|
+
static createAnnotationEntity(type, value) {
|
|
928
|
+
switch (type) {
|
|
929
|
+
case 'customAttribute':
|
|
930
|
+
return CustomAttributeAnnotation.from(value);
|
|
931
|
+
case 'customClass':
|
|
932
|
+
return CustomClassAnnotation.from(value);
|
|
933
|
+
case 'customStyle':
|
|
934
|
+
return CustomStyleAnnotation.from(value);
|
|
935
|
+
}
|
|
792
936
|
}
|
|
793
937
|
/**
|
|
794
938
|
* Get annotation by type
|
|
795
939
|
*
|
|
796
940
|
* @typedef T generic type
|
|
797
|
-
* @param {
|
|
941
|
+
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
798
942
|
* @returns {Nullable<T>} - Annotation
|
|
799
943
|
*/
|
|
800
944
|
getAnnotationByType(type) {
|
|
801
945
|
return this.annotationMap.get(type);
|
|
802
946
|
}
|
|
803
947
|
/**
|
|
804
|
-
*
|
|
948
|
+
* Delete annotation by type
|
|
949
|
+
*
|
|
950
|
+
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
951
|
+
*/
|
|
952
|
+
deleteAnnotationByType(type) {
|
|
953
|
+
this.annotationMap.delete(type);
|
|
954
|
+
this.flushChange();
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Apply action to node
|
|
805
958
|
*
|
|
806
959
|
* @param {AnnotationAction} action - Annotation action
|
|
960
|
+
* @returns {this} - Node
|
|
807
961
|
*/
|
|
808
962
|
apply(action) {
|
|
809
963
|
this.doApply(action);
|
|
810
964
|
if (action.isFlushable) {
|
|
811
|
-
|
|
812
|
-
if (domNode) {
|
|
813
|
-
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
|
|
814
|
-
if (nodeSubject) {
|
|
815
|
-
ChangeManager.notify(nodeSubject, {});
|
|
816
|
-
}
|
|
817
|
-
}
|
|
965
|
+
this.flushChange();
|
|
818
966
|
}
|
|
819
|
-
|
|
820
|
-
/**
|
|
821
|
-
* Check if the block is a list item block
|
|
822
|
-
*
|
|
823
|
-
* @returns {boolean} True if the block is a list item block, false otherwise.
|
|
824
|
-
*/
|
|
825
|
-
isListItemBlock() {
|
|
826
|
-
return this.type === 'list-item';
|
|
967
|
+
return this;
|
|
827
968
|
}
|
|
828
969
|
/**
|
|
829
970
|
* Get styles from annotations
|
|
@@ -832,21 +973,18 @@ class RTEBlock {
|
|
|
832
973
|
* @returns {AnnotationStyle} - Annotation styles
|
|
833
974
|
*/
|
|
834
975
|
getStyles(options = { standalone: false }) {
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
.map((annotation) => annotation.renderStyle(options))
|
|
838
|
-
.filter(isNonNullable)
|
|
839
|
-
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {})), (this.shouldRenderAsInternalWrapper() ? { display: 'contents' } : {}));
|
|
976
|
+
const rteAnnotationStyle = new RTEAnnotationStyle(this);
|
|
977
|
+
return rteAnnotationStyle.toJSON(options, ['textDecoration']);
|
|
840
978
|
}
|
|
841
979
|
/**
|
|
842
980
|
* Get classes from annotations
|
|
843
981
|
*
|
|
844
|
-
* @param {RTERenderContext} [options={ standalone: false }] - Options to control
|
|
982
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
|
|
845
983
|
* @returns {string} - Annotation style
|
|
846
984
|
*/
|
|
847
985
|
getClasses(options = { standalone: false }) {
|
|
848
986
|
return Array.from(this.annotationMap.values())
|
|
849
|
-
.filter((annotation) => annotation instanceof
|
|
987
|
+
.filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomClassAnnotation)
|
|
850
988
|
.map((annotation) => annotation.renderClass(options))
|
|
851
989
|
.filter(isNonNullable)
|
|
852
990
|
.reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
|
|
@@ -854,11 +992,27 @@ class RTEBlock {
|
|
|
854
992
|
/**
|
|
855
993
|
* Get custom attribute annotation, excluding "class" and "style"
|
|
856
994
|
*
|
|
857
|
-
* @returns {
|
|
995
|
+
* @returns {CustomAttributeAnnotation} - custom attribute annotation
|
|
858
996
|
*/
|
|
859
997
|
getCustomAttributesAnnotation() {
|
|
860
998
|
return this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
|
|
861
999
|
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Check if the node is a text node.
|
|
1002
|
+
*
|
|
1003
|
+
* @returns {boolean} - True if the node is a text node, false otherwise.
|
|
1004
|
+
*/
|
|
1005
|
+
isTextNode() {
|
|
1006
|
+
return false;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Get the HTMLElement reference associated with this node.
|
|
1010
|
+
*
|
|
1011
|
+
* @returns {Nullable<HTMLElement>} The HTMLElement reference or null if not found.
|
|
1012
|
+
*/
|
|
1013
|
+
getElementRef() {
|
|
1014
|
+
return stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1015
|
+
}
|
|
862
1016
|
/**
|
|
863
1017
|
* Generate attributes as string
|
|
864
1018
|
*
|
|
@@ -867,9 +1021,10 @@ class RTEBlock {
|
|
|
867
1021
|
*/
|
|
868
1022
|
generateAttributeString(...attrs) {
|
|
869
1023
|
var _a;
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
1024
|
+
const nodeAnnotationStyle = new RTEAnnotationStyle(this);
|
|
1025
|
+
const styles = nodeAnnotationStyle.toCssText({ standalone: true }, [
|
|
1026
|
+
'textDecoration',
|
|
1027
|
+
]);
|
|
873
1028
|
const customClassAnnotation = this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_CLASS);
|
|
874
1029
|
const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
|
|
875
1030
|
const attributes = [
|
|
@@ -881,136 +1036,248 @@ class RTEBlock {
|
|
|
881
1036
|
return attributes.length ? ` ${attributes.join(' ')}` : '';
|
|
882
1037
|
}
|
|
883
1038
|
/**
|
|
884
|
-
*
|
|
1039
|
+
* apply annotation action or modify content action
|
|
885
1040
|
*
|
|
886
|
-
* @param {AnnotationAction|ModifyContentAction} action
|
|
1041
|
+
* @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
|
|
887
1042
|
*/
|
|
888
1043
|
doApply(action) {
|
|
889
1044
|
if (action instanceof ModifyContentAction) {
|
|
890
|
-
|
|
1045
|
+
this.doModifyActionApply(action);
|
|
891
1046
|
}
|
|
892
1047
|
else {
|
|
893
|
-
this.
|
|
1048
|
+
this.doAnnotationActionApply(action);
|
|
894
1049
|
}
|
|
895
1050
|
}
|
|
896
1051
|
/**
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
* @param {AnnotationAction} action - Annotation action
|
|
1052
|
+
* Flush the value change
|
|
900
1053
|
*/
|
|
901
|
-
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
|
|
1054
|
+
flushChange() {
|
|
1055
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1056
|
+
if (domNode) {
|
|
1057
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
|
|
1058
|
+
if (nodeSubject) {
|
|
1059
|
+
ChangeManager.notify(nodeSubject, {});
|
|
1060
|
+
}
|
|
905
1061
|
}
|
|
906
|
-
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
907
1062
|
}
|
|
908
1063
|
/**
|
|
909
|
-
*
|
|
1064
|
+
* Clones the annotations of the current RTETextNode.
|
|
910
1065
|
*
|
|
911
|
-
* @returns {
|
|
1066
|
+
* @returns {NodeAnnotations} A new Map containing cloned annotations.
|
|
912
1067
|
*/
|
|
913
1068
|
cloneAnnotations() {
|
|
914
1069
|
return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
|
|
915
1070
|
}
|
|
1071
|
+
/* istanbul ignore next */
|
|
1072
|
+
/**
|
|
1073
|
+
* Placeholder for the method to be implemented in sub classes.
|
|
1074
|
+
*
|
|
1075
|
+
* @param {AnnotationAction} action Annotation action
|
|
1076
|
+
*/
|
|
1077
|
+
doAnnotationActionApply(action) {
|
|
1078
|
+
}
|
|
1079
|
+
/* istanbul ignore next */
|
|
1080
|
+
/**
|
|
1081
|
+
* Placeholder for the method to be implemented in sub classes.
|
|
1082
|
+
*
|
|
1083
|
+
* @param {ModifyContentAction} action ModifyContentAction
|
|
1084
|
+
*/
|
|
1085
|
+
doModifyActionApply(action) {
|
|
1086
|
+
}
|
|
916
1087
|
}
|
|
917
1088
|
|
|
918
|
-
var NodeAnnotationTypeEnum;
|
|
919
|
-
(function (NodeAnnotationTypeEnum) {
|
|
920
|
-
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
921
|
-
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
922
|
-
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
923
|
-
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
924
|
-
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
925
|
-
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
926
|
-
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
927
|
-
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
928
|
-
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
929
|
-
NodeAnnotationTypeEnum["INLINE_HTML"] = "INLINE_HTML";
|
|
930
|
-
NodeAnnotationTypeEnum["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
931
|
-
})(NodeAnnotationTypeEnum || (NodeAnnotationTypeEnum = {}));
|
|
932
1089
|
/**
|
|
933
|
-
*
|
|
1090
|
+
* RTEDTOClassManager is a singleton class that manages the registration and retrieval of RTE DTO classes.
|
|
1091
|
+
* It allows for the dynamic handling of different RTE blocks and nodes by their types.
|
|
934
1092
|
*/
|
|
935
|
-
class
|
|
1093
|
+
class RTEDTOClassManager {
|
|
1094
|
+
constructor() {
|
|
1095
|
+
// Register RTE Block DTO classes.
|
|
1096
|
+
this.RTE_BLOCK_DTO_CLASS_MAP = new Map();
|
|
1097
|
+
// Register RTE Block DTO classes.
|
|
1098
|
+
this.RTE_NODE_DTO_CLASS_MAP = new Map();
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Registers a new RTE DTO class.
|
|
1102
|
+
*
|
|
1103
|
+
* @typedef T - The type of the RTE DTO class to register.
|
|
1104
|
+
* @param {string} type - The type identifier for the RTE DTO class.
|
|
1105
|
+
* @param {ClassType<T>} RTEDTOClass - The class constructor for the RTE DTO.
|
|
1106
|
+
*/
|
|
1107
|
+
registerRTEDTOClass(type, RTEDTOClass) {
|
|
1108
|
+
if (RTEDTOClass.prototype instanceof RTEBlock) {
|
|
1109
|
+
this.RTE_BLOCK_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1110
|
+
}
|
|
1111
|
+
else if (RTEDTOClass.prototype instanceof RTENode) {
|
|
1112
|
+
this.RTE_NODE_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1113
|
+
}
|
|
1114
|
+
else {
|
|
1115
|
+
throw new Error(`Invalid RTE DTO class type: ${type}`);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Retrieves the RTE block class for a given type.
|
|
1120
|
+
*
|
|
1121
|
+
* @param {string} type - The type identifier for the RTE block.
|
|
1122
|
+
* @returns {Nullable<RTEBlockDTOClass>} - The class constructor for the RTE block, or null if not found.
|
|
1123
|
+
*/
|
|
1124
|
+
getRTEBlockClass(type) {
|
|
1125
|
+
return this.RTE_BLOCK_DTO_CLASS_MAP.get(type);
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Retrieves the RTE node class for a given type.
|
|
1129
|
+
*
|
|
1130
|
+
* @param {string} type - The type identifier for the RTE node.
|
|
1131
|
+
* @returns {Nullable<RTENodeDTOClass>} - The class constructor for the RTE node, or null if not found.
|
|
1132
|
+
*/
|
|
1133
|
+
getRTENodeClass(type) {
|
|
1134
|
+
return this.RTE_NODE_DTO_CLASS_MAP.get(type);
|
|
1135
|
+
}
|
|
936
1136
|
}
|
|
1137
|
+
const RTEDTOClassManager$1 = new RTEDTOClassManager();
|
|
937
1138
|
|
|
938
|
-
var NodeTypeEnum;
|
|
939
|
-
(function (NodeTypeEnum) {
|
|
940
|
-
NodeTypeEnum["TEXT"] = "TEXT";
|
|
941
|
-
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
942
|
-
NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
|
|
943
|
-
})(NodeTypeEnum || (NodeTypeEnum = {}));
|
|
944
1139
|
/**
|
|
945
|
-
* Abstract class for
|
|
1140
|
+
* Abstract class for block
|
|
946
1141
|
*/
|
|
947
|
-
class
|
|
948
|
-
constructor(id
|
|
1142
|
+
class RTEBlock {
|
|
1143
|
+
constructor(id) {
|
|
949
1144
|
this.annotationMap = new Map();
|
|
950
1145
|
this.id = id;
|
|
951
|
-
|
|
952
|
-
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Creates a new instance of the block from the given JSON object.
|
|
1149
|
+
*
|
|
1150
|
+
* @param {unknown} json - The JSON object to create the block from.
|
|
1151
|
+
* @param {VegaRTETransformOptions} options - Options for transforming the block.
|
|
1152
|
+
*/
|
|
1153
|
+
static from(json, options) {
|
|
1154
|
+
throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${options}) is not implemented. Please implement this method in the subclass.`);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Generates block children from an array of VegaRTEContentBlock.
|
|
1158
|
+
*
|
|
1159
|
+
* @param {VegaRTEContentBlock[]} blockArray - The array of VegaRTEContentBlock to generate children from.
|
|
1160
|
+
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
1161
|
+
* @param {VegaRTEContent | RTEBlock} [parentBlock] - Optional parent block.
|
|
1162
|
+
* @returns {RTEBlock[]} An array of generated RTEBlock children.
|
|
1163
|
+
*/
|
|
1164
|
+
static generateBlockChildren(blockArray, options, parentBlock) {
|
|
1165
|
+
return blockArray
|
|
1166
|
+
.map((child) => {
|
|
1167
|
+
const BlockClass = RTEDTOClassManager$1.getRTEBlockClass(child.type);
|
|
1168
|
+
if (BlockClass) {
|
|
1169
|
+
const block = BlockClass.from(child, options);
|
|
1170
|
+
block.parent = parentBlock;
|
|
1171
|
+
return block;
|
|
1172
|
+
}
|
|
1173
|
+
})
|
|
1174
|
+
.filter(isNonNullable);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
1178
|
+
* and value.
|
|
1179
|
+
*
|
|
1180
|
+
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
1181
|
+
* the type of annotation entity to create.
|
|
1182
|
+
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
1183
|
+
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
1184
|
+
* annotation being created.
|
|
1185
|
+
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
1186
|
+
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
1187
|
+
*/
|
|
1188
|
+
static createAnnotationEntity(type, value) {
|
|
1189
|
+
switch (type) {
|
|
1190
|
+
case 'textAlign':
|
|
1191
|
+
return HorizontalAlignmentAnnotation.from(value);
|
|
1192
|
+
case 'indent':
|
|
1193
|
+
return IndentAnnotation.from(value);
|
|
1194
|
+
case 'customAttribute':
|
|
1195
|
+
return CustomAttributeAnnotation.from(value);
|
|
1196
|
+
case 'customClass':
|
|
1197
|
+
return CustomClassAnnotation.from(value);
|
|
1198
|
+
case 'customStyle':
|
|
1199
|
+
return CustomStyleAnnotation.from(value);
|
|
1200
|
+
case 'internalWrapper':
|
|
1201
|
+
return InternalWrapperAnnotation.from(value);
|
|
953
1202
|
}
|
|
954
1203
|
}
|
|
955
1204
|
/**
|
|
956
|
-
*
|
|
1205
|
+
* Converts annotations to an array of block annotation entities.
|
|
1206
|
+
*
|
|
1207
|
+
* @param {BlockAnnotations} annotationMap - The map to store the converted annotations.
|
|
1208
|
+
* @param {VegaRTEBlockAnnotations} annotations - The annotations to convert.
|
|
1209
|
+
*/
|
|
1210
|
+
static convertAnnotationsToMap(annotationMap, annotations) {
|
|
1211
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
1212
|
+
const item = this.createAnnotationEntity(type, value);
|
|
1213
|
+
if (isNonNullable(item)) {
|
|
1214
|
+
annotationMap.set(...item);
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Check if the block should be rendered as a wrapper.
|
|
957
1220
|
*
|
|
958
|
-
* @
|
|
959
|
-
* @param {RTEBlock} parentBlock - The parent block of the node.
|
|
960
|
-
* @param {VegaRTETransformOptions} options - Options for transforming the node.
|
|
1221
|
+
* @returns {boolean} - Returns true if the block is an internal wrapper.
|
|
961
1222
|
*/
|
|
962
|
-
|
|
963
|
-
|
|
1223
|
+
shouldRenderAsInternalWrapper() {
|
|
1224
|
+
const internalWrapperAnnotation = this.getAnnotationByType(BlockAnnotationTypeEnum.INTERNAL_WRAPPER);
|
|
1225
|
+
if (internalWrapperAnnotation) {
|
|
1226
|
+
return (internalWrapperAnnotation.internalWrapper &&
|
|
1227
|
+
Array.from(this.annotationMap.values()).filter((annotation) => !(annotation instanceof LinkGroupAnnotation) &&
|
|
1228
|
+
!(annotation instanceof InternalWrapperAnnotation)).length === 0);
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
return false;
|
|
1232
|
+
}
|
|
964
1233
|
}
|
|
965
1234
|
/**
|
|
966
|
-
*
|
|
1235
|
+
* Class to JSON object
|
|
967
1236
|
*
|
|
968
|
-
* @
|
|
969
|
-
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
970
|
-
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
971
|
-
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
1237
|
+
* @returns {VegaRTEBlockBase} - JSON object
|
|
972
1238
|
*/
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
return CustomStyleAnnotation.from(value);
|
|
981
|
-
}
|
|
1239
|
+
toJSON() {
|
|
1240
|
+
const annotations = Array.from(this.annotationMap.values())
|
|
1241
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CommonAnnotation)
|
|
1242
|
+
.reduce((record, annotation) => {
|
|
1243
|
+
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
1244
|
+
}, {});
|
|
1245
|
+
return Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {}));
|
|
982
1246
|
}
|
|
983
1247
|
/**
|
|
984
1248
|
* Get annotation by type
|
|
985
1249
|
*
|
|
986
1250
|
* @typedef T generic type
|
|
987
|
-
* @param {
|
|
1251
|
+
* @param {keyof typeof BlockAnnotationTypeEnum} type - Annotation type
|
|
988
1252
|
* @returns {Nullable<T>} - Annotation
|
|
989
1253
|
*/
|
|
990
1254
|
getAnnotationByType(type) {
|
|
991
1255
|
return this.annotationMap.get(type);
|
|
992
1256
|
}
|
|
993
1257
|
/**
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
997
|
-
*/
|
|
998
|
-
deleteAnnotationByType(type) {
|
|
999
|
-
this.annotationMap.delete(type);
|
|
1000
|
-
this.flushChange();
|
|
1001
|
-
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Apply action to node
|
|
1258
|
+
* Apply action to block
|
|
1004
1259
|
*
|
|
1005
1260
|
* @param {AnnotationAction} action - Annotation action
|
|
1006
|
-
* @returns {this} - Node
|
|
1007
1261
|
*/
|
|
1008
1262
|
apply(action) {
|
|
1009
1263
|
this.doApply(action);
|
|
1010
1264
|
if (action.isFlushable) {
|
|
1011
|
-
|
|
1265
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1266
|
+
if (domNode) {
|
|
1267
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, VegaInternalRichTextEditorFlushChanges);
|
|
1268
|
+
if (nodeSubject) {
|
|
1269
|
+
ChangeManager.notify(nodeSubject, {});
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1012
1272
|
}
|
|
1013
|
-
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Check if the block is a list item block
|
|
1276
|
+
*
|
|
1277
|
+
* @returns {boolean} True if the block is a list item block, false otherwise.
|
|
1278
|
+
*/
|
|
1279
|
+
isListItemBlock() {
|
|
1280
|
+
return this.type === 'list-item';
|
|
1014
1281
|
}
|
|
1015
1282
|
/**
|
|
1016
1283
|
* Get styles from annotations
|
|
@@ -1019,21 +1286,19 @@ class RTENode {
|
|
|
1019
1286
|
* @returns {AnnotationStyle} - Annotation styles
|
|
1020
1287
|
*/
|
|
1021
1288
|
getStyles(options = { standalone: false }) {
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
.filter(Boolean);
|
|
1026
|
-
return this.mergeAnnotationStyles(styles, ['textDecoration']);
|
|
1289
|
+
const rteAnnotationStyle = new RTEAnnotationStyle(this);
|
|
1290
|
+
const blockAnnotationStyle = rteAnnotationStyle.toJSON(options);
|
|
1291
|
+
return Object.assign(Object.assign({}, blockAnnotationStyle), (this.shouldRenderAsInternalWrapper() ? { display: 'contents' } : {}));
|
|
1027
1292
|
}
|
|
1028
1293
|
/**
|
|
1029
1294
|
* Get classes from annotations
|
|
1030
1295
|
*
|
|
1031
|
-
* @param {RTERenderContext} [options={ standalone: false }] - Options to control
|
|
1296
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control standalone mode
|
|
1032
1297
|
* @returns {string} - Annotation style
|
|
1033
1298
|
*/
|
|
1034
1299
|
getClasses(options = { standalone: false }) {
|
|
1035
1300
|
return Array.from(this.annotationMap.values())
|
|
1036
|
-
.filter((annotation) => annotation instanceof
|
|
1301
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomClassAnnotation)
|
|
1037
1302
|
.map((annotation) => annotation.renderClass(options))
|
|
1038
1303
|
.filter(isNonNullable)
|
|
1039
1304
|
.reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
|
|
@@ -1041,27 +1306,11 @@ class RTENode {
|
|
|
1041
1306
|
/**
|
|
1042
1307
|
* Get custom attribute annotation, excluding "class" and "style"
|
|
1043
1308
|
*
|
|
1044
|
-
* @returns {CustomAttributeAnnotation} - custom attribute annotation
|
|
1309
|
+
* @returns {Nullable<CustomAttributeAnnotation>} - custom attribute annotation
|
|
1045
1310
|
*/
|
|
1046
1311
|
getCustomAttributesAnnotation() {
|
|
1047
1312
|
return this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
|
|
1048
1313
|
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Check if the node is a text node.
|
|
1051
|
-
*
|
|
1052
|
-
* @returns {boolean} - True if the node is a text node, false otherwise.
|
|
1053
|
-
*/
|
|
1054
|
-
isTextNode() {
|
|
1055
|
-
return false;
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* Get the HTMLElement reference associated with this node.
|
|
1059
|
-
*
|
|
1060
|
-
* @returns {Nullable<HTMLElement>} The HTMLElement reference or null if not found.
|
|
1061
|
-
*/
|
|
1062
|
-
getElementRef() {
|
|
1063
|
-
return stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1064
|
-
}
|
|
1065
1314
|
/**
|
|
1066
1315
|
* Generate attributes as string
|
|
1067
1316
|
*
|
|
@@ -1070,9 +1319,8 @@ class RTENode {
|
|
|
1070
1319
|
*/
|
|
1071
1320
|
generateAttributeString(...attrs) {
|
|
1072
1321
|
var _a;
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
.join('');
|
|
1322
|
+
const blockAnnotationStyle = new RTEAnnotationStyle(this);
|
|
1323
|
+
const styles = blockAnnotationStyle.toCssText({ standalone: true });
|
|
1076
1324
|
const customClassAnnotation = this.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_CLASS);
|
|
1077
1325
|
const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
|
|
1078
1326
|
const attributes = [
|
|
@@ -1084,82 +1332,38 @@ class RTENode {
|
|
|
1084
1332
|
return attributes.length ? ` ${attributes.join(' ')}` : '';
|
|
1085
1333
|
}
|
|
1086
1334
|
/**
|
|
1087
|
-
*
|
|
1335
|
+
* Apply action to block
|
|
1088
1336
|
*
|
|
1089
|
-
* @param {AnnotationAction
|
|
1337
|
+
* @param {AnnotationAction|ModifyContentAction} action - Annotation action
|
|
1090
1338
|
*/
|
|
1091
1339
|
doApply(action) {
|
|
1092
1340
|
if (action instanceof ModifyContentAction) {
|
|
1093
|
-
|
|
1341
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
1094
1342
|
}
|
|
1095
1343
|
else {
|
|
1096
|
-
this.
|
|
1344
|
+
this.applyAnnotationAction(action);
|
|
1097
1345
|
}
|
|
1098
1346
|
}
|
|
1099
1347
|
/**
|
|
1100
|
-
*
|
|
1348
|
+
* Apply annotation action to block
|
|
1349
|
+
*
|
|
1350
|
+
* @param {AnnotationAction} action - Annotation action
|
|
1101
1351
|
*/
|
|
1102
|
-
|
|
1103
|
-
const
|
|
1104
|
-
if (
|
|
1105
|
-
|
|
1106
|
-
if (nodeSubject) {
|
|
1107
|
-
ChangeManager.notify(nodeSubject, {});
|
|
1108
|
-
}
|
|
1352
|
+
applyAnnotationAction(action) {
|
|
1353
|
+
const annotation = action.toAnnotation();
|
|
1354
|
+
if (!(annotation instanceof LinkGroupAnnotation)) {
|
|
1355
|
+
this.annotationMap.set(annotation.type, annotation);
|
|
1109
1356
|
}
|
|
1357
|
+
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
1110
1358
|
}
|
|
1111
1359
|
/**
|
|
1112
|
-
*
|
|
1360
|
+
* clone annotations of the block
|
|
1113
1361
|
*
|
|
1114
|
-
* @returns {
|
|
1362
|
+
* @returns {BlockAnnotations} - Cloned annotations
|
|
1115
1363
|
*/
|
|
1116
1364
|
cloneAnnotations() {
|
|
1117
1365
|
return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
|
|
1118
1366
|
}
|
|
1119
|
-
/* istanbul ignore next */
|
|
1120
|
-
/**
|
|
1121
|
-
* Placeholder for the method to be implemented in sub classes.
|
|
1122
|
-
*
|
|
1123
|
-
* @param {AnnotationAction} action Annotation action
|
|
1124
|
-
*/
|
|
1125
|
-
doAnnotationActionApply(action) {
|
|
1126
|
-
}
|
|
1127
|
-
/* istanbul ignore next */
|
|
1128
|
-
/**
|
|
1129
|
-
* Placeholder for the method to be implemented in sub classes.
|
|
1130
|
-
*
|
|
1131
|
-
* @param {ModifyContentAction} action ModifyContentAction
|
|
1132
|
-
*/
|
|
1133
|
-
doModifyActionApply(action) {
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Merge an array of annotation styles into a single style object.
|
|
1137
|
-
* e.g.,
|
|
1138
|
-
* { textDecoration: 'underline', textDecoration: 'line-through' }
|
|
1139
|
-
* -> { textDecoration: 'underline line-through' }
|
|
1140
|
-
*
|
|
1141
|
-
* @param {AnnotationStyle[]} styles - Array of annotation style objects to merge.
|
|
1142
|
-
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
1143
|
-
* @returns {AnnotationStyle} - The merged annotation style object.
|
|
1144
|
-
*/
|
|
1145
|
-
mergeAnnotationStyles(styles, canMergeKeyList) {
|
|
1146
|
-
const merged = {};
|
|
1147
|
-
for (const style of styles) {
|
|
1148
|
-
for (const key in style) {
|
|
1149
|
-
const value = style[key];
|
|
1150
|
-
const existing = merged[key];
|
|
1151
|
-
if (typeof existing === 'string' &&
|
|
1152
|
-
typeof value === 'string' &&
|
|
1153
|
-
canMergeKeyList.includes(key)) {
|
|
1154
|
-
merged[key] = Array.from(new Set(`${existing} ${value}`.split(/\s+/).filter(Boolean))).join(' ');
|
|
1155
|
-
}
|
|
1156
|
-
else {
|
|
1157
|
-
merged[key] = value;
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return merged;
|
|
1162
|
-
}
|
|
1163
1367
|
}
|
|
1164
1368
|
|
|
1165
1369
|
/**
|
|
@@ -1669,56 +1873,6 @@ class SyncUpSelectionAction extends AnnotationAction {
|
|
|
1669
1873
|
}
|
|
1670
1874
|
}
|
|
1671
1875
|
|
|
1672
|
-
/**
|
|
1673
|
-
* RTEDTOClassManager is a singleton class that manages the registration and retrieval of RTE DTO classes.
|
|
1674
|
-
* It allows for the dynamic handling of different RTE blocks and nodes by their types.
|
|
1675
|
-
*/
|
|
1676
|
-
class RTEDTOClassManager {
|
|
1677
|
-
constructor() {
|
|
1678
|
-
// Register RTE Block DTO classes.
|
|
1679
|
-
this.RTE_BLOCK_DTO_CLASS_MAP = new Map();
|
|
1680
|
-
// Register RTE Block DTO classes.
|
|
1681
|
-
this.RTE_NODE_DTO_CLASS_MAP = new Map();
|
|
1682
|
-
}
|
|
1683
|
-
/**
|
|
1684
|
-
* Registers a new RTE DTO class.
|
|
1685
|
-
*
|
|
1686
|
-
* @typedef T - The type of the RTE DTO class to register.
|
|
1687
|
-
* @param {string} type - The type identifier for the RTE DTO class.
|
|
1688
|
-
* @param {ClassType<T>} RTEDTOClass - The class constructor for the RTE DTO.
|
|
1689
|
-
*/
|
|
1690
|
-
registerRTEDTOClass(type, RTEDTOClass) {
|
|
1691
|
-
if (RTEDTOClass.prototype instanceof RTEBlock) {
|
|
1692
|
-
this.RTE_BLOCK_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1693
|
-
}
|
|
1694
|
-
else if (RTEDTOClass.prototype instanceof RTENode) {
|
|
1695
|
-
this.RTE_NODE_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1696
|
-
}
|
|
1697
|
-
else {
|
|
1698
|
-
throw new Error(`Invalid RTE DTO class type: ${type}`);
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
/**
|
|
1702
|
-
* Retrieves the RTE block class for a given type.
|
|
1703
|
-
*
|
|
1704
|
-
* @param {string} type - The type identifier for the RTE block.
|
|
1705
|
-
* @returns {Nullable<RTEBlockDTOClass>} - The class constructor for the RTE block, or null if not found.
|
|
1706
|
-
*/
|
|
1707
|
-
getRTEBlockClass(type) {
|
|
1708
|
-
return this.RTE_BLOCK_DTO_CLASS_MAP.get(type);
|
|
1709
|
-
}
|
|
1710
|
-
/**
|
|
1711
|
-
* Retrieves the RTE node class for a given type.
|
|
1712
|
-
*
|
|
1713
|
-
* @param {string} type - The type identifier for the RTE node.
|
|
1714
|
-
* @returns {Nullable<RTENodeDTOClass>} - The class constructor for the RTE node, or null if not found.
|
|
1715
|
-
*/
|
|
1716
|
-
getRTENodeClass(type) {
|
|
1717
|
-
return this.RTE_NODE_DTO_CLASS_MAP.get(type);
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
const RTEDTOClassManager$1 = new RTEDTOClassManager();
|
|
1721
|
-
|
|
1722
1876
|
/**
|
|
1723
1877
|
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
1724
1878
|
*/
|
|
@@ -2470,6 +2624,25 @@ class PlainTextAnnotation extends NodeAnnotation {
|
|
|
2470
2624
|
}
|
|
2471
2625
|
}
|
|
2472
2626
|
|
|
2627
|
+
/**
|
|
2628
|
+
* Action to toggle the text color annotation visibility/state.
|
|
2629
|
+
*/
|
|
2630
|
+
class TextColorAnnotationAction extends TextSplittableAction {
|
|
2631
|
+
constructor(textColor) {
|
|
2632
|
+
super();
|
|
2633
|
+
this.isFlushable = true;
|
|
2634
|
+
this.textColor = textColor;
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Converts the action into a text color annotation.
|
|
2638
|
+
*
|
|
2639
|
+
* @returns {Annotation} the annotation
|
|
2640
|
+
*/
|
|
2641
|
+
toAnnotation() {
|
|
2642
|
+
return new TextColorAnnotation(this.textColor);
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
|
|
2473
2646
|
/**
|
|
2474
2647
|
* Text node
|
|
2475
2648
|
*/
|
|
@@ -2656,6 +2829,13 @@ class RTETextNode extends RTENode {
|
|
|
2656
2829
|
}
|
|
2657
2830
|
ActionHandleStrategyRegistry.register(TextSplittableAction.name, dtoClassName, new NodeSplitTextStrategy());
|
|
2658
2831
|
ActionHandleStrategyRegistry.register(ModifyContentActionType.DELETE_LINK_GROUP, dtoClassName, new DeleteLinkGroupStrategy());
|
|
2832
|
+
ActionHandleStrategyRegistry.register(BoldAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2833
|
+
ActionHandleStrategyRegistry.register(ClearFormattingAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2834
|
+
ActionHandleStrategyRegistry.register(ItalicAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2835
|
+
ActionHandleStrategyRegistry.register(UnderlineAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2836
|
+
ActionHandleStrategyRegistry.register(TextColorAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2837
|
+
ActionHandleStrategyRegistry.register(StrikethroughAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2838
|
+
ActionHandleStrategyRegistry.register(CodeAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2659
2839
|
ActionHandleStrategyRegistry.register(AnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2660
2840
|
RTETextNode.registerActionStrategyStatus[dtoClassName] = true;
|
|
2661
2841
|
}
|
|
@@ -2706,9 +2886,6 @@ class RTETextNode extends RTENode {
|
|
|
2706
2886
|
/**
|
|
2707
2887
|
* 1. Try to get the specific strategy for the action and node type first (e.g., LinkAnnotationAction on RTETextNode).
|
|
2708
2888
|
* 2. If no specific strategy found, try to get the generic NodeUpdateAnnotationMapStrategy for AnnotationAction on RTETextNode.
|
|
2709
|
-
*
|
|
2710
|
-
* This is useful when we want to check if there is a specific strategy for an action-node combination first, we can use the specific strategy to check if the special toolbar button should be enabled or disabled.
|
|
2711
|
-
* TODO: Update the other annotation actions to follow this pattern. https://gethired.atlassian.net/browse/VD-7367
|
|
2712
2889
|
*/
|
|
2713
2890
|
const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, node.constructor.name);
|
|
2714
2891
|
if (strategy) {
|
|
@@ -3544,11 +3721,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
3544
3721
|
toHtml() {
|
|
3545
3722
|
const BlockTag = this.getBlockTag();
|
|
3546
3723
|
const attrStr = super.generateAttributeString();
|
|
3547
|
-
const
|
|
3548
|
-
let nodesHtml = this.children.map((node) => node.toHtml()).join('');
|
|
3549
|
-
if (linkGroupAnnotation && this.children.length > 0) {
|
|
3550
|
-
nodesHtml = this.generateLinkHtml(linkGroupAnnotation, nodesHtml);
|
|
3551
|
-
}
|
|
3724
|
+
const nodesHtml = this.getChildrenHtml();
|
|
3552
3725
|
return super.shouldRenderAsInternalWrapper()
|
|
3553
3726
|
? nodesHtml
|
|
3554
3727
|
: [`<${BlockTag}${attrStr}>`, nodesHtml, `</${BlockTag}>`].join('');
|
|
@@ -3614,6 +3787,19 @@ class RTETextBlock extends RTEBlock {
|
|
|
3614
3787
|
return 'p';
|
|
3615
3788
|
}
|
|
3616
3789
|
}
|
|
3790
|
+
/**
|
|
3791
|
+
* Get the HTML string for the children nodes, including handling link group annotations.
|
|
3792
|
+
*
|
|
3793
|
+
* @returns {string} The HTML string representing the children nodes.
|
|
3794
|
+
*/
|
|
3795
|
+
getChildrenHtml() {
|
|
3796
|
+
const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
3797
|
+
let nodesHtml = this.children.map((node) => node.toHtml()).join('');
|
|
3798
|
+
if (linkGroupAnnotation && this.children.length > 0) {
|
|
3799
|
+
nodesHtml = this.generateLinkHtml(linkGroupAnnotation, nodesHtml);
|
|
3800
|
+
}
|
|
3801
|
+
return nodesHtml;
|
|
3802
|
+
}
|
|
3617
3803
|
/**
|
|
3618
3804
|
* @inheritDoc
|
|
3619
3805
|
*/
|
|
@@ -3753,9 +3939,7 @@ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
|
3753
3939
|
if (currentBlockIndex > 0) {
|
|
3754
3940
|
return currentBlock.parent.children[currentBlockIndex - 1];
|
|
3755
3941
|
}
|
|
3756
|
-
else if ((currentBlock.parent
|
|
3757
|
-
currentBlock.parent['type'] === 'bullet-list') &&
|
|
3758
|
-
currentBlockIndex === 0) {
|
|
3942
|
+
else if (this.isRTEBlock(currentBlock.parent) && currentBlockIndex === 0) {
|
|
3759
3943
|
return this.getPreviousBlock(currentBlock.parent);
|
|
3760
3944
|
}
|
|
3761
3945
|
}
|
|
@@ -3806,6 +3990,15 @@ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
|
3806
3990
|
}
|
|
3807
3991
|
}
|
|
3808
3992
|
}
|
|
3993
|
+
/**
|
|
3994
|
+
* Checks if the given instance is not the root content block.
|
|
3995
|
+
*
|
|
3996
|
+
* @param {RTEBlock | VegaRTEContent} block - The instance to check.
|
|
3997
|
+
* @returns {boolean} True if the block is not the root content block, false otherwise.
|
|
3998
|
+
*/
|
|
3999
|
+
isRTEBlock(block) {
|
|
4000
|
+
return block && block.constructor.name !== 'VegaRTEContent';
|
|
4001
|
+
}
|
|
3809
4002
|
}
|
|
3810
4003
|
|
|
3811
4004
|
/**
|
|
@@ -4220,4 +4413,4 @@ class RTECodeBlock extends RTEBlock {
|
|
|
4220
4413
|
})();
|
|
4221
4414
|
RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element';
|
|
4222
4415
|
|
|
4223
|
-
export {
|
|
4416
|
+
export { TextColorAnnotationAction as $, ActionHandleStrategyRegistry as A, BlockUpdateTextStyleStrategy as B, CustomStyleAnnotation as C, NodeTypeEnum as D, CommonAnnotation as E, AnnotationAction as F, ReplaceChildNodesAction as G, HorizontalAlignmentAnnotationAction as H, InsertChildrenAfterAction as I, SplitBlockWithNodeAction as J, BlockDeleteNodeContentStrategy as K, RemoveChildrenStrategy as L, ModifyContentAction as M, NodeAnnotation as N, RTE_TEXT_COLORS as O, RTE_DEFAULT_TEXT_COLOR as P, CodeLanguage as Q, RTEDTOClassManager$1 as R, SyncUpSelectionAction as S, TextStyleAnnotationAction as T, UpdateTextAction as U, VegaRTEPresetToolbarItems as V, LinkAnnotationAction as W, CommonAnnotationTypeEnum as X, UpdateCodeBlockAction as Y, ZERO_WIDTH_SPACE as Z, SelectionChangeAction as _, ActionHandlerInterceptorRegistry as a, RTECodeBlockNode as a0, BoldAnnotationAction as a1, ItalicAnnotationAction as a2, UnderlineAnnotationAction as a3, TextStyleAnnotation as a4, BoldAnnotation as a5, ClearFormattingAnnotationAction as a6, CodeAnnotationAction as a7, StrikethroughAnnotationAction as a8, IndentAnnotationAction as a9, RTETextNode as b, ModifyContentActionType as c, ActionHandleStrategy as d, RTETextBlock as e, RTEBlock as f, RTEAnnotationStyle as g, AppendChildrenAction as h, RTENode as i, InsertChildrenBeforeAction as j, InternalAnnotationTypeEnum as k, BlockUpdateHorizontalAlignmentStrategy as l, BlockInsertLineBreakStrategy as m, BlockInsertLineBreakWithBlocksStrategy as n, BlockSplitWithTextNodeStrategy as o, BlockReplaceNodesStrategy as p, BlockMergeNodesStrategy as q, RemoveChildrenAction as r, stateEntityRenderingRegistry as s, BlockAnnotation as t, BlockAnnotationTypeEnum as u, CustomClassAnnotation as v, CustomAttributeAnnotation as w, RTECodeBlock as x, NodeAnnotationTypeEnum as y, RTEDecoratorNode as z };
|