@heartlandone/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
|
@@ -151,6 +151,7 @@ exports.ModifyContentActionType = void 0;
|
|
|
151
151
|
ModifyContentActionType["UPDATE_CURSOR_POSITION"] = "UPDATE_CURSOR_POSITION";
|
|
152
152
|
ModifyContentActionType["INSERT_TEXT_TO_DECORATOR_NODE"] = "INSERT_TEXT_TO_DECORATOR_NODE";
|
|
153
153
|
ModifyContentActionType["INSERT_NODE_TO_NEAREST_ROOT"] = "INSERT_NODE_TO_NEAREST_ROOT";
|
|
154
|
+
ModifyContentActionType["PASTE_CONTENT"] = "PASTE_CONTENT";
|
|
154
155
|
})(exports.ModifyContentActionType || (exports.ModifyContentActionType = {}));
|
|
155
156
|
/**
|
|
156
157
|
* Abstract class for update node content, delete node, insert node
|
|
@@ -385,6 +386,67 @@ class IndentAnnotation extends BlockAnnotation {
|
|
|
385
386
|
}
|
|
386
387
|
}
|
|
387
388
|
|
|
389
|
+
/**
|
|
390
|
+
* Registry for action handler interceptors, which can register and retrieve interceptors for specific actions and targets.
|
|
391
|
+
*/
|
|
392
|
+
class ActionHandlerInterceptorRegistry {
|
|
393
|
+
/**
|
|
394
|
+
* Bind a specific strategy to a special action type of the rich text node.
|
|
395
|
+
*
|
|
396
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
397
|
+
* @param {string} targetClass - The rich text node class name.
|
|
398
|
+
* @param {ActionHandlerInterceptor} strategy - The action handle strategy instance.
|
|
399
|
+
*/
|
|
400
|
+
static register(actionType, targetClass, strategy) {
|
|
401
|
+
if (!this.registry.has(targetClass)) {
|
|
402
|
+
this.registry.set(targetClass, new Map());
|
|
403
|
+
}
|
|
404
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
405
|
+
if (!this.registry.get(targetClass).has(actionType)) {
|
|
406
|
+
this.registry.get(targetClass).set(actionType, new Set());
|
|
407
|
+
}
|
|
408
|
+
this.registry.get(targetClass).get(actionType).add(strategy);
|
|
409
|
+
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Unregister the strategy for the specific action type and target class.
|
|
413
|
+
*
|
|
414
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
415
|
+
* @param {string} targetClass - The rich text node class name.
|
|
416
|
+
* @param {ActionHandlerInterceptor} strategy - The action handler interceptor instance.
|
|
417
|
+
*/
|
|
418
|
+
static unregister(actionType, targetClass, strategy) {
|
|
419
|
+
const strategyMap = this.registry.get(targetClass);
|
|
420
|
+
if (strategyMap) {
|
|
421
|
+
const strategySet = strategyMap.get(actionType);
|
|
422
|
+
if (strategySet) {
|
|
423
|
+
strategySet.delete(strategy);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Get the special interceptor strategy that before handle the action logic.
|
|
429
|
+
*
|
|
430
|
+
* @typedef T generic type
|
|
431
|
+
* @typedef target generic type
|
|
432
|
+
* @param {RTEActionType} action - The special action .
|
|
433
|
+
* @param {string} targetClass - The rich text node class name.
|
|
434
|
+
* @returns {Nullable<ActionHandlerInterceptor<T, target>>} - The action handler interceptor instance or null if not found.
|
|
435
|
+
*/
|
|
436
|
+
static get(action, targetClass) {
|
|
437
|
+
const targetClassName = targetClass.constructor.name;
|
|
438
|
+
const actionType = action instanceof ModifyContentAction ? action.type : action.constructor.name;
|
|
439
|
+
const strategyMap = this.registry.get(targetClassName);
|
|
440
|
+
if (strategyMap) {
|
|
441
|
+
const set = strategyMap.get(actionType);
|
|
442
|
+
if (set && set.size > 0) {
|
|
443
|
+
return Array.from(set).find((interceptor) => interceptor.canIntercept(action, targetClass));
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
ActionHandlerInterceptorRegistry.registry = new Map();
|
|
449
|
+
|
|
388
450
|
/**
|
|
389
451
|
* The strategies registry, contains static methods `register`, `get` and `getStrategyAndExecute`.
|
|
390
452
|
*/
|
|
@@ -403,6 +465,18 @@ class ActionHandleStrategyRegistry {
|
|
|
403
465
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
404
466
|
this.registry.get(targetClass).set(actionType, strategy);
|
|
405
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* Unregister the strategy for the specific action type and target class.
|
|
470
|
+
*
|
|
471
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
472
|
+
* @param {string} targetClass - The rich text node class name.
|
|
473
|
+
*/
|
|
474
|
+
static unregister(actionType, targetClass) {
|
|
475
|
+
const strategyMap = this.registry.get(targetClass);
|
|
476
|
+
if (strategyMap) {
|
|
477
|
+
strategyMap.delete(actionType);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
406
480
|
/**
|
|
407
481
|
* Get the special strategy that handle the action logic.
|
|
408
482
|
*
|
|
@@ -428,20 +502,31 @@ class ActionHandleStrategyRegistry {
|
|
|
428
502
|
* @returns {R | undefined} The return value of the strategy method execute invoke result.
|
|
429
503
|
*/
|
|
430
504
|
static executeTheStrategy(action, RTEInstance) {
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
505
|
+
const interceptor = ActionHandlerInterceptorRegistry.get(action, RTEInstance);
|
|
506
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
507
|
+
const executeStrategy = () => {
|
|
508
|
+
const actionType = action instanceof ModifyContentAction ? action.type : action.constructor.name;
|
|
509
|
+
const strategy = ActionHandleStrategyRegistry.get(actionType, RTEInstance.constructor.name);
|
|
510
|
+
if (strategy) {
|
|
511
|
+
action['executedFlag'] = true;
|
|
512
|
+
return strategy.execute(action, RTEInstance);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
globalSlimmerRegistry.LogUtility.warn(`Type ${actionType} action handle strategy is not registered in class ${RTEInstance.constructor.name}`);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
if (interceptor) {
|
|
519
|
+
return interceptor.intercept(executeStrategy, action, RTEInstance);
|
|
435
520
|
}
|
|
436
521
|
else {
|
|
437
|
-
|
|
522
|
+
return executeStrategy();
|
|
438
523
|
}
|
|
439
524
|
}
|
|
440
525
|
/**
|
|
441
526
|
* Check if the action type can be handled by strategy for the specific RTE instance.
|
|
442
527
|
*
|
|
443
528
|
* @param {string} actionType - The special action type or the action class name.
|
|
444
|
-
* @param {RTENode | RTEBlock} RTEInstance - The rich text editor node.
|
|
529
|
+
* @param {RTENode | RTEBlock | VegaRTEContent} RTEInstance - The rich text editor node.
|
|
445
530
|
* @returns {boolean} - Whether the action type can be handled by the strategy.
|
|
446
531
|
*/
|
|
447
532
|
static canHandle(actionType, RTEInstance) {
|
|
@@ -704,128 +789,184 @@ class InternalWrapperAnnotation extends BlockAnnotation {
|
|
|
704
789
|
}
|
|
705
790
|
}
|
|
706
791
|
|
|
792
|
+
exports.NodeAnnotationTypeEnum = void 0;
|
|
793
|
+
(function (NodeAnnotationTypeEnum) {
|
|
794
|
+
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
795
|
+
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
796
|
+
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
797
|
+
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
798
|
+
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
799
|
+
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
800
|
+
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
801
|
+
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
802
|
+
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
803
|
+
NodeAnnotationTypeEnum["INLINE_HTML"] = "INLINE_HTML";
|
|
804
|
+
NodeAnnotationTypeEnum["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
805
|
+
})(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
|
|
707
806
|
/**
|
|
708
|
-
* Abstract class for
|
|
807
|
+
* Abstract class for all annotations
|
|
709
808
|
*/
|
|
710
|
-
class
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
809
|
+
class NodeAnnotation extends Annotation {
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Class to handle the style representation of annotations for RTE blocks and nodes.
|
|
814
|
+
*/
|
|
815
|
+
class RTEAnnotationStyle {
|
|
816
|
+
constructor(dto) {
|
|
817
|
+
this.dtoType = dto instanceof RTEBlock ? 'block' : 'node';
|
|
818
|
+
this.annotationMap = dto.annotationMap;
|
|
714
819
|
}
|
|
715
820
|
/**
|
|
716
|
-
*
|
|
821
|
+
* Convert an AnnotationStyle object to a CSS text string.
|
|
717
822
|
*
|
|
718
|
-
* @param {
|
|
719
|
-
* @param {
|
|
823
|
+
* @param {RTERenderContext} options - Rendering context options.
|
|
824
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
825
|
+
* @param {Nullable<AnnotationStyle>} annotationStyle - The annotation style object, if null, get from toJSON().
|
|
826
|
+
* @returns {string} A string representing the CSS text.
|
|
720
827
|
*/
|
|
721
|
-
|
|
722
|
-
|
|
828
|
+
toCssText(options = { standalone: false }, canMergeKeyList, annotationStyle) {
|
|
829
|
+
annotationStyle = annotationStyle ? annotationStyle : this.toJSON(options, canMergeKeyList);
|
|
830
|
+
return Object.entries(Object.assign({}, annotationStyle))
|
|
831
|
+
.map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
|
|
832
|
+
.join('');
|
|
723
833
|
}
|
|
724
834
|
/**
|
|
725
|
-
*
|
|
726
|
-
* and value.
|
|
835
|
+
* Convert the annotation map to a JSON representation.
|
|
727
836
|
*
|
|
728
|
-
* @param {
|
|
729
|
-
*
|
|
730
|
-
* @
|
|
731
|
-
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
732
|
-
* annotation being created.
|
|
733
|
-
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
734
|
-
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
837
|
+
* @param {RTERenderContext} options - Rendering context options.
|
|
838
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
839
|
+
* @returns {AnnotationStyle} - The JSON representation of the annotation styles.
|
|
735
840
|
*/
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
case 'customStyle':
|
|
747
|
-
return CustomStyleAnnotation.from(value);
|
|
748
|
-
case 'internalWrapper':
|
|
749
|
-
return InternalWrapperAnnotation.from(value);
|
|
841
|
+
toJSON(options = { standalone: false }, canMergeKeyList) {
|
|
842
|
+
const styles = Array.from(this.annotationMap.values())
|
|
843
|
+
.filter((annotation) => this.filterAnnotation(annotation) || annotation instanceof CustomStyleAnnotation)
|
|
844
|
+
.map((annotation) => annotation.renderStyle(options))
|
|
845
|
+
.filter(typeGuard.isNonNullable);
|
|
846
|
+
if (canMergeKeyList && canMergeKeyList.length > 0) {
|
|
847
|
+
return this.mergeAnnotationStyles(styles, canMergeKeyList);
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
return styles.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
750
851
|
}
|
|
751
852
|
}
|
|
752
853
|
/**
|
|
753
|
-
*
|
|
854
|
+
* Filter annotations based on whether they are block or node annotations.
|
|
754
855
|
*
|
|
755
|
-
* @param {
|
|
756
|
-
* @
|
|
856
|
+
* @param {RTENodeAnnotationMapValue | RTEBlockAnnotationMapValue} annotation - The annotation to filter.
|
|
857
|
+
* @returns {boolean} - True if the annotation matches the DTO type, false otherwise.
|
|
757
858
|
*/
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
annotationMap.set(...item);
|
|
763
|
-
}
|
|
764
|
-
});
|
|
859
|
+
filterAnnotation(annotation) {
|
|
860
|
+
return this.dtoType === 'block'
|
|
861
|
+
? annotation instanceof BlockAnnotation
|
|
862
|
+
: annotation instanceof NodeAnnotation;
|
|
765
863
|
}
|
|
766
864
|
/**
|
|
767
|
-
*
|
|
865
|
+
* Merge an array of annotation styles into a single style object.
|
|
866
|
+
* e.g.,
|
|
867
|
+
* { textDecoration: 'underline', textDecoration: 'line-through' }
|
|
868
|
+
* -> { textDecoration: 'underline line-through' }
|
|
768
869
|
*
|
|
769
|
-
* @
|
|
870
|
+
* @param {AnnotationStyle[]} styles - Array of annotation style objects to merge.
|
|
871
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
872
|
+
* @returns {AnnotationStyle} - The merged annotation style object.
|
|
770
873
|
*/
|
|
771
|
-
|
|
772
|
-
const
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
874
|
+
mergeAnnotationStyles(styles, canMergeKeyList) {
|
|
875
|
+
const merged = {};
|
|
876
|
+
for (const style of styles) {
|
|
877
|
+
for (const key in style) {
|
|
878
|
+
const value = style[key];
|
|
879
|
+
const existing = merged[key];
|
|
880
|
+
if (typeof existing === 'string' &&
|
|
881
|
+
typeof value === 'string' &&
|
|
882
|
+
canMergeKeyList.includes(key)) {
|
|
883
|
+
merged[key] = Array.from(new Set(`${existing} ${value}`.split(/\s+/).filter(Boolean))).join(' ');
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
merged[key] = value;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
777
889
|
}
|
|
778
|
-
|
|
779
|
-
|
|
890
|
+
return merged;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
exports.NodeTypeEnum = void 0;
|
|
895
|
+
(function (NodeTypeEnum) {
|
|
896
|
+
NodeTypeEnum["TEXT"] = "TEXT";
|
|
897
|
+
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
898
|
+
NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
|
|
899
|
+
})(exports.NodeTypeEnum || (exports.NodeTypeEnum = {}));
|
|
900
|
+
/**
|
|
901
|
+
* Abstract class for all nodes
|
|
902
|
+
*/
|
|
903
|
+
class RTENode {
|
|
904
|
+
constructor(id, annotationMap) {
|
|
905
|
+
this.annotationMap = new Map();
|
|
906
|
+
this.id = id;
|
|
907
|
+
if (annotationMap) {
|
|
908
|
+
this.annotationMap = annotationMap;
|
|
780
909
|
}
|
|
781
910
|
}
|
|
782
911
|
/**
|
|
783
|
-
*
|
|
912
|
+
* Creates a new instance of the RTENode from the given JSON data.
|
|
784
913
|
*
|
|
785
|
-
* @
|
|
914
|
+
* @param {unknown} json - The JSON data to create the node from.
|
|
915
|
+
* @param {RTEBlock} parentBlock - The parent block of the node.
|
|
916
|
+
* @param {VegaRTETransformOptions} options - Options for transforming the node.
|
|
786
917
|
*/
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
918
|
+
static from(json, parentBlock, options) {
|
|
919
|
+
throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${parentBlock}, ${options}) is not implemented. Please implement this method in the subclass.`);
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Creates different types of text annotations based on the provided type and value.
|
|
923
|
+
*
|
|
924
|
+
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
925
|
+
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
926
|
+
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
927
|
+
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
928
|
+
*/
|
|
929
|
+
static createAnnotationEntity(type, value) {
|
|
930
|
+
switch (type) {
|
|
931
|
+
case 'customAttribute':
|
|
932
|
+
return CustomAttributeAnnotation.from(value);
|
|
933
|
+
case 'customClass':
|
|
934
|
+
return CustomClassAnnotation.from(value);
|
|
935
|
+
case 'customStyle':
|
|
936
|
+
return CustomStyleAnnotation.from(value);
|
|
937
|
+
}
|
|
794
938
|
}
|
|
795
939
|
/**
|
|
796
940
|
* Get annotation by type
|
|
797
941
|
*
|
|
798
942
|
* @typedef T generic type
|
|
799
|
-
* @param {
|
|
943
|
+
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
800
944
|
* @returns {Nullable<T>} - Annotation
|
|
801
945
|
*/
|
|
802
946
|
getAnnotationByType(type) {
|
|
803
947
|
return this.annotationMap.get(type);
|
|
804
948
|
}
|
|
805
949
|
/**
|
|
806
|
-
*
|
|
950
|
+
* Delete annotation by type
|
|
951
|
+
*
|
|
952
|
+
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
953
|
+
*/
|
|
954
|
+
deleteAnnotationByType(type) {
|
|
955
|
+
this.annotationMap.delete(type);
|
|
956
|
+
this.flushChange();
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Apply action to node
|
|
807
960
|
*
|
|
808
961
|
* @param {AnnotationAction} action - Annotation action
|
|
962
|
+
* @returns {this} - Node
|
|
809
963
|
*/
|
|
810
964
|
apply(action) {
|
|
811
965
|
this.doApply(action);
|
|
812
966
|
if (action.isFlushable) {
|
|
813
|
-
|
|
814
|
-
if (domNode) {
|
|
815
|
-
const nodeSubject = domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
816
|
-
if (nodeSubject) {
|
|
817
|
-
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
818
|
-
}
|
|
819
|
-
}
|
|
967
|
+
this.flushChange();
|
|
820
968
|
}
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Check if the block is a list item block
|
|
824
|
-
*
|
|
825
|
-
* @returns {boolean} True if the block is a list item block, false otherwise.
|
|
826
|
-
*/
|
|
827
|
-
isListItemBlock() {
|
|
828
|
-
return this.type === 'list-item';
|
|
969
|
+
return this;
|
|
829
970
|
}
|
|
830
971
|
/**
|
|
831
972
|
* Get styles from annotations
|
|
@@ -834,21 +975,18 @@ class RTEBlock {
|
|
|
834
975
|
* @returns {AnnotationStyle} - Annotation styles
|
|
835
976
|
*/
|
|
836
977
|
getStyles(options = { standalone: false }) {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
.map((annotation) => annotation.renderStyle(options))
|
|
840
|
-
.filter(typeGuard.isNonNullable)
|
|
841
|
-
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {})), (this.shouldRenderAsInternalWrapper() ? { display: 'contents' } : {}));
|
|
978
|
+
const rteAnnotationStyle = new RTEAnnotationStyle(this);
|
|
979
|
+
return rteAnnotationStyle.toJSON(options, ['textDecoration']);
|
|
842
980
|
}
|
|
843
981
|
/**
|
|
844
982
|
* Get classes from annotations
|
|
845
983
|
*
|
|
846
|
-
* @param {RTERenderContext} [options={ standalone: false }] - Options to control
|
|
984
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
|
|
847
985
|
* @returns {string} - Annotation style
|
|
848
986
|
*/
|
|
849
987
|
getClasses(options = { standalone: false }) {
|
|
850
988
|
return Array.from(this.annotationMap.values())
|
|
851
|
-
.filter((annotation) => annotation instanceof
|
|
989
|
+
.filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomClassAnnotation)
|
|
852
990
|
.map((annotation) => annotation.renderClass(options))
|
|
853
991
|
.filter(typeGuard.isNonNullable)
|
|
854
992
|
.reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
|
|
@@ -856,11 +994,27 @@ class RTEBlock {
|
|
|
856
994
|
/**
|
|
857
995
|
* Get custom attribute annotation, excluding "class" and "style"
|
|
858
996
|
*
|
|
859
|
-
* @returns {
|
|
997
|
+
* @returns {CustomAttributeAnnotation} - custom attribute annotation
|
|
860
998
|
*/
|
|
861
999
|
getCustomAttributesAnnotation() {
|
|
862
1000
|
return this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
|
|
863
1001
|
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Check if the node is a text node.
|
|
1004
|
+
*
|
|
1005
|
+
* @returns {boolean} - True if the node is a text node, false otherwise.
|
|
1006
|
+
*/
|
|
1007
|
+
isTextNode() {
|
|
1008
|
+
return false;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Get the HTMLElement reference associated with this node.
|
|
1012
|
+
*
|
|
1013
|
+
* @returns {Nullable<HTMLElement>} The HTMLElement reference or null if not found.
|
|
1014
|
+
*/
|
|
1015
|
+
getElementRef() {
|
|
1016
|
+
return stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1017
|
+
}
|
|
864
1018
|
/**
|
|
865
1019
|
* Generate attributes as string
|
|
866
1020
|
*
|
|
@@ -869,9 +1023,10 @@ class RTEBlock {
|
|
|
869
1023
|
*/
|
|
870
1024
|
generateAttributeString(...attrs) {
|
|
871
1025
|
var _a;
|
|
872
|
-
const
|
|
873
|
-
|
|
874
|
-
|
|
1026
|
+
const nodeAnnotationStyle = new RTEAnnotationStyle(this);
|
|
1027
|
+
const styles = nodeAnnotationStyle.toCssText({ standalone: true }, [
|
|
1028
|
+
'textDecoration',
|
|
1029
|
+
]);
|
|
875
1030
|
const customClassAnnotation = this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_CLASS);
|
|
876
1031
|
const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
|
|
877
1032
|
const attributes = [
|
|
@@ -883,136 +1038,248 @@ class RTEBlock {
|
|
|
883
1038
|
return attributes.length ? ` ${attributes.join(' ')}` : '';
|
|
884
1039
|
}
|
|
885
1040
|
/**
|
|
886
|
-
*
|
|
1041
|
+
* apply annotation action or modify content action
|
|
887
1042
|
*
|
|
888
|
-
* @param {AnnotationAction|ModifyContentAction} action
|
|
1043
|
+
* @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
|
|
889
1044
|
*/
|
|
890
1045
|
doApply(action) {
|
|
891
1046
|
if (action instanceof ModifyContentAction) {
|
|
892
|
-
|
|
1047
|
+
this.doModifyActionApply(action);
|
|
893
1048
|
}
|
|
894
1049
|
else {
|
|
895
|
-
this.
|
|
1050
|
+
this.doAnnotationActionApply(action);
|
|
896
1051
|
}
|
|
897
1052
|
}
|
|
898
1053
|
/**
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
* @param {AnnotationAction} action - Annotation action
|
|
1054
|
+
* Flush the value change
|
|
902
1055
|
*/
|
|
903
|
-
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
|
|
1056
|
+
flushChange() {
|
|
1057
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1058
|
+
if (domNode) {
|
|
1059
|
+
const nodeSubject = domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
1060
|
+
if (nodeSubject) {
|
|
1061
|
+
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
1062
|
+
}
|
|
907
1063
|
}
|
|
908
|
-
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
909
1064
|
}
|
|
910
1065
|
/**
|
|
911
|
-
*
|
|
1066
|
+
* Clones the annotations of the current RTETextNode.
|
|
912
1067
|
*
|
|
913
|
-
* @returns {
|
|
1068
|
+
* @returns {NodeAnnotations} A new Map containing cloned annotations.
|
|
914
1069
|
*/
|
|
915
1070
|
cloneAnnotations() {
|
|
916
1071
|
return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
|
|
917
1072
|
}
|
|
1073
|
+
/* istanbul ignore next */
|
|
1074
|
+
/**
|
|
1075
|
+
* Placeholder for the method to be implemented in sub classes.
|
|
1076
|
+
*
|
|
1077
|
+
* @param {AnnotationAction} action Annotation action
|
|
1078
|
+
*/
|
|
1079
|
+
doAnnotationActionApply(action) {
|
|
1080
|
+
}
|
|
1081
|
+
/* istanbul ignore next */
|
|
1082
|
+
/**
|
|
1083
|
+
* Placeholder for the method to be implemented in sub classes.
|
|
1084
|
+
*
|
|
1085
|
+
* @param {ModifyContentAction} action ModifyContentAction
|
|
1086
|
+
*/
|
|
1087
|
+
doModifyActionApply(action) {
|
|
1088
|
+
}
|
|
918
1089
|
}
|
|
919
1090
|
|
|
920
|
-
exports.NodeAnnotationTypeEnum = void 0;
|
|
921
|
-
(function (NodeAnnotationTypeEnum) {
|
|
922
|
-
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
923
|
-
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
924
|
-
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
925
|
-
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
926
|
-
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
927
|
-
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
928
|
-
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
929
|
-
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
930
|
-
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
931
|
-
NodeAnnotationTypeEnum["INLINE_HTML"] = "INLINE_HTML";
|
|
932
|
-
NodeAnnotationTypeEnum["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
933
|
-
})(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
|
|
934
1091
|
/**
|
|
935
|
-
*
|
|
1092
|
+
* RTEDTOClassManager is a singleton class that manages the registration and retrieval of RTE DTO classes.
|
|
1093
|
+
* It allows for the dynamic handling of different RTE blocks and nodes by their types.
|
|
936
1094
|
*/
|
|
937
|
-
class
|
|
1095
|
+
class RTEDTOClassManager {
|
|
1096
|
+
constructor() {
|
|
1097
|
+
// Register RTE Block DTO classes.
|
|
1098
|
+
this.RTE_BLOCK_DTO_CLASS_MAP = new Map();
|
|
1099
|
+
// Register RTE Block DTO classes.
|
|
1100
|
+
this.RTE_NODE_DTO_CLASS_MAP = new Map();
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Registers a new RTE DTO class.
|
|
1104
|
+
*
|
|
1105
|
+
* @typedef T - The type of the RTE DTO class to register.
|
|
1106
|
+
* @param {string} type - The type identifier for the RTE DTO class.
|
|
1107
|
+
* @param {ClassType<T>} RTEDTOClass - The class constructor for the RTE DTO.
|
|
1108
|
+
*/
|
|
1109
|
+
registerRTEDTOClass(type, RTEDTOClass) {
|
|
1110
|
+
if (RTEDTOClass.prototype instanceof RTEBlock) {
|
|
1111
|
+
this.RTE_BLOCK_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1112
|
+
}
|
|
1113
|
+
else if (RTEDTOClass.prototype instanceof RTENode) {
|
|
1114
|
+
this.RTE_NODE_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1115
|
+
}
|
|
1116
|
+
else {
|
|
1117
|
+
throw new Error(`Invalid RTE DTO class type: ${type}`);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Retrieves the RTE block class for a given type.
|
|
1122
|
+
*
|
|
1123
|
+
* @param {string} type - The type identifier for the RTE block.
|
|
1124
|
+
* @returns {Nullable<RTEBlockDTOClass>} - The class constructor for the RTE block, or null if not found.
|
|
1125
|
+
*/
|
|
1126
|
+
getRTEBlockClass(type) {
|
|
1127
|
+
return this.RTE_BLOCK_DTO_CLASS_MAP.get(type);
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Retrieves the RTE node class for a given type.
|
|
1131
|
+
*
|
|
1132
|
+
* @param {string} type - The type identifier for the RTE node.
|
|
1133
|
+
* @returns {Nullable<RTENodeDTOClass>} - The class constructor for the RTE node, or null if not found.
|
|
1134
|
+
*/
|
|
1135
|
+
getRTENodeClass(type) {
|
|
1136
|
+
return this.RTE_NODE_DTO_CLASS_MAP.get(type);
|
|
1137
|
+
}
|
|
938
1138
|
}
|
|
1139
|
+
const RTEDTOClassManager$1 = new RTEDTOClassManager();
|
|
939
1140
|
|
|
940
|
-
exports.NodeTypeEnum = void 0;
|
|
941
|
-
(function (NodeTypeEnum) {
|
|
942
|
-
NodeTypeEnum["TEXT"] = "TEXT";
|
|
943
|
-
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
944
|
-
NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
|
|
945
|
-
})(exports.NodeTypeEnum || (exports.NodeTypeEnum = {}));
|
|
946
1141
|
/**
|
|
947
|
-
* Abstract class for
|
|
1142
|
+
* Abstract class for block
|
|
948
1143
|
*/
|
|
949
|
-
class
|
|
950
|
-
constructor(id
|
|
1144
|
+
class RTEBlock {
|
|
1145
|
+
constructor(id) {
|
|
951
1146
|
this.annotationMap = new Map();
|
|
952
1147
|
this.id = id;
|
|
953
|
-
|
|
954
|
-
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Creates a new instance of the block from the given JSON object.
|
|
1151
|
+
*
|
|
1152
|
+
* @param {unknown} json - The JSON object to create the block from.
|
|
1153
|
+
* @param {VegaRTETransformOptions} options - Options for transforming the block.
|
|
1154
|
+
*/
|
|
1155
|
+
static from(json, options) {
|
|
1156
|
+
throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${options}) is not implemented. Please implement this method in the subclass.`);
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Generates block children from an array of VegaRTEContentBlock.
|
|
1160
|
+
*
|
|
1161
|
+
* @param {VegaRTEContentBlock[]} blockArray - The array of VegaRTEContentBlock to generate children from.
|
|
1162
|
+
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
1163
|
+
* @param {VegaRTEContent | RTEBlock} [parentBlock] - Optional parent block.
|
|
1164
|
+
* @returns {RTEBlock[]} An array of generated RTEBlock children.
|
|
1165
|
+
*/
|
|
1166
|
+
static generateBlockChildren(blockArray, options, parentBlock) {
|
|
1167
|
+
return blockArray
|
|
1168
|
+
.map((child) => {
|
|
1169
|
+
const BlockClass = RTEDTOClassManager$1.getRTEBlockClass(child.type);
|
|
1170
|
+
if (BlockClass) {
|
|
1171
|
+
const block = BlockClass.from(child, options);
|
|
1172
|
+
block.parent = parentBlock;
|
|
1173
|
+
return block;
|
|
1174
|
+
}
|
|
1175
|
+
})
|
|
1176
|
+
.filter(typeGuard.isNonNullable);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
1180
|
+
* and value.
|
|
1181
|
+
*
|
|
1182
|
+
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
1183
|
+
* the type of annotation entity to create.
|
|
1184
|
+
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
1185
|
+
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
1186
|
+
* annotation being created.
|
|
1187
|
+
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
1188
|
+
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
1189
|
+
*/
|
|
1190
|
+
static createAnnotationEntity(type, value) {
|
|
1191
|
+
switch (type) {
|
|
1192
|
+
case 'textAlign':
|
|
1193
|
+
return HorizontalAlignmentAnnotation.from(value);
|
|
1194
|
+
case 'indent':
|
|
1195
|
+
return IndentAnnotation.from(value);
|
|
1196
|
+
case 'customAttribute':
|
|
1197
|
+
return CustomAttributeAnnotation.from(value);
|
|
1198
|
+
case 'customClass':
|
|
1199
|
+
return CustomClassAnnotation.from(value);
|
|
1200
|
+
case 'customStyle':
|
|
1201
|
+
return CustomStyleAnnotation.from(value);
|
|
1202
|
+
case 'internalWrapper':
|
|
1203
|
+
return InternalWrapperAnnotation.from(value);
|
|
955
1204
|
}
|
|
956
1205
|
}
|
|
957
1206
|
/**
|
|
958
|
-
*
|
|
1207
|
+
* Converts annotations to an array of block annotation entities.
|
|
1208
|
+
*
|
|
1209
|
+
* @param {BlockAnnotations} annotationMap - The map to store the converted annotations.
|
|
1210
|
+
* @param {VegaRTEBlockAnnotations} annotations - The annotations to convert.
|
|
1211
|
+
*/
|
|
1212
|
+
static convertAnnotationsToMap(annotationMap, annotations) {
|
|
1213
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
1214
|
+
const item = this.createAnnotationEntity(type, value);
|
|
1215
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1216
|
+
annotationMap.set(...item);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Check if the block should be rendered as a wrapper.
|
|
959
1222
|
*
|
|
960
|
-
* @
|
|
961
|
-
* @param {RTEBlock} parentBlock - The parent block of the node.
|
|
962
|
-
* @param {VegaRTETransformOptions} options - Options for transforming the node.
|
|
1223
|
+
* @returns {boolean} - Returns true if the block is an internal wrapper.
|
|
963
1224
|
*/
|
|
964
|
-
|
|
965
|
-
|
|
1225
|
+
shouldRenderAsInternalWrapper() {
|
|
1226
|
+
const internalWrapperAnnotation = this.getAnnotationByType(exports.BlockAnnotationTypeEnum.INTERNAL_WRAPPER);
|
|
1227
|
+
if (internalWrapperAnnotation) {
|
|
1228
|
+
return (internalWrapperAnnotation.internalWrapper &&
|
|
1229
|
+
Array.from(this.annotationMap.values()).filter((annotation) => !(annotation instanceof LinkGroupAnnotation) &&
|
|
1230
|
+
!(annotation instanceof InternalWrapperAnnotation)).length === 0);
|
|
1231
|
+
}
|
|
1232
|
+
else {
|
|
1233
|
+
return false;
|
|
1234
|
+
}
|
|
966
1235
|
}
|
|
967
1236
|
/**
|
|
968
|
-
*
|
|
1237
|
+
* Class to JSON object
|
|
969
1238
|
*
|
|
970
|
-
* @
|
|
971
|
-
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
972
|
-
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
973
|
-
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
1239
|
+
* @returns {VegaRTEBlockBase} - JSON object
|
|
974
1240
|
*/
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
return CustomStyleAnnotation.from(value);
|
|
983
|
-
}
|
|
1241
|
+
toJSON() {
|
|
1242
|
+
const annotations = Array.from(this.annotationMap.values())
|
|
1243
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CommonAnnotation)
|
|
1244
|
+
.reduce((record, annotation) => {
|
|
1245
|
+
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
1246
|
+
}, {});
|
|
1247
|
+
return Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {}));
|
|
984
1248
|
}
|
|
985
1249
|
/**
|
|
986
1250
|
* Get annotation by type
|
|
987
1251
|
*
|
|
988
1252
|
* @typedef T generic type
|
|
989
|
-
* @param {
|
|
1253
|
+
* @param {keyof typeof BlockAnnotationTypeEnum} type - Annotation type
|
|
990
1254
|
* @returns {Nullable<T>} - Annotation
|
|
991
1255
|
*/
|
|
992
1256
|
getAnnotationByType(type) {
|
|
993
1257
|
return this.annotationMap.get(type);
|
|
994
1258
|
}
|
|
995
1259
|
/**
|
|
996
|
-
*
|
|
997
|
-
*
|
|
998
|
-
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
999
|
-
*/
|
|
1000
|
-
deleteAnnotationByType(type) {
|
|
1001
|
-
this.annotationMap.delete(type);
|
|
1002
|
-
this.flushChange();
|
|
1003
|
-
}
|
|
1004
|
-
/**
|
|
1005
|
-
* Apply action to node
|
|
1260
|
+
* Apply action to block
|
|
1006
1261
|
*
|
|
1007
1262
|
* @param {AnnotationAction} action - Annotation action
|
|
1008
|
-
* @returns {this} - Node
|
|
1009
1263
|
*/
|
|
1010
1264
|
apply(action) {
|
|
1011
1265
|
this.doApply(action);
|
|
1012
1266
|
if (action.isFlushable) {
|
|
1013
|
-
|
|
1267
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1268
|
+
if (domNode) {
|
|
1269
|
+
const nodeSubject = domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
1270
|
+
if (nodeSubject) {
|
|
1271
|
+
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1014
1274
|
}
|
|
1015
|
-
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Check if the block is a list item block
|
|
1278
|
+
*
|
|
1279
|
+
* @returns {boolean} True if the block is a list item block, false otherwise.
|
|
1280
|
+
*/
|
|
1281
|
+
isListItemBlock() {
|
|
1282
|
+
return this.type === 'list-item';
|
|
1016
1283
|
}
|
|
1017
1284
|
/**
|
|
1018
1285
|
* Get styles from annotations
|
|
@@ -1021,21 +1288,19 @@ class RTENode {
|
|
|
1021
1288
|
* @returns {AnnotationStyle} - Annotation styles
|
|
1022
1289
|
*/
|
|
1023
1290
|
getStyles(options = { standalone: false }) {
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
.filter(Boolean);
|
|
1028
|
-
return this.mergeAnnotationStyles(styles, ['textDecoration']);
|
|
1291
|
+
const rteAnnotationStyle = new RTEAnnotationStyle(this);
|
|
1292
|
+
const blockAnnotationStyle = rteAnnotationStyle.toJSON(options);
|
|
1293
|
+
return Object.assign(Object.assign({}, blockAnnotationStyle), (this.shouldRenderAsInternalWrapper() ? { display: 'contents' } : {}));
|
|
1029
1294
|
}
|
|
1030
1295
|
/**
|
|
1031
1296
|
* Get classes from annotations
|
|
1032
1297
|
*
|
|
1033
|
-
* @param {RTERenderContext} [options={ standalone: false }] - Options to control
|
|
1298
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control standalone mode
|
|
1034
1299
|
* @returns {string} - Annotation style
|
|
1035
1300
|
*/
|
|
1036
1301
|
getClasses(options = { standalone: false }) {
|
|
1037
1302
|
return Array.from(this.annotationMap.values())
|
|
1038
|
-
.filter((annotation) => annotation instanceof
|
|
1303
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomClassAnnotation)
|
|
1039
1304
|
.map((annotation) => annotation.renderClass(options))
|
|
1040
1305
|
.filter(typeGuard.isNonNullable)
|
|
1041
1306
|
.reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
|
|
@@ -1043,27 +1308,11 @@ class RTENode {
|
|
|
1043
1308
|
/**
|
|
1044
1309
|
* Get custom attribute annotation, excluding "class" and "style"
|
|
1045
1310
|
*
|
|
1046
|
-
* @returns {CustomAttributeAnnotation} - custom attribute annotation
|
|
1311
|
+
* @returns {Nullable<CustomAttributeAnnotation>} - custom attribute annotation
|
|
1047
1312
|
*/
|
|
1048
1313
|
getCustomAttributesAnnotation() {
|
|
1049
1314
|
return this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
|
|
1050
1315
|
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Check if the node is a text node.
|
|
1053
|
-
*
|
|
1054
|
-
* @returns {boolean} - True if the node is a text node, false otherwise.
|
|
1055
|
-
*/
|
|
1056
|
-
isTextNode() {
|
|
1057
|
-
return false;
|
|
1058
|
-
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Get the HTMLElement reference associated with this node.
|
|
1061
|
-
*
|
|
1062
|
-
* @returns {Nullable<HTMLElement>} The HTMLElement reference or null if not found.
|
|
1063
|
-
*/
|
|
1064
|
-
getElementRef() {
|
|
1065
|
-
return stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1066
|
-
}
|
|
1067
1316
|
/**
|
|
1068
1317
|
* Generate attributes as string
|
|
1069
1318
|
*
|
|
@@ -1072,9 +1321,8 @@ class RTENode {
|
|
|
1072
1321
|
*/
|
|
1073
1322
|
generateAttributeString(...attrs) {
|
|
1074
1323
|
var _a;
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1077
|
-
.join('');
|
|
1324
|
+
const blockAnnotationStyle = new RTEAnnotationStyle(this);
|
|
1325
|
+
const styles = blockAnnotationStyle.toCssText({ standalone: true });
|
|
1078
1326
|
const customClassAnnotation = this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_CLASS);
|
|
1079
1327
|
const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
|
|
1080
1328
|
const attributes = [
|
|
@@ -1086,82 +1334,38 @@ class RTENode {
|
|
|
1086
1334
|
return attributes.length ? ` ${attributes.join(' ')}` : '';
|
|
1087
1335
|
}
|
|
1088
1336
|
/**
|
|
1089
|
-
*
|
|
1337
|
+
* Apply action to block
|
|
1090
1338
|
*
|
|
1091
|
-
* @param {AnnotationAction
|
|
1339
|
+
* @param {AnnotationAction|ModifyContentAction} action - Annotation action
|
|
1092
1340
|
*/
|
|
1093
1341
|
doApply(action) {
|
|
1094
1342
|
if (action instanceof ModifyContentAction) {
|
|
1095
|
-
|
|
1343
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
1096
1344
|
}
|
|
1097
1345
|
else {
|
|
1098
|
-
this.
|
|
1346
|
+
this.applyAnnotationAction(action);
|
|
1099
1347
|
}
|
|
1100
1348
|
}
|
|
1101
1349
|
/**
|
|
1102
|
-
*
|
|
1350
|
+
* Apply annotation action to block
|
|
1351
|
+
*
|
|
1352
|
+
* @param {AnnotationAction} action - Annotation action
|
|
1103
1353
|
*/
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1106
|
-
if (
|
|
1107
|
-
|
|
1108
|
-
if (nodeSubject) {
|
|
1109
|
-
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
1110
|
-
}
|
|
1354
|
+
applyAnnotationAction(action) {
|
|
1355
|
+
const annotation = action.toAnnotation();
|
|
1356
|
+
if (!(annotation instanceof LinkGroupAnnotation)) {
|
|
1357
|
+
this.annotationMap.set(annotation.type, annotation);
|
|
1111
1358
|
}
|
|
1359
|
+
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
1112
1360
|
}
|
|
1113
1361
|
/**
|
|
1114
|
-
*
|
|
1362
|
+
* clone annotations of the block
|
|
1115
1363
|
*
|
|
1116
|
-
* @returns {
|
|
1364
|
+
* @returns {BlockAnnotations} - Cloned annotations
|
|
1117
1365
|
*/
|
|
1118
1366
|
cloneAnnotations() {
|
|
1119
1367
|
return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
|
|
1120
1368
|
}
|
|
1121
|
-
/* istanbul ignore next */
|
|
1122
|
-
/**
|
|
1123
|
-
* Placeholder for the method to be implemented in sub classes.
|
|
1124
|
-
*
|
|
1125
|
-
* @param {AnnotationAction} action Annotation action
|
|
1126
|
-
*/
|
|
1127
|
-
doAnnotationActionApply(action) {
|
|
1128
|
-
}
|
|
1129
|
-
/* istanbul ignore next */
|
|
1130
|
-
/**
|
|
1131
|
-
* Placeholder for the method to be implemented in sub classes.
|
|
1132
|
-
*
|
|
1133
|
-
* @param {ModifyContentAction} action ModifyContentAction
|
|
1134
|
-
*/
|
|
1135
|
-
doModifyActionApply(action) {
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Merge an array of annotation styles into a single style object.
|
|
1139
|
-
* e.g.,
|
|
1140
|
-
* { textDecoration: 'underline', textDecoration: 'line-through' }
|
|
1141
|
-
* -> { textDecoration: 'underline line-through' }
|
|
1142
|
-
*
|
|
1143
|
-
* @param {AnnotationStyle[]} styles - Array of annotation style objects to merge.
|
|
1144
|
-
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
1145
|
-
* @returns {AnnotationStyle} - The merged annotation style object.
|
|
1146
|
-
*/
|
|
1147
|
-
mergeAnnotationStyles(styles, canMergeKeyList) {
|
|
1148
|
-
const merged = {};
|
|
1149
|
-
for (const style of styles) {
|
|
1150
|
-
for (const key in style) {
|
|
1151
|
-
const value = style[key];
|
|
1152
|
-
const existing = merged[key];
|
|
1153
|
-
if (typeof existing === 'string' &&
|
|
1154
|
-
typeof value === 'string' &&
|
|
1155
|
-
canMergeKeyList.includes(key)) {
|
|
1156
|
-
merged[key] = Array.from(new Set(`${existing} ${value}`.split(/\s+/).filter(Boolean))).join(' ');
|
|
1157
|
-
}
|
|
1158
|
-
else {
|
|
1159
|
-
merged[key] = value;
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
return merged;
|
|
1164
|
-
}
|
|
1165
1369
|
}
|
|
1166
1370
|
|
|
1167
1371
|
/**
|
|
@@ -1671,56 +1875,6 @@ class SyncUpSelectionAction extends AnnotationAction {
|
|
|
1671
1875
|
}
|
|
1672
1876
|
}
|
|
1673
1877
|
|
|
1674
|
-
/**
|
|
1675
|
-
* RTEDTOClassManager is a singleton class that manages the registration and retrieval of RTE DTO classes.
|
|
1676
|
-
* It allows for the dynamic handling of different RTE blocks and nodes by their types.
|
|
1677
|
-
*/
|
|
1678
|
-
class RTEDTOClassManager {
|
|
1679
|
-
constructor() {
|
|
1680
|
-
// Register RTE Block DTO classes.
|
|
1681
|
-
this.RTE_BLOCK_DTO_CLASS_MAP = new Map();
|
|
1682
|
-
// Register RTE Block DTO classes.
|
|
1683
|
-
this.RTE_NODE_DTO_CLASS_MAP = new Map();
|
|
1684
|
-
}
|
|
1685
|
-
/**
|
|
1686
|
-
* Registers a new RTE DTO class.
|
|
1687
|
-
*
|
|
1688
|
-
* @typedef T - The type of the RTE DTO class to register.
|
|
1689
|
-
* @param {string} type - The type identifier for the RTE DTO class.
|
|
1690
|
-
* @param {ClassType<T>} RTEDTOClass - The class constructor for the RTE DTO.
|
|
1691
|
-
*/
|
|
1692
|
-
registerRTEDTOClass(type, RTEDTOClass) {
|
|
1693
|
-
if (RTEDTOClass.prototype instanceof RTEBlock) {
|
|
1694
|
-
this.RTE_BLOCK_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1695
|
-
}
|
|
1696
|
-
else if (RTEDTOClass.prototype instanceof RTENode) {
|
|
1697
|
-
this.RTE_NODE_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1698
|
-
}
|
|
1699
|
-
else {
|
|
1700
|
-
throw new Error(`Invalid RTE DTO class type: ${type}`);
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
/**
|
|
1704
|
-
* Retrieves the RTE block class for a given type.
|
|
1705
|
-
*
|
|
1706
|
-
* @param {string} type - The type identifier for the RTE block.
|
|
1707
|
-
* @returns {Nullable<RTEBlockDTOClass>} - The class constructor for the RTE block, or null if not found.
|
|
1708
|
-
*/
|
|
1709
|
-
getRTEBlockClass(type) {
|
|
1710
|
-
return this.RTE_BLOCK_DTO_CLASS_MAP.get(type);
|
|
1711
|
-
}
|
|
1712
|
-
/**
|
|
1713
|
-
* Retrieves the RTE node class for a given type.
|
|
1714
|
-
*
|
|
1715
|
-
* @param {string} type - The type identifier for the RTE node.
|
|
1716
|
-
* @returns {Nullable<RTENodeDTOClass>} - The class constructor for the RTE node, or null if not found.
|
|
1717
|
-
*/
|
|
1718
|
-
getRTENodeClass(type) {
|
|
1719
|
-
return this.RTE_NODE_DTO_CLASS_MAP.get(type);
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
const RTEDTOClassManager$1 = new RTEDTOClassManager();
|
|
1723
|
-
|
|
1724
1878
|
/**
|
|
1725
1879
|
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
1726
1880
|
*/
|
|
@@ -2472,6 +2626,25 @@ class PlainTextAnnotation extends NodeAnnotation {
|
|
|
2472
2626
|
}
|
|
2473
2627
|
}
|
|
2474
2628
|
|
|
2629
|
+
/**
|
|
2630
|
+
* Action to toggle the text color annotation visibility/state.
|
|
2631
|
+
*/
|
|
2632
|
+
class TextColorAnnotationAction extends TextSplittableAction {
|
|
2633
|
+
constructor(textColor) {
|
|
2634
|
+
super();
|
|
2635
|
+
this.isFlushable = true;
|
|
2636
|
+
this.textColor = textColor;
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Converts the action into a text color annotation.
|
|
2640
|
+
*
|
|
2641
|
+
* @returns {Annotation} the annotation
|
|
2642
|
+
*/
|
|
2643
|
+
toAnnotation() {
|
|
2644
|
+
return new TextColorAnnotation(this.textColor);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2475
2648
|
/**
|
|
2476
2649
|
* Text node
|
|
2477
2650
|
*/
|
|
@@ -2658,6 +2831,13 @@ class RTETextNode extends RTENode {
|
|
|
2658
2831
|
}
|
|
2659
2832
|
ActionHandleStrategyRegistry.register(TextSplittableAction.name, dtoClassName, new NodeSplitTextStrategy());
|
|
2660
2833
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_LINK_GROUP, dtoClassName, new DeleteLinkGroupStrategy());
|
|
2834
|
+
ActionHandleStrategyRegistry.register(BoldAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2835
|
+
ActionHandleStrategyRegistry.register(ClearFormattingAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2836
|
+
ActionHandleStrategyRegistry.register(ItalicAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2837
|
+
ActionHandleStrategyRegistry.register(UnderlineAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2838
|
+
ActionHandleStrategyRegistry.register(TextColorAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2839
|
+
ActionHandleStrategyRegistry.register(StrikethroughAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2840
|
+
ActionHandleStrategyRegistry.register(CodeAnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2661
2841
|
ActionHandleStrategyRegistry.register(AnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2662
2842
|
RTETextNode.registerActionStrategyStatus[dtoClassName] = true;
|
|
2663
2843
|
}
|
|
@@ -2708,9 +2888,6 @@ class RTETextNode extends RTENode {
|
|
|
2708
2888
|
/**
|
|
2709
2889
|
* 1. Try to get the specific strategy for the action and node type first (e.g., LinkAnnotationAction on RTETextNode).
|
|
2710
2890
|
* 2. If no specific strategy found, try to get the generic NodeUpdateAnnotationMapStrategy for AnnotationAction on RTETextNode.
|
|
2711
|
-
*
|
|
2712
|
-
* 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.
|
|
2713
|
-
* TODO: Update the other annotation actions to follow this pattern. https://gethired.atlassian.net/browse/VD-7367
|
|
2714
2891
|
*/
|
|
2715
2892
|
const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, node.constructor.name);
|
|
2716
2893
|
if (strategy) {
|
|
@@ -3546,11 +3723,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
3546
3723
|
toHtml() {
|
|
3547
3724
|
const BlockTag = this.getBlockTag();
|
|
3548
3725
|
const attrStr = super.generateAttributeString();
|
|
3549
|
-
const
|
|
3550
|
-
let nodesHtml = this.children.map((node) => node.toHtml()).join('');
|
|
3551
|
-
if (linkGroupAnnotation && this.children.length > 0) {
|
|
3552
|
-
nodesHtml = this.generateLinkHtml(linkGroupAnnotation, nodesHtml);
|
|
3553
|
-
}
|
|
3726
|
+
const nodesHtml = this.getChildrenHtml();
|
|
3554
3727
|
return super.shouldRenderAsInternalWrapper()
|
|
3555
3728
|
? nodesHtml
|
|
3556
3729
|
: [`<${BlockTag}${attrStr}>`, nodesHtml, `</${BlockTag}>`].join('');
|
|
@@ -3616,6 +3789,19 @@ class RTETextBlock extends RTEBlock {
|
|
|
3616
3789
|
return 'p';
|
|
3617
3790
|
}
|
|
3618
3791
|
}
|
|
3792
|
+
/**
|
|
3793
|
+
* Get the HTML string for the children nodes, including handling link group annotations.
|
|
3794
|
+
*
|
|
3795
|
+
* @returns {string} The HTML string representing the children nodes.
|
|
3796
|
+
*/
|
|
3797
|
+
getChildrenHtml() {
|
|
3798
|
+
const linkGroupAnnotation = this.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
3799
|
+
let nodesHtml = this.children.map((node) => node.toHtml()).join('');
|
|
3800
|
+
if (linkGroupAnnotation && this.children.length > 0) {
|
|
3801
|
+
nodesHtml = this.generateLinkHtml(linkGroupAnnotation, nodesHtml);
|
|
3802
|
+
}
|
|
3803
|
+
return nodesHtml;
|
|
3804
|
+
}
|
|
3619
3805
|
/**
|
|
3620
3806
|
* @inheritDoc
|
|
3621
3807
|
*/
|
|
@@ -3755,9 +3941,7 @@ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
|
3755
3941
|
if (currentBlockIndex > 0) {
|
|
3756
3942
|
return currentBlock.parent.children[currentBlockIndex - 1];
|
|
3757
3943
|
}
|
|
3758
|
-
else if ((currentBlock.parent
|
|
3759
|
-
currentBlock.parent['type'] === 'bullet-list') &&
|
|
3760
|
-
currentBlockIndex === 0) {
|
|
3944
|
+
else if (this.isRTEBlock(currentBlock.parent) && currentBlockIndex === 0) {
|
|
3761
3945
|
return this.getPreviousBlock(currentBlock.parent);
|
|
3762
3946
|
}
|
|
3763
3947
|
}
|
|
@@ -3808,6 +3992,15 @@ class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
|
3808
3992
|
}
|
|
3809
3993
|
}
|
|
3810
3994
|
}
|
|
3995
|
+
/**
|
|
3996
|
+
* Checks if the given instance is not the root content block.
|
|
3997
|
+
*
|
|
3998
|
+
* @param {RTEBlock | VegaRTEContent} block - The instance to check.
|
|
3999
|
+
* @returns {boolean} True if the block is not the root content block, false otherwise.
|
|
4000
|
+
*/
|
|
4001
|
+
isRTEBlock(block) {
|
|
4002
|
+
return block && block.constructor.name !== 'VegaRTEContent';
|
|
4003
|
+
}
|
|
3811
4004
|
}
|
|
3812
4005
|
|
|
3813
4006
|
/**
|
|
@@ -4224,6 +4417,7 @@ RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element
|
|
|
4224
4417
|
|
|
4225
4418
|
exports.ActionHandleStrategy = ActionHandleStrategy;
|
|
4226
4419
|
exports.ActionHandleStrategyRegistry = ActionHandleStrategyRegistry;
|
|
4420
|
+
exports.ActionHandlerInterceptorRegistry = ActionHandlerInterceptorRegistry;
|
|
4227
4421
|
exports.AnnotationAction = AnnotationAction;
|
|
4228
4422
|
exports.AppendChildrenAction = AppendChildrenAction;
|
|
4229
4423
|
exports.BlockAnnotation = BlockAnnotation;
|
|
@@ -4234,6 +4428,7 @@ exports.BlockMergeNodesStrategy = BlockMergeNodesStrategy;
|
|
|
4234
4428
|
exports.BlockReplaceNodesStrategy = BlockReplaceNodesStrategy;
|
|
4235
4429
|
exports.BlockSplitWithTextNodeStrategy = BlockSplitWithTextNodeStrategy;
|
|
4236
4430
|
exports.BlockUpdateHorizontalAlignmentStrategy = BlockUpdateHorizontalAlignmentStrategy;
|
|
4431
|
+
exports.BlockUpdateTextStyleStrategy = BlockUpdateTextStyleStrategy;
|
|
4237
4432
|
exports.BoldAnnotation = BoldAnnotation;
|
|
4238
4433
|
exports.BoldAnnotationAction = BoldAnnotationAction;
|
|
4239
4434
|
exports.ClearFormattingAnnotationAction = ClearFormattingAnnotationAction;
|
|
@@ -4250,6 +4445,7 @@ exports.ItalicAnnotationAction = ItalicAnnotationAction;
|
|
|
4250
4445
|
exports.LinkAnnotationAction = LinkAnnotationAction;
|
|
4251
4446
|
exports.ModifyContentAction = ModifyContentAction;
|
|
4252
4447
|
exports.NodeAnnotation = NodeAnnotation;
|
|
4448
|
+
exports.RTEAnnotationStyle = RTEAnnotationStyle;
|
|
4253
4449
|
exports.RTEBlock = RTEBlock;
|
|
4254
4450
|
exports.RTECodeBlock = RTECodeBlock;
|
|
4255
4451
|
exports.RTECodeBlockNode = RTECodeBlockNode;
|
|
@@ -4267,8 +4463,7 @@ exports.SelectionChangeAction = SelectionChangeAction;
|
|
|
4267
4463
|
exports.SplitBlockWithNodeAction = SplitBlockWithNodeAction;
|
|
4268
4464
|
exports.StrikethroughAnnotationAction = StrikethroughAnnotationAction;
|
|
4269
4465
|
exports.SyncUpSelectionAction = SyncUpSelectionAction;
|
|
4270
|
-
exports.
|
|
4271
|
-
exports.TextSplittableAction = TextSplittableAction;
|
|
4466
|
+
exports.TextColorAnnotationAction = TextColorAnnotationAction;
|
|
4272
4467
|
exports.TextStyleAnnotation = TextStyleAnnotation;
|
|
4273
4468
|
exports.TextStyleAnnotationAction = TextStyleAnnotationAction;
|
|
4274
4469
|
exports.UnderlineAnnotationAction = UnderlineAnnotationAction;
|