@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
|
@@ -3,30 +3,32 @@
|
|
|
3
3
|
const misc = require('./misc-3d30df91.js');
|
|
4
4
|
const ui = require('./ui-c91c37a7.js');
|
|
5
5
|
const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
|
|
6
|
-
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-
|
|
6
|
+
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-91b0cbfb.js');
|
|
7
7
|
const internalVegaZIndexManager = require('./internal-vega-z-index-manager-f03ddb37.js');
|
|
8
8
|
const dynamicSlimmer = require('./dynamic-slimmer-f31fdfd7.js');
|
|
9
9
|
const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-273d62ef.js');
|
|
10
|
-
const internalVegaEventManager = require('./internal-vega-event-manager-
|
|
11
|
-
const internalTranslationController = require('./internal-translation-controller-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const codeBlock = require('./code-block-
|
|
15
|
-
const typeGuard = require('./type-guard-
|
|
16
|
-
const
|
|
10
|
+
const internalVegaEventManager = require('./internal-vega-event-manager-7196a847.js');
|
|
11
|
+
const internalTranslationController = require('./internal-translation-controller-48ebfd0f.js');
|
|
12
|
+
const internalCalendarPeriodFactory = require('./internal-calendar-period-factory-6187ec4c.js');
|
|
13
|
+
const contentState = require('./content-state-96ec9114.js');
|
|
14
|
+
const codeBlock = require('./code-block-6435d641.js');
|
|
15
|
+
const typeGuard = require('./type-guard-7ab48d6c.js');
|
|
16
|
+
const linkExtension = require('./link-extension-28d95849.js');
|
|
17
|
+
const internalIconManager = require('./internal-icon-manager-40bcac72.js');
|
|
17
18
|
const vegaNonceManager = require('./vega-nonce-manager-df69d3ed.js');
|
|
18
19
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-c82df135.js');
|
|
19
|
-
const vegaEventId = require('./vega-event-id-
|
|
20
|
-
const splitCellOperation = require('./split-cell-operation-
|
|
20
|
+
const vegaEventId = require('./vega-event-id-df22d80e.js');
|
|
21
|
+
const splitCellOperation = require('./split-cell-operation-9e3ab88d.js');
|
|
21
22
|
const changeManager = require('./change-manager-a297e4d2.js');
|
|
22
|
-
const vegaInternalEventId = require('./vega-internal-event-id-
|
|
23
|
+
const vegaInternalEventId = require('./vega-internal-event-id-ecc5b87a.js');
|
|
23
24
|
const remoteInvocationRegistry = require('./remote-invocation-registry-fc22fdd0.js');
|
|
24
25
|
const darkModeStyleController = require('./dark-mode-style-controller-32d4054a.js');
|
|
25
26
|
const tryGetDocument = require('./try-get-document-c0ebd39a.js');
|
|
26
27
|
const pixel = require('./pixel-98f2a10c.js');
|
|
27
28
|
const object = require('./object-b53e9416.js');
|
|
28
29
|
const timer = require('./timer-5f33058b.js');
|
|
29
|
-
const replaceSelectedTextAction = require('./replace-selected-text-action-
|
|
30
|
+
const replaceSelectedTextAction = require('./replace-selected-text-action-a31563ed.js');
|
|
31
|
+
const copy = require('./copy-d021c780.js');
|
|
30
32
|
|
|
31
33
|
const VegaLoaderRuntimeMetricsPayloadDefinition = [
|
|
32
34
|
{
|
|
@@ -82,7 +84,7 @@ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
82
84
|
*/
|
|
83
85
|
class VegaLoaderController {
|
|
84
86
|
constructor() {
|
|
85
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaLoaderController, ['load', 'close'], VegaLoaderRuntimeMetricsPayloadDefinition);
|
|
87
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaLoaderController, ['load', 'close'], VegaLoaderRuntimeMetricsPayloadDefinition, 'VegaLoaderController');
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Create a loading indicator and append it to the container
|
|
@@ -288,7 +290,7 @@ class VegaNotifyController {
|
|
|
288
290
|
target: () => this.container,
|
|
289
291
|
},
|
|
290
292
|
]);
|
|
291
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaNotifyController, ['open', 'close', 'closeAll'], VegaNotifyRuntimeMetricsPayloadDefinition);
|
|
293
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaNotifyController, ['open', 'close', 'closeAll'], VegaNotifyRuntimeMetricsPayloadDefinition, 'VegaNotifyController');
|
|
292
294
|
}
|
|
293
295
|
/**
|
|
294
296
|
* It creates a new notification element, adds it to the container, and returns the notification's ID
|
|
@@ -606,7 +608,7 @@ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
606
608
|
*/
|
|
607
609
|
class VegaEventManager {
|
|
608
610
|
constructor() {
|
|
609
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaEventManager, ['setSemantics', 'getSemantics', 'getEnabledEventIdsByComponent'], VegaEventManagerRuntimeMetricsPayloadDefinition);
|
|
611
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaEventManager, ['setSemantics', 'getSemantics', 'getEnabledEventIdsByComponent'], VegaEventManagerRuntimeMetricsPayloadDefinition, 'VegaEventManager');
|
|
610
612
|
}
|
|
611
613
|
/**
|
|
612
614
|
* The function sets the semantics configuration for event management.
|
|
@@ -705,7 +707,7 @@ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
705
707
|
*/
|
|
706
708
|
class VegaZIndexManager {
|
|
707
709
|
constructor() {
|
|
708
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaZIndexManager, ['overrideZIndexBasicValues'], ZIndexManagerRuntimeMetricsPayloadDefinition);
|
|
710
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaZIndexManager, ['overrideZIndexBasicValues'], ZIndexManagerRuntimeMetricsPayloadDefinition, 'VegaZIndexManager');
|
|
709
711
|
}
|
|
710
712
|
/**
|
|
711
713
|
* The function "overrideZIndexBasicValues" calls a method in the "ZIndexManager" class to change the
|
|
@@ -757,7 +759,7 @@ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
757
759
|
*/
|
|
758
760
|
class WaitForVegaHandler {
|
|
759
761
|
constructor() {
|
|
760
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(WaitForVegaHandler, ['handle'], WaitForVegaPayloadDefinition);
|
|
762
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(WaitForVegaHandler, ['handle'], WaitForVegaPayloadDefinition, 'WaitForVegaHandler');
|
|
761
763
|
}
|
|
762
764
|
/* istanbul ignore next */
|
|
763
765
|
/**
|
|
@@ -865,7 +867,7 @@ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
865
867
|
*/
|
|
866
868
|
class VegaSkeletonLoaderController {
|
|
867
869
|
constructor() {
|
|
868
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaSkeletonLoaderController, ['load', 'unLoad', 'unLoadAll'], VegaSkeletonRuntimeMetricsPayloadDefinition);
|
|
870
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(VegaSkeletonLoaderController, ['load', 'unLoad', 'unLoadAll'], VegaSkeletonRuntimeMetricsPayloadDefinition, 'VegaSkeletonLoaderController');
|
|
869
871
|
this.loaderMap = new Map();
|
|
870
872
|
}
|
|
871
873
|
/**
|
|
@@ -1014,7 +1016,7 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
|
|
|
1014
1016
|
*/
|
|
1015
1017
|
class TranslationController {
|
|
1016
1018
|
constructor() {
|
|
1017
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(TranslationController, ['init', 'changeLanguage'], VegaTranslationRuntimeMetricsPayloadDefinition);
|
|
1019
|
+
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(TranslationController, ['init', 'changeLanguage'], VegaTranslationRuntimeMetricsPayloadDefinition, 'TranslationController');
|
|
1018
1020
|
}
|
|
1019
1021
|
/**
|
|
1020
1022
|
* Get current language
|
|
@@ -1049,6 +1051,25 @@ __decorate([
|
|
|
1049
1051
|
], TranslationController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
1050
1052
|
const VegaTranslation = new TranslationController();
|
|
1051
1053
|
|
|
1054
|
+
/**
|
|
1055
|
+
* Factory class for creating CalendarPeriod instances.
|
|
1056
|
+
*/
|
|
1057
|
+
class VegaCalendarPeriodFactory {
|
|
1058
|
+
/**
|
|
1059
|
+
* Create a VegaCalendarCurrentPeriodType based on the specified view mode and date.
|
|
1060
|
+
*
|
|
1061
|
+
* @param {string} dateString - The date string to base the period on, in 'MM/DD/YYYY' format
|
|
1062
|
+
* @param {'month'|'week'|'day'} [viewMode='month'] - The view mode for the period, defaults to 'month'
|
|
1063
|
+
* @param {string} [timezone] - Optional timezone for the period calculation
|
|
1064
|
+
* @param {boolean} [showWeekends=true] - Whether to show weekends in the period, It's flag for calendar component, will effect the calendar view only.
|
|
1065
|
+
* @returns {VegaCalendarPeriodType} The period information containing year, month, startDate and endDate
|
|
1066
|
+
*/
|
|
1067
|
+
static fromDate(dateString, viewMode = 'month', timezone, showWeekends = true) {
|
|
1068
|
+
const period = internalCalendarPeriodFactory.InternalCalendarPeriodConverter.createCalendarPeriod(dateString, viewMode, timezone, showWeekends);
|
|
1069
|
+
return internalCalendarPeriodFactory.InternalCalendarPeriodConverter.toCalendarPeriodType(period);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1052
1073
|
/**
|
|
1053
1074
|
* Base class for rendering extension toolbar button in the rich text editor.
|
|
1054
1075
|
* The renderer provides common functionalities for rendering toolbar buttons, including:
|
|
@@ -1749,7 +1770,7 @@ class VegaRTELanguageExtension extends linkExtension.VegaRTEExtension {
|
|
|
1749
1770
|
*/
|
|
1750
1771
|
prepareBeforeLoad(host) {
|
|
1751
1772
|
this.languageToolbarButtonRenderer = new RTELanguageToolbarButtonRenderer(this.languageList, this.languageChangeCallBack, this.languageState.selectedLanguage);
|
|
1752
|
-
this.registerToolbarButtonRenderer(
|
|
1773
|
+
this.registerToolbarButtonRenderer(VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY, this.languageToolbarButtonRenderer, host);
|
|
1753
1774
|
}
|
|
1754
1775
|
/**
|
|
1755
1776
|
* Initializes the language extension.
|
|
@@ -1841,6 +1862,7 @@ class VegaRTELanguageExtension extends linkExtension.VegaRTEExtension {
|
|
|
1841
1862
|
return result;
|
|
1842
1863
|
}
|
|
1843
1864
|
}
|
|
1865
|
+
VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY = 'languages';
|
|
1844
1866
|
|
|
1845
1867
|
const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
1846
1868
|
/**
|
|
@@ -2633,7 +2655,7 @@ class VegaRTEFunctionExtension extends linkExtension.VegaRTEExtension {
|
|
|
2633
2655
|
}
|
|
2634
2656
|
/** @inheritDoc */
|
|
2635
2657
|
prepareBeforeLoad(host) {
|
|
2636
|
-
this.registerToolbarButtonRenderer(
|
|
2658
|
+
this.registerToolbarButtonRenderer(VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY, new FunctionToolbarButtonRenderer(), host);
|
|
2637
2659
|
}
|
|
2638
2660
|
/**
|
|
2639
2661
|
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
@@ -2657,6 +2679,7 @@ class VegaRTEFunctionExtension extends linkExtension.VegaRTEExtension {
|
|
|
2657
2679
|
linkExtension.VegaRTEExtension.registerActionHandlerInterceptor(codeBlock.RTETextBlock.name, codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
2658
2680
|
linkExtension.VegaRTEExtension.registerActionHandlerInterceptor(codeBlock.RTETextBlock.name, codeBlock.ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
2659
2681
|
})();
|
|
2682
|
+
VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY = 'functions';
|
|
2660
2683
|
|
|
2661
2684
|
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}";
|
|
2662
2685
|
|
|
@@ -7293,7 +7316,7 @@ class VegaRTETableExtension extends linkExtension.VegaRTEExtension {
|
|
|
7293
7316
|
this.tableHeadCellRenderer = new RTETableHeadCellRenderer();
|
|
7294
7317
|
this.tableSelection = new RTETableSelection();
|
|
7295
7318
|
splitCellOperation.RTETableColorManager.setTableColors(colors);
|
|
7296
|
-
this.registerToolbarButtonRenderer(
|
|
7319
|
+
this.registerToolbarButtonRenderer(VegaRTETableExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
|
|
7297
7320
|
this.registerBlockBasicStrategies(splitCellOperation.RTETableBlock.name);
|
|
7298
7321
|
this.registerBlockBasicStrategies(splitCellOperation.RTETableHeadBlock.name);
|
|
7299
7322
|
this.registerBlockBasicStrategies(splitCellOperation.RTETableHeadCellBlock.name);
|
|
@@ -7381,6 +7404,7 @@ class VegaRTETableExtension extends linkExtension.VegaRTEExtension {
|
|
|
7381
7404
|
linkExtension.VegaRTEExtension.registerFilterStylesStrategy(splitCellOperation.RTETableCellBlock.dtoName, new TableCellFilterStylesStrategy());
|
|
7382
7405
|
linkExtension.VegaRTEExtension.registerFilterStylesStrategy(splitCellOperation.RTETableHeadCellBlock.dtoName, new TableCellFilterStylesStrategy('th'));
|
|
7383
7406
|
})();
|
|
7407
|
+
VegaRTETableExtension.TOOLBAR_BUTTON_KEY = 'table';
|
|
7384
7408
|
|
|
7385
7409
|
/**
|
|
7386
7410
|
* Horizontal line node — a decorator node representing `<hr>` in the editor.
|
|
@@ -7878,7 +7902,7 @@ class VegaRTEHorizontalLineExtension extends linkExtension.VegaRTEExtension {
|
|
|
7878
7902
|
// Register the renderer
|
|
7879
7903
|
this.registerRenderer('horizontal-line', this.blockRenderer);
|
|
7880
7904
|
// Register the toolbar button
|
|
7881
|
-
this.registerToolbarButtonRenderer(
|
|
7905
|
+
this.registerToolbarButtonRenderer(VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
|
|
7882
7906
|
// Register HTML → DTO conversion strategy
|
|
7883
7907
|
this.registerElementToBlockDTOClassStrategy(new HrToHorizontalLineBlockStrategy());
|
|
7884
7908
|
// Register filter styles strategy for source edit round-trip
|
|
@@ -7893,6 +7917,7 @@ class VegaRTEHorizontalLineExtension extends linkExtension.VegaRTEExtension {
|
|
|
7893
7917
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(contentState.RTEImageBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
|
|
7894
7918
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(RTEHorizontalLineBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
|
|
7895
7919
|
})();
|
|
7920
|
+
VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY = 'horizontalLine';
|
|
7896
7921
|
|
|
7897
7922
|
const ARROW_CHARACTERS = [
|
|
7898
7923
|
{ character: '←', title: 'leftwards simple arrow' },
|
|
@@ -8390,7 +8415,7 @@ class VegaRTESpecialCharactersExtension extends linkExtension.VegaRTEExtension {
|
|
|
8390
8415
|
}
|
|
8391
8416
|
/** @inheritDoc */
|
|
8392
8417
|
prepareBeforeLoad(host) {
|
|
8393
|
-
this.registerToolbarButtonRenderer(
|
|
8418
|
+
this.registerToolbarButtonRenderer(VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY, new RTESpecialCharactersToolbarButtonRenderer(this.categories), host);
|
|
8394
8419
|
}
|
|
8395
8420
|
/**
|
|
8396
8421
|
* Builds the final list of special character categories from the provided config.
|
|
@@ -8409,268 +8434,1462 @@ class VegaRTESpecialCharactersExtension extends linkExtension.VegaRTEExtension {
|
|
|
8409
8434
|
return [...defaultCategories, ...config.categories];
|
|
8410
8435
|
}
|
|
8411
8436
|
}
|
|
8437
|
+
VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY = 'special-characters';
|
|
8438
|
+
|
|
8439
|
+
const findReplaceIcon = {
|
|
8440
|
+
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>`,
|
|
8441
|
+
};
|
|
8412
8442
|
|
|
8413
8443
|
/**
|
|
8414
|
-
*
|
|
8415
|
-
*
|
|
8444
|
+
* Defines how a specific type of RTEBlock contributes searchable leaf blocks.
|
|
8445
|
+
*
|
|
8446
|
+
* Implementations are registered on FindReplaceState in priority order.
|
|
8447
|
+
* The first strategy whose `canHandle` returns true is used.
|
|
8416
8448
|
*/
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
{ title: '1', value: '1' },
|
|
8420
|
-
{ title: '1.5', value: '1.5' },
|
|
8421
|
-
{ title: '2', value: '2' },
|
|
8422
|
-
{ title: '2.5', value: '2.5' },
|
|
8423
|
-
];
|
|
8449
|
+
class BlockSearchStrategy {
|
|
8450
|
+
}
|
|
8424
8451
|
|
|
8425
|
-
var RTELineHeightExtensionAnnotationTypeEnum;
|
|
8426
|
-
(function (RTELineHeightExtensionAnnotationTypeEnum) {
|
|
8427
|
-
RTELineHeightExtensionAnnotationTypeEnum["LINE_HEIGHT"] = "LINE_HEIGHT";
|
|
8428
|
-
})(RTELineHeightExtensionAnnotationTypeEnum || (RTELineHeightExtensionAnnotationTypeEnum = {}));
|
|
8429
8452
|
/**
|
|
8430
|
-
*
|
|
8453
|
+
* Handles RTECodeBlock — a searchable leaf block whose text lives in children[0].text.
|
|
8431
8454
|
*/
|
|
8432
|
-
class
|
|
8433
|
-
constructor(lineHeight) {
|
|
8434
|
-
super();
|
|
8435
|
-
this.type = RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT;
|
|
8436
|
-
this.lineHeight = lineHeight;
|
|
8437
|
-
}
|
|
8455
|
+
class CodeBlockSearchStrategy extends BlockSearchStrategy {
|
|
8438
8456
|
/**
|
|
8439
|
-
*
|
|
8440
|
-
*
|
|
8441
|
-
* @param {string} lineHeight - Line height value.
|
|
8442
|
-
* @returns {[RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT, LineHeightAnnotation]} Map item for the annotation.
|
|
8457
|
+
* @inheritDoc
|
|
8443
8458
|
*/
|
|
8444
|
-
|
|
8445
|
-
return
|
|
8459
|
+
canHandle(block) {
|
|
8460
|
+
return block instanceof codeBlock.RTECodeBlock;
|
|
8446
8461
|
}
|
|
8447
8462
|
/**
|
|
8448
|
-
*
|
|
8449
|
-
*
|
|
8450
|
-
* @param {string} lineHeight - The line height value.
|
|
8451
|
-
* @returns {AnnotationStyle} The default standalone styles.
|
|
8463
|
+
* @inheritDoc
|
|
8452
8464
|
*/
|
|
8453
|
-
|
|
8454
|
-
return
|
|
8465
|
+
collect(block) {
|
|
8466
|
+
return [block];
|
|
8455
8467
|
}
|
|
8468
|
+
}
|
|
8469
|
+
|
|
8470
|
+
/**
|
|
8471
|
+
* Handles RTEListItemBlock — a searchable leaf block that may also carry
|
|
8472
|
+
* nested RTEListBlocks via its `nestList` property.
|
|
8473
|
+
*
|
|
8474
|
+
* Must be registered before TextBlockSearchStrategy because RTEListItemBlock
|
|
8475
|
+
* extends RTETextBlock and would otherwise be matched by the parent class check.
|
|
8476
|
+
*/
|
|
8477
|
+
class ListItemBlockSearchStrategy extends BlockSearchStrategy {
|
|
8456
8478
|
/**
|
|
8457
|
-
*
|
|
8458
|
-
*
|
|
8459
|
-
* @returns {Record<string, unknown>} JSON representation of the annotation.
|
|
8479
|
+
* @inheritDoc
|
|
8460
8480
|
*/
|
|
8461
|
-
|
|
8462
|
-
return
|
|
8463
|
-
lineHeight: this.lineHeight,
|
|
8464
|
-
};
|
|
8481
|
+
canHandle(block) {
|
|
8482
|
+
return block instanceof contentState.RTEListItemBlock;
|
|
8465
8483
|
}
|
|
8466
8484
|
/**
|
|
8467
8485
|
* @inheritDoc
|
|
8468
8486
|
*/
|
|
8469
|
-
|
|
8470
|
-
|
|
8487
|
+
collect(block, recurse) {
|
|
8488
|
+
const listItemBlock = block;
|
|
8489
|
+
const result = [listItemBlock];
|
|
8490
|
+
if (listItemBlock.nestList && listItemBlock.nestList.length > 0) {
|
|
8491
|
+
for (const nestedList of listItemBlock.nestList) {
|
|
8492
|
+
result.push(...recurse(nestedList.children));
|
|
8493
|
+
}
|
|
8494
|
+
}
|
|
8495
|
+
return result;
|
|
8471
8496
|
}
|
|
8497
|
+
}
|
|
8498
|
+
|
|
8499
|
+
/**
|
|
8500
|
+
* Handles plain RTETextBlock (paragraph, heading, etc.) — a searchable leaf
|
|
8501
|
+
* block whose text lives in its RTETextNode children.
|
|
8502
|
+
*/
|
|
8503
|
+
class TextBlockSearchStrategy extends BlockSearchStrategy {
|
|
8472
8504
|
/**
|
|
8473
8505
|
* @inheritDoc
|
|
8474
8506
|
*/
|
|
8475
|
-
|
|
8476
|
-
return
|
|
8507
|
+
canHandle(block) {
|
|
8508
|
+
return block instanceof codeBlock.RTETextBlock;
|
|
8477
8509
|
}
|
|
8478
8510
|
/**
|
|
8479
8511
|
* @inheritDoc
|
|
8480
8512
|
*/
|
|
8481
|
-
|
|
8482
|
-
return
|
|
8513
|
+
collect(block) {
|
|
8514
|
+
return [block];
|
|
8483
8515
|
}
|
|
8484
8516
|
}
|
|
8485
8517
|
|
|
8486
8518
|
/**
|
|
8487
|
-
*
|
|
8519
|
+
* Fallback strategy for generic container blocks whose concrete type is not
|
|
8520
|
+
* known at compile time (RTEHtmlBlock, table blocks, extension-defined blocks, …).
|
|
8521
|
+
*
|
|
8522
|
+
* A block is treated as a container when its children array is non-empty and
|
|
8523
|
+
* the first child is not an RTETextNode (i.e. children are blocks, not nodes).
|
|
8488
8524
|
*/
|
|
8489
|
-
class
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8525
|
+
class ContainerBlockSearchStrategy extends BlockSearchStrategy {
|
|
8526
|
+
/**
|
|
8527
|
+
* @inheritDoc
|
|
8528
|
+
*/
|
|
8529
|
+
canHandle(block) {
|
|
8530
|
+
return (block.children != null && block.children.length > 0 && !(block.children[0] instanceof codeBlock.RTETextNode));
|
|
8494
8531
|
}
|
|
8495
8532
|
/**
|
|
8496
|
-
*
|
|
8497
|
-
*
|
|
8498
|
-
* @returns {LineHeightAnnotation} The annotation.
|
|
8533
|
+
* @inheritDoc
|
|
8499
8534
|
*/
|
|
8500
|
-
|
|
8501
|
-
return
|
|
8535
|
+
collect(block, recurse) {
|
|
8536
|
+
return recurse(block.children);
|
|
8502
8537
|
}
|
|
8503
8538
|
}
|
|
8504
8539
|
|
|
8505
8540
|
/**
|
|
8506
|
-
*
|
|
8541
|
+
* Sentinel character inserted into the flat text in place of a non-editable
|
|
8542
|
+
* node (e.g. a token). It keeps surrounding searchable segments from bridging
|
|
8543
|
+
* across the removed node — producing false matches — while never matching any
|
|
8544
|
+
* user keyword. `\u0000` (NULL) does not appear in editable document text.
|
|
8545
|
+
*/
|
|
8546
|
+
const NON_EDITABLE_SENTINEL = '\u0000';
|
|
8547
|
+
/**
|
|
8548
|
+
* Manages the in-memory state for a single Find & Replace session.
|
|
8507
8549
|
*
|
|
8508
|
-
*
|
|
8509
|
-
*
|
|
8550
|
+
* One instance is created per editor host inside VegaRTEFindReplaceExtension
|
|
8551
|
+
* during `initialExtensionAfterLoad`. It holds all search results, the
|
|
8552
|
+
* current navigation index, and a per-block flat-text cache.
|
|
8553
|
+
*
|
|
8554
|
+
* Public API:
|
|
8555
|
+
* - `search(content, keyword)` — run a search, replace current state using current options
|
|
8556
|
+
* - `next()` / `prev()` — navigate through results
|
|
8557
|
+
* - `getCurrentMatch()` / `getMatches()` / `getTotal()` / `getCurrentIndex()` — read state
|
|
8558
|
+
* - `clear()` — reset everything
|
|
8510
8559
|
*/
|
|
8511
|
-
class
|
|
8560
|
+
class FindReplaceState {
|
|
8561
|
+
constructor() {
|
|
8562
|
+
this.matches = [];
|
|
8563
|
+
this.currentIndex = -1;
|
|
8564
|
+
this.flatCache = new WeakMap();
|
|
8565
|
+
this.cachedContent = null;
|
|
8566
|
+
this.matchCase = false;
|
|
8567
|
+
this.wholeWords = false;
|
|
8568
|
+
/**
|
|
8569
|
+
* Ordered strategy chain used to classify and traverse each block type.
|
|
8570
|
+
* More specific types (RTEListItemBlock) must precede their parent class (RTETextBlock).
|
|
8571
|
+
*/
|
|
8572
|
+
this.blockSearchStrategies = [
|
|
8573
|
+
new CodeBlockSearchStrategy(),
|
|
8574
|
+
new ListItemBlockSearchStrategy(),
|
|
8575
|
+
new TextBlockSearchStrategy(),
|
|
8576
|
+
new ContainerBlockSearchStrategy(),
|
|
8577
|
+
];
|
|
8578
|
+
}
|
|
8512
8579
|
/**
|
|
8513
|
-
*
|
|
8580
|
+
* Runs a fresh search over the given content and replaces all previous results.
|
|
8514
8581
|
*
|
|
8515
|
-
*
|
|
8516
|
-
*
|
|
8582
|
+
* The flat-text cache is invalidated whenever the content reference changes
|
|
8583
|
+
* (i.e. after the user edits the document). When only the keyword or options
|
|
8584
|
+
* change (user typing in the find input), the cache is reused.
|
|
8585
|
+
*
|
|
8586
|
+
* @param {VegaRTEContent} content - The root content DTO to search.
|
|
8587
|
+
* @param {string} keyword - The search keyword entered by the user.
|
|
8588
|
+
* Uses the currently stored `matchCase` and `wholeWords` options.
|
|
8517
8589
|
*/
|
|
8518
|
-
|
|
8519
|
-
this.
|
|
8590
|
+
search(content, keyword) {
|
|
8591
|
+
this.invalidateCacheIfNeeded(content);
|
|
8592
|
+
if (!keyword) {
|
|
8593
|
+
this.matches = [];
|
|
8594
|
+
this.currentIndex = -1;
|
|
8595
|
+
return;
|
|
8596
|
+
}
|
|
8597
|
+
const regex = this.buildRegExp(keyword, this.getFindOptions());
|
|
8598
|
+
const blocks = this.collectSearchableBlocks(content.children);
|
|
8599
|
+
const results = [];
|
|
8600
|
+
for (const block of blocks) {
|
|
8601
|
+
let cached = this.flatCache.get(block);
|
|
8602
|
+
if (!cached) {
|
|
8603
|
+
cached =
|
|
8604
|
+
block instanceof codeBlock.RTECodeBlock
|
|
8605
|
+
? this.buildCodeBlockFlat(block)
|
|
8606
|
+
: this.buildTextBlockFlat(block);
|
|
8607
|
+
this.flatCache.set(block, cached);
|
|
8608
|
+
}
|
|
8609
|
+
const { flatText, segments } = cached;
|
|
8610
|
+
if (!flatText) {
|
|
8611
|
+
continue;
|
|
8612
|
+
}
|
|
8613
|
+
regex.lastIndex = 0;
|
|
8614
|
+
let match;
|
|
8615
|
+
while ((match = regex.exec(flatText)) !== null) {
|
|
8616
|
+
// match[1] is always the keyword capture group. In wholeWords mode,
|
|
8617
|
+
// match[0] may include a leading non-letter boundary char, so we
|
|
8618
|
+
// compute the actual start from the end offset minus the keyword length.
|
|
8619
|
+
const matchEnd = match.index + match[0].length;
|
|
8620
|
+
const matchStart = matchEnd - match[1].length;
|
|
8621
|
+
const nodes = this.flatOffsetToNodePositions(segments, matchStart, matchEnd);
|
|
8622
|
+
if (nodes.length > 0) {
|
|
8623
|
+
results.push({ block, nodes, matchText: match[1] });
|
|
8624
|
+
}
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
this.matches = results;
|
|
8628
|
+
this.currentIndex = results.length > 0 ? 0 : -1;
|
|
8520
8629
|
}
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
*/
|
|
8530
|
-
class RTELineHeightToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
8531
|
-
constructor(options) {
|
|
8532
|
-
super();
|
|
8533
|
-
this.options = options;
|
|
8630
|
+
/**
|
|
8631
|
+
* Advances to the next match, wrapping around to the first.
|
|
8632
|
+
*/
|
|
8633
|
+
next() {
|
|
8634
|
+
if (this.matches.length === 0) {
|
|
8635
|
+
return;
|
|
8636
|
+
}
|
|
8637
|
+
this.currentIndex = (this.currentIndex + 1) % this.matches.length;
|
|
8534
8638
|
}
|
|
8535
8639
|
/**
|
|
8536
|
-
*
|
|
8640
|
+
* Moves to the previous match, wrapping around to the last.
|
|
8537
8641
|
*/
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
label: (_a = item.title) !== null && _a !== void 0 ? _a : item.value,
|
|
8544
|
-
});
|
|
8545
|
-
});
|
|
8546
|
-
return this.renderDropdown(createElement, editorContext, {
|
|
8547
|
-
selectType: 'single',
|
|
8548
|
-
selectedSourceKey: this.getSelectedSourceValue(editorContext),
|
|
8549
|
-
}, [
|
|
8550
|
-
this.renderButton(createElement, editorContext, {
|
|
8551
|
-
icon: 'line-height',
|
|
8552
|
-
showArrowIcon: true,
|
|
8553
|
-
tooltip: { text: internalTranslationController.VegaInternalTranslation.t('Line Height') },
|
|
8554
|
-
}),
|
|
8555
|
-
this.renderDropdownListTemplate(createElement, dropdownItems, editorContext),
|
|
8556
|
-
]);
|
|
8642
|
+
prev() {
|
|
8643
|
+
if (this.matches.length === 0) {
|
|
8644
|
+
return;
|
|
8645
|
+
}
|
|
8646
|
+
this.currentIndex = (this.currentIndex - 1 + this.matches.length) % this.matches.length;
|
|
8557
8647
|
}
|
|
8558
8648
|
/**
|
|
8559
|
-
*
|
|
8649
|
+
* Sets the current index directly. Clamps to valid range.
|
|
8650
|
+
*
|
|
8651
|
+
* @param {number} index - The desired index.
|
|
8560
8652
|
*/
|
|
8561
|
-
|
|
8562
|
-
|
|
8653
|
+
setCurrentIndex(index) {
|
|
8654
|
+
if (this.matches.length === 0) {
|
|
8655
|
+
this.currentIndex = -1;
|
|
8656
|
+
return;
|
|
8657
|
+
}
|
|
8658
|
+
this.currentIndex = Math.max(0, Math.min(index, this.matches.length - 1));
|
|
8563
8659
|
}
|
|
8564
8660
|
/**
|
|
8565
|
-
*
|
|
8661
|
+
* Returns the currently active match, or null if there are no results.
|
|
8662
|
+
*
|
|
8663
|
+
* @returns {FindMatch | null} The currently active match, or null if there are no results.
|
|
8566
8664
|
*/
|
|
8567
|
-
|
|
8665
|
+
getCurrentMatch() {
|
|
8568
8666
|
var _a;
|
|
8569
|
-
|
|
8570
|
-
return true;
|
|
8571
|
-
}
|
|
8572
|
-
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
8573
|
-
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
8574
|
-
if (selectedNodes.some((node) => {
|
|
8575
|
-
var _a;
|
|
8576
|
-
return ((_a = node.getAnnotationByType(codeBlock.NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
8577
|
-
node.parent instanceof codeBlock.RTECodeBlock;
|
|
8578
|
-
})) {
|
|
8579
|
-
return true;
|
|
8580
|
-
}
|
|
8581
|
-
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
8582
|
-
return selectedBlocks.some((block) => block instanceof codeBlock.RTECodeBlock ||
|
|
8583
|
-
block instanceof contentState.RTEImageBlock ||
|
|
8584
|
-
!codeBlock.ActionHandleStrategyRegistry.canHandle(LineHeightAnnotationAction.name, block));
|
|
8667
|
+
return (_a = this.matches[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
|
|
8585
8668
|
}
|
|
8586
8669
|
/**
|
|
8587
|
-
*
|
|
8670
|
+
* Returns all matches from the last search.
|
|
8671
|
+
*
|
|
8672
|
+
* @returns {ReadonlyArray<FindMatch>} All matches from the last search.
|
|
8588
8673
|
*/
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
8592
|
-
selectedBlocks.forEach((block) => {
|
|
8593
|
-
block.apply(new LineHeightAnnotationAction(selectedLineHeight));
|
|
8594
|
-
});
|
|
8674
|
+
getMatches() {
|
|
8675
|
+
return this.matches;
|
|
8595
8676
|
}
|
|
8596
8677
|
/**
|
|
8597
|
-
*
|
|
8678
|
+
* Returns the total number of matches from the last search.
|
|
8679
|
+
*
|
|
8680
|
+
* @returns {number} The total number of matches.
|
|
8598
8681
|
*/
|
|
8599
|
-
|
|
8600
|
-
|
|
8682
|
+
getTotal() {
|
|
8683
|
+
return this.matches.length;
|
|
8601
8684
|
}
|
|
8602
8685
|
/**
|
|
8603
|
-
*
|
|
8686
|
+
* Returns the 0-based index of the current match, or -1 when there are no results.
|
|
8604
8687
|
*
|
|
8605
|
-
* @
|
|
8606
|
-
* @returns {string} Selected line-height key or empty string for mixed/none.
|
|
8688
|
+
* @returns {number} The 0-based index, or -1 when there are no results.
|
|
8607
8689
|
*/
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
if (selectedBlocks.length === 0) {
|
|
8611
|
-
return '';
|
|
8612
|
-
}
|
|
8613
|
-
const firstAnnotation = selectedBlocks[0].getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
8614
|
-
const isSameLineHeight = selectedBlocks.every((block) => {
|
|
8615
|
-
const annotation = block.getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
8616
|
-
return (annotation === null || annotation === void 0 ? void 0 : annotation.lineHeight) === (firstAnnotation === null || firstAnnotation === void 0 ? void 0 : firstAnnotation.lineHeight);
|
|
8617
|
-
});
|
|
8618
|
-
return isSameLineHeight && firstAnnotation ? firstAnnotation.lineHeight : '';
|
|
8690
|
+
getCurrentIndex() {
|
|
8691
|
+
return this.currentIndex;
|
|
8619
8692
|
}
|
|
8620
8693
|
/**
|
|
8621
|
-
*
|
|
8694
|
+
* Resets only match results and navigation index.
|
|
8695
|
+
* The flat-text cache and cached content reference are preserved so that
|
|
8696
|
+
* a subsequent search on the same document (e.g. after a keyword change)
|
|
8697
|
+
* can reuse the already-computed block flat texts.
|
|
8698
|
+
*/
|
|
8699
|
+
clearResults() {
|
|
8700
|
+
this.matches = [];
|
|
8701
|
+
this.currentIndex = -1;
|
|
8702
|
+
}
|
|
8703
|
+
/**
|
|
8704
|
+
* Resets all search state, including results, navigation index, and flat-text cache.
|
|
8705
|
+
* Use this when the session ends (e.g. panel closed) or the host changes.
|
|
8706
|
+
*/
|
|
8707
|
+
clear() {
|
|
8708
|
+
this.matches = [];
|
|
8709
|
+
this.currentIndex = -1;
|
|
8710
|
+
this.flatCache = new WeakMap();
|
|
8711
|
+
this.cachedContent = null;
|
|
8712
|
+
}
|
|
8713
|
+
/**
|
|
8714
|
+
* Sets the matchCase search option.
|
|
8622
8715
|
*
|
|
8623
|
-
* @param {
|
|
8624
|
-
* @returns {RTEBlock[]} Selected blocks.
|
|
8716
|
+
* @param {boolean} enabled - Whether to enable case-sensitive matching.
|
|
8625
8717
|
*/
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
8629
|
-
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
8630
|
-
const selectedBlocks = [];
|
|
8631
|
-
selectedNodes.forEach((node) => {
|
|
8632
|
-
if (node.parent instanceof codeBlock.RTEBlock && !selectedBlocks.includes(node.parent)) {
|
|
8633
|
-
selectedBlocks.push(node.parent);
|
|
8634
|
-
}
|
|
8635
|
-
});
|
|
8636
|
-
if (selectedBlocks.length === 0 && ((_b = editorContext.rteRange.startNode) === null || _b === void 0 ? void 0 : _b.parent) instanceof codeBlock.RTEBlock) {
|
|
8637
|
-
selectedBlocks.push(editorContext.rteRange.startNode.parent);
|
|
8638
|
-
}
|
|
8639
|
-
return selectedBlocks;
|
|
8718
|
+
setMatchCase(enabled) {
|
|
8719
|
+
this.matchCase = enabled;
|
|
8640
8720
|
}
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
const LINE_HEIGHT_AWARE_BLOCK_NAMES = new Set([
|
|
8649
|
-
codeBlock.RTETextBlock.name,
|
|
8650
|
-
contentState.RTEListItemBlock.name,
|
|
8651
|
-
]);
|
|
8652
|
-
/** Handle line height annotation. */
|
|
8653
|
-
class LineHeightAnnotationHandler extends contentState.AnnotationGeneratorStrategyAbstract {
|
|
8654
|
-
constructor(options = VegaRTEDefaultLineHeightOptions) {
|
|
8655
|
-
super();
|
|
8656
|
-
this.allowedLineHeights = new Set(options.map((option) => option.value));
|
|
8721
|
+
/**
|
|
8722
|
+
* Sets the wholeWords search option.
|
|
8723
|
+
*
|
|
8724
|
+
* @param {boolean} enabled - Whether to enable whole-word matching.
|
|
8725
|
+
*/
|
|
8726
|
+
setWholeWords(enabled) {
|
|
8727
|
+
this.wholeWords = enabled;
|
|
8657
8728
|
}
|
|
8729
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
8658
8730
|
/**
|
|
8659
|
-
*
|
|
8731
|
+
* Invalidates the flat-text cache when the content reference has changed.
|
|
8732
|
+
* Since flushChanges always produces a new VegaRTEContent via clone(), a
|
|
8733
|
+
* changed reference reliably indicates the document has been edited.
|
|
8660
8734
|
*
|
|
8661
|
-
* @param {
|
|
8662
|
-
* @returns {boolean} Whether the target DTO supports line-height annotations.
|
|
8735
|
+
* @param {VegaRTEContent} content - The incoming content reference.
|
|
8663
8736
|
*/
|
|
8664
|
-
|
|
8665
|
-
|
|
8737
|
+
invalidateCacheIfNeeded(content) {
|
|
8738
|
+
if (content !== this.cachedContent) {
|
|
8739
|
+
this.flatCache = new WeakMap();
|
|
8740
|
+
this.cachedContent = content;
|
|
8741
|
+
}
|
|
8666
8742
|
}
|
|
8667
8743
|
/**
|
|
8668
|
-
*
|
|
8744
|
+
* Builds a RegExp from the keyword and search options.
|
|
8669
8745
|
*
|
|
8670
|
-
* @param {
|
|
8671
|
-
* @
|
|
8746
|
+
* @param {string} keyword - The raw user input.
|
|
8747
|
+
* @param {FindOptions} options - Search options.
|
|
8748
|
+
* @returns {RegExp} The compiled regular expression.
|
|
8672
8749
|
*/
|
|
8673
|
-
|
|
8750
|
+
buildRegExp(keyword, options) {
|
|
8751
|
+
const escaped = this.escapeRegExp(keyword);
|
|
8752
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
8753
|
+
let flags = 'gu';
|
|
8754
|
+
if (!options.matchCase) {
|
|
8755
|
+
flags += 'i';
|
|
8756
|
+
}
|
|
8757
|
+
if (options.wholeWords) {
|
|
8758
|
+
// Aligned with CKEditor's findByTextCallback non-letter boundary group.
|
|
8759
|
+
//
|
|
8760
|
+
// The keyword is wrapped in a capturing group (match[1]) so the search
|
|
8761
|
+
// loop can compute the exact start offset without lookbehind assertions
|
|
8762
|
+
// (not supported in Safari < 16.4). The non-capturing prefix group
|
|
8763
|
+
// `(?:^|nonLetter)` may consume one boundary char, which is why we
|
|
8764
|
+
// derive matchStart as matchEnd - match[1].length rather than match.index.
|
|
8765
|
+
const nonLetter = '[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF]';
|
|
8766
|
+
const prefix = !new RegExp(`^${nonLetter}`).test(keyword) ? `(?:^|${nonLetter})` : '';
|
|
8767
|
+
const suffix = !new RegExp(`${nonLetter}$`).test(keyword) ? `(?=${nonLetter}|$)` : '';
|
|
8768
|
+
return new RegExp(`${prefix}(${escaped})${suffix}`, flags);
|
|
8769
|
+
}
|
|
8770
|
+
return new RegExp(`(${escaped})`, flags);
|
|
8771
|
+
}
|
|
8772
|
+
/**
|
|
8773
|
+
* Escapes all regex special characters so the keyword is treated as literal text.
|
|
8774
|
+
*
|
|
8775
|
+
* @param {string} text - The raw input string.
|
|
8776
|
+
* @returns {string} The escaped string safe for use in a RegExp constructor.
|
|
8777
|
+
*/
|
|
8778
|
+
escapeRegExp(text) {
|
|
8779
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
8780
|
+
}
|
|
8781
|
+
/**
|
|
8782
|
+
* Recursively collects all searchable leaf blocks (RTETextBlock and RTECodeBlock)
|
|
8783
|
+
* from a block tree in document order.
|
|
8784
|
+
*
|
|
8785
|
+
* Each block is dispatched to the first matching BlockSearchStrategy.
|
|
8786
|
+
*
|
|
8787
|
+
* @param {RTEBlock[]} blocks - The block array to traverse.
|
|
8788
|
+
* @returns {(RTETextBlock | RTECodeBlock)[]} Ordered list of searchable leaf blocks.
|
|
8789
|
+
*/
|
|
8790
|
+
collectSearchableBlocks(blocks) {
|
|
8791
|
+
const result = [];
|
|
8792
|
+
const recurse = this.collectSearchableBlocks.bind(this);
|
|
8793
|
+
for (const block of blocks) {
|
|
8794
|
+
const strategy = this.blockSearchStrategies.find((s) => s.canHandle(block));
|
|
8795
|
+
if (strategy) {
|
|
8796
|
+
result.push(...strategy.collect(block, recurse));
|
|
8797
|
+
}
|
|
8798
|
+
}
|
|
8799
|
+
return result;
|
|
8800
|
+
}
|
|
8801
|
+
/**
|
|
8802
|
+
* Builds the flat text and segment table for a RTETextBlock.
|
|
8803
|
+
*
|
|
8804
|
+
* Non-editable child nodes (e.g. tokens, which render as read-only chips)
|
|
8805
|
+
* are excluded from the searchable flat text. Each is replaced by a single
|
|
8806
|
+
* sentinel character so that adjacent editable segments cannot bridge across
|
|
8807
|
+
* the token to form a false match, while keeping segment offsets aligned.
|
|
8808
|
+
*
|
|
8809
|
+
* @param {RTETextBlock} block - The text block to flatten.
|
|
8810
|
+
* @returns {BlockFlatCache} The flat text string and segment mapping.
|
|
8811
|
+
*/
|
|
8812
|
+
buildTextBlockFlat(block) {
|
|
8813
|
+
const segments = [];
|
|
8814
|
+
const flatParts = [];
|
|
8815
|
+
let cursor = 0;
|
|
8816
|
+
for (const node of block.children) {
|
|
8817
|
+
if (!node.isContentEditable()) {
|
|
8818
|
+
flatParts.push(NON_EDITABLE_SENTINEL);
|
|
8819
|
+
cursor += NON_EDITABLE_SENTINEL.length;
|
|
8820
|
+
continue;
|
|
8821
|
+
}
|
|
8822
|
+
const len = node.text.length;
|
|
8823
|
+
segments.push({ node, start: cursor, end: cursor + len });
|
|
8824
|
+
flatParts.push(node.text);
|
|
8825
|
+
cursor += len;
|
|
8826
|
+
}
|
|
8827
|
+
return {
|
|
8828
|
+
flatText: flatParts.join(''),
|
|
8829
|
+
segments,
|
|
8830
|
+
};
|
|
8831
|
+
}
|
|
8832
|
+
/**
|
|
8833
|
+
* Builds the flat text and segment table for a RTECodeBlock.
|
|
8834
|
+
*
|
|
8835
|
+
* @param {RTECodeBlock} block - The code block to flatten.
|
|
8836
|
+
* @returns {BlockFlatCache} The flat text string and segment mapping.
|
|
8837
|
+
*/
|
|
8838
|
+
buildCodeBlockFlat(block) {
|
|
8839
|
+
const codeNode = block.children[0];
|
|
8840
|
+
if (!codeNode) {
|
|
8841
|
+
return { flatText: '', segments: [] };
|
|
8842
|
+
}
|
|
8843
|
+
const flatText = codeNode.text;
|
|
8844
|
+
return {
|
|
8845
|
+
flatText,
|
|
8846
|
+
segments: [{ node: codeNode, start: 0, end: flatText.length }],
|
|
8847
|
+
};
|
|
8848
|
+
}
|
|
8849
|
+
/**
|
|
8850
|
+
* Maps a flat [matchStart, matchEnd) range back to individual node positions.
|
|
8851
|
+
*
|
|
8852
|
+
* @param {(TextSegment | CodeSegment)[]} segments - The segment table.
|
|
8853
|
+
* @param {number} matchStart - Inclusive start in the flat text.
|
|
8854
|
+
* @param {number} matchEnd - Exclusive end in the flat text.
|
|
8855
|
+
* @returns {NodePosition[]} Ordered list of node-local positions spanning the match.
|
|
8856
|
+
*/
|
|
8857
|
+
flatOffsetToNodePositions(segments, matchStart, matchEnd) {
|
|
8858
|
+
const positions = [];
|
|
8859
|
+
for (const segment of segments) {
|
|
8860
|
+
if (segment.end <= matchStart) {
|
|
8861
|
+
continue;
|
|
8862
|
+
}
|
|
8863
|
+
if (segment.start >= matchEnd) {
|
|
8864
|
+
break;
|
|
8865
|
+
}
|
|
8866
|
+
const localStart = Math.max(0, matchStart - segment.start);
|
|
8867
|
+
const localEnd = Math.min(segment.end, matchEnd) - segment.start;
|
|
8868
|
+
positions.push({ node: segment.node, startOffset: localStart, endOffset: localEnd });
|
|
8869
|
+
}
|
|
8870
|
+
return positions;
|
|
8871
|
+
}
|
|
8872
|
+
/**
|
|
8873
|
+
* Builds the current find options from the shared context.
|
|
8874
|
+
*
|
|
8875
|
+
* @returns {FindOptions} The options for the search engine.
|
|
8876
|
+
*/
|
|
8877
|
+
getFindOptions() {
|
|
8878
|
+
return { matchCase: this.matchCase, wholeWords: this.wholeWords };
|
|
8879
|
+
}
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8882
|
+
// Light-mode values (used as CSS var() fall-backs).
|
|
8883
|
+
// Dark-mode values are registered via VegaDarkModeStyleController below.
|
|
8884
|
+
const HIGHLIGHT_BG_LIGHT = '255, 220, 0, 0.35';
|
|
8885
|
+
const HIGHLIGHT_ACTIVE_BG_LIGHT = '255, 150, 0, 0.5';
|
|
8886
|
+
// Dark-mode: brighter yellow/orange tones stand out on dark backgrounds.
|
|
8887
|
+
const HIGHLIGHT_BG_DARK = '255, 235, 0, 0.55';
|
|
8888
|
+
const HIGHLIGHT_ACTIVE_BG_DARK = '255, 190, 0, 0.7';
|
|
8889
|
+
// CSS var() expressions that auto-switch between light and dark.
|
|
8890
|
+
const HIGHLIGHT_BG = `rgba(var(--v-rte-find-highlight-bg, ${HIGHLIGHT_BG_LIGHT}))`;
|
|
8891
|
+
const HIGHLIGHT_ACTIVE_BG = `rgba(var(--v-rte-find-highlight-active-bg, ${HIGHLIGHT_ACTIVE_BG_LIGHT}))`;
|
|
8892
|
+
/**
|
|
8893
|
+
* Manages highlights for the Find & Replace extension using a DOM overlay.
|
|
8894
|
+
*
|
|
8895
|
+
* Instead of modifying the RTE content tree (which causes re-renders, cursor
|
|
8896
|
+
* jumping, and VegaChange events), this manager renders semi-transparent
|
|
8897
|
+
* highlight rectangles in an absolutely-positioned overlay container.
|
|
8898
|
+
*
|
|
8899
|
+
* The overlay lives inside `.rich-text-editor-container` (the RTE's scroll
|
|
8900
|
+
* container) so highlight divs scroll naturally with the text content.
|
|
8901
|
+
* `pointer-events: none` ensures highlights don't interfere with user
|
|
8902
|
+
* interaction (selection, typing, clicking).
|
|
8903
|
+
*
|
|
8904
|
+
* Position computation uses `Range.getClientRects()` on the actual text DOM
|
|
8905
|
+
* nodes (resolved via `stateEntityRenderingRegistry.getDOMByEntity`).
|
|
8906
|
+
*/
|
|
8907
|
+
class FindReplaceHighlightManager {
|
|
8908
|
+
constructor() {
|
|
8909
|
+
this.overlayContainer = null;
|
|
8910
|
+
// Register dark-mode overrides so `html.dark { --v-rte-find-highlight-*: ... }` is generated.
|
|
8911
|
+
// CSS variables cascade into shadow DOM and update automatically when html.dark is toggled.
|
|
8912
|
+
darkModeStyleController.VegaDarkModeStyleController.registerCustomDarkModeColor({
|
|
8913
|
+
'rte-find-highlight-bg': HIGHLIGHT_BG_DARK,
|
|
8914
|
+
'rte-find-highlight-active-bg': HIGHLIGHT_ACTIVE_BG_DARK,
|
|
8915
|
+
'rte-find-highlight-blend': 'lighten',
|
|
8916
|
+
});
|
|
8917
|
+
}
|
|
8918
|
+
/**
|
|
8919
|
+
* Renders highlight overlays for all matches, with the active match
|
|
8920
|
+
* visually distinct. Clears any existing highlights before applying.
|
|
8921
|
+
*
|
|
8922
|
+
* @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
|
|
8923
|
+
* @param {ReadonlyArray<FindMatch>} matches - All search results.
|
|
8924
|
+
* @param {number} currentIndex - 0-based index of the active match (-1 = none).
|
|
8925
|
+
* @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
|
|
8926
|
+
* @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
|
|
8927
|
+
*/
|
|
8928
|
+
apply(matches, currentIndex, host, scrollToActive = true) {
|
|
8929
|
+
this.clear();
|
|
8930
|
+
if (matches.length === 0) {
|
|
8931
|
+
return;
|
|
8932
|
+
}
|
|
8933
|
+
const overlay = this.getOrCreateOverlay(host);
|
|
8934
|
+
if (overlay) {
|
|
8935
|
+
const overlayRect = overlay.getBoundingClientRect();
|
|
8936
|
+
let activeHighlightDiv = null;
|
|
8937
|
+
matches.forEach((match, matchIndex) => {
|
|
8938
|
+
const isActive = matchIndex === currentIndex;
|
|
8939
|
+
const bg = isActive ? HIGHLIGHT_ACTIVE_BG : HIGHLIGHT_BG;
|
|
8940
|
+
match.nodes.forEach((nodePosition) => {
|
|
8941
|
+
const highlightDiv = this.createHighlightRectangles(overlay, overlayRect, nodePosition, bg);
|
|
8942
|
+
if (isActive && !activeHighlightDiv && highlightDiv) {
|
|
8943
|
+
activeHighlightDiv = highlightDiv;
|
|
8944
|
+
}
|
|
8945
|
+
});
|
|
8946
|
+
});
|
|
8947
|
+
if (scrollToActive && activeHighlightDiv) {
|
|
8948
|
+
activeHighlightDiv.scrollIntoView({ block: 'center', inline: 'nearest' });
|
|
8949
|
+
}
|
|
8950
|
+
}
|
|
8951
|
+
}
|
|
8952
|
+
/**
|
|
8953
|
+
* Removes all highlight overlay elements.
|
|
8954
|
+
* Safe to call multiple times or when no highlights are active.
|
|
8955
|
+
*/
|
|
8956
|
+
clear() {
|
|
8957
|
+
if (this.overlayContainer) {
|
|
8958
|
+
this.overlayContainer.innerHTML = '';
|
|
8959
|
+
}
|
|
8960
|
+
}
|
|
8961
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
8962
|
+
/**
|
|
8963
|
+
* Gets the existing overlay container or creates one inside the RTE's
|
|
8964
|
+
* scroll container (`.rich-text-editor-container`).
|
|
8965
|
+
*
|
|
8966
|
+
* @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
|
|
8967
|
+
* @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
|
|
8968
|
+
* @returns {HTMLDivElement | null} The overlay container, or null in SSR environments.
|
|
8969
|
+
*/
|
|
8970
|
+
getOrCreateOverlay(host) {
|
|
8971
|
+
if (this.overlayContainer && this.overlayContainer.isConnected) {
|
|
8972
|
+
return this.overlayContainer;
|
|
8973
|
+
}
|
|
8974
|
+
const safeDocument = tryGetDocument.tryGetDocument();
|
|
8975
|
+
if (safeDocument) {
|
|
8976
|
+
const scrollContainer = host.shadowRoot.querySelector('.rich-text-editor-container');
|
|
8977
|
+
if (scrollContainer) {
|
|
8978
|
+
// The overlay is appended as the last child (paints above content).
|
|
8979
|
+
// Blend mode is controlled via CSS variable --v-rte-find-highlight-blend:
|
|
8980
|
+
// - Light (default): multiply (yellow darkens white bg, text readable)
|
|
8981
|
+
// - Dark (via html.dark override): lighten (yellow visible on dark bg,
|
|
8982
|
+
// white text unaffected since lighten(255, x) = 255)
|
|
8983
|
+
// CSS vars cascade into shadow DOM and react to theme switches instantly.
|
|
8984
|
+
const overlay = safeDocument.createElement('div');
|
|
8985
|
+
overlay.style.position = 'absolute';
|
|
8986
|
+
overlay.style.top = '0';
|
|
8987
|
+
overlay.style.left = '0';
|
|
8988
|
+
overlay.style.width = '100%';
|
|
8989
|
+
overlay.style.height = '100%';
|
|
8990
|
+
overlay.style.pointerEvents = 'none';
|
|
8991
|
+
overlay.style.overflow = 'visible';
|
|
8992
|
+
overlay.style.setProperty('mix-blend-mode', 'var(--v-rte-find-highlight-blend, multiply)');
|
|
8993
|
+
scrollContainer.appendChild(overlay);
|
|
8994
|
+
this.overlayContainer = overlay;
|
|
8995
|
+
return overlay;
|
|
8996
|
+
}
|
|
8997
|
+
}
|
|
8998
|
+
return null;
|
|
8999
|
+
}
|
|
9000
|
+
/**
|
|
9001
|
+
* Creates absolutely-positioned highlight rectangles for a single node
|
|
9002
|
+
* position within a match.
|
|
9003
|
+
*
|
|
9004
|
+
* Uses client rectangle extraction from `Range` to handle multi-line matches (where a
|
|
9005
|
+
* single text range may produce multiple rectangles due to line wrapping).
|
|
9006
|
+
*
|
|
9007
|
+
* @param {HTMLDivElement} overlay - The overlay container.
|
|
9008
|
+
* @param {DOMRect} overlayRect - The overlay's bounding client rect (for coordinate conversion).
|
|
9009
|
+
* @param {NodePosition} nodePosition - The node and character offsets for this segment.
|
|
9010
|
+
* @param {string} bg - The background color to apply.
|
|
9011
|
+
* @returns {Nullable<HTMLDivElement>} The first created highlight div for this node segment.
|
|
9012
|
+
*/
|
|
9013
|
+
createHighlightRectangles(overlay, overlayRect, nodePosition, bg) {
|
|
9014
|
+
const domElement = codeBlock.stateEntityRenderingRegistry.getDOMByEntity(nodePosition.node);
|
|
9015
|
+
if (!domElement) {
|
|
9016
|
+
return null;
|
|
9017
|
+
}
|
|
9018
|
+
const range = this.buildRange(domElement, nodePosition);
|
|
9019
|
+
if (!range) {
|
|
9020
|
+
return null;
|
|
9021
|
+
}
|
|
9022
|
+
// eslint-disable-next-line spellcheck/spell-checker -- DOM API method name is fixed by platform.
|
|
9023
|
+
const clientRectList = range.getClientRects();
|
|
9024
|
+
const safeDocument = tryGetDocument.tryGetDocument();
|
|
9025
|
+
let firstHighlightDiv = null;
|
|
9026
|
+
if (safeDocument) {
|
|
9027
|
+
for (let i = 0; i < clientRectList.length; i++) {
|
|
9028
|
+
const rect = clientRectList[i];
|
|
9029
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
9030
|
+
continue;
|
|
9031
|
+
}
|
|
9032
|
+
const div = safeDocument.createElement('div');
|
|
9033
|
+
div.style.position = 'absolute';
|
|
9034
|
+
div.style.top = `${rect.top - overlayRect.top}px`;
|
|
9035
|
+
div.style.left = `${rect.left - overlayRect.left}px`;
|
|
9036
|
+
div.style.width = `${rect.width}px`;
|
|
9037
|
+
div.style.height = `${rect.height}px`;
|
|
9038
|
+
div.style.backgroundColor = bg;
|
|
9039
|
+
div.style.pointerEvents = 'none';
|
|
9040
|
+
div.style.borderRadius = '2px';
|
|
9041
|
+
overlay.appendChild(div);
|
|
9042
|
+
if (!firstHighlightDiv) {
|
|
9043
|
+
firstHighlightDiv = div;
|
|
9044
|
+
}
|
|
9045
|
+
}
|
|
9046
|
+
}
|
|
9047
|
+
return firstHighlightDiv;
|
|
9048
|
+
}
|
|
9049
|
+
/**
|
|
9050
|
+
* Builds a DOM Range for the given node position.
|
|
9051
|
+
*
|
|
9052
|
+
* For standard text nodes (RTETextNode rendered as `<span>`), the first
|
|
9053
|
+
* child is a Text node and offsets apply directly.
|
|
9054
|
+
*
|
|
9055
|
+
* For code block nodes (`<vega-code-block>` with shadow DOM), we traverse
|
|
9056
|
+
* the shadow root's `<code>` element child spans to locate the correct
|
|
9057
|
+
* text positions by accumulated character offset.
|
|
9058
|
+
*
|
|
9059
|
+
* @param {HTMLElement} domElement - The registered DOM element for the node.
|
|
9060
|
+
* @param {NodePosition} nodePosition - The character offsets within the node.
|
|
9061
|
+
* @returns {Nullable<Range>} A Range if successfully built, or null on failure.
|
|
9062
|
+
*/
|
|
9063
|
+
buildRange(domElement, nodePosition) {
|
|
9064
|
+
// <vega-code-block> wraps syntax-highlighted tokens inside a shadow root <code> element.
|
|
9065
|
+
if (nodePosition.node instanceof codeBlock.RTECodeBlockNode) {
|
|
9066
|
+
return this.buildCodeBlockRange(domElement, nodePosition);
|
|
9067
|
+
}
|
|
9068
|
+
// Standard text node: <span> with a direct Text child.
|
|
9069
|
+
const textNode = domElement.firstChild;
|
|
9070
|
+
if (!textNode) {
|
|
9071
|
+
return null;
|
|
9072
|
+
}
|
|
9073
|
+
const safeDocument = tryGetDocument.tryGetDocument();
|
|
9074
|
+
if (safeDocument) {
|
|
9075
|
+
const range = safeDocument.createRange();
|
|
9076
|
+
try {
|
|
9077
|
+
range.setStart(textNode, nodePosition.startOffset);
|
|
9078
|
+
range.setEnd(textNode, nodePosition.endOffset);
|
|
9079
|
+
return range;
|
|
9080
|
+
}
|
|
9081
|
+
catch (_a) {
|
|
9082
|
+
return null;
|
|
9083
|
+
}
|
|
9084
|
+
}
|
|
9085
|
+
return null;
|
|
9086
|
+
}
|
|
9087
|
+
/**
|
|
9088
|
+
* Builds a Range inside a `<vega-code-block>` shadow DOM element.
|
|
9089
|
+
*
|
|
9090
|
+
* `<vega-code-block>` renders its content inside a shadow root with a `<code>`
|
|
9091
|
+
* element containing multiple child `<span>` nodes (one per syntax token).
|
|
9092
|
+
* This method walks all Text nodes within that `<code>` element, accumulating
|
|
9093
|
+
* character length until the positions corresponding to startOffset / endOffset
|
|
9094
|
+
* are found.
|
|
9095
|
+
*
|
|
9096
|
+
* @param {HTMLElement} domElement - The `<vega-code-block>` host element.
|
|
9097
|
+
* @param {NodePosition} nodePosition - The character offsets within the node.
|
|
9098
|
+
* @returns {Range | null} A Range if successfully built, or null on failure.
|
|
9099
|
+
*/
|
|
9100
|
+
buildCodeBlockRange(domElement, nodePosition) {
|
|
9101
|
+
const shadowRoot = domElement.shadowRoot;
|
|
9102
|
+
const codeEl = shadowRoot.querySelector('code');
|
|
9103
|
+
if (!codeEl) {
|
|
9104
|
+
return null;
|
|
9105
|
+
}
|
|
9106
|
+
const safeDocument = tryGetDocument.tryGetDocument();
|
|
9107
|
+
if (safeDocument) {
|
|
9108
|
+
const walker = safeDocument.createTreeWalker(codeEl, NodeFilter.SHOW_TEXT);
|
|
9109
|
+
let accumulated = 0;
|
|
9110
|
+
let startNode = null;
|
|
9111
|
+
let startLocal = 0;
|
|
9112
|
+
let endNode = null;
|
|
9113
|
+
let endLocal = 0;
|
|
9114
|
+
let current = walker.nextNode();
|
|
9115
|
+
while (current) {
|
|
9116
|
+
const len = current.textContent.length;
|
|
9117
|
+
if (!startNode && accumulated + len > nodePosition.startOffset) {
|
|
9118
|
+
startNode = current;
|
|
9119
|
+
startLocal = nodePosition.startOffset - accumulated;
|
|
9120
|
+
}
|
|
9121
|
+
if (accumulated + len >= nodePosition.endOffset) {
|
|
9122
|
+
endNode = current;
|
|
9123
|
+
endLocal = nodePosition.endOffset - accumulated;
|
|
9124
|
+
break;
|
|
9125
|
+
}
|
|
9126
|
+
accumulated += len;
|
|
9127
|
+
current = walker.nextNode();
|
|
9128
|
+
}
|
|
9129
|
+
if (startNode && endNode) {
|
|
9130
|
+
const range = safeDocument.createRange();
|
|
9131
|
+
try {
|
|
9132
|
+
range.setStart(startNode, startLocal);
|
|
9133
|
+
range.setEnd(endNode, endLocal);
|
|
9134
|
+
return range;
|
|
9135
|
+
}
|
|
9136
|
+
catch (_a) {
|
|
9137
|
+
return null;
|
|
9138
|
+
}
|
|
9139
|
+
}
|
|
9140
|
+
}
|
|
9141
|
+
return null;
|
|
9142
|
+
}
|
|
9143
|
+
}
|
|
9144
|
+
|
|
9145
|
+
/**
|
|
9146
|
+
* Creates a new shared controller context with default (empty) state.
|
|
9147
|
+
*
|
|
9148
|
+
* @returns {FindReplaceControllerContext} A fresh context instance.
|
|
9149
|
+
*/
|
|
9150
|
+
function createFindReplaceControllerContext() {
|
|
9151
|
+
return {
|
|
9152
|
+
state: new FindReplaceState(),
|
|
9153
|
+
highlightManager: new FindReplaceHighlightManager(),
|
|
9154
|
+
hostRef: null,
|
|
9155
|
+
keyword: '',
|
|
9156
|
+
};
|
|
9157
|
+
}
|
|
9158
|
+
/**
|
|
9159
|
+
* Abstract base controller for the Find & Replace extension.
|
|
9160
|
+
*
|
|
9161
|
+
* Holds shared operations ({@link setHost}, {@link setKeyword}) and the
|
|
9162
|
+
* common helper {@link applyAndGetResult}. Concrete implementations
|
|
9163
|
+
* ({@link FindController}, {@link ReplaceController}) add the respective
|
|
9164
|
+
* search/navigation and mutation capabilities.
|
|
9165
|
+
*/
|
|
9166
|
+
class FindReplaceControllerAbstract {
|
|
9167
|
+
constructor(context) {
|
|
9168
|
+
this.context = context;
|
|
9169
|
+
}
|
|
9170
|
+
/**
|
|
9171
|
+
* Updates the cached host reference. Called on each render cycle.
|
|
9172
|
+
*
|
|
9173
|
+
* @typedef HTMLVegaRichTextEditorElement - The type of the host rich text editor element.
|
|
9174
|
+
* @param {HTMLVegaRichTextEditorElement} host - The RTE host element.
|
|
9175
|
+
*/
|
|
9176
|
+
setHost(host) {
|
|
9177
|
+
this.context.hostRef = host;
|
|
9178
|
+
}
|
|
9179
|
+
/**
|
|
9180
|
+
* Updates the keyword. Clears previous match results and highlights,
|
|
9181
|
+
* but preserves the flat-text cache so the next find() on the same
|
|
9182
|
+
* document does not re-flatten every block.
|
|
9183
|
+
*
|
|
9184
|
+
* @param {string} keyword - The new search keyword.
|
|
9185
|
+
* @returns {FindReplaceResult} Reset result (0/0).
|
|
9186
|
+
*/
|
|
9187
|
+
setKeyword(keyword) {
|
|
9188
|
+
this.context.keyword = keyword;
|
|
9189
|
+
this.context.state.clearResults();
|
|
9190
|
+
if (this.context.hostRef) {
|
|
9191
|
+
this.context.highlightManager.clear();
|
|
9192
|
+
}
|
|
9193
|
+
return { current: 0, total: 0 };
|
|
9194
|
+
}
|
|
9195
|
+
// ─── Protected ────────────────────────────────────────────────────────────────
|
|
9196
|
+
/**
|
|
9197
|
+
* Applies highlight overlays and returns the current result for the panel.
|
|
9198
|
+
*
|
|
9199
|
+
* @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
|
|
9200
|
+
* @returns {FindReplaceResult} The current match position and total count.
|
|
9201
|
+
*/
|
|
9202
|
+
applyAndGetResult(scrollToActive = true) {
|
|
9203
|
+
const total = this.context.state.getTotal();
|
|
9204
|
+
const current = total > 0 ? this.context.state.getCurrentIndex() + 1 : 0;
|
|
9205
|
+
if (this.context.hostRef) {
|
|
9206
|
+
this.context.highlightManager.apply(this.context.state.getMatches(), this.context.state.getCurrentIndex(), this.context.hostRef, scrollToActive);
|
|
9207
|
+
}
|
|
9208
|
+
return { current, total };
|
|
9209
|
+
}
|
|
9210
|
+
}
|
|
9211
|
+
|
|
9212
|
+
/**
|
|
9213
|
+
* Concrete find controller.
|
|
9214
|
+
*
|
|
9215
|
+
* Provides search, navigation, highlight, and lifecycle capabilities.
|
|
9216
|
+
* Shares state with {@link ReplaceController} via the injected
|
|
9217
|
+
* {@link FindReplaceControllerContext}.
|
|
9218
|
+
*/
|
|
9219
|
+
class FindController extends FindReplaceControllerAbstract {
|
|
9220
|
+
constructor(context) {
|
|
9221
|
+
super(context);
|
|
9222
|
+
}
|
|
9223
|
+
/**
|
|
9224
|
+
* Runs a search with the current keyword on the host's content.
|
|
9225
|
+
* Applies highlights and returns the result for panel display.
|
|
9226
|
+
*
|
|
9227
|
+
* @returns {FindReplaceResult} The match count and current position.
|
|
9228
|
+
*/
|
|
9229
|
+
find() {
|
|
9230
|
+
if (!this.context.hostRef) {
|
|
9231
|
+
return { current: 0, total: 0 };
|
|
9232
|
+
}
|
|
9233
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9234
|
+
return this.applyAndGetResult();
|
|
9235
|
+
}
|
|
9236
|
+
/**
|
|
9237
|
+
* Navigates to the next match.
|
|
9238
|
+
*
|
|
9239
|
+
* @returns {FindReplaceResult} Updated position.
|
|
9240
|
+
*/
|
|
9241
|
+
next() {
|
|
9242
|
+
this.context.state.next();
|
|
9243
|
+
return this.applyAndGetResult();
|
|
9244
|
+
}
|
|
9245
|
+
/**
|
|
9246
|
+
* Navigates to the previous match.
|
|
9247
|
+
*
|
|
9248
|
+
* @returns {FindReplaceResult} Updated position.
|
|
9249
|
+
*/
|
|
9250
|
+
prev() {
|
|
9251
|
+
this.context.state.prev();
|
|
9252
|
+
return this.applyAndGetResult();
|
|
9253
|
+
}
|
|
9254
|
+
/**
|
|
9255
|
+
* Clears all search state and removes highlight overlays.
|
|
9256
|
+
*/
|
|
9257
|
+
clear() {
|
|
9258
|
+
this.context.state.clear();
|
|
9259
|
+
if (this.context.hostRef) {
|
|
9260
|
+
this.context.highlightManager.clear();
|
|
9261
|
+
}
|
|
9262
|
+
}
|
|
9263
|
+
/**
|
|
9264
|
+
* Re-runs the search after content has changed (e.g. user typed while
|
|
9265
|
+
* panel is open). Attempts to preserve the previous navigation position.
|
|
9266
|
+
*
|
|
9267
|
+
* @param {boolean} scrollToActive - Whether to scroll the active highlight into view.
|
|
9268
|
+
* @returns {FindReplaceResult | null} Updated result, or null if no search is active.
|
|
9269
|
+
*/
|
|
9270
|
+
refresh(scrollToActive = true) {
|
|
9271
|
+
if (!this.context.keyword || !this.context.hostRef) {
|
|
9272
|
+
return null;
|
|
9273
|
+
}
|
|
9274
|
+
const prevIndex = this.context.state.getCurrentIndex();
|
|
9275
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9276
|
+
this.context.state.setCurrentIndex(prevIndex);
|
|
9277
|
+
return this.applyAndGetResult(scrollToActive);
|
|
9278
|
+
}
|
|
9279
|
+
/**
|
|
9280
|
+
* Toggles the match-case search option, clears previous results,
|
|
9281
|
+
* and re-runs the search if a keyword is set.
|
|
9282
|
+
*
|
|
9283
|
+
* @param {boolean} enabled - Whether match-case should be enabled.
|
|
9284
|
+
* @returns {FindReplaceResult} The updated search result.
|
|
9285
|
+
*/
|
|
9286
|
+
setMatchCase(enabled) {
|
|
9287
|
+
this.context.state.setMatchCase(enabled);
|
|
9288
|
+
return this.updateFindResults();
|
|
9289
|
+
}
|
|
9290
|
+
/**
|
|
9291
|
+
* Toggles the whole-words search option, clears previous results,
|
|
9292
|
+
* and re-runs the search if a keyword is set.
|
|
9293
|
+
*
|
|
9294
|
+
* @param {boolean} enabled - Whether whole-words should be enabled.
|
|
9295
|
+
* @returns {FindReplaceResult} The updated search result.
|
|
9296
|
+
*/
|
|
9297
|
+
setWholeWords(enabled) {
|
|
9298
|
+
this.context.state.setWholeWords(enabled);
|
|
9299
|
+
return this.updateFindResults();
|
|
9300
|
+
}
|
|
9301
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
9302
|
+
/**
|
|
9303
|
+
* Clears previous results and re-runs the search with the current keyword and options.
|
|
9304
|
+
*
|
|
9305
|
+
* @returns {FindReplaceResult} The updated search result.
|
|
9306
|
+
*/
|
|
9307
|
+
updateFindResults() {
|
|
9308
|
+
this.context.state.clearResults();
|
|
9309
|
+
if (this.context.keyword && this.context.hostRef) {
|
|
9310
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9311
|
+
return this.applyAndGetResult();
|
|
9312
|
+
}
|
|
9313
|
+
return { current: 0, total: 0 };
|
|
9314
|
+
}
|
|
9315
|
+
}
|
|
9316
|
+
|
|
9317
|
+
/**
|
|
9318
|
+
* Replace controller — adds mutation capabilities on top of the shared
|
|
9319
|
+
* find state.
|
|
9320
|
+
*
|
|
9321
|
+
* Shares state with {@link FindController} via the injected
|
|
9322
|
+
* {@link FindReplaceControllerContext}, so both controllers always operate
|
|
9323
|
+
* on the same search results and highlight overlays.
|
|
9324
|
+
*/
|
|
9325
|
+
class ReplaceController extends FindReplaceControllerAbstract {
|
|
9326
|
+
constructor(context) {
|
|
9327
|
+
super(context);
|
|
9328
|
+
/** The replacement string used by replace() and replaceAll(). Updated via setReplacement(). */
|
|
9329
|
+
this.replacement = '';
|
|
9330
|
+
this.flushFn = null;
|
|
9331
|
+
}
|
|
9332
|
+
/**
|
|
9333
|
+
* Stores the flush callback used to commit content changes to the editor.
|
|
9334
|
+
* Called by the toolbar renderer after obtaining it from the extension context.
|
|
9335
|
+
*
|
|
9336
|
+
* Calling `flushValue` once — even after mutating multiple nodes — creates a
|
|
9337
|
+
* single entry in the editor's undo stack, so the entire replace/replaceAll
|
|
9338
|
+
* operation is undone as one atomic step.
|
|
9339
|
+
*
|
|
9340
|
+
* @param {(value: VegaRTEContent) => void} fn - The flush function.
|
|
9341
|
+
* @returns {void} No return value.
|
|
9342
|
+
*/
|
|
9343
|
+
setFlushValue(fn) {
|
|
9344
|
+
this.flushFn = fn;
|
|
9345
|
+
}
|
|
9346
|
+
/**
|
|
9347
|
+
* Stores the replacement text for the next replace() or replaceAll() call.
|
|
9348
|
+
*
|
|
9349
|
+
* @param {string} text - The replacement string.
|
|
9350
|
+
* @returns {void} No return value.
|
|
9351
|
+
*/
|
|
9352
|
+
setReplacement(text) {
|
|
9353
|
+
this.replacement = text;
|
|
9354
|
+
}
|
|
9355
|
+
/**
|
|
9356
|
+
* Replaces the current match with the stored replacement text,
|
|
9357
|
+
* advances to the next match, and refreshes highlights.
|
|
9358
|
+
* An empty replacement string deletes the matched text.
|
|
9359
|
+
*
|
|
9360
|
+
* No-op when there is no current match or no host.
|
|
9361
|
+
*
|
|
9362
|
+
* @returns {FindReplaceResult} Updated match position and total.
|
|
9363
|
+
*/
|
|
9364
|
+
replace() {
|
|
9365
|
+
const currentMatch = this.context.state.getCurrentMatch();
|
|
9366
|
+
if (currentMatch && this.context.hostRef && this.flushFn) {
|
|
9367
|
+
const previousIndex = this.context.state.getCurrentIndex();
|
|
9368
|
+
this.applyMatchReplacement(currentMatch);
|
|
9369
|
+
this.flushFn(this.context.hostRef.value);
|
|
9370
|
+
this.context.state.clear();
|
|
9371
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9372
|
+
// setCurrentIndex clamps to [0, total-1], so passing previousIndex
|
|
9373
|
+
// directly keeps the cursor as close as possible to the replaced position
|
|
9374
|
+
// rather than wrapping around when previousIndex >= total.
|
|
9375
|
+
this.context.state.setCurrentIndex(previousIndex);
|
|
9376
|
+
}
|
|
9377
|
+
return this.applyAndGetResult();
|
|
9378
|
+
}
|
|
9379
|
+
/**
|
|
9380
|
+
* Replaces all matches with the stored replacement text in a single operation
|
|
9381
|
+
* (one flushValue call = one Undo step), then re-runs the search.
|
|
9382
|
+
* An empty replacement string deletes all matched text.
|
|
9383
|
+
*
|
|
9384
|
+
* No-op when there are no matches or no host.
|
|
9385
|
+
*
|
|
9386
|
+
* @returns {FindReplaceResult} Updated match position and total.
|
|
9387
|
+
*/
|
|
9388
|
+
replaceAll() {
|
|
9389
|
+
if (this.context.state.getTotal() > 0 && this.flushFn && this.context.hostRef) {
|
|
9390
|
+
const matches = this.context.state.getMatches();
|
|
9391
|
+
// Iterate in reverse so that mutating a later match does not shift the
|
|
9392
|
+
// startOffset/endOffset of earlier matches that have not yet been processed.
|
|
9393
|
+
for (let i = matches.length - 1; i >= 0; i -= 1) {
|
|
9394
|
+
this.applyMatchReplacement(matches[i]);
|
|
9395
|
+
}
|
|
9396
|
+
this.flushFn(this.context.hostRef.value);
|
|
9397
|
+
this.context.state.clear();
|
|
9398
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
9399
|
+
}
|
|
9400
|
+
return this.applyAndGetResult();
|
|
9401
|
+
}
|
|
9402
|
+
// ─── Private ──────────────────────────────────────────────────────────────────
|
|
9403
|
+
/**
|
|
9404
|
+
* Directly mutates the matched nodes in the live content tree.
|
|
9405
|
+
* `position.node` is already a reference into `this.context.hostRef.value`,
|
|
9406
|
+
* so no cloning or path navigation is needed.
|
|
9407
|
+
*
|
|
9408
|
+
* For multi-node (cross-span) matches the first node receives the replacement
|
|
9409
|
+
* text and every subsequent node has its matched slice deleted.
|
|
9410
|
+
*
|
|
9411
|
+
* This method mutates the content tree in place. The caller is
|
|
9412
|
+
* responsible for calling `state.clear()` afterwards to invalidate the
|
|
9413
|
+
* flat-text cache, which uses reference equality and will not detect the
|
|
9414
|
+
* in-place change automatically.
|
|
9415
|
+
*
|
|
9416
|
+
* @param {FindMatch} match - The match to replace.
|
|
9417
|
+
* @returns {void} No return value.
|
|
9418
|
+
*/
|
|
9419
|
+
applyMatchReplacement(match) {
|
|
9420
|
+
match.nodes.forEach((position, index) => {
|
|
9421
|
+
const replacementText = index === 0 ? this.replacement : '';
|
|
9422
|
+
position.node.text =
|
|
9423
|
+
position.node.text.slice(0, position.startOffset) +
|
|
9424
|
+
replacementText +
|
|
9425
|
+
position.node.text.slice(position.endOffset);
|
|
9426
|
+
});
|
|
9427
|
+
}
|
|
9428
|
+
}
|
|
9429
|
+
|
|
9430
|
+
/**
|
|
9431
|
+
* Toolbar button renderer for the Find & Replace extension.
|
|
9432
|
+
*
|
|
9433
|
+
* Responsible only for UI concerns:
|
|
9434
|
+
* - Renders the toolbar button wrapped in a vega-popover.
|
|
9435
|
+
* - Wires panel events to the {@link FindController} and {@link ReplaceController}.
|
|
9436
|
+
* - Pushes controller results back to the panel display.
|
|
9437
|
+
*
|
|
9438
|
+
* Both controllers share a single {@link FindReplaceControllerContext} so they
|
|
9439
|
+
* operate on the same search state and highlight overlays.
|
|
9440
|
+
*/
|
|
9441
|
+
class FindReplaceToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
9442
|
+
constructor() {
|
|
9443
|
+
super(...arguments);
|
|
9444
|
+
this.sharedContext = createFindReplaceControllerContext();
|
|
9445
|
+
this.findController = new FindController(this.sharedContext);
|
|
9446
|
+
this.replaceController = new ReplaceController(this.sharedContext);
|
|
9447
|
+
this.panelRef = null;
|
|
9448
|
+
this.popoverRef = null;
|
|
9449
|
+
this.isPopoverOpen = false;
|
|
9450
|
+
this.scrollOnNextRefresh = false;
|
|
9451
|
+
this.debouncedRefresh = timer.debounce(this.onContentChanged, 100, this);
|
|
9452
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
9453
|
+
this.panelActionHandlers = {
|
|
9454
|
+
'find': () => this.findController.find(),
|
|
9455
|
+
'prev': () => this.findController.prev(),
|
|
9456
|
+
'next': () => this.findController.next(),
|
|
9457
|
+
'replace': () => {
|
|
9458
|
+
this.scrollOnNextRefresh = true;
|
|
9459
|
+
return this.replaceController.replace();
|
|
9460
|
+
},
|
|
9461
|
+
'replace-all': () => {
|
|
9462
|
+
this.scrollOnNextRefresh = true;
|
|
9463
|
+
return this.replaceController.replaceAll();
|
|
9464
|
+
},
|
|
9465
|
+
'match-case': (data) => this.findController.setMatchCase(data),
|
|
9466
|
+
'whole-words': (data) => this.findController.setWholeWords(data),
|
|
9467
|
+
'close': () => this.closePanel(),
|
|
9468
|
+
};
|
|
9469
|
+
}
|
|
9470
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
9471
|
+
/**
|
|
9472
|
+
* @inheritDoc
|
|
9473
|
+
*/
|
|
9474
|
+
render(h, editorContext) {
|
|
9475
|
+
this.syncEditorState(editorContext);
|
|
9476
|
+
return h('vega-popover', {
|
|
9477
|
+
trigger: 'none',
|
|
9478
|
+
alignment: 'start',
|
|
9479
|
+
placement: 'bottom',
|
|
9480
|
+
showArrow: false,
|
|
9481
|
+
isScreenPosition: true,
|
|
9482
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
9483
|
+
ref: (ref) => {
|
|
9484
|
+
if (ref) {
|
|
9485
|
+
this.popoverRef = ref;
|
|
9486
|
+
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, vegaEventId.VegaPopoverHide, () => {
|
|
9487
|
+
this.isPopoverOpen = false;
|
|
9488
|
+
this.findController.clear();
|
|
9489
|
+
this.updatePanel({ current: 0, total: 0 });
|
|
9490
|
+
});
|
|
9491
|
+
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, vegaEventId.VegaPopoverShow, () => {
|
|
9492
|
+
this.isPopoverOpen = true;
|
|
9493
|
+
});
|
|
9494
|
+
}
|
|
9495
|
+
},
|
|
9496
|
+
}, [
|
|
9497
|
+
h('div', { slot: 'popover' }, [
|
|
9498
|
+
h('vega-rich-text-find-replace-panel', {
|
|
9499
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
9500
|
+
ref: (ref) => {
|
|
9501
|
+
if (ref) {
|
|
9502
|
+
this.panelRef = ref;
|
|
9503
|
+
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, vegaEventId.VegaChange, (e) => {
|
|
9504
|
+
if (e.detail.type === 'keyword') {
|
|
9505
|
+
this.updatePanel(this.findController.setKeyword(e.detail.value));
|
|
9506
|
+
}
|
|
9507
|
+
else if (e.detail.type === 'replace') {
|
|
9508
|
+
this.replaceController.setReplacement(e.detail.value);
|
|
9509
|
+
}
|
|
9510
|
+
});
|
|
9511
|
+
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, vegaEventId.VegaClick, (payload) => {
|
|
9512
|
+
this.handlePanelAction(payload.detail);
|
|
9513
|
+
});
|
|
9514
|
+
}
|
|
9515
|
+
},
|
|
9516
|
+
}),
|
|
9517
|
+
]),
|
|
9518
|
+
h('div', { slot: 'popover-content' }, this.renderButton(h, editorContext, {
|
|
9519
|
+
icon: 'rte-find-replace',
|
|
9520
|
+
tooltip: { text: internalTranslationController.VegaInternalTranslation.t('Find and replace') },
|
|
9521
|
+
})),
|
|
9522
|
+
]);
|
|
9523
|
+
}
|
|
9524
|
+
/**
|
|
9525
|
+
* Toggles the popover open/close when the toolbar button is clicked.
|
|
9526
|
+
*/
|
|
9527
|
+
handleButtonClick() {
|
|
9528
|
+
if (this.popoverRef) {
|
|
9529
|
+
if (this.isPopoverOpen) {
|
|
9530
|
+
void this.popoverRef.hide();
|
|
9531
|
+
}
|
|
9532
|
+
else {
|
|
9533
|
+
void this.popoverRef.show();
|
|
9534
|
+
}
|
|
9535
|
+
}
|
|
9536
|
+
}
|
|
9537
|
+
/* istanbul ignore next */
|
|
9538
|
+
/**
|
|
9539
|
+
* Not used — this button has no dropdown.
|
|
9540
|
+
*/
|
|
9541
|
+
handleDropdownClick() {
|
|
9542
|
+
// no-op
|
|
9543
|
+
}
|
|
9544
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
9545
|
+
/**
|
|
9546
|
+
* Synchronizes internal state with the editor context on each render cycle.
|
|
9547
|
+
* Registers the host reference and content-change listener, and hides the
|
|
9548
|
+
* popover if the toolbar item becomes hidden while open.
|
|
9549
|
+
*
|
|
9550
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context.
|
|
9551
|
+
*/
|
|
9552
|
+
syncEditorState(editorContext) {
|
|
9553
|
+
this.findController.setHost(editorContext.host);
|
|
9554
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
9555
|
+
if (extensionContext) {
|
|
9556
|
+
this.replaceController.setFlushValue(extensionContext.flushValue);
|
|
9557
|
+
}
|
|
9558
|
+
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(editorContext.host, vegaEventId.VegaChange, this.debouncedRefresh);
|
|
9559
|
+
if (this.isHidden(editorContext) && this.isPopoverOpen && this.popoverRef) {
|
|
9560
|
+
void this.popoverRef.hide();
|
|
9561
|
+
}
|
|
9562
|
+
}
|
|
9563
|
+
/**
|
|
9564
|
+
* Dispatches panel button actions to the controller.
|
|
9565
|
+
*
|
|
9566
|
+
* @param {FindReplacePanelAction} panelAction - The structured action emitted by the panel.
|
|
9567
|
+
*/
|
|
9568
|
+
handlePanelAction(panelAction) {
|
|
9569
|
+
const { action, data } = panelAction;
|
|
9570
|
+
const handler = this.panelActionHandlers[action];
|
|
9571
|
+
if (handler) {
|
|
9572
|
+
const result = handler(data);
|
|
9573
|
+
if (result) {
|
|
9574
|
+
this.updatePanel(result);
|
|
9575
|
+
}
|
|
9576
|
+
}
|
|
9577
|
+
}
|
|
9578
|
+
/**
|
|
9579
|
+
* Pushes result to the panel counter display.
|
|
9580
|
+
*
|
|
9581
|
+
* @param {FindReplaceResult} result - The current/total values.
|
|
9582
|
+
*/
|
|
9583
|
+
updatePanel(result) {
|
|
9584
|
+
if (this.panelRef) {
|
|
9585
|
+
void this.panelRef.updateResult(result.current, result.total);
|
|
9586
|
+
}
|
|
9587
|
+
}
|
|
9588
|
+
/**
|
|
9589
|
+
* Content changed — ask the controller to refresh search results.
|
|
9590
|
+
*/
|
|
9591
|
+
onContentChanged() {
|
|
9592
|
+
if (!this.isPopoverOpen) {
|
|
9593
|
+
return;
|
|
9594
|
+
}
|
|
9595
|
+
const shouldScroll = this.scrollOnNextRefresh;
|
|
9596
|
+
this.scrollOnNextRefresh = false;
|
|
9597
|
+
const result = this.findController.refresh(shouldScroll);
|
|
9598
|
+
if (result) {
|
|
9599
|
+
this.updatePanel(result);
|
|
9600
|
+
}
|
|
9601
|
+
}
|
|
9602
|
+
/**
|
|
9603
|
+
* Closes the panel popover.
|
|
9604
|
+
*/
|
|
9605
|
+
closePanel() {
|
|
9606
|
+
if (this.popoverRef) {
|
|
9607
|
+
void this.popoverRef.hide();
|
|
9608
|
+
}
|
|
9609
|
+
}
|
|
9610
|
+
}
|
|
9611
|
+
(() => {
|
|
9612
|
+
internalIconManager.VegaInternalIconManager.register({ 'rte-find-replace': findReplaceIcon });
|
|
9613
|
+
})();
|
|
9614
|
+
|
|
9615
|
+
/**
|
|
9616
|
+
* Find & Replace extension for Vega Rich Text Editor.
|
|
9617
|
+
*
|
|
9618
|
+
* Registers a toolbar button (magnifying-glass icon) that toggles the find-replace panel.
|
|
9619
|
+
* Each editor host gets its own isolated FindReplaceState and toolbar renderer instance,
|
|
9620
|
+
* created during the per-host prepareBeforeLoad lifecycle hook.
|
|
9621
|
+
*
|
|
9622
|
+
* Toolbar key: 'findReplace'
|
|
9623
|
+
*/
|
|
9624
|
+
class VegaRTEFindReplaceExtension extends linkExtension.VegaRTEExtension {
|
|
9625
|
+
/** @inheritDoc */
|
|
9626
|
+
prepareBeforeLoad(host) {
|
|
9627
|
+
this.registerToolbarButtonRenderer(VegaRTEFindReplaceExtension.TOOLBAR_BUTTON_KEY, new FindReplaceToolbarButtonRenderer(), host);
|
|
9628
|
+
}
|
|
9629
|
+
}
|
|
9630
|
+
VegaRTEFindReplaceExtension.TOOLBAR_BUTTON_KEY = 'findReplace';
|
|
9631
|
+
|
|
9632
|
+
/**
|
|
9633
|
+
* Default line height options used by the line-height extension when no
|
|
9634
|
+
* custom options are provided.
|
|
9635
|
+
*/
|
|
9636
|
+
const VegaRTEDefaultLineHeightOptions = [
|
|
9637
|
+
{ title: '0.5', value: '0.5' },
|
|
9638
|
+
{ title: '1', value: '1' },
|
|
9639
|
+
{ title: '1.5', value: '1.5' },
|
|
9640
|
+
{ title: '2', value: '2' },
|
|
9641
|
+
{ title: '2.5', value: '2.5' },
|
|
9642
|
+
];
|
|
9643
|
+
|
|
9644
|
+
var RTELineHeightExtensionAnnotationTypeEnum;
|
|
9645
|
+
(function (RTELineHeightExtensionAnnotationTypeEnum) {
|
|
9646
|
+
RTELineHeightExtensionAnnotationTypeEnum["LINE_HEIGHT"] = "LINE_HEIGHT";
|
|
9647
|
+
})(RTELineHeightExtensionAnnotationTypeEnum || (RTELineHeightExtensionAnnotationTypeEnum = {}));
|
|
9648
|
+
/**
|
|
9649
|
+
* Annotation to set block line height.
|
|
9650
|
+
*/
|
|
9651
|
+
class LineHeightAnnotation extends codeBlock.BlockAnnotation {
|
|
9652
|
+
constructor(lineHeight) {
|
|
9653
|
+
super();
|
|
9654
|
+
this.type = RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT;
|
|
9655
|
+
this.lineHeight = lineHeight;
|
|
9656
|
+
}
|
|
9657
|
+
/**
|
|
9658
|
+
* Generate the map item for the annotation.
|
|
9659
|
+
*
|
|
9660
|
+
* @param {string} lineHeight - Line height value.
|
|
9661
|
+
* @returns {[RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT, LineHeightAnnotation]} Map item for the annotation.
|
|
9662
|
+
*/
|
|
9663
|
+
static from(lineHeight) {
|
|
9664
|
+
return [RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT, new LineHeightAnnotation(lineHeight)];
|
|
9665
|
+
}
|
|
9666
|
+
/**
|
|
9667
|
+
* Get the default standalone styles for a given line height value.
|
|
9668
|
+
*
|
|
9669
|
+
* @param {string} lineHeight - The line height value.
|
|
9670
|
+
* @returns {AnnotationStyle} The default standalone styles.
|
|
9671
|
+
*/
|
|
9672
|
+
static getDefaultStyles(lineHeight) {
|
|
9673
|
+
return { lineHeight };
|
|
9674
|
+
}
|
|
9675
|
+
/**
|
|
9676
|
+
* Generate the JSON item of the annotation.
|
|
9677
|
+
*
|
|
9678
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation.
|
|
9679
|
+
*/
|
|
9680
|
+
toJSON() {
|
|
9681
|
+
return {
|
|
9682
|
+
lineHeight: this.lineHeight,
|
|
9683
|
+
};
|
|
9684
|
+
}
|
|
9685
|
+
/**
|
|
9686
|
+
* @inheritDoc
|
|
9687
|
+
*/
|
|
9688
|
+
renderClass() {
|
|
9689
|
+
return null;
|
|
9690
|
+
}
|
|
9691
|
+
/**
|
|
9692
|
+
* @inheritDoc
|
|
9693
|
+
*/
|
|
9694
|
+
clone() {
|
|
9695
|
+
return new LineHeightAnnotation(this.lineHeight);
|
|
9696
|
+
}
|
|
9697
|
+
/**
|
|
9698
|
+
* @inheritDoc
|
|
9699
|
+
*/
|
|
9700
|
+
renderStyle() {
|
|
9701
|
+
return LineHeightAnnotation.getDefaultStyles(this.lineHeight);
|
|
9702
|
+
}
|
|
9703
|
+
}
|
|
9704
|
+
|
|
9705
|
+
/**
|
|
9706
|
+
* Action to update block line height annotation.
|
|
9707
|
+
*/
|
|
9708
|
+
class LineHeightAnnotationAction extends codeBlock.AnnotationAction {
|
|
9709
|
+
constructor(lineHeight) {
|
|
9710
|
+
super();
|
|
9711
|
+
this.isFlushable = true;
|
|
9712
|
+
this.lineHeight = lineHeight;
|
|
9713
|
+
}
|
|
9714
|
+
/**
|
|
9715
|
+
* Converts the action to an annotation.
|
|
9716
|
+
*
|
|
9717
|
+
* @returns {LineHeightAnnotation} The annotation.
|
|
9718
|
+
*/
|
|
9719
|
+
toAnnotation() {
|
|
9720
|
+
return new LineHeightAnnotation(this.lineHeight);
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9723
|
+
|
|
9724
|
+
/**
|
|
9725
|
+
* Update the block line height strategy.
|
|
9726
|
+
*
|
|
9727
|
+
* Registered for RTETextBlock and RTEListItemBlock, so the
|
|
9728
|
+
* target type is widened to the common RTEBlock base.
|
|
9729
|
+
*/
|
|
9730
|
+
class BlockUpdateLineHeightStrategy extends codeBlock.ActionHandleStrategy {
|
|
9731
|
+
/**
|
|
9732
|
+
* Updating the line height of a block requires cascading updates to the custom style.
|
|
9733
|
+
*
|
|
9734
|
+
* @param {LineHeightAnnotationAction} _action - The line height annotation action.
|
|
9735
|
+
* @param {RTEBlock} target - The current block.
|
|
9736
|
+
*/
|
|
9737
|
+
handleAction(_action, target) {
|
|
9738
|
+
this.updateCustomStyleAnnotation(target, ['lineHeight']);
|
|
9739
|
+
}
|
|
9740
|
+
}
|
|
9741
|
+
|
|
9742
|
+
const lineHeight = {
|
|
9743
|
+
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>`,
|
|
9744
|
+
};
|
|
9745
|
+
|
|
9746
|
+
/**
|
|
9747
|
+
* Renderer for the line-height toolbar button in the Vega Rich Text Editor.
|
|
9748
|
+
*/
|
|
9749
|
+
class RTELineHeightToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
9750
|
+
constructor(options) {
|
|
9751
|
+
super();
|
|
9752
|
+
this.options = options;
|
|
9753
|
+
}
|
|
9754
|
+
/**
|
|
9755
|
+
* @inheritDoc
|
|
9756
|
+
*/
|
|
9757
|
+
render(createElement, editorContext) {
|
|
9758
|
+
const dropdownItems = this.options.map((item) => {
|
|
9759
|
+
var _a;
|
|
9760
|
+
return ({
|
|
9761
|
+
key: item.value,
|
|
9762
|
+
label: (_a = item.title) !== null && _a !== void 0 ? _a : item.value,
|
|
9763
|
+
});
|
|
9764
|
+
});
|
|
9765
|
+
return this.renderDropdown(createElement, editorContext, {
|
|
9766
|
+
selectType: 'single',
|
|
9767
|
+
selectedSourceKey: this.getSelectedSourceValue(editorContext),
|
|
9768
|
+
}, [
|
|
9769
|
+
this.renderButton(createElement, editorContext, {
|
|
9770
|
+
icon: 'line-height',
|
|
9771
|
+
showArrowIcon: true,
|
|
9772
|
+
tooltip: { text: internalTranslationController.VegaInternalTranslation.t('Line Height') },
|
|
9773
|
+
}),
|
|
9774
|
+
this.renderDropdownListTemplate(createElement, dropdownItems, editorContext),
|
|
9775
|
+
]);
|
|
9776
|
+
}
|
|
9777
|
+
/**
|
|
9778
|
+
* @inheritDoc
|
|
9779
|
+
*/
|
|
9780
|
+
isSelected() {
|
|
9781
|
+
return false;
|
|
9782
|
+
}
|
|
9783
|
+
/**
|
|
9784
|
+
* @inheritDoc
|
|
9785
|
+
*/
|
|
9786
|
+
isDisabled(editorContext) {
|
|
9787
|
+
var _a;
|
|
9788
|
+
if (editorContext.host.disabled) {
|
|
9789
|
+
return true;
|
|
9790
|
+
}
|
|
9791
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
9792
|
+
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
9793
|
+
if (selectedNodes.some((node) => {
|
|
9794
|
+
var _a;
|
|
9795
|
+
return ((_a = node.getAnnotationByType(codeBlock.NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
9796
|
+
node.parent instanceof codeBlock.RTECodeBlock;
|
|
9797
|
+
})) {
|
|
9798
|
+
return true;
|
|
9799
|
+
}
|
|
9800
|
+
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
9801
|
+
return selectedBlocks.some((block) => block instanceof codeBlock.RTECodeBlock ||
|
|
9802
|
+
block instanceof contentState.RTEImageBlock ||
|
|
9803
|
+
!codeBlock.ActionHandleStrategyRegistry.canHandle(LineHeightAnnotationAction.name, block));
|
|
9804
|
+
}
|
|
9805
|
+
/**
|
|
9806
|
+
* @inheritDoc
|
|
9807
|
+
*/
|
|
9808
|
+
handleDropdownClick(itemValue, editorContext) {
|
|
9809
|
+
const selectedLineHeight = itemValue;
|
|
9810
|
+
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
9811
|
+
selectedBlocks.forEach((block) => {
|
|
9812
|
+
block.apply(new LineHeightAnnotationAction(selectedLineHeight));
|
|
9813
|
+
});
|
|
9814
|
+
}
|
|
9815
|
+
/**
|
|
9816
|
+
* Handle direct toolbar button click.
|
|
9817
|
+
*/
|
|
9818
|
+
handleButtonClick() {
|
|
9819
|
+
// No direct click action; selection happens in dropdown options.
|
|
9820
|
+
}
|
|
9821
|
+
/**
|
|
9822
|
+
* Get the selected line-height key for dropdown selection state.
|
|
9823
|
+
*
|
|
9824
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - Current toolbar context.
|
|
9825
|
+
* @returns {string} Selected line-height key or empty string for mixed/none.
|
|
9826
|
+
*/
|
|
9827
|
+
getSelectedSourceValue(editorContext) {
|
|
9828
|
+
const selectedBlocks = this.getSelectedBlocks(editorContext);
|
|
9829
|
+
if (selectedBlocks.length === 0) {
|
|
9830
|
+
return '';
|
|
9831
|
+
}
|
|
9832
|
+
const firstAnnotation = selectedBlocks[0].getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
9833
|
+
const isSameLineHeight = selectedBlocks.every((block) => {
|
|
9834
|
+
const annotation = block.getAnnotationByType(RTELineHeightExtensionAnnotationTypeEnum.LINE_HEIGHT);
|
|
9835
|
+
return (annotation === null || annotation === void 0 ? void 0 : annotation.lineHeight) === (firstAnnotation === null || firstAnnotation === void 0 ? void 0 : firstAnnotation.lineHeight);
|
|
9836
|
+
});
|
|
9837
|
+
return isSameLineHeight && firstAnnotation ? firstAnnotation.lineHeight : '';
|
|
9838
|
+
}
|
|
9839
|
+
/**
|
|
9840
|
+
* Resolve selected blocks from selected nodes with range fallback.
|
|
9841
|
+
*
|
|
9842
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - Current toolbar context.
|
|
9843
|
+
* @returns {RTEBlock[]} Selected blocks.
|
|
9844
|
+
*/
|
|
9845
|
+
getSelectedBlocks(editorContext) {
|
|
9846
|
+
var _a, _b;
|
|
9847
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
9848
|
+
const selectedNodes = (_a = extensionContext === null || extensionContext === void 0 ? void 0 : extensionContext.getSelectedNodes()) !== null && _a !== void 0 ? _a : [];
|
|
9849
|
+
const selectedBlocks = [];
|
|
9850
|
+
selectedNodes.forEach((node) => {
|
|
9851
|
+
if (node.parent instanceof codeBlock.RTEBlock && !selectedBlocks.includes(node.parent)) {
|
|
9852
|
+
selectedBlocks.push(node.parent);
|
|
9853
|
+
}
|
|
9854
|
+
});
|
|
9855
|
+
if (selectedBlocks.length === 0 && ((_b = editorContext.rteRange.startNode) === null || _b === void 0 ? void 0 : _b.parent) instanceof codeBlock.RTEBlock) {
|
|
9856
|
+
selectedBlocks.push(editorContext.rteRange.startNode.parent);
|
|
9857
|
+
}
|
|
9858
|
+
return selectedBlocks;
|
|
9859
|
+
}
|
|
9860
|
+
}
|
|
9861
|
+
(() => {
|
|
9862
|
+
internalIconManager.VegaInternalIconManager.register({
|
|
9863
|
+
'line-height': lineHeight,
|
|
9864
|
+
});
|
|
9865
|
+
})();
|
|
9866
|
+
|
|
9867
|
+
const LINE_HEIGHT_AWARE_BLOCK_NAMES = new Set([
|
|
9868
|
+
codeBlock.RTETextBlock.name,
|
|
9869
|
+
contentState.RTEListItemBlock.name,
|
|
9870
|
+
]);
|
|
9871
|
+
/** Handle line height annotation. */
|
|
9872
|
+
class LineHeightAnnotationHandler extends contentState.AnnotationGeneratorStrategyAbstract {
|
|
9873
|
+
constructor(options = VegaRTEDefaultLineHeightOptions) {
|
|
9874
|
+
super();
|
|
9875
|
+
this.allowedLineHeights = new Set(options.map((option) => option.value));
|
|
9876
|
+
}
|
|
9877
|
+
/**
|
|
9878
|
+
* Can be handled.
|
|
9879
|
+
*
|
|
9880
|
+
* @param {RTEDtoClassPrototype} targetDto - Target DTO.
|
|
9881
|
+
* @returns {boolean} Whether the target DTO supports line-height annotations.
|
|
9882
|
+
*/
|
|
9883
|
+
canHandle(targetDto) {
|
|
9884
|
+
return LINE_HEIGHT_AWARE_BLOCK_NAMES.has(targetDto.name);
|
|
9885
|
+
}
|
|
9886
|
+
/**
|
|
9887
|
+
* Extract inline `line-height` as a semantic `lineHeight` annotation.
|
|
9888
|
+
*
|
|
9889
|
+
* @param {HTMLElement} [element] - Current element.
|
|
9890
|
+
* @returns {VegaRTEBlockAnnotations} `{ lineHeight }` when present, otherwise `{}`.
|
|
9891
|
+
*/
|
|
9892
|
+
handle(element) {
|
|
8674
9893
|
var _a, _b;
|
|
8675
9894
|
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 : '';
|
|
8676
9895
|
if (!lineHeight) {
|
|
@@ -8809,7 +10028,7 @@ class VegaRTELineHeightExtension extends linkExtension.VegaRTEExtension {
|
|
|
8809
10028
|
*/
|
|
8810
10029
|
prepareBeforeLoad(host) {
|
|
8811
10030
|
this.toolbarButtonRenderer = new RTELineHeightToolbarButtonRenderer(this.options);
|
|
8812
|
-
this.registerToolbarButtonRenderer(
|
|
10031
|
+
this.registerToolbarButtonRenderer(VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer, host);
|
|
8813
10032
|
}
|
|
8814
10033
|
}
|
|
8815
10034
|
(() => {
|
|
@@ -8819,6 +10038,396 @@ class VegaRTELineHeightExtension extends linkExtension.VegaRTEExtension {
|
|
|
8819
10038
|
attachLineHeightFromJson(BlockClass);
|
|
8820
10039
|
});
|
|
8821
10040
|
})();
|
|
10041
|
+
VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY = 'lineHeight';
|
|
10042
|
+
|
|
10043
|
+
/**
|
|
10044
|
+
* Action to extract the currently selected content (HTML and plain text) from the editor.
|
|
10045
|
+
*
|
|
10046
|
+
* The action is read-only: it does not mutate the content state. The handling strategy resolves
|
|
10047
|
+
* the selected HTML and plain text and writes them directly to the clipboard.
|
|
10048
|
+
*
|
|
10049
|
+
* @example host.value.apply(new CopySelectedContentAction(selection, selectedNodes));
|
|
10050
|
+
*/
|
|
10051
|
+
class CopySelectedContentAction extends codeBlock.ModifyContentAction {
|
|
10052
|
+
constructor(selection, selectedNodes) {
|
|
10053
|
+
super();
|
|
10054
|
+
this.type = 'COPY_SELECTED_CONTENT_ACTION';
|
|
10055
|
+
this.selection = null;
|
|
10056
|
+
this.selectedNodes = [];
|
|
10057
|
+
// The result of the copy operation, which may be a Promise if the clipboard write is asynchronous.
|
|
10058
|
+
this.copyResult = null;
|
|
10059
|
+
this.selection = selection;
|
|
10060
|
+
this.selectedNodes = selectedNodes;
|
|
10061
|
+
}
|
|
10062
|
+
}
|
|
10063
|
+
|
|
10064
|
+
/**
|
|
10065
|
+
* Toolbar button renderer for the Copy extension.
|
|
10066
|
+
* Renders a toolbar button that copies the currently selected editor text to the clipboard.
|
|
10067
|
+
*/
|
|
10068
|
+
class RTECopyToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
10069
|
+
/**
|
|
10070
|
+
* Renders the copy toolbar button.
|
|
10071
|
+
*
|
|
10072
|
+
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
10073
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10074
|
+
* @returns {VegaRTERenderResult} - The toolbar button render result.
|
|
10075
|
+
*/
|
|
10076
|
+
render(h, editorContext) {
|
|
10077
|
+
return this.renderButton(h, editorContext, {
|
|
10078
|
+
icon: 'rte-copy',
|
|
10079
|
+
tooltip: { text: 'Copy' },
|
|
10080
|
+
});
|
|
10081
|
+
}
|
|
10082
|
+
/**
|
|
10083
|
+
* Determines if the copy button should be disabled.
|
|
10084
|
+
* Disabled when the editor is disabled or when no content is selected.
|
|
10085
|
+
*
|
|
10086
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10087
|
+
* @returns {boolean} - True if the button should be disabled.
|
|
10088
|
+
*/
|
|
10089
|
+
isDisabled(editorContext) {
|
|
10090
|
+
const context = this.getExtensionContext(editorContext.host);
|
|
10091
|
+
return (!context || context.host.disabled || !context.getSelection() || context.getSelection().isCollapsed);
|
|
10092
|
+
}
|
|
10093
|
+
/**
|
|
10094
|
+
* Handles the copy button click event.
|
|
10095
|
+
* Dispatches a copy action through `host.value`; the action handler extracts the current selection
|
|
10096
|
+
* and writes the resulting HTML and plain text content to the clipboard.
|
|
10097
|
+
*
|
|
10098
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10099
|
+
*/
|
|
10100
|
+
handleButtonClick(editorContext) {
|
|
10101
|
+
const context = this.getExtensionContext(editorContext.host);
|
|
10102
|
+
if (context && context.host) {
|
|
10103
|
+
context.host.value.apply(new CopySelectedContentAction(context.getSelection(), context.getSelectedNodes()));
|
|
10104
|
+
}
|
|
10105
|
+
}
|
|
10106
|
+
/*istanbul ignore next*/
|
|
10107
|
+
/**
|
|
10108
|
+
* Handles dropdown click event. Not applicable for the copy button, so it's left empty.
|
|
10109
|
+
*/
|
|
10110
|
+
handleDropdownClick() {
|
|
10111
|
+
}
|
|
10112
|
+
}
|
|
10113
|
+
(() => {
|
|
10114
|
+
internalIconManager.VegaInternalIconManager.register({ 'rte-copy': copy.copy });
|
|
10115
|
+
})();
|
|
10116
|
+
|
|
10117
|
+
/**
|
|
10118
|
+
* Strategy that extracts the HTML and plain text content of the current selection, stores the
|
|
10119
|
+
* result on the {@link CopySelectedContentAction} and writes it to the clipboard.
|
|
10120
|
+
*/
|
|
10121
|
+
class CopySelectedContentStrategy extends codeBlock.ActionHandleStrategy {
|
|
10122
|
+
/**
|
|
10123
|
+
* @inheritDoc
|
|
10124
|
+
*/
|
|
10125
|
+
handleAction(action) {
|
|
10126
|
+
const parentBlocks = this.getParentBlocks(action.selectedNodes);
|
|
10127
|
+
const { html, text } = this.getSelectedContent(action.selection, parentBlocks);
|
|
10128
|
+
if (text || html) {
|
|
10129
|
+
action.copyResult = this.copyToClipboard(html, text);
|
|
10130
|
+
}
|
|
10131
|
+
}
|
|
10132
|
+
/**
|
|
10133
|
+
* Extracts the HTML and text content from the current selection.
|
|
10134
|
+
*
|
|
10135
|
+
* `Range.cloneContents()` returns only the nodes inside the selection, dropping the ancestor chain
|
|
10136
|
+
* between the selection's common ancestor and its block. When the selection stays inside a single
|
|
10137
|
+
* block, those dropped ancestors carry the styling, so the cloned fragment is re-wrapped with
|
|
10138
|
+
* shallow clones of every ancestor from the common ancestor up to the block, preserving arbitrary
|
|
10139
|
+
* inline nesting (e.g. `block > strong > em > span > text`).
|
|
10140
|
+
*
|
|
10141
|
+
* When the selection covers the whole block (its common ancestor sits above the block) or spans
|
|
10142
|
+
* multiple blocks, each block is already kept by `cloneContents()`, so no re-wrapping is done.
|
|
10143
|
+
*
|
|
10144
|
+
* @param {Nullable<Selection>} selection - The current selection object.
|
|
10145
|
+
* @param {RTEBlock[]} parentBlocks - The parent blocks of the selected nodes.
|
|
10146
|
+
* @returns {RTESelectedContent} - The HTML and text content of the selected content.
|
|
10147
|
+
*/
|
|
10148
|
+
getSelectedContent(selection, parentBlocks) {
|
|
10149
|
+
const result = { html: '', text: '' };
|
|
10150
|
+
if (!selection || selection.rangeCount === 0 || selection.isCollapsed) {
|
|
10151
|
+
return result;
|
|
10152
|
+
}
|
|
10153
|
+
const range = selection.getRangeAt(0);
|
|
10154
|
+
const doc = tryGetDocument.tryGetDocument();
|
|
10155
|
+
if (!doc) {
|
|
10156
|
+
return result;
|
|
10157
|
+
}
|
|
10158
|
+
// `cloneContents()` returns a `DocumentFragment` of real DOM nodes (already well-formed). Its
|
|
10159
|
+
// `textContent` is the plain text; the fragment itself is wrapped/serialized into HTML below.
|
|
10160
|
+
const fragment = range.cloneContents();
|
|
10161
|
+
// A `DocumentFragment` has no `innerHTML`, so a temporary element is used to serialize it to HTML.
|
|
10162
|
+
const container = doc.createElement('div');
|
|
10163
|
+
const commonAncestor = range.commonAncestorContainer;
|
|
10164
|
+
if (parentBlocks.length === 1) {
|
|
10165
|
+
const block = this.getDOMByEntity(parentBlocks[0]);
|
|
10166
|
+
// Only re-wrap when the block is dropped from the clone, i.e. the selection stays inside the
|
|
10167
|
+
// block. When the whole block is selected, `commonAncestor` sits above it and the clone
|
|
10168
|
+
// already keeps the block, so wrapping again would nest a duplicate block.
|
|
10169
|
+
if (block && block.contains(commonAncestor)) {
|
|
10170
|
+
// Wrap the cloned fragment with the dropped ancestor chain (from `commonAncestor` up to the
|
|
10171
|
+
// block), preserving each element's styles, then serialize the rebuilt block to HTML.
|
|
10172
|
+
const cloneNode = this.wrapWithAncestorChain(fragment, commonAncestor, block);
|
|
10173
|
+
container.appendChild(cloneNode);
|
|
10174
|
+
result.html = container.innerHTML;
|
|
10175
|
+
result.text = container.textContent;
|
|
10176
|
+
return result;
|
|
10177
|
+
}
|
|
10178
|
+
}
|
|
10179
|
+
else if (parentBlocks.length > 1 &&
|
|
10180
|
+
parentBlocks.every((block) => block.type === 'list-item')) {
|
|
10181
|
+
const firstList = parentBlocks[0].parent;
|
|
10182
|
+
if (firstList && parentBlocks.every((block) => block.parent === firstList)) {
|
|
10183
|
+
const listElement = this.getDOMByEntity(firstList);
|
|
10184
|
+
if (listElement && listElement.contains(commonAncestor)) {
|
|
10185
|
+
const cloneListElement = listElement.cloneNode(false);
|
|
10186
|
+
cloneListElement.appendChild(fragment);
|
|
10187
|
+
container.appendChild(cloneListElement);
|
|
10188
|
+
result.html = container.innerHTML;
|
|
10189
|
+
result.text = container.textContent;
|
|
10190
|
+
return result;
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
}
|
|
10194
|
+
// The selection covers whole/multiple blocks: the clone already keeps them, so serialize as-is.
|
|
10195
|
+
container.appendChild(fragment);
|
|
10196
|
+
result.html = container.innerHTML;
|
|
10197
|
+
result.text = container.textContent;
|
|
10198
|
+
return result;
|
|
10199
|
+
}
|
|
10200
|
+
/**
|
|
10201
|
+
* Wraps the cloned selection fragment with the ancestor chain that `cloneContents()` dropped,
|
|
10202
|
+
* rebuilding every element from the selection's common ancestor up to the block while preserving
|
|
10203
|
+
* each element's styles. Returns the cloned block that holds the rebuilt chain and content.
|
|
10204
|
+
*
|
|
10205
|
+
* When the common ancestor is the block itself, the fragment is appended directly under the cloned
|
|
10206
|
+
* block, since no inline ancestor chain was dropped.
|
|
10207
|
+
*
|
|
10208
|
+
* @param {Node} content - The cloned selection fragment to place at the innermost level.
|
|
10209
|
+
* @param {Node} commonAncestor - The selection's common ancestor container.
|
|
10210
|
+
* @param {HTMLElement} block - The block element to stop cloning at.
|
|
10211
|
+
* @returns {HTMLElement} - The cloned block wrapping the rebuilt ancestor chain and content.
|
|
10212
|
+
*/
|
|
10213
|
+
wrapWithAncestorChain(content, commonAncestor, block) {
|
|
10214
|
+
const blockClone = block.cloneNode(false);
|
|
10215
|
+
// `cloneContents()` keeps everything inside `commonAncestor`, so the dropped chain runs from
|
|
10216
|
+
// `commonAncestor` (its element, when the ancestor is a text node) up to the block.
|
|
10217
|
+
const targetElement = commonAncestor.nodeType === Node.TEXT_NODE
|
|
10218
|
+
? commonAncestor.parentElement
|
|
10219
|
+
: commonAncestor;
|
|
10220
|
+
// The target is the block itself: the content sits directly under the block, no chain to rebuild.
|
|
10221
|
+
if (targetElement === block) {
|
|
10222
|
+
blockClone.appendChild(content);
|
|
10223
|
+
return blockClone;
|
|
10224
|
+
}
|
|
10225
|
+
// Clone the target as the innermost container and place the content inside it.
|
|
10226
|
+
const innermost = targetElement.cloneNode(false);
|
|
10227
|
+
innermost.appendChild(content);
|
|
10228
|
+
// Walk up from the target to the block, cloning each ancestor and nesting the chain bottom-up.
|
|
10229
|
+
let shouldAppendNode = innermost;
|
|
10230
|
+
let current = targetElement.parentElement;
|
|
10231
|
+
while (current && current !== block) {
|
|
10232
|
+
const parentClone = current.cloneNode(false);
|
|
10233
|
+
parentClone.appendChild(shouldAppendNode);
|
|
10234
|
+
shouldAppendNode = parentClone;
|
|
10235
|
+
current = current.parentElement;
|
|
10236
|
+
}
|
|
10237
|
+
// Append the assembled ancestor chain to the cloned block.
|
|
10238
|
+
blockClone.appendChild(shouldAppendNode);
|
|
10239
|
+
// When the block is a list item inside an ordered list, wrap the cloned list item with a
|
|
10240
|
+
// shallow clone of the ordered list to preserve the numbering.
|
|
10241
|
+
if (blockClone.tagName === 'LI' &&
|
|
10242
|
+
current &&
|
|
10243
|
+
current.parentElement &&
|
|
10244
|
+
current.parentElement.tagName === 'OL') {
|
|
10245
|
+
const cloneList = current.parentElement.cloneNode(false);
|
|
10246
|
+
cloneList.appendChild(blockClone);
|
|
10247
|
+
return cloneList;
|
|
10248
|
+
}
|
|
10249
|
+
return blockClone;
|
|
10250
|
+
}
|
|
10251
|
+
/**
|
|
10252
|
+
* Retrieves the parent blocks of the given selected nodes.
|
|
10253
|
+
*
|
|
10254
|
+
* @param {RTENode[]} selectedNodes - The nodes for which to find parent blocks.
|
|
10255
|
+
* @returns {RTEBlock[]} An array of parent blocks.
|
|
10256
|
+
*/
|
|
10257
|
+
getParentBlocks(selectedNodes) {
|
|
10258
|
+
const parentBlocks = [];
|
|
10259
|
+
for (const node of selectedNodes) {
|
|
10260
|
+
const block = node.parent;
|
|
10261
|
+
if (block && !parentBlocks.includes(block)) {
|
|
10262
|
+
parentBlocks.push(block);
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
return parentBlocks;
|
|
10266
|
+
}
|
|
10267
|
+
/**
|
|
10268
|
+
* Copies both HTML and plain text content to the clipboard using the Clipboard API.
|
|
10269
|
+
*
|
|
10270
|
+
* Browser compatibility for `navigator.clipboard.write()` with `ClipboardItem`:
|
|
10271
|
+
* - Chrome 76+, Edge 79+, Safari 13.1+, Firefox 127+
|
|
10272
|
+
*
|
|
10273
|
+
* Since Firefox 86+ must be supported, fall back to `execCommand('copy')` when the
|
|
10274
|
+
* Clipboard API is unavailable or fails (e.g. Firefox 86-126).
|
|
10275
|
+
*
|
|
10276
|
+
* @param {string} htmlContent - The HTML content to copy.
|
|
10277
|
+
* @param {string} textContent - The plain text content to copy.
|
|
10278
|
+
* @returns {Promise<boolean>} - A promise that resolves to true if the copy operation succeeded.
|
|
10279
|
+
*/
|
|
10280
|
+
async copyToClipboard(htmlContent, textContent) {
|
|
10281
|
+
let result = false;
|
|
10282
|
+
try {
|
|
10283
|
+
const htmlBlob = new Blob([htmlContent], { type: 'text/html' });
|
|
10284
|
+
const textBlob = new Blob([textContent], { type: 'text/plain' });
|
|
10285
|
+
const clipboardItem = new ClipboardItem({
|
|
10286
|
+
'text/html': htmlBlob,
|
|
10287
|
+
'text/plain': textBlob,
|
|
10288
|
+
});
|
|
10289
|
+
await navigator.clipboard.write([clipboardItem]);
|
|
10290
|
+
result = true;
|
|
10291
|
+
}
|
|
10292
|
+
catch (_a) {
|
|
10293
|
+
// Fallback for browsers without ClipboardItem support (e.g. Firefox 86-126)
|
|
10294
|
+
result = this.copyWithExecCommand(htmlContent, textContent);
|
|
10295
|
+
if (!result) {
|
|
10296
|
+
globalSlimmerRegistry.LogUtility.warn('Failed to copy the selected content to the clipboard. Use keyboard shortcuts instead.');
|
|
10297
|
+
}
|
|
10298
|
+
}
|
|
10299
|
+
return result;
|
|
10300
|
+
}
|
|
10301
|
+
/**
|
|
10302
|
+
* Fallback copy method using `execCommand('copy')` for browsers that don't support the
|
|
10303
|
+
* Clipboard API (e.g. Firefox 86-126).
|
|
10304
|
+
*
|
|
10305
|
+
* Instead of creating a temporary element and changing the selection (which would clear the
|
|
10306
|
+
* editor's Shadow DOM selection and steal focus), this intercepts the native `copy` event that
|
|
10307
|
+
* `execCommand('copy')` triggers and overrides its clipboard data. The user's original selection
|
|
10308
|
+
* and focus stay untouched.
|
|
10309
|
+
*
|
|
10310
|
+
* @param {string} htmlContent - The HTML content to copy.
|
|
10311
|
+
* @param {string} textContent - The plain text content to copy.
|
|
10312
|
+
* @returns {boolean} - True if the copy command succeeded.
|
|
10313
|
+
*/
|
|
10314
|
+
copyWithExecCommand(htmlContent, textContent) {
|
|
10315
|
+
const doc = tryGetDocument.tryGetDocument();
|
|
10316
|
+
if (!doc) {
|
|
10317
|
+
return false;
|
|
10318
|
+
}
|
|
10319
|
+
/**
|
|
10320
|
+
* Overrides the clipboard data of the native copy event triggered by `execCommand('copy')`.
|
|
10321
|
+
*
|
|
10322
|
+
* @param {ClipboardEvent} event - The native copy event.
|
|
10323
|
+
*/
|
|
10324
|
+
const onCopy = (event) => {
|
|
10325
|
+
if (event.clipboardData) {
|
|
10326
|
+
event.clipboardData.setData('text/html', htmlContent);
|
|
10327
|
+
event.clipboardData.setData('text/plain', textContent);
|
|
10328
|
+
}
|
|
10329
|
+
event.preventDefault();
|
|
10330
|
+
};
|
|
10331
|
+
doc.addEventListener('copy', onCopy);
|
|
10332
|
+
try {
|
|
10333
|
+
return doc.execCommand('copy');
|
|
10334
|
+
}
|
|
10335
|
+
finally {
|
|
10336
|
+
doc.removeEventListener('copy', onCopy);
|
|
10337
|
+
}
|
|
10338
|
+
}
|
|
10339
|
+
}
|
|
10340
|
+
|
|
10341
|
+
/**
|
|
10342
|
+
* Vega Rich Text Editor Copy Extension.
|
|
10343
|
+
* Adds a toolbar button that copies the currently selected editor content to the clipboard.
|
|
10344
|
+
*/
|
|
10345
|
+
class VegaRTECopyExtension extends linkExtension.VegaRTEExtension {
|
|
10346
|
+
/** @inheritDoc */
|
|
10347
|
+
prepareBeforeLoad(host) {
|
|
10348
|
+
this.registerToolbarButtonRenderer(VegaRTECopyExtension.TOOLBAR_BUTTON_KEY, new RTECopyToolbarButtonRenderer(), host);
|
|
10349
|
+
}
|
|
10350
|
+
}
|
|
10351
|
+
(() => {
|
|
10352
|
+
codeBlock.ActionHandleStrategyRegistry.register('COPY_SELECTED_CONTENT_ACTION', contentState.VegaRTEContent.name, new CopySelectedContentStrategy());
|
|
10353
|
+
})();
|
|
10354
|
+
// The unique key for the copy toolbar button, used for registration and retrieval.
|
|
10355
|
+
VegaRTECopyExtension.TOOLBAR_BUTTON_KEY = 'copy';
|
|
10356
|
+
|
|
10357
|
+
const cutIcon = {
|
|
10358
|
+
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>`,
|
|
10359
|
+
};
|
|
10360
|
+
|
|
10361
|
+
/**
|
|
10362
|
+
* Delete the currently selected content from the editor.
|
|
10363
|
+
*
|
|
10364
|
+
* @example currentVegaRTEContent.apply(new DeleteSelectedContentAction(host, mergeFlag))
|
|
10365
|
+
*/
|
|
10366
|
+
class DeleteSelectedContentAction extends codeBlock.ModifyContentAction {
|
|
10367
|
+
constructor(host, mergeFlag, flushable = false) {
|
|
10368
|
+
super();
|
|
10369
|
+
this.type = codeBlock.ModifyContentActionType.DELETE_SELECTED_CONTENT;
|
|
10370
|
+
// mergeFlag indicates whether the action should merge adjacent text nodes after deletion.
|
|
10371
|
+
this.mergeFlag = false;
|
|
10372
|
+
this.host = host;
|
|
10373
|
+
this.mergeFlag = mergeFlag;
|
|
10374
|
+
this.isFlushable = flushable;
|
|
10375
|
+
}
|
|
10376
|
+
}
|
|
10377
|
+
|
|
10378
|
+
/**
|
|
10379
|
+
* Toolbar button renderer for the Cut extension.
|
|
10380
|
+
* Reuses the Copy renderer to write the selected editor content to the clipboard,
|
|
10381
|
+
* then removes the selected content from the editor.
|
|
10382
|
+
*/
|
|
10383
|
+
class RTECutToolbarButtonRenderer extends RTECopyToolbarButtonRenderer {
|
|
10384
|
+
/**
|
|
10385
|
+
* Renders the cut toolbar button.
|
|
10386
|
+
*
|
|
10387
|
+
* @param {VegaRTECreateElementFunction} h - Create element function.
|
|
10388
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10389
|
+
* @returns {VegaRTERenderResult} - The toolbar button render result.
|
|
10390
|
+
*/
|
|
10391
|
+
render(h, editorContext) {
|
|
10392
|
+
return this.renderButton(h, editorContext, {
|
|
10393
|
+
icon: 'rte-cut',
|
|
10394
|
+
tooltip: { text: 'Cut' },
|
|
10395
|
+
});
|
|
10396
|
+
}
|
|
10397
|
+
/**
|
|
10398
|
+
* Handles the cut button click event.
|
|
10399
|
+
* Copies the current editor selection to the clipboard and then deletes it from the editor.
|
|
10400
|
+
*
|
|
10401
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context for the editor.
|
|
10402
|
+
*/
|
|
10403
|
+
async handleButtonClick(editorContext) {
|
|
10404
|
+
const context = this.getExtensionContext(editorContext.host);
|
|
10405
|
+
if (context && context.host) {
|
|
10406
|
+
const { host } = context;
|
|
10407
|
+
const copySelectedContentAction = new CopySelectedContentAction(context.getSelection(), context.getSelectedNodes());
|
|
10408
|
+
host.value.apply(copySelectedContentAction);
|
|
10409
|
+
const isCopySuccessful = await copySelectedContentAction.copyResult;
|
|
10410
|
+
isCopySuccessful && host.value.apply(new DeleteSelectedContentAction(host, true, true));
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10413
|
+
}
|
|
10414
|
+
(() => {
|
|
10415
|
+
internalIconManager.VegaInternalIconManager.register({ 'rte-cut': cutIcon });
|
|
10416
|
+
})();
|
|
10417
|
+
|
|
10418
|
+
/**
|
|
10419
|
+
* Vega Rich Text Editor Cut Extension.
|
|
10420
|
+
* Adds a toolbar button that copies the currently selected editor content to the clipboard
|
|
10421
|
+
* and removes it from the editor.
|
|
10422
|
+
*/
|
|
10423
|
+
class VegaRTECutExtension extends linkExtension.VegaRTEExtension {
|
|
10424
|
+
/** @inheritDoc */
|
|
10425
|
+
prepareBeforeLoad(host) {
|
|
10426
|
+
this.registerToolbarButtonRenderer(VegaRTECutExtension.TOOLBAR_BUTTON_KEY, new RTECutToolbarButtonRenderer(), host);
|
|
10427
|
+
}
|
|
10428
|
+
}
|
|
10429
|
+
// The unique key for the cut toolbar button, used for registration and retrieval.
|
|
10430
|
+
VegaRTECutExtension.TOOLBAR_BUTTON_KEY = 'cut';
|
|
8822
10431
|
|
|
8823
10432
|
/**
|
|
8824
10433
|
* Insert a new children to the nearest position of the parent container
|
|
@@ -8938,7 +10547,7 @@ class VegaRTETokenExtension extends linkExtension.VegaRTEExtension {
|
|
|
8938
10547
|
}
|
|
8939
10548
|
/** @inheritDoc */
|
|
8940
10549
|
prepareBeforeLoad(host) {
|
|
8941
|
-
this.registerToolbarButtonRenderer(
|
|
10550
|
+
this.registerToolbarButtonRenderer(VegaRTETokenExtension.TOOLBAR_BUTTON_KEY, new RTETokenToolbarButtonRenderer(this.tokenList), host);
|
|
8942
10551
|
}
|
|
8943
10552
|
}
|
|
8944
10553
|
(() => {
|
|
@@ -8946,17 +10555,23 @@ class VegaRTETokenExtension extends linkExtension.VegaRTEExtension {
|
|
|
8946
10555
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(codeBlock.RTETextBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
8947
10556
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(contentState.RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
8948
10557
|
})();
|
|
10558
|
+
VegaRTETokenExtension.TOOLBAR_BUTTON_KEY = 'token';
|
|
8949
10559
|
|
|
8950
10560
|
exports.ActionHandlerInterceptor = ActionHandlerInterceptor;
|
|
10561
|
+
exports.DeleteSelectedContentAction = DeleteSelectedContentAction;
|
|
8951
10562
|
exports.InsertNodeToNearestRootAction = InsertNodeToNearestRootAction;
|
|
8952
10563
|
exports.RTELanguageToolbarButtonRenderer = RTELanguageToolbarButtonRenderer;
|
|
8953
10564
|
exports.RTETokenNode = RTETokenNode;
|
|
8954
10565
|
exports.RTETokenNodeRenderer = RTETokenNodeRenderer;
|
|
8955
10566
|
exports.RTETokenToolbarButtonRenderer = RTETokenToolbarButtonRenderer;
|
|
10567
|
+
exports.VegaCalendarPeriodFactory = VegaCalendarPeriodFactory;
|
|
8956
10568
|
exports.VegaEventManager = VegaEventManager$1;
|
|
8957
10569
|
exports.VegaLoader = VegaLoader;
|
|
8958
10570
|
exports.VegaNotify = VegaNotify;
|
|
10571
|
+
exports.VegaRTECopyExtension = VegaRTECopyExtension;
|
|
10572
|
+
exports.VegaRTECutExtension = VegaRTECutExtension;
|
|
8959
10573
|
exports.VegaRTEDefaultLineHeightOptions = VegaRTEDefaultLineHeightOptions;
|
|
10574
|
+
exports.VegaRTEFindReplaceExtension = VegaRTEFindReplaceExtension;
|
|
8960
10575
|
exports.VegaRTEFunctionExtension = VegaRTEFunctionExtension;
|
|
8961
10576
|
exports.VegaRTEHorizontalLineExtension = VegaRTEHorizontalLineExtension;
|
|
8962
10577
|
exports.VegaRTELanguageExtension = VegaRTELanguageExtension;
|