@globalpayments/vega 2.90.0 → 2.92.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-08924736.js → app-globals-2f326662.js} +23 -12
- package/dist/cjs/{aria-dialog-focusable-trap-slimmer-a0ff1263.js → aria-dialog-focusable-trap-slimmer-73b4c0cb.js} +1 -1
- package/dist/cjs/{child-nodes-event-prevent-slimmer-85a7fdb0.js → child-nodes-event-prevent-slimmer-b9a5b3e2.js} +2 -2
- package/dist/cjs/{code-block-89850671.js → code-block-6435d641.js} +32 -3
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-a8da4087.js → component-value-history-controller-slimmer.abstract-e4c9a5ba.js} +59 -4
- package/dist/cjs/{content-state-e1c3efe6.js → content-state-96ec9114.js} +33 -4
- package/dist/cjs/copy-d021c780.js +7 -0
- package/dist/cjs/{create-public-api-runtime-metrics-slimmer-122350c3.js → create-public-api-runtime-metrics-slimmer-91b0cbfb.js} +3 -2
- package/dist/cjs/{date-required-rule-3437acbc.js → date-required-rule-8c9e312b.js} +1 -1
- package/dist/cjs/{design-token-939bf72c.js → design-token-3548af29.js} +4 -4
- package/dist/cjs/{element-appender-slimmer-14e85a91.js → element-appender-slimmer-3bf69990.js} +4 -4
- package/dist/cjs/{event-emit-slimmer-146316b2.js → event-emit-slimmer-5bab10c2.js} +1 -1
- package/dist/cjs/{feature-flag-controller-5fa21654.js → feature-flag-controller-c19d0b58.js} +12 -0
- package/dist/cjs/{file-uploader-required-rule-313ec9e3.js → file-uploader-required-rule-5520bbec.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-c4ebee27.js → form-field-controller-slimmer-e0efac05.js} +3 -3
- package/dist/cjs/{icon-manager-e855446d.js → icon-manager-be358b32.js} +2 -2
- package/dist/cjs/{image-annotation-action-f86690fd.js → image-annotation-action-853f72c8.js} +4 -4
- package/dist/cjs/index-58ea899e.js +8 -4
- package/dist/cjs/index.cjs.js +34 -27
- package/dist/cjs/{inject-keyboard-manager-743de047.js → inject-keyboard-manager-0dccff1a.js} +1 -1
- package/dist/cjs/internal-calendar-period-factory-6187ec4c.js +78 -0
- package/dist/cjs/{internal-icon-manager-66c48800.js → internal-icon-manager-40bcac72.js} +1 -1
- package/dist/cjs/{internal-translation-controller-9785d4e8.js → internal-translation-controller-48ebfd0f.js} +19 -0
- package/dist/cjs/{internal-vega-event-manager-6e49d1ca.js → internal-vega-event-manager-7196a847.js} +3 -1
- package/dist/cjs/{keyboard-manager-5396083a.js → keyboard-manager-dfe8d924.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-eedcfbc8.js → keyboard-manager-slimmer-4a2560a1.js} +1 -1
- package/dist/cjs/{legend-input-processor-1e53e5bc.js → legend-input-processor-ce9b38f8.js} +1 -1
- package/dist/cjs/{link-extension-dafeeed0.js → link-extension-28d95849.js} +3 -3
- package/dist/cjs/loader.cjs.js +22 -20
- package/dist/cjs/month-view-generator-2e59b188.js +33 -0
- package/dist/cjs/{public-rules-b032050f.js → public-rules-8727c42c.js} +13 -11
- package/dist/cjs/{range-efdf6f78.js → range-5cb3d1e4.js} +25 -3
- package/dist/cjs/{replace-selected-text-action-0f7b7c78.js → replace-selected-text-action-a31563ed.js} +1 -1
- package/dist/cjs/{required-field-rule-d73c1d8c.js → required-field-rule-400690c3.js} +10 -1
- package/dist/cjs/{responsive-format-facade-d112aa9f.js → responsive-format-facade-98b89142.js} +2 -2
- package/dist/cjs/{rich-text-editor-required-rule-86d9cd4d.js → rich-text-editor-required-rule-8e4d577d.js} +1 -1
- package/dist/cjs/{split-cell-operation-b41344bd.js → split-cell-operation-9e3ab88d.js} +5 -5
- package/dist/cjs/{state-border-formatter-c3c9b90d.js → state-border-formatter-626b0a14.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-d51050cd.js → string-format-strategy.abstract-981f43e1.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-23fdb50e.js → string-input-formatter-slimmer-fc4a0ba5.js} +3 -3
- package/dist/cjs/{string-mask-strategy-10fe0f6d.js → string-mask-strategy-b47fa159.js} +2 -2
- package/dist/cjs/{style-formatter-11c95331.js → style-formatter-baf18624.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-450277b6.js → sub-state-notify-slimmer-18891389.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-5bfe8e97.js → sub-state-observer-slimmer-eee2f0ae.js} +1 -1
- package/dist/cjs/{time-required-rule-2fd7c828.js → time-required-rule-e77d174f.js} +1 -1
- package/dist/cjs/{token-extension-2e3e1631.js → token-extension-3aec039f.js} +1826 -211
- package/dist/cjs/{translation-slimmer-e8549aff.js → translation-slimmer-1e05769e.js} +1 -1
- package/dist/cjs/{type-guard-9917b11f.js → type-guard-7ab48d6c.js} +119 -4
- package/dist/cjs/{typography-4560e7f1.js → typography-3ea4fe41.js} +10 -10
- package/dist/cjs/{valid-credit-card-number-rule-8c541bcd.js → valid-credit-card-number-rule-52ba9c67.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +25 -17
- package/dist/cjs/vega-app-footer.cjs.entry.js +61 -7
- package/dist/cjs/vega-app-header-button.cjs.entry.js +14 -14
- package/dist/cjs/vega-banner.cjs.entry.js +9 -12
- package/dist/cjs/vega-bar-chart.cjs.entry.js +3 -3
- package/dist/cjs/vega-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-brand-logo.cjs.entry.js +3 -3
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +5 -5
- package/dist/cjs/vega-button-circle.cjs.entry.js +12 -12
- package/dist/cjs/vega-button-group_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-button-link.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +10 -10
- package/dist/cjs/{vega-calendar_4.cjs.entry.js → vega-calendar_5.cjs.entry.js} +669 -398
- package/dist/cjs/vega-card.cjs.entry.js +7 -7
- package/dist/cjs/vega-carousel.cjs.entry.js +8 -8
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-chip.cjs.entry.js +11 -11
- package/dist/cjs/vega-code-block.cjs.entry.js +20 -23
- package/dist/cjs/vega-color-picker.cjs.entry.js +10 -8
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +15 -15
- package/dist/cjs/vega-color-swatch.cjs.entry.js +5 -5
- package/dist/cjs/vega-combo-box.cjs.entry.js +18 -18
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +26 -26
- package/dist/cjs/{vega-dialog-controller-6df7825e.js → vega-dialog-controller-16be85d5.js} +2 -2
- package/dist/cjs/vega-dialog_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-divider.cjs.entry.js +7 -7
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +17 -17
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/{vega-event-id-37c1716f.js → vega-event-id-df22d80e.js} +2 -0
- package/dist/cjs/vega-field-label.cjs.entry.js +16 -12
- package/dist/cjs/vega-file-uploader.cjs.entry.js +15 -13
- package/dist/cjs/vega-flag-icon.cjs.entry.js +10 -10
- package/dist/cjs/vega-flex.cjs.entry.js +8 -8
- package/dist/cjs/vega-font.cjs.entry.js +14 -8
- package/dist/cjs/vega-form.cjs.entry.js +12 -12
- package/dist/cjs/vega-grid.cjs.entry.js +7 -7
- package/dist/cjs/vega-icon.cjs.entry.js +9 -9
- package/dist/cjs/vega-image-uploader.cjs.entry.js +17 -17
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +18 -18
- package/dist/cjs/vega-input-numeric.cjs.entry.js +15 -15
- package/dist/cjs/vega-input-passcode.cjs.entry.js +14 -14
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +15 -15
- package/dist/cjs/vega-input-range.cjs.entry.js +10 -10
- package/dist/cjs/vega-input-select.cjs.entry.js +19 -27
- package/dist/cjs/vega-input.cjs.entry.js +20 -18
- package/dist/cjs/{vega-internal-event-id-e138d4d6.js → vega-internal-event-id-ecc5b87a.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +18 -18
- package/dist/cjs/vega-line-chart.cjs.entry.js +3 -3
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +5 -5
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination.cjs.entry.js +11 -11
- package/dist/cjs/vega-pie-chart.cjs.entry.js +2 -2
- package/dist/cjs/vega-popover_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-radio_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +15 -15
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +243 -69
- package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +233 -0
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +9 -9
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +18 -18
- package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +14 -14
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +14 -14
- package/dist/cjs/vega-signature-capture.cjs.entry.js +18 -18
- package/dist/cjs/vega-stepper.cjs.entry.js +9 -9
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-table_11.cjs.entry.js +16 -16
- package/dist/cjs/vega-textarea.cjs.entry.js +11 -11
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +17 -17
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +7 -7
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +9 -9
- package/dist/cjs/vega.cjs.js +22 -20
- package/dist/cjs/{wait-for-component-did-render-762084fc.js → wait-for-component-did-render-02ca4bee.js} +1 -1
- package/dist/cjs/xmark-large-faae5a80.js +7 -0
- package/dist/cjs/{y-axis-input-processor-54a26515.js → y-axis-input-processor-d3a3839c.js} +1 -1
- package/dist/collection/collection-manifest.json +16 -8
- package/dist/collection/components/vega-accordion/slimmers/vega-accordion-renderer.js +11 -3
- package/dist/collection/components/vega-app-footer/slimmers/renderers/vega-app-footer-additional-links-renderer.js +45 -0
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +63 -12
- package/dist/collection/components/vega-box/vega-box.js +3 -3
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-current-period-controller.js +21 -24
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.js +13 -79
- package/dist/collection/components/vega-calendar/vega-calendar-period-switcher/slimmers/controllers/vega-calendar-period-current-period-controller.js +153 -0
- package/dist/collection/components/vega-calendar/vega-calendar-period-switcher/slimmers/controllers/vega-calendar-period-state-controller.js +32 -0
- package/dist/collection/components/vega-calendar/vega-calendar-period-switcher/slimmers/renderers/vega-calendar-period-renderer.js +55 -0
- package/dist/collection/components/vega-calendar/vega-calendar-period-switcher/vega-calendar-period-switcher.css +20 -0
- package/dist/collection/components/vega-calendar/vega-calendar-period-switcher/vega-calendar-period-switcher.js +309 -0
- package/dist/collection/components/vega-calendar/vega-calendar.css +0 -9
- package/dist/collection/components/vega-calendar/vega-calendar.js +73 -1
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +1 -1
- package/dist/collection/components/vega-combo-box/vega-combo-box.js +1 -1
- package/dist/collection/components/vega-field-label/slimmers/renderers/vega-field-label-suffix-element-renderer.js +5 -4
- package/dist/collection/components/vega-field-label/vega-field-label.css +20 -0
- package/dist/collection/components/vega-field-label/vega-field-label.js +6 -3
- package/dist/collection/components/vega-font/slimmers/controllers/vega-font-classes-controller.js +7 -0
- package/dist/collection/components/vega-font/vega-font.css +72 -10
- package/dist/collection/components/vega-input/vega-input.css +1 -0
- package/dist/collection/components/vega-input/vega-input.js +1 -1
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +1 -9
- package/dist/collection/components/vega-input-select/vega-input-select.js +1 -1
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +3 -1
- package/dist/collection/components/vega-rich-text-editor/assets/cut.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.js +16 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-selected-content-strategy.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-selected-content-action.js +17 -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/content-state.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/range.js +24 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/copy/action-handler-strategies/copy-selected-content-strategy.js +226 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/copy/actions/copy-selected-content-action.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/copy/copy-extension.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/copy/copy-toolbar-button-renderer.js +58 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/cut/cut-extension.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/cut/cut-toolbar-button-renderer.js +44 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/assets/find-and-replace.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/find-replace-extension.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-controller.js +105 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-replace-controller.abstract.js +68 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/block-search-strategy.abstract.js +8 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/code-block-search-strategy.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/container-block-search-strategy.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/list-item-block-search-strategy.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/text-block-search-strategy.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-highlight-manager.js +266 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-state.js +346 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/replace-controller.js +113 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/slimmer/renderers/find-replace-toolbar-button-renderer.js +194 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/slimmers/renderers/find-replace-panel-renderer.js +153 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/vega-rich-text-find-replace-panel.css +50 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/vega-rich-text-find-replace-panel.js +156 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/horizontal-line/horizontal-line-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/line-height/line-height-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/special-characters/special-characters-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/controllers/selection-widget-keyboard-controller.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-extension.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/public-api.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +133 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.js +35 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.js +93 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +9 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +10 -1
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +2 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +3 -10
- package/dist/collection/components/vega-textarea/vega-textarea.js +1 -1
- package/dist/collection/constants/tokens/typography.js +10 -10
- package/dist/collection/constants/ui.js +1 -0
- package/dist/collection/global/scripts/before-vega-load.js +14 -0
- package/dist/collection/helpers/calendar/calendar-period/day-period.js +9 -0
- package/dist/collection/helpers/calendar/calendar-period/internal-calendar-period-factory.js +76 -0
- package/dist/collection/helpers/calendar/calendar-period/month-period.js +9 -0
- package/dist/collection/helpers/calendar/calendar-period/vega-calendar-period-factory.js +19 -0
- package/dist/collection/helpers/calendar/calendar-period/week-period.js +14 -0
- package/dist/collection/helpers/calendar/index.js +1 -0
- package/dist/collection/helpers/common/wait-for-vega-handler.js +1 -1
- package/dist/collection/helpers/dialog/vega-dialog-controller.js +1 -1
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +3 -1
- package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/vega-event-manager.js +1 -1
- package/dist/collection/helpers/feature-control/feature-flags-map.js +12 -0
- package/dist/collection/helpers/icon/icon-manager.js +1 -1
- package/dist/collection/helpers/loading-indicator/vega-loader-controller.js +1 -1
- package/dist/collection/helpers/notify/vega-notify-controller.js +1 -1
- package/dist/collection/helpers/public-api.js +1 -0
- package/dist/collection/helpers/skeleton-loader/vega-skeleton-loader-controller.js +1 -1
- package/dist/collection/helpers/slimmers/runtime-metrics/create-public-api-runtime-metrics-slimmer.js +3 -2
- package/dist/collection/helpers/theme/theme-manager.js +1 -1
- package/dist/collection/helpers/translation/locales/en.js +19 -0
- package/dist/collection/helpers/translation/translation.js +1 -1
- package/dist/collection/helpers/validator/rules/required-field-rule.js +10 -1
- package/dist/collection/helpers/zindex/vega-z-index-manager.js +1 -1
- package/dist/esm/{app-globals-a4134d21.js → app-globals-5e0d319a.js} +23 -12
- package/dist/esm/{aria-dialog-focusable-trap-slimmer-7db3d5a7.js → aria-dialog-focusable-trap-slimmer-9eae86c6.js} +1 -1
- package/dist/esm/{child-nodes-event-prevent-slimmer-1e3ac106.js → child-nodes-event-prevent-slimmer-f24618c5.js} +2 -2
- package/dist/esm/{code-block-9a17d89b.js → code-block-b71b2aa4.js} +32 -4
- package/dist/esm/{component-value-history-controller-slimmer.abstract-a64c3678.js → component-value-history-controller-slimmer.abstract-282df6e5.js} +59 -4
- package/dist/esm/{content-state-d59b4560.js → content-state-909099f8.js} +33 -4
- package/dist/esm/copy-54e45e2d.js +5 -0
- package/dist/esm/{create-public-api-runtime-metrics-slimmer-da6615bf.js → create-public-api-runtime-metrics-slimmer-48f85199.js} +3 -2
- package/dist/esm/{date-required-rule-cb960229.js → date-required-rule-15edb04a.js} +1 -1
- package/dist/esm/{design-token-f73ebce9.js → design-token-cb5ed6b9.js} +4 -4
- package/dist/esm/{element-appender-slimmer-c62cf540.js → element-appender-slimmer-e41120ee.js} +4 -4
- package/dist/esm/{event-emit-slimmer-3eb4d8ad.js → event-emit-slimmer-03deba18.js} +1 -1
- package/dist/esm/{feature-flag-controller-5ebc0cec.js → feature-flag-controller-3fd04ea9.js} +12 -0
- package/dist/esm/{file-uploader-required-rule-ad886d01.js → file-uploader-required-rule-96952e1a.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-514a3195.js → form-field-controller-slimmer-cfe1d8a7.js} +3 -3
- package/dist/esm/{icon-manager-691c8682.js → icon-manager-4ef3f6dd.js} +2 -2
- package/dist/esm/{image-annotation-action-f4ea265c.js → image-annotation-action-98232dc4.js} +4 -4
- package/dist/esm/index-090d31ca.js +8 -4
- package/dist/esm/index.js +29 -27
- package/dist/esm/{inject-keyboard-manager-6522df5c.js → inject-keyboard-manager-13cc77ab.js} +1 -1
- package/dist/esm/internal-calendar-period-factory-c3d70f3b.js +76 -0
- package/dist/esm/{internal-icon-manager-276f968f.js → internal-icon-manager-e7c57096.js} +1 -1
- package/dist/esm/{internal-translation-controller-653bd7e3.js → internal-translation-controller-8e8a514a.js} +19 -0
- package/dist/esm/{internal-vega-event-manager-a9758b6e.js → internal-vega-event-manager-75e5e3bb.js} +3 -1
- package/dist/esm/{keyboard-manager-9615fa9b.js → keyboard-manager-fe885db1.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-21bdc3a4.js → keyboard-manager-slimmer-61d4c79b.js} +1 -1
- package/dist/esm/{legend-input-processor-122008c5.js → legend-input-processor-3b2de4b7.js} +1 -1
- package/dist/esm/{link-extension-be164793.js → link-extension-f1a3bea7.js} +3 -3
- package/dist/esm/loader.js +22 -20
- package/dist/esm/month-view-generator-85eecb95.js +31 -0
- package/dist/esm/{public-rules-58f31834.js → public-rules-323bea4b.js} +13 -11
- package/dist/esm/{range-1c1c20fa.js → range-e63068d1.js} +25 -3
- package/dist/esm/{replace-selected-text-action-1abc5200.js → replace-selected-text-action-c0817b2b.js} +1 -1
- package/dist/esm/{required-field-rule-ab4bdc47.js → required-field-rule-897fe8d1.js} +10 -1
- package/dist/esm/{responsive-format-facade-12697af2.js → responsive-format-facade-fb424f5b.js} +2 -2
- package/dist/esm/{rich-text-editor-required-rule-050d292b.js → rich-text-editor-required-rule-0edb8ba7.js} +1 -1
- package/dist/esm/{split-cell-operation-8251d2a1.js → split-cell-operation-93b4d775.js} +5 -5
- package/dist/esm/{state-border-formatter-55cee24d.js → state-border-formatter-1a528ca4.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-14c1e874.js → string-format-strategy.abstract-72fc98aa.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-ec297247.js → string-input-formatter-slimmer-b0c480d8.js} +3 -3
- package/dist/esm/{string-mask-strategy-18760123.js → string-mask-strategy-4e00c173.js} +2 -2
- package/dist/esm/{style-formatter-6073ae27.js → style-formatter-5c1bea8d.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-d5a21bb3.js → sub-state-notify-slimmer-0f72ce74.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-d924288a.js → sub-state-observer-slimmer-64532d94.js} +1 -1
- package/dist/esm/{time-required-rule-9b775d24.js → time-required-rule-df500b14.js} +1 -1
- package/dist/esm/{token-extension-6cb7dcb2.js → token-extension-32d1fa56.js} +1823 -213
- package/dist/esm/{translation-slimmer-d32eb861.js → translation-slimmer-60408f13.js} +1 -1
- package/dist/esm/{type-guard-fd1f4760.js → type-guard-91087018.js} +117 -3
- package/dist/esm/{typography-396de03f.js → typography-19c3b9be.js} +10 -10
- package/dist/esm/{valid-credit-card-number-rule-dfd3e0a6.js → valid-credit-card-number-rule-681ecb75.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +25 -17
- package/dist/esm/vega-app-footer.entry.js +63 -9
- package/dist/esm/vega-app-header-button.entry.js +14 -14
- package/dist/esm/vega-banner.entry.js +8 -11
- package/dist/esm/vega-bar-chart.entry.js +3 -3
- package/dist/esm/vega-box.entry.js +8 -8
- package/dist/esm/vega-brand-logo.entry.js +3 -3
- package/dist/esm/vega-breadcrumb.entry.js +5 -5
- package/dist/esm/vega-button-circle.entry.js +12 -12
- package/dist/esm/vega-button-group_2.entry.js +8 -8
- package/dist/esm/vega-button-link.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +10 -10
- package/dist/esm/{vega-calendar_4.entry.js → vega-calendar_5.entry.js} +666 -396
- package/dist/esm/vega-card.entry.js +7 -7
- package/dist/esm/vega-carousel.entry.js +8 -8
- package/dist/esm/vega-checkbox_2.entry.js +10 -10
- package/dist/esm/vega-chip.entry.js +11 -11
- package/dist/esm/vega-code-block.entry.js +19 -22
- package/dist/esm/vega-color-picker.entry.js +10 -8
- package/dist/esm/vega-color-swatch-picker.entry.js +15 -15
- package/dist/esm/vega-color-swatch.entry.js +5 -5
- package/dist/esm/vega-combo-box.entry.js +18 -18
- package/dist/esm/vega-date-picker_2.entry.js +26 -26
- package/dist/esm/{vega-dialog-controller-389e7f7c.js → vega-dialog-controller-726b74f9.js} +2 -2
- package/dist/esm/vega-dialog_2.entry.js +11 -11
- package/dist/esm/vega-divider.entry.js +7 -7
- package/dist/esm/vega-dropdown_5.entry.js +17 -17
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/{vega-event-id-92848bf5.js → vega-event-id-d3017041.js} +2 -1
- package/dist/esm/vega-field-label.entry.js +16 -12
- package/dist/esm/vega-file-uploader.entry.js +15 -13
- package/dist/esm/vega-flag-icon.entry.js +10 -10
- package/dist/esm/vega-flex.entry.js +8 -8
- package/dist/esm/vega-font.entry.js +14 -8
- package/dist/esm/vega-form.entry.js +12 -12
- package/dist/esm/vega-grid.entry.js +7 -7
- package/dist/esm/vega-icon.entry.js +9 -9
- package/dist/esm/vega-image-uploader.entry.js +17 -17
- package/dist/esm/vega-input-credit-card.entry.js +18 -18
- package/dist/esm/vega-input-numeric.entry.js +15 -15
- package/dist/esm/vega-input-passcode.entry.js +14 -14
- package/dist/esm/vega-input-phone-number.entry.js +15 -15
- package/dist/esm/vega-input-range.entry.js +10 -10
- package/dist/esm/vega-input-select.entry.js +19 -27
- package/dist/esm/vega-input.entry.js +20 -18
- package/dist/esm/{vega-internal-event-id-913e8be6.js → vega-internal-event-id-827eb1ce.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +18 -18
- package/dist/esm/vega-line-chart.entry.js +3 -3
- package/dist/esm/vega-loader-wrapper_2.entry.js +5 -5
- package/dist/esm/vega-page-notification_2.entry.js +1 -1
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +5 -5
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination.entry.js +11 -11
- package/dist/esm/vega-pie-chart.entry.js +2 -2
- package/dist/esm/vega-popover_2.entry.js +15 -15
- package/dist/esm/vega-progress-tracker_2.entry.js +11 -11
- package/dist/esm/vega-radio_2.entry.js +15 -15
- package/dist/esm/vega-rich-text-content.entry.js +15 -15
- package/dist/esm/vega-rich-text-editor_4.entry.js +243 -69
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +229 -0
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +9 -9
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +18 -18
- package/dist/esm/vega-segment-control.entry.js +3 -3
- package/dist/esm/vega-selection-chip_2.entry.js +14 -14
- package/dist/esm/vega-selection-tile_2.entry.js +11 -11
- package/dist/esm/vega-sidenav_3.entry.js +14 -14
- package/dist/esm/vega-signature-capture.entry.js +18 -18
- package/dist/esm/vega-stepper.entry.js +9 -9
- package/dist/esm/vega-tab-group_2.entry.js +5 -5
- package/dist/esm/vega-table_11.entry.js +16 -16
- package/dist/esm/vega-textarea.entry.js +11 -11
- package/dist/esm/vega-time-picker_2.entry.js +17 -17
- package/dist/esm/vega-toggle-switch.entry.js +7 -7
- package/dist/esm/vega-tooltip_2.entry.js +9 -9
- package/dist/esm/vega.js +22 -20
- package/dist/esm/{wait-for-component-did-render-b378bf16.js → wait-for-component-did-render-0c237cb8.js} +1 -1
- package/dist/esm/xmark-large-c5ae7944.js +5 -0
- package/dist/esm/{y-axis-input-processor-c7e05353.js → y-axis-input-processor-c6b2a914.js} +1 -1
- package/dist/sri/vega-sri-manifest.json +420 -404
- package/dist/types/components/vega-accordion/slimmers/vega-accordion-renderer.d.ts +2 -0
- package/dist/types/components/vega-app-footer/slimmers/renderers/vega-app-footer-additional-links-renderer.d.ts +13 -0
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +18 -1
- package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-current-period-controller.d.ts +11 -6
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.d.ts +2 -29
- package/dist/types/components/vega-calendar/types.d.ts +7 -1
- package/dist/types/components/vega-calendar/vega-calendar-period-switcher/slimmers/controllers/vega-calendar-period-current-period-controller.d.ts +63 -0
- package/dist/types/components/vega-calendar/vega-calendar-period-switcher/slimmers/controllers/vega-calendar-period-state-controller.d.ts +10 -0
- package/dist/types/components/vega-calendar/vega-calendar-period-switcher/slimmers/renderers/vega-calendar-period-renderer.d.ts +11 -0
- package/dist/types/components/vega-calendar/vega-calendar-period-switcher/vega-calendar-period-switcher.d.ts +82 -0
- package/dist/types/components/vega-calendar/vega-calendar.d.ts +15 -1
- package/dist/types/components/vega-combo-box/vega-combo-box.d.ts +2 -10
- 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-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +5 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-selected-content-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/delete-selected-content-action.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/range.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/extensions/copy/action-handler-strategies/copy-selected-content-strategy.d.ts +79 -0
- package/dist/types/components/vega-rich-text-editor/extensions/copy/actions/copy-selected-content-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/copy/copy-extension.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/extensions/copy/copy-toolbar-button-renderer.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/extensions/cut/cut-extension.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/cut/cut-toolbar-button-renderer.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/assets/find-and-replace.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/find-replace-extension.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-controller.d.ts +65 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/find-replace-controller.abstract.d.ts +65 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/block-search-strategy.abstract.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/code-block-search-strategy.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/container-block-search-strategy.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/list-item-block-search-strategy.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/block-search-strategies/text-block-search-strategy.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-highlight-manager.d.ts +88 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/helper/find-replace-state.d.ts +200 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/controllers/replace-controller.d.ts +73 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/slimmer/renderers/find-replace-toolbar-button-renderer.d.ts +64 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/slimmers/renderers/find-replace-panel-renderer.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/extensions/find-replace/vega-rich-text-find-replace-panel/vega-rich-text-find-replace-panel.d.ts +56 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/horizontal-line/horizontal-line-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/languages/language-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/line-height/line-height-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/special-characters/special-characters-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-extension.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.d.ts +60 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +5 -2
- package/dist/types/components.d.ts +133 -6
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/global/icons/copy.d.ts +3 -0
- package/dist/types/helpers/calendar/calendar-period/calendar-period.abstract.d.ts +6 -0
- package/dist/types/helpers/calendar/calendar-period/day-period.d.ts +4 -0
- package/dist/types/helpers/calendar/calendar-period/internal-calendar-period-factory.d.ts +33 -0
- package/dist/types/helpers/calendar/calendar-period/month-period.d.ts +4 -0
- package/dist/types/helpers/calendar/calendar-period/vega-calendar-period-factory.d.ts +16 -0
- package/dist/types/helpers/calendar/calendar-period/week-period.d.ts +5 -0
- package/dist/types/helpers/calendar/index.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/feature-control/feature-flag.d.ts +3 -1
- package/dist/types/helpers/public-api.d.ts +1 -0
- package/dist/types/helpers/slimmers/runtime-metrics/create-public-api-runtime-metrics-slimmer.d.ts +2 -1
- package/dist/types/helpers/translation/interface.d.ts +20 -1
- package/dist/types/types/components.type.d.ts +1 -0
- package/dist/types/types/ui.type.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-fcefb62c.js → p-0179f55d.js} +1 -1
- package/dist/vega/{p-44f81987.entry.js → p-06c2ce2c.entry.js} +1 -1
- package/dist/vega/{p-0cc4a052.entry.js → p-07b56f2b.entry.js} +1 -1
- package/dist/vega/{p-881622fd.js → p-136226f8.js} +1 -1
- package/dist/vega/{p-fe573f85.entry.js → p-18413b62.entry.js} +1 -1
- package/dist/vega/p-209e0166.js +1 -0
- package/dist/vega/{p-97e7da55.js → p-228c5de8.js} +1 -1
- package/dist/vega/{p-02492864.entry.js → p-22f73e6e.entry.js} +1 -1
- package/dist/vega/p-2314494a.entry.js +1 -0
- package/dist/vega/p-2353b64f.entry.js +1 -0
- package/dist/vega/p-29e3eb12.js +1 -0
- package/dist/vega/{p-d76cb9da.entry.js → p-2da12975.entry.js} +1 -1
- package/dist/vega/{p-b7c90543.js → p-2def8e3e.js} +1 -1
- package/dist/vega/{p-f9ae396b.entry.js → p-2e58d99e.entry.js} +1 -1
- package/dist/vega/{p-600f0316.entry.js → p-30561e1d.entry.js} +1 -1
- package/dist/vega/p-35df0f0a.entry.js +1 -0
- package/dist/vega/p-37dffdf6.entry.js +1 -0
- package/dist/vega/{p-740f3325.entry.js → p-3911e760.entry.js} +1 -1
- package/dist/vega/{p-3a93730e.js → p-3a68b729.js} +1 -1
- package/dist/vega/p-3cf4339a.entry.js +1 -0
- package/dist/vega/{p-46e0c6ca.js → p-3f183b52.js} +1 -1
- package/dist/vega/{p-6d99a0b3.entry.js → p-40501057.entry.js} +1 -1
- package/dist/vega/{p-d6422004.entry.js → p-438b7404.entry.js} +1 -1
- package/dist/vega/p-43c3848f.entry.js +1 -0
- package/dist/vega/{p-e8c5a446.entry.js → p-450bf94d.entry.js} +1 -1
- package/dist/vega/{p-a809b33a.js → p-45ab490c.js} +1 -1
- package/dist/vega/{p-a9a70696.entry.js → p-481601c0.entry.js} +1 -1
- package/dist/vega/p-4953bb1a.js +1 -0
- package/dist/vega/p-4d9061fb.js +1 -0
- package/dist/vega/{p-8d9c4338.entry.js → p-4e39adf5.entry.js} +1 -1
- package/dist/vega/{p-ed1dbc98.entry.js → p-5038b6d7.entry.js} +1 -1
- package/dist/vega/{p-8666f206.entry.js → p-5319da71.entry.js} +1 -1
- package/dist/vega/{p-c1c5bd2c.entry.js → p-53c76d9d.entry.js} +1 -1
- package/dist/vega/{p-6fec4d46.entry.js → p-5545a235.entry.js} +1 -1
- package/dist/vega/{p-0278cd2b.entry.js → p-56cf1a65.entry.js} +1 -1
- package/dist/vega/{p-6528739f.entry.js → p-5829a66d.entry.js} +1 -1
- package/dist/vega/p-590c8720.entry.js +1 -0
- package/dist/vega/{p-f0d6e2f2.js → p-5946fadf.js} +1 -1
- package/dist/vega/{p-328dbe8e.js → p-5beec481.js} +1 -1
- package/dist/vega/p-5de1acdb.js +1 -0
- package/dist/vega/p-5df9047c.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-724df1f5.js → p-6031bed1.js} +1 -1
- package/dist/vega/{p-8e34b266.js → p-6096ffc3.js} +1 -1
- package/dist/vega/{p-616d7096.entry.js → p-625351a3.entry.js} +1 -1
- package/dist/vega/p-683cfe24.js +1 -0
- package/dist/vega/{p-8258dc37.entry.js → p-68e16c70.entry.js} +1 -1
- package/dist/vega/{p-d7790113.js → p-70817cf5.js} +1 -1
- package/dist/vega/p-71e2a3ec.js +1 -0
- package/dist/vega/{p-c5621f60.entry.js → p-7798254d.entry.js} +1 -1
- package/dist/vega/{p-e4917e76.js → p-7b9ed949.js} +1 -1
- package/dist/vega/p-7be548a7.js +1 -0
- package/dist/vega/{p-2c7e1bcb.js → p-802bf369.js} +1 -1
- package/dist/vega/{p-dfda6e01.entry.js → p-82279b03.entry.js} +1 -1
- package/dist/vega/p-8509c140.entry.js +1 -0
- package/dist/vega/{p-dcf162e9.js → p-87a4d75f.js} +1 -1
- package/dist/vega/p-88a6c89a.js +1 -0
- package/dist/vega/p-890a5254.js +1 -0
- package/dist/vega/p-8aa07ed0.js +1 -0
- package/dist/vega/p-8b9a8603.entry.js +1 -0
- package/dist/vega/p-8bc15ed0.js +1 -0
- package/dist/vega/{p-277c306b.js → p-8d69b201.js} +1 -1
- package/dist/vega/p-8da860f6.js +1 -0
- package/dist/vega/{p-1827a459.entry.js → p-8f078d0d.entry.js} +1 -1
- package/dist/vega/p-916dfa7e.entry.js +1 -0
- package/dist/vega/p-9219201a.entry.js +1 -0
- package/dist/vega/{p-844b7826.js → p-92823583.js} +1 -1
- package/dist/vega/{p-788a7a5a.js → p-93dfab05.js} +1 -1
- package/dist/vega/{p-99545fd7.entry.js → p-9440a8a5.entry.js} +1 -1
- package/dist/vega/p-970115d6.js +1 -0
- package/dist/vega/{p-00d2a013.entry.js → p-9abf7d0a.entry.js} +1 -1
- package/dist/vega/{p-6845ed5c.entry.js → p-9b1d718c.entry.js} +1 -1
- package/dist/vega/{p-92e493ea.entry.js → p-9cdedcfb.entry.js} +1 -1
- package/dist/vega/{p-456890f5.entry.js → p-9fafc956.entry.js} +1 -1
- package/dist/vega/p-9fb3aeeb.entry.js +1 -0
- package/dist/vega/p-a268a4fb.entry.js +1 -0
- package/dist/vega/{p-d2916121.js → p-a2bd621e.js} +1 -1
- package/dist/vega/p-a361456d.js +1 -0
- package/dist/vega/p-aa32f2f3.js +1 -0
- package/dist/vega/{p-9a6bd32c.js → p-afcd8f04.js} +1 -1
- package/dist/vega/p-b438e68b.js +1 -0
- package/dist/vega/p-b6225d01.js +1 -0
- package/dist/vega/p-b6ebfd5c.entry.js +1 -0
- package/dist/vega/{p-0a1c7f80.js → p-b730bf6e.js} +1 -1
- package/dist/vega/p-b799fc1f.entry.js +1 -0
- package/dist/vega/{p-1be90bab.entry.js → p-c04a90d8.entry.js} +1 -1
- package/dist/vega/{p-465590d1.entry.js → p-c0629528.entry.js} +1 -1
- package/dist/vega/{p-f5c8024e.entry.js → p-c2e0f8b7.entry.js} +1 -1
- package/dist/vega/p-c67ce78c.entry.js +1 -0
- package/dist/vega/{p-4694fe27.entry.js → p-c78aeaf3.entry.js} +1 -1
- package/dist/vega/{p-7fe292af.entry.js → p-c78e8081.entry.js} +1 -1
- package/dist/vega/{p-bcd3bd79.entry.js → p-c8eaf91c.entry.js} +1 -1
- package/dist/vega/p-ca9852bb.js +1 -0
- package/dist/vega/{p-285e5e52.entry.js → p-cd1844ad.entry.js} +1 -1
- package/dist/vega/{p-1d16a7fa.entry.js → p-cd9fb2ca.entry.js} +1 -1
- package/dist/vega/{p-350d1b75.entry.js → p-ce7e9515.entry.js} +1 -1
- package/dist/vega/p-d0ce752f.entry.js +1 -0
- package/dist/vega/{p-88c29aae.entry.js → p-d20587b4.entry.js} +1 -1
- package/dist/vega/{p-bce9f489.entry.js → p-d3c8b871.entry.js} +1 -1
- package/dist/vega/{p-30487f0e.js → p-d7369441.js} +1 -1
- package/dist/vega/{p-c9c42a07.js → p-de885ef2.js} +1 -1
- package/dist/vega/{p-fd2a49be.entry.js → p-dee38163.entry.js} +1 -1
- package/dist/vega/{p-54141828.entry.js → p-e160a727.entry.js} +1 -1
- package/dist/vega/p-e371738b.js +1 -0
- package/dist/vega/{p-566ba295.js → p-e3803943.js} +1 -1
- package/dist/vega/p-e41d9d0e.entry.js +1 -0
- package/dist/vega/p-e5502873.entry.js +1 -0
- package/dist/vega/p-e8f50fc5.js +1 -0
- package/dist/vega/{p-850ea38b.entry.js → p-e9cee498.entry.js} +1 -1
- package/dist/vega/p-ea22cba0.js +1 -0
- package/dist/vega/p-ea54ce0a.js +3 -0
- package/dist/vega/p-ee3155bd.js +1 -0
- package/dist/vega/{p-99ea0fa0.entry.js → p-eee01ba7.entry.js} +1 -1
- package/dist/vega/{p-d0e7c14b.entry.js → p-ef2b9846.entry.js} +1 -1
- package/dist/vega/p-f0bc2bbb.js +1 -0
- package/dist/vega/p-f365601c.entry.js +1 -0
- package/dist/vega/p-f4a01959.js +1 -0
- package/dist/vega/{p-1b4abd76.entry.js → p-f515d189.entry.js} +1 -1
- package/dist/vega/p-f5aefb2f.entry.js +1 -0
- package/dist/vega/{p-581d89bb.entry.js → p-f6bccb06.entry.js} +1 -1
- package/dist/vega/p-f70f7ad8.entry.js +1 -0
- package/dist/vega/{p-c0a6ed53.entry.js → p-f7739cbb.entry.js} +1 -1
- package/dist/vega/{p-4386625c.entry.js → p-fc5dfb52.entry.js} +1 -1
- package/dist/vega/p-fd70418f.js +1 -0
- package/dist/vega/{p-1704ff25.js → p-ffdc25ec.js} +1 -1
- package/dist/vega/vega.css +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/style/vega.css +1 -1
- package/dist/cjs/month-view-generator-c7492e06.js +0 -101
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +0 -92
- package/dist/esm/month-view-generator-1b7c9bb8.js +0 -97
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +0 -26
- package/dist/vega/p-018756ad.entry.js +0 -1
- package/dist/vega/p-0542b8ac.js +0 -1
- package/dist/vega/p-0bb860cc.js +0 -1
- package/dist/vega/p-1ee185d9.entry.js +0 -1
- package/dist/vega/p-203f4ce9.entry.js +0 -1
- package/dist/vega/p-2620a164.js +0 -1
- package/dist/vega/p-2649051e.entry.js +0 -1
- package/dist/vega/p-280cbcdb.js +0 -1
- package/dist/vega/p-30a6b7aa.entry.js +0 -1
- package/dist/vega/p-355ea330.entry.js +0 -1
- package/dist/vega/p-35d617d5.js +0 -1
- package/dist/vega/p-3755d8d3.entry.js +0 -1
- package/dist/vega/p-3e956269.entry.js +0 -1
- package/dist/vega/p-3ed6a602.js +0 -1
- package/dist/vega/p-44f39eee.js +0 -1
- package/dist/vega/p-46cab60a.js +0 -1
- package/dist/vega/p-47ffdc0f.entry.js +0 -1
- package/dist/vega/p-4fdd0a71.js +0 -1
- package/dist/vega/p-5a6e2c08.entry.js +0 -1
- package/dist/vega/p-5f048811.entry.js +0 -1
- package/dist/vega/p-667c980d.entry.js +0 -1
- package/dist/vega/p-6cedb325.js +0 -1
- package/dist/vega/p-716a393e.entry.js +0 -1
- package/dist/vega/p-73ce8fef.js +0 -1
- package/dist/vega/p-820ff54c.js +0 -1
- package/dist/vega/p-82c133aa.js +0 -1
- package/dist/vega/p-85dcd07b.js +0 -3
- package/dist/vega/p-8a054a13.js +0 -1
- package/dist/vega/p-8a34c08a.js +0 -1
- package/dist/vega/p-939c486f.entry.js +0 -1
- package/dist/vega/p-a58cacca.js +0 -1
- package/dist/vega/p-aae71499.entry.js +0 -1
- package/dist/vega/p-b0f55f5f.js +0 -1
- package/dist/vega/p-b5c08306.entry.js +0 -1
- package/dist/vega/p-b6be1f33.js +0 -1
- package/dist/vega/p-c596bb49.js +0 -1
- package/dist/vega/p-d871e8eb.entry.js +0 -1
- package/dist/vega/p-d884c644.js +0 -1
- package/dist/vega/p-d905159c.entry.js +0 -1
- package/dist/vega/p-e30a4f3e.js +0 -1
- package/dist/vega/p-eb927e2b.js +0 -1
- package/dist/vega/p-ecea4d24.js +0 -1
- package/dist/vega/p-f0b99c3a.entry.js +0 -1
- package/dist/vega/p-f251a907.entry.js +0 -1
- package/dist/vega/p-f70cfac5.entry.js +0 -1
- package/dist/vega/p-f830deb8.js +0 -1
- /package/dist/collection/{components/vega-code-block/assets → global/icons}/copy.js +0 -0
- /package/dist/types/components/{vega-code-block/assets/copy.d.ts → vega-rich-text-editor/assets/cut.d.ts} +0 -0
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { g as generateUUID } from './misc-9fdbcfbb.js';
|
|
2
2
|
import { a as arrayToClassString, g as getDeviceType, D as DeviceType, f as findParent, r as rgbToHex } from './ui-d73f756a.js';
|
|
3
3
|
import { L as LogUtility, I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
4
|
-
import { I as InjectVegaTelemetrySlimmer, c as createPublicAPIRuntimeMetricsSlimmer } from './create-public-api-runtime-metrics-slimmer-
|
|
4
|
+
import { I as InjectVegaTelemetrySlimmer, c as createPublicAPIRuntimeMetricsSlimmer } from './create-public-api-runtime-metrics-slimmer-48f85199.js';
|
|
5
5
|
import { I as InternalVegaZIndexManager } from './internal-vega-z-index-manager-7d2b54c3.js';
|
|
6
6
|
import { c as createDynamicSlimmer } from './dynamic-slimmer-90b8af32.js';
|
|
7
7
|
import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-e24d36c5.js';
|
|
8
|
-
import { i as internalVegaEventManager } from './internal-vega-event-manager-
|
|
9
|
-
import { V as VegaInternalTranslation } from './internal-translation-controller-
|
|
10
|
-
import {
|
|
11
|
-
import { R as
|
|
12
|
-
import { M as ModifyContentAction, A as ActionHandleStrategyRegistry, R as RTETextNode, a as RTEBlock, b as RTETextBlock, c as RTEAnnotationStyle, d as ActionHandleStrategy, I as InsertChildrenAfterAction, e as AppendChildrenAction, f as RTENode, s as stateEntityRenderingRegistry, g as InsertChildrenBeforeAction, h as InternalAnnotationTypeEnum, i as ModifyContentActionType, B as BlockAnnotation, j as AnnotationAction, k as RemoveChildrenAction, C as CommonAnnotationTypeEnum, l as CustomAttributeAnnotation, m as RTEDTOClassManager, n as RTEFilterStylesStrategy, o as RTEDecoratorNode, S as SplitBlockWithNodeAction, U as UpdateTextAction,
|
|
13
|
-
import { i as isNonNullable } from './type-guard-
|
|
14
|
-
import {
|
|
8
|
+
import { i as internalVegaEventManager } from './internal-vega-event-manager-75e5e3bb.js';
|
|
9
|
+
import { V as VegaInternalTranslation } from './internal-translation-controller-8e8a514a.js';
|
|
10
|
+
import { I as InternalCalendarPeriodConverter } from './internal-calendar-period-factory-c3d70f3b.js';
|
|
11
|
+
import { U as UpdateCursorPositionAction, V as VegaRTEContent, B as BlockToRTEBlockStrategyAbstract, E as ElementToDTOStrategy, h as htmlElementToAnnotationGenerator, I as InsertNewParagraphAction, R as RTEImageBlock, a as InsertChildrenBeforeStrategy, P as PasteContentStrategy, A as AnnotationGeneratorStrategyAbstract, b as RTEListItemBlock } from './content-state-909099f8.js';
|
|
12
|
+
import { M as ModifyContentAction, A as ActionHandleStrategyRegistry, R as RTETextNode, a as RTEBlock, b as RTETextBlock, c as RTEAnnotationStyle, d as ActionHandleStrategy, I as InsertChildrenAfterAction, e as AppendChildrenAction, f as RTENode, s as stateEntityRenderingRegistry, g as InsertChildrenBeforeAction, h as InternalAnnotationTypeEnum, i as ModifyContentActionType, B as BlockAnnotation, j as AnnotationAction, k as RemoveChildrenAction, C as CommonAnnotationTypeEnum, l as CustomAttributeAnnotation, m as RTEDTOClassManager, n as RTEFilterStylesStrategy, o as RTEDecoratorNode, S as SplitBlockWithNodeAction, U as UpdateTextAction, p as RTECodeBlock, q as RTECodeBlockNode, N as NodeAnnotationTypeEnum, r as CustomStyleAnnotation, t as RTEFilterStylesStrategyRegistry } from './code-block-b71b2aa4.js';
|
|
13
|
+
import { i as isNonNullable } from './type-guard-91087018.js';
|
|
14
|
+
import { R as RTEExtensionContextManager, a as VegaRTEExtensionRenderer, b as VegaRTEExtension } from './link-extension-f1a3bea7.js';
|
|
15
|
+
import { V as VegaInternalIconManager } from './internal-icon-manager-e7c57096.js';
|
|
15
16
|
import { v as vegaNonceManager } from './vega-nonce-manager-497e5eb5.js';
|
|
16
17
|
import { D as DomNodeSubjectObserverFactory, d as domNodeSubjectFactory } from './dom-node-subject-observer-factory-ddff8662.js';
|
|
17
|
-
import { V as VegaDropdownClick, a as VegaClick, b as VegaPopoverHide, c as VegaPopoverShow } from './vega-event-id-
|
|
18
|
-
import { R as RTETableExtensionAnnotationTypeEnum, a as RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR, S as SettingEventHandler, T as TableSettingType, b as RTETableAnnotation, c as RTETableCellAnnotation, d as RTETableHeadCellBlock, e as RowOperationEventHandler, C as ColumnOperationEventHandler, M as MergeCellsOperationEventHandler, f as SplitCellOperationEventHandler, g as RTETableColorManager, h as RTETableBlock, i as generateTableBody, j as RTETableCellBlock, k as RTETableHeadBlock, l as RTETableBodyBlock, m as getParentBlockByType, n as RTETableHeadCellAnnotation, o as TableColumnStrategy, p as getAllTableRows, q as buildTableGrid, s as setSpanAttributes, r as findCellBlockById, t as getDefaultCellBlockTemplate, I as InsertTableColumnDirection, u as buildCellStartColumnMap, v as getTableColumnCount, w as getFirstNode, x as getCellSpan, y as createNewCell, z as MergeCellsOperationType, A as RTETableRowBlock, B as getActualColumnPosition, D as InsertTableRowDirection, E as RTE_TABLE_DEFAULT_COLORS, F as INSERT_TABLE_ROW_INTO_DIFFERENT_SECTION, G as INSERT_TABLE_ROW_INTO_SAME_SECTION, H as DELETE_TABLE_ROW, J as TOGGLE_HEADER_ROW, K as INSERT_TABLE_COLUMN, L as DELETE_TABLE_COLUMN, N as TOGGLE_HEADER_TABLE_COLUMN, O as ToggleHeaderTableColumnStrategy, P as SPLIT_TABLE_CELL, Q as REPLACE_TABLE_CELL, U as SPLIT_CELL_HORIZONTALLY, W as SPLIT_CELL_VERTICALLY, X as SELECT_TABLE_COLUMN, Y as MERGE_CELLS } from './split-cell-operation-
|
|
18
|
+
import { V as VegaDropdownClick, a as VegaClick, b as VegaPopoverHide, c as VegaPopoverShow, d as VegaChange } from './vega-event-id-d3017041.js';
|
|
19
|
+
import { R as RTETableExtensionAnnotationTypeEnum, a as RTE_TABLE_HEAD_DEFAULT_BACKGROUND_COLOR, S as SettingEventHandler, T as TableSettingType, b as RTETableAnnotation, c as RTETableCellAnnotation, d as RTETableHeadCellBlock, e as RowOperationEventHandler, C as ColumnOperationEventHandler, M as MergeCellsOperationEventHandler, f as SplitCellOperationEventHandler, g as RTETableColorManager, h as RTETableBlock, i as generateTableBody, j as RTETableCellBlock, k as RTETableHeadBlock, l as RTETableBodyBlock, m as getParentBlockByType, n as RTETableHeadCellAnnotation, o as TableColumnStrategy, p as getAllTableRows, q as buildTableGrid, s as setSpanAttributes, r as findCellBlockById, t as getDefaultCellBlockTemplate, I as InsertTableColumnDirection, u as buildCellStartColumnMap, v as getTableColumnCount, w as getFirstNode, x as getCellSpan, y as createNewCell, z as MergeCellsOperationType, A as RTETableRowBlock, B as getActualColumnPosition, D as InsertTableRowDirection, E as RTE_TABLE_DEFAULT_COLORS, F as INSERT_TABLE_ROW_INTO_DIFFERENT_SECTION, G as INSERT_TABLE_ROW_INTO_SAME_SECTION, H as DELETE_TABLE_ROW, J as TOGGLE_HEADER_ROW, K as INSERT_TABLE_COLUMN, L as DELETE_TABLE_COLUMN, N as TOGGLE_HEADER_TABLE_COLUMN, O as ToggleHeaderTableColumnStrategy, P as SPLIT_TABLE_CELL, Q as REPLACE_TABLE_CELL, U as SPLIT_CELL_HORIZONTALLY, W as SPLIT_CELL_VERTICALLY, X as SELECT_TABLE_COLUMN, Y as MERGE_CELLS } from './split-cell-operation-93b4d775.js';
|
|
19
20
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
20
|
-
import { V as VegaInternalRTEExtensionTableCellsSelectionAnchor, a as VegaInternalPopoverUpdateTarget, b as VegaInternalRTEExtensionTableCellSelectionChange } from './vega-internal-event-id-
|
|
21
|
+
import { V as VegaInternalRTEExtensionTableCellsSelectionAnchor, a as VegaInternalPopoverUpdateTarget, b as VegaInternalRTEExtensionTableCellSelectionChange } from './vega-internal-event-id-827eb1ce.js';
|
|
21
22
|
import { r as remoteInvocationRegistry } from './remote-invocation-registry-d69245c2.js';
|
|
22
|
-
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-ca5afd2d.js';
|
|
23
|
+
import { V as VegaInternalThemeManager, a as VegaDarkModeStyleController } from './dark-mode-style-controller-ca5afd2d.js';
|
|
23
24
|
import { t as tryGetDocument } from './try-get-document-bef0f526.js';
|
|
24
25
|
import { p as parseToPixelString } from './pixel-f32c07ce.js';
|
|
25
26
|
import { c as cleanObject } from './object-0c277f57.js';
|
|
26
27
|
import { d as debounce } from './timer-9321173b.js';
|
|
27
|
-
import { R as ReplaceSelectedTextAction } from './replace-selected-text-action-
|
|
28
|
+
import { R as ReplaceSelectedTextAction } from './replace-selected-text-action-c0817b2b.js';
|
|
29
|
+
import { c as copy } from './copy-54e45e2d.js';
|
|
28
30
|
|
|
29
31
|
const VegaLoaderRuntimeMetricsPayloadDefinition = [
|
|
30
32
|
{
|
|
@@ -80,7 +82,7 @@ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
80
82
|
*/
|
|
81
83
|
class VegaLoaderController {
|
|
82
84
|
constructor() {
|
|
83
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaLoaderController, ['load', 'close'], VegaLoaderRuntimeMetricsPayloadDefinition);
|
|
85
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaLoaderController, ['load', 'close'], VegaLoaderRuntimeMetricsPayloadDefinition, 'VegaLoaderController');
|
|
84
86
|
}
|
|
85
87
|
/**
|
|
86
88
|
* Create a loading indicator and append it to the container
|
|
@@ -286,7 +288,7 @@ class VegaNotifyController {
|
|
|
286
288
|
target: () => this.container,
|
|
287
289
|
},
|
|
288
290
|
]);
|
|
289
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaNotifyController, ['open', 'close', 'closeAll'], VegaNotifyRuntimeMetricsPayloadDefinition);
|
|
291
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaNotifyController, ['open', 'close', 'closeAll'], VegaNotifyRuntimeMetricsPayloadDefinition, 'VegaNotifyController');
|
|
290
292
|
}
|
|
291
293
|
/**
|
|
292
294
|
* It creates a new notification element, adds it to the container, and returns the notification's ID
|
|
@@ -604,7 +606,7 @@ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
604
606
|
*/
|
|
605
607
|
class VegaEventManager {
|
|
606
608
|
constructor() {
|
|
607
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaEventManager, ['setSemantics', 'getSemantics', 'getEnabledEventIdsByComponent'], VegaEventManagerRuntimeMetricsPayloadDefinition);
|
|
609
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaEventManager, ['setSemantics', 'getSemantics', 'getEnabledEventIdsByComponent'], VegaEventManagerRuntimeMetricsPayloadDefinition, 'VegaEventManager');
|
|
608
610
|
}
|
|
609
611
|
/**
|
|
610
612
|
* The function sets the semantics configuration for event management.
|
|
@@ -703,7 +705,7 @@ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
703
705
|
*/
|
|
704
706
|
class VegaZIndexManager {
|
|
705
707
|
constructor() {
|
|
706
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaZIndexManager, ['overrideZIndexBasicValues'], ZIndexManagerRuntimeMetricsPayloadDefinition);
|
|
708
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaZIndexManager, ['overrideZIndexBasicValues'], ZIndexManagerRuntimeMetricsPayloadDefinition, 'VegaZIndexManager');
|
|
707
709
|
}
|
|
708
710
|
/**
|
|
709
711
|
* The function "overrideZIndexBasicValues" calls a method in the "ZIndexManager" class to change the
|
|
@@ -755,7 +757,7 @@ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
755
757
|
*/
|
|
756
758
|
class WaitForVegaHandler {
|
|
757
759
|
constructor() {
|
|
758
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(WaitForVegaHandler, ['handle'], WaitForVegaPayloadDefinition);
|
|
760
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(WaitForVegaHandler, ['handle'], WaitForVegaPayloadDefinition, 'WaitForVegaHandler');
|
|
759
761
|
}
|
|
760
762
|
/* istanbul ignore next */
|
|
761
763
|
/**
|
|
@@ -863,7 +865,7 @@ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
863
865
|
*/
|
|
864
866
|
class VegaSkeletonLoaderController {
|
|
865
867
|
constructor() {
|
|
866
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaSkeletonLoaderController, ['load', 'unLoad', 'unLoadAll'], VegaSkeletonRuntimeMetricsPayloadDefinition);
|
|
868
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(VegaSkeletonLoaderController, ['load', 'unLoad', 'unLoadAll'], VegaSkeletonRuntimeMetricsPayloadDefinition, 'VegaSkeletonLoaderController');
|
|
867
869
|
this.loaderMap = new Map();
|
|
868
870
|
}
|
|
869
871
|
/**
|
|
@@ -1012,7 +1014,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
1012
1014
|
*/
|
|
1013
1015
|
class TranslationController {
|
|
1014
1016
|
constructor() {
|
|
1015
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(TranslationController, ['init', 'changeLanguage'], VegaTranslationRuntimeMetricsPayloadDefinition);
|
|
1017
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicAPIRuntimeMetricsSlimmer(TranslationController, ['init', 'changeLanguage'], VegaTranslationRuntimeMetricsPayloadDefinition, 'TranslationController');
|
|
1016
1018
|
}
|
|
1017
1019
|
/**
|
|
1018
1020
|
* Get current language
|
|
@@ -1047,6 +1049,25 @@ __decorate([
|
|
|
1047
1049
|
], TranslationController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1048
1050
|
const VegaTranslation = new TranslationController();
|
|
1049
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* Factory class for creating CalendarPeriod instances.
|
|
1054
|
+
*/
|
|
1055
|
+
class VegaCalendarPeriodFactory {
|
|
1056
|
+
/**
|
|
1057
|
+
* Create a VegaCalendarCurrentPeriodType based on the specified view mode and date.
|
|
1058
|
+
*
|
|
1059
|
+
* @param {string} dateString - The date string to base the period on, in 'MM/DD/YYYY' format
|
|
1060
|
+
* @param {'month'|'week'|'day'} [viewMode='month'] - The view mode for the period, defaults to 'month'
|
|
1061
|
+
* @param {string} [timezone] - Optional timezone for the period calculation
|
|
1062
|
+
* @param {boolean} [showWeekends=true] - Whether to show weekends in the period, It's flag for calendar component, will effect the calendar view only.
|
|
1063
|
+
* @returns {VegaCalendarPeriodType} The period information containing year, month, startDate and endDate
|
|
1064
|
+
*/
|
|
1065
|
+
static fromDate(dateString, viewMode = 'month', timezone, showWeekends = true) {
|
|
1066
|
+
const period = InternalCalendarPeriodConverter.createCalendarPeriod(dateString, viewMode, timezone, showWeekends);
|
|
1067
|
+
return InternalCalendarPeriodConverter.toCalendarPeriodType(period);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1050
1071
|
/**
|
|
1051
1072
|
* Base class for rendering extension toolbar button in the rich text editor.
|
|
1052
1073
|
* The renderer provides common functionalities for rendering toolbar buttons, including:
|
|
@@ -1747,7 +1768,7 @@ class VegaRTELanguageExtension extends VegaRTEExtension {
|
|
|
1747
1768
|
*/
|
|
1748
1769
|
prepareBeforeLoad(host) {
|
|
1749
1770
|
this.languageToolbarButtonRenderer = new RTELanguageToolbarButtonRenderer(this.languageList, this.languageChangeCallBack, this.languageState.selectedLanguage);
|
|
1750
|
-
this.registerToolbarButtonRenderer(
|
|
1771
|
+
this.registerToolbarButtonRenderer(VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY, this.languageToolbarButtonRenderer, host);
|
|
1751
1772
|
}
|
|
1752
1773
|
/**
|
|
1753
1774
|
* Initializes the language extension.
|
|
@@ -1839,6 +1860,7 @@ class VegaRTELanguageExtension extends VegaRTEExtension {
|
|
|
1839
1860
|
return result;
|
|
1840
1861
|
}
|
|
1841
1862
|
}
|
|
1863
|
+
VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY = 'languages';
|
|
1842
1864
|
|
|
1843
1865
|
const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
1844
1866
|
/**
|
|
@@ -2631,7 +2653,7 @@ class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
|
2631
2653
|
}
|
|
2632
2654
|
/** @inheritDoc */
|
|
2633
2655
|
prepareBeforeLoad(host) {
|
|
2634
|
-
this.registerToolbarButtonRenderer(
|
|
2656
|
+
this.registerToolbarButtonRenderer(VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY, new FunctionToolbarButtonRenderer(), host);
|
|
2635
2657
|
}
|
|
2636
2658
|
/**
|
|
2637
2659
|
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
@@ -2655,6 +2677,7 @@ class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
|
2655
2677
|
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
2656
2678
|
VegaRTEExtension.registerActionHandlerInterceptor(RTETextBlock.name, ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
2657
2679
|
})();
|
|
2680
|
+
VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY = 'functions';
|
|
2658
2681
|
|
|
2659
2682
|
const tableBlockStylesCss = ".v-rte--extension-table-container{display:table}table.v-rte--extension-table{border-collapse:collapse}table.v-rte--extension-table th,table.v-rte--extension-table td{border:1px solid #ddd;padding:12px;text-align:left;vertical-align:middle;min-width:55px;box-sizing:border-box;position:relative}table.v-rte--extension-table th{background-color:#f2f2f2}.rte-table-setting-popover,.rte-table-dynamic-popover{display:block}table.v-rte--extension-table .v-rte-table-cell-focused::after,table.v-rte--extension-table .v-rte-table-cell-selected::after{content:'';position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-color:rgba(158, 207, 250, 0.3)}table.v-rte--extension-table:has(.v-rte-table-cell-selected){caret-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::selection{background-color:transparent}table.v-rte--extension-table:has(.v-rte-table-cell-selected) ::-moz-selection{background-color:transparent}.v-rte--extension-table-caption{padding:8px;border:1px solid #ddd;border-bottom:none;background-color:rgba(var(--v-bg-table-header, 240, 243, 247, 1));position:relative;display:table-caption;caption-side:top;min-height:22px;text-align:center;word-break:break-word;overflow-wrap:break-word}.v-rte--extension-table-caption.showPlaceholder::before{position:absolute;left:0;right:0;content:attr(data-placeholder);font-family:'Inter', sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0;color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1));text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
|
|
2660
2683
|
|
|
@@ -7291,7 +7314,7 @@ class VegaRTETableExtension extends VegaRTEExtension {
|
|
|
7291
7314
|
this.tableHeadCellRenderer = new RTETableHeadCellRenderer();
|
|
7292
7315
|
this.tableSelection = new RTETableSelection();
|
|
7293
7316
|
RTETableColorManager.setTableColors(colors);
|
|
7294
|
-
this.registerToolbarButtonRenderer(
|
|
7317
|
+
this.registerToolbarButtonRenderer(VegaRTETableExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
|
|
7295
7318
|
this.registerBlockBasicStrategies(RTETableBlock.name);
|
|
7296
7319
|
this.registerBlockBasicStrategies(RTETableHeadBlock.name);
|
|
7297
7320
|
this.registerBlockBasicStrategies(RTETableHeadCellBlock.name);
|
|
@@ -7379,6 +7402,7 @@ class VegaRTETableExtension extends VegaRTEExtension {
|
|
|
7379
7402
|
VegaRTEExtension.registerFilterStylesStrategy(RTETableCellBlock.dtoName, new TableCellFilterStylesStrategy());
|
|
7380
7403
|
VegaRTEExtension.registerFilterStylesStrategy(RTETableHeadCellBlock.dtoName, new TableCellFilterStylesStrategy('th'));
|
|
7381
7404
|
})();
|
|
7405
|
+
VegaRTETableExtension.TOOLBAR_BUTTON_KEY = 'table';
|
|
7382
7406
|
|
|
7383
7407
|
/**
|
|
7384
7408
|
* Horizontal line node — a decorator node representing `<hr>` in the editor.
|
|
@@ -7876,7 +7900,7 @@ class VegaRTEHorizontalLineExtension extends VegaRTEExtension {
|
|
|
7876
7900
|
// Register the renderer
|
|
7877
7901
|
this.registerRenderer('horizontal-line', this.blockRenderer);
|
|
7878
7902
|
// Register the toolbar button
|
|
7879
|
-
this.registerToolbarButtonRenderer(
|
|
7903
|
+
this.registerToolbarButtonRenderer(VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
|
|
7880
7904
|
// Register HTML → DTO conversion strategy
|
|
7881
7905
|
this.registerElementToBlockDTOClassStrategy(new HrToHorizontalLineBlockStrategy());
|
|
7882
7906
|
// Register filter styles strategy for source edit round-trip
|
|
@@ -7891,6 +7915,7 @@ class VegaRTEHorizontalLineExtension extends VegaRTEExtension {
|
|
|
7891
7915
|
VegaRTEExtension.registerActionHandleStrategy(RTEImageBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
|
|
7892
7916
|
VegaRTEExtension.registerActionHandleStrategy(RTEHorizontalLineBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
|
|
7893
7917
|
})();
|
|
7918
|
+
VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY = 'horizontalLine';
|
|
7894
7919
|
|
|
7895
7920
|
const ARROW_CHARACTERS = [
|
|
7896
7921
|
{ character: '←', title: 'leftwards simple arrow' },
|
|
@@ -8388,7 +8413,7 @@ class VegaRTESpecialCharactersExtension extends VegaRTEExtension {
|
|
|
8388
8413
|
}
|
|
8389
8414
|
/** @inheritDoc */
|
|
8390
8415
|
prepareBeforeLoad(host) {
|
|
8391
|
-
this.registerToolbarButtonRenderer(
|
|
8416
|
+
this.registerToolbarButtonRenderer(VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY, new RTESpecialCharactersToolbarButtonRenderer(this.categories), host);
|
|
8392
8417
|
}
|
|
8393
8418
|
/**
|
|
8394
8419
|
* Builds the final list of special character categories from the provided config.
|
|
@@ -8407,268 +8432,1462 @@ class VegaRTESpecialCharactersExtension extends VegaRTEExtension {
|
|
|
8407
8432
|
return [...defaultCategories, ...config.categories];
|
|
8408
8433
|
}
|
|
8409
8434
|
}
|
|
8435
|
+
VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY = 'special-characters';
|
|
8436
|
+
|
|
8437
|
+
const findReplaceIcon = {
|
|
8438
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M208 48c39.6 0 75.9 14.4 103.8 38.2L279 119c-6.9 6.9-8.9 17.2-5.2 26.2S286.3 160 296 160l96 0c13.3 0 24-10.7 24-24l0-96c0-9.7-5.8-18.5-14.8-22.2S381.9 16.2 375 23L345.8 52.2c-36.7-32.5-85-52.2-137.8-52.2-99.4 0-182.4 69.7-203.1 162.8-2.9 12.9 5.3 25.8 18.2 28.6 1.4 .3 2.7 .5 4.1 .5l2.3 0C40.1 191.5 49.4 184 51.8 173.2 67.7 101.6 131.6 48 208 48zM386 224c-10.4 .7-19.4 8.1-21.8 18.8-15.9 71.7-79.8 125.2-156.2 125.2-39.6 0-75.9-14.4-103.8-38.2L137 297c6.9-6.9 8.9-17.2 5.2-26.2S129.7 256 120 256l-96 0c-13.3 0-24 10.7-24 24l0 96c0 9.7 5.8 18.5 14.8 22.2S34.1 399.8 41 393l29.2-29.2c36.7 32.5 85 52.2 137.8 52.2 48.8 0 93.7-16.8 129.1-44.9L471 505c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9L371.1 337.1c19.2-24.2 33.1-52.8 40-84 2.9-12.9-5.3-25.8-18.2-28.6-1.2-.3-2.4-.4-3.6-.5l-3.2 0z"/></svg>`,
|
|
8439
|
+
};
|
|
8410
8440
|
|
|
8411
8441
|
/**
|
|
8412
|
-
*
|
|
8413
|
-
*
|
|
8442
|
+
* Defines how a specific type of RTEBlock contributes searchable leaf blocks.
|
|
8443
|
+
*
|
|
8444
|
+
* Implementations are registered on FindReplaceState in priority order.
|
|
8445
|
+
* The first strategy whose `canHandle` returns true is used.
|
|
8414
8446
|
*/
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
{ title: '1', value: '1' },
|
|
8418
|
-
{ title: '1.5', value: '1.5' },
|
|
8419
|
-
{ title: '2', value: '2' },
|
|
8420
|
-
{ title: '2.5', value: '2.5' },
|
|
8421
|
-
];
|
|
8447
|
+
class BlockSearchStrategy {
|
|
8448
|
+
}
|
|
8422
8449
|
|
|
8423
|
-
var RTELineHeightExtensionAnnotationTypeEnum;
|
|
8424
|
-
(function (RTELineHeightExtensionAnnotationTypeEnum) {
|
|
8425
|
-
RTELineHeightExtensionAnnotationTypeEnum["LINE_HEIGHT"] = "LINE_HEIGHT";
|
|
8426
|
-
})(RTELineHeightExtensionAnnotationTypeEnum || (RTELineHeightExtensionAnnotationTypeEnum = {}));
|
|
8427
8450
|
/**
|
|
8428
|
-
*
|
|
8451
|
+
* Handles RTECodeBlock — a searchable leaf block whose text lives in children[0].text.
|
|
8429
8452
|
*/
|
|
8430
|
-
class
|
|
8431
|
-
constructor(lineHeight) {
|
|
8432
|
-
super();
|
|
8433
|
-
this.type = RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT;
|
|
8434
|
-
this.lineHeight = lineHeight;
|
|
8435
|
-
}
|
|
8453
|
+
class CodeBlockSearchStrategy extends BlockSearchStrategy {
|
|
8436
8454
|
/**
|
|
8437
|
-
*
|
|
8438
|
-
*
|
|
8439
|
-
* @param {string} lineHeight - Line height value.
|
|
8440
|
-
* @returns {[RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT, LineHeightAnnotation]} Map item for the annotation.
|
|
8455
|
+
* @inheritDoc
|
|
8441
8456
|
*/
|
|
8442
|
-
|
|
8443
|
-
return
|
|
8457
|
+
canHandle(block) {
|
|
8458
|
+
return block instanceof RTECodeBlock;
|
|
8444
8459
|
}
|
|
8445
8460
|
/**
|
|
8446
|
-
*
|
|
8447
|
-
*
|
|
8448
|
-
* @param {string} lineHeight - The line height value.
|
|
8449
|
-
* @returns {AnnotationStyle} The default standalone styles.
|
|
8461
|
+
* @inheritDoc
|
|
8450
8462
|
*/
|
|
8451
|
-
|
|
8452
|
-
return
|
|
8463
|
+
collect(block) {
|
|
8464
|
+
return [block];
|
|
8453
8465
|
}
|
|
8466
|
+
}
|
|
8467
|
+
|
|
8468
|
+
/**
|
|
8469
|
+
* Handles RTEListItemBlock — a searchable leaf block that may also carry
|
|
8470
|
+
* nested RTEListBlocks via its `nestList` property.
|
|
8471
|
+
*
|
|
8472
|
+
* Must be registered before TextBlockSearchStrategy because RTEListItemBlock
|
|
8473
|
+
* extends RTETextBlock and would otherwise be matched by the parent class check.
|
|
8474
|
+
*/
|
|
8475
|
+
class ListItemBlockSearchStrategy extends BlockSearchStrategy {
|
|
8454
8476
|
/**
|
|
8455
|
-
*
|
|
8456
|
-
*
|
|
8457
|
-
* @returns {Record<string, unknown>} JSON representation of the annotation.
|
|
8477
|
+
* @inheritDoc
|
|
8458
8478
|
*/
|
|
8459
|
-
|
|
8460
|
-
return
|
|
8461
|
-
lineHeight: this.lineHeight,
|
|
8462
|
-
};
|
|
8479
|
+
canHandle(block) {
|
|
8480
|
+
return block instanceof RTEListItemBlock;
|
|
8463
8481
|
}
|
|
8464
8482
|
/**
|
|
8465
8483
|
* @inheritDoc
|
|
8466
8484
|
*/
|
|
8467
|
-
|
|
8468
|
-
|
|
8485
|
+
collect(block, recurse) {
|
|
8486
|
+
const listItemBlock = block;
|
|
8487
|
+
const result = [listItemBlock];
|
|
8488
|
+
if (listItemBlock.nestList && listItemBlock.nestList.length > 0) {
|
|
8489
|
+
for (const nestedList of listItemBlock.nestList) {
|
|
8490
|
+
result.push(...recurse(nestedList.children));
|
|
8491
|
+
}
|
|
8492
|
+
}
|
|
8493
|
+
return result;
|
|
8469
8494
|
}
|
|
8495
|
+
}
|
|
8496
|
+
|
|
8497
|
+
/**
|
|
8498
|
+
* Handles plain RTETextBlock (paragraph, heading, etc.) — a searchable leaf
|
|
8499
|
+
* block whose text lives in its RTETextNode children.
|
|
8500
|
+
*/
|
|
8501
|
+
class TextBlockSearchStrategy extends BlockSearchStrategy {
|
|
8470
8502
|
/**
|
|
8471
8503
|
* @inheritDoc
|
|
8472
8504
|
*/
|
|
8473
|
-
|
|
8474
|
-
return
|
|
8505
|
+
canHandle(block) {
|
|
8506
|
+
return block instanceof RTETextBlock;
|
|
8475
8507
|
}
|
|
8476
8508
|
/**
|
|
8477
8509
|
* @inheritDoc
|
|
8478
8510
|
*/
|
|
8479
|
-
|
|
8480
|
-
return
|
|
8511
|
+
collect(block) {
|
|
8512
|
+
return [block];
|
|
8481
8513
|
}
|
|
8482
8514
|
}
|
|
8483
8515
|
|
|
8484
8516
|
/**
|
|
8485
|
-
*
|
|
8517
|
+
* Fallback strategy for generic container blocks whose concrete type is not
|
|
8518
|
+
* known at compile time (RTEHtmlBlock, table blocks, extension-defined blocks, …).
|
|
8519
|
+
*
|
|
8520
|
+
* A block is treated as a container when its children array is non-empty and
|
|
8521
|
+
* the first child is not an RTETextNode (i.e. children are blocks, not nodes).
|
|
8486
8522
|
*/
|
|
8487
|
-
class
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8523
|
+
class ContainerBlockSearchStrategy extends BlockSearchStrategy {
|
|
8524
|
+
/**
|
|
8525
|
+
* @inheritDoc
|
|
8526
|
+
*/
|
|
8527
|
+
canHandle(block) {
|
|
8528
|
+
return (block.children != null && block.children.length > 0 && !(block.children[0] instanceof RTETextNode));
|
|
8492
8529
|
}
|
|
8493
8530
|
/**
|
|
8494
|
-
*
|
|
8495
|
-
*
|
|
8496
|
-
* @returns {LineHeightAnnotation} The annotation.
|
|
8531
|
+
* @inheritDoc
|
|
8497
8532
|
*/
|
|
8498
|
-
|
|
8499
|
-
return
|
|
8533
|
+
collect(block, recurse) {
|
|
8534
|
+
return recurse(block.children);
|
|
8500
8535
|
}
|
|
8501
8536
|
}
|
|
8502
8537
|
|
|
8503
8538
|
/**
|
|
8504
|
-
*
|
|
8539
|
+
* Sentinel character inserted into the flat text in place of a non-editable
|
|
8540
|
+
* node (e.g. a token). It keeps surrounding searchable segments from bridging
|
|
8541
|
+
* across the removed node — producing false matches — while never matching any
|
|
8542
|
+
* user keyword. `\u0000` (NULL) does not appear in editable document text.
|
|
8543
|
+
*/
|
|
8544
|
+
const NON_EDITABLE_SENTINEL = '\u0000';
|
|
8545
|
+
/**
|
|
8546
|
+
* Manages the in-memory state for a single Find & Replace session.
|
|
8505
8547
|
*
|
|
8506
|
-
*
|
|
8507
|
-
*
|
|
8548
|
+
* One instance is created per editor host inside VegaRTEFindReplaceExtension
|
|
8549
|
+
* during `initialExtensionAfterLoad`. It holds all search results, the
|
|
8550
|
+
* current navigation index, and a per-block flat-text cache.
|
|
8551
|
+
*
|
|
8552
|
+
* Public API:
|
|
8553
|
+
* - `search(content, keyword)` — run a search, replace current state using current options
|
|
8554
|
+
* - `next()` / `prev()` — navigate through results
|
|
8555
|
+
* - `getCurrentMatch()` / `getMatches()` / `getTotal()` / `getCurrentIndex()` — read state
|
|
8556
|
+
* - `clear()` — reset everything
|
|
8508
8557
|
*/
|
|
8509
|
-
class
|
|
8558
|
+
class FindReplaceState {
|
|
8559
|
+
constructor() {
|
|
8560
|
+
this.matches = [];
|
|
8561
|
+
this.currentIndex = -1;
|
|
8562
|
+
this.flatCache = new WeakMap();
|
|
8563
|
+
this.cachedContent = null;
|
|
8564
|
+
this.matchCase = false;
|
|
8565
|
+
this.wholeWords = false;
|
|
8566
|
+
/**
|
|
8567
|
+
* Ordered strategy chain used to classify and traverse each block type.
|
|
8568
|
+
* More specific types (RTEListItemBlock) must precede their parent class (RTETextBlock).
|
|
8569
|
+
*/
|
|
8570
|
+
this.blockSearchStrategies = [
|
|
8571
|
+
new CodeBlockSearchStrategy(),
|
|
8572
|
+
new ListItemBlockSearchStrategy(),
|
|
8573
|
+
new TextBlockSearchStrategy(),
|
|
8574
|
+
new ContainerBlockSearchStrategy(),
|
|
8575
|
+
];
|
|
8576
|
+
}
|
|
8510
8577
|
/**
|
|
8511
|
-
*
|
|
8578
|
+
* Runs a fresh search over the given content and replaces all previous results.
|
|
8512
8579
|
*
|
|
8513
|
-
*
|
|
8514
|
-
*
|
|
8580
|
+
* The flat-text cache is invalidated whenever the content reference changes
|
|
8581
|
+
* (i.e. after the user edits the document). When only the keyword or options
|
|
8582
|
+
* change (user typing in the find input), the cache is reused.
|
|
8583
|
+
*
|
|
8584
|
+
* @param {VegaRTEContent} content - The root content DTO to search.
|
|
8585
|
+
* @param {string} keyword - The search keyword entered by the user.
|
|
8586
|
+
* Uses the currently stored `matchCase` and `wholeWords` options.
|
|
8515
8587
|
*/
|
|
8516
|
-
|
|
8517
|
-
this.
|
|
8588
|
+
search(content, keyword) {
|
|
8589
|
+
this.invalidateCacheIfNeeded(content);
|
|
8590
|
+
if (!keyword) {
|
|
8591
|
+
this.matches = [];
|
|
8592
|
+
this.currentIndex = -1;
|
|
8593
|
+
return;
|
|
8594
|
+
}
|
|
8595
|
+
const regex = this.buildRegExp(keyword, this.getFindOptions());
|
|
8596
|
+
const blocks = this.collectSearchableBlocks(content.children);
|
|
8597
|
+
const results = [];
|
|
8598
|
+
for (const block of blocks) {
|
|
8599
|
+
let cached = this.flatCache.get(block);
|
|
8600
|
+
if (!cached) {
|
|
8601
|
+
cached =
|
|
8602
|
+
block instanceof RTECodeBlock
|
|
8603
|
+
? this.buildCodeBlockFlat(block)
|
|
8604
|
+
: this.buildTextBlockFlat(block);
|
|
8605
|
+
this.flatCache.set(block, cached);
|
|
8606
|
+
}
|
|
8607
|
+
const { flatText, segments } = cached;
|
|
8608
|
+
if (!flatText) {
|
|
8609
|
+
continue;
|
|
8610
|
+
}
|
|
8611
|
+
regex.lastIndex = 0;
|
|
8612
|
+
let match;
|
|
8613
|
+
while ((match = regex.exec(flatText)) !== null) {
|
|
8614
|
+
// match[1] is always the keyword capture group. In wholeWords mode,
|
|
8615
|
+
// match[0] may include a leading non-letter boundary char, so we
|
|
8616
|
+
// compute the actual start from the end offset minus the keyword length.
|
|
8617
|
+
const matchEnd = match.index + match[0].length;
|
|
8618
|
+
const matchStart = matchEnd - match[1].length;
|
|
8619
|
+
const nodes = this.flatOffsetToNodePositions(segments, matchStart, matchEnd);
|
|
8620
|
+
if (nodes.length > 0) {
|
|
8621
|
+
results.push({ block, nodes, matchText: match[1] });
|
|
8622
|
+
}
|
|
8623
|
+
}
|
|
8624
|
+
}
|
|
8625
|
+
this.matches = results;
|
|
8626
|
+
this.currentIndex = results.length > 0 ? 0 : -1;
|
|
8518
8627
|
}
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
*/
|
|
8528
|
-
class RTELineHeightToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
8529
|
-
constructor(options) {
|
|
8530
|
-
super();
|
|
8531
|
-
this.options = options;
|
|
8628
|
+
/**
|
|
8629
|
+
* Advances to the next match, wrapping around to the first.
|
|
8630
|
+
*/
|
|
8631
|
+
next() {
|
|
8632
|
+
if (this.matches.length === 0) {
|
|
8633
|
+
return;
|
|
8634
|
+
}
|
|
8635
|
+
this.currentIndex = (this.currentIndex + 1) % this.matches.length;
|
|
8532
8636
|
}
|
|
8533
8637
|
/**
|
|
8534
|
-
*
|
|
8638
|
+
* Moves to the previous match, wrapping around to the last.
|
|
8535
8639
|
*/
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
label: (_a = item.title) !== null && _a !== void 0 ? _a : item.value,
|
|
8542
|
-
});
|
|
8543
|
-
});
|
|
8544
|
-
return this.renderDropdown(createElement, editorContext, {
|
|
8545
|
-
selectType: 'single',
|
|
8546
|
-
selectedSourceKey: this.getSelectedSourceValue(editorContext),
|
|
8547
|
-
}, [
|
|
8548
|
-
this.renderButton(createElement, editorContext, {
|
|
8549
|
-
icon: 'line-height',
|
|
8550
|
-
showArrowIcon: true,
|
|
8551
|
-
tooltip: { text: VegaInternalTranslation.t('Line Height') },
|
|
8552
|
-
}),
|
|
8553
|
-
this.renderDropdownListTemplate(createElement, dropdownItems, editorContext),
|
|
8554
|
-
]);
|
|
8640
|
+
prev() {
|
|
8641
|
+
if (this.matches.length === 0) {
|
|
8642
|
+
return;
|
|
8643
|
+
}
|
|
8644
|
+
this.currentIndex = (this.currentIndex - 1 + this.matches.length) % this.matches.length;
|
|
8555
8645
|
}
|
|
8556
8646
|
/**
|
|
8557
|
-
*
|
|
8647
|
+
* Sets the current index directly. Clamps to valid range.
|
|
8648
|
+
*
|
|
8649
|
+
* @param {number} index - The desired index.
|
|
8558
8650
|
*/
|
|
8559
|
-
|
|
8560
|
-
|
|
8651
|
+
setCurrentIndex(index) {
|
|
8652
|
+
if (this.matches.length === 0) {
|
|
8653
|
+
this.currentIndex = -1;
|
|
8654
|
+
return;
|
|
8655
|
+
}
|
|
8656
|
+
this.currentIndex = Math.max(0, Math.min(index, this.matches.length - 1));
|
|
8561
8657
|
}
|
|
8562
8658
|
/**
|
|
8563
|
-
*
|
|
8659
|
+
* Returns the currently active match, or null if there are no results.
|
|
8660
|
+
*
|
|
8661
|
+
* @returns {FindMatch | null} The currently active match, or null if there are no results.
|
|
8564
8662
|
*/
|
|
8565
|
-
|
|
8663
|
+
getCurrentMatch() {
|
|
8566
8664
|
var _a;
|
|
8567
|
-
|
|
8568
|
-
return true;
|
|
8569
|
-
}
|
|
8570
|
-
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
8571
|
-
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
8572
|
-
if (selectedNodes.some((node) => {
|
|
8573
|
-
var _a;
|
|
8574
|
-
return ((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
8575
|
-
node.parent instanceof RTECodeBlock;
|
|
8576
|
-
})) {
|
|
8577
|
-
return true;
|
|
8578
|
-
}
|
|
8579
|
-
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
8580
|
-
return selectedBlocks.some((block) => block instanceof RTECodeBlock ||
|
|
8581
|
-
block instanceof RTEImageBlock ||
|
|
8582
|
-
!ActionHandleStrategyRegistry.canHandle(LineHeightAnnotationAction.name, block));
|
|
8665
|
+
return (_a = this.matches[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
|
|
8583
8666
|
}
|
|
8584
8667
|
/**
|
|
8585
|
-
*
|
|
8668
|
+
* Returns all matches from the last search.
|
|
8669
|
+
*
|
|
8670
|
+
* @returns {ReadonlyArray<FindMatch>} All matches from the last search.
|
|
8586
8671
|
*/
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
8590
|
-
selectedBlocks.forEach((block) => {
|
|
8591
|
-
block.apply(new LineHeightAnnotationAction(selectedLineHeight));
|
|
8592
|
-
});
|
|
8672
|
+
getMatches() {
|
|
8673
|
+
return this.matches;
|
|
8593
8674
|
}
|
|
8594
8675
|
/**
|
|
8595
|
-
*
|
|
8676
|
+
* Returns the total number of matches from the last search.
|
|
8677
|
+
*
|
|
8678
|
+
* @returns {number} The total number of matches.
|
|
8596
8679
|
*/
|
|
8597
|
-
|
|
8598
|
-
|
|
8680
|
+
getTotal() {
|
|
8681
|
+
return this.matches.length;
|
|
8599
8682
|
}
|
|
8600
8683
|
/**
|
|
8601
|
-
*
|
|
8684
|
+
* Returns the 0-based index of the current match, or -1 when there are no results.
|
|
8602
8685
|
*
|
|
8603
|
-
* @
|
|
8604
|
-
* @returns {string} Selected line-height key or empty string for mixed/none.
|
|
8686
|
+
* @returns {number} The 0-based index, or -1 when there are no results.
|
|
8605
8687
|
*/
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
if (selectedBlocks.length === 0) {
|
|
8609
|
-
return '';
|
|
8610
|
-
}
|
|
8611
|
-
const firstAnnotation = selectedBlocks[0].getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
8612
|
-
const isSameLineHeight = selectedBlocks.every((block) => {
|
|
8613
|
-
const annotation = block.getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
8614
|
-
return (annotation === null || annotation === void 0 ? void 0 : annotation.lineHeight) === (firstAnnotation === null || firstAnnotation === void 0 ? void 0 : firstAnnotation.lineHeight);
|
|
8615
|
-
});
|
|
8616
|
-
return isSameLineHeight && firstAnnotation ? firstAnnotation.lineHeight : '';
|
|
8688
|
+
getCurrentIndex() {
|
|
8689
|
+
return this.currentIndex;
|
|
8617
8690
|
}
|
|
8618
8691
|
/**
|
|
8619
|
-
*
|
|
8692
|
+
* Resets only match results and navigation index.
|
|
8693
|
+
* The flat-text cache and cached content reference are preserved so that
|
|
8694
|
+
* a subsequent search on the same document (e.g. after a keyword change)
|
|
8695
|
+
* can reuse the already-computed block flat texts.
|
|
8696
|
+
*/
|
|
8697
|
+
clearResults() {
|
|
8698
|
+
this.matches = [];
|
|
8699
|
+
this.currentIndex = -1;
|
|
8700
|
+
}
|
|
8701
|
+
/**
|
|
8702
|
+
* Resets all search state, including results, navigation index, and flat-text cache.
|
|
8703
|
+
* Use this when the session ends (e.g. panel closed) or the host changes.
|
|
8704
|
+
*/
|
|
8705
|
+
clear() {
|
|
8706
|
+
this.matches = [];
|
|
8707
|
+
this.currentIndex = -1;
|
|
8708
|
+
this.flatCache = new WeakMap();
|
|
8709
|
+
this.cachedContent = null;
|
|
8710
|
+
}
|
|
8711
|
+
/**
|
|
8712
|
+
* Sets the matchCase search option.
|
|
8620
8713
|
*
|
|
8621
|
-
* @param {
|
|
8622
|
-
* @returns {RTEBlock[]} Selected blocks.
|
|
8714
|
+
* @param {boolean} enabled - Whether to enable case-sensitive matching.
|
|
8623
8715
|
*/
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
8627
|
-
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
8628
|
-
const selectedBlocks = [];
|
|
8629
|
-
selectedNodes.forEach((node) => {
|
|
8630
|
-
if (node.parent instanceof RTEBlock && !selectedBlocks.includes(node.parent)) {
|
|
8631
|
-
selectedBlocks.push(node.parent);
|
|
8632
|
-
}
|
|
8633
|
-
});
|
|
8634
|
-
if (selectedBlocks.length === 0 && ((_b = editorContext.rteRange.startNode) === null || _b === void 0 ? void 0 : _b.parent) instanceof RTEBlock) {
|
|
8635
|
-
selectedBlocks.push(editorContext.rteRange.startNode.parent);
|
|
8636
|
-
}
|
|
8637
|
-
return selectedBlocks;
|
|
8716
|
+
setMatchCase(enabled) {
|
|
8717
|
+
this.matchCase = enabled;
|
|
8638
8718
|
}
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
const LINE_HEIGHT_AWARE_BLOCK_NAMES = new Set([
|
|
8647
|
-
RTETextBlock.name,
|
|
8648
|
-
RTEListItemBlock.name,
|
|
8649
|
-
]);
|
|
8650
|
-
/** Handle line height annotation. */
|
|
8651
|
-
class LineHeightAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
8652
|
-
constructor(options = VegaRTEDefaultLineHeightOptions) {
|
|
8653
|
-
super();
|
|
8654
|
-
this.allowedLineHeights = new Set(options.map((option) => option.value));
|
|
8719
|
+
/**
|
|
8720
|
+
* Sets the wholeWords search option.
|
|
8721
|
+
*
|
|
8722
|
+
* @param {boolean} enabled - Whether to enable whole-word matching.
|
|
8723
|
+
*/
|
|
8724
|
+
setWholeWords(enabled) {
|
|
8725
|
+
this.wholeWords = enabled;
|
|
8655
8726
|
}
|
|
8727
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
8656
8728
|
/**
|
|
8657
|
-
*
|
|
8729
|
+
* Invalidates the flat-text cache when the content reference has changed.
|
|
8730
|
+
* Since flushChanges always produces a new VegaRTEContent via clone(), a
|
|
8731
|
+
* changed reference reliably indicates the document has been edited.
|
|
8658
8732
|
*
|
|
8659
|
-
* @param {
|
|
8660
|
-
* @returns {boolean} Whether the target DTO supports line-height annotations.
|
|
8733
|
+
* @param {VegaRTEContent} content - The incoming content reference.
|
|
8661
8734
|
*/
|
|
8662
|
-
|
|
8663
|
-
|
|
8735
|
+
invalidateCacheIfNeeded(content) {
|
|
8736
|
+
if (content !== this.cachedContent) {
|
|
8737
|
+
this.flatCache = new WeakMap();
|
|
8738
|
+
this.cachedContent = content;
|
|
8739
|
+
}
|
|
8664
8740
|
}
|
|
8665
8741
|
/**
|
|
8666
|
-
*
|
|
8742
|
+
* Builds a RegExp from the keyword and search options.
|
|
8667
8743
|
*
|
|
8668
|
-
* @param {
|
|
8669
|
-
* @
|
|
8744
|
+
* @param {string} keyword - The raw user input.
|
|
8745
|
+
* @param {FindOptions} options - Search options.
|
|
8746
|
+
* @returns {RegExp} The compiled regular expression.
|
|
8670
8747
|
*/
|
|
8671
|
-
|
|
8748
|
+
buildRegExp(keyword, options) {
|
|
8749
|
+
const escaped = this.escapeRegExp(keyword);
|
|
8750
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
8751
|
+
let flags = 'gu';
|
|
8752
|
+
if (!options.matchCase) {
|
|
8753
|
+
flags += 'i';
|
|
8754
|
+
}
|
|
8755
|
+
if (options.wholeWords) {
|
|
8756
|
+
// Aligned with CKEditor's findByTextCallback non-letter boundary group.
|
|
8757
|
+
//
|
|
8758
|
+
// The keyword is wrapped in a capturing group (match[1]) so the search
|
|
8759
|
+
// loop can compute the exact start offset without lookbehind assertions
|
|
8760
|
+
// (not supported in Safari < 16.4). The non-capturing prefix group
|
|
8761
|
+
// `(?:^|nonLetter)` may consume one boundary char, which is why we
|
|
8762
|
+
// derive matchStart as matchEnd - match[1].length rather than match.index.
|
|
8763
|
+
const nonLetter = '[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF]';
|
|
8764
|
+
const prefix = !new RegExp(`^${nonLetter}`).test(keyword) ? `(?:^|${nonLetter})` : '';
|
|
8765
|
+
const suffix = !new RegExp(`${nonLetter}$`).test(keyword) ? `(?=${nonLetter}|$)` : '';
|
|
8766
|
+
return new RegExp(`${prefix}(${escaped})${suffix}`, flags);
|
|
8767
|
+
}
|
|
8768
|
+
return new RegExp(`(${escaped})`, flags);
|
|
8769
|
+
}
|
|
8770
|
+
/**
|
|
8771
|
+
* Escapes all regex special characters so the keyword is treated as literal text.
|
|
8772
|
+
*
|
|
8773
|
+
* @param {string} text - The raw input string.
|
|
8774
|
+
* @returns {string} The escaped string safe for use in a RegExp constructor.
|
|
8775
|
+
*/
|
|
8776
|
+
escapeRegExp(text) {
|
|
8777
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
8778
|
+
}
|
|
8779
|
+
/**
|
|
8780
|
+
* Recursively collects all searchable leaf blocks (RTETextBlock and RTECodeBlock)
|
|
8781
|
+
* from a block tree in document order.
|
|
8782
|
+
*
|
|
8783
|
+
* Each block is dispatched to the first matching BlockSearchStrategy.
|
|
8784
|
+
*
|
|
8785
|
+
* @param {RTEBlock[]} blocks - The block array to traverse.
|
|
8786
|
+
* @returns {(RTETextBlock | RTECodeBlock)[]} Ordered list of searchable leaf blocks.
|
|
8787
|
+
*/
|
|
8788
|
+
collectSearchableBlocks(blocks) {
|
|
8789
|
+
const result = [];
|
|
8790
|
+
const recurse = this.collectSearchableBlocks.bind(this);
|
|
8791
|
+
for (const block of blocks) {
|
|
8792
|
+
const strategy = this.blockSearchStrategies.find((s) => s.canHandle(block));
|
|
8793
|
+
if (strategy) {
|
|
8794
|
+
result.push(...strategy.collect(block, recurse));
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8797
|
+
return result;
|
|
8798
|
+
}
|
|
8799
|
+
/**
|
|
8800
|
+
* Builds the flat text and segment table for a RTETextBlock.
|
|
8801
|
+
*
|
|
8802
|
+
* Non-editable child nodes (e.g. tokens, which render as read-only chips)
|
|
8803
|
+
* are excluded from the searchable flat text. Each is replaced by a single
|
|
8804
|
+
* sentinel character so that adjacent editable segments cannot bridge across
|
|
8805
|
+
* the token to form a false match, while keeping segment offsets aligned.
|
|
8806
|
+
*
|
|
8807
|
+
* @param {RTETextBlock} block - The text block to flatten.
|
|
8808
|
+
* @returns {BlockFlatCache} The flat text string and segment mapping.
|
|
8809
|
+
*/
|
|
8810
|
+
buildTextBlockFlat(block) {
|
|
8811
|
+
const segments = [];
|
|
8812
|
+
const flatParts = [];
|
|
8813
|
+
let cursor = 0;
|
|
8814
|
+
for (const node of block.children) {
|
|
8815
|
+
if (!node.isContentEditable()) {
|
|
8816
|
+
flatParts.push(NON_EDITABLE_SENTINEL);
|
|
8817
|
+
cursor += NON_EDITABLE_SENTINEL.length;
|
|
8818
|
+
continue;
|
|
8819
|
+
}
|
|
8820
|
+
const len = node.text.length;
|
|
8821
|
+
segments.push({ node, start: cursor, end: cursor + len });
|
|
8822
|
+
flatParts.push(node.text);
|
|
8823
|
+
cursor += len;
|
|
8824
|
+
}
|
|
8825
|
+
return {
|
|
8826
|
+
flatText: flatParts.join(''),
|
|
8827
|
+
segments,
|
|
8828
|
+
};
|
|
8829
|
+
}
|
|
8830
|
+
/**
|
|
8831
|
+
* Builds the flat text and segment table for a RTECodeBlock.
|
|
8832
|
+
*
|
|
8833
|
+
* @param {RTECodeBlock} block - The code block to flatten.
|
|
8834
|
+
* @returns {BlockFlatCache} The flat text string and segment mapping.
|
|
8835
|
+
*/
|
|
8836
|
+
buildCodeBlockFlat(block) {
|
|
8837
|
+
const codeNode = block.children[0];
|
|
8838
|
+
if (!codeNode) {
|
|
8839
|
+
return { flatText: '', segments: [] };
|
|
8840
|
+
}
|
|
8841
|
+
const flatText = codeNode.text;
|
|
8842
|
+
return {
|
|
8843
|
+
flatText,
|
|
8844
|
+
segments: [{ node: codeNode, start: 0, end: flatText.length }],
|
|
8845
|
+
};
|
|
8846
|
+
}
|
|
8847
|
+
/**
|
|
8848
|
+
* Maps a flat [matchStart, matchEnd) range back to individual node positions.
|
|
8849
|
+
*
|
|
8850
|
+
* @param {(TextSegment | CodeSegment)[]} segments - The segment table.
|
|
8851
|
+
* @param {number} matchStart - Inclusive start in the flat text.
|
|
8852
|
+
* @param {number} matchEnd - Exclusive end in the flat text.
|
|
8853
|
+
* @returns {NodePosition[]} Ordered list of node-local positions spanning the match.
|
|
8854
|
+
*/
|
|
8855
|
+
flatOffsetToNodePositions(segments, matchStart, matchEnd) {
|
|
8856
|
+
const positions = [];
|
|
8857
|
+
for (const segment of segments) {
|
|
8858
|
+
if (segment.end <= matchStart) {
|
|
8859
|
+
continue;
|
|
8860
|
+
}
|
|
8861
|
+
if (segment.start >= matchEnd) {
|
|
8862
|
+
break;
|
|
8863
|
+
}
|
|
8864
|
+
const localStart = Math.max(0, matchStart - segment.start);
|
|
8865
|
+
const localEnd = Math.min(segment.end, matchEnd) - segment.start;
|
|
8866
|
+
positions.push({ node: segment.node, startOffset: localStart, endOffset: localEnd });
|
|
8867
|
+
}
|
|
8868
|
+
return positions;
|
|
8869
|
+
}
|
|
8870
|
+
/**
|
|
8871
|
+
* Builds the current find options from the shared context.
|
|
8872
|
+
*
|
|
8873
|
+
* @returns {FindOptions} The options for the search engine.
|
|
8874
|
+
*/
|
|
8875
|
+
getFindOptions() {
|
|
8876
|
+
return { matchCase: this.matchCase, wholeWords: this.wholeWords };
|
|
8877
|
+
}
|
|
8878
|
+
}
|
|
8879
|
+
|
|
8880
|
+
// Light-mode values (used as CSS var() fall-backs).
|
|
8881
|
+
// Dark-mode values are registered via VegaDarkModeStyleController below.
|
|
8882
|
+
const HIGHLIGHT_BG_LIGHT = '255, 220, 0, 0.35';
|
|
8883
|
+
const HIGHLIGHT_ACTIVE_BG_LIGHT = '255, 150, 0, 0.5';
|
|
8884
|
+
// Dark-mode: brighter yellow/orange tones stand out on dark backgrounds.
|
|
8885
|
+
const HIGHLIGHT_BG_DARK = '255, 235, 0, 0.55';
|
|
8886
|
+
const HIGHLIGHT_ACTIVE_BG_DARK = '255, 190, 0, 0.7';
|
|
8887
|
+
// CSS var() expressions that auto-switch between light and dark.
|
|
8888
|
+
const HIGHLIGHT_BG = `rgba(var(--v-rte-find-highlight-bg, ${HIGHLIGHT_BG_LIGHT}))`;
|
|
8889
|
+
const HIGHLIGHT_ACTIVE_BG = `rgba(var(--v-rte-find-highlight-active-bg, ${HIGHLIGHT_ACTIVE_BG_LIGHT}))`;
|
|
8890
|
+
/**
|
|
8891
|
+
* Manages highlights for the Find & Replace extension using a DOM overlay.
|
|
8892
|
+
*
|
|
8893
|
+
* Instead of modifying the RTE content tree (which causes re-renders, cursor
|
|
8894
|
+
* jumping, and VegaChange events), this manager renders semi-transparent
|
|
8895
|
+
* highlight rectangles in an absolutely-positioned overlay container.
|
|
8896
|
+
*
|
|
8897
|
+
* The overlay lives inside `.rich-text-editor-container` (the RTE's scroll
|
|
8898
|
+
* container) so highlight divs scroll naturally with the text content.
|
|
8899
|
+
* `pointer-events: none` ensures highlights don't interfere with user
|
|
8900
|
+
* interaction (selection, typing, clicking).
|
|
8901
|
+
*
|
|
8902
|
+
* Position computation uses `Range.getClientRects()` on the actual text DOM
|
|
8903
|
+
* nodes (resolved via `stateEntityRenderingRegistry.getDOMByEntity`).
|
|
8904
|
+
*/
|
|
8905
|
+
class FindReplaceHighlightManager {
|
|
8906
|
+
constructor() {
|
|
8907
|
+
this.overlayContainer = null;
|
|
8908
|
+
// Register dark-mode overrides so `html.dark { --v-rte-find-highlight-*: ... }` is generated.
|
|
8909
|
+
// CSS variables cascade into shadow DOM and update automatically when html.dark is toggled.
|
|
8910
|
+
VegaDarkModeStyleController.registerCustomDarkModeColor({
|
|
8911
|
+
'rte-find-highlight-bg': HIGHLIGHT_BG_DARK,
|
|
8912
|
+
'rte-find-highlight-active-bg': HIGHLIGHT_ACTIVE_BG_DARK,
|
|
8913
|
+
'rte-find-highlight-blend': 'lighten',
|
|
8914
|
+
});
|
|
8915
|
+
}
|
|
8916
|
+
/**
|
|
8917
|
+
* Renders highlight overlays for all matches, with the active match
|
|
8918
|
+
* visually distinct. Clears any existing highlights before applying.
|
|
8919
|
+
*
|
|
8920
|
+
* @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
|
|
8921
|
+
* @param {ReadonlyArray<FindMatch>} matches - All search results.
|
|
8922
|
+
* @param {number} currentIndex - 0-based index of the active match (-1 = none).
|
|
8923
|
+
* @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
|
|
8924
|
+
* @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
|
|
8925
|
+
*/
|
|
8926
|
+
apply(matches, currentIndex, host, scrollToActive = true) {
|
|
8927
|
+
this.clear();
|
|
8928
|
+
if (matches.length === 0) {
|
|
8929
|
+
return;
|
|
8930
|
+
}
|
|
8931
|
+
const overlay = this.getOrCreateOverlay(host);
|
|
8932
|
+
if (overlay) {
|
|
8933
|
+
const overlayRect = overlay.getBoundingClientRect();
|
|
8934
|
+
let activeHighlightDiv = null;
|
|
8935
|
+
matches.forEach((match, matchIndex) => {
|
|
8936
|
+
const isActive = matchIndex === currentIndex;
|
|
8937
|
+
const bg = isActive ? HIGHLIGHT_ACTIVE_BG : HIGHLIGHT_BG;
|
|
8938
|
+
match.nodes.forEach((nodePosition) => {
|
|
8939
|
+
const highlightDiv = this.createHighlightRectangles(overlay, overlayRect, nodePosition, bg);
|
|
8940
|
+
if (isActive && !activeHighlightDiv && highlightDiv) {
|
|
8941
|
+
activeHighlightDiv = highlightDiv;
|
|
8942
|
+
}
|
|
8943
|
+
});
|
|
8944
|
+
});
|
|
8945
|
+
if (scrollToActive && activeHighlightDiv) {
|
|
8946
|
+
activeHighlightDiv.scrollIntoView({ block: 'center', inline: 'nearest' });
|
|
8947
|
+
}
|
|
8948
|
+
}
|
|
8949
|
+
}
|
|
8950
|
+
/**
|
|
8951
|
+
* Removes all highlight overlay elements.
|
|
8952
|
+
* Safe to call multiple times or when no highlights are active.
|
|
8953
|
+
*/
|
|
8954
|
+
clear() {
|
|
8955
|
+
if (this.overlayContainer) {
|
|
8956
|
+
this.overlayContainer.innerHTML = '';
|
|
8957
|
+
}
|
|
8958
|
+
}
|
|
8959
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
8960
|
+
/**
|
|
8961
|
+
* Gets the existing overlay container or creates one inside the RTE's
|
|
8962
|
+
* scroll container (`.rich-text-editor-container`).
|
|
8963
|
+
*
|
|
8964
|
+
* @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
|
|
8965
|
+
* @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
|
|
8966
|
+
* @returns {HTMLDivElement | null} The overlay container, or null in SSR environments.
|
|
8967
|
+
*/
|
|
8968
|
+
getOrCreateOverlay(host) {
|
|
8969
|
+
if (this.overlayContainer && this.overlayContainer.isConnected) {
|
|
8970
|
+
return this.overlayContainer;
|
|
8971
|
+
}
|
|
8972
|
+
const safeDocument = tryGetDocument();
|
|
8973
|
+
if (safeDocument) {
|
|
8974
|
+
const scrollContainer = host.shadowRoot.querySelector('.rich-text-editor-container');
|
|
8975
|
+
if (scrollContainer) {
|
|
8976
|
+
// The overlay is appended as the last child (paints above content).
|
|
8977
|
+
// Blend mode is controlled via CSS variable --v-rte-find-highlight-blend:
|
|
8978
|
+
// - Light (default): multiply (yellow darkens white bg, text readable)
|
|
8979
|
+
// - Dark (via html.dark override): lighten (yellow visible on dark bg,
|
|
8980
|
+
// white text unaffected since lighten(255, x) = 255)
|
|
8981
|
+
// CSS vars cascade into shadow DOM and react to theme switches instantly.
|
|
8982
|
+
const overlay = safeDocument.createElement('div');
|
|
8983
|
+
overlay.style.position = 'absolute';
|
|
8984
|
+
overlay.style.top = '0';
|
|
8985
|
+
overlay.style.left = '0';
|
|
8986
|
+
overlay.style.width = '100%';
|
|
8987
|
+
overlay.style.height = '100%';
|
|
8988
|
+
overlay.style.pointerEvents = 'none';
|
|
8989
|
+
overlay.style.overflow = 'visible';
|
|
8990
|
+
overlay.style.setProperty('mix-blend-mode', 'var(--v-rte-find-highlight-blend, multiply)');
|
|
8991
|
+
scrollContainer.appendChild(overlay);
|
|
8992
|
+
this.overlayContainer = overlay;
|
|
8993
|
+
return overlay;
|
|
8994
|
+
}
|
|
8995
|
+
}
|
|
8996
|
+
return null;
|
|
8997
|
+
}
|
|
8998
|
+
/**
|
|
8999
|
+
* Creates absolutely-positioned highlight rectangles for a single node
|
|
9000
|
+
* position within a match.
|
|
9001
|
+
*
|
|
9002
|
+
* Uses client rectangle extraction from `Range` to handle multi-line matches (where a
|
|
9003
|
+
* single text range may produce multiple rectangles due to line wrapping).
|
|
9004
|
+
*
|
|
9005
|
+
* @param {HTMLDivElement} overlay - The overlay container.
|
|
9006
|
+
* @param {DOMRect} overlayRect - The overlay's bounding client rect (for coordinate conversion).
|
|
9007
|
+
* @param {NodePosition} nodePosition - The node and character offsets for this segment.
|
|
9008
|
+
* @param {string} bg - The background color to apply.
|
|
9009
|
+
* @returns {Nullable<HTMLDivElement>} The first created highlight div for this node segment.
|
|
9010
|
+
*/
|
|
9011
|
+
createHighlightRectangles(overlay, overlayRect, nodePosition, bg) {
|
|
9012
|
+
const domElement = stateEntityRenderingRegistry.getDOMByEntity(nodePosition.node);
|
|
9013
|
+
if (!domElement) {
|
|
9014
|
+
return null;
|
|
9015
|
+
}
|
|
9016
|
+
const range = this.buildRange(domElement, nodePosition);
|
|
9017
|
+
if (!range) {
|
|
9018
|
+
return null;
|
|
9019
|
+
}
|
|
9020
|
+
// eslint-disable-next-line spellcheck/spell-checker -- DOM API method name is fixed by platform.
|
|
9021
|
+
const clientRectList = range.getClientRects();
|
|
9022
|
+
const safeDocument = tryGetDocument();
|
|
9023
|
+
let firstHighlightDiv = null;
|
|
9024
|
+
if (safeDocument) {
|
|
9025
|
+
for (let i = 0; i < clientRectList.length; i++) {
|
|
9026
|
+
const rect = clientRectList[i];
|
|
9027
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
9028
|
+
continue;
|
|
9029
|
+
}
|
|
9030
|
+
const div = safeDocument.createElement('div');
|
|
9031
|
+
div.style.position = 'absolute';
|
|
9032
|
+
div.style.top = `${rect.top - overlayRect.top}px`;
|
|
9033
|
+
div.style.left = `${rect.left - overlayRect.left}px`;
|
|
9034
|
+
div.style.width = `${rect.width}px`;
|
|
9035
|
+
div.style.height = `${rect.height}px`;
|
|
9036
|
+
div.style.backgroundColor = bg;
|
|
9037
|
+
div.style.pointerEvents = 'none';
|
|
9038
|
+
div.style.borderRadius = '2px';
|
|
9039
|
+
overlay.appendChild(div);
|
|
9040
|
+
if (!firstHighlightDiv) {
|
|
9041
|
+
firstHighlightDiv = div;
|
|
9042
|
+
}
|
|
9043
|
+
}
|
|
9044
|
+
}
|
|
9045
|
+
return firstHighlightDiv;
|
|
9046
|
+
}
|
|
9047
|
+
/**
|
|
9048
|
+
* Builds a DOM Range for the given node position.
|
|
9049
|
+
*
|
|
9050
|
+
* For standard text nodes (RTETextNode rendered as `<span>`), the first
|
|
9051
|
+
* child is a Text node and offsets apply directly.
|
|
9052
|
+
*
|
|
9053
|
+
* For code block nodes (`<vega-code-block>` with shadow DOM), we traverse
|
|
9054
|
+
* the shadow root's `<code>` element child spans to locate the correct
|
|
9055
|
+
* text positions by accumulated character offset.
|
|
9056
|
+
*
|
|
9057
|
+
* @param {HTMLElement} domElement - The registered DOM element for the node.
|
|
9058
|
+
* @param {NodePosition} nodePosition - The character offsets within the node.
|
|
9059
|
+
* @returns {Nullable<Range>} A Range if successfully built, or null on failure.
|
|
9060
|
+
*/
|
|
9061
|
+
buildRange(domElement, nodePosition) {
|
|
9062
|
+
// <vega-code-block> wraps syntax-highlighted tokens inside a shadow root <code> element.
|
|
9063
|
+
if (nodePosition.node instanceof RTECodeBlockNode) {
|
|
9064
|
+
return this.buildCodeBlockRange(domElement, nodePosition);
|
|
9065
|
+
}
|
|
9066
|
+
// Standard text node: <span> with a direct Text child.
|
|
9067
|
+
const textNode = domElement.firstChild;
|
|
9068
|
+
if (!textNode) {
|
|
9069
|
+
return null;
|
|
9070
|
+
}
|
|
9071
|
+
const safeDocument = tryGetDocument();
|
|
9072
|
+
if (safeDocument) {
|
|
9073
|
+
const range = safeDocument.createRange();
|
|
9074
|
+
try {
|
|
9075
|
+
range.setStart(textNode, nodePosition.startOffset);
|
|
9076
|
+
range.setEnd(textNode, nodePosition.endOffset);
|
|
9077
|
+
return range;
|
|
9078
|
+
}
|
|
9079
|
+
catch (_a) {
|
|
9080
|
+
return null;
|
|
9081
|
+
}
|
|
9082
|
+
}
|
|
9083
|
+
return null;
|
|
9084
|
+
}
|
|
9085
|
+
/**
|
|
9086
|
+
* Builds a Range inside a `<vega-code-block>` shadow DOM element.
|
|
9087
|
+
*
|
|
9088
|
+
* `<vega-code-block>` renders its content inside a shadow root with a `<code>`
|
|
9089
|
+
* element containing multiple child `<span>` nodes (one per syntax token).
|
|
9090
|
+
* This method walks all Text nodes within that `<code>` element, accumulating
|
|
9091
|
+
* character length until the positions corresponding to startOffset / endOffset
|
|
9092
|
+
* are found.
|
|
9093
|
+
*
|
|
9094
|
+
* @param {HTMLElement} domElement - The `<vega-code-block>` host element.
|
|
9095
|
+
* @param {NodePosition} nodePosition - The character offsets within the node.
|
|
9096
|
+
* @returns {Range | null} A Range if successfully built, or null on failure.
|
|
9097
|
+
*/
|
|
9098
|
+
buildCodeBlockRange(domElement, nodePosition) {
|
|
9099
|
+
const shadowRoot = domElement.shadowRoot;
|
|
9100
|
+
const codeEl = shadowRoot.querySelector('code');
|
|
9101
|
+
if (!codeEl) {
|
|
9102
|
+
return null;
|
|
9103
|
+
}
|
|
9104
|
+
const safeDocument = tryGetDocument();
|
|
9105
|
+
if (safeDocument) {
|
|
9106
|
+
const walker = safeDocument.createTreeWalker(codeEl, NodeFilter.SHOW_TEXT);
|
|
9107
|
+
let accumulated = 0;
|
|
9108
|
+
let startNode = null;
|
|
9109
|
+
let startLocal = 0;
|
|
9110
|
+
let endNode = null;
|
|
9111
|
+
let endLocal = 0;
|
|
9112
|
+
let current = walker.nextNode();
|
|
9113
|
+
while (current) {
|
|
9114
|
+
const len = current.textContent.length;
|
|
9115
|
+
if (!startNode && accumulated + len > nodePosition.startOffset) {
|
|
9116
|
+
startNode = current;
|
|
9117
|
+
startLocal = nodePosition.startOffset - accumulated;
|
|
9118
|
+
}
|
|
9119
|
+
if (accumulated + len >= nodePosition.endOffset) {
|
|
9120
|
+
endNode = current;
|
|
9121
|
+
endLocal = nodePosition.endOffset - accumulated;
|
|
9122
|
+
break;
|
|
9123
|
+
}
|
|
9124
|
+
accumulated += len;
|
|
9125
|
+
current = walker.nextNode();
|
|
9126
|
+
}
|
|
9127
|
+
if (startNode && endNode) {
|
|
9128
|
+
const range = safeDocument.createRange();
|
|
9129
|
+
try {
|
|
9130
|
+
range.setStart(startNode, startLocal);
|
|
9131
|
+
range.setEnd(endNode, endLocal);
|
|
9132
|
+
return range;
|
|
9133
|
+
}
|
|
9134
|
+
catch (_a) {
|
|
9135
|
+
return null;
|
|
9136
|
+
}
|
|
9137
|
+
}
|
|
9138
|
+
}
|
|
9139
|
+
return null;
|
|
9140
|
+
}
|
|
9141
|
+
}
|
|
9142
|
+
|
|
9143
|
+
/**
|
|
9144
|
+
* Creates a new shared controller context with default (empty) state.
|
|
9145
|
+
*
|
|
9146
|
+
* @returns {FindReplaceControllerContext} A fresh context instance.
|
|
9147
|
+
*/
|
|
9148
|
+
function createFindReplaceControllerContext() {
|
|
9149
|
+
return {
|
|
9150
|
+
state: new FindReplaceState(),
|
|
9151
|
+
highlightManager: new FindReplaceHighlightManager(),
|
|
9152
|
+
hostRef: null,
|
|
9153
|
+
keyword: '',
|
|
9154
|
+
};
|
|
9155
|
+
}
|
|
9156
|
+
/**
|
|
9157
|
+
* Abstract base controller for the Find & Replace extension.
|
|
9158
|
+
*
|
|
9159
|
+
* Holds shared operations ({@link setHost}, {@link setKeyword}) and the
|
|
9160
|
+
* common helper {@link applyAndGetResult}. Concrete implementations
|
|
9161
|
+
* ({@link FindController}, {@link ReplaceController}) add the respective
|
|
9162
|
+
* search/navigation and mutation capabilities.
|
|
9163
|
+
*/
|
|
9164
|
+
class FindReplaceControllerAbstract {
|
|
9165
|
+
constructor(context) {
|
|
9166
|
+
this.context = context;
|
|
9167
|
+
}
|
|
9168
|
+
/**
|
|
9169
|
+
* Updates the cached host reference. Called on each render cycle.
|
|
9170
|
+
*
|
|
9171
|
+
* @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
|
|
9172
|
+
* @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
|
|
9173
|
+
*/
|
|
9174
|
+
setHost(host) {
|
|
9175
|
+
this.context.hostRef = host;
|
|
9176
|
+
}
|
|
9177
|
+
/**
|
|
9178
|
+
* Updates the keyword. Clears previous match results and highlights,
|
|
9179
|
+
* but preserves the flat-text cache so the next find() on the same
|
|
9180
|
+
* document does not re-flatten every block.
|
|
9181
|
+
*
|
|
9182
|
+
* @param {string} keyword - The new search keyword.
|
|
9183
|
+
* @returns {FindReplaceResult} Reset result (0/0).
|
|
9184
|
+
*/
|
|
9185
|
+
setKeyword(keyword) {
|
|
9186
|
+
this.context.keyword = keyword;
|
|
9187
|
+
this.context.state.clearResults();
|
|
9188
|
+
if (this.context.hostRef) {
|
|
9189
|
+
this.context.highlightManager.clear();
|
|
9190
|
+
}
|
|
9191
|
+
return { current: 0, total: 0 };
|
|
9192
|
+
}
|
|
9193
|
+
// ─── Protected ────────────────────────────────────────────────────────────────
|
|
9194
|
+
/**
|
|
9195
|
+
* Applies highlight overlays and returns the current result for the panel.
|
|
9196
|
+
*
|
|
9197
|
+
* @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
|
|
9198
|
+
* @returns {FindReplaceResult} The current match position and total count.
|
|
9199
|
+
*/
|
|
9200
|
+
applyAndGetResult(scrollToActive = true) {
|
|
9201
|
+
const total = this.context.state.getTotal();
|
|
9202
|
+
const current = total > 0 ? this.context.state.getCurrentIndex() + 1 : 0;
|
|
9203
|
+
if (this.context.hostRef) {
|
|
9204
|
+
this.context.highlightManager.apply(this.context.state.getMatches(), this.context.state.getCurrentIndex(), this.context.hostRef, scrollToActive);
|
|
9205
|
+
}
|
|
9206
|
+
return { current, total };
|
|
9207
|
+
}
|
|
9208
|
+
}
|
|
9209
|
+
|
|
9210
|
+
/**
|
|
9211
|
+
* Concrete find controller.
|
|
9212
|
+
*
|
|
9213
|
+
* Provides search, navigation, highlight, and lifecycle capabilities.
|
|
9214
|
+
* Shares state with {@link ReplaceController} via the injected
|
|
9215
|
+
* {@link FindReplaceControllerContext}.
|
|
9216
|
+
*/
|
|
9217
|
+
class FindController extends FindReplaceControllerAbstract {
|
|
9218
|
+
constructor(context) {
|
|
9219
|
+
super(context);
|
|
9220
|
+
}
|
|
9221
|
+
/**
|
|
9222
|
+
* Runs a search with the current keyword on the host's content.
|
|
9223
|
+
* Applies highlights and returns the result for panel display.
|
|
9224
|
+
*
|
|
9225
|
+
* @returns {FindReplaceResult} The match count and current position.
|
|
9226
|
+
*/
|
|
9227
|
+
find() {
|
|
9228
|
+
if (!this.context.hostRef) {
|
|
9229
|
+
return { current: 0, total: 0 };
|
|
9230
|
+
}
|
|
9231
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9232
|
+
return this.applyAndGetResult();
|
|
9233
|
+
}
|
|
9234
|
+
/**
|
|
9235
|
+
* Navigates to the next match.
|
|
9236
|
+
*
|
|
9237
|
+
* @returns {FindReplaceResult} Updated position.
|
|
9238
|
+
*/
|
|
9239
|
+
next() {
|
|
9240
|
+
this.context.state.next();
|
|
9241
|
+
return this.applyAndGetResult();
|
|
9242
|
+
}
|
|
9243
|
+
/**
|
|
9244
|
+
* Navigates to the previous match.
|
|
9245
|
+
*
|
|
9246
|
+
* @returns {FindReplaceResult} Updated position.
|
|
9247
|
+
*/
|
|
9248
|
+
prev() {
|
|
9249
|
+
this.context.state.prev();
|
|
9250
|
+
return this.applyAndGetResult();
|
|
9251
|
+
}
|
|
9252
|
+
/**
|
|
9253
|
+
* Clears all search state and removes highlight overlays.
|
|
9254
|
+
*/
|
|
9255
|
+
clear() {
|
|
9256
|
+
this.context.state.clear();
|
|
9257
|
+
if (this.context.hostRef) {
|
|
9258
|
+
this.context.highlightManager.clear();
|
|
9259
|
+
}
|
|
9260
|
+
}
|
|
9261
|
+
/**
|
|
9262
|
+
* Re-runs the search after content has changed (e.g. user typed while
|
|
9263
|
+
* panel is open). Attempts to preserve the previous navigation position.
|
|
9264
|
+
*
|
|
9265
|
+
* @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
|
|
9266
|
+
* @returns {FindReplaceResult | null} Updated result, or null if no search is active.
|
|
9267
|
+
*/
|
|
9268
|
+
refresh(scrollToActive = true) {
|
|
9269
|
+
if (!this.context.keyword || !this.context.hostRef) {
|
|
9270
|
+
return null;
|
|
9271
|
+
}
|
|
9272
|
+
const prevIndex = this.context.state.getCurrentIndex();
|
|
9273
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9274
|
+
this.context.state.setCurrentIndex(prevIndex);
|
|
9275
|
+
return this.applyAndGetResult(scrollToActive);
|
|
9276
|
+
}
|
|
9277
|
+
/**
|
|
9278
|
+
* Toggles the match-case search option, clears previous results,
|
|
9279
|
+
* and re-runs the search if a keyword is set.
|
|
9280
|
+
*
|
|
9281
|
+
* @param {boolean} enabled - Whether match-case should be enabled.
|
|
9282
|
+
* @returns {FindReplaceResult} The updated search result.
|
|
9283
|
+
*/
|
|
9284
|
+
setMatchCase(enabled) {
|
|
9285
|
+
this.context.state.setMatchCase(enabled);
|
|
9286
|
+
return this.updateFindResults();
|
|
9287
|
+
}
|
|
9288
|
+
/**
|
|
9289
|
+
* Toggles the whole-words search option, clears previous results,
|
|
9290
|
+
* and re-runs the search if a keyword is set.
|
|
9291
|
+
*
|
|
9292
|
+
* @param {boolean} enabled - Whether whole-words should be enabled.
|
|
9293
|
+
* @returns {FindReplaceResult} The updated search result.
|
|
9294
|
+
*/
|
|
9295
|
+
setWholeWords(enabled) {
|
|
9296
|
+
this.context.state.setWholeWords(enabled);
|
|
9297
|
+
return this.updateFindResults();
|
|
9298
|
+
}
|
|
9299
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
9300
|
+
/**
|
|
9301
|
+
* Clears previous results and re-runs the search with the current keyword and options.
|
|
9302
|
+
*
|
|
9303
|
+
* @returns {FindReplaceResult} The updated search result.
|
|
9304
|
+
*/
|
|
9305
|
+
updateFindResults() {
|
|
9306
|
+
this.context.state.clearResults();
|
|
9307
|
+
if (this.context.keyword && this.context.hostRef) {
|
|
9308
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9309
|
+
return this.applyAndGetResult();
|
|
9310
|
+
}
|
|
9311
|
+
return { current: 0, total: 0 };
|
|
9312
|
+
}
|
|
9313
|
+
}
|
|
9314
|
+
|
|
9315
|
+
/**
|
|
9316
|
+
* Replace controller — adds mutation capabilities on top of the shared
|
|
9317
|
+
* find state.
|
|
9318
|
+
*
|
|
9319
|
+
* Shares state with {@link FindController} via the injected
|
|
9320
|
+
* {@link FindReplaceControllerContext}, so both controllers always operate
|
|
9321
|
+
* on the same search results and highlight overlays.
|
|
9322
|
+
*/
|
|
9323
|
+
class ReplaceController extends FindReplaceControllerAbstract {
|
|
9324
|
+
constructor(context) {
|
|
9325
|
+
super(context);
|
|
9326
|
+
/** The replacement string used by replace() and replaceAll(). Updated via setReplacement(). */
|
|
9327
|
+
this.replacement = '';
|
|
9328
|
+
this.flushFn = null;
|
|
9329
|
+
}
|
|
9330
|
+
/**
|
|
9331
|
+
* Stores the flush callback used to commit content changes to the editor.
|
|
9332
|
+
* Called by the toolbar renderer after obtaining it from the extension context.
|
|
9333
|
+
*
|
|
9334
|
+
* Calling `flushValue` once — even after mutating multiple nodes — creates a
|
|
9335
|
+
* single entry in the editor's undo stack, so the entire replace/replaceAll
|
|
9336
|
+
* operation is undone as one atomic step.
|
|
9337
|
+
*
|
|
9338
|
+
* @param {(value: VegaRTEContent) => void} fn - The flush function.
|
|
9339
|
+
* @returns {void} No return value.
|
|
9340
|
+
*/
|
|
9341
|
+
setFlushValue(fn) {
|
|
9342
|
+
this.flushFn = fn;
|
|
9343
|
+
}
|
|
9344
|
+
/**
|
|
9345
|
+
* Stores the replacement text for the next replace() or replaceAll() call.
|
|
9346
|
+
*
|
|
9347
|
+
* @param {string} text - The replacement string.
|
|
9348
|
+
* @returns {void} No return value.
|
|
9349
|
+
*/
|
|
9350
|
+
setReplacement(text) {
|
|
9351
|
+
this.replacement = text;
|
|
9352
|
+
}
|
|
9353
|
+
/**
|
|
9354
|
+
* Replaces the current match with the stored replacement text,
|
|
9355
|
+
* advances to the next match, and refreshes highlights.
|
|
9356
|
+
* An empty replacement string deletes the matched text.
|
|
9357
|
+
*
|
|
9358
|
+
* No-op when there is no current match or no host.
|
|
9359
|
+
*
|
|
9360
|
+
* @returns {FindReplaceResult} Updated match position and total.
|
|
9361
|
+
*/
|
|
9362
|
+
replace() {
|
|
9363
|
+
const currentMatch = this.context.state.getCurrentMatch();
|
|
9364
|
+
if (currentMatch && this.context.hostRef && this.flushFn) {
|
|
9365
|
+
const previousIndex = this.context.state.getCurrentIndex();
|
|
9366
|
+
this.applyMatchReplacement(currentMatch);
|
|
9367
|
+
this.flushFn(this.context.hostRef.value);
|
|
9368
|
+
this.context.state.clear();
|
|
9369
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9370
|
+
// setCurrentIndex clamps to [0, total-1], so passing previousIndex
|
|
9371
|
+
// directly keeps the cursor as close as possible to the replaced position
|
|
9372
|
+
// rather than wrapping around when previousIndex >= total.
|
|
9373
|
+
this.context.state.setCurrentIndex(previousIndex);
|
|
9374
|
+
}
|
|
9375
|
+
return this.applyAndGetResult();
|
|
9376
|
+
}
|
|
9377
|
+
/**
|
|
9378
|
+
* Replaces all matches with the stored replacement text in a single operation
|
|
9379
|
+
* (one flushValue call = one Undo step), then re-runs the search.
|
|
9380
|
+
* An empty replacement string deletes all matched text.
|
|
9381
|
+
*
|
|
9382
|
+
* No-op when there are no matches or no host.
|
|
9383
|
+
*
|
|
9384
|
+
* @returns {FindReplaceResult} Updated match position and total.
|
|
9385
|
+
*/
|
|
9386
|
+
replaceAll() {
|
|
9387
|
+
if (this.context.state.getTotal() > 0 && this.flushFn && this.context.hostRef) {
|
|
9388
|
+
const matches = this.context.state.getMatches();
|
|
9389
|
+
// Iterate in reverse so that mutating a later match does not shift the
|
|
9390
|
+
// startOffset/endOffset of earlier matches that have not yet been processed.
|
|
9391
|
+
for (let i = matches.length - 1; i >= 0; i -= 1) {
|
|
9392
|
+
this.applyMatchReplacement(matches[i]);
|
|
9393
|
+
}
|
|
9394
|
+
this.flushFn(this.context.hostRef.value);
|
|
9395
|
+
this.context.state.clear();
|
|
9396
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9397
|
+
}
|
|
9398
|
+
return this.applyAndGetResult();
|
|
9399
|
+
}
|
|
9400
|
+
// ─── Private ──────────────────────────────────────────────────────────────────
|
|
9401
|
+
/**
|
|
9402
|
+
* Directly mutates the matched nodes in the live content tree.
|
|
9403
|
+
* `position.node` is already a reference into `this.context.hostRef.value`,
|
|
9404
|
+
* so no cloning or path navigation is needed.
|
|
9405
|
+
*
|
|
9406
|
+
* For multi-node (cross-span) matches the first node receives the replacement
|
|
9407
|
+
* text and every subsequent node has its matched slice deleted.
|
|
9408
|
+
*
|
|
9409
|
+
* This method mutates the content tree in place. The caller is
|
|
9410
|
+
* responsible for calling `state.clear()` afterwards to invalidate the
|
|
9411
|
+
* flat-text cache, which uses reference equality and will not detect the
|
|
9412
|
+
* in-place change automatically.
|
|
9413
|
+
*
|
|
9414
|
+
* @param {FindMatch} match - The match to replace.
|
|
9415
|
+
* @returns {void} No return value.
|
|
9416
|
+
*/
|
|
9417
|
+
applyMatchReplacement(match) {
|
|
9418
|
+
match.nodes.forEach((position, index) => {
|
|
9419
|
+
const replacementText = index === 0 ? this.replacement : '';
|
|
9420
|
+
position.node.text =
|
|
9421
|
+
position.node.text.slice(0, position.startOffset) +
|
|
9422
|
+
replacementText +
|
|
9423
|
+
position.node.text.slice(position.endOffset);
|
|
9424
|
+
});
|
|
9425
|
+
}
|
|
9426
|
+
}
|
|
9427
|
+
|
|
9428
|
+
/**
|
|
9429
|
+
* Toolbar button renderer for the Find & Replace extension.
|
|
9430
|
+
*
|
|
9431
|
+
* Responsible only for UI concerns:
|
|
9432
|
+
* - Renders the toolbar button wrapped in a vega-popover.
|
|
9433
|
+
* - Wires panel events to the {@link FindController} and {@link ReplaceController}.
|
|
9434
|
+
* - Pushes controller results back to the panel display.
|
|
9435
|
+
*
|
|
9436
|
+
* Both controllers share a single {@link FindReplaceControllerContext} so they
|
|
9437
|
+
* operate on the same search state and highlight overlays.
|
|
9438
|
+
*/
|
|
9439
|
+
class FindReplaceToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
9440
|
+
constructor() {
|
|
9441
|
+
super(...arguments);
|
|
9442
|
+
this.sharedContext = createFindReplaceControllerContext();
|
|
9443
|
+
this.findController = new FindController(this.sharedContext);
|
|
9444
|
+
this.replaceController = new ReplaceController(this.sharedContext);
|
|
9445
|
+
this.panelRef = null;
|
|
9446
|
+
this.popoverRef = null;
|
|
9447
|
+
this.isPopoverOpen = false;
|
|
9448
|
+
this.scrollOnNextRefresh = false;
|
|
9449
|
+
this.debouncedRefresh = debounce(this.onContentChanged, 100, this);
|
|
9450
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
9451
|
+
this.panelActionHandlers = {
|
|
9452
|
+
'find': () => this.findController.find(),
|
|
9453
|
+
'prev': () => this.findController.prev(),
|
|
9454
|
+
'next': () => this.findController.next(),
|
|
9455
|
+
'replace': () => {
|
|
9456
|
+
this.scrollOnNextRefresh = true;
|
|
9457
|
+
return this.replaceController.replace();
|
|
9458
|
+
},
|
|
9459
|
+
'replace-all': () => {
|
|
9460
|
+
this.scrollOnNextRefresh = true;
|
|
9461
|
+
return this.replaceController.replaceAll();
|
|
9462
|
+
},
|
|
9463
|
+
'match-case': (data) => this.findController.setMatchCase(data),
|
|
9464
|
+
'whole-words': (data) => this.findController.setWholeWords(data),
|
|
9465
|
+
'close': () => this.closePanel(),
|
|
9466
|
+
};
|
|
9467
|
+
}
|
|
9468
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
9469
|
+
/**
|
|
9470
|
+
* @inheritDoc
|
|
9471
|
+
*/
|
|
9472
|
+
render(h, editorContext) {
|
|
9473
|
+
this.syncEditorState(editorContext);
|
|
9474
|
+
return h('vega-popover', {
|
|
9475
|
+
trigger: 'none',
|
|
9476
|
+
alignment: 'start',
|
|
9477
|
+
placement: 'bottom',
|
|
9478
|
+
showArrow: false,
|
|
9479
|
+
isScreenPosition: true,
|
|
9480
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
9481
|
+
ref: (ref) => {
|
|
9482
|
+
if (ref) {
|
|
9483
|
+
this.popoverRef = ref;
|
|
9484
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaPopoverHide, () => {
|
|
9485
|
+
this.isPopoverOpen = false;
|
|
9486
|
+
this.findController.clear();
|
|
9487
|
+
this.updatePanel({ current: 0, total: 0 });
|
|
9488
|
+
});
|
|
9489
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaPopoverShow, () => {
|
|
9490
|
+
this.isPopoverOpen = true;
|
|
9491
|
+
});
|
|
9492
|
+
}
|
|
9493
|
+
},
|
|
9494
|
+
}, [
|
|
9495
|
+
h('div', { slot: 'popover' }, [
|
|
9496
|
+
h('vega-rich-text-find-replace-panel', {
|
|
9497
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
9498
|
+
ref: (ref) => {
|
|
9499
|
+
if (ref) {
|
|
9500
|
+
this.panelRef = ref;
|
|
9501
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, (e) => {
|
|
9502
|
+
if (e.detail.type === 'keyword') {
|
|
9503
|
+
this.updatePanel(this.findController.setKeyword(e.detail.value));
|
|
9504
|
+
}
|
|
9505
|
+
else if (e.detail.type === 'replace') {
|
|
9506
|
+
this.replaceController.setReplacement(e.detail.value);
|
|
9507
|
+
}
|
|
9508
|
+
});
|
|
9509
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaClick, (payload) => {
|
|
9510
|
+
this.handlePanelAction(payload.detail);
|
|
9511
|
+
});
|
|
9512
|
+
}
|
|
9513
|
+
},
|
|
9514
|
+
}),
|
|
9515
|
+
]),
|
|
9516
|
+
h('div', { slot: 'popover-content' }, this.renderButton(h, editorContext, {
|
|
9517
|
+
icon: 'rte-find-replace',
|
|
9518
|
+
tooltip: { text: VegaInternalTranslation.t('Find and replace') },
|
|
9519
|
+
})),
|
|
9520
|
+
]);
|
|
9521
|
+
}
|
|
9522
|
+
/**
|
|
9523
|
+
* Toggles the popover open/close when the toolbar button is clicked.
|
|
9524
|
+
*/
|
|
9525
|
+
handleButtonClick() {
|
|
9526
|
+
if (this.popoverRef) {
|
|
9527
|
+
if (this.isPopoverOpen) {
|
|
9528
|
+
void this.popoverRef.hide();
|
|
9529
|
+
}
|
|
9530
|
+
else {
|
|
9531
|
+
void this.popoverRef.show();
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9534
|
+
}
|
|
9535
|
+
/* istanbul ignore next */
|
|
9536
|
+
/**
|
|
9537
|
+
* Not used — this button has no dropdown.
|
|
9538
|
+
*/
|
|
9539
|
+
handleDropdownClick() {
|
|
9540
|
+
// no-op
|
|
9541
|
+
}
|
|
9542
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
9543
|
+
/**
|
|
9544
|
+
* Synchronizes internal state with the editor context on each render cycle.
|
|
9545
|
+
* Registers the host reference and content-change listener, and hides the
|
|
9546
|
+
* popover if the toolbar item becomes hidden while open.
|
|
9547
|
+
*
|
|
9548
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context.
|
|
9549
|
+
*/
|
|
9550
|
+
syncEditorState(editorContext) {
|
|
9551
|
+
this.findController.setHost(editorContext.host);
|
|
9552
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
9553
|
+
if (extensionContext) {
|
|
9554
|
+
this.replaceController.setFlushValue(extensionContext.flushValue);
|
|
9555
|
+
}
|
|
9556
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(editorContext.host, VegaChange, this.debouncedRefresh);
|
|
9557
|
+
if (this.isHidden(editorContext) && this.isPopoverOpen && this.popoverRef) {
|
|
9558
|
+
void this.popoverRef.hide();
|
|
9559
|
+
}
|
|
9560
|
+
}
|
|
9561
|
+
/**
|
|
9562
|
+
* Dispatches panel button actions to the controller.
|
|
9563
|
+
*
|
|
9564
|
+
* @param {FindReplacePanelAction} panelAction - The structured action emitted by the panel.
|
|
9565
|
+
*/
|
|
9566
|
+
handlePanelAction(panelAction) {
|
|
9567
|
+
const { action, data } = panelAction;
|
|
9568
|
+
const handler = this.panelActionHandlers[action];
|
|
9569
|
+
if (handler) {
|
|
9570
|
+
const result = handler(data);
|
|
9571
|
+
if (result) {
|
|
9572
|
+
this.updatePanel(result);
|
|
9573
|
+
}
|
|
9574
|
+
}
|
|
9575
|
+
}
|
|
9576
|
+
/**
|
|
9577
|
+
* Pushes result to the panel counter display.
|
|
9578
|
+
*
|
|
9579
|
+
* @param {FindReplaceResult} result - The current/total values.
|
|
9580
|
+
*/
|
|
9581
|
+
updatePanel(result) {
|
|
9582
|
+
if (this.panelRef) {
|
|
9583
|
+
void this.panelRef.updateResult(result.current, result.total);
|
|
9584
|
+
}
|
|
9585
|
+
}
|
|
9586
|
+
/**
|
|
9587
|
+
* Content changed — ask the controller to refresh search results.
|
|
9588
|
+
*/
|
|
9589
|
+
onContentChanged() {
|
|
9590
|
+
if (!this.isPopoverOpen) {
|
|
9591
|
+
return;
|
|
9592
|
+
}
|
|
9593
|
+
const shouldScroll = this.scrollOnNextRefresh;
|
|
9594
|
+
this.scrollOnNextRefresh = false;
|
|
9595
|
+
const result = this.findController.refresh(shouldScroll);
|
|
9596
|
+
if (result) {
|
|
9597
|
+
this.updatePanel(result);
|
|
9598
|
+
}
|
|
9599
|
+
}
|
|
9600
|
+
/**
|
|
9601
|
+
* Closes the panel popover.
|
|
9602
|
+
*/
|
|
9603
|
+
closePanel() {
|
|
9604
|
+
if (this.popoverRef) {
|
|
9605
|
+
void this.popoverRef.hide();
|
|
9606
|
+
}
|
|
9607
|
+
}
|
|
9608
|
+
}
|
|
9609
|
+
(() => {
|
|
9610
|
+
VegaInternalIconManager.register({ 'rte-find-replace': findReplaceIcon });
|
|
9611
|
+
})();
|
|
9612
|
+
|
|
9613
|
+
/**
|
|
9614
|
+
* Find & Replace extension for Vega Rich Text Editor.
|
|
9615
|
+
*
|
|
9616
|
+
* Registers a toolbar button (magnifying-glass icon) that toggles the find-replace panel.
|
|
9617
|
+
* Each editor host gets its own isolated FindReplaceState and toolbar renderer instance,
|
|
9618
|
+
* created during the per-host prepareBeforeLoad lifecycle hook.
|
|
9619
|
+
*
|
|
9620
|
+
* Toolbar key: 'findReplace'
|
|
9621
|
+
*/
|
|
9622
|
+
class VegaRTEFindReplaceExtension extends VegaRTEExtension {
|
|
9623
|
+
/** @inheritDoc */
|
|
9624
|
+
prepareBeforeLoad(host) {
|
|
9625
|
+
this.registerToolbarButtonRenderer(VegaRTEFindReplaceExtension.TOOLBAR_BUTTON_KEY, new FindReplaceToolbarButtonRenderer(), host);
|
|
9626
|
+
}
|
|
9627
|
+
}
|
|
9628
|
+
VegaRTEFindReplaceExtension.TOOLBAR_BUTTON_KEY = 'findReplace';
|
|
9629
|
+
|
|
9630
|
+
/**
|
|
9631
|
+
* Default line height options used by the line-height extension when no
|
|
9632
|
+
* custom options are provided.
|
|
9633
|
+
*/
|
|
9634
|
+
const VegaRTEDefaultLineHeightOptions = [
|
|
9635
|
+
{ title: '0.5', value: '0.5' },
|
|
9636
|
+
{ title: '1', value: '1' },
|
|
9637
|
+
{ title: '1.5', value: '1.5' },
|
|
9638
|
+
{ title: '2', value: '2' },
|
|
9639
|
+
{ title: '2.5', value: '2.5' },
|
|
9640
|
+
];
|
|
9641
|
+
|
|
9642
|
+
var RTELineHeightExtensionAnnotationTypeEnum;
|
|
9643
|
+
(function (RTELineHeightExtensionAnnotationTypeEnum) {
|
|
9644
|
+
RTELineHeightExtensionAnnotationTypeEnum["LINE_HEIGHT"] = "LINE_HEIGHT";
|
|
9645
|
+
})(RTELineHeightExtensionAnnotationTypeEnum || (RTELineHeightExtensionAnnotationTypeEnum = {}));
|
|
9646
|
+
/**
|
|
9647
|
+
* Annotation to set block line height.
|
|
9648
|
+
*/
|
|
9649
|
+
class LineHeightAnnotation extends BlockAnnotation {
|
|
9650
|
+
constructor(lineHeight) {
|
|
9651
|
+
super();
|
|
9652
|
+
this.type = RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT;
|
|
9653
|
+
this.lineHeight = lineHeight;
|
|
9654
|
+
}
|
|
9655
|
+
/**
|
|
9656
|
+
* Generate the map item for the annotation.
|
|
9657
|
+
*
|
|
9658
|
+
* @param {string} lineHeight - Line height value.
|
|
9659
|
+
* @returns {[RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT, LineHeightAnnotation]} Map item for the annotation.
|
|
9660
|
+
*/
|
|
9661
|
+
static from(lineHeight) {
|
|
9662
|
+
return [RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT, new LineHeightAnnotation(lineHeight)];
|
|
9663
|
+
}
|
|
9664
|
+
/**
|
|
9665
|
+
* Get the default standalone styles for a given line height value.
|
|
9666
|
+
*
|
|
9667
|
+
* @param {string} lineHeight - The line height value.
|
|
9668
|
+
* @returns {AnnotationStyle} The default standalone styles.
|
|
9669
|
+
*/
|
|
9670
|
+
static getDefaultStyles(lineHeight) {
|
|
9671
|
+
return { lineHeight };
|
|
9672
|
+
}
|
|
9673
|
+
/**
|
|
9674
|
+
* Generate the JSON item of the annotation.
|
|
9675
|
+
*
|
|
9676
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation.
|
|
9677
|
+
*/
|
|
9678
|
+
toJSON() {
|
|
9679
|
+
return {
|
|
9680
|
+
lineHeight: this.lineHeight,
|
|
9681
|
+
};
|
|
9682
|
+
}
|
|
9683
|
+
/**
|
|
9684
|
+
* @inheritDoc
|
|
9685
|
+
*/
|
|
9686
|
+
renderClass() {
|
|
9687
|
+
return null;
|
|
9688
|
+
}
|
|
9689
|
+
/**
|
|
9690
|
+
* @inheritDoc
|
|
9691
|
+
*/
|
|
9692
|
+
clone() {
|
|
9693
|
+
return new LineHeightAnnotation(this.lineHeight);
|
|
9694
|
+
}
|
|
9695
|
+
/**
|
|
9696
|
+
* @inheritDoc
|
|
9697
|
+
*/
|
|
9698
|
+
renderStyle() {
|
|
9699
|
+
return LineHeightAnnotation.getDefaultStyles(this.lineHeight);
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9702
|
+
|
|
9703
|
+
/**
|
|
9704
|
+
* Action to update block line height annotation.
|
|
9705
|
+
*/
|
|
9706
|
+
class LineHeightAnnotationAction extends AnnotationAction {
|
|
9707
|
+
constructor(lineHeight) {
|
|
9708
|
+
super();
|
|
9709
|
+
this.isFlushable = true;
|
|
9710
|
+
this.lineHeight = lineHeight;
|
|
9711
|
+
}
|
|
9712
|
+
/**
|
|
9713
|
+
* Converts the action to an annotation.
|
|
9714
|
+
*
|
|
9715
|
+
* @returns {LineHeightAnnotation} The annotation.
|
|
9716
|
+
*/
|
|
9717
|
+
toAnnotation() {
|
|
9718
|
+
return new LineHeightAnnotation(this.lineHeight);
|
|
9719
|
+
}
|
|
9720
|
+
}
|
|
9721
|
+
|
|
9722
|
+
/**
|
|
9723
|
+
* Update the block line height strategy.
|
|
9724
|
+
*
|
|
9725
|
+
* Registered for RTETextBlock and RTEListItemBlock, so the
|
|
9726
|
+
* target type is widened to the common RTEBlock base.
|
|
9727
|
+
*/
|
|
9728
|
+
class BlockUpdateLineHeightStrategy extends ActionHandleStrategy {
|
|
9729
|
+
/**
|
|
9730
|
+
* Updating the line height of a block requires cascading updates to the custom style.
|
|
9731
|
+
*
|
|
9732
|
+
* @param {LineHeightAnnotationAction} _action - The line height annotation action.
|
|
9733
|
+
* @param {RTEBlock} target - The current block.
|
|
9734
|
+
*/
|
|
9735
|
+
handleAction(_action, target) {
|
|
9736
|
+
this.updateCustomStyleAnnotation(target, ['lineHeight']);
|
|
9737
|
+
}
|
|
9738
|
+
}
|
|
9739
|
+
|
|
9740
|
+
const lineHeight = {
|
|
9741
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M113.8 39.9c-4.6-5.1-11-7.9-17.8-7.9s-13.3 2.9-17.8 7.9l-72 80c-8.9 9.9-8.1 25 1.8 33.9s25 8.1 33.9-1.8L72 118.5V393.5L41.8 359.9c-8.9-9.9-24-10.7-33.9-1.8s-10.7 24-1.8 33.9l72 80c4.6 5.1 11 7.9 17.8 7.9s13.3-2.9 17.8-7.9l72-80c8.9-9.9 8.1-25-1.8-33.9s-25-8.1-33.9 1.8L120 393.5V118.5l30.2 33.5c8.9 9.9 24 10.7 33.9 1.8s10.7-24 1.8-33.9l-72-80zM248 72c-13.3 0-24 10.7-24 24s10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248zm0 160c-13.3 0-24 10.7-24 24s10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248zM224 416c0 13.3 10.7 24 24 24H552c13.3 0 24-10.7 24-24s-10.7-24-24-24H248c-13.3 0-24 10.7-24 24z"/></svg>`,
|
|
9742
|
+
};
|
|
9743
|
+
|
|
9744
|
+
/**
|
|
9745
|
+
* Renderer for the line-height toolbar button in the Vega Rich Text Editor.
|
|
9746
|
+
*/
|
|
9747
|
+
class RTELineHeightToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
9748
|
+
constructor(options) {
|
|
9749
|
+
super();
|
|
9750
|
+
this.options = options;
|
|
9751
|
+
}
|
|
9752
|
+
/**
|
|
9753
|
+
* @inheritDoc
|
|
9754
|
+
*/
|
|
9755
|
+
render(createElement, editorContext) {
|
|
9756
|
+
const dropdownItems = this.options.map((item) => {
|
|
9757
|
+
var _a;
|
|
9758
|
+
return ({
|
|
9759
|
+
key: item.value,
|
|
9760
|
+
label: (_a = item.title) !== null && _a !== void 0 ? _a : item.value,
|
|
9761
|
+
});
|
|
9762
|
+
});
|
|
9763
|
+
return this.renderDropdown(createElement, editorContext, {
|
|
9764
|
+
selectType: 'single',
|
|
9765
|
+
selectedSourceKey: this.getSelectedSourceValue(editorContext),
|
|
9766
|
+
}, [
|
|
9767
|
+
this.renderButton(createElement, editorContext, {
|
|
9768
|
+
icon: 'line-height',
|
|
9769
|
+
showArrowIcon: true,
|
|
9770
|
+
tooltip: { text: VegaInternalTranslation.t('Line Height') },
|
|
9771
|
+
}),
|
|
9772
|
+
this.renderDropdownListTemplate(createElement, dropdownItems, editorContext),
|
|
9773
|
+
]);
|
|
9774
|
+
}
|
|
9775
|
+
/**
|
|
9776
|
+
* @inheritDoc
|
|
9777
|
+
*/
|
|
9778
|
+
isSelected() {
|
|
9779
|
+
return false;
|
|
9780
|
+
}
|
|
9781
|
+
/**
|
|
9782
|
+
* @inheritDoc
|
|
9783
|
+
*/
|
|
9784
|
+
isDisabled(editorContext) {
|
|
9785
|
+
var _a;
|
|
9786
|
+
if (editorContext.host.disabled) {
|
|
9787
|
+
return true;
|
|
9788
|
+
}
|
|
9789
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
9790
|
+
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
9791
|
+
if (selectedNodes.some((node) => {
|
|
9792
|
+
var _a;
|
|
9793
|
+
return ((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
9794
|
+
node.parent instanceof RTECodeBlock;
|
|
9795
|
+
})) {
|
|
9796
|
+
return true;
|
|
9797
|
+
}
|
|
9798
|
+
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
9799
|
+
return selectedBlocks.some((block) => block instanceof RTECodeBlock ||
|
|
9800
|
+
block instanceof RTEImageBlock ||
|
|
9801
|
+
!ActionHandleStrategyRegistry.canHandle(LineHeightAnnotationAction.name, block));
|
|
9802
|
+
}
|
|
9803
|
+
/**
|
|
9804
|
+
* @inheritDoc
|
|
9805
|
+
*/
|
|
9806
|
+
handleDropdownClick(itemValue, editorContext) {
|
|
9807
|
+
const selectedLineHeight = itemValue;
|
|
9808
|
+
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
9809
|
+
selectedBlocks.forEach((block) => {
|
|
9810
|
+
block.apply(new LineHeightAnnotationAction(selectedLineHeight));
|
|
9811
|
+
});
|
|
9812
|
+
}
|
|
9813
|
+
/**
|
|
9814
|
+
* Handle direct toolbar button click.
|
|
9815
|
+
*/
|
|
9816
|
+
handleButtonClick() {
|
|
9817
|
+
// No direct click action; selection happens in dropdown options.
|
|
9818
|
+
}
|
|
9819
|
+
/**
|
|
9820
|
+
* Get the selected line-height key for dropdown selection state.
|
|
9821
|
+
*
|
|
9822
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - Current toolbar context.
|
|
9823
|
+
* @returns {string} Selected line-height key or empty string for mixed/none.
|
|
9824
|
+
*/
|
|
9825
|
+
getSelectedSourceValue(editorContext) {
|
|
9826
|
+
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
9827
|
+
if (selectedBlocks.length === 0) {
|
|
9828
|
+
return '';
|
|
9829
|
+
}
|
|
9830
|
+
const firstAnnotation = selectedBlocks[0].getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
9831
|
+
const isSameLineHeight = selectedBlocks.every((block) => {
|
|
9832
|
+
const annotation = block.getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
9833
|
+
return (annotation === null || annotation === void 0 ? void 0 : annotation.lineHeight) === (firstAnnotation === null || firstAnnotation === void 0 ? void 0 : firstAnnotation.lineHeight);
|
|
9834
|
+
});
|
|
9835
|
+
return isSameLineHeight && firstAnnotation ? firstAnnotation.lineHeight : '';
|
|
9836
|
+
}
|
|
9837
|
+
/**
|
|
9838
|
+
* Resolve selected blocks from selected nodes with range fallback.
|
|
9839
|
+
*
|
|
9840
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - Current toolbar context.
|
|
9841
|
+
* @returns {RTEBlock[]} Selected blocks.
|
|
9842
|
+
*/
|
|
9843
|
+
getSelectedBlocks(editorContext) {
|
|
9844
|
+
var _a, _b;
|
|
9845
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
9846
|
+
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
9847
|
+
const selectedBlocks = [];
|
|
9848
|
+
selectedNodes.forEach((node) => {
|
|
9849
|
+
if (node.parent instanceof RTEBlock && !selectedBlocks.includes(node.parent)) {
|
|
9850
|
+
selectedBlocks.push(node.parent);
|
|
9851
|
+
}
|
|
9852
|
+
});
|
|
9853
|
+
if (selectedBlocks.length === 0 && ((_b = editorContext.rteRange.startNode) === null || _b === void 0 ? void 0 : _b.parent) instanceof RTEBlock) {
|
|
9854
|
+
selectedBlocks.push(editorContext.rteRange.startNode.parent);
|
|
9855
|
+
}
|
|
9856
|
+
return selectedBlocks;
|
|
9857
|
+
}
|
|
9858
|
+
}
|
|
9859
|
+
(() => {
|
|
9860
|
+
VegaInternalIconManager.register({
|
|
9861
|
+
'line-height': lineHeight,
|
|
9862
|
+
});
|
|
9863
|
+
})();
|
|
9864
|
+
|
|
9865
|
+
const LINE_HEIGHT_AWARE_BLOCK_NAMES = new Set([
|
|
9866
|
+
RTETextBlock.name,
|
|
9867
|
+
RTEListItemBlock.name,
|
|
9868
|
+
]);
|
|
9869
|
+
/** Handle line height annotation. */
|
|
9870
|
+
class LineHeightAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
9871
|
+
constructor(options = VegaRTEDefaultLineHeightOptions) {
|
|
9872
|
+
super();
|
|
9873
|
+
this.allowedLineHeights = new Set(options.map((option) => option.value));
|
|
9874
|
+
}
|
|
9875
|
+
/**
|
|
9876
|
+
* Can be handled.
|
|
9877
|
+
*
|
|
9878
|
+
* @param {RTEDtoClassPrototype} targetDto - Target DTO.
|
|
9879
|
+
* @returns {boolean} Whether the target DTO supports line-height annotations.
|
|
9880
|
+
*/
|
|
9881
|
+
canHandle(targetDto) {
|
|
9882
|
+
return LINE_HEIGHT_AWARE_BLOCK_NAMES.has(targetDto.name);
|
|
9883
|
+
}
|
|
9884
|
+
/**
|
|
9885
|
+
* Extract inline `line-height` as a semantic `lineHeight` annotation.
|
|
9886
|
+
*
|
|
9887
|
+
* @param {HTMLElement} [element] - Current element.
|
|
9888
|
+
* @returns {VegaRTEBlockAnnotations} `{ lineHeight }` when present, otherwise `{}`.
|
|
9889
|
+
*/
|
|
9890
|
+
handle(element) {
|
|
8672
9891
|
var _a, _b;
|
|
8673
9892
|
const lineHeight = (_b = (_a = element === null || element === void 0 ? void 0 : element.style.lineHeight) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
|
|
8674
9893
|
if (!lineHeight) {
|
|
@@ -8807,7 +10026,7 @@ class VegaRTELineHeightExtension extends VegaRTEExtension {
|
|
|
8807
10026
|
*/
|
|
8808
10027
|
prepareBeforeLoad(host) {
|
|
8809
10028
|
this.toolbarButtonRenderer = new RTELineHeightToolbarButtonRenderer(this.options);
|
|
8810
|
-
this.registerToolbarButtonRenderer(
|
|
10029
|
+
this.registerToolbarButtonRenderer(VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer, host);
|
|
8811
10030
|
}
|
|
8812
10031
|
}
|
|
8813
10032
|
(() => {
|
|
@@ -8817,6 +10036,396 @@ class VegaRTELineHeightExtension extends VegaRTEExtension {
|
|
|
8817
10036
|
attachLineHeightFromJson(BlockClass);
|
|
8818
10037
|
});
|
|
8819
10038
|
})();
|
|
10039
|
+
VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY = 'lineHeight';
|
|
10040
|
+
|
|
10041
|
+
/**
|
|
10042
|
+
* Action to extract the currently selected content (HTML and plain text) from the editor.
|
|
10043
|
+
*
|
|
10044
|
+
* The action is read-only: it does not mutate the content state. The handling strategy resolves
|
|
10045
|
+
* the selected HTML and plain text and writes them directly to the clipboard.
|
|
10046
|
+
*
|
|
10047
|
+
* @example host.value.apply(new CopySelectedContentAction(selection, selectedNodes));
|
|
10048
|
+
*/
|
|
10049
|
+
class CopySelectedContentAction extends ModifyContentAction {
|
|
10050
|
+
constructor(selection, selectedNodes) {
|
|
10051
|
+
super();
|
|
10052
|
+
this.type = 'COPY_SELECTED_CONTENT_ACTION';
|
|
10053
|
+
this.selection = null;
|
|
10054
|
+
this.selectedNodes = [];
|
|
10055
|
+
// The result of the copy operation, which may be a Promise if the clipboard write is asynchronous.
|
|
10056
|
+
this.copyResult = null;
|
|
10057
|
+
this.selection = selection;
|
|
10058
|
+
this.selectedNodes = selectedNodes;
|
|
10059
|
+
}
|
|
10060
|
+
}
|
|
10061
|
+
|
|
10062
|
+
/**
|
|
10063
|
+
* Toolbar button renderer for the Copy extension.
|
|
10064
|
+
* Renders a toolbar button that copies the currently selected editor text to the clipboard.
|
|
10065
|
+
*/
|
|
10066
|
+
class RTECopyToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
10067
|
+
/**
|
|
10068
|
+
* Renders the copy toolbar button.
|
|
10069
|
+
*
|
|
10070
|
+
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
10071
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10072
|
+
* @returns {VegaRTERenderResult} - The toolbar button render result.
|
|
10073
|
+
*/
|
|
10074
|
+
render(h, editorContext) {
|
|
10075
|
+
return this.renderButton(h, editorContext, {
|
|
10076
|
+
icon: 'rte-copy',
|
|
10077
|
+
tooltip: { text: 'Copy' },
|
|
10078
|
+
});
|
|
10079
|
+
}
|
|
10080
|
+
/**
|
|
10081
|
+
* Determines if the copy button should be disabled.
|
|
10082
|
+
* Disabled when the editor is disabled or when no content is selected.
|
|
10083
|
+
*
|
|
10084
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10085
|
+
* @returns {boolean} - True if the button should be disabled.
|
|
10086
|
+
*/
|
|
10087
|
+
isDisabled(editorContext) {
|
|
10088
|
+
const context = this.getExtensionContext(editorContext.host);
|
|
10089
|
+
return (!context || context.host.disabled || !context.getSelection() || context.getSelection().isCollapsed);
|
|
10090
|
+
}
|
|
10091
|
+
/**
|
|
10092
|
+
* Handles the copy button click event.
|
|
10093
|
+
* Dispatches a copy action through `host.value`; the action handler extracts the current selection
|
|
10094
|
+
* and writes the resulting HTML and plain text content to the clipboard.
|
|
10095
|
+
*
|
|
10096
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10097
|
+
*/
|
|
10098
|
+
handleButtonClick(editorContext) {
|
|
10099
|
+
const context = this.getExtensionContext(editorContext.host);
|
|
10100
|
+
if (context && context.host) {
|
|
10101
|
+
context.host.value.apply(new CopySelectedContentAction(context.getSelection(), context.getSelectedNodes()));
|
|
10102
|
+
}
|
|
10103
|
+
}
|
|
10104
|
+
/*istanbul ignore next*/
|
|
10105
|
+
/**
|
|
10106
|
+
* Handles dropdown click event. Not applicable for the copy button, so it's left empty.
|
|
10107
|
+
*/
|
|
10108
|
+
handleDropdownClick() {
|
|
10109
|
+
}
|
|
10110
|
+
}
|
|
10111
|
+
(() => {
|
|
10112
|
+
VegaInternalIconManager.register({ 'rte-copy': copy });
|
|
10113
|
+
})();
|
|
10114
|
+
|
|
10115
|
+
/**
|
|
10116
|
+
* Strategy that extracts the HTML and plain text content of the current selection, stores the
|
|
10117
|
+
* result on the {@link CopySelectedContentAction} and writes it to the clipboard.
|
|
10118
|
+
*/
|
|
10119
|
+
class CopySelectedContentStrategy extends ActionHandleStrategy {
|
|
10120
|
+
/**
|
|
10121
|
+
* @inheritDoc
|
|
10122
|
+
*/
|
|
10123
|
+
handleAction(action) {
|
|
10124
|
+
const parentBlocks = this.getParentBlocks(action.selectedNodes);
|
|
10125
|
+
const { html, text } = this.getSelectedContent(action.selection, parentBlocks);
|
|
10126
|
+
if (text || html) {
|
|
10127
|
+
action.copyResult = this.copyToClipboard(html, text);
|
|
10128
|
+
}
|
|
10129
|
+
}
|
|
10130
|
+
/**
|
|
10131
|
+
* Extracts the HTML and text content from the current selection.
|
|
10132
|
+
*
|
|
10133
|
+
* `Range.cloneContents()` returns only the nodes inside the selection, dropping the ancestor chain
|
|
10134
|
+
* between the selection's common ancestor and its block. When the selection stays inside a single
|
|
10135
|
+
* block, those dropped ancestors carry the styling, so the cloned fragment is re-wrapped with
|
|
10136
|
+
* shallow clones of every ancestor from the common ancestor up to the block, preserving arbitrary
|
|
10137
|
+
* inline nesting (e.g. `block > strong > em > span > text`).
|
|
10138
|
+
*
|
|
10139
|
+
* When the selection covers the whole block (its common ancestor sits above the block) or spans
|
|
10140
|
+
* multiple blocks, each block is already kept by `cloneContents()`, so no re-wrapping is done.
|
|
10141
|
+
*
|
|
10142
|
+
* @param {Nullable<Selection>} selection - The current selection object.
|
|
10143
|
+
* @param {RTEBlock[]} parentBlocks - The parent blocks of the selected nodes.
|
|
10144
|
+
* @returns {RTESelectedContent} - The HTML and text content of the selected content.
|
|
10145
|
+
*/
|
|
10146
|
+
getSelectedContent(selection, parentBlocks) {
|
|
10147
|
+
const result = { html: '', text: '' };
|
|
10148
|
+
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
|
|
10149
|
+
return result;
|
|
10150
|
+
}
|
|
10151
|
+
const range = selection.getRangeAt(0);
|
|
10152
|
+
const doc = tryGetDocument();
|
|
10153
|
+
if (!doc) {
|
|
10154
|
+
return result;
|
|
10155
|
+
}
|
|
10156
|
+
// `cloneContents()` returns a `DocumentFragment` of real DOM nodes (already well-formed). Its
|
|
10157
|
+
// `textContent` is the plain text; the fragment itself is wrapped/serialized into HTML below.
|
|
10158
|
+
const fragment = range.cloneContents();
|
|
10159
|
+
// A `DocumentFragment` has no `innerHTML`, so a temporary element is used to serialize it to HTML.
|
|
10160
|
+
const container = doc.createElement('div');
|
|
10161
|
+
const commonAncestor = range.commonAncestorContainer;
|
|
10162
|
+
if (parentBlocks.length === 1) {
|
|
10163
|
+
const block = this.getDOMByEntity(parentBlocks[0]);
|
|
10164
|
+
// Only re-wrap when the block is dropped from the clone, i.e. the selection stays inside the
|
|
10165
|
+
// block. When the whole block is selected, `commonAncestor` sits above it and the clone
|
|
10166
|
+
// already keeps the block, so wrapping again would nest a duplicate block.
|
|
10167
|
+
if (block && block.contains(commonAncestor)) {
|
|
10168
|
+
// Wrap the cloned fragment with the dropped ancestor chain (from `commonAncestor` up to the
|
|
10169
|
+
// block), preserving each element's styles, then serialize the rebuilt block to HTML.
|
|
10170
|
+
const cloneNode = this.wrapWithAncestorChain(fragment, commonAncestor, block);
|
|
10171
|
+
container.appendChild(cloneNode);
|
|
10172
|
+
result.html = container.innerHTML;
|
|
10173
|
+
result.text = container.textContent;
|
|
10174
|
+
return result;
|
|
10175
|
+
}
|
|
10176
|
+
}
|
|
10177
|
+
else if (parentBlocks.length > 1 &&
|
|
10178
|
+
parentBlocks.every((block) => block.type === 'list-item')) {
|
|
10179
|
+
const firstList = parentBlocks[0].parent;
|
|
10180
|
+
if (firstList && parentBlocks.every((block) => block.parent === firstList)) {
|
|
10181
|
+
const listElement = this.getDOMByEntity(firstList);
|
|
10182
|
+
if (listElement && listElement.contains(commonAncestor)) {
|
|
10183
|
+
const cloneListElement = listElement.cloneNode(false);
|
|
10184
|
+
cloneListElement.appendChild(fragment);
|
|
10185
|
+
container.appendChild(cloneListElement);
|
|
10186
|
+
result.html = container.innerHTML;
|
|
10187
|
+
result.text = container.textContent;
|
|
10188
|
+
return result;
|
|
10189
|
+
}
|
|
10190
|
+
}
|
|
10191
|
+
}
|
|
10192
|
+
// The selection covers whole/multiple blocks: the clone already keeps them, so serialize as-is.
|
|
10193
|
+
container.appendChild(fragment);
|
|
10194
|
+
result.html = container.innerHTML;
|
|
10195
|
+
result.text = container.textContent;
|
|
10196
|
+
return result;
|
|
10197
|
+
}
|
|
10198
|
+
/**
|
|
10199
|
+
* Wraps the cloned selection fragment with the ancestor chain that `cloneContents()` dropped,
|
|
10200
|
+
* rebuilding every element from the selection's common ancestor up to the block while preserving
|
|
10201
|
+
* each element's styles. Returns the cloned block that holds the rebuilt chain and content.
|
|
10202
|
+
*
|
|
10203
|
+
* When the common ancestor is the block itself, the fragment is appended directly under the cloned
|
|
10204
|
+
* block, since no inline ancestor chain was dropped.
|
|
10205
|
+
*
|
|
10206
|
+
* @param {Node} content - The cloned selection fragment to place at the innermost level.
|
|
10207
|
+
* @param {Node} commonAncestor - The selection's common ancestor container.
|
|
10208
|
+
* @param {HTMLElement} block - The block element to stop cloning at.
|
|
10209
|
+
* @returns {HTMLElement} - The cloned block wrapping the rebuilt ancestor chain and content.
|
|
10210
|
+
*/
|
|
10211
|
+
wrapWithAncestorChain(content, commonAncestor, block) {
|
|
10212
|
+
const blockClone = block.cloneNode(false);
|
|
10213
|
+
// `cloneContents()` keeps everything inside `commonAncestor`, so the dropped chain runs from
|
|
10214
|
+
// `commonAncestor` (its element, when the ancestor is a text node) up to the block.
|
|
10215
|
+
const targetElement = commonAncestor.nodeType === Node.TEXT_NODE
|
|
10216
|
+
? commonAncestor.parentElement
|
|
10217
|
+
: commonAncestor;
|
|
10218
|
+
// The target is the block itself: the content sits directly under the block, no chain to rebuild.
|
|
10219
|
+
if (targetElement === block) {
|
|
10220
|
+
blockClone.appendChild(content);
|
|
10221
|
+
return blockClone;
|
|
10222
|
+
}
|
|
10223
|
+
// Clone the target as the innermost container and place the content inside it.
|
|
10224
|
+
const innermost = targetElement.cloneNode(false);
|
|
10225
|
+
innermost.appendChild(content);
|
|
10226
|
+
// Walk up from the target to the block, cloning each ancestor and nesting the chain bottom-up.
|
|
10227
|
+
let shouldAppendNode = innermost;
|
|
10228
|
+
let current = targetElement.parentElement;
|
|
10229
|
+
while (current && current !== block) {
|
|
10230
|
+
const parentClone = current.cloneNode(false);
|
|
10231
|
+
parentClone.appendChild(shouldAppendNode);
|
|
10232
|
+
shouldAppendNode = parentClone;
|
|
10233
|
+
current = current.parentElement;
|
|
10234
|
+
}
|
|
10235
|
+
// Append the assembled ancestor chain to the cloned block.
|
|
10236
|
+
blockClone.appendChild(shouldAppendNode);
|
|
10237
|
+
// When the block is a list item inside an ordered list, wrap the cloned list item with a
|
|
10238
|
+
// shallow clone of the ordered list to preserve the numbering.
|
|
10239
|
+
if (blockClone.tagName === 'LI' &&
|
|
10240
|
+
current &&
|
|
10241
|
+
current.parentElement &&
|
|
10242
|
+
current.parentElement.tagName === 'OL') {
|
|
10243
|
+
const cloneList = current.parentElement.cloneNode(false);
|
|
10244
|
+
cloneList.appendChild(blockClone);
|
|
10245
|
+
return cloneList;
|
|
10246
|
+
}
|
|
10247
|
+
return blockClone;
|
|
10248
|
+
}
|
|
10249
|
+
/**
|
|
10250
|
+
* Retrieves the parent blocks of the given selected nodes.
|
|
10251
|
+
*
|
|
10252
|
+
* @param {RTENode[]} selectedNodes - The nodes for which to find parent blocks.
|
|
10253
|
+
* @returns {RTEBlock[]} An array of parent blocks.
|
|
10254
|
+
*/
|
|
10255
|
+
getParentBlocks(selectedNodes) {
|
|
10256
|
+
const parentBlocks = [];
|
|
10257
|
+
for (const node of selectedNodes) {
|
|
10258
|
+
const block = node.parent;
|
|
10259
|
+
if (block && !parentBlocks.includes(block)) {
|
|
10260
|
+
parentBlocks.push(block);
|
|
10261
|
+
}
|
|
10262
|
+
}
|
|
10263
|
+
return parentBlocks;
|
|
10264
|
+
}
|
|
10265
|
+
/**
|
|
10266
|
+
* Copies both HTML and plain text content to the clipboard using the Clipboard API.
|
|
10267
|
+
*
|
|
10268
|
+
* Browser compatibility for `navigator.clipboard.write()` with `ClipboardItem`:
|
|
10269
|
+
* - Chrome 76+, Edge 79+, Safari 13.1+, Firefox 127+
|
|
10270
|
+
*
|
|
10271
|
+
* Since Firefox 86+ must be supported, fall back to `execCommand('copy')` when the
|
|
10272
|
+
* Clipboard API is unavailable or fails (e.g. Firefox 86-126).
|
|
10273
|
+
*
|
|
10274
|
+
* @param {string} htmlContent - The HTML content to copy.
|
|
10275
|
+
* @param {string} textContent - The plain text content to copy.
|
|
10276
|
+
* @returns {Promise<boolean>} - A promise that resolves to true if the copy operation succeeded.
|
|
10277
|
+
*/
|
|
10278
|
+
async copyToClipboard(htmlContent, textContent) {
|
|
10279
|
+
let result = false;
|
|
10280
|
+
try {
|
|
10281
|
+
const htmlBlob = new Blob([htmlContent], { type: 'text/html' });
|
|
10282
|
+
const textBlob = new Blob([textContent], { type: 'text/plain' });
|
|
10283
|
+
const clipboardItem = new ClipboardItem({
|
|
10284
|
+
'text/html': htmlBlob,
|
|
10285
|
+
'text/plain': textBlob,
|
|
10286
|
+
});
|
|
10287
|
+
await navigator.clipboard.write([clipboardItem]);
|
|
10288
|
+
result = true;
|
|
10289
|
+
}
|
|
10290
|
+
catch (_a) {
|
|
10291
|
+
// Fallback for browsers without ClipboardItem support (e.g. Firefox 86-126)
|
|
10292
|
+
result = this.copyWithExecCommand(htmlContent, textContent);
|
|
10293
|
+
if (!result) {
|
|
10294
|
+
LogUtility.warn('Failed to copy the selected content to the clipboard. Use keyboard shortcuts instead.');
|
|
10295
|
+
}
|
|
10296
|
+
}
|
|
10297
|
+
return result;
|
|
10298
|
+
}
|
|
10299
|
+
/**
|
|
10300
|
+
* Fallback copy method using `execCommand('copy')` for browsers that don't support the
|
|
10301
|
+
* Clipboard API (e.g. Firefox 86-126).
|
|
10302
|
+
*
|
|
10303
|
+
* Instead of creating a temporary element and changing the selection (which would clear the
|
|
10304
|
+
* editor's Shadow DOM selection and steal focus), this intercepts the native `copy` event that
|
|
10305
|
+
* `execCommand('copy')` triggers and overrides its clipboard data. The user's original selection
|
|
10306
|
+
* and focus stay untouched.
|
|
10307
|
+
*
|
|
10308
|
+
* @param {string} htmlContent - The HTML content to copy.
|
|
10309
|
+
* @param {string} textContent - The plain text content to copy.
|
|
10310
|
+
* @returns {boolean} - True if the copy command succeeded.
|
|
10311
|
+
*/
|
|
10312
|
+
copyWithExecCommand(htmlContent, textContent) {
|
|
10313
|
+
const doc = tryGetDocument();
|
|
10314
|
+
if (!doc) {
|
|
10315
|
+
return false;
|
|
10316
|
+
}
|
|
10317
|
+
/**
|
|
10318
|
+
* Overrides the clipboard data of the native copy event triggered by `execCommand('copy')`.
|
|
10319
|
+
*
|
|
10320
|
+
* @param {ClipboardEvent} event - The native copy event.
|
|
10321
|
+
*/
|
|
10322
|
+
const onCopy = (event) => {
|
|
10323
|
+
if (event.clipboardData) {
|
|
10324
|
+
event.clipboardData.setData('text/html', htmlContent);
|
|
10325
|
+
event.clipboardData.setData('text/plain', textContent);
|
|
10326
|
+
}
|
|
10327
|
+
event.preventDefault();
|
|
10328
|
+
};
|
|
10329
|
+
doc.addEventListener('copy', onCopy);
|
|
10330
|
+
try {
|
|
10331
|
+
return doc.execCommand('copy');
|
|
10332
|
+
}
|
|
10333
|
+
finally {
|
|
10334
|
+
doc.removeEventListener('copy', onCopy);
|
|
10335
|
+
}
|
|
10336
|
+
}
|
|
10337
|
+
}
|
|
10338
|
+
|
|
10339
|
+
/**
|
|
10340
|
+
* Vega Rich Text Editor Copy Extension.
|
|
10341
|
+
* Adds a toolbar button that copies the currently selected editor content to the clipboard.
|
|
10342
|
+
*/
|
|
10343
|
+
class VegaRTECopyExtension extends VegaRTEExtension {
|
|
10344
|
+
/** @inheritDoc */
|
|
10345
|
+
prepareBeforeLoad(host) {
|
|
10346
|
+
this.registerToolbarButtonRenderer(VegaRTECopyExtension.TOOLBAR_BUTTON_KEY, new RTECopyToolbarButtonRenderer(), host);
|
|
10347
|
+
}
|
|
10348
|
+
}
|
|
10349
|
+
(() => {
|
|
10350
|
+
ActionHandleStrategyRegistry.register('COPY_SELECTED_CONTENT_ACTION', VegaRTEContent.name, new CopySelectedContentStrategy());
|
|
10351
|
+
})();
|
|
10352
|
+
// The unique key for the copy toolbar button, used for registration and retrieval.
|
|
10353
|
+
VegaRTECopyExtension.TOOLBAR_BUTTON_KEY = 'copy';
|
|
10354
|
+
|
|
10355
|
+
const cutIcon = {
|
|
10356
|
+
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M48 112a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm176 0C224 50.1 173.9 0 112 0S0 50.1 0 112 50.1 224 112 224c24 0 46.3-7.6 64.5-20.4l57.3 52.4-57.3 52.4C158.3 295.6 136 288 112 288 50.1 288 0 338.1 0 400s50.1 112 112 112 112-50.1 112-112c0-20.5-5.5-39.6-15.1-56.2L504.2 73.7c9.8-8.9 10.5-24.1 1.5-33.9s-24.1-10.5-33.9-1.5l-202.4 185.2-60.5-55.3c9.6-16.5 15.1-35.7 15.1-56.2zM471.8 473.7c9.8 8.9 25 8.3 33.9-1.5s8.3-25-1.5-33.9L338.6 286.8 302.7 319 471.8 473.7zM48 400a64 64 0 1 1 128 0 64 64 0 1 1 -128 0z"/></svg>`,
|
|
10357
|
+
};
|
|
10358
|
+
|
|
10359
|
+
/**
|
|
10360
|
+
* Delete the currently selected content from the editor.
|
|
10361
|
+
*
|
|
10362
|
+
* @example currentVegaRTEContent.apply(new DeleteSelectedContentAction(host, mergeFlag))
|
|
10363
|
+
*/
|
|
10364
|
+
class DeleteSelectedContentAction extends ModifyContentAction {
|
|
10365
|
+
constructor(host, mergeFlag, flushable = false) {
|
|
10366
|
+
super();
|
|
10367
|
+
this.type = ModifyContentActionType.DELETE_SELECTED_CONTENT;
|
|
10368
|
+
// mergeFlag indicates whether the action should merge adjacent text nodes after deletion.
|
|
10369
|
+
this.mergeFlag = false;
|
|
10370
|
+
this.host = host;
|
|
10371
|
+
this.mergeFlag = mergeFlag;
|
|
10372
|
+
this.isFlushable = flushable;
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10375
|
+
|
|
10376
|
+
/**
|
|
10377
|
+
* Toolbar button renderer for the Cut extension.
|
|
10378
|
+
* Reuses the Copy renderer to write the selected editor content to the clipboard,
|
|
10379
|
+
* then removes the selected content from the editor.
|
|
10380
|
+
*/
|
|
10381
|
+
class RTECutToolbarButtonRenderer extends RTECopyToolbarButtonRenderer {
|
|
10382
|
+
/**
|
|
10383
|
+
* Renders the cut toolbar button.
|
|
10384
|
+
*
|
|
10385
|
+
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
10386
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10387
|
+
* @returns {VegaRTERenderResult} - The toolbar button render result.
|
|
10388
|
+
*/
|
|
10389
|
+
render(h, editorContext) {
|
|
10390
|
+
return this.renderButton(h, editorContext, {
|
|
10391
|
+
icon: 'rte-cut',
|
|
10392
|
+
tooltip: { text: 'Cut' },
|
|
10393
|
+
});
|
|
10394
|
+
}
|
|
10395
|
+
/**
|
|
10396
|
+
* Handles the cut button click event.
|
|
10397
|
+
* Copies the current editor selection to the clipboard and then deletes it from the editor.
|
|
10398
|
+
*
|
|
10399
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10400
|
+
*/
|
|
10401
|
+
async handleButtonClick(editorContext) {
|
|
10402
|
+
const context = this.getExtensionContext(editorContext.host);
|
|
10403
|
+
if (context && context.host) {
|
|
10404
|
+
const { host } = context;
|
|
10405
|
+
const copySelectedContentAction = new CopySelectedContentAction(context.getSelection(), context.getSelectedNodes());
|
|
10406
|
+
host.value.apply(copySelectedContentAction);
|
|
10407
|
+
const isCopySuccessful = await copySelectedContentAction.copyResult;
|
|
10408
|
+
isCopySuccessful && host.value.apply(new DeleteSelectedContentAction(host, true, true));
|
|
10409
|
+
}
|
|
10410
|
+
}
|
|
10411
|
+
}
|
|
10412
|
+
(() => {
|
|
10413
|
+
VegaInternalIconManager.register({ 'rte-cut': cutIcon });
|
|
10414
|
+
})();
|
|
10415
|
+
|
|
10416
|
+
/**
|
|
10417
|
+
* Vega Rich Text Editor Cut Extension.
|
|
10418
|
+
* Adds a toolbar button that copies the currently selected editor content to the clipboard
|
|
10419
|
+
* and removes it from the editor.
|
|
10420
|
+
*/
|
|
10421
|
+
class VegaRTECutExtension extends VegaRTEExtension {
|
|
10422
|
+
/** @inheritDoc */
|
|
10423
|
+
prepareBeforeLoad(host) {
|
|
10424
|
+
this.registerToolbarButtonRenderer(VegaRTECutExtension.TOOLBAR_BUTTON_KEY, new RTECutToolbarButtonRenderer(), host);
|
|
10425
|
+
}
|
|
10426
|
+
}
|
|
10427
|
+
// The unique key for the cut toolbar button, used for registration and retrieval.
|
|
10428
|
+
VegaRTECutExtension.TOOLBAR_BUTTON_KEY = 'cut';
|
|
8820
10429
|
|
|
8821
10430
|
/**
|
|
8822
10431
|
* Insert a new children to the nearest position of the parent container
|
|
@@ -8936,7 +10545,7 @@ class VegaRTETokenExtension extends VegaRTEExtension {
|
|
|
8936
10545
|
}
|
|
8937
10546
|
/** @inheritDoc */
|
|
8938
10547
|
prepareBeforeLoad(host) {
|
|
8939
|
-
this.registerToolbarButtonRenderer(
|
|
10548
|
+
this.registerToolbarButtonRenderer(VegaRTETokenExtension.TOOLBAR_BUTTON_KEY, new RTETokenToolbarButtonRenderer(this.tokenList), host);
|
|
8940
10549
|
}
|
|
8941
10550
|
}
|
|
8942
10551
|
(() => {
|
|
@@ -8944,5 +10553,6 @@ class VegaRTETokenExtension extends VegaRTEExtension {
|
|
|
8944
10553
|
VegaRTEExtension.registerActionHandleStrategy(RTETextBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
8945
10554
|
VegaRTEExtension.registerActionHandleStrategy(RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
8946
10555
|
})();
|
|
10556
|
+
VegaRTETokenExtension.TOOLBAR_BUTTON_KEY = 'token';
|
|
8947
10557
|
|
|
8948
|
-
export {
|
|
10558
|
+
export { RTETokenNodeRenderer as A, RTELanguageToolbarButtonRenderer as B, ActionHandlerInterceptor as C, DeleteSelectedContentAction as D, InsertNodeToNearestRootAction as I, RTETokenToolbarButtonRenderer as R, VegaLoader as V, VegaNotify as a, VegaEventManager$1 as b, VegaZIndexManager$1 as c, VegaSkeletonLoader as d, VegaTranslation as e, VegaRTETokenExtension as f, VegaRTELanguageExtension as g, VegaRTEDefaultLineHeightOptions as h, VegaRTEFunctionExtension as i, VegaRTETableExtension as j, VegaRTEHorizontalLineExtension as k, VegaRTESpecialCharactersExtension as l, VegaRTEFindReplaceExtension as m, VegaRTESpecialCharactersEssentials as n, VegaRTESpecialCharactersLatin as o, VegaRTESpecialCharactersMathematical as p, VegaRTESpecialCharactersArrows as q, VegaRTESpecialCharactersCurrency as r, VegaRTESpecialCharactersText as s, VegaRTELineHeightExtension as t, VegaRTECopyExtension as u, VegaRTECutExtension as v, waitForVega as w, VegaCalendarPeriodFactory as x, VegaRTEToolbarButtonRenderer as y, RTETokenNode as z };
|