@heartlandone/vega 2.67.0 → 2.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-ab28f910.js → app-globals-f7106a22.js} +15 -14
- package/dist/cjs/{child-nodes-event-prevent-slimmer-eb803b14.js → child-nodes-event-prevent-slimmer-f8840f1b.js} +1 -1
- package/dist/cjs/{code-block-ab97a0a0.js → code-block-39074880.js} +514 -319
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-5630341e.js → component-value-history-controller-slimmer.abstract-ddedf543.js} +2 -2
- package/dist/cjs/{design-token-847739f1.js → design-token-e14a4e66.js} +1 -1
- package/dist/cjs/{dto-renderer-manager-d0f0f2c0.js → dto-renderer-manager-b7969d6c.js} +1587 -1563
- package/dist/cjs/{element-appender-slimmer-aead9bbb.js → element-appender-slimmer-7ee27ab3.js} +5 -5
- package/dist/cjs/{event-emit-slimmer-d21a0935.js → event-emit-slimmer-7afe8d78.js} +1 -1
- package/dist/cjs/{token-extension-aa8d5cce.js → function-extension-f0e845f2.js} +1019 -96
- package/dist/cjs/{image-annotation-action-d84de785.js → image-annotation-action-7f0626c8.js} +15 -25
- package/dist/cjs/index.cjs.js +36 -24
- package/dist/cjs/{internal-vega-event-manager-4d1ce667.js → internal-vega-event-manager-45d451de.js} +5 -2
- package/dist/cjs/{language-extension-d257e65d.js → language-extension-d0103d1a.js} +5 -5
- package/dist/cjs/loader.cjs.js +8 -8
- package/dist/cjs/{public-rules-d2b9b8f0.js → public-rules-8b67eaba.js} +3 -3
- package/dist/cjs/{range-d610028e.js → range-002671b6.js} +1 -1
- package/dist/cjs/{responsive-format-facade-71e7b74c.js → responsive-format-facade-347db035.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-a8fe5f50.js → rich-text-editor-required-rule-5392bd8a.js} +1 -1
- package/dist/cjs/{style-formatter-6facb42b.js → style-formatter-0a09f0dd.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +7 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-banner.cjs.entry.js +2 -2
- package/dist/cjs/vega-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-circle.cjs.entry.js +9 -9
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-link.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +8 -8
- package/dist/cjs/vega-calendar_4.cjs.entry.js +307 -269
- package/dist/cjs/vega-card.cjs.entry.js +7 -7
- package/dist/cjs/vega-carousel.cjs.entry.js +7 -7
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +9 -9
- package/dist/cjs/vega-code-block.cjs.entry.js +6 -6
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +12 -12
- package/dist/cjs/vega-dialog_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-divider.cjs.entry.js +7 -7
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +24 -5
- package/dist/cjs/vega-file-uploader.cjs.entry.js +2 -2
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-flex.cjs.entry.js +8 -8
- package/dist/cjs/vega-font.cjs.entry.js +7 -7
- package/dist/cjs/vega-form.cjs.entry.js +3 -3
- package/dist/cjs/vega-grid.cjs.entry.js +7 -7
- package/dist/cjs/vega-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-passcode.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +38 -14
- package/dist/cjs/vega-input.cjs.entry.js +14 -3
- package/dist/cjs/vega-item-toggle.cjs.entry.js +2 -2
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +11 -11
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +7 -7
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +2 -2
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +93 -16
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +107 -54
- package/dist/cjs/vega-segment-control.cjs.entry.js +2 -2
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +10 -10
- package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_8.cjs.entry.js +11 -11
- package/dist/cjs/vega-textarea.cjs.entry.js +24 -4
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega.cjs.js +8 -8
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/calendar-event-sorter.js +3 -3
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/layout/day-view-timed-event-layout-column.js +1 -1
- package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +3 -4
- package/dist/collection/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.js +11 -3
- package/dist/collection/components/vega-field-label/vega-field-label.js +42 -0
- package/dist/collection/components/vega-input/vega-input.js +48 -2
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-renderer.js +16 -5
- package/dist/collection/components/vega-input-select/vega-input-select.css +2 -44
- package/dist/collection/components/vega-input-select/vega-input-select.js +81 -1
- package/dist/collection/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-extensions-styles-controller.js +60 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +7 -1
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.js +17 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor-registry.js +61 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor.abstract.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +30 -6
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +10 -3
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/paste-content-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/annotation-style.js +87 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +27 -9
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +1 -12
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +6 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +14 -5
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +7 -37
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +14 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +19 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +44 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +51 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-new-paragraph-interceptor.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-paste-content-interceptor.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/function-block-insert-paragraph-strategy.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/paste-plain-text-strategy.js +68 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/actions/insert-function-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/actions/paste-plain-text-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +97 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.js +73 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-node.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +75 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +71 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.js +5 -6
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-toolbar-button-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/public-api.js +8 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +9 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +0 -12
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +12 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +30 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +10 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +1 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +2 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +2 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +4 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +32 -2
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-style.test.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +3 -0
- package/dist/collection/components/vega-selection-chip/vega-selection-chip.js +1 -1
- package/dist/collection/components/vega-table/vega-table.css +2 -1
- package/dist/collection/components/vega-textarea/vega-textarea.js +88 -2
- package/dist/collection/global/scripts/before-vega-load.js +2 -0
- package/dist/collection/helpers/calendar/calendar-date-time.js +136 -0
- package/dist/collection/helpers/calendar/calendar-date.js +10 -4
- package/dist/collection/helpers/calendar/calendar-event.js +38 -193
- package/dist/collection/helpers/calendar/calendar-time.js +120 -0
- package/dist/collection/helpers/calendar/index.js +2 -0
- package/dist/collection/helpers/calendar/test/calendar-date-time.test.js +27 -0
- package/dist/collection/helpers/calendar/test/calendar-event.test.js +24 -22
- package/dist/collection/helpers/calendar/test/calendar-period/day-period.test.js +2 -2
- package/dist/collection/helpers/calendar/test/calendar-period/month-period.test.js +2 -2
- package/dist/collection/helpers/calendar/test/calendar-period/week-period.test.js +6 -6
- package/dist/collection/helpers/calendar/test/calendar-time.test.js +45 -0
- package/dist/collection/helpers/calendar/test/utils.test.js +1 -29
- package/dist/collection/helpers/calendar/utils.js +0 -66
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +5 -2
- package/dist/collection/helpers/rte-manager/dto-action-strategy-manager.js +2 -0
- package/dist/esm/{app-globals-37a60cc1.js → app-globals-2f689986.js} +6 -5
- package/dist/esm/{child-nodes-event-prevent-slimmer-735cb880.js → child-nodes-event-prevent-slimmer-76331524.js} +1 -1
- package/dist/esm/{code-block-11b2bc1c.js → code-block-e8839202.js} +511 -318
- package/dist/esm/{component-value-history-controller-slimmer.abstract-16c5cb96.js → component-value-history-controller-slimmer.abstract-c6f94113.js} +2 -2
- package/dist/esm/{design-token-297dc528.js → design-token-e9e6b011.js} +1 -1
- package/dist/esm/{dto-renderer-manager-a1a3b6d2.js → dto-renderer-manager-7abc53bf.js} +1587 -1565
- package/dist/esm/{element-appender-slimmer-f7233708.js → element-appender-slimmer-8dbc8387.js} +2 -2
- package/dist/esm/{event-emit-slimmer-28fd360c.js → event-emit-slimmer-4e28e9f8.js} +1 -1
- package/dist/esm/{token-extension-b690953f.js → function-extension-eb1d062f.js} +1018 -97
- package/dist/esm/{image-annotation-action-fc46c920.js → image-annotation-action-7957653a.js} +14 -24
- package/dist/esm/index.js +9 -9
- package/dist/esm/{internal-vega-event-manager-a5a5938d.js → internal-vega-event-manager-516aa721.js} +5 -2
- package/dist/esm/{language-extension-314a2b18.js → language-extension-3331131f.js} +3 -3
- package/dist/esm/loader.js +8 -8
- package/dist/esm/{public-rules-c6a6946d.js → public-rules-e613dead.js} +3 -3
- package/dist/esm/{range-b78254de.js → range-adf206fd.js} +1 -1
- package/dist/esm/{responsive-format-facade-a41e1be7.js → responsive-format-facade-b0712993.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-d50c24da.js → rich-text-editor-required-rule-43857573.js} +1 -1
- package/dist/esm/{style-formatter-f7effaac.js → style-formatter-a20a1ef4.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +7 -7
- package/dist/esm/vega-app-header-button.entry.js +8 -8
- package/dist/esm/vega-banner.entry.js +2 -2
- package/dist/esm/vega-box.entry.js +8 -8
- package/dist/esm/vega-breadcrumb.entry.js +3 -3
- package/dist/esm/vega-button-circle.entry.js +9 -9
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button-link.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +8 -8
- package/dist/esm/vega-calendar_4.entry.js +307 -269
- package/dist/esm/vega-card.entry.js +7 -7
- package/dist/esm/vega-carousel.entry.js +7 -7
- package/dist/esm/vega-checkbox_2.entry.js +3 -3
- package/dist/esm/vega-chip.entry.js +9 -9
- package/dist/esm/vega-code-block.entry.js +6 -6
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +3 -3
- package/dist/esm/vega-date-picker_2.entry.js +8 -8
- package/dist/esm/vega-dialog_2.entry.js +9 -9
- package/dist/esm/vega-divider.entry.js +7 -7
- package/dist/esm/vega-dropdown_5.entry.js +9 -9
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +24 -5
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-flag-icon.entry.js +6 -6
- package/dist/esm/vega-flex.entry.js +8 -8
- package/dist/esm/vega-font.entry.js +7 -7
- package/dist/esm/vega-form.entry.js +3 -3
- package/dist/esm/vega-grid.entry.js +7 -7
- package/dist/esm/vega-icon.entry.js +6 -6
- package/dist/esm/vega-image-uploader.entry.js +7 -7
- package/dist/esm/vega-input-credit-card.entry.js +3 -3
- package/dist/esm/vega-input-numeric.entry.js +3 -3
- package/dist/esm/vega-input-passcode.entry.js +3 -3
- package/dist/esm/vega-input-phone-number.entry.js +6 -6
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +38 -14
- package/dist/esm/vega-input.entry.js +14 -3
- package/dist/esm/vega-item-toggle.entry.js +2 -2
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +6 -6
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +7 -7
- package/dist/esm/vega-popover_2.entry.js +9 -9
- package/dist/esm/vega-progress-tracker.entry.js +2 -2
- package/dist/esm/vega-radio_2.entry.js +3 -3
- package/dist/esm/vega-rich-text-content.entry.js +93 -16
- package/dist/esm/vega-rich-text-editor_4.entry.js +107 -54
- package/dist/esm/vega-segment-control.entry.js +2 -2
- package/dist/esm/vega-selection-chip_2.entry.js +8 -8
- package/dist/esm/vega-selection-tile_2.entry.js +3 -3
- package/dist/esm/vega-sidenav_3.entry.js +6 -6
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +3 -3
- package/dist/esm/vega-tab-group_2.entry.js +3 -3
- package/dist/esm/vega-table_8.entry.js +8 -8
- package/dist/esm/vega-textarea.entry.js +25 -5
- package/dist/esm/vega-time-picker_2.entry.js +9 -9
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega-tooltip_2.entry.js +7 -7
- package/dist/esm/vega.js +8 -8
- package/dist/sri/vega-sri-manifest.json +273 -273
- package/dist/types/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.d.ts +1 -0
- package/dist/types/components/vega-field-label/types.d.ts +12 -0
- package/dist/types/components/vega-field-label/vega-field-label.d.ts +13 -1
- package/dist/types/components/vega-input/vega-input.d.ts +14 -2
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-renderer.d.ts +3 -0
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +25 -0
- package/dist/types/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-extensions-styles-controller.d.ts +26 -0
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-content/vega-rich-text-content.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor-registry.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-interceptor.abstract.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +9 -2
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/paste-content-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/paste-content-action.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation-style.d.ts +46 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +10 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +19 -3
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +36 -3
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-new-paragraph-interceptor.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-interceptor/prevent-paste-content-interceptor.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/function-block-insert-paragraph-strategy.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/paste-plain-text-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/actions/insert-function-block-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/actions/paste-plain-text-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +58 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.d.ts +55 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/logic-control-node.d.ts +48 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-extension.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-toolbar-button-renderer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node-renderer.d.ts +3 -4
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +8 -2
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +8 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +2 -11
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-delete-node-content-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/annotation-style.test.d.ts +1 -0
- package/dist/types/components/vega-textarea/vega-textarea.d.ts +26 -0
- package/dist/types/components.d.ts +65 -3
- package/dist/types/helpers/calendar/calendar-date-time.d.ts +76 -0
- package/dist/types/helpers/calendar/calendar-event.d.ts +18 -57
- package/dist/types/helpers/calendar/calendar-time.d.ts +64 -0
- package/dist/types/helpers/calendar/index.d.ts +2 -0
- package/dist/types/helpers/calendar/test/calendar-date-time.test.d.ts +1 -0
- package/dist/types/helpers/calendar/test/calendar-time.test.d.ts +1 -0
- package/dist/types/helpers/calendar/utils.d.ts +0 -25
- package/dist/types/types/components.type.d.ts +1 -1
- package/dist/types/types/public-api.d.ts +2 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-6f7d42a0.entry.js → p-00376f71.entry.js} +1 -1
- package/dist/vega/p-018d70a5.js +1 -0
- package/dist/vega/p-0849f85e.js +1 -0
- package/dist/vega/{p-b431f9d5.entry.js → p-0a55f984.entry.js} +1 -1
- package/dist/vega/p-0f7dec29.entry.js +1 -0
- package/dist/vega/{p-47cae62d.entry.js → p-113d305b.entry.js} +1 -1
- package/dist/vega/{p-015cdbe7.entry.js → p-115b42e6.entry.js} +1 -1
- package/dist/vega/p-16358fec.entry.js +1 -0
- package/dist/vega/{p-af5bfe34.js → p-16d68187.js} +1 -1
- package/dist/vega/{p-92a22562.entry.js → p-18e8c54a.entry.js} +1 -1
- package/dist/vega/{p-6f6ccf67.entry.js → p-1922303e.entry.js} +1 -1
- package/dist/vega/{p-74d61782.entry.js → p-19256107.entry.js} +1 -1
- package/dist/vega/{p-59298f5e.entry.js → p-1dcb1fcd.entry.js} +2 -2
- package/dist/vega/{p-7f69081b.entry.js → p-1dd7f8b2.entry.js} +1 -1
- package/dist/vega/{p-d006e732.entry.js → p-22fe8c61.entry.js} +1 -1
- package/dist/vega/{p-524693d8.entry.js → p-238afe1b.entry.js} +1 -1
- package/dist/vega/p-240d9d35.entry.js +1 -0
- package/dist/vega/{p-b82d3915.entry.js → p-24419ebe.entry.js} +1 -1
- package/dist/vega/p-2478f65e.js +1 -0
- package/dist/vega/{p-358e9800.entry.js → p-2c945862.entry.js} +1 -1
- package/dist/vega/{p-5f58d1da.entry.js → p-2e32fbe6.entry.js} +1 -1
- package/dist/vega/p-2f04d2ac.js +1 -0
- package/dist/vega/{p-a73dc4b3.entry.js → p-30a8d9d6.entry.js} +1 -1
- package/dist/vega/{p-e6cccee4.js → p-369810ae.js} +1 -1
- package/dist/vega/p-3ad87199.entry.js +1 -0
- package/dist/vega/{p-fe2e859f.entry.js → p-3b800f1b.entry.js} +1 -1
- package/dist/vega/p-437f865f.js +1 -0
- package/dist/vega/{p-de624f7d.entry.js → p-48bc03fa.entry.js} +1 -1
- package/dist/vega/{p-46830028.entry.js → p-54ddd06f.entry.js} +1 -1
- package/dist/vega/{p-5a0524ab.entry.js → p-56636a58.entry.js} +1 -1
- package/dist/vega/{p-fc8c5869.entry.js → p-56f77466.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-ab1001f5.entry.js → p-61d9cdf9.entry.js} +1 -1
- package/dist/vega/{p-39b9c57b.entry.js → p-626246b4.entry.js} +1 -1
- package/dist/vega/{p-ff3bb4e2.entry.js → p-634499cb.entry.js} +1 -1
- package/dist/vega/p-6609d87e.entry.js +1 -0
- package/dist/vega/p-69d27eaf.entry.js +1 -0
- package/dist/vega/{p-7efb5ebe.entry.js → p-705dad87.entry.js} +1 -1
- package/dist/vega/{p-8d574fbd.entry.js → p-75b5894f.entry.js} +1 -1
- package/dist/vega/{p-00071542.entry.js → p-76b1dae4.entry.js} +1 -1
- package/dist/vega/{p-54b62ecf.js → p-7747c163.js} +1 -1
- package/dist/vega/{p-0ed53cce.entry.js → p-787caad3.entry.js} +1 -1
- package/dist/vega/{p-129c0ce1.js → p-79e6e12c.js} +1 -1
- package/dist/vega/{p-cc519f53.entry.js → p-7dde3be9.entry.js} +1 -1
- package/dist/vega/p-8233d814.entry.js +1 -0
- package/dist/vega/{p-5e32866d.entry.js → p-83a50ac2.entry.js} +1 -1
- package/dist/vega/p-8506e8c3.js +1 -0
- package/dist/vega/{p-47fa359b.js → p-85407fb9.js} +1 -1
- package/dist/vega/{p-892cbe7c.entry.js → p-880569ec.entry.js} +1 -1
- package/dist/vega/{p-0113a83c.entry.js → p-8dba59a6.entry.js} +1 -1
- package/dist/vega/p-94e167b8.entry.js +1 -0
- package/dist/vega/{p-b2aaab66.entry.js → p-98fb9eaa.entry.js} +1 -1
- package/dist/vega/{p-3288a65b.entry.js → p-99bf5993.entry.js} +1 -1
- package/dist/vega/p-a211ae63.js +1 -0
- package/dist/vega/{p-fef846d5.entry.js → p-a2506cb5.entry.js} +1 -1
- package/dist/vega/{p-4e33fff6.entry.js → p-a6fb5a40.entry.js} +1 -1
- package/dist/vega/{p-bee1cc34.entry.js → p-b5060e84.entry.js} +1 -1
- package/dist/vega/{p-616cd622.entry.js → p-b78670c9.entry.js} +1 -1
- package/dist/vega/{p-d5761532.entry.js → p-b8558278.entry.js} +1 -1
- package/dist/vega/{p-8d655fd2.entry.js → p-bb0f2b5f.entry.js} +1 -1
- package/dist/vega/{p-a7631c6b.js → p-bb37a401.js} +1 -1
- package/dist/vega/p-bccee21e.js +1 -0
- package/dist/vega/{p-2553031f.entry.js → p-bd0e55a2.entry.js} +1 -1
- package/dist/vega/{p-65693321.entry.js → p-c0223a17.entry.js} +1 -1
- package/dist/vega/{p-2d430dc4.entry.js → p-c26332ae.entry.js} +1 -1
- package/dist/vega/{p-7f9ec104.entry.js → p-c54148fb.entry.js} +1 -1
- package/dist/vega/{p-276b1163.entry.js → p-d3905af1.entry.js} +2 -2
- package/dist/vega/p-d4893487.js +1 -0
- package/dist/vega/{p-d1dacaeb.entry.js → p-d67200e8.entry.js} +1 -1
- package/dist/vega/{p-725f0a2c.js → p-db57dddc.js} +1 -1
- package/dist/vega/{p-ed8bc4f0.entry.js → p-de02f404.entry.js} +1 -1
- package/dist/vega/{p-d4452dbc.entry.js → p-de8c5fae.entry.js} +1 -1
- package/dist/vega/{p-7b145620.js → p-de97c6d9.js} +1 -1
- package/dist/vega/{p-34800282.entry.js → p-e0979451.entry.js} +1 -1
- package/dist/vega/{p-1a3cb65e.entry.js → p-e6351dab.entry.js} +1 -1
- package/dist/vega/{p-8d096fea.entry.js → p-f0fb3fdd.entry.js} +1 -1
- package/dist/vega/{p-ea05a2fc.entry.js → p-f3399ef1.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-019f7f95.js +0 -1
- package/dist/vega/p-03a1e82e.entry.js +0 -1
- package/dist/vega/p-0d1eca78.entry.js +0 -1
- package/dist/vega/p-16370cfb.js +0 -1
- package/dist/vega/p-3a7f177a.entry.js +0 -1
- package/dist/vega/p-41c3fcb4.js +0 -1
- package/dist/vega/p-81105691.entry.js +0 -1
- package/dist/vega/p-822c6092.js +0 -1
- package/dist/vega/p-8edf3513.js +0 -1
- package/dist/vega/p-a1b7a179.entry.js +0 -1
- package/dist/vega/p-ab8f99e9.entry.js +0 -1
- package/dist/vega/p-bf7f755b.js +0 -1
- package/dist/vega/p-bf9476cd.entry.js +0 -1
- package/dist/vega/p-c6ce2869.js +0 -1
- package/dist/vega/p-d0e6454e.entry.js +0 -1
- package/dist/vega/p-d88e88a7.js +0 -1
- package/dist/vega/p-f360c9ba.js +0 -1
|
@@ -4,13 +4,13 @@ import { L as LogUtility, I as InjectVegaSlimmer } from './global-slimmer-regist
|
|
|
4
4
|
import { c as createDynamicSlimmer } from './dynamic-slimmer-90b8af32.js';
|
|
5
5
|
import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-0bf7fbf3.js';
|
|
6
6
|
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-b7e85b6a.js';
|
|
7
|
-
import { i as internalVegaEventManager } from './internal-vega-event-manager-
|
|
7
|
+
import { i as internalVegaEventManager } from './internal-vega-event-manager-516aa721.js';
|
|
8
8
|
import { c as convertToNumber } from './number-4398f2e1.js';
|
|
9
|
-
import { R as RTEDTORendererManager, a as RTEDTOActionStrategyManager, E as ElementToDTOClassStrategyManager, U as UpdateCursorPositionAction, b as ElementToDTOStrategy, c as RTEListItemBlock } from './dto-renderer-manager-
|
|
10
|
-
import { A as ActionHandleStrategyRegistry,
|
|
9
|
+
import { R as RTEDTORendererManager, a as RTEDTOActionStrategyManager, E as ElementToDTOClassStrategyManager, U as UpdateCursorPositionAction, b as ElementToDTOStrategy, h as htmlElementToAnnotationGenerator, c as RTEListItemBlock, V as VegaRTEContent, B as BlockToRTEBlockStrategyAbstract, I as InsertNewParagraphAction, d as RTEImageBlock } from './dto-renderer-manager-7abc53bf.js';
|
|
10
|
+
import { s as stateEntityRenderingRegistry, A as ActionHandleStrategyRegistry, a as ActionHandlerInterceptorRegistry, R as RTEDTOClassManager, M as ModifyContentAction, b as RTETextNode, c as ModifyContentActionType, d as ActionHandleStrategy, e as RTETextBlock, f as RTEBlock, g as RTEAnnotationStyle, I as InsertChildrenAfterAction, h as AppendChildrenAction, i as RTENode, j as InsertChildrenBeforeAction, k as InternalAnnotationTypeEnum } from './code-block-e8839202.js';
|
|
11
|
+
import { a as VegaInternalIconManager } from './internal-icon-manager-f0486245.js';
|
|
11
12
|
import { i as isNonNullable } from './type-guard-12f7654b.js';
|
|
12
13
|
import { V as VegaRTEBaseRenderer } from './base-renderer-101f6d04.js';
|
|
13
|
-
import { a as VegaInternalIconManager } from './internal-icon-manager-f0486245.js';
|
|
14
14
|
import { D as DomNodeSubjectObserverFactory, V as VegaDropdownClick, a as VegaClick } from './dom-node-subject-observer-factory-dca87b70.js';
|
|
15
15
|
|
|
16
16
|
const VegaLoaderRuntimeMetricsPayloadDefinition = [
|
|
@@ -1295,6 +1295,104 @@ __decorate([
|
|
|
1295
1295
|
], VegaSkeletonLoaderController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1296
1296
|
const VegaSkeletonLoader = new VegaSkeletonLoaderController();
|
|
1297
1297
|
|
|
1298
|
+
/**
|
|
1299
|
+
* Base renderer for Vega Rich Text Editor.
|
|
1300
|
+
*/
|
|
1301
|
+
class VegaRTEExtensionRenderer extends VegaRTEBaseRenderer {
|
|
1302
|
+
/**
|
|
1303
|
+
* Returns the styles to be injected into the RTE scope.
|
|
1304
|
+
* Override this method to provide custom styles for the custom blocks or nodes.
|
|
1305
|
+
*
|
|
1306
|
+
* @returns {string} - The styles as a string.
|
|
1307
|
+
*/
|
|
1308
|
+
injectRTEScopeStyles() {
|
|
1309
|
+
return '';
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Renders the given data as a DOM element.
|
|
1313
|
+
*
|
|
1314
|
+
* @param {RTEBlock | RTENode} renderData - The data to render, which can be a block or a node.
|
|
1315
|
+
* @param {RTERenderContext} rteContext - The rte editor context.
|
|
1316
|
+
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1317
|
+
* @returns {VegaRTERenderResult} - The rendered DOM element.
|
|
1318
|
+
*/
|
|
1319
|
+
render(renderData, rteContext, createElement) {
|
|
1320
|
+
const element = this.doRender(createElement, renderData, rteContext);
|
|
1321
|
+
this.fallbackRegisterRef(element, renderData);
|
|
1322
|
+
this.appendChildren(element, renderData, rteContext, createElement);
|
|
1323
|
+
return element;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* Register the reference of the element in the rendering registry.
|
|
1327
|
+
*
|
|
1328
|
+
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1329
|
+
* @returns {VegaRTEUseRef} - The function to register the element.
|
|
1330
|
+
*/
|
|
1331
|
+
useRef(renderData) {
|
|
1332
|
+
renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] = true;
|
|
1333
|
+
return function (element) {
|
|
1334
|
+
if (element) {
|
|
1335
|
+
stateEntityRenderingRegistry.register(element, renderData);
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Get a registered renderer by its key.
|
|
1341
|
+
*
|
|
1342
|
+
* @param {string} key - The key of the renderer.
|
|
1343
|
+
* @returns {Nullable<BaseRenderer>} - The registered renderer or null if not found.
|
|
1344
|
+
*/
|
|
1345
|
+
getDTORenderer(key) {
|
|
1346
|
+
return RTEDTORendererManager.getRTERenderer(key);
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Auto render the block children if the block element is not exist
|
|
1350
|
+
*
|
|
1351
|
+
* @param {VegaRTERenderResult} parentElement - The parent element to append children to.
|
|
1352
|
+
* @param {RTEBlock | RTENode} renderData - The data to render children for.
|
|
1353
|
+
* @param {RTERenderContext} rteContext - The render context.
|
|
1354
|
+
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1355
|
+
*/
|
|
1356
|
+
appendChildren(parentElement, renderData, rteContext, createElement) {
|
|
1357
|
+
if (Array.isArray(renderData['children']) &&
|
|
1358
|
+
renderData['children'].length &&
|
|
1359
|
+
!parentElement['$children$']) {
|
|
1360
|
+
parentElement['$children$'] = renderData['children']
|
|
1361
|
+
.map((child) => {
|
|
1362
|
+
return this.renderChildren(child, rteContext, createElement);
|
|
1363
|
+
})
|
|
1364
|
+
.filter(isNonNullable);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Render the children node.
|
|
1369
|
+
*
|
|
1370
|
+
* @param {RTENode | RTEBlock} renderData - The node to render children for.
|
|
1371
|
+
* @param {RTERenderContext} rteContext - The render context.
|
|
1372
|
+
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1373
|
+
* @returns {Nullable<VegaRTERenderResult>} - The rendered DOM element.
|
|
1374
|
+
*/
|
|
1375
|
+
renderChildren(renderData, rteContext, createElement) {
|
|
1376
|
+
const renderer = this.getDTORenderer(renderData.type);
|
|
1377
|
+
if (renderer) {
|
|
1378
|
+
return renderer.render(renderData, rteContext, createElement);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Fallback register reference for the element.
|
|
1383
|
+
*
|
|
1384
|
+
* @param {VegaRTERenderResult} element - The rendered DOM element.
|
|
1385
|
+
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1386
|
+
*/
|
|
1387
|
+
fallbackRegisterRef(element, renderData) {
|
|
1388
|
+
if (!renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] && element['$attrs$']) {
|
|
1389
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1390
|
+
element['$attrs$']['ref'] = this.useRef(renderData);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
VegaRTEExtensionRenderer.REGISTER_REF_FLAG = '__registeredRef__';
|
|
1395
|
+
|
|
1298
1396
|
/**
|
|
1299
1397
|
* Abstract class for Vega Rich Text Editor extensions.
|
|
1300
1398
|
*/
|
|
@@ -1304,17 +1402,28 @@ class VegaRTEExtension {
|
|
|
1304
1402
|
* The context of the RTE extension, which may include references to the host editor and other relevant information.
|
|
1305
1403
|
*/
|
|
1306
1404
|
this.extensionContext = null;
|
|
1405
|
+
this.hasCustomStylesRenderers = new Set();
|
|
1307
1406
|
}
|
|
1308
1407
|
/**
|
|
1309
1408
|
* Registers an action handle strategy for a specific node or block class.
|
|
1310
1409
|
*
|
|
1311
1410
|
* @param {string} nodeOrBlockClassName - The name of the node or block class.
|
|
1312
1411
|
* @param {string} actionType - The type of the action.
|
|
1313
|
-
* @param {ActionHandleStrategy<ModifyContentAction, RTENode | RTEBlock>} strategy - The strategy to register.
|
|
1412
|
+
* @param {ActionHandleStrategy<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The strategy to register.
|
|
1314
1413
|
*/
|
|
1315
1414
|
static registerActionHandleStrategy(nodeOrBlockClassName, actionType, strategy) {
|
|
1316
1415
|
ActionHandleStrategyRegistry.register(actionType, nodeOrBlockClassName, strategy);
|
|
1317
1416
|
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Registers an action handler interceptor for a specific node or block class.
|
|
1419
|
+
*
|
|
1420
|
+
* @param {string} nodeOrBlockClassName - The name of the node or block class.
|
|
1421
|
+
* @param {string} actionType - The type of the action.
|
|
1422
|
+
* @param {ActionHandlerInterceptor<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The interceptor to register.
|
|
1423
|
+
*/
|
|
1424
|
+
static registerActionHandlerInterceptor(nodeOrBlockClassName, actionType, strategy) {
|
|
1425
|
+
ActionHandlerInterceptorRegistry.register(actionType, nodeOrBlockClassName, strategy);
|
|
1426
|
+
}
|
|
1318
1427
|
/**
|
|
1319
1428
|
* Initializes the RTE extension with the provided context.
|
|
1320
1429
|
*
|
|
@@ -1323,6 +1432,21 @@ class VegaRTEExtension {
|
|
|
1323
1432
|
initialExtension(context) {
|
|
1324
1433
|
this.extensionContext = context;
|
|
1325
1434
|
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Collect custom styles for the extension renderers.
|
|
1437
|
+
* If custom nodes have special styles, override this method to provide the styles.
|
|
1438
|
+
*
|
|
1439
|
+
* @returns {string} - The custom styles as a string.
|
|
1440
|
+
*/
|
|
1441
|
+
collectExtensionRendererStyles() {
|
|
1442
|
+
let styles = '';
|
|
1443
|
+
if (this.hasCustomStylesRenderers.size > 0) {
|
|
1444
|
+
this.hasCustomStylesRenderers.forEach((renderer) => {
|
|
1445
|
+
styles += `${renderer.injectRTEScopeStyles()}\n`;
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
return styles;
|
|
1449
|
+
}
|
|
1326
1450
|
/**
|
|
1327
1451
|
* Register a node type with the extension.
|
|
1328
1452
|
*
|
|
@@ -1340,6 +1464,9 @@ class VegaRTEExtension {
|
|
|
1340
1464
|
*/
|
|
1341
1465
|
registerRenderer(type, renderer) {
|
|
1342
1466
|
RTEDTORendererManager.registerRTEDTORenderer(type, renderer);
|
|
1467
|
+
if (renderer instanceof VegaRTEExtensionRenderer && renderer.injectRTEScopeStyles()) {
|
|
1468
|
+
this.hasCustomStylesRenderers.add(renderer);
|
|
1469
|
+
}
|
|
1343
1470
|
}
|
|
1344
1471
|
/**
|
|
1345
1472
|
* Register a toolbar button renderer for the extension.
|
|
@@ -1362,6 +1489,25 @@ class VegaRTEExtension {
|
|
|
1362
1489
|
registerBlockBasicStrategies(blockClassName) {
|
|
1363
1490
|
RTEDTOActionStrategyManager.registerBlockBasicStrategies(blockClassName);
|
|
1364
1491
|
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Unregister a strategy for a specific action type and block class if not need.
|
|
1494
|
+
*
|
|
1495
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
1496
|
+
* @param {string} blockClassName - The class name of the block to unregister the strategy for.
|
|
1497
|
+
*/
|
|
1498
|
+
unRegisterStrategy(actionType, blockClassName) {
|
|
1499
|
+
ActionHandleStrategyRegistry.unregister(actionType, blockClassName);
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Unregister a strategy for a specific action type and block class if not need.
|
|
1503
|
+
*
|
|
1504
|
+
* @param {string} actionType - The special action type or the action class name.
|
|
1505
|
+
* @param {string} blockClassName - The class name of the block to unregister the strategy for.
|
|
1506
|
+
* @param {ActionHandlerInterceptor<ModifyContentAction, RTENode | RTEBlock | VegaRTEContent>} strategy - The interceptor to unregister.
|
|
1507
|
+
*/
|
|
1508
|
+
unRegisterInterceptor(actionType, blockClassName, strategy) {
|
|
1509
|
+
ActionHandlerInterceptorRegistry.unregister(actionType, blockClassName, strategy);
|
|
1510
|
+
}
|
|
1365
1511
|
/**
|
|
1366
1512
|
* Register an element to block DTO class strategy.
|
|
1367
1513
|
*
|
|
@@ -1388,86 +1534,6 @@ class VegaRTEExtension {
|
|
|
1388
1534
|
}
|
|
1389
1535
|
}
|
|
1390
1536
|
|
|
1391
|
-
/**
|
|
1392
|
-
* Base renderer for Vega Rich Text Editor.
|
|
1393
|
-
*/
|
|
1394
|
-
class VegaRTEExtensionRenderer extends VegaRTEBaseRenderer {
|
|
1395
|
-
/**
|
|
1396
|
-
* Renders the given data as a DOM element.
|
|
1397
|
-
*
|
|
1398
|
-
* @param {RTEBlock | RTENode} renderData - The data to render, which can be a block or a node.
|
|
1399
|
-
* @param {RTERenderContext} rteContext - The rte editor context.
|
|
1400
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1401
|
-
* @returns {VegaRTERenderResult} - The rendered DOM element.
|
|
1402
|
-
*/
|
|
1403
|
-
render(renderData, rteContext, createElement) {
|
|
1404
|
-
const element = this.doRender(createElement, renderData, rteContext);
|
|
1405
|
-
this.fallbackRegisterRef(element, renderData);
|
|
1406
|
-
this.appendChildren(element, renderData, rteContext, createElement);
|
|
1407
|
-
return element;
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Register the reference of the element in the rendering registry.
|
|
1411
|
-
*
|
|
1412
|
-
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1413
|
-
* @returns {VegaRTEUseRef} - The function to register the element.
|
|
1414
|
-
*/
|
|
1415
|
-
useRef(renderData) {
|
|
1416
|
-
renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] = true;
|
|
1417
|
-
return function (element) {
|
|
1418
|
-
if (element) {
|
|
1419
|
-
stateEntityRenderingRegistry.register(element, renderData);
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
}
|
|
1423
|
-
/**
|
|
1424
|
-
* Auto render the block children if the block element is not exist
|
|
1425
|
-
*
|
|
1426
|
-
* @param {VegaRTERenderResult} parentElement - The parent element to append children to.
|
|
1427
|
-
* @param {RTEBlock | RTENode} renderData - The data to render children for.
|
|
1428
|
-
* @param {RTERenderContext} rteContext - The render context.
|
|
1429
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1430
|
-
*/
|
|
1431
|
-
appendChildren(parentElement, renderData, rteContext, createElement) {
|
|
1432
|
-
if (Array.isArray(renderData['children']) &&
|
|
1433
|
-
renderData['children'].length &&
|
|
1434
|
-
!parentElement['$children$']) {
|
|
1435
|
-
parentElement['$children$'] = renderData['children']
|
|
1436
|
-
.map((child) => {
|
|
1437
|
-
return this.renderChildren(child, rteContext, createElement);
|
|
1438
|
-
})
|
|
1439
|
-
.filter(isNonNullable);
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
/**
|
|
1443
|
-
* Render the children node.
|
|
1444
|
-
*
|
|
1445
|
-
* @param {RTENode | RTEBlock} renderData - The node to render children for.
|
|
1446
|
-
* @param {RTERenderContext} rteContext - The render context.
|
|
1447
|
-
* @param {VegaRTECreateElementFunction} createElement - The function to create a DOM element.
|
|
1448
|
-
* @returns {Nullable<VegaRTERenderResult>} - The rendered DOM element.
|
|
1449
|
-
*/
|
|
1450
|
-
renderChildren(renderData, rteContext, createElement) {
|
|
1451
|
-
const renderer = RTEDTORendererManager.getRTERenderer(renderData.type);
|
|
1452
|
-
if (renderer) {
|
|
1453
|
-
return renderer.render(renderData, rteContext, createElement);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
/**
|
|
1457
|
-
* Fallback register reference for the element.
|
|
1458
|
-
*
|
|
1459
|
-
* @param {VegaRTERenderResult} element - The rendered DOM element.
|
|
1460
|
-
* @param {RTEBlock | RTENode} renderData - The data to register with the element.
|
|
1461
|
-
*/
|
|
1462
|
-
fallbackRegisterRef(element, renderData) {
|
|
1463
|
-
if (!renderData[VegaRTEExtensionRenderer.REGISTER_REF_FLAG] && element['$attrs$']) {
|
|
1464
|
-
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1465
|
-
element['$attrs$']['ref'] = this.useRef(renderData);
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
}
|
|
1469
|
-
VegaRTEExtensionRenderer.REGISTER_REF_FLAG = '__registeredRef__';
|
|
1470
|
-
|
|
1471
1537
|
/**
|
|
1472
1538
|
* Base class for rendering extension toolbar button in the rich text editor.
|
|
1473
1539
|
* The renderer provides common functionalities for rendering toolbar buttons, including:
|
|
@@ -1499,7 +1565,7 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1499
1565
|
* @returns {VegaRTERenderResult} - The render result for the dropdown.
|
|
1500
1566
|
*/
|
|
1501
1567
|
renderDropdown(h, editorContext, dropdownProps, children) {
|
|
1502
|
-
return h('vega-dropdown', Object.assign({ trigger: 'click', searchable: false,
|
|
1568
|
+
return h('vega-dropdown', Object.assign({ trigger: 'click', searchable: false, maxWidth: '200', itemDisplayRule: 'ellipsis',
|
|
1503
1569
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
1504
1570
|
ref: (el) => {
|
|
1505
1571
|
DomNodeSubjectObserverFactory.addUniqueObserverToNode(el, VegaDropdownClick, (input) => this.handleDropdownClick(input.detail, editorContext));
|
|
@@ -1509,7 +1575,7 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1509
1575
|
* Renders the dropdown list template.
|
|
1510
1576
|
*
|
|
1511
1577
|
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1512
|
-
* @param {RTEDropdownListItem[]} itemList - The list of dropdown items.
|
|
1578
|
+
* @param {(RTEDropdownListItem | RTEDropdownListGroup)[]} itemList - The list of dropdown items.
|
|
1513
1579
|
* @returns {VegaRTERenderResult} - The render result for the dropdown list.
|
|
1514
1580
|
*/
|
|
1515
1581
|
renderDropdownListTemplate(h, itemList) {
|
|
@@ -1517,7 +1583,9 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1517
1583
|
slot: 'items',
|
|
1518
1584
|
onMouseDown: this.preventDefault,
|
|
1519
1585
|
}, itemList.map((item) => {
|
|
1520
|
-
return
|
|
1586
|
+
return 'children' in item
|
|
1587
|
+
? this.renderDropdownGroup(h, item)
|
|
1588
|
+
: this.renderDropdownItem(h, item);
|
|
1521
1589
|
}));
|
|
1522
1590
|
}
|
|
1523
1591
|
/**
|
|
@@ -1535,6 +1603,24 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1535
1603
|
prefixIcon: item.icon,
|
|
1536
1604
|
});
|
|
1537
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Renders a dropdown item for the toolbar button.
|
|
1608
|
+
*
|
|
1609
|
+
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
1610
|
+
* @param {RTEDropdownListGroup} item - The dropdown group.
|
|
1611
|
+
* @returns {VegaRTERenderResult} - The render result for the dropdown item.
|
|
1612
|
+
*/
|
|
1613
|
+
renderDropdownGroup(h, item) {
|
|
1614
|
+
return h('vega-dropdown-group', {
|
|
1615
|
+
key: item.key,
|
|
1616
|
+
label: item.label,
|
|
1617
|
+
divide: false,
|
|
1618
|
+
}, item.children.map((child) => {
|
|
1619
|
+
return 'children' in child
|
|
1620
|
+
? this.renderDropdownGroup(h, child)
|
|
1621
|
+
: this.renderDropdownItem(h, child);
|
|
1622
|
+
}));
|
|
1623
|
+
}
|
|
1538
1624
|
/**
|
|
1539
1625
|
* Renders a common toolbar button with optional icon, label, and arrow icon.
|
|
1540
1626
|
*
|
|
@@ -1613,6 +1699,27 @@ class VegaRTEToolbarButtonRenderer {
|
|
|
1613
1699
|
preventDefault(e) {
|
|
1614
1700
|
e.preventDefault();
|
|
1615
1701
|
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Recursively searches for a dropdown list item by its key.
|
|
1704
|
+
*
|
|
1705
|
+
* @param {(RTEDropdownListItem | RTEDropdownListGroup)[]} itemList The list of dropdown items or groups to search through.
|
|
1706
|
+
* @param {string} key The key of the item to find.
|
|
1707
|
+
* @returns {Nullable<RTEDropdownListItem>} The dropdown list item if found, otherwise null.
|
|
1708
|
+
*/
|
|
1709
|
+
getListItemByKey(itemList, key) {
|
|
1710
|
+
for (const item of itemList) {
|
|
1711
|
+
if ('children' in item) {
|
|
1712
|
+
const foundItem = this.getListItemByKey(item.children, key);
|
|
1713
|
+
if (foundItem) {
|
|
1714
|
+
return foundItem;
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
else if (item.key === key) {
|
|
1718
|
+
return item;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
return null;
|
|
1722
|
+
}
|
|
1616
1723
|
}
|
|
1617
1724
|
|
|
1618
1725
|
/**
|
|
@@ -1693,7 +1800,7 @@ class RTETokenToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
|
1693
1800
|
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
1694
1801
|
*/
|
|
1695
1802
|
handleDropdownClick(itemKey, editorContext) {
|
|
1696
|
-
const token = this.
|
|
1803
|
+
const token = this.getListItemByKey(this.tokenList, itemKey);
|
|
1697
1804
|
const { rteRange } = editorContext;
|
|
1698
1805
|
const { startNode } = rteRange;
|
|
1699
1806
|
if (startNode && startNode.parent) {
|
|
@@ -1794,7 +1901,7 @@ class RTETokenNodeRenderer extends VegaRTEExtensionRenderer {
|
|
|
1794
1901
|
'template-token-key': token,
|
|
1795
1902
|
'token-key': token,
|
|
1796
1903
|
'contenteditable': 'false',
|
|
1797
|
-
'style':
|
|
1904
|
+
'style': node.getStyles(),
|
|
1798
1905
|
'class': `token ${node.getClasses()}`,
|
|
1799
1906
|
'ref': this.useRef(node),
|
|
1800
1907
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
@@ -1815,13 +1922,12 @@ class RTETokenNodeRenderer extends VegaRTEExtensionRenderer {
|
|
|
1815
1922
|
this.extensionContext = context;
|
|
1816
1923
|
}
|
|
1817
1924
|
/**
|
|
1818
|
-
*
|
|
1925
|
+
* Override to inject RTE scope styles for the token node.
|
|
1819
1926
|
*
|
|
1820
|
-
* @
|
|
1821
|
-
* @returns {Record<string, string>} The style object for the token element.
|
|
1927
|
+
* @returns {string} The CSS styles for the token node.
|
|
1822
1928
|
*/
|
|
1823
|
-
|
|
1824
|
-
return
|
|
1929
|
+
injectRTEScopeStyles() {
|
|
1930
|
+
return `span[token-key]{padding: 0 2px; margin: 0 1px; background-color: rgba(var(--v-bg-status-info, 205,209,211))}`;
|
|
1825
1931
|
}
|
|
1826
1932
|
/**
|
|
1827
1933
|
* Handle the click event on the token element.
|
|
@@ -1902,7 +2008,7 @@ class SpanToTokenNodeStrategy extends ElementToDTOStrategy {
|
|
|
1902
2008
|
const element = elementsArray[0];
|
|
1903
2009
|
const tokenKey = element.getAttribute('token-key');
|
|
1904
2010
|
const text = element.textContent;
|
|
1905
|
-
const annotations =
|
|
2011
|
+
const annotations = htmlElementToAnnotationGenerator.generate(RTETextNode, element);
|
|
1906
2012
|
// Exclude customAttribute and customClass from annotations
|
|
1907
2013
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1908
2014
|
const restAnnotations = __rest(annotations, ["customAttribute", "customClass"]);
|
|
@@ -1958,4 +2064,819 @@ class VegaRTETokenExtension extends VegaRTEExtension {
|
|
|
1958
2064
|
VegaRTEExtension.registerActionHandleStrategy(RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
1959
2065
|
})();
|
|
1960
2066
|
|
|
1961
|
-
|
|
2067
|
+
const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
2068
|
+
/**
|
|
2069
|
+
* Action to insert a function block into the rich text editor.
|
|
2070
|
+
*
|
|
2071
|
+
* @example focusedBlock.apply(new InsertFunctionBlockAction('IF'))
|
|
2072
|
+
* @example host.value.apply(new InsertFunctionBlockAction('IF'))
|
|
2073
|
+
*/
|
|
2074
|
+
class InsertFunctionBlockAction extends ModifyContentAction {
|
|
2075
|
+
constructor(functionType) {
|
|
2076
|
+
super();
|
|
2077
|
+
this.type = INSERT_FUNCTION_BLOCK;
|
|
2078
|
+
this.functionType = functionType;
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* RTE Function Block
|
|
2084
|
+
*/
|
|
2085
|
+
class RTEFunctionBlock extends RTEBlock {
|
|
2086
|
+
constructor(id) {
|
|
2087
|
+
super(id);
|
|
2088
|
+
this.type = 'function-block';
|
|
2089
|
+
this.children = [];
|
|
2090
|
+
}
|
|
2091
|
+
/**
|
|
2092
|
+
* Creates an RTEFunctionBlock from a VegaFunctionBlock.
|
|
2093
|
+
*
|
|
2094
|
+
* @param {VegaFunctionBlock} block - The custom block to convert.
|
|
2095
|
+
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
2096
|
+
* @returns {RTEFunctionBlock} The resulting RTEFunctionBlock.
|
|
2097
|
+
*/
|
|
2098
|
+
static from(block, options) {
|
|
2099
|
+
const functionBlock = new RTEFunctionBlock(block.id);
|
|
2100
|
+
const defaultAnnotation = { customClass: ['statement'] };
|
|
2101
|
+
let { annotations } = block;
|
|
2102
|
+
annotations = annotations
|
|
2103
|
+
? Object.assign(Object.assign({}, annotations), defaultAnnotation) : defaultAnnotation;
|
|
2104
|
+
super.convertAnnotationsToMap(functionBlock.annotationMap, annotations);
|
|
2105
|
+
functionBlock.children = this.generateBlockChildren(block.children, options, functionBlock);
|
|
2106
|
+
return functionBlock;
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Converts the RTEFunctionBlock and its children to an HTML string.
|
|
2110
|
+
*
|
|
2111
|
+
* @returns {string} The HTML string representation of the function block.
|
|
2112
|
+
*/
|
|
2113
|
+
toHtml() {
|
|
2114
|
+
const childrenHtml = this.children
|
|
2115
|
+
.map((child) => {
|
|
2116
|
+
if (child instanceof RTETextBlock) {
|
|
2117
|
+
const attrStr = this.getFunctionContentStyle(child);
|
|
2118
|
+
return `<div class="statementelement"${attrStr}>${child.getChildrenHtml()}</div>`;
|
|
2119
|
+
}
|
|
2120
|
+
else {
|
|
2121
|
+
return child.toHtml();
|
|
2122
|
+
}
|
|
2123
|
+
})
|
|
2124
|
+
.join('');
|
|
2125
|
+
return `<div class="statement">${childrenHtml}</div>`;
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* @inheritDoc
|
|
2129
|
+
*/
|
|
2130
|
+
clone(parent) {
|
|
2131
|
+
const clonedBlock = new RTEFunctionBlock(generateUUID());
|
|
2132
|
+
clonedBlock.parent = parent;
|
|
2133
|
+
clonedBlock.children = this.children.map((child) => {
|
|
2134
|
+
const clonedChild = child.clone(clonedBlock);
|
|
2135
|
+
return clonedChild;
|
|
2136
|
+
});
|
|
2137
|
+
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
2138
|
+
return clonedBlock;
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* @inheritDoc
|
|
2142
|
+
*/
|
|
2143
|
+
getLastNode() {
|
|
2144
|
+
return this.children[this.children.length - 1].getLastNode();
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* @inheritDoc
|
|
2148
|
+
*/
|
|
2149
|
+
isNotEmpty() {
|
|
2150
|
+
return this.children.length > 0;
|
|
2151
|
+
}
|
|
2152
|
+
/**
|
|
2153
|
+
* @inheritDoc
|
|
2154
|
+
*/
|
|
2155
|
+
toJSON() {
|
|
2156
|
+
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, children: this.children.map((child) => child.toJSON()) });
|
|
2157
|
+
}
|
|
2158
|
+
/**
|
|
2159
|
+
* Get the style string for function content block, excluding default paragraph styles.
|
|
2160
|
+
*
|
|
2161
|
+
* @param {RTETextBlock} block - The text block to extract styles from
|
|
2162
|
+
* @returns {string} - The style attribute string
|
|
2163
|
+
*/
|
|
2164
|
+
getFunctionContentStyle(block) {
|
|
2165
|
+
const blockAnnotationStyle = new RTEAnnotationStyle(block);
|
|
2166
|
+
let styles = blockAnnotationStyle.toCssText({ standalone: true });
|
|
2167
|
+
const textStyleAnnotation = block.getAnnotationByType('TEXT_STYLE');
|
|
2168
|
+
if (textStyleAnnotation && textStyleAnnotation.textStyle === 'paragraph') {
|
|
2169
|
+
const defaultParagraphStyles = blockAnnotationStyle.toCssText(undefined, undefined, textStyleAnnotation.renderStyle({ standalone: true }));
|
|
2170
|
+
styles = styles.replace(defaultParagraphStyles, '').trim();
|
|
2171
|
+
}
|
|
2172
|
+
return styles ? ` style="${styles}"` : '';
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* Strategy to handle the insertion of a function block into the rich text editor.
|
|
2178
|
+
*/
|
|
2179
|
+
class InsertFunctionBlockStrategy extends ActionHandleStrategy {
|
|
2180
|
+
/**
|
|
2181
|
+
* @inheritDoc
|
|
2182
|
+
*/
|
|
2183
|
+
handleAction(action, target) {
|
|
2184
|
+
const { functionType } = action;
|
|
2185
|
+
const functionBlock = this.getFunctionBlock(functionType);
|
|
2186
|
+
const emptyParagraph = this.createNewParagraph('');
|
|
2187
|
+
const referenceBlock = this.getReferenceBlock(target);
|
|
2188
|
+
if (referenceBlock) {
|
|
2189
|
+
referenceBlock.parent.apply(new InsertChildrenAfterAction(referenceBlock, functionBlock, emptyParagraph));
|
|
2190
|
+
}
|
|
2191
|
+
else {
|
|
2192
|
+
target.apply(new AppendChildrenAction([functionBlock, emptyParagraph]));
|
|
2193
|
+
}
|
|
2194
|
+
if (emptyParagraph) {
|
|
2195
|
+
action.nextFocusNode = emptyParagraph.children[0];
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
/**
|
|
2199
|
+
* Get a function block based on the specified type.
|
|
2200
|
+
*
|
|
2201
|
+
* @param {string} type - The type of function block to create.
|
|
2202
|
+
* @returns {RTEFunctionBlock} The function block instance.
|
|
2203
|
+
*/
|
|
2204
|
+
getFunctionBlock(type) {
|
|
2205
|
+
const id = generateUUID();
|
|
2206
|
+
return RTEFunctionBlock.from({
|
|
2207
|
+
id: id,
|
|
2208
|
+
type: 'function-block',
|
|
2209
|
+
children: [
|
|
2210
|
+
{
|
|
2211
|
+
id: `${id}-1`,
|
|
2212
|
+
type: 'logic-control-block',
|
|
2213
|
+
statementText: type.toUpperCase(),
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
id: `${id}-2`,
|
|
2217
|
+
annotations: {
|
|
2218
|
+
customClass: ['statementelement'],
|
|
2219
|
+
},
|
|
2220
|
+
type: 'paragraph',
|
|
2221
|
+
nodes: [
|
|
2222
|
+
{
|
|
2223
|
+
id: `${id}-2-1`,
|
|
2224
|
+
type: 'text',
|
|
2225
|
+
text: ' ',
|
|
2226
|
+
},
|
|
2227
|
+
],
|
|
2228
|
+
},
|
|
2229
|
+
{
|
|
2230
|
+
id: `${id}-3`,
|
|
2231
|
+
type: 'logic-control-block',
|
|
2232
|
+
statementText: 'SHOW',
|
|
2233
|
+
},
|
|
2234
|
+
{
|
|
2235
|
+
id: `${id}-4`,
|
|
2236
|
+
annotations: {
|
|
2237
|
+
customClass: ['statementelement'],
|
|
2238
|
+
},
|
|
2239
|
+
type: 'paragraph',
|
|
2240
|
+
nodes: [
|
|
2241
|
+
{
|
|
2242
|
+
id: `${id}-4-1`,
|
|
2243
|
+
type: 'text',
|
|
2244
|
+
text: ' ',
|
|
2245
|
+
},
|
|
2246
|
+
],
|
|
2247
|
+
},
|
|
2248
|
+
],
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* We need to get the correct block if the current target is a function block element to avoid nesting function blocks.
|
|
2253
|
+
*
|
|
2254
|
+
* @param {RTEBlock | VegaRTEContent} currentTarget - The current target block or content.
|
|
2255
|
+
* @returns {Nullable<RTEBlock>} The reference block.
|
|
2256
|
+
*/
|
|
2257
|
+
getReferenceBlock(currentTarget) {
|
|
2258
|
+
if (!(currentTarget instanceof VegaRTEContent)) {
|
|
2259
|
+
const parentBlock = currentTarget.parent;
|
|
2260
|
+
if (parentBlock instanceof RTEFunctionBlock) {
|
|
2261
|
+
return parentBlock;
|
|
2262
|
+
}
|
|
2263
|
+
else {
|
|
2264
|
+
return currentTarget;
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Class representing a logic control node in the rich text editor.
|
|
2272
|
+
*/
|
|
2273
|
+
class RTELogicControlNode extends RTENode {
|
|
2274
|
+
constructor(id, text, parent) {
|
|
2275
|
+
super(id);
|
|
2276
|
+
this.type = 'logic-control-node';
|
|
2277
|
+
this.text = '';
|
|
2278
|
+
this.text = text;
|
|
2279
|
+
this.parent = parent;
|
|
2280
|
+
}
|
|
2281
|
+
/**
|
|
2282
|
+
* Clone the current node instance.
|
|
2283
|
+
*
|
|
2284
|
+
* @returns {RTELogicControlNode} - A new instance of RTELogicControlNode.
|
|
2285
|
+
*/
|
|
2286
|
+
clone() {
|
|
2287
|
+
return new RTELogicControlNode(this.id, this.text, this.parent);
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Convert the node to its HTML representation.
|
|
2291
|
+
*
|
|
2292
|
+
* @returns {string} - The HTML string of the logic control node.
|
|
2293
|
+
*/
|
|
2294
|
+
toHtml() {
|
|
2295
|
+
return this.text;
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Convert the node to a JSON representation.
|
|
2299
|
+
*
|
|
2300
|
+
* @returns {unknown} - The JSON object of the statement syntax node.
|
|
2301
|
+
*/
|
|
2302
|
+
toJSON() {
|
|
2303
|
+
return {
|
|
2304
|
+
id: this.id,
|
|
2305
|
+
type: this.type,
|
|
2306
|
+
text: this.text,
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Get the end offset of the node's range.
|
|
2311
|
+
*
|
|
2312
|
+
* @returns {number} - The end offset of the node's range.
|
|
2313
|
+
*/
|
|
2314
|
+
getRangeEndOffset() {
|
|
2315
|
+
return 1;
|
|
2316
|
+
}
|
|
2317
|
+
/**
|
|
2318
|
+
* Get the container element for the node's range.
|
|
2319
|
+
*
|
|
2320
|
+
* @returns {Nullable<Node>} - The container node for the range.
|
|
2321
|
+
*/
|
|
2322
|
+
getRangeContainer() {
|
|
2323
|
+
const element = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
2324
|
+
if (element) {
|
|
2325
|
+
return element.parentElement;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Get the content editable state of the node.
|
|
2330
|
+
*
|
|
2331
|
+
* @returns {boolean} - The content editable state of the node.
|
|
2332
|
+
*/
|
|
2333
|
+
isContentEditable() {
|
|
2334
|
+
return false;
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* Class representing a logic control block in the rich text editor.
|
|
2340
|
+
*/
|
|
2341
|
+
class RTELogicControlBlock extends RTEBlock {
|
|
2342
|
+
constructor(id, statementText, parent) {
|
|
2343
|
+
super(id);
|
|
2344
|
+
this.type = 'logic-control-block';
|
|
2345
|
+
this.children = [];
|
|
2346
|
+
this.statementText = '';
|
|
2347
|
+
this.statementText = statementText;
|
|
2348
|
+
this.children = [new RTELogicControlNode(`${id}-node-1`, statementText, this)];
|
|
2349
|
+
if (parent) {
|
|
2350
|
+
this.parent = parent;
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Create a logic control block from a JSON representation.
|
|
2355
|
+
*
|
|
2356
|
+
* @param {VegaRTELogicControlBlock} json - The JSON object representing the logic control block.
|
|
2357
|
+
* @returns {RTELogicControlBlock} - The created logic control block.
|
|
2358
|
+
*/
|
|
2359
|
+
static from(json) {
|
|
2360
|
+
const block = new RTELogicControlBlock(json.id, json.statementText);
|
|
2361
|
+
return block;
|
|
2362
|
+
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Check the block is not empty.
|
|
2365
|
+
*
|
|
2366
|
+
* @returns {boolean} - Always true for logic control block.
|
|
2367
|
+
*/
|
|
2368
|
+
isNotEmpty() {
|
|
2369
|
+
return true;
|
|
2370
|
+
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Get the last node of the block.
|
|
2373
|
+
*
|
|
2374
|
+
* @returns {RTELogicControlNode} - The last node in the block.
|
|
2375
|
+
*/
|
|
2376
|
+
getLastNode() {
|
|
2377
|
+
return this.children[this.children.length - 1];
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* Convert the block to its HTML representation.
|
|
2381
|
+
*
|
|
2382
|
+
* @returns {string} - The HTML string of the logic control block.
|
|
2383
|
+
*/
|
|
2384
|
+
toHtml() {
|
|
2385
|
+
return `<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Clone the current block instance.
|
|
2389
|
+
*
|
|
2390
|
+
* @param { RTEFunctionBlock } parent - The parent function block for the cloned instance.
|
|
2391
|
+
* @returns {RTELogicControlBlock} - A new instance of RTEStatementSyntaxBlock.
|
|
2392
|
+
*/
|
|
2393
|
+
clone(parent) {
|
|
2394
|
+
return new RTELogicControlBlock(this.id, this.statementText, parent);
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* Get the JSON representation of the block.
|
|
2398
|
+
*
|
|
2399
|
+
* @returns {VegaRTELogicControlBlock} - The JSON object of the logic control block.
|
|
2400
|
+
*/
|
|
2401
|
+
toJSON() {
|
|
2402
|
+
return {
|
|
2403
|
+
id: this.id,
|
|
2404
|
+
type: this.type,
|
|
2405
|
+
statementText: this.statementText,
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* Function toolbar button renderer class.
|
|
2412
|
+
*/
|
|
2413
|
+
class FunctionToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
2414
|
+
/**
|
|
2415
|
+
* Injects the extension context
|
|
2416
|
+
*
|
|
2417
|
+
* @param {RTEExtensionContext} context - extension context
|
|
2418
|
+
*/
|
|
2419
|
+
injectExtensionContext(context) {
|
|
2420
|
+
this.extensionContext = context;
|
|
2421
|
+
}
|
|
2422
|
+
/**
|
|
2423
|
+
* @inheritDoc
|
|
2424
|
+
*/
|
|
2425
|
+
render(h, editorContext) {
|
|
2426
|
+
return this.renderDropdown(h, editorContext, {}, [
|
|
2427
|
+
this.renderButton(h, editorContext, {
|
|
2428
|
+
label: 'Functions',
|
|
2429
|
+
showArrowIcon: true,
|
|
2430
|
+
}),
|
|
2431
|
+
this.renderDropdownListTemplate(h, FunctionToolbarButtonRenderer.FUNCTION_LIST),
|
|
2432
|
+
]);
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Overrides the isDisabled method to determine if the button should be disabled.
|
|
2436
|
+
*
|
|
2437
|
+
* @returns {boolean} - true if the button should be disabled, false otherwise.
|
|
2438
|
+
*/
|
|
2439
|
+
isDisabled() {
|
|
2440
|
+
const { host, getSelectedNodes } = this.extensionContext;
|
|
2441
|
+
const focusNode = getSelectedNodes()[0];
|
|
2442
|
+
let enableInsert = true;
|
|
2443
|
+
if (focusNode) {
|
|
2444
|
+
enableInsert = ActionHandleStrategyRegistry.canHandle(INSERT_FUNCTION_BLOCK, focusNode.parent);
|
|
2445
|
+
}
|
|
2446
|
+
return host.disabled || !enableInsert;
|
|
2447
|
+
}
|
|
2448
|
+
/* istanbul ignore next */
|
|
2449
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
2450
|
+
handleButtonClick() {
|
|
2451
|
+
throw new Error('Method not implemented.');
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* Handles dropdown click event
|
|
2455
|
+
*
|
|
2456
|
+
* @param {RTEExtensionFunctionType} itemKey - key of the clicked item
|
|
2457
|
+
*/
|
|
2458
|
+
handleDropdownClick(itemKey) {
|
|
2459
|
+
const { host, getSelectedNodes } = this.extensionContext;
|
|
2460
|
+
const focusNode = getSelectedNodes()[0];
|
|
2461
|
+
const action = new InsertFunctionBlockAction(itemKey);
|
|
2462
|
+
if (!focusNode) {
|
|
2463
|
+
host.value.apply(action);
|
|
2464
|
+
}
|
|
2465
|
+
else if (focusNode.parent) {
|
|
2466
|
+
focusNode.parent.apply(action);
|
|
2467
|
+
}
|
|
2468
|
+
if (action.nextFocusNode) {
|
|
2469
|
+
host.value.apply(new UpdateCursorPositionAction(action.nextFocusNode, 1));
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
FunctionToolbarButtonRenderer.FUNCTION_LIST = [
|
|
2474
|
+
{ key: 'IF', label: 'Conditional' },
|
|
2475
|
+
{ key: 'FOREACH', label: 'Foreach' },
|
|
2476
|
+
];
|
|
2477
|
+
|
|
2478
|
+
/**
|
|
2479
|
+
* Renders a logic control block in the rich text editor.
|
|
2480
|
+
*/
|
|
2481
|
+
class RTELogicControlBlockRenderer extends VegaRTEExtensionRenderer {
|
|
2482
|
+
/**
|
|
2483
|
+
* @inheritDoc
|
|
2484
|
+
*/
|
|
2485
|
+
doRender(h, renderData) {
|
|
2486
|
+
return h('div', {
|
|
2487
|
+
key: renderData.id,
|
|
2488
|
+
class: 'statementsyntax',
|
|
2489
|
+
ref: this.useRef(renderData),
|
|
2490
|
+
}, h('span', {
|
|
2491
|
+
key: `${renderData.id}-1`,
|
|
2492
|
+
contenteditable: 'false',
|
|
2493
|
+
ref: this.useRef(renderData.children[0]),
|
|
2494
|
+
}, renderData.statementText));
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
/**
|
|
2499
|
+
* Strategy to convert a div with class 'statementsyntax' into an RTELogicControlBlock DTO.
|
|
2500
|
+
*/
|
|
2501
|
+
class DivToLogicControlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
2502
|
+
constructor() {
|
|
2503
|
+
super(...arguments);
|
|
2504
|
+
this.blockClassName = 'statementsyntax';
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* @inheritDoc
|
|
2508
|
+
*/
|
|
2509
|
+
canHandle(elementsArray, currentIndex) {
|
|
2510
|
+
const element = elementsArray[currentIndex];
|
|
2511
|
+
return element &&
|
|
2512
|
+
element.nodeType === Node.ELEMENT_NODE &&
|
|
2513
|
+
element.classList.contains(this.blockClassName) &&
|
|
2514
|
+
this.isFunctionBlockChild(element)
|
|
2515
|
+
? 1
|
|
2516
|
+
: 0;
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* @inheritDoc
|
|
2520
|
+
*/
|
|
2521
|
+
handle(elementsArray) {
|
|
2522
|
+
const element = elementsArray[0];
|
|
2523
|
+
return RTELogicControlBlock.from({
|
|
2524
|
+
id: generateUUID(),
|
|
2525
|
+
type: 'logic-control-block',
|
|
2526
|
+
statementText: element.innerText,
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* The logic control block does not have child blocks to append. so this method is intentionally left empty.
|
|
2531
|
+
*/
|
|
2532
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2533
|
+
appendChildBlocks() { }
|
|
2534
|
+
/**
|
|
2535
|
+
* @inheritDoc
|
|
2536
|
+
*/
|
|
2537
|
+
shouldProceedToElementChildren() {
|
|
2538
|
+
return false;
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Checks if the given element is a child of a function block
|
|
2542
|
+
*
|
|
2543
|
+
* @param {HTMLElement} element - The HTML element to check
|
|
2544
|
+
* @returns {boolean} True if the element is a child of a function block, false otherwise
|
|
2545
|
+
*/
|
|
2546
|
+
isFunctionBlockChild(element) {
|
|
2547
|
+
return !!(element.parentElement && element.parentElement.classList.contains('statement'));
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Strategy to convert a div with class 'statement' into an function block.
|
|
2553
|
+
*/
|
|
2554
|
+
class DivToFunctionBlockStrategy extends ElementToDTOStrategy {
|
|
2555
|
+
/**
|
|
2556
|
+
* @inheritDoc
|
|
2557
|
+
*/
|
|
2558
|
+
canHandle(elementsArray, currentIndex) {
|
|
2559
|
+
const element = elementsArray[currentIndex];
|
|
2560
|
+
return element &&
|
|
2561
|
+
element.tagName === 'DIV' &&
|
|
2562
|
+
element.classList.contains('statement') &&
|
|
2563
|
+
element.childNodes.length &&
|
|
2564
|
+
element.querySelector('.statementsyntax')
|
|
2565
|
+
? 1
|
|
2566
|
+
: 0;
|
|
2567
|
+
}
|
|
2568
|
+
/**
|
|
2569
|
+
* @inheritDoc
|
|
2570
|
+
*/
|
|
2571
|
+
handle() {
|
|
2572
|
+
return RTEFunctionBlock.from({
|
|
2573
|
+
id: generateUUID(),
|
|
2574
|
+
type: 'function-block',
|
|
2575
|
+
annotations: {
|
|
2576
|
+
customClass: ['statement'],
|
|
2577
|
+
},
|
|
2578
|
+
children: [],
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* @inheritDoc
|
|
2583
|
+
*/
|
|
2584
|
+
appendChildBlocks(currentBlock, childBlocks) {
|
|
2585
|
+
currentBlock.children = childBlocks.map((block) => {
|
|
2586
|
+
block.parent = currentBlock;
|
|
2587
|
+
return block;
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* @inheritDoc
|
|
2592
|
+
*/
|
|
2593
|
+
shouldProceedToElementChildren() {
|
|
2594
|
+
return true;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/**
|
|
2599
|
+
* Strategy to convert a div with class 'statementelement' into an function block.
|
|
2600
|
+
*/
|
|
2601
|
+
class DivToFunctionContentStrategy extends DivToLogicControlBlockStrategy {
|
|
2602
|
+
constructor() {
|
|
2603
|
+
super(...arguments);
|
|
2604
|
+
this.blockClassName = 'statementelement';
|
|
2605
|
+
}
|
|
2606
|
+
/**
|
|
2607
|
+
* @inheritDoc
|
|
2608
|
+
*/
|
|
2609
|
+
handle(elementsArray, options) {
|
|
2610
|
+
const element = elementsArray[0];
|
|
2611
|
+
const annotations = htmlElementToAnnotationGenerator.generate(RTETextBlock, element);
|
|
2612
|
+
const nodes = Array.from(elementsArray[0].childNodes);
|
|
2613
|
+
return RTETextBlock.from({
|
|
2614
|
+
id: generateUUID(),
|
|
2615
|
+
type: 'paragraph',
|
|
2616
|
+
annotations: Object.assign({ customClass: [this.blockClassName] }, annotations),
|
|
2617
|
+
nodes: this.generateChildNodes(nodes, undefined, options),
|
|
2618
|
+
});
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
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}";
|
|
2623
|
+
|
|
2624
|
+
/**
|
|
2625
|
+
* Renderer for Function Block
|
|
2626
|
+
*/
|
|
2627
|
+
class RTEFunctionBlockRenderer extends VegaRTEExtensionRenderer {
|
|
2628
|
+
/**
|
|
2629
|
+
* @inheritDoc
|
|
2630
|
+
*/
|
|
2631
|
+
doRender(createElement, renderData) {
|
|
2632
|
+
return createElement('div', {
|
|
2633
|
+
key: renderData.id,
|
|
2634
|
+
class: this.getElementClassName(renderData),
|
|
2635
|
+
ref: this.useRef(renderData),
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
/**
|
|
2639
|
+
* Defines the function block styles to be injected into the RTE scope.
|
|
2640
|
+
*
|
|
2641
|
+
* @returns {string} - The styles as a string.
|
|
2642
|
+
*/
|
|
2643
|
+
injectRTEScopeStyles() {
|
|
2644
|
+
return functionBlockStylesCss;
|
|
2645
|
+
}
|
|
2646
|
+
/**
|
|
2647
|
+
* Gets the class name for the function block element.
|
|
2648
|
+
*
|
|
2649
|
+
* @param {RTEFunctionBlock} block - The function block.
|
|
2650
|
+
* @returns {string} The class name for the function block element.
|
|
2651
|
+
*/
|
|
2652
|
+
getElementClassName(block) {
|
|
2653
|
+
let classes = block.getClasses();
|
|
2654
|
+
if (classes.indexOf('statement') < 0) {
|
|
2655
|
+
classes = 'statement ' + classes;
|
|
2656
|
+
}
|
|
2657
|
+
return classes.trim();
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
/**
|
|
2662
|
+
* Abstract class for action handler interceptors, which can intercept actions before they are handled.
|
|
2663
|
+
*/
|
|
2664
|
+
class ActionHandlerInterceptor {
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
/**
|
|
2668
|
+
* Prevent special type input in function block.
|
|
2669
|
+
*/
|
|
2670
|
+
class PreventNewParagraphInterceptor extends ActionHandlerInterceptor {
|
|
2671
|
+
/**
|
|
2672
|
+
* Checks the target block parent whether is function block.
|
|
2673
|
+
*
|
|
2674
|
+
* @param {InsertNewParagraphAction} _action - the action to be intercepted
|
|
2675
|
+
* @param {RTETextBlock} target - the target block
|
|
2676
|
+
* @returns {boolean} - true if the target block parent is function block, false otherwise
|
|
2677
|
+
*/
|
|
2678
|
+
canIntercept(_action, target) {
|
|
2679
|
+
return target.parent && target.parent instanceof RTEFunctionBlock;
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* Insert a new paragraph behind of the function block instead of the target block.
|
|
2683
|
+
*
|
|
2684
|
+
* @param {ActionHandlerExecution} _execution - the original execution function
|
|
2685
|
+
* @param {ModifyContentAction} _action - the action to be intercepted
|
|
2686
|
+
* @param {RTETextBlock} target - the target block
|
|
2687
|
+
*/
|
|
2688
|
+
intercept(_execution, _action, target) {
|
|
2689
|
+
const insertParagraphAction = new InsertNewParagraphAction(target.children[0], 0);
|
|
2690
|
+
insertParagraphAction.isFlushable = true;
|
|
2691
|
+
target.parent.apply(insertParagraphAction);
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2695
|
+
/**
|
|
2696
|
+
* Insert a new paragraph behind of current function block strategy.
|
|
2697
|
+
*/
|
|
2698
|
+
class FunctionBlockInsertParagraphStrategy extends ActionHandleStrategy {
|
|
2699
|
+
/**
|
|
2700
|
+
* @inheritDoc
|
|
2701
|
+
*/
|
|
2702
|
+
handleAction(action, target) {
|
|
2703
|
+
const newParagraph = this.createNewParagraph('');
|
|
2704
|
+
if (newParagraph) {
|
|
2705
|
+
target.parent.apply(new InsertChildrenAfterAction(target, newParagraph));
|
|
2706
|
+
action.newBlock = newParagraph;
|
|
2707
|
+
this.focusToNextLine(newParagraph);
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
/**
|
|
2711
|
+
* Focus to next paragraph.
|
|
2712
|
+
*
|
|
2713
|
+
* @param {RTETextBlock} block - The paragraph need to focus.
|
|
2714
|
+
*/
|
|
2715
|
+
focusToNextLine(block) {
|
|
2716
|
+
const root = this.getRootContent(block);
|
|
2717
|
+
if (root) {
|
|
2718
|
+
root.apply(new UpdateCursorPositionAction(block.children[0], 1));
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
const PASTE_PLAIN_TEXT = 'PASTE_PLAIN_TEXT';
|
|
2724
|
+
/**
|
|
2725
|
+
* Action to paste plain text content into function block.
|
|
2726
|
+
*
|
|
2727
|
+
* @example functionBlock.apply(new PastePlainTextAction('content', range))
|
|
2728
|
+
* @example host.value.apply(new PastePlainTextAction('content', range))
|
|
2729
|
+
*/
|
|
2730
|
+
class PastePlainTextAction extends ModifyContentAction {
|
|
2731
|
+
constructor(blocksToBeInserted, startNode, startOffset) {
|
|
2732
|
+
super();
|
|
2733
|
+
this.type = PASTE_PLAIN_TEXT;
|
|
2734
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
2735
|
+
this.startNode = startNode;
|
|
2736
|
+
this.startOffset = startOffset;
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
/**
|
|
2741
|
+
* Prevent special type input in function block.
|
|
2742
|
+
*/
|
|
2743
|
+
class PreventPasteContentInterceptor extends PreventNewParagraphInterceptor {
|
|
2744
|
+
/**
|
|
2745
|
+
* Paste plain text into text block.
|
|
2746
|
+
*
|
|
2747
|
+
* @param {ActionHandlerExecution} _execution - the original execution function
|
|
2748
|
+
* @param {ModifyContentAction} action - the action to be intercepted
|
|
2749
|
+
* @param {RTETextBlock} target - the target block
|
|
2750
|
+
*/
|
|
2751
|
+
intercept(_execution, action, target) {
|
|
2752
|
+
const { blocksToBeInserted, rteRange } = action;
|
|
2753
|
+
let { startNode, startOffset } = action;
|
|
2754
|
+
// Set the start offset from rteRange if available, this is to handle the paste issue https://gethired.atlassian.net/browse/VD-7779
|
|
2755
|
+
if (rteRange) {
|
|
2756
|
+
startNode = rteRange.startNode;
|
|
2757
|
+
startOffset = rteRange.startOffset;
|
|
2758
|
+
}
|
|
2759
|
+
const pastePlainTextAction = new PastePlainTextAction(blocksToBeInserted, startNode, startOffset);
|
|
2760
|
+
target.apply(pastePlainTextAction);
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* Strategy to handle the paste content into function block.
|
|
2766
|
+
*/
|
|
2767
|
+
class PastePlainTextStrategy extends ActionHandleStrategy {
|
|
2768
|
+
/**
|
|
2769
|
+
* @inheritDoc
|
|
2770
|
+
*/
|
|
2771
|
+
handleAction(action, target) {
|
|
2772
|
+
const { blocksToBeInserted, startNode, startOffset } = action;
|
|
2773
|
+
if (startNode instanceof RTETextNode) {
|
|
2774
|
+
const textNodes = blocksToBeInserted.flatMap((block) => {
|
|
2775
|
+
if (block instanceof RTETextBlock) {
|
|
2776
|
+
this.copyLinkGroupAnnotations(target.annotationMap, block.annotationMap);
|
|
2777
|
+
return block.children;
|
|
2778
|
+
}
|
|
2779
|
+
return [];
|
|
2780
|
+
});
|
|
2781
|
+
if (textNodes.length > 0) {
|
|
2782
|
+
if (startOffset > 0) {
|
|
2783
|
+
target.apply(new InsertChildrenAfterAction(startNode, ...textNodes));
|
|
2784
|
+
}
|
|
2785
|
+
else {
|
|
2786
|
+
target.apply(new InsertChildrenBeforeAction(startNode, ...textNodes));
|
|
2787
|
+
}
|
|
2788
|
+
this.focusToNextLine(textNodes[textNodes.length - 1], textNodes[textNodes.length - 1].getRangeEndOffset());
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
/**
|
|
2793
|
+
* Focus to next paragraph.
|
|
2794
|
+
*
|
|
2795
|
+
* @param {RTETextNode} node - The text node need to focus.
|
|
2796
|
+
* @param {number} startOffset - The offset need to focus.
|
|
2797
|
+
*/
|
|
2798
|
+
focusToNextLine(node, startOffset) {
|
|
2799
|
+
const root = this.getRootContent(node);
|
|
2800
|
+
if (root) {
|
|
2801
|
+
root.apply(new UpdateCursorPositionAction(node, startOffset));
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
/**
|
|
2805
|
+
* Copy link group annotations from copied block to target block.
|
|
2806
|
+
*
|
|
2807
|
+
* @param {BlockAnnotations} blockAnnotationMap - The target block annotation map.
|
|
2808
|
+
* @param {BlockAnnotations} copiedAnnotationMap - The copied block annotation map.
|
|
2809
|
+
*/
|
|
2810
|
+
copyLinkGroupAnnotations(blockAnnotationMap, copiedAnnotationMap) {
|
|
2811
|
+
if (copiedAnnotationMap && copiedAnnotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
2812
|
+
const copiedLinkGroupAnnotation = copiedAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2813
|
+
if (!blockAnnotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
2814
|
+
blockAnnotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, copiedAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP));
|
|
2815
|
+
}
|
|
2816
|
+
else {
|
|
2817
|
+
copiedLinkGroupAnnotation.linkGroups.forEach((nodes, groupKey) => {
|
|
2818
|
+
const existingAnnotation = blockAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2819
|
+
existingAnnotation.linkGroups.set(groupKey, nodes);
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
const convertLogicControlBlockStrategy = new DivToLogicControlBlockStrategy();
|
|
2827
|
+
const convertFunctionContentStrategy = new DivToFunctionContentStrategy();
|
|
2828
|
+
const convertFunctionBlockStrategy = new DivToFunctionBlockStrategy();
|
|
2829
|
+
/**
|
|
2830
|
+
* Function extension class for Vega Rich Text Editor.
|
|
2831
|
+
*/
|
|
2832
|
+
class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
2833
|
+
constructor() {
|
|
2834
|
+
super();
|
|
2835
|
+
this.toolbarButtonRenderer = new FunctionToolbarButtonRenderer();
|
|
2836
|
+
this.registerBlockBasicStrategies(RTELogicControlBlock.name);
|
|
2837
|
+
this.registerBlockBasicStrategies(RTEFunctionBlock.name);
|
|
2838
|
+
this.preventFunctionBlockDefaultInsertNewParagraph();
|
|
2839
|
+
this.registerNode('logic-control-block', RTELogicControlBlock);
|
|
2840
|
+
this.registerRenderer('logic-control-block', new RTELogicControlBlockRenderer());
|
|
2841
|
+
this.registerNode('function-block', RTEFunctionBlock);
|
|
2842
|
+
this.registerRenderer('function-block', new RTEFunctionBlockRenderer());
|
|
2843
|
+
this.registerToolbarButtonRenderer('functions', this.toolbarButtonRenderer);
|
|
2844
|
+
this.registerElementToBlockDTOClassStrategy(convertLogicControlBlockStrategy);
|
|
2845
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionContentStrategy);
|
|
2846
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionBlockStrategy);
|
|
2847
|
+
}
|
|
2848
|
+
/**
|
|
2849
|
+
* Initializes the extension with the given context
|
|
2850
|
+
*
|
|
2851
|
+
* @param {RTEExtensionContext} context - extension context
|
|
2852
|
+
*/
|
|
2853
|
+
initialExtension(context) {
|
|
2854
|
+
super.initialExtension(context);
|
|
2855
|
+
if (this.toolbarButtonRenderer) {
|
|
2856
|
+
this.toolbarButtonRenderer.injectExtensionContext(context);
|
|
2857
|
+
}
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
2861
|
+
*/
|
|
2862
|
+
preventFunctionBlockDefaultInsertNewParagraph() {
|
|
2863
|
+
this.unRegisterStrategy(ModifyContentActionType.INSERT_NEW_PARAGRAPH, RTELogicControlBlock.name);
|
|
2864
|
+
this.unRegisterStrategy(ModifyContentActionType.APPEND_CHILDREN, RTEFunctionBlock.name);
|
|
2865
|
+
this.unRegisterStrategy(ModifyContentActionType.INSERT_CHILDREN_AFTER, RTEFunctionBlock.name);
|
|
2866
|
+
this.unRegisterStrategy(ModifyContentActionType.INSERT_CHILDREN_BEFORE, RTEFunctionBlock.name);
|
|
2867
|
+
this.unRegisterStrategy(ModifyContentActionType.PASTE_CONTENT, RTELogicControlBlock.name);
|
|
2868
|
+
VegaRTEExtension.registerActionHandleStrategy(RTEFunctionBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new FunctionBlockInsertParagraphStrategy());
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
(() => {
|
|
2872
|
+
const insertFunctionBlockStrategy = new InsertFunctionBlockStrategy();
|
|
2873
|
+
VegaRTEExtension.registerActionHandleStrategy(VegaRTEContent.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2874
|
+
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2875
|
+
VegaRTEExtension.registerActionHandleStrategy(RTEImageBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2876
|
+
VegaRTEExtension.registerActionHandleStrategy(RTELogicControlBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
2877
|
+
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, PASTE_PLAIN_TEXT, new PastePlainTextStrategy());
|
|
2878
|
+
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
2879
|
+
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
2880
|
+
})();
|
|
2881
|
+
|
|
2882
|
+
export { ActionHandlerInterceptor as A, InsertNodeToNearestRootAction as I, RTETokenToolbarButtonRenderer as R, VegaLoader as V, VegaNotify as a, VegaThemeManager as b, VegaDialog as c, VegaEventManager$1 as d, VegaZIndexManager$1 as e, VegaSkeletonLoader as f, VegaRTETokenExtension as g, VegaRTEFunctionExtension as h, VegaRTEToolbarButtonRenderer as i, VegaRTEExtension as j, VegaRTEExtensionRenderer as k, RTETokenNode as l, RTETokenNodeRenderer as m, InternalVegaZIndexManager$1 as n };
|