@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
|
@@ -6,13 +6,13 @@ const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
|
|
|
6
6
|
const dynamicSlimmer = require('./dynamic-slimmer-f31fdfd7.js');
|
|
7
7
|
const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-11937d6f.js');
|
|
8
8
|
const darkModeStyleController = require('./dark-mode-style-controller-27809ff8.js');
|
|
9
|
-
const internalVegaEventManager = require('./internal-vega-event-manager-
|
|
9
|
+
const internalVegaEventManager = require('./internal-vega-event-manager-45d451de.js');
|
|
10
10
|
const number = require('./number-4816603d.js');
|
|
11
|
-
const dtoRendererManager = require('./dto-renderer-manager-
|
|
12
|
-
const codeBlock = require('./code-block-
|
|
11
|
+
const dtoRendererManager = require('./dto-renderer-manager-b7969d6c.js');
|
|
12
|
+
const codeBlock = require('./code-block-39074880.js');
|
|
13
|
+
const internalIconManager = require('./internal-icon-manager-32f9ed63.js');
|
|
13
14
|
const typeGuard = require('./type-guard-f12b5bae.js');
|
|
14
15
|
const baseRenderer = require('./base-renderer-0a3b62b7.js');
|
|
15
|
-
const internalIconManager = require('./internal-icon-manager-32f9ed63.js');
|
|
16
16
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-f040608b.js');
|
|
17
17
|
|
|
18
18
|
const VegaLoaderRuntimeMetricsPayloadDefinition = [
|
|
@@ -1297,6 +1297,104 @@ __decorate([
|
|
|
1297
1297
|
], VegaSkeletonLoaderController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1298
1298
|
const VegaSkeletonLoader = new VegaSkeletonLoaderController();
|
|
1299
1299
|
|
|
1300
|
+
/**
|
|
1301
|
+
* Base renderer for Vega Rich Text Editor.
|
|
1302
|
+
*/
|
|
1303
|
+
class VegaRTEExtensionRenderer extends baseRenderer.VegaRTEBaseRenderer {
|
|
1304
|
+
/**
|
|
1305
|
+
* Returns the styles to be injected into the RTE scope.
|
|
1306
|
+
* Override this method to provide custom styles for the custom blocks or nodes.
|
|
1307
|
+
*
|
|
1308
|
+
* @returns {string} - The styles as a string.
|
|
1309
|
+
*/
|
|
1310
|
+
injectRTEScopeStyles() {
|
|
1311
|
+
return '';
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Renders the given data as a DOM element.
|
|
1315
|
+
*
|
|
1316
|
+
* @param {RTEBlock | RTENode} renderData - The data to render, which can be a block or a node.
|
|
1317
|
+
* @param {RTERenderContext} rteContext - The rte editor context.
|
|
1318
|
+
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1319
|
+
* @returns {VegaRTERenderResult} - The rendered DOM element.
|
|
1320
|
+
*/
|
|
1321
|
+
render(renderData, rteContext, createElement) {
|
|
1322
|
+
const element = this.doRender(createElement, renderData, rteContext);
|
|
1323
|
+
this.fallbackRegisterRef(element, renderData);
|
|
1324
|
+
this.appendChildren(element, renderData, rteContext, createElement);
|
|
1325
|
+
return element;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Register the reference of the element in the rendering registry.
|
|
1329
|
+
*
|
|
1330
|
+
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1331
|
+
* @returns {VegaRTEUseRef} - The function to register the element.
|
|
1332
|
+
*/
|
|
1333
|
+
useRef(renderData) {
|
|
1334
|
+
renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] = true;
|
|
1335
|
+
return function (element) {
|
|
1336
|
+
if (element) {
|
|
1337
|
+
codeBlock.stateEntityRenderingRegistry.register(element, renderData);
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Get a registered renderer by its key.
|
|
1343
|
+
*
|
|
1344
|
+
* @param {string} key - The key of the renderer.
|
|
1345
|
+
* @returns {Nullable<BaseRenderer>} - The registered renderer or null if not found.
|
|
1346
|
+
*/
|
|
1347
|
+
getDTORenderer(key) {
|
|
1348
|
+
return dtoRendererManager.RTEDTORendererManager.getRTERenderer(key);
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Auto render the block children if the block element is not exist
|
|
1352
|
+
*
|
|
1353
|
+
* @param {VegaRTERenderResult} parentElement - The parent element to append children to.
|
|
1354
|
+
* @param {RTEBlock | RTENode} renderData - The data to render children for.
|
|
1355
|
+
* @param {RTERenderContext} rteContext - The render context.
|
|
1356
|
+
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1357
|
+
*/
|
|
1358
|
+
appendChildren(parentElement, renderData, rteContext, createElement) {
|
|
1359
|
+
if (Array.isArray(renderData['children']) &&
|
|
1360
|
+
renderData['children'].length &&
|
|
1361
|
+
!parentElement['$children$']) {
|
|
1362
|
+
parentElement['$children$'] = renderData['children']
|
|
1363
|
+
.map((child) => {
|
|
1364
|
+
return this.renderChildren(child, rteContext, createElement);
|
|
1365
|
+
})
|
|
1366
|
+
.filter(typeGuard.isNonNullable);
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Render the children node.
|
|
1371
|
+
*
|
|
1372
|
+
* @param {RTENode | RTEBlock} renderData - The node to render children for.
|
|
1373
|
+
* @param {RTERenderContext} rteContext - The render context.
|
|
1374
|
+
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1375
|
+
* @returns {Nullable<VegaRTERenderResult>} - The rendered DOM element.
|
|
1376
|
+
*/
|
|
1377
|
+
renderChildren(renderData, rteContext, createElement) {
|
|
1378
|
+
const renderer = this.getDTORenderer(renderData.type);
|
|
1379
|
+
if (renderer) {
|
|
1380
|
+
return renderer.render(renderData, rteContext, createElement);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Fallback register reference for the element.
|
|
1385
|
+
*
|
|
1386
|
+
* @param {VegaRTERenderResult} element - The rendered DOM element.
|
|
1387
|
+
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1388
|
+
*/
|
|
1389
|
+
fallbackRegisterRef(element, renderData) {
|
|
1390
|
+
if (!renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] && element['$attrs$']) {
|
|
1391
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1392
|
+
element['$attrs$']['ref'] = this.useRef(renderData);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
VegaRTEExtensionRenderer.REGISTER_REF_FLAG = '__registeredRef__';
|
|
1397
|
+
|
|
1300
1398
|
/**
|
|
1301
1399
|
* Abstract class for Vega Rich Text Editor extensions.
|
|
1302
1400
|
*/
|
|
@@ -1306,17 +1404,28 @@ class VegaRTEExtension {
|
|
|
1306
1404
|
* The context of the RTE extension, which may include references to the host editor and other relevant information.
|
|
1307
1405
|
*/
|
|
1308
1406
|
this.extensionContext = null;
|
|
1407
|
+
this.hasCustomStylesRenderers = new Set();
|
|
1309
1408
|
}
|
|
1310
1409
|
/**
|
|
1311
1410
|
* Registers an action handle strategy for a specific node or block class.
|
|
1312
1411
|
*
|
|
1313
1412
|
* @param {string} nodeOrBlockClassName - The name of the node or block class.
|
|
1314
1413
|
* @param {string} actionType - The type of the action.
|
|
1315
|
-
* @param {ActionHandleStrategy<ModifyContentAction, RTENode | RTEBlock>} strategy - The strategy to register.
|
|
1414
|
+
* @param {ActionHandleStrategy<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The strategy to register.
|
|
1316
1415
|
*/
|
|
1317
1416
|
static registerActionHandleStrategy(nodeOrBlockClassName, actionType, strategy) {
|
|
1318
1417
|
codeBlock.ActionHandleStrategyRegistry.register(actionType, nodeOrBlockClassName, strategy);
|
|
1319
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Registers an action handler interceptor for a specific node or block class.
|
|
1421
|
+
*
|
|
1422
|
+
* @param {string} nodeOrBlockClassName - The name of the node or block class.
|
|
1423
|
+
* @param {string} actionType - The type of the action.
|
|
1424
|
+
* @param {ActionHandlerInterceptor<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The interceptor to register.
|
|
1425
|
+
*/
|
|
1426
|
+
static registerActionHandlerInterceptor(nodeOrBlockClassName, actionType, strategy) {
|
|
1427
|
+
codeBlock.ActionHandlerInterceptorRegistry.register(actionType, nodeOrBlockClassName, strategy);
|
|
1428
|
+
}
|
|
1320
1429
|
/**
|
|
1321
1430
|
* Initializes the RTE extension with the provided context.
|
|
1322
1431
|
*
|
|
@@ -1325,6 +1434,21 @@ class VegaRTEExtension {
|
|
|
1325
1434
|
initialExtension(context) {
|
|
1326
1435
|
this.extensionContext = context;
|
|
1327
1436
|
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Collect custom styles for the extension renderers.
|
|
1439
|
+
* If custom nodes have special styles, override this method to provide the styles.
|
|
1440
|
+
*
|
|
1441
|
+
* @returns {string} - The custom styles as a string.
|
|
1442
|
+
*/
|
|
1443
|
+
collectExtensionRendererStyles() {
|
|
1444
|
+
let styles = '';
|
|
1445
|
+
if (this.hasCustomStylesRenderers.size > 0) {
|
|
1446
|
+
this.hasCustomStylesRenderers.forEach((renderer) => {
|
|
1447
|
+
styles += `${renderer.injectRTEScopeStyles()}\n`;
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
return styles;
|
|
1451
|
+
}
|
|
1328
1452
|
/**
|
|
1329
1453
|
* Register a node type with the extension.
|
|
1330
1454
|
*
|
|
@@ -1342,6 +1466,9 @@ class VegaRTEExtension {
|
|
|
1342
1466
|
*/
|
|
1343
1467
|
registerRenderer(type, renderer) {
|
|
1344
1468
|
dtoRendererManager.RTEDTORendererManager.registerRTEDTORenderer(type, renderer);
|
|
1469
|
+
if (renderer instanceof VegaRTEExtensionRenderer && renderer.injectRTEScopeStyles()) {
|
|
1470
|
+
this.hasCustomStylesRenderers.add(renderer);
|
|
1471
|
+
}
|
|
1345
1472
|
}
|
|
1346
1473
|
/**
|
|
1347
1474
|
* Register a toolbar button renderer for the extension.
|
|
@@ -1364,6 +1491,25 @@ class VegaRTEExtension {
|
|
|
1364
1491
|
registerBlockBasicStrategies(blockClassName) {
|
|
1365
1492
|
dtoRendererManager.RTEDTOActionStrategyManager.registerBlockBasicStrategies(blockClassName);
|
|
1366
1493
|
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Unregister a strategy for a specific action type and block class if not need.
|
|
1496
|
+
*
|
|
1497
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
1498
|
+
* @param {string} blockClassName - The class name of the block to unregister the strategy for.
|
|
1499
|
+
*/
|
|
1500
|
+
unRegisterStrategy(actionType, blockClassName) {
|
|
1501
|
+
codeBlock.ActionHandleStrategyRegistry.unregister(actionType, blockClassName);
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Unregister a strategy for a specific action type and block class if not need.
|
|
1505
|
+
*
|
|
1506
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
1507
|
+
* @param {string} blockClassName - The class name of the block to unregister the strategy for.
|
|
1508
|
+
* @param {ActionHandlerInterceptor<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The interceptor to unregister.
|
|
1509
|
+
*/
|
|
1510
|
+
unRegisterInterceptor(actionType, blockClassName, strategy) {
|
|
1511
|
+
codeBlock.ActionHandlerInterceptorRegistry.unregister(actionType, blockClassName, strategy);
|
|
1512
|
+
}
|
|
1367
1513
|
/**
|
|
1368
1514
|
* Register an element to block DTO class strategy.
|
|
1369
1515
|
*
|
|
@@ -1390,86 +1536,6 @@ class VegaRTEExtension {
|
|
|
1390
1536
|
}
|
|
1391
1537
|
}
|
|
1392
1538
|
|
|
1393
|
-
/**
|
|
1394
|
-
* Base renderer for Vega Rich Text Editor.
|
|
1395
|
-
*/
|
|
1396
|
-
class VegaRTEExtensionRenderer extends baseRenderer.VegaRTEBaseRenderer {
|
|
1397
|
-
/**
|
|
1398
|
-
* Renders the given data as a DOM element.
|
|
1399
|
-
*
|
|
1400
|
-
* @param {RTEBlock | RTENode} renderData - The data to render, which can be a block or a node.
|
|
1401
|
-
* @param {RTERenderContext} rteContext - The rte editor context.
|
|
1402
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1403
|
-
* @returns {VegaRTERenderResult} - The rendered DOM element.
|
|
1404
|
-
*/
|
|
1405
|
-
render(renderData, rteContext, createElement) {
|
|
1406
|
-
const element = this.doRender(createElement, renderData, rteContext);
|
|
1407
|
-
this.fallbackRegisterRef(element, renderData);
|
|
1408
|
-
this.appendChildren(element, renderData, rteContext, createElement);
|
|
1409
|
-
return element;
|
|
1410
|
-
}
|
|
1411
|
-
/**
|
|
1412
|
-
* Register the reference of the element in the rendering registry.
|
|
1413
|
-
*
|
|
1414
|
-
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1415
|
-
* @returns {VegaRTEUseRef} - The function to register the element.
|
|
1416
|
-
*/
|
|
1417
|
-
useRef(renderData) {
|
|
1418
|
-
renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] = true;
|
|
1419
|
-
return function (element) {
|
|
1420
|
-
if (element) {
|
|
1421
|
-
codeBlock.stateEntityRenderingRegistry.register(element, renderData);
|
|
1422
|
-
}
|
|
1423
|
-
};
|
|
1424
|
-
}
|
|
1425
|
-
/**
|
|
1426
|
-
* Auto render the block children if the block element is not exist
|
|
1427
|
-
*
|
|
1428
|
-
* @param {VegaRTERenderResult} parentElement - The parent element to append children to.
|
|
1429
|
-
* @param {RTEBlock | RTENode} renderData - The data to render children for.
|
|
1430
|
-
* @param {RTERenderContext} rteContext - The render context.
|
|
1431
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1432
|
-
*/
|
|
1433
|
-
appendChildren(parentElement, renderData, rteContext, createElement) {
|
|
1434
|
-
if (Array.isArray(renderData['children']) &&
|
|
1435
|
-
renderData['children'].length &&
|
|
1436
|
-
!parentElement['$children$']) {
|
|
1437
|
-
parentElement['$children$'] = renderData['children']
|
|
1438
|
-
.map((child) => {
|
|
1439
|
-
return this.renderChildren(child, rteContext, createElement);
|
|
1440
|
-
})
|
|
1441
|
-
.filter(typeGuard.isNonNullable);
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
/**
|
|
1445
|
-
* Render the children node.
|
|
1446
|
-
*
|
|
1447
|
-
* @param {RTENode | RTEBlock} renderData - The node to render children for.
|
|
1448
|
-
* @param {RTERenderContext} rteContext - The render context.
|
|
1449
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1450
|
-
* @returns {Nullable<VegaRTERenderResult>} - The rendered DOM element.
|
|
1451
|
-
*/
|
|
1452
|
-
renderChildren(renderData, rteContext, createElement) {
|
|
1453
|
-
const renderer = dtoRendererManager.RTEDTORendererManager.getRTERenderer(renderData.type);
|
|
1454
|
-
if (renderer) {
|
|
1455
|
-
return renderer.render(renderData, rteContext, createElement);
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
/**
|
|
1459
|
-
* Fallback register reference for the element.
|
|
1460
|
-
*
|
|
1461
|
-
* @param {VegaRTERenderResult} element - The rendered DOM element.
|
|
1462
|
-
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1463
|
-
*/
|
|
1464
|
-
fallbackRegisterRef(element, renderData) {
|
|
1465
|
-
if (!renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] && element['$attrs$']) {
|
|
1466
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1467
|
-
element['$attrs$']['ref'] = this.useRef(renderData);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
VegaRTEExtensionRenderer.REGISTER_REF_FLAG = '__registeredRef__';
|
|
1472
|
-
|
|
1473
1539
|
/**
|
|
1474
1540
|
* Base class for rendering extension toolbar button in the rich text editor.
|
|
1475
1541
|
* The renderer provides common functionalities for rendering toolbar buttons, including:
|
|
@@ -1501,7 +1567,7 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1501
1567
|
* @returns {VegaRTERenderResult} - The render result for the dropdown.
|
|
1502
1568
|
*/
|
|
1503
1569
|
renderDropdown(h, editorContext, dropdownProps, children) {
|
|
1504
|
-
return h('vega-dropdown', Object.assign({ trigger: 'click', searchable: false,
|
|
1570
|
+
return h('vega-dropdown', Object.assign({ trigger: 'click', searchable: false, maxWidth: '200', itemDisplayRule: 'ellipsis',
|
|
1505
1571
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1506
1572
|
ref: (el) => {
|
|
1507
1573
|
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(el, domNodeSubjectObserverFactory.VegaDropdownClick, (input) => this.handleDropdownClick(input.detail, editorContext));
|
|
@@ -1511,7 +1577,7 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1511
1577
|
* Renders the dropdown list template.
|
|
1512
1578
|
*
|
|
1513
1579
|
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1514
|
-
* @param {RTEDropdownListItem[]} itemList - The list of dropdown items.
|
|
1580
|
+
* @param {(RTEDropdownListItem | RTEDropdownListGroup)[]} itemList - The list of dropdown items.
|
|
1515
1581
|
* @returns {VegaRTERenderResult} - The render result for the dropdown list.
|
|
1516
1582
|
*/
|
|
1517
1583
|
renderDropdownListTemplate(h, itemList) {
|
|
@@ -1519,7 +1585,9 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1519
1585
|
slot: 'items',
|
|
1520
1586
|
onMouseDown: this.preventDefault,
|
|
1521
1587
|
}, itemList.map((item) => {
|
|
1522
|
-
return
|
|
1588
|
+
return 'children' in item
|
|
1589
|
+
? this.renderDropdownGroup(h, item)
|
|
1590
|
+
: this.renderDropdownItem(h, item);
|
|
1523
1591
|
}));
|
|
1524
1592
|
}
|
|
1525
1593
|
/**
|
|
@@ -1537,6 +1605,24 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1537
1605
|
prefixIcon: item.icon,
|
|
1538
1606
|
});
|
|
1539
1607
|
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Renders a dropdown item for the toolbar button.
|
|
1610
|
+
*
|
|
1611
|
+
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1612
|
+
* @param {RTEDropdownListGroup} item - The dropdown group.
|
|
1613
|
+
* @returns {VegaRTERenderResult} - The render result for the dropdown item.
|
|
1614
|
+
*/
|
|
1615
|
+
renderDropdownGroup(h, item) {
|
|
1616
|
+
return h('vega-dropdown-group', {
|
|
1617
|
+
key: item.key,
|
|
1618
|
+
label: item.label,
|
|
1619
|
+
divide: false,
|
|
1620
|
+
}, item.children.map((child) => {
|
|
1621
|
+
return 'children' in child
|
|
1622
|
+
? this.renderDropdownGroup(h, child)
|
|
1623
|
+
: this.renderDropdownItem(h, child);
|
|
1624
|
+
}));
|
|
1625
|
+
}
|
|
1540
1626
|
/**
|
|
1541
1627
|
* Renders a common toolbar button with optional icon, label, and arrow icon.
|
|
1542
1628
|
*
|
|
@@ -1615,6 +1701,27 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1615
1701
|
preventDefault(e) {
|
|
1616
1702
|
e.preventDefault();
|
|
1617
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Recursively searches for a dropdown list item by its key.
|
|
1706
|
+
*
|
|
1707
|
+
* @param {(RTEDropdownListItem | RTEDropdownListGroup)[]} itemList The list of dropdown items or groups to search through.
|
|
1708
|
+
* @param {string} key The key of the item to find.
|
|
1709
|
+
* @returns {Nullable<RTEDropdownListItem>} The dropdown list item if found, otherwise null.
|
|
1710
|
+
*/
|
|
1711
|
+
getListItemByKey(itemList, key) {
|
|
1712
|
+
for (const item of itemList) {
|
|
1713
|
+
if ('children' in item) {
|
|
1714
|
+
const foundItem = this.getListItemByKey(item.children, key);
|
|
1715
|
+
if (foundItem) {
|
|
1716
|
+
return foundItem;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
else if (item.key === key) {
|
|
1720
|
+
return item;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
return null;
|
|
1724
|
+
}
|
|
1618
1725
|
}
|
|
1619
1726
|
|
|
1620
1727
|
/**
|
|
@@ -1695,7 +1802,7 @@ class RTETokenToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
|
1695
1802
|
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1696
1803
|
*/
|
|
1697
1804
|
handleDropdownClick(itemKey, editorContext) {
|
|
1698
|
-
const token = this.
|
|
1805
|
+
const token = this.getListItemByKey(this.tokenList, itemKey);
|
|
1699
1806
|
const { rteRange } = editorContext;
|
|
1700
1807
|
const { startNode } = rteRange;
|
|
1701
1808
|
if (startNode && startNode.parent) {
|
|
@@ -1796,7 +1903,7 @@ class RTETokenNodeRenderer extends VegaRTEExtensionRenderer {
|
|
|
1796
1903
|
'template-token-key': token,
|
|
1797
1904
|
'token-key': token,
|
|
1798
1905
|
'contenteditable': 'false',
|
|
1799
|
-
'style':
|
|
1906
|
+
'style': node.getStyles(),
|
|
1800
1907
|
'class': `token ${node.getClasses()}`,
|
|
1801
1908
|
'ref': this.useRef(node),
|
|
1802
1909
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
@@ -1817,13 +1924,12 @@ class RTETokenNodeRenderer extends VegaRTEExtensionRenderer {
|
|
|
1817
1924
|
this.extensionContext = context;
|
|
1818
1925
|
}
|
|
1819
1926
|
/**
|
|
1820
|
-
*
|
|
1927
|
+
* Override to inject RTE scope styles for the token node.
|
|
1821
1928
|
*
|
|
1822
|
-
* @
|
|
1823
|
-
* @returns {Record<string, string>} The style object for the token element.
|
|
1929
|
+
* @returns {string} The CSS styles for the token node.
|
|
1824
1930
|
*/
|
|
1825
|
-
|
|
1826
|
-
return
|
|
1931
|
+
injectRTEScopeStyles() {
|
|
1932
|
+
return `span[token-key]{padding: 0 2px; margin: 0 1px; background-color: rgba(var(--v-bg-status-info, 205,209,211))}`;
|
|
1827
1933
|
}
|
|
1828
1934
|
/**
|
|
1829
1935
|
* Handle the click event on the token element.
|
|
@@ -1904,7 +2010,7 @@ class SpanToTokenNodeStrategy extends dtoRendererManager.ElementToDTOStrategy {
|
|
|
1904
2010
|
const element = elementsArray[0];
|
|
1905
2011
|
const tokenKey = element.getAttribute('token-key');
|
|
1906
2012
|
const text = element.textContent;
|
|
1907
|
-
const annotations =
|
|
2013
|
+
const annotations = dtoRendererManager.htmlElementToAnnotationGenerator.generate(codeBlock.RTETextNode, element);
|
|
1908
2014
|
// Exclude customAttribute and customClass from annotations
|
|
1909
2015
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1910
2016
|
const restAnnotations = __rest(annotations, ["customAttribute", "customClass"]);
|
|
@@ -1960,6 +2066,822 @@ class VegaRTETokenExtension extends VegaRTEExtension {
|
|
|
1960
2066
|
VegaRTEExtension.registerActionHandleStrategy(dtoRendererManager.RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
1961
2067
|
})();
|
|
1962
2068
|
|
|
2069
|
+
const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
2070
|
+
/**
|
|
2071
|
+
* Action to insert a function block into the rich text editor.
|
|
2072
|
+
*
|
|
2073
|
+
* @example focusedBlock.apply(new InsertFunctionBlockAction('IF'))
|
|
2074
|
+
* @example host.value.apply(new InsertFunctionBlockAction('IF'))
|
|
2075
|
+
*/
|
|
2076
|
+
class InsertFunctionBlockAction extends codeBlock.ModifyContentAction {
|
|
2077
|
+
constructor(functionType) {
|
|
2078
|
+
super();
|
|
2079
|
+
this.type = INSERT_FUNCTION_BLOCK;
|
|
2080
|
+
this.functionType = functionType;
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
/**
|
|
2085
|
+
* RTE Function Block
|
|
2086
|
+
*/
|
|
2087
|
+
class RTEFunctionBlock extends codeBlock.RTEBlock {
|
|
2088
|
+
constructor(id) {
|
|
2089
|
+
super(id);
|
|
2090
|
+
this.type = 'function-block';
|
|
2091
|
+
this.children = [];
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* Creates an RTEFunctionBlock from a VegaFunctionBlock.
|
|
2095
|
+
*
|
|
2096
|
+
* @param {VegaFunctionBlock} block - The custom block to convert.
|
|
2097
|
+
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
2098
|
+
* @returns {RTEFunctionBlock} The resulting RTEFunctionBlock.
|
|
2099
|
+
*/
|
|
2100
|
+
static from(block, options) {
|
|
2101
|
+
const functionBlock = new RTEFunctionBlock(block.id);
|
|
2102
|
+
const defaultAnnotation = { customClass: ['statement'] };
|
|
2103
|
+
let { annotations } = block;
|
|
2104
|
+
annotations = annotations
|
|
2105
|
+
? Object.assign(Object.assign({}, annotations), defaultAnnotation) : defaultAnnotation;
|
|
2106
|
+
super.convertAnnotationsToMap(functionBlock.annotationMap, annotations);
|
|
2107
|
+
functionBlock.children = this.generateBlockChildren(block.children, options, functionBlock);
|
|
2108
|
+
return functionBlock;
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Converts the RTEFunctionBlock and its children to an HTML string.
|
|
2112
|
+
*
|
|
2113
|
+
* @returns {string} The HTML string representation of the function block.
|
|
2114
|
+
*/
|
|
2115
|
+
toHtml() {
|
|
2116
|
+
const childrenHtml = this.children
|
|
2117
|
+
.map((child) => {
|
|
2118
|
+
if (child instanceof codeBlock.RTETextBlock) {
|
|
2119
|
+
const attrStr = this.getFunctionContentStyle(child);
|
|
2120
|
+
return `<div class="statementelement"${attrStr}>${child.getChildrenHtml()}</div>`;
|
|
2121
|
+
}
|
|
2122
|
+
else {
|
|
2123
|
+
return child.toHtml();
|
|
2124
|
+
}
|
|
2125
|
+
})
|
|
2126
|
+
.join('');
|
|
2127
|
+
return `<div class="statement">${childrenHtml}</div>`;
|
|
2128
|
+
}
|
|
2129
|
+
/**
|
|
2130
|
+
* @inheritDoc
|
|
2131
|
+
*/
|
|
2132
|
+
clone(parent) {
|
|
2133
|
+
const clonedBlock = new RTEFunctionBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
2134
|
+
clonedBlock.parent = parent;
|
|
2135
|
+
clonedBlock.children = this.children.map((child) => {
|
|
2136
|
+
const clonedChild = child.clone(clonedBlock);
|
|
2137
|
+
return clonedChild;
|
|
2138
|
+
});
|
|
2139
|
+
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
2140
|
+
return clonedBlock;
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* @inheritDoc
|
|
2144
|
+
*/
|
|
2145
|
+
getLastNode() {
|
|
2146
|
+
return this.children[this.children.length - 1].getLastNode();
|
|
2147
|
+
}
|
|
2148
|
+
/**
|
|
2149
|
+
* @inheritDoc
|
|
2150
|
+
*/
|
|
2151
|
+
isNotEmpty() {
|
|
2152
|
+
return this.children.length > 0;
|
|
2153
|
+
}
|
|
2154
|
+
/**
|
|
2155
|
+
* @inheritDoc
|
|
2156
|
+
*/
|
|
2157
|
+
toJSON() {
|
|
2158
|
+
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, children: this.children.map((child) => child.toJSON()) });
|
|
2159
|
+
}
|
|
2160
|
+
/**
|
|
2161
|
+
* Get the style string for function content block, excluding default paragraph styles.
|
|
2162
|
+
*
|
|
2163
|
+
* @param {RTETextBlock} block - The text block to extract styles from
|
|
2164
|
+
* @returns {string} - The style attribute string
|
|
2165
|
+
*/
|
|
2166
|
+
getFunctionContentStyle(block) {
|
|
2167
|
+
const blockAnnotationStyle = new codeBlock.RTEAnnotationStyle(block);
|
|
2168
|
+
let styles = blockAnnotationStyle.toCssText({ standalone: true });
|
|
2169
|
+
const textStyleAnnotation = block.getAnnotationByType('TEXT_STYLE');
|
|
2170
|
+
if (textStyleAnnotation && textStyleAnnotation.textStyle === 'paragraph') {
|
|
2171
|
+
const defaultParagraphStyles = blockAnnotationStyle.toCssText(undefined, undefined, textStyleAnnotation.renderStyle({ standalone: true }));
|
|
2172
|
+
styles = styles.replace(defaultParagraphStyles, '').trim();
|
|
2173
|
+
}
|
|
2174
|
+
return styles ? ` style="${styles}"` : '';
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
/**
|
|
2179
|
+
* Strategy to handle the insertion of a function block into the rich text editor.
|
|
2180
|
+
*/
|
|
2181
|
+
class InsertFunctionBlockStrategy extends codeBlock.ActionHandleStrategy {
|
|
2182
|
+
/**
|
|
2183
|
+
* @inheritDoc
|
|
2184
|
+
*/
|
|
2185
|
+
handleAction(action, target) {
|
|
2186
|
+
const { functionType } = action;
|
|
2187
|
+
const functionBlock = this.getFunctionBlock(functionType);
|
|
2188
|
+
const emptyParagraph = this.createNewParagraph('');
|
|
2189
|
+
const referenceBlock = this.getReferenceBlock(target);
|
|
2190
|
+
if (referenceBlock) {
|
|
2191
|
+
referenceBlock.parent.apply(new codeBlock.InsertChildrenAfterAction(referenceBlock, functionBlock, emptyParagraph));
|
|
2192
|
+
}
|
|
2193
|
+
else {
|
|
2194
|
+
target.apply(new codeBlock.AppendChildrenAction([functionBlock, emptyParagraph]));
|
|
2195
|
+
}
|
|
2196
|
+
if (emptyParagraph) {
|
|
2197
|
+
action.nextFocusNode = emptyParagraph.children[0];
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Get a function block based on the specified type.
|
|
2202
|
+
*
|
|
2203
|
+
* @param {string} type - The type of function block to create.
|
|
2204
|
+
* @returns {RTEFunctionBlock} The function block instance.
|
|
2205
|
+
*/
|
|
2206
|
+
getFunctionBlock(type) {
|
|
2207
|
+
const id = createPublicApiRuntimeMetricsSlimmer.generateUUID();
|
|
2208
|
+
return RTEFunctionBlock.from({
|
|
2209
|
+
id: id,
|
|
2210
|
+
type: 'function-block',
|
|
2211
|
+
children: [
|
|
2212
|
+
{
|
|
2213
|
+
id: `${id}-1`,
|
|
2214
|
+
type: 'logic-control-block',
|
|
2215
|
+
statementText: type.toUpperCase(),
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
id: `${id}-2`,
|
|
2219
|
+
annotations: {
|
|
2220
|
+
customClass: ['statementelement'],
|
|
2221
|
+
},
|
|
2222
|
+
type: 'paragraph',
|
|
2223
|
+
nodes: [
|
|
2224
|
+
{
|
|
2225
|
+
id: `${id}-2-1`,
|
|
2226
|
+
type: 'text',
|
|
2227
|
+
text: ' ',
|
|
2228
|
+
},
|
|
2229
|
+
],
|
|
2230
|
+
},
|
|
2231
|
+
{
|
|
2232
|
+
id: `${id}-3`,
|
|
2233
|
+
type: 'logic-control-block',
|
|
2234
|
+
statementText: 'SHOW',
|
|
2235
|
+
},
|
|
2236
|
+
{
|
|
2237
|
+
id: `${id}-4`,
|
|
2238
|
+
annotations: {
|
|
2239
|
+
customClass: ['statementelement'],
|
|
2240
|
+
},
|
|
2241
|
+
type: 'paragraph',
|
|
2242
|
+
nodes: [
|
|
2243
|
+
{
|
|
2244
|
+
id: `${id}-4-1`,
|
|
2245
|
+
type: 'text',
|
|
2246
|
+
text: ' ',
|
|
2247
|
+
},
|
|
2248
|
+
],
|
|
2249
|
+
},
|
|
2250
|
+
],
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* We need to get the correct block if the current target is a function block element to avoid nesting function blocks.
|
|
2255
|
+
*
|
|
2256
|
+
* @param {RTEBlock | VegaRTEContent} currentTarget - The current target block or content.
|
|
2257
|
+
* @returns {Nullable<RTEBlock>} The reference block.
|
|
2258
|
+
*/
|
|
2259
|
+
getReferenceBlock(currentTarget) {
|
|
2260
|
+
if (!(currentTarget instanceof dtoRendererManager.VegaRTEContent)) {
|
|
2261
|
+
const parentBlock = currentTarget.parent;
|
|
2262
|
+
if (parentBlock instanceof RTEFunctionBlock) {
|
|
2263
|
+
return parentBlock;
|
|
2264
|
+
}
|
|
2265
|
+
else {
|
|
2266
|
+
return currentTarget;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
/**
|
|
2273
|
+
* Class representing a logic control node in the rich text editor.
|
|
2274
|
+
*/
|
|
2275
|
+
class RTELogicControlNode extends codeBlock.RTENode {
|
|
2276
|
+
constructor(id, text, parent) {
|
|
2277
|
+
super(id);
|
|
2278
|
+
this.type = 'logic-control-node';
|
|
2279
|
+
this.text = '';
|
|
2280
|
+
this.text = text;
|
|
2281
|
+
this.parent = parent;
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Clone the current node instance.
|
|
2285
|
+
*
|
|
2286
|
+
* @returns {RTELogicControlNode} - A new instance of RTELogicControlNode.
|
|
2287
|
+
*/
|
|
2288
|
+
clone() {
|
|
2289
|
+
return new RTELogicControlNode(this.id, this.text, this.parent);
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Convert the node to its HTML representation.
|
|
2293
|
+
*
|
|
2294
|
+
* @returns {string} - The HTML string of the logic control node.
|
|
2295
|
+
*/
|
|
2296
|
+
toHtml() {
|
|
2297
|
+
return this.text;
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Convert the node to a JSON representation.
|
|
2301
|
+
*
|
|
2302
|
+
* @returns {unknown} - The JSON object of the statement syntax node.
|
|
2303
|
+
*/
|
|
2304
|
+
toJSON() {
|
|
2305
|
+
return {
|
|
2306
|
+
id: this.id,
|
|
2307
|
+
type: this.type,
|
|
2308
|
+
text: this.text,
|
|
2309
|
+
};
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Get the end offset of the node's range.
|
|
2313
|
+
*
|
|
2314
|
+
* @returns {number} - The end offset of the node's range.
|
|
2315
|
+
*/
|
|
2316
|
+
getRangeEndOffset() {
|
|
2317
|
+
return 1;
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Get the container element for the node's range.
|
|
2321
|
+
*
|
|
2322
|
+
* @returns {Nullable<Node>} - The container node for the range.
|
|
2323
|
+
*/
|
|
2324
|
+
getRangeContainer() {
|
|
2325
|
+
const element = codeBlock.stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
2326
|
+
if (element) {
|
|
2327
|
+
return element.parentElement;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Get the content editable state of the node.
|
|
2332
|
+
*
|
|
2333
|
+
* @returns {boolean} - The content editable state of the node.
|
|
2334
|
+
*/
|
|
2335
|
+
isContentEditable() {
|
|
2336
|
+
return false;
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Class representing a logic control block in the rich text editor.
|
|
2342
|
+
*/
|
|
2343
|
+
class RTELogicControlBlock extends codeBlock.RTEBlock {
|
|
2344
|
+
constructor(id, statementText, parent) {
|
|
2345
|
+
super(id);
|
|
2346
|
+
this.type = 'logic-control-block';
|
|
2347
|
+
this.children = [];
|
|
2348
|
+
this.statementText = '';
|
|
2349
|
+
this.statementText = statementText;
|
|
2350
|
+
this.children = [new RTELogicControlNode(`${id}-node-1`, statementText, this)];
|
|
2351
|
+
if (parent) {
|
|
2352
|
+
this.parent = parent;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
/**
|
|
2356
|
+
* Create a logic control block from a JSON representation.
|
|
2357
|
+
*
|
|
2358
|
+
* @param {VegaRTELogicControlBlock} json - The JSON object representing the logic control block.
|
|
2359
|
+
* @returns {RTELogicControlBlock} - The created logic control block.
|
|
2360
|
+
*/
|
|
2361
|
+
static from(json) {
|
|
2362
|
+
const block = new RTELogicControlBlock(json.id, json.statementText);
|
|
2363
|
+
return block;
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* Check the block is not empty.
|
|
2367
|
+
*
|
|
2368
|
+
* @returns {boolean} - Always true for logic control block.
|
|
2369
|
+
*/
|
|
2370
|
+
isNotEmpty() {
|
|
2371
|
+
return true;
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Get the last node of the block.
|
|
2375
|
+
*
|
|
2376
|
+
* @returns {RTELogicControlNode} - The last node in the block.
|
|
2377
|
+
*/
|
|
2378
|
+
getLastNode() {
|
|
2379
|
+
return this.children[this.children.length - 1];
|
|
2380
|
+
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Convert the block to its HTML representation.
|
|
2383
|
+
*
|
|
2384
|
+
* @returns {string} - The HTML string of the logic control block.
|
|
2385
|
+
*/
|
|
2386
|
+
toHtml() {
|
|
2387
|
+
return `<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`;
|
|
2388
|
+
}
|
|
2389
|
+
/**
|
|
2390
|
+
* Clone the current block instance.
|
|
2391
|
+
*
|
|
2392
|
+
* @param { RTEFunctionBlock } parent - The parent function block for the cloned instance.
|
|
2393
|
+
* @returns {RTELogicControlBlock} - A new instance of RTEStatementSyntaxBlock.
|
|
2394
|
+
*/
|
|
2395
|
+
clone(parent) {
|
|
2396
|
+
return new RTELogicControlBlock(this.id, this.statementText, parent);
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Get the JSON representation of the block.
|
|
2400
|
+
*
|
|
2401
|
+
* @returns {VegaRTELogicControlBlock} - The JSON object of the logic control block.
|
|
2402
|
+
*/
|
|
2403
|
+
toJSON() {
|
|
2404
|
+
return {
|
|
2405
|
+
id: this.id,
|
|
2406
|
+
type: this.type,
|
|
2407
|
+
statementText: this.statementText,
|
|
2408
|
+
};
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
/**
|
|
2413
|
+
* Function toolbar button renderer class.
|
|
2414
|
+
*/
|
|
2415
|
+
class FunctionToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
2416
|
+
/**
|
|
2417
|
+
* Injects the extension context
|
|
2418
|
+
*
|
|
2419
|
+
* @param {RTEExtensionContext} context - extension context
|
|
2420
|
+
*/
|
|
2421
|
+
injectExtensionContext(context) {
|
|
2422
|
+
this.extensionContext = context;
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* @inheritDoc
|
|
2426
|
+
*/
|
|
2427
|
+
render(h, editorContext) {
|
|
2428
|
+
return this.renderDropdown(h, editorContext, {}, [
|
|
2429
|
+
this.renderButton(h, editorContext, {
|
|
2430
|
+
label: 'Functions',
|
|
2431
|
+
showArrowIcon: true,
|
|
2432
|
+
}),
|
|
2433
|
+
this.renderDropdownListTemplate(h, FunctionToolbarButtonRenderer.FUNCTION_LIST),
|
|
2434
|
+
]);
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Overrides the isDisabled method to determine if the button should be disabled.
|
|
2438
|
+
*
|
|
2439
|
+
* @returns {boolean} - true if the button should be disabled, false otherwise.
|
|
2440
|
+
*/
|
|
2441
|
+
isDisabled() {
|
|
2442
|
+
const { host, getSelectedNodes } = this.extensionContext;
|
|
2443
|
+
const focusNode = getSelectedNodes()[0];
|
|
2444
|
+
let enableInsert = true;
|
|
2445
|
+
if (focusNode) {
|
|
2446
|
+
enableInsert = codeBlock.ActionHandleStrategyRegistry.canHandle(INSERT_FUNCTION_BLOCK, focusNode.parent);
|
|
2447
|
+
}
|
|
2448
|
+
return host.disabled || !enableInsert;
|
|
2449
|
+
}
|
|
2450
|
+
/* istanbul ignore next */
|
|
2451
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
2452
|
+
handleButtonClick() {
|
|
2453
|
+
throw new Error('Method not implemented.');
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Handles dropdown click event
|
|
2457
|
+
*
|
|
2458
|
+
* @param {RTEExtensionFunctionType} itemKey - key of the clicked item
|
|
2459
|
+
*/
|
|
2460
|
+
handleDropdownClick(itemKey) {
|
|
2461
|
+
const { host, getSelectedNodes } = this.extensionContext;
|
|
2462
|
+
const focusNode = getSelectedNodes()[0];
|
|
2463
|
+
const action = new InsertFunctionBlockAction(itemKey);
|
|
2464
|
+
if (!focusNode) {
|
|
2465
|
+
host.value.apply(action);
|
|
2466
|
+
}
|
|
2467
|
+
else if (focusNode.parent) {
|
|
2468
|
+
focusNode.parent.apply(action);
|
|
2469
|
+
}
|
|
2470
|
+
if (action.nextFocusNode) {
|
|
2471
|
+
host.value.apply(new dtoRendererManager.UpdateCursorPositionAction(action.nextFocusNode, 1));
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
FunctionToolbarButtonRenderer.FUNCTION_LIST = [
|
|
2476
|
+
{ key: 'IF', label: 'Conditional' },
|
|
2477
|
+
{ key: 'FOREACH', label: 'Foreach' },
|
|
2478
|
+
];
|
|
2479
|
+
|
|
2480
|
+
/**
|
|
2481
|
+
* Renders a logic control block in the rich text editor.
|
|
2482
|
+
*/
|
|
2483
|
+
class RTELogicControlBlockRenderer extends VegaRTEExtensionRenderer {
|
|
2484
|
+
/**
|
|
2485
|
+
* @inheritDoc
|
|
2486
|
+
*/
|
|
2487
|
+
doRender(h, renderData) {
|
|
2488
|
+
return h('div', {
|
|
2489
|
+
key: renderData.id,
|
|
2490
|
+
class: 'statementsyntax',
|
|
2491
|
+
ref: this.useRef(renderData),
|
|
2492
|
+
}, h('span', {
|
|
2493
|
+
key: `${renderData.id}-1`,
|
|
2494
|
+
contenteditable: 'false',
|
|
2495
|
+
ref: this.useRef(renderData.children[0]),
|
|
2496
|
+
}, renderData.statementText));
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
/**
|
|
2501
|
+
* Strategy to convert a div with class 'statementsyntax' into an RTELogicControlBlock DTO.
|
|
2502
|
+
*/
|
|
2503
|
+
class DivToLogicControlBlockStrategy extends dtoRendererManager.BlockToRTEBlockStrategyAbstract {
|
|
2504
|
+
constructor() {
|
|
2505
|
+
super(...arguments);
|
|
2506
|
+
this.blockClassName = 'statementsyntax';
|
|
2507
|
+
}
|
|
2508
|
+
/**
|
|
2509
|
+
* @inheritDoc
|
|
2510
|
+
*/
|
|
2511
|
+
canHandle(elementsArray, currentIndex) {
|
|
2512
|
+
const element = elementsArray[currentIndex];
|
|
2513
|
+
return element &&
|
|
2514
|
+
element.nodeType === Node.ELEMENT_NODE &&
|
|
2515
|
+
element.classList.contains(this.blockClassName) &&
|
|
2516
|
+
this.isFunctionBlockChild(element)
|
|
2517
|
+
? 1
|
|
2518
|
+
: 0;
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* @inheritDoc
|
|
2522
|
+
*/
|
|
2523
|
+
handle(elementsArray) {
|
|
2524
|
+
const element = elementsArray[0];
|
|
2525
|
+
return RTELogicControlBlock.from({
|
|
2526
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
2527
|
+
type: 'logic-control-block',
|
|
2528
|
+
statementText: element.innerText,
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* The logic control block does not have child blocks to append. so this method is intentionally left empty.
|
|
2533
|
+
*/
|
|
2534
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2535
|
+
appendChildBlocks() { }
|
|
2536
|
+
/**
|
|
2537
|
+
* @inheritDoc
|
|
2538
|
+
*/
|
|
2539
|
+
shouldProceedToElementChildren() {
|
|
2540
|
+
return false;
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Checks if the given element is a child of a function block
|
|
2544
|
+
*
|
|
2545
|
+
* @param {HTMLElement} element - The HTML element to check
|
|
2546
|
+
* @returns {boolean} True if the element is a child of a function block, false otherwise
|
|
2547
|
+
*/
|
|
2548
|
+
isFunctionBlockChild(element) {
|
|
2549
|
+
return !!(element.parentElement && element.parentElement.classList.contains('statement'));
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* Strategy to convert a div with class 'statement' into an function block.
|
|
2555
|
+
*/
|
|
2556
|
+
class DivToFunctionBlockStrategy extends dtoRendererManager.ElementToDTOStrategy {
|
|
2557
|
+
/**
|
|
2558
|
+
* @inheritDoc
|
|
2559
|
+
*/
|
|
2560
|
+
canHandle(elementsArray, currentIndex) {
|
|
2561
|
+
const element = elementsArray[currentIndex];
|
|
2562
|
+
return element &&
|
|
2563
|
+
element.tagName === 'DIV' &&
|
|
2564
|
+
element.classList.contains('statement') &&
|
|
2565
|
+
element.childNodes.length &&
|
|
2566
|
+
element.querySelector('.statementsyntax')
|
|
2567
|
+
? 1
|
|
2568
|
+
: 0;
|
|
2569
|
+
}
|
|
2570
|
+
/**
|
|
2571
|
+
* @inheritDoc
|
|
2572
|
+
*/
|
|
2573
|
+
handle() {
|
|
2574
|
+
return RTEFunctionBlock.from({
|
|
2575
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
2576
|
+
type: 'function-block',
|
|
2577
|
+
annotations: {
|
|
2578
|
+
customClass: ['statement'],
|
|
2579
|
+
},
|
|
2580
|
+
children: [],
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* @inheritDoc
|
|
2585
|
+
*/
|
|
2586
|
+
appendChildBlocks(currentBlock, childBlocks) {
|
|
2587
|
+
currentBlock.children = childBlocks.map((block) => {
|
|
2588
|
+
block.parent = currentBlock;
|
|
2589
|
+
return block;
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
/**
|
|
2593
|
+
* @inheritDoc
|
|
2594
|
+
*/
|
|
2595
|
+
shouldProceedToElementChildren() {
|
|
2596
|
+
return true;
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* Strategy to convert a div with class 'statementelement' into an function block.
|
|
2602
|
+
*/
|
|
2603
|
+
class DivToFunctionContentStrategy extends DivToLogicControlBlockStrategy {
|
|
2604
|
+
constructor() {
|
|
2605
|
+
super(...arguments);
|
|
2606
|
+
this.blockClassName = 'statementelement';
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* @inheritDoc
|
|
2610
|
+
*/
|
|
2611
|
+
handle(elementsArray, options) {
|
|
2612
|
+
const element = elementsArray[0];
|
|
2613
|
+
const annotations = dtoRendererManager.htmlElementToAnnotationGenerator.generate(codeBlock.RTETextBlock, element);
|
|
2614
|
+
const nodes = Array.from(elementsArray[0].childNodes);
|
|
2615
|
+
return codeBlock.RTETextBlock.from({
|
|
2616
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
2617
|
+
type: 'paragraph',
|
|
2618
|
+
annotations: Object.assign({ customClass: [this.blockClassName] }, annotations),
|
|
2619
|
+
nodes: this.generateChildNodes(nodes, undefined, options),
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
const functionBlockStylesCss = "div.statement{padding:2px 4px;background:rgba(var(--v-bg-accent3-secondary, 255, 239, 200));border:1px solid rgba(var(--v-bg-accent3-primary, 255, 220, 131));border-radius:4px;display:flex;flex-direction:row;justify-content:flex-start;align-items:stretch;gap:4px}div.statement .statementsyntax{padding:3px 0;line-height:22px}.rich-text-content div.statement .statementsyntax,.rich-text-content div.statement .statementelement{display:inline-block}div.statement+div.statement{margin-top:2px}div.statement .statementsyntax span{color:rgb(38, 42, 255);font-weight:bold}div.statement .statementelement{padding:2px 4px;background:rgba(var(--v-bg-secondary, 245, 247, 247));border:1px solid rgba(var(--v-border-color-input-field, 171, 198, 216));border-radius:4px;margin:0;min-width:8px}";
|
|
2625
|
+
|
|
2626
|
+
/**
|
|
2627
|
+
* Renderer for Function Block
|
|
2628
|
+
*/
|
|
2629
|
+
class RTEFunctionBlockRenderer extends VegaRTEExtensionRenderer {
|
|
2630
|
+
/**
|
|
2631
|
+
* @inheritDoc
|
|
2632
|
+
*/
|
|
2633
|
+
doRender(createElement, renderData) {
|
|
2634
|
+
return createElement('div', {
|
|
2635
|
+
key: renderData.id,
|
|
2636
|
+
class: this.getElementClassName(renderData),
|
|
2637
|
+
ref: this.useRef(renderData),
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
/**
|
|
2641
|
+
* Defines the function block styles to be injected into the RTE scope.
|
|
2642
|
+
*
|
|
2643
|
+
* @returns {string} - The styles as a string.
|
|
2644
|
+
*/
|
|
2645
|
+
injectRTEScopeStyles() {
|
|
2646
|
+
return functionBlockStylesCss;
|
|
2647
|
+
}
|
|
2648
|
+
/**
|
|
2649
|
+
* Gets the class name for the function block element.
|
|
2650
|
+
*
|
|
2651
|
+
* @param {RTEFunctionBlock} block - The function block.
|
|
2652
|
+
* @returns {string} The class name for the function block element.
|
|
2653
|
+
*/
|
|
2654
|
+
getElementClassName(block) {
|
|
2655
|
+
let classes = block.getClasses();
|
|
2656
|
+
if (classes.indexOf('statement') < 0) {
|
|
2657
|
+
classes = 'statement ' + classes;
|
|
2658
|
+
}
|
|
2659
|
+
return classes.trim();
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
/**
|
|
2664
|
+
* Abstract class for action handler interceptors, which can intercept actions before they are handled.
|
|
2665
|
+
*/
|
|
2666
|
+
class ActionHandlerInterceptor {
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
/**
|
|
2670
|
+
* Prevent special type input in function block.
|
|
2671
|
+
*/
|
|
2672
|
+
class PreventNewParagraphInterceptor extends ActionHandlerInterceptor {
|
|
2673
|
+
/**
|
|
2674
|
+
* Checks the target block parent whether is function block.
|
|
2675
|
+
*
|
|
2676
|
+
* @param {InsertNewParagraphAction} _action - the action to be intercepted
|
|
2677
|
+
* @param {RTETextBlock} target - the target block
|
|
2678
|
+
* @returns {boolean} - true if the target block parent is function block, false otherwise
|
|
2679
|
+
*/
|
|
2680
|
+
canIntercept(_action, target) {
|
|
2681
|
+
return target.parent && target.parent instanceof RTEFunctionBlock;
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* Insert a new paragraph behind of the function block instead of the target block.
|
|
2685
|
+
*
|
|
2686
|
+
* @param {ActionHandlerExecution} _execution - the original execution function
|
|
2687
|
+
* @param {ModifyContentAction} _action - the action to be intercepted
|
|
2688
|
+
* @param {RTETextBlock} target - the target block
|
|
2689
|
+
*/
|
|
2690
|
+
intercept(_execution, _action, target) {
|
|
2691
|
+
const insertParagraphAction = new dtoRendererManager.InsertNewParagraphAction(target.children[0], 0);
|
|
2692
|
+
insertParagraphAction.isFlushable = true;
|
|
2693
|
+
target.parent.apply(insertParagraphAction);
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
/**
|
|
2698
|
+
* Insert a new paragraph behind of current function block strategy.
|
|
2699
|
+
*/
|
|
2700
|
+
class FunctionBlockInsertParagraphStrategy extends codeBlock.ActionHandleStrategy {
|
|
2701
|
+
/**
|
|
2702
|
+
* @inheritDoc
|
|
2703
|
+
*/
|
|
2704
|
+
handleAction(action, target) {
|
|
2705
|
+
const newParagraph = this.createNewParagraph('');
|
|
2706
|
+
if (newParagraph) {
|
|
2707
|
+
target.parent.apply(new codeBlock.InsertChildrenAfterAction(target, newParagraph));
|
|
2708
|
+
action.newBlock = newParagraph;
|
|
2709
|
+
this.focusToNextLine(newParagraph);
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
/**
|
|
2713
|
+
* Focus to next paragraph.
|
|
2714
|
+
*
|
|
2715
|
+
* @param {RTETextBlock} block - The paragraph need to focus.
|
|
2716
|
+
*/
|
|
2717
|
+
focusToNextLine(block) {
|
|
2718
|
+
const root = this.getRootContent(block);
|
|
2719
|
+
if (root) {
|
|
2720
|
+
root.apply(new dtoRendererManager.UpdateCursorPositionAction(block.children[0], 1));
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
const PASTE_PLAIN_TEXT = 'PASTE_PLAIN_TEXT';
|
|
2726
|
+
/**
|
|
2727
|
+
* Action to paste plain text content into function block.
|
|
2728
|
+
*
|
|
2729
|
+
* @example functionBlock.apply(new PastePlainTextAction('content', range))
|
|
2730
|
+
* @example host.value.apply(new PastePlainTextAction('content', range))
|
|
2731
|
+
*/
|
|
2732
|
+
class PastePlainTextAction extends codeBlock.ModifyContentAction {
|
|
2733
|
+
constructor(blocksToBeInserted, startNode, startOffset) {
|
|
2734
|
+
super();
|
|
2735
|
+
this.type = PASTE_PLAIN_TEXT;
|
|
2736
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
2737
|
+
this.startNode = startNode;
|
|
2738
|
+
this.startOffset = startOffset;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Prevent special type input in function block.
|
|
2744
|
+
*/
|
|
2745
|
+
class PreventPasteContentInterceptor extends PreventNewParagraphInterceptor {
|
|
2746
|
+
/**
|
|
2747
|
+
* Paste plain text into text block.
|
|
2748
|
+
*
|
|
2749
|
+
* @param {ActionHandlerExecution} _execution - the original execution function
|
|
2750
|
+
* @param {ModifyContentAction} action - the action to be intercepted
|
|
2751
|
+
* @param {RTETextBlock} target - the target block
|
|
2752
|
+
*/
|
|
2753
|
+
intercept(_execution, action, target) {
|
|
2754
|
+
const { blocksToBeInserted, rteRange } = action;
|
|
2755
|
+
let { startNode, startOffset } = action;
|
|
2756
|
+
// Set the start offset from rteRange if available, this is to handle the paste issue https://gethired.atlassian.net/browse/VD-7779
|
|
2757
|
+
if (rteRange) {
|
|
2758
|
+
startNode = rteRange.startNode;
|
|
2759
|
+
startOffset = rteRange.startOffset;
|
|
2760
|
+
}
|
|
2761
|
+
const pastePlainTextAction = new PastePlainTextAction(blocksToBeInserted, startNode, startOffset);
|
|
2762
|
+
target.apply(pastePlainTextAction);
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
/**
|
|
2767
|
+
* Strategy to handle the paste content into function block.
|
|
2768
|
+
*/
|
|
2769
|
+
class PastePlainTextStrategy extends codeBlock.ActionHandleStrategy {
|
|
2770
|
+
/**
|
|
2771
|
+
* @inheritDoc
|
|
2772
|
+
*/
|
|
2773
|
+
handleAction(action, target) {
|
|
2774
|
+
const { blocksToBeInserted, startNode, startOffset } = action;
|
|
2775
|
+
if (startNode instanceof codeBlock.RTETextNode) {
|
|
2776
|
+
const textNodes = blocksToBeInserted.flatMap((block) => {
|
|
2777
|
+
if (block instanceof codeBlock.RTETextBlock) {
|
|
2778
|
+
this.copyLinkGroupAnnotations(target.annotationMap, block.annotationMap);
|
|
2779
|
+
return block.children;
|
|
2780
|
+
}
|
|
2781
|
+
return [];
|
|
2782
|
+
});
|
|
2783
|
+
if (textNodes.length > 0) {
|
|
2784
|
+
if (startOffset > 0) {
|
|
2785
|
+
target.apply(new codeBlock.InsertChildrenAfterAction(startNode, ...textNodes));
|
|
2786
|
+
}
|
|
2787
|
+
else {
|
|
2788
|
+
target.apply(new codeBlock.InsertChildrenBeforeAction(startNode, ...textNodes));
|
|
2789
|
+
}
|
|
2790
|
+
this.focusToNextLine(textNodes[textNodes.length - 1], textNodes[textNodes.length - 1].getRangeEndOffset());
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Focus to next paragraph.
|
|
2796
|
+
*
|
|
2797
|
+
* @param {RTETextNode} node - The text node need to focus.
|
|
2798
|
+
* @param {number} startOffset - The offset need to focus.
|
|
2799
|
+
*/
|
|
2800
|
+
focusToNextLine(node, startOffset) {
|
|
2801
|
+
const root = this.getRootContent(node);
|
|
2802
|
+
if (root) {
|
|
2803
|
+
root.apply(new dtoRendererManager.UpdateCursorPositionAction(node, startOffset));
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
/**
|
|
2807
|
+
* Copy link group annotations from copied block to target block.
|
|
2808
|
+
*
|
|
2809
|
+
* @param {BlockAnnotations} blockAnnotationMap - The target block annotation map.
|
|
2810
|
+
* @param {BlockAnnotations} copiedAnnotationMap - The copied block annotation map.
|
|
2811
|
+
*/
|
|
2812
|
+
copyLinkGroupAnnotations(blockAnnotationMap, copiedAnnotationMap) {
|
|
2813
|
+
if (copiedAnnotationMap && copiedAnnotationMap.has(codeBlock.InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
2814
|
+
const copiedLinkGroupAnnotation = copiedAnnotationMap.get(codeBlock.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2815
|
+
if (!blockAnnotationMap.has(codeBlock.InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
2816
|
+
blockAnnotationMap.set(codeBlock.InternalAnnotationTypeEnum.LINK_GROUP, copiedAnnotationMap.get(codeBlock.InternalAnnotationTypeEnum.LINK_GROUP));
|
|
2817
|
+
}
|
|
2818
|
+
else {
|
|
2819
|
+
copiedLinkGroupAnnotation.linkGroups.forEach((nodes, groupKey) => {
|
|
2820
|
+
const existingAnnotation = blockAnnotationMap.get(codeBlock.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2821
|
+
existingAnnotation.linkGroups.set(groupKey, nodes);
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
const convertLogicControlBlockStrategy = new DivToLogicControlBlockStrategy();
|
|
2829
|
+
const convertFunctionContentStrategy = new DivToFunctionContentStrategy();
|
|
2830
|
+
const convertFunctionBlockStrategy = new DivToFunctionBlockStrategy();
|
|
2831
|
+
/**
|
|
2832
|
+
* Function extension class for Vega Rich Text Editor.
|
|
2833
|
+
*/
|
|
2834
|
+
class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
2835
|
+
constructor() {
|
|
2836
|
+
super();
|
|
2837
|
+
this.toolbarButtonRenderer = new FunctionToolbarButtonRenderer();
|
|
2838
|
+
this.registerBlockBasicStrategies(RTELogicControlBlock.name);
|
|
2839
|
+
this.registerBlockBasicStrategies(RTEFunctionBlock.name);
|
|
2840
|
+
this.preventFunctionBlockDefaultInsertNewParagraph();
|
|
2841
|
+
this.registerNode('logic-control-block', RTELogicControlBlock);
|
|
2842
|
+
this.registerRenderer('logic-control-block', new RTELogicControlBlockRenderer());
|
|
2843
|
+
this.registerNode('function-block', RTEFunctionBlock);
|
|
2844
|
+
this.registerRenderer('function-block', new RTEFunctionBlockRenderer());
|
|
2845
|
+
this.registerToolbarButtonRenderer('functions', this.toolbarButtonRenderer);
|
|
2846
|
+
this.registerElementToBlockDTOClassStrategy(convertLogicControlBlockStrategy);
|
|
2847
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionContentStrategy);
|
|
2848
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionBlockStrategy);
|
|
2849
|
+
}
|
|
2850
|
+
/**
|
|
2851
|
+
* Initializes the extension with the given context
|
|
2852
|
+
*
|
|
2853
|
+
* @param {RTEExtensionContext} context - extension context
|
|
2854
|
+
*/
|
|
2855
|
+
initialExtension(context) {
|
|
2856
|
+
super.initialExtension(context);
|
|
2857
|
+
if (this.toolbarButtonRenderer) {
|
|
2858
|
+
this.toolbarButtonRenderer.injectExtensionContext(context);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
2863
|
+
*/
|
|
2864
|
+
preventFunctionBlockDefaultInsertNewParagraph() {
|
|
2865
|
+
this.unRegisterStrategy(codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH, RTELogicControlBlock.name);
|
|
2866
|
+
this.unRegisterStrategy(codeBlock.ModifyContentActionType.APPEND_CHILDREN, RTEFunctionBlock.name);
|
|
2867
|
+
this.unRegisterStrategy(codeBlock.ModifyContentActionType.INSERT_CHILDREN_AFTER, RTEFunctionBlock.name);
|
|
2868
|
+
this.unRegisterStrategy(codeBlock.ModifyContentActionType.INSERT_CHILDREN_BEFORE, RTEFunctionBlock.name);
|
|
2869
|
+
this.unRegisterStrategy(codeBlock.ModifyContentActionType.PASTE_CONTENT, RTELogicControlBlock.name);
|
|
2870
|
+
VegaRTEExtension.registerActionHandleStrategy(RTEFunctionBlock.name, codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH, new FunctionBlockInsertParagraphStrategy());
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
(() => {
|
|
2874
|
+
const insertFunctionBlockStrategy = new InsertFunctionBlockStrategy();
|
|
2875
|
+
VegaRTEExtension.registerActionHandleStrategy(dtoRendererManager.VegaRTEContent.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2876
|
+
VegaRTEExtension.registerActionHandleStrategy(codeBlock.RTETextBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2877
|
+
VegaRTEExtension.registerActionHandleStrategy(dtoRendererManager.RTEImageBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2878
|
+
VegaRTEExtension.registerActionHandleStrategy(RTELogicControlBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2879
|
+
VegaRTEExtension.registerActionHandleStrategy(codeBlock.RTETextBlock.name, PASTE_PLAIN_TEXT, new PastePlainTextStrategy());
|
|
2880
|
+
VegaRTEExtension.registerActionHandlerInterceptor(codeBlock.RTETextBlock.name, codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
2881
|
+
VegaRTEExtension.registerActionHandlerInterceptor(codeBlock.RTETextBlock.name, codeBlock.ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
2882
|
+
})();
|
|
2883
|
+
|
|
2884
|
+
exports.ActionHandlerInterceptor = ActionHandlerInterceptor;
|
|
1963
2885
|
exports.InsertNodeToNearestRootAction = InsertNodeToNearestRootAction;
|
|
1964
2886
|
exports.InternalVegaZIndexManager = InternalVegaZIndexManager$1;
|
|
1965
2887
|
exports.RTETokenNode = RTETokenNode;
|
|
@@ -1971,6 +2893,7 @@ exports.VegaLoader = VegaLoader;
|
|
|
1971
2893
|
exports.VegaNotify = VegaNotify;
|
|
1972
2894
|
exports.VegaRTEExtension = VegaRTEExtension;
|
|
1973
2895
|
exports.VegaRTEExtensionRenderer = VegaRTEExtensionRenderer;
|
|
2896
|
+
exports.VegaRTEFunctionExtension = VegaRTEFunctionExtension;
|
|
1974
2897
|
exports.VegaRTETokenExtension = VegaRTETokenExtension;
|
|
1975
2898
|
exports.VegaRTEToolbarButtonRenderer = VegaRTEToolbarButtonRenderer;
|
|
1976
2899
|
exports.VegaSkeletonLoader = VegaSkeletonLoader;
|