@globalpayments/vega 2.66.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 +138 -44
- 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-modal/slimmers/controllers/vega-modal-open-state-controller.js +95 -16
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-z-index-controller.js +4 -1
- package/dist/collection/components/vega-modal/slimmers/models/vega-modal-open-state.js +9 -0
- package/dist/collection/components/vega-modal/slimmers/renderers/vega-modal-renderer.js +4 -1
- package/dist/collection/components/vega-modal/vega-modal.js +19 -16
- 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 +132 -38
- 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-modal/slimmers/controllers/vega-modal-open-state-controller.d.ts +31 -2
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-z-index-controller.d.ts +1 -0
- package/dist/types/components/vega-modal/slimmers/models/vega-modal-open-state.d.ts +9 -0
- package/dist/types/components/vega-modal/slimmers/renderers/vega-modal-renderer.d.ts +1 -0
- package/dist/types/components/vega-modal/types.d.ts +9 -0
- package/dist/types/components/vega-modal/vega-modal.d.ts +8 -2
- 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 +66 -4
- 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-30a8d9d6.entry.js +1 -0
- 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-c1da8328.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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ActionHandleStrategy } from '../../../dto/action-handle-strategies/action-handle-strategy.abstract';
|
|
2
|
+
import { InsertChildrenAfterAction } from '../../../dto/actions/insert-children-after-block';
|
|
3
|
+
import { InsertChildrenBeforeAction } from '../../../dto/actions/insert-children-before-block';
|
|
4
|
+
import { UpdateCursorPositionAction } from '../../../dto/actions/update-cursor-position-action';
|
|
5
|
+
import { InternalAnnotationTypeEnum } from '../../../dto/annotations/annotation.abstract';
|
|
6
|
+
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
7
|
+
import { RTETextNode } from '../../../dto/nodes/text-node';
|
|
8
|
+
/**
|
|
9
|
+
* Strategy to handle the paste content into function block.
|
|
10
|
+
*/
|
|
11
|
+
export class PastePlainTextStrategy extends ActionHandleStrategy {
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
handleAction(action, target) {
|
|
16
|
+
const { blocksToBeInserted, startNode, startOffset } = action;
|
|
17
|
+
if (startNode instanceof RTETextNode) {
|
|
18
|
+
const textNodes = blocksToBeInserted.flatMap((block) => {
|
|
19
|
+
if (block instanceof RTETextBlock) {
|
|
20
|
+
this.copyLinkGroupAnnotations(target.annotationMap, block.annotationMap);
|
|
21
|
+
return block.children;
|
|
22
|
+
}
|
|
23
|
+
return [];
|
|
24
|
+
});
|
|
25
|
+
if (textNodes.length > 0) {
|
|
26
|
+
if (startOffset > 0) {
|
|
27
|
+
target.apply(new InsertChildrenAfterAction(startNode, ...textNodes));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
target.apply(new InsertChildrenBeforeAction(startNode, ...textNodes));
|
|
31
|
+
}
|
|
32
|
+
this.focusToNextLine(textNodes[textNodes.length - 1], textNodes[textNodes.length - 1].getRangeEndOffset());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Focus to next paragraph.
|
|
38
|
+
*
|
|
39
|
+
* @param {RTETextNode} node - The text node need to focus.
|
|
40
|
+
* @param {number} startOffset - The offset need to focus.
|
|
41
|
+
*/
|
|
42
|
+
focusToNextLine(node, startOffset) {
|
|
43
|
+
const root = this.getRootContent(node);
|
|
44
|
+
if (root) {
|
|
45
|
+
root.apply(new UpdateCursorPositionAction(node, startOffset));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Copy link group annotations from copied block to target block.
|
|
50
|
+
*
|
|
51
|
+
* @param {BlockAnnotations} blockAnnotationMap - The target block annotation map.
|
|
52
|
+
* @param {BlockAnnotations} copiedAnnotationMap - The copied block annotation map.
|
|
53
|
+
*/
|
|
54
|
+
copyLinkGroupAnnotations(blockAnnotationMap, copiedAnnotationMap) {
|
|
55
|
+
if (copiedAnnotationMap && copiedAnnotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
56
|
+
const copiedLinkGroupAnnotation = copiedAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
57
|
+
if (!blockAnnotationMap.has(InternalAnnotationTypeEnum.LINK_GROUP)) {
|
|
58
|
+
blockAnnotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, copiedAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
copiedLinkGroupAnnotation.linkGroups.forEach((nodes, groupKey) => {
|
|
62
|
+
const existingAnnotation = blockAnnotationMap.get(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
63
|
+
existingAnnotation.linkGroups.set(groupKey, nodes);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModifyContentAction } from '../../../dto/actions/modify-content-action.abstract';
|
|
2
|
+
export const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
3
|
+
/**
|
|
4
|
+
* Action to insert a function block into the rich text editor.
|
|
5
|
+
*
|
|
6
|
+
* @example focusedBlock.apply(new InsertFunctionBlockAction('IF'))
|
|
7
|
+
* @example host.value.apply(new InsertFunctionBlockAction('IF'))
|
|
8
|
+
*/
|
|
9
|
+
export class InsertFunctionBlockAction extends ModifyContentAction {
|
|
10
|
+
constructor(functionType) {
|
|
11
|
+
super();
|
|
12
|
+
this.type = INSERT_FUNCTION_BLOCK;
|
|
13
|
+
this.functionType = functionType;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ModifyContentAction } from '../../../dto/actions/modify-content-action.abstract';
|
|
2
|
+
export const PASTE_PLAIN_TEXT = 'PASTE_PLAIN_TEXT';
|
|
3
|
+
/**
|
|
4
|
+
* Action to paste plain text content into function block.
|
|
5
|
+
*
|
|
6
|
+
* @example functionBlock.apply(new PastePlainTextAction('content', range))
|
|
7
|
+
* @example host.value.apply(new PastePlainTextAction('content', range))
|
|
8
|
+
*/
|
|
9
|
+
export class PastePlainTextAction extends ModifyContentAction {
|
|
10
|
+
constructor(blocksToBeInserted, startNode, startOffset) {
|
|
11
|
+
super();
|
|
12
|
+
this.type = PASTE_PLAIN_TEXT;
|
|
13
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
14
|
+
this.startNode = startNode;
|
|
15
|
+
this.startOffset = startOffset;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../utils/misc';
|
|
2
|
+
import { RTEAnnotationStyle } from '../../../dto/annotations/annotation-style';
|
|
3
|
+
import { RTEBlock } from '../../../dto/blocks/block.abstract';
|
|
4
|
+
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
5
|
+
/**
|
|
6
|
+
* RTE Function Block
|
|
7
|
+
*/
|
|
8
|
+
export class RTEFunctionBlock extends RTEBlock {
|
|
9
|
+
constructor(id) {
|
|
10
|
+
super(id);
|
|
11
|
+
this.type = 'function-block';
|
|
12
|
+
this.children = [];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates an RTEFunctionBlock from a VegaFunctionBlock.
|
|
16
|
+
*
|
|
17
|
+
* @param {VegaFunctionBlock} block - The custom block to convert.
|
|
18
|
+
* @param {VegaRTETransformOptions} [options] - Optional transformation options.
|
|
19
|
+
* @returns {RTEFunctionBlock} The resulting RTEFunctionBlock.
|
|
20
|
+
*/
|
|
21
|
+
static from(block, options) {
|
|
22
|
+
const functionBlock = new RTEFunctionBlock(block.id);
|
|
23
|
+
const defaultAnnotation = { customClass: ['statement'] };
|
|
24
|
+
let { annotations } = block;
|
|
25
|
+
annotations = annotations
|
|
26
|
+
? Object.assign(Object.assign({}, annotations), defaultAnnotation) : defaultAnnotation;
|
|
27
|
+
super.convertAnnotationsToMap(functionBlock.annotationMap, annotations);
|
|
28
|
+
functionBlock.children = this.generateBlockChildren(block.children, options, functionBlock);
|
|
29
|
+
return functionBlock;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Converts the RTEFunctionBlock and its children to an HTML string.
|
|
33
|
+
*
|
|
34
|
+
* @returns {string} The HTML string representation of the function block.
|
|
35
|
+
*/
|
|
36
|
+
toHtml() {
|
|
37
|
+
const childrenHtml = this.children
|
|
38
|
+
.map((child) => {
|
|
39
|
+
if (child instanceof RTETextBlock) {
|
|
40
|
+
const attrStr = this.getFunctionContentStyle(child);
|
|
41
|
+
return `<div class="statementelement"${attrStr}>${child.getChildrenHtml()}</div>`;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return child.toHtml();
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
.join('');
|
|
48
|
+
return `<div class="statement">${childrenHtml}</div>`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @inheritDoc
|
|
52
|
+
*/
|
|
53
|
+
clone(parent) {
|
|
54
|
+
const clonedBlock = new RTEFunctionBlock(generateUUID());
|
|
55
|
+
clonedBlock.parent = parent;
|
|
56
|
+
clonedBlock.children = this.children.map((child) => {
|
|
57
|
+
const clonedChild = child.clone(clonedBlock);
|
|
58
|
+
return clonedChild;
|
|
59
|
+
});
|
|
60
|
+
clonedBlock.annotationMap = super.cloneAnnotations();
|
|
61
|
+
return clonedBlock;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
getLastNode() {
|
|
67
|
+
return this.children[this.children.length - 1].getLastNode();
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @inheritDoc
|
|
71
|
+
*/
|
|
72
|
+
isNotEmpty() {
|
|
73
|
+
return this.children.length > 0;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @inheritDoc
|
|
77
|
+
*/
|
|
78
|
+
toJSON() {
|
|
79
|
+
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, children: this.children.map((child) => child.toJSON()) });
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get the style string for function content block, excluding default paragraph styles.
|
|
83
|
+
*
|
|
84
|
+
* @param {RTETextBlock} block - The text block to extract styles from
|
|
85
|
+
* @returns {string} - The style attribute string
|
|
86
|
+
*/
|
|
87
|
+
getFunctionContentStyle(block) {
|
|
88
|
+
const blockAnnotationStyle = new RTEAnnotationStyle(block);
|
|
89
|
+
let styles = blockAnnotationStyle.toCssText({ standalone: true });
|
|
90
|
+
const textStyleAnnotation = block.getAnnotationByType('TEXT_STYLE');
|
|
91
|
+
if (textStyleAnnotation && textStyleAnnotation.textStyle === 'paragraph') {
|
|
92
|
+
const defaultParagraphStyles = blockAnnotationStyle.toCssText(undefined, undefined, textStyleAnnotation.renderStyle({ standalone: true }));
|
|
93
|
+
styles = styles.replace(defaultParagraphStyles, '').trim();
|
|
94
|
+
}
|
|
95
|
+
return styles ? ` style="${styles}"` : '';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { RTEBlock } from '../../../dto/blocks/block.abstract';
|
|
2
|
+
import { RTELogicControlNode } from '../dto/logic-control-node';
|
|
3
|
+
/**
|
|
4
|
+
* Class representing a logic control block in the rich text editor.
|
|
5
|
+
*/
|
|
6
|
+
export class RTELogicControlBlock extends RTEBlock {
|
|
7
|
+
constructor(id, statementText, parent) {
|
|
8
|
+
super(id);
|
|
9
|
+
this.type = 'logic-control-block';
|
|
10
|
+
this.children = [];
|
|
11
|
+
this.statementText = '';
|
|
12
|
+
this.statementText = statementText;
|
|
13
|
+
this.children = [new RTELogicControlNode(`${id}-node-1`, statementText, this)];
|
|
14
|
+
if (parent) {
|
|
15
|
+
this.parent = parent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a logic control block from a JSON representation.
|
|
20
|
+
*
|
|
21
|
+
* @param {VegaRTELogicControlBlock} json - The JSON object representing the logic control block.
|
|
22
|
+
* @returns {RTELogicControlBlock} - The created logic control block.
|
|
23
|
+
*/
|
|
24
|
+
static from(json) {
|
|
25
|
+
const block = new RTELogicControlBlock(json.id, json.statementText);
|
|
26
|
+
return block;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check the block is not empty.
|
|
30
|
+
*
|
|
31
|
+
* @returns {boolean} - Always true for logic control block.
|
|
32
|
+
*/
|
|
33
|
+
isNotEmpty() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the last node of the block.
|
|
38
|
+
*
|
|
39
|
+
* @returns {RTELogicControlNode} - The last node in the block.
|
|
40
|
+
*/
|
|
41
|
+
getLastNode() {
|
|
42
|
+
return this.children[this.children.length - 1];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert the block to its HTML representation.
|
|
46
|
+
*
|
|
47
|
+
* @returns {string} - The HTML string of the logic control block.
|
|
48
|
+
*/
|
|
49
|
+
toHtml() {
|
|
50
|
+
return `<div class='statementsyntax' contenteditable='false'>${this.statementText}</div>`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Clone the current block instance.
|
|
54
|
+
*
|
|
55
|
+
* @param { RTEFunctionBlock } parent - The parent function block for the cloned instance.
|
|
56
|
+
* @returns {RTELogicControlBlock} - A new instance of RTEStatementSyntaxBlock.
|
|
57
|
+
*/
|
|
58
|
+
clone(parent) {
|
|
59
|
+
return new RTELogicControlBlock(this.id, this.statementText, parent);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the JSON representation of the block.
|
|
63
|
+
*
|
|
64
|
+
* @returns {VegaRTELogicControlBlock} - The JSON object of the logic control block.
|
|
65
|
+
*/
|
|
66
|
+
toJSON() {
|
|
67
|
+
return {
|
|
68
|
+
id: this.id,
|
|
69
|
+
type: this.type,
|
|
70
|
+
statementText: this.statementText,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { RTENode } from '../../../dto/nodes/node.abstract';
|
|
2
|
+
import stateEntityRenderingRegistry from '../../../slimmers/controllers/state-entity-rendering-registry';
|
|
3
|
+
/**
|
|
4
|
+
* Class representing a logic control node in the rich text editor.
|
|
5
|
+
*/
|
|
6
|
+
export class RTELogicControlNode extends RTENode {
|
|
7
|
+
constructor(id, text, parent) {
|
|
8
|
+
super(id);
|
|
9
|
+
this.type = 'logic-control-node';
|
|
10
|
+
this.text = '';
|
|
11
|
+
this.text = text;
|
|
12
|
+
this.parent = parent;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Clone the current node instance.
|
|
16
|
+
*
|
|
17
|
+
* @returns {RTELogicControlNode} - A new instance of RTELogicControlNode.
|
|
18
|
+
*/
|
|
19
|
+
clone() {
|
|
20
|
+
return new RTELogicControlNode(this.id, this.text, this.parent);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Convert the node to its HTML representation.
|
|
24
|
+
*
|
|
25
|
+
* @returns {string} - The HTML string of the logic control node.
|
|
26
|
+
*/
|
|
27
|
+
toHtml() {
|
|
28
|
+
return this.text;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Convert the node to a JSON representation.
|
|
32
|
+
*
|
|
33
|
+
* @returns {unknown} - The JSON object of the statement syntax node.
|
|
34
|
+
*/
|
|
35
|
+
toJSON() {
|
|
36
|
+
return {
|
|
37
|
+
id: this.id,
|
|
38
|
+
type: this.type,
|
|
39
|
+
text: this.text,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get the end offset of the node's range.
|
|
44
|
+
*
|
|
45
|
+
* @returns {number} - The end offset of the node's range.
|
|
46
|
+
*/
|
|
47
|
+
getRangeEndOffset() {
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the container element for the node's range.
|
|
52
|
+
*
|
|
53
|
+
* @returns {Nullable<Node>} - The container node for the range.
|
|
54
|
+
*/
|
|
55
|
+
getRangeContainer() {
|
|
56
|
+
const element = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
57
|
+
if (element) {
|
|
58
|
+
return element.parentElement;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the content editable state of the node.
|
|
63
|
+
*
|
|
64
|
+
* @returns {boolean} - The content editable state of the node.
|
|
65
|
+
*/
|
|
66
|
+
isContentEditable() {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../utils/misc';
|
|
2
|
+
import { ElementToDTOStrategy } from '../../../slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract';
|
|
3
|
+
import { RTEFunctionBlock } from '../dto/function-block';
|
|
4
|
+
/**
|
|
5
|
+
* Strategy to convert a div with class 'statement' into an function block.
|
|
6
|
+
*/
|
|
7
|
+
export class DivToFunctionBlockStrategy extends ElementToDTOStrategy {
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
|
+
canHandle(elementsArray, currentIndex) {
|
|
12
|
+
const element = elementsArray[currentIndex];
|
|
13
|
+
return element &&
|
|
14
|
+
element.tagName === 'DIV' &&
|
|
15
|
+
element.classList.contains('statement') &&
|
|
16
|
+
element.childNodes.length &&
|
|
17
|
+
element.querySelector('.statementsyntax')
|
|
18
|
+
? 1
|
|
19
|
+
: 0;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
24
|
+
handle() {
|
|
25
|
+
return RTEFunctionBlock.from({
|
|
26
|
+
id: generateUUID(),
|
|
27
|
+
type: 'function-block',
|
|
28
|
+
annotations: {
|
|
29
|
+
customClass: ['statement'],
|
|
30
|
+
},
|
|
31
|
+
children: [],
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @inheritDoc
|
|
36
|
+
*/
|
|
37
|
+
appendChildBlocks(currentBlock, childBlocks) {
|
|
38
|
+
currentBlock.children = childBlocks.map((block) => {
|
|
39
|
+
block.parent = currentBlock;
|
|
40
|
+
return block;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
shouldProceedToElementChildren() {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../utils/misc';
|
|
2
|
+
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
3
|
+
import htmlElementToAnnotationGenerator from '../../../slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator';
|
|
4
|
+
import { DivToLogicControlBlockStrategy } from './div-to-logic-control-block-strategy';
|
|
5
|
+
/**
|
|
6
|
+
* Strategy to convert a div with class 'statementelement' into an function block.
|
|
7
|
+
*/
|
|
8
|
+
export class DivToFunctionContentStrategy extends DivToLogicControlBlockStrategy {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.blockClassName = 'statementelement';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
handle(elementsArray, options) {
|
|
17
|
+
const element = elementsArray[0];
|
|
18
|
+
const annotations = htmlElementToAnnotationGenerator.generate(RTETextBlock, element);
|
|
19
|
+
const nodes = Array.from(elementsArray[0].childNodes);
|
|
20
|
+
return RTETextBlock.from({
|
|
21
|
+
id: generateUUID(),
|
|
22
|
+
type: 'paragraph',
|
|
23
|
+
annotations: Object.assign({ customClass: [this.blockClassName] }, annotations),
|
|
24
|
+
nodes: this.generateChildNodes(nodes, undefined, options),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../utils/misc';
|
|
2
|
+
import { RTELogicControlBlock } from '../dto/logic-control-block';
|
|
3
|
+
import { BlockToRTEBlockStrategyAbstract } from '../../../slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract';
|
|
4
|
+
/**
|
|
5
|
+
* Strategy to convert a div with class 'statementsyntax' into an RTELogicControlBlock DTO.
|
|
6
|
+
*/
|
|
7
|
+
export class DivToLogicControlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.blockClassName = 'statementsyntax';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @inheritDoc
|
|
14
|
+
*/
|
|
15
|
+
canHandle(elementsArray, currentIndex) {
|
|
16
|
+
const element = elementsArray[currentIndex];
|
|
17
|
+
return element &&
|
|
18
|
+
element.nodeType === Node.ELEMENT_NODE &&
|
|
19
|
+
element.classList.contains(this.blockClassName) &&
|
|
20
|
+
this.isFunctionBlockChild(element)
|
|
21
|
+
? 1
|
|
22
|
+
: 0;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
handle(elementsArray) {
|
|
28
|
+
const element = elementsArray[0];
|
|
29
|
+
return RTELogicControlBlock.from({
|
|
30
|
+
id: generateUUID(),
|
|
31
|
+
type: 'logic-control-block',
|
|
32
|
+
statementText: element.innerText,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The logic control block does not have child blocks to append. so this method is intentionally left empty.
|
|
37
|
+
*/
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
39
|
+
appendChildBlocks() { }
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
shouldProceedToElementChildren() {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Checks if the given element is a child of a function block
|
|
48
|
+
*
|
|
49
|
+
* @param {HTMLElement} element - The HTML element to check
|
|
50
|
+
* @returns {boolean} True if the element is a child of a function block, false otherwise
|
|
51
|
+
*/
|
|
52
|
+
isFunctionBlockChild(element) {
|
|
53
|
+
return !!(element.parentElement && element.parentElement.classList.contains('statement'));
|
|
54
|
+
}
|
|
55
|
+
}
|
package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { VegaRTEExtension } from '../extension.abstract';
|
|
2
|
+
import { VegaRTEContent } from '../../dto/content-state';
|
|
3
|
+
import { INSERT_FUNCTION_BLOCK } from './actions/insert-function-block-action';
|
|
4
|
+
import { InsertFunctionBlockStrategy } from './action-handler-strategies/insert-function-block-strategy';
|
|
5
|
+
import { RTETextBlock } from '../../dto/blocks/text-block';
|
|
6
|
+
import { RTEImageBlock } from '../../dto/blocks/image-block';
|
|
7
|
+
import { RTELogicControlBlock } from './dto/logic-control-block';
|
|
8
|
+
import { FunctionToolbarButtonRenderer } from './renderers/function-toolbar-button-renderer';
|
|
9
|
+
import { RTELogicControlBlockRenderer } from './renderers/logic-control-block-renderer';
|
|
10
|
+
import { DivToLogicControlBlockStrategy } from './element-to-dto-strategies/div-to-logic-control-block-strategy';
|
|
11
|
+
import { DivToFunctionBlockStrategy } from './element-to-dto-strategies/div-to-function-block-strategy';
|
|
12
|
+
import { DivToFunctionContentStrategy } from './element-to-dto-strategies/div-to-function-content-strategy';
|
|
13
|
+
import { RTEFunctionBlock } from './dto/function-block';
|
|
14
|
+
import { RTEFunctionBlockRenderer } from './renderers/function-block-renderer';
|
|
15
|
+
import { ModifyContentActionType } from '../../dto/actions/modify-content-action.abstract';
|
|
16
|
+
import { PreventNewParagraphInterceptor } from './action-handler-interceptor/prevent-new-paragraph-interceptor';
|
|
17
|
+
import { FunctionBlockInsertParagraphStrategy } from './action-handler-strategies/function-block-insert-paragraph-strategy';
|
|
18
|
+
import { PreventPasteContentInterceptor } from './action-handler-interceptor/prevent-paste-content-interceptor';
|
|
19
|
+
import { PASTE_PLAIN_TEXT } from './actions/paste-plain-text-action';
|
|
20
|
+
import { PastePlainTextStrategy } from './action-handler-strategies/paste-plain-text-strategy';
|
|
21
|
+
const convertLogicControlBlockStrategy = new DivToLogicControlBlockStrategy();
|
|
22
|
+
const convertFunctionContentStrategy = new DivToFunctionContentStrategy();
|
|
23
|
+
const convertFunctionBlockStrategy = new DivToFunctionBlockStrategy();
|
|
24
|
+
/**
|
|
25
|
+
* Function extension class for Vega Rich Text Editor.
|
|
26
|
+
*/
|
|
27
|
+
export class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this.toolbarButtonRenderer = new FunctionToolbarButtonRenderer();
|
|
31
|
+
this.registerBlockBasicStrategies(RTELogicControlBlock.name);
|
|
32
|
+
this.registerBlockBasicStrategies(RTEFunctionBlock.name);
|
|
33
|
+
this.preventFunctionBlockDefaultInsertNewParagraph();
|
|
34
|
+
this.registerNode('logic-control-block', RTELogicControlBlock);
|
|
35
|
+
this.registerRenderer('logic-control-block', new RTELogicControlBlockRenderer());
|
|
36
|
+
this.registerNode('function-block', RTEFunctionBlock);
|
|
37
|
+
this.registerRenderer('function-block', new RTEFunctionBlockRenderer());
|
|
38
|
+
this.registerToolbarButtonRenderer('functions', this.toolbarButtonRenderer);
|
|
39
|
+
this.registerElementToBlockDTOClassStrategy(convertLogicControlBlockStrategy);
|
|
40
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionContentStrategy);
|
|
41
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionBlockStrategy);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Initializes the extension with the given context
|
|
45
|
+
*
|
|
46
|
+
* @param {RTEExtensionContext} context - extension context
|
|
47
|
+
*/
|
|
48
|
+
initialExtension(context) {
|
|
49
|
+
super.initialExtension(context);
|
|
50
|
+
if (this.toolbarButtonRenderer) {
|
|
51
|
+
this.toolbarButtonRenderer.injectExtensionContext(context);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
56
|
+
*/
|
|
57
|
+
preventFunctionBlockDefaultInsertNewParagraph() {
|
|
58
|
+
this.unRegisterStrategy(ModifyContentActionType.INSERT_NEW_PARAGRAPH, RTELogicControlBlock.name);
|
|
59
|
+
this.unRegisterStrategy(ModifyContentActionType.APPEND_CHILDREN, RTEFunctionBlock.name);
|
|
60
|
+
this.unRegisterStrategy(ModifyContentActionType.INSERT_CHILDREN_AFTER, RTEFunctionBlock.name);
|
|
61
|
+
this.unRegisterStrategy(ModifyContentActionType.INSERT_CHILDREN_BEFORE, RTEFunctionBlock.name);
|
|
62
|
+
this.unRegisterStrategy(ModifyContentActionType.PASTE_CONTENT, RTELogicControlBlock.name);
|
|
63
|
+
VegaRTEExtension.registerActionHandleStrategy(RTEFunctionBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new FunctionBlockInsertParagraphStrategy());
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
(() => {
|
|
67
|
+
const insertFunctionBlockStrategy = new InsertFunctionBlockStrategy();
|
|
68
|
+
VegaRTEExtension.registerActionHandleStrategy(VegaRTEContent.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
69
|
+
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
70
|
+
VegaRTEExtension.registerActionHandleStrategy(RTEImageBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
71
|
+
VegaRTEExtension.registerActionHandleStrategy(RTELogicControlBlock.name, INSERT_FUNCTION_BLOCK, insertFunctionBlockStrategy);
|
|
72
|
+
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, PASTE_PLAIN_TEXT, new PastePlainTextStrategy());
|
|
73
|
+
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
74
|
+
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
75
|
+
})();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { VegaRTEExtensionRenderer } from '../../base-extension-renderer';
|
|
2
|
+
import styles from './function-block-styles.css';
|
|
3
|
+
/**
|
|
4
|
+
* Renderer for Function Block
|
|
5
|
+
*/
|
|
6
|
+
export class RTEFunctionBlockRenderer extends VegaRTEExtensionRenderer {
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
doRender(createElement, renderData) {
|
|
11
|
+
return createElement('div', {
|
|
12
|
+
key: renderData.id,
|
|
13
|
+
class: this.getElementClassName(renderData),
|
|
14
|
+
ref: this.useRef(renderData),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Defines the function block styles to be injected into the RTE scope.
|
|
19
|
+
*
|
|
20
|
+
* @returns {string} - The styles as a string.
|
|
21
|
+
*/
|
|
22
|
+
injectRTEScopeStyles() {
|
|
23
|
+
return styles;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the class name for the function block element.
|
|
27
|
+
*
|
|
28
|
+
* @param {RTEFunctionBlock} block - The function block.
|
|
29
|
+
* @returns {string} The class name for the function block element.
|
|
30
|
+
*/
|
|
31
|
+
getElementClassName(block) {
|
|
32
|
+
let classes = block.getClasses();
|
|
33
|
+
if (classes.indexOf('statement') < 0) {
|
|
34
|
+
classes = 'statement ' + classes;
|
|
35
|
+
}
|
|
36
|
+
return classes.trim();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
|
|
2
|
+
import { UpdateCursorPositionAction } from '../../../dto/actions/update-cursor-position-action';
|
|
3
|
+
import { VegaRTEToolbarButtonRenderer } from '../../base-toolbar-button-renderer';
|
|
4
|
+
import { INSERT_FUNCTION_BLOCK, InsertFunctionBlockAction, } from '../actions/insert-function-block-action';
|
|
5
|
+
/**
|
|
6
|
+
* Function toolbar button renderer class.
|
|
7
|
+
*/
|
|
8
|
+
export class FunctionToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
9
|
+
/**
|
|
10
|
+
* Injects the extension context
|
|
11
|
+
*
|
|
12
|
+
* @param {RTEExtensionContext} context - extension context
|
|
13
|
+
*/
|
|
14
|
+
injectExtensionContext(context) {
|
|
15
|
+
this.extensionContext = context;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
render(h, editorContext) {
|
|
21
|
+
return this.renderDropdown(h, editorContext, {}, [
|
|
22
|
+
this.renderButton(h, editorContext, {
|
|
23
|
+
label: 'Functions',
|
|
24
|
+
showArrowIcon: true,
|
|
25
|
+
}),
|
|
26
|
+
this.renderDropdownListTemplate(h, FunctionToolbarButtonRenderer.FUNCTION_LIST),
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Overrides the isDisabled method to determine if the button should be disabled.
|
|
31
|
+
*
|
|
32
|
+
* @returns {boolean} - true if the button should be disabled, false otherwise.
|
|
33
|
+
*/
|
|
34
|
+
isDisabled() {
|
|
35
|
+
const { host, getSelectedNodes } = this.extensionContext;
|
|
36
|
+
const focusNode = getSelectedNodes()[0];
|
|
37
|
+
let enableInsert = true;
|
|
38
|
+
if (focusNode) {
|
|
39
|
+
enableInsert = ActionHandleStrategyRegistry.canHandle(INSERT_FUNCTION_BLOCK, focusNode.parent);
|
|
40
|
+
}
|
|
41
|
+
return host.disabled || !enableInsert;
|
|
42
|
+
}
|
|
43
|
+
/* istanbul ignore next */
|
|
44
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
45
|
+
handleButtonClick() {
|
|
46
|
+
throw new Error('Method not implemented.');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handles dropdown click event
|
|
50
|
+
*
|
|
51
|
+
* @param {RTEExtensionFunctionType} itemKey - key of the clicked item
|
|
52
|
+
*/
|
|
53
|
+
handleDropdownClick(itemKey) {
|
|
54
|
+
const { host, getSelectedNodes } = this.extensionContext;
|
|
55
|
+
const focusNode = getSelectedNodes()[0];
|
|
56
|
+
const action = new InsertFunctionBlockAction(itemKey);
|
|
57
|
+
if (!focusNode) {
|
|
58
|
+
host.value.apply(action);
|
|
59
|
+
}
|
|
60
|
+
else if (focusNode.parent) {
|
|
61
|
+
focusNode.parent.apply(action);
|
|
62
|
+
}
|
|
63
|
+
if (action.nextFocusNode) {
|
|
64
|
+
host.value.apply(new UpdateCursorPositionAction(action.nextFocusNode, 1));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
FunctionToolbarButtonRenderer.FUNCTION_LIST = [
|
|
69
|
+
{ key: 'IF', label: 'Conditional' },
|
|
70
|
+
{ key: 'FOREACH', label: 'Foreach' },
|
|
71
|
+
];
|