@globalpayments/vega 2.91.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-7bb10088.js → app-globals-2f326662.js} +13 -10
- package/dist/cjs/{child-nodes-event-prevent-slimmer-76d19d56.js → child-nodes-event-prevent-slimmer-b9a5b3e2.js} +1 -1
- package/dist/cjs/{code-block-c1039791.js → code-block-6435d641.js} +24 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-1d36641d.js → component-value-history-controller-slimmer.abstract-e4c9a5ba.js} +3 -3
- package/dist/cjs/{content-state-a6105949.js → content-state-96ec9114.js} +32 -3
- package/dist/cjs/copy-d021c780.js +7 -0
- package/dist/cjs/{date-required-rule-c4997459.js → date-required-rule-8c9e312b.js} +1 -1
- package/dist/cjs/{design-token-f65eab4a.js → design-token-3548af29.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-316668d0.js → element-appender-slimmer-3bf69990.js} +3 -3
- package/dist/cjs/{file-uploader-required-rule-cc51d4ab.js → file-uploader-required-rule-5520bbec.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-b0c35330.js → form-field-controller-slimmer-e0efac05.js} +1 -1
- package/dist/cjs/{image-annotation-action-e4596726.js → image-annotation-action-853f72c8.js} +2 -2
- package/dist/cjs/index-58ea899e.js +4 -0
- package/dist/cjs/index.cjs.js +25 -20
- package/dist/cjs/{inject-keyboard-manager-1f5bbb19.js → inject-keyboard-manager-0dccff1a.js} +1 -1
- package/dist/cjs/{internal-calendar-period-factory-9c66cf36.js → internal-calendar-period-factory-6187ec4c.js} +1 -1
- package/dist/cjs/{internal-translation-controller-5905469e.js → internal-translation-controller-48ebfd0f.js} +14 -0
- package/dist/cjs/{keyboard-manager-61e8ce38.js → keyboard-manager-dfe8d924.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-079a7e87.js → keyboard-manager-slimmer-4a2560a1.js} +1 -1
- package/dist/cjs/{link-extension-a7ac28f3.js → link-extension-28d95849.js} +3 -3
- package/dist/cjs/loader.cjs.js +14 -13
- package/dist/cjs/{month-view-generator-48215a05.js → month-view-generator-2e59b188.js} +1 -1
- package/dist/cjs/{public-rules-66540638.js → public-rules-8727c42c.js} +10 -10
- package/dist/cjs/{range-dea19a90.js → range-5cb3d1e4.js} +25 -3
- package/dist/cjs/{replace-selected-text-action-6d1ebbf9.js → replace-selected-text-action-a31563ed.js} +1 -1
- package/dist/cjs/{required-field-rule-b12a29e1.js → required-field-rule-400690c3.js} +1 -1
- package/dist/cjs/{responsive-format-facade-10ff730e.js → responsive-format-facade-98b89142.js} +2 -2
- package/dist/cjs/{rich-text-editor-required-rule-63492ca3.js → rich-text-editor-required-rule-8e4d577d.js} +1 -1
- package/dist/cjs/{split-cell-operation-30e5dd4a.js → split-cell-operation-9e3ab88d.js} +3 -3
- package/dist/cjs/{state-border-formatter-e7779964.js → state-border-formatter-626b0a14.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-a22f0cb1.js → string-format-strategy.abstract-981f43e1.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-8179eb40.js → string-input-formatter-slimmer-fc4a0ba5.js} +1 -1
- package/dist/cjs/{string-mask-strategy-8b9bb0c1.js → string-mask-strategy-b47fa159.js} +2 -2
- package/dist/cjs/{style-formatter-380b9a86.js → style-formatter-baf18624.js} +2 -2
- package/dist/cjs/{time-required-rule-080d975b.js → time-required-rule-e77d174f.js} +1 -1
- package/dist/cjs/{token-extension-619379a3.js → token-extension-3aec039f.js} +1609 -15
- package/dist/cjs/{translation-slimmer-2af6f141.js → translation-slimmer-1e05769e.js} +1 -1
- package/dist/cjs/{type-guard-0171e779.js → type-guard-7ab48d6c.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-fdfca83e.js → valid-credit-card-number-rule-52ba9c67.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +18 -10
- package/dist/cjs/vega-app-header-button.cjs.entry.js +7 -7
- package/dist/cjs/vega-banner.cjs.entry.js +3 -6
- package/dist/cjs/vega-box.cjs.entry.js +7 -7
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-circle.cjs.entry.js +7 -7
- package/dist/cjs/vega-button-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-link.cjs.entry.js +2 -2
- package/dist/cjs/vega-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-calendar_5.cjs.entry.js +9 -9
- package/dist/cjs/vega-card.cjs.entry.js +6 -6
- package/dist/cjs/vega-carousel.cjs.entry.js +4 -4
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-chip.cjs.entry.js +7 -7
- package/dist/cjs/vega-code-block.cjs.entry.js +12 -15
- package/dist/cjs/vega-color-picker.cjs.entry.js +4 -4
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +6 -6
- package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +11 -11
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-dialog_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-divider.cjs.entry.js +6 -6
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +13 -9
- package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-flex.cjs.entry.js +7 -7
- package/dist/cjs/vega-font.cjs.entry.js +6 -6
- package/dist/cjs/vega-form.cjs.entry.js +5 -5
- package/dist/cjs/vega-grid.cjs.entry.js +6 -6
- package/dist/cjs/vega-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +9 -9
- package/dist/cjs/vega-input-numeric.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-passcode.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-range.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-select.cjs.entry.js +8 -8
- package/dist/cjs/vega-input.cjs.entry.js +9 -9
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +8 -8
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +6 -6
- package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-radio_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +220 -48
- 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 +5 -5
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +11 -11
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +4 -4
- package/dist/cjs/vega-signature-capture.cjs.entry.js +9 -9
- package/dist/cjs/vega-stepper.cjs.entry.js +4 -4
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_11.cjs.entry.js +6 -6
- package/dist/cjs/vega-textarea.cjs.entry.js +5 -5
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega.cjs.js +14 -13
- package/dist/cjs/xmark-large-faae5a80.js +7 -0
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/vega-accordion/slimmers/vega-accordion-renderer.js +11 -3
- package/dist/collection/components/vega-box/vega-box.js +3 -3
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.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-input/vega-input.css +1 -0
- package/dist/collection/components/vega-input/vega-input.js +1 -1
- package/dist/collection/components/vega-input-select/vega-input-select.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/assets/cut.js +3 -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/user-input-controller.js +9 -3
- package/dist/collection/components/vega-textarea/vega-textarea.js +1 -1
- package/dist/collection/global/scripts/before-vega-load.js +6 -0
- package/dist/collection/helpers/translation/locales/en.js +14 -0
- package/dist/esm/{app-globals-6041f52f.js → app-globals-5e0d319a.js} +13 -10
- package/dist/esm/{aria-dialog-focusable-trap-slimmer-1332c071.js → aria-dialog-focusable-trap-slimmer-9eae86c6.js} +1 -1
- package/dist/esm/{child-nodes-event-prevent-slimmer-50022584.js → child-nodes-event-prevent-slimmer-f24618c5.js} +2 -2
- package/dist/esm/{code-block-37294847.js → code-block-b71b2aa4.js} +26 -3
- package/dist/esm/{component-value-history-controller-slimmer.abstract-45ccddc9.js → component-value-history-controller-slimmer.abstract-282df6e5.js} +4 -4
- package/dist/esm/{content-state-67950b80.js → content-state-909099f8.js} +33 -4
- package/dist/esm/copy-54e45e2d.js +5 -0
- package/dist/esm/{date-required-rule-958cf380.js → date-required-rule-15edb04a.js} +1 -1
- package/dist/esm/{design-token-e7e78f18.js → design-token-cb5ed6b9.js} +3 -3
- package/dist/esm/{element-appender-slimmer-ebda526d.js → element-appender-slimmer-e41120ee.js} +4 -4
- package/dist/esm/{event-emit-slimmer-b94cec83.js → event-emit-slimmer-03deba18.js} +1 -1
- package/dist/esm/{file-uploader-required-rule-82188a61.js → file-uploader-required-rule-96952e1a.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-0a2ba886.js → form-field-controller-slimmer-cfe1d8a7.js} +3 -3
- package/dist/esm/{image-annotation-action-7f7a5678.js → image-annotation-action-98232dc4.js} +3 -3
- package/dist/esm/index-090d31ca.js +4 -0
- package/dist/esm/index.js +24 -23
- package/dist/esm/{inject-keyboard-manager-2b19c121.js → inject-keyboard-manager-13cc77ab.js} +1 -1
- package/dist/esm/{internal-calendar-period-factory-fff8aaee.js → internal-calendar-period-factory-c3d70f3b.js} +1 -1
- package/dist/esm/{internal-translation-controller-aa09ca87.js → internal-translation-controller-8e8a514a.js} +14 -0
- package/dist/esm/{internal-vega-event-manager-956cf128.js → internal-vega-event-manager-75e5e3bb.js} +1 -1
- package/dist/esm/{keyboard-manager-3e5b157f.js → keyboard-manager-fe885db1.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-ba5cc767.js → keyboard-manager-slimmer-61d4c79b.js} +1 -1
- package/dist/esm/{link-extension-afb404fb.js → link-extension-f1a3bea7.js} +3 -3
- package/dist/esm/loader.js +17 -16
- package/dist/esm/{month-view-generator-7a0c869c.js → month-view-generator-85eecb95.js} +1 -1
- package/dist/esm/{public-rules-f64b0b78.js → public-rules-323bea4b.js} +11 -11
- package/dist/esm/{range-4d09a305.js → range-e63068d1.js} +25 -3
- package/dist/esm/{replace-selected-text-action-12bc8b82.js → replace-selected-text-action-c0817b2b.js} +1 -1
- package/dist/esm/{required-field-rule-a4634842.js → required-field-rule-897fe8d1.js} +1 -1
- package/dist/esm/{responsive-format-facade-844c5e09.js → responsive-format-facade-fb424f5b.js} +2 -2
- package/dist/esm/{rich-text-editor-required-rule-d62d418e.js → rich-text-editor-required-rule-0edb8ba7.js} +1 -1
- package/dist/esm/{split-cell-operation-c515669e.js → split-cell-operation-93b4d775.js} +3 -3
- package/dist/esm/{state-border-formatter-f53847a5.js → state-border-formatter-1a528ca4.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-a0327405.js → string-format-strategy.abstract-72fc98aa.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-12de4a25.js → string-input-formatter-slimmer-b0c480d8.js} +3 -3
- package/dist/esm/{string-mask-strategy-3bb03155.js → string-mask-strategy-4e00c173.js} +2 -2
- package/dist/esm/{style-formatter-df7bf8ec.js → style-formatter-5c1bea8d.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-7ef94141.js → sub-state-notify-slimmer-0f72ce74.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-d9ad2bdd.js → sub-state-observer-slimmer-64532d94.js} +1 -1
- package/dist/esm/{time-required-rule-db0dee53.js → time-required-rule-df500b14.js} +1 -1
- package/dist/esm/{token-extension-8ff92d14.js → token-extension-32d1fa56.js} +1610 -20
- package/dist/esm/{translation-slimmer-4904e7fe.js → translation-slimmer-60408f13.js} +1 -1
- package/dist/esm/{type-guard-a2cbaae9.js → type-guard-91087018.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-a3f9858d.js → valid-credit-card-number-rule-681ecb75.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +21 -13
- package/dist/esm/vega-app-footer.entry.js +3 -3
- package/dist/esm/vega-app-header-button.entry.js +10 -10
- package/dist/esm/vega-banner.entry.js +5 -8
- package/dist/esm/vega-box.entry.js +7 -7
- package/dist/esm/vega-breadcrumb.entry.js +5 -5
- package/dist/esm/vega-button-circle.entry.js +11 -11
- 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 +9 -9
- package/dist/esm/vega-calendar_5.entry.js +15 -15
- package/dist/esm/vega-card.entry.js +6 -6
- package/dist/esm/vega-carousel.entry.js +7 -7
- package/dist/esm/vega-checkbox_2.entry.js +10 -10
- package/dist/esm/vega-chip.entry.js +10 -10
- package/dist/esm/vega-code-block.entry.js +15 -18
- package/dist/esm/vega-color-picker.entry.js +9 -9
- package/dist/esm/vega-color-swatch-picker.entry.js +11 -11
- package/dist/esm/vega-color-swatch.entry.js +5 -5
- package/dist/esm/vega-combo-box.entry.js +16 -16
- package/dist/esm/vega-date-picker_2.entry.js +22 -22
- package/dist/esm/vega-dialog_2.entry.js +10 -10
- package/dist/esm/vega-divider.entry.js +6 -6
- package/dist/esm/vega-dropdown_5.entry.js +16 -16
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/{vega-event-id-268f8def.js → vega-event-id-d3017041.js} +1 -1
- package/dist/esm/vega-field-label.entry.js +16 -12
- package/dist/esm/vega-file-uploader.entry.js +11 -11
- package/dist/esm/vega-flag-icon.entry.js +6 -6
- package/dist/esm/vega-flex.entry.js +7 -7
- package/dist/esm/vega-font.entry.js +6 -6
- package/dist/esm/vega-form.entry.js +11 -11
- package/dist/esm/vega-grid.entry.js +6 -6
- package/dist/esm/vega-icon.entry.js +6 -6
- package/dist/esm/vega-image-uploader.entry.js +13 -13
- package/dist/esm/vega-input-credit-card.entry.js +14 -14
- package/dist/esm/vega-input-numeric.entry.js +14 -14
- package/dist/esm/vega-input-passcode.entry.js +13 -13
- package/dist/esm/vega-input-phone-number.entry.js +11 -11
- package/dist/esm/vega-input-range.entry.js +10 -10
- package/dist/esm/vega-input-select.entry.js +13 -13
- package/dist/esm/vega-input.entry.js +15 -15
- package/dist/esm/{vega-internal-event-id-22151a4d.js → vega-internal-event-id-827eb1ce.js} +1 -1
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +14 -14
- package/dist/esm/vega-loader-wrapper_2.entry.js +4 -4
- 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 +10 -10
- package/dist/esm/vega-popover_2.entry.js +14 -14
- package/dist/esm/vega-progress-tracker_2.entry.js +10 -10
- package/dist/esm/vega-radio_2.entry.js +13 -13
- package/dist/esm/vega-rich-text-content.entry.js +10 -10
- package/dist/esm/vega-rich-text-editor_4.entry.js +227 -55
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +229 -0
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +8 -8
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +14 -14
- package/dist/esm/vega-segment-control.entry.js +3 -3
- package/dist/esm/vega-selection-chip_2.entry.js +13 -13
- package/dist/esm/vega-selection-tile_2.entry.js +11 -11
- package/dist/esm/vega-sidenav_3.entry.js +10 -10
- package/dist/esm/vega-signature-capture.entry.js +14 -14
- 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 +12 -12
- package/dist/esm/vega-textarea.entry.js +10 -10
- package/dist/esm/vega-time-picker_2.entry.js +16 -16
- package/dist/esm/vega-toggle-switch.entry.js +7 -7
- package/dist/esm/vega-tooltip_2.entry.js +8 -8
- package/dist/esm/vega.js +17 -16
- package/dist/esm/{wait-for-component-did-render-0488922a.js → wait-for-component-did-render-0c237cb8.js} +1 -1
- package/dist/esm/xmark-large-c5ae7944.js +5 -0
- package/dist/sri/vega-sri-manifest.json +387 -375
- package/dist/types/components/vega-accordion/slimmers/vega-accordion-renderer.d.ts +2 -0
- 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-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/user-input-controller.d.ts +2 -1
- package/dist/types/components.d.ts +34 -0
- package/dist/types/global/icons/copy.d.ts +3 -0
- package/dist/types/helpers/translation/interface.d.ts +15 -1
- package/dist/types/types/ui.type.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-cb4033ef.js → p-0179f55d.js} +1 -1
- package/dist/vega/{p-8bc23bcf.entry.js → p-06c2ce2c.entry.js} +1 -1
- package/dist/vega/{p-fb1ef3e6.entry.js → p-07b56f2b.entry.js} +1 -1
- package/dist/vega/{p-141f74ff.js → p-136226f8.js} +1 -1
- package/dist/vega/{p-e9a82603.entry.js → p-18413b62.entry.js} +1 -1
- package/dist/vega/p-209e0166.js +1 -0
- package/dist/vega/{p-014e2cf9.js → p-228c5de8.js} +1 -1
- package/dist/vega/{p-cc8bf6e7.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-2da12975.entry.js +1 -0
- package/dist/vega/{p-8019c156.js → p-2def8e3e.js} +1 -1
- package/dist/vega/{p-5bed3fd2.entry.js → p-2e58d99e.entry.js} +1 -1
- package/dist/vega/{p-bb0040d4.entry.js → p-30561e1d.entry.js} +1 -1
- package/dist/vega/{p-fc103347.entry.js → p-35df0f0a.entry.js} +1 -1
- package/dist/vega/{p-15da9d58.entry.js → p-37dffdf6.entry.js} +1 -1
- package/dist/vega/{p-5ffc7cb8.js → p-3a68b729.js} +1 -1
- package/dist/vega/{p-507612f6.entry.js → p-3cf4339a.entry.js} +1 -1
- package/dist/vega/{p-4cef4812.js → p-3f183b52.js} +1 -1
- package/dist/vega/{p-42ed76ee.entry.js → p-40501057.entry.js} +1 -1
- package/dist/vega/{p-12b5c5e3.entry.js → p-438b7404.entry.js} +1 -1
- package/dist/vega/{p-8982796b.entry.js → p-43c3848f.entry.js} +1 -1
- package/dist/vega/{p-9756c6b9.entry.js → p-450bf94d.entry.js} +1 -1
- package/dist/vega/{p-0e03daa6.js → p-45ab490c.js} +1 -1
- package/dist/vega/{p-94845302.entry.js → p-481601c0.entry.js} +1 -1
- package/dist/vega/{p-0707aa21.js → p-4953bb1a.js} +1 -1
- package/dist/vega/{p-2b22091e.js → p-4d9061fb.js} +1 -1
- package/dist/vega/{p-b2f9698a.entry.js → p-4e39adf5.entry.js} +1 -1
- package/dist/vega/{p-316a1e5c.entry.js → p-5038b6d7.entry.js} +1 -1
- package/dist/vega/{p-3cf298a4.entry.js → p-5319da71.entry.js} +1 -1
- package/dist/vega/p-53c76d9d.entry.js +1 -0
- package/dist/vega/{p-64b5fe2a.entry.js → p-5545a235.entry.js} +1 -1
- package/dist/vega/{p-c75872a4.entry.js → p-56cf1a65.entry.js} +1 -1
- package/dist/vega/{p-216ef41e.entry.js → p-5829a66d.entry.js} +1 -1
- package/dist/vega/p-590c8720.entry.js +1 -0
- package/dist/vega/{p-5e282e41.js → p-5946fadf.js} +1 -1
- package/dist/vega/{p-822f70b0.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-aaa6e976.entry.js → p-625351a3.entry.js} +1 -1
- package/dist/vega/p-683cfe24.js +1 -0
- package/dist/vega/p-68e16c70.entry.js +1 -0
- package/dist/vega/{p-ef44d516.js → p-70817cf5.js} +1 -1
- package/dist/vega/{p-a14d8767.js → p-71e2a3ec.js} +1 -1
- package/dist/vega/{p-a4826f3f.entry.js → p-7798254d.entry.js} +1 -1
- package/dist/vega/p-7be548a7.js +1 -0
- package/dist/vega/{p-4037126d.js → p-802bf369.js} +1 -1
- package/dist/vega/{p-b77e85e0.entry.js → p-82279b03.entry.js} +1 -1
- package/dist/vega/{p-f362c07b.entry.js → p-8509c140.entry.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-da2b1fd0.entry.js → p-8b9a8603.entry.js} +1 -1
- package/dist/vega/{p-14bfc113.js → p-8bc15ed0.js} +1 -1
- package/dist/vega/{p-aea912ac.js → p-8d69b201.js} +1 -1
- package/dist/vega/p-8da860f6.js +1 -0
- package/dist/vega/{p-329c808e.entry.js → p-8f078d0d.entry.js} +1 -1
- package/dist/vega/p-916dfa7e.entry.js +1 -0
- package/dist/vega/{p-42a1d300.entry.js → p-9219201a.entry.js} +1 -1
- package/dist/vega/{p-cd2a1ffb.js → p-92823583.js} +1 -1
- package/dist/vega/{p-cec8ffdc.js → p-93dfab05.js} +1 -1
- package/dist/vega/{p-7f086e54.entry.js → p-9440a8a5.entry.js} +1 -1
- package/dist/vega/p-970115d6.js +1 -0
- package/dist/vega/{p-da067259.entry.js → p-9b1d718c.entry.js} +1 -1
- package/dist/vega/{p-c65a5778.entry.js → p-9cdedcfb.entry.js} +1 -1
- package/dist/vega/{p-6e7c1b19.entry.js → p-9fafc956.entry.js} +1 -1
- package/dist/vega/{p-70352240.entry.js → p-a268a4fb.entry.js} +1 -1
- package/dist/vega/{p-cd21adb8.js → p-a2bd621e.js} +1 -1
- package/dist/vega/p-a361456d.js +1 -0
- package/dist/vega/{p-73b9868f.js → p-aa32f2f3.js} +1 -1
- package/dist/vega/p-b6225d01.js +1 -0
- package/dist/vega/{p-58a00869.entry.js → p-b6ebfd5c.entry.js} +1 -1
- package/dist/vega/{p-fea33425.js → p-b730bf6e.js} +1 -1
- package/dist/vega/{p-81591449.entry.js → p-b799fc1f.entry.js} +1 -1
- package/dist/vega/{p-4644ccf9.entry.js → p-c0629528.entry.js} +1 -1
- package/dist/vega/{p-50d7a1c4.entry.js → p-c2e0f8b7.entry.js} +1 -1
- package/dist/vega/{p-522dd15f.entry.js → p-c67ce78c.entry.js} +1 -1
- package/dist/vega/{p-6ecb3c7d.entry.js → p-c78aeaf3.entry.js} +1 -1
- package/dist/vega/{p-5df53125.entry.js → p-c78e8081.entry.js} +1 -1
- package/dist/vega/{p-1acd5f04.entry.js → p-c8eaf91c.entry.js} +1 -1
- package/dist/vega/p-ca9852bb.js +1 -0
- package/dist/vega/{p-ce27c273.entry.js → p-cd1844ad.entry.js} +1 -1
- package/dist/vega/{p-a04b95aa.entry.js → p-cd9fb2ca.entry.js} +1 -1
- package/dist/vega/p-ce7e9515.entry.js +1 -0
- package/dist/vega/p-d0ce752f.entry.js +1 -0
- package/dist/vega/{p-044496e0.entry.js → p-d20587b4.entry.js} +1 -1
- package/dist/vega/{p-ae728041.entry.js → p-d3c8b871.entry.js} +1 -1
- package/dist/vega/{p-c87c7ef4.js → p-d7369441.js} +1 -1
- package/dist/vega/p-de885ef2.js +1 -0
- package/dist/vega/{p-b7b0930a.entry.js → p-dee38163.entry.js} +1 -1
- package/dist/vega/{p-6820b488.entry.js → p-e160a727.entry.js} +1 -1
- package/dist/vega/{p-49b4ab2b.js → p-e371738b.js} +1 -1
- package/dist/vega/{p-4979fd7d.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-5fcb825c.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-0605c656.entry.js → p-eee01ba7.entry.js} +1 -1
- package/dist/vega/{p-3fe43f7a.entry.js → p-ef2b9846.entry.js} +1 -1
- package/dist/vega/p-f0bc2bbb.js +1 -0
- package/dist/vega/{p-3863187f.entry.js → p-f365601c.entry.js} +1 -1
- package/dist/vega/p-f4a01959.js +1 -0
- package/dist/vega/{p-9e327397.entry.js → p-f515d189.entry.js} +1 -1
- package/dist/vega/{p-b504a8b4.entry.js → p-f5aefb2f.entry.js} +1 -1
- package/dist/vega/{p-2f48162f.entry.js → p-f6bccb06.entry.js} +1 -1
- package/dist/vega/{p-e75e75c9.entry.js → p-f70f7ad8.entry.js} +1 -1
- package/dist/vega/{p-42f3c0b1.entry.js → p-f7739cbb.entry.js} +1 -1
- package/dist/vega/{p-335e3237.entry.js → p-fc5dfb52.entry.js} +1 -1
- package/dist/vega/p-fd70418f.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +0 -92
- 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-144d4b30.js +0 -1
- package/dist/vega/p-21775cc7.js +0 -1
- package/dist/vega/p-2944c76e.entry.js +0 -1
- package/dist/vega/p-3372f34a.entry.js +0 -1
- package/dist/vega/p-53ed3b1f.js +0 -1
- package/dist/vega/p-57f7c257.js +0 -1
- package/dist/vega/p-5a4e598f.js +0 -1
- package/dist/vega/p-5e1cd1cc.js +0 -1
- package/dist/vega/p-5e1ec2b8.entry.js +0 -1
- package/dist/vega/p-61d42e9b.entry.js +0 -1
- package/dist/vega/p-63ae5ada.entry.js +0 -1
- package/dist/vega/p-66905cbf.js +0 -1
- package/dist/vega/p-689070f9.entry.js +0 -1
- package/dist/vega/p-74fa0f5b.entry.js +0 -1
- package/dist/vega/p-7bb39b97.js +0 -1
- package/dist/vega/p-7f139b74.js +0 -1
- package/dist/vega/p-85d78ac1.js +0 -1
- package/dist/vega/p-92a144bc.js +0 -1
- package/dist/vega/p-9f608b97.js +0 -1
- package/dist/vega/p-aca134a3.entry.js +0 -1
- package/dist/vega/p-b2f89dbd.js +0 -1
- package/dist/vega/p-bd94b904.entry.js +0 -1
- package/dist/vega/p-c0c2a917.js +0 -3
- package/dist/vega/p-c40555c4.entry.js +0 -1
- package/dist/vega/p-d0060bdb.js +0 -1
- package/dist/vega/p-d00b3910.js +0 -1
- package/dist/vega/p-d14ddf80.js +0 -1
- package/dist/vega/p-dc78e8d6.js +0 -1
- package/dist/vega/p-ddc2d219.js +0 -1
- /package/dist/cjs/{feature-flag-controller-438a1510.js → feature-flag-controller-c19d0b58.js} +0 -0
- /package/dist/collection/{components/vega-code-block/assets → global/icons}/copy.js +0 -0
- /package/dist/esm/{feature-flag-controller-2a89f20c.js → feature-flag-controller-3fd04ea9.js} +0 -0
- /package/dist/types/components/{vega-code-block/assets/copy.d.ts → vega-rich-text-editor/assets/cut.d.ts} +0 -0
- /package/dist/vega/{p-bc73ce30.js → p-87a4d75f.js} +0 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { RTECodeBlock } from '../../../../../dto/blocks/code-block';
|
|
2
|
+
import { CodeBlockSearchStrategy } from './block-search-strategies/code-block-search-strategy';
|
|
3
|
+
import { ListItemBlockSearchStrategy } from './block-search-strategies/list-item-block-search-strategy';
|
|
4
|
+
import { TextBlockSearchStrategy } from './block-search-strategies/text-block-search-strategy';
|
|
5
|
+
import { ContainerBlockSearchStrategy } from './block-search-strategies/container-block-search-strategy';
|
|
6
|
+
/**
|
|
7
|
+
* Sentinel character inserted into the flat text in place of a non-editable
|
|
8
|
+
* node (e.g. a token). It keeps surrounding searchable segments from bridging
|
|
9
|
+
* across the removed node — producing false matches — while never matching any
|
|
10
|
+
* user keyword. `\u0000` (NULL) does not appear in editable document text.
|
|
11
|
+
*/
|
|
12
|
+
const NON_EDITABLE_SENTINEL = '\u0000';
|
|
13
|
+
/**
|
|
14
|
+
* Manages the in-memory state for a single Find & Replace session.
|
|
15
|
+
*
|
|
16
|
+
* One instance is created per editor host inside VegaRTEFindReplaceExtension
|
|
17
|
+
* during `initialExtensionAfterLoad`. It holds all search results, the
|
|
18
|
+
* current navigation index, and a per-block flat-text cache.
|
|
19
|
+
*
|
|
20
|
+
* Public API:
|
|
21
|
+
* - `search(content, keyword)` — run a search, replace current state using current options
|
|
22
|
+
* - `next()` / `prev()` — navigate through results
|
|
23
|
+
* - `getCurrentMatch()` / `getMatches()` / `getTotal()` / `getCurrentIndex()` — read state
|
|
24
|
+
* - `clear()` — reset everything
|
|
25
|
+
*/
|
|
26
|
+
export class FindReplaceState {
|
|
27
|
+
constructor() {
|
|
28
|
+
this.matches = [];
|
|
29
|
+
this.currentIndex = -1;
|
|
30
|
+
this.flatCache = new WeakMap();
|
|
31
|
+
this.cachedContent = null;
|
|
32
|
+
this.matchCase = false;
|
|
33
|
+
this.wholeWords = false;
|
|
34
|
+
/**
|
|
35
|
+
* Ordered strategy chain used to classify and traverse each block type.
|
|
36
|
+
* More specific types (RTEListItemBlock) must precede their parent class (RTETextBlock).
|
|
37
|
+
*/
|
|
38
|
+
this.blockSearchStrategies = [
|
|
39
|
+
new CodeBlockSearchStrategy(),
|
|
40
|
+
new ListItemBlockSearchStrategy(),
|
|
41
|
+
new TextBlockSearchStrategy(),
|
|
42
|
+
new ContainerBlockSearchStrategy(),
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Runs a fresh search over the given content and replaces all previous results.
|
|
47
|
+
*
|
|
48
|
+
* The flat-text cache is invalidated whenever the content reference changes
|
|
49
|
+
* (i.e. after the user edits the document). When only the keyword or options
|
|
50
|
+
* change (user typing in the find input), the cache is reused.
|
|
51
|
+
*
|
|
52
|
+
* @param {VegaRTEContent} content - The root content DTO to search.
|
|
53
|
+
* @param {string} keyword - The search keyword entered by the user.
|
|
54
|
+
* Uses the currently stored `matchCase` and `wholeWords` options.
|
|
55
|
+
*/
|
|
56
|
+
search(content, keyword) {
|
|
57
|
+
this.invalidateCacheIfNeeded(content);
|
|
58
|
+
if (!keyword) {
|
|
59
|
+
this.matches = [];
|
|
60
|
+
this.currentIndex = -1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const regex = this.buildRegExp(keyword, this.getFindOptions());
|
|
64
|
+
const blocks = this.collectSearchableBlocks(content.children);
|
|
65
|
+
const results = [];
|
|
66
|
+
for (const block of blocks) {
|
|
67
|
+
let cached = this.flatCache.get(block);
|
|
68
|
+
if (!cached) {
|
|
69
|
+
cached =
|
|
70
|
+
block instanceof RTECodeBlock
|
|
71
|
+
? this.buildCodeBlockFlat(block)
|
|
72
|
+
: this.buildTextBlockFlat(block);
|
|
73
|
+
this.flatCache.set(block, cached);
|
|
74
|
+
}
|
|
75
|
+
const { flatText, segments } = cached;
|
|
76
|
+
if (!flatText) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
regex.lastIndex = 0;
|
|
80
|
+
let match;
|
|
81
|
+
while ((match = regex.exec(flatText)) !== null) {
|
|
82
|
+
// match[1] is always the keyword capture group. In wholeWords mode,
|
|
83
|
+
// match[0] may include a leading non-letter boundary char, so we
|
|
84
|
+
// compute the actual start from the end offset minus the keyword length.
|
|
85
|
+
const matchEnd = match.index + match[0].length;
|
|
86
|
+
const matchStart = matchEnd - match[1].length;
|
|
87
|
+
const nodes = this.flatOffsetToNodePositions(segments, matchStart, matchEnd);
|
|
88
|
+
if (nodes.length > 0) {
|
|
89
|
+
results.push({ block, nodes, matchText: match[1] });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
this.matches = results;
|
|
94
|
+
this.currentIndex = results.length > 0 ? 0 : -1;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Advances to the next match, wrapping around to the first.
|
|
98
|
+
*/
|
|
99
|
+
next() {
|
|
100
|
+
if (this.matches.length === 0) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.currentIndex = (this.currentIndex + 1) % this.matches.length;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Moves to the previous match, wrapping around to the last.
|
|
107
|
+
*/
|
|
108
|
+
prev() {
|
|
109
|
+
if (this.matches.length === 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.currentIndex = (this.currentIndex - 1 + this.matches.length) % this.matches.length;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Sets the current index directly. Clamps to valid range.
|
|
116
|
+
*
|
|
117
|
+
* @param {number} index - The desired index.
|
|
118
|
+
*/
|
|
119
|
+
setCurrentIndex(index) {
|
|
120
|
+
if (this.matches.length === 0) {
|
|
121
|
+
this.currentIndex = -1;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.currentIndex = Math.max(0, Math.min(index, this.matches.length - 1));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns the currently active match, or null if there are no results.
|
|
128
|
+
*
|
|
129
|
+
* @returns {FindMatch | null} The currently active match, or null if there are no results.
|
|
130
|
+
*/
|
|
131
|
+
getCurrentMatch() {
|
|
132
|
+
var _a;
|
|
133
|
+
return (_a = this.matches[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns all matches from the last search.
|
|
137
|
+
*
|
|
138
|
+
* @returns {ReadonlyArray<FindMatch>} All matches from the last search.
|
|
139
|
+
*/
|
|
140
|
+
getMatches() {
|
|
141
|
+
return this.matches;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Returns the total number of matches from the last search.
|
|
145
|
+
*
|
|
146
|
+
* @returns {number} The total number of matches.
|
|
147
|
+
*/
|
|
148
|
+
getTotal() {
|
|
149
|
+
return this.matches.length;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns the 0-based index of the current match, or -1 when there are no results.
|
|
153
|
+
*
|
|
154
|
+
* @returns {number} The 0-based index, or -1 when there are no results.
|
|
155
|
+
*/
|
|
156
|
+
getCurrentIndex() {
|
|
157
|
+
return this.currentIndex;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Resets only match results and navigation index.
|
|
161
|
+
* The flat-text cache and cached content reference are preserved so that
|
|
162
|
+
* a subsequent search on the same document (e.g. after a keyword change)
|
|
163
|
+
* can reuse the already-computed block flat texts.
|
|
164
|
+
*/
|
|
165
|
+
clearResults() {
|
|
166
|
+
this.matches = [];
|
|
167
|
+
this.currentIndex = -1;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Resets all search state, including results, navigation index, and flat-text cache.
|
|
171
|
+
* Use this when the session ends (e.g. panel closed) or the host changes.
|
|
172
|
+
*/
|
|
173
|
+
clear() {
|
|
174
|
+
this.matches = [];
|
|
175
|
+
this.currentIndex = -1;
|
|
176
|
+
this.flatCache = new WeakMap();
|
|
177
|
+
this.cachedContent = null;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Sets the matchCase search option.
|
|
181
|
+
*
|
|
182
|
+
* @param {boolean} enabled - Whether to enable case-sensitive matching.
|
|
183
|
+
*/
|
|
184
|
+
setMatchCase(enabled) {
|
|
185
|
+
this.matchCase = enabled;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Sets the wholeWords search option.
|
|
189
|
+
*
|
|
190
|
+
* @param {boolean} enabled - Whether to enable whole-word matching.
|
|
191
|
+
*/
|
|
192
|
+
setWholeWords(enabled) {
|
|
193
|
+
this.wholeWords = enabled;
|
|
194
|
+
}
|
|
195
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
196
|
+
/**
|
|
197
|
+
* Invalidates the flat-text cache when the content reference has changed.
|
|
198
|
+
* Since flushChanges always produces a new VegaRTEContent via clone(), a
|
|
199
|
+
* changed reference reliably indicates the document has been edited.
|
|
200
|
+
*
|
|
201
|
+
* @param {VegaRTEContent} content - The incoming content reference.
|
|
202
|
+
*/
|
|
203
|
+
invalidateCacheIfNeeded(content) {
|
|
204
|
+
if (content !== this.cachedContent) {
|
|
205
|
+
this.flatCache = new WeakMap();
|
|
206
|
+
this.cachedContent = content;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Builds a RegExp from the keyword and search options.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} keyword - The raw user input.
|
|
213
|
+
* @param {FindOptions} options - Search options.
|
|
214
|
+
* @returns {RegExp} The compiled regular expression.
|
|
215
|
+
*/
|
|
216
|
+
buildRegExp(keyword, options) {
|
|
217
|
+
const escaped = this.escapeRegExp(keyword);
|
|
218
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
219
|
+
let flags = 'gu';
|
|
220
|
+
if (!options.matchCase) {
|
|
221
|
+
flags += 'i';
|
|
222
|
+
}
|
|
223
|
+
if (options.wholeWords) {
|
|
224
|
+
// Aligned with CKEditor's findByTextCallback non-letter boundary group.
|
|
225
|
+
//
|
|
226
|
+
// The keyword is wrapped in a capturing group (match[1]) so the search
|
|
227
|
+
// loop can compute the exact start offset without lookbehind assertions
|
|
228
|
+
// (not supported in Safari < 16.4). The non-capturing prefix group
|
|
229
|
+
// `(?:^|nonLetter)` may consume one boundary char, which is why we
|
|
230
|
+
// derive matchStart as matchEnd - match[1].length rather than match.index.
|
|
231
|
+
const nonLetter = '[^a-zA-Z\u00C0-\u024F\u1E00-\u1EFF]';
|
|
232
|
+
const prefix = !new RegExp(`^${nonLetter}`).test(keyword) ? `(?:^|${nonLetter})` : '';
|
|
233
|
+
const suffix = !new RegExp(`${nonLetter}$`).test(keyword) ? `(?=${nonLetter}|$)` : '';
|
|
234
|
+
return new RegExp(`${prefix}(${escaped})${suffix}`, flags);
|
|
235
|
+
}
|
|
236
|
+
return new RegExp(`(${escaped})`, flags);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Escapes all regex special characters so the keyword is treated as literal text.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} text - The raw input string.
|
|
242
|
+
* @returns {string} The escaped string safe for use in a RegExp constructor.
|
|
243
|
+
*/
|
|
244
|
+
escapeRegExp(text) {
|
|
245
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Recursively collects all searchable leaf blocks (RTETextBlock and RTECodeBlock)
|
|
249
|
+
* from a block tree in document order.
|
|
250
|
+
*
|
|
251
|
+
* Each block is dispatched to the first matching BlockSearchStrategy.
|
|
252
|
+
*
|
|
253
|
+
* @param {RTEBlock[]} blocks - The block array to traverse.
|
|
254
|
+
* @returns {(RTETextBlock | RTECodeBlock)[]} Ordered list of searchable leaf blocks.
|
|
255
|
+
*/
|
|
256
|
+
collectSearchableBlocks(blocks) {
|
|
257
|
+
const result = [];
|
|
258
|
+
const recurse = this.collectSearchableBlocks.bind(this);
|
|
259
|
+
for (const block of blocks) {
|
|
260
|
+
const strategy = this.blockSearchStrategies.find((s) => s.canHandle(block));
|
|
261
|
+
if (strategy) {
|
|
262
|
+
result.push(...strategy.collect(block, recurse));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return result;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Builds the flat text and segment table for a RTETextBlock.
|
|
269
|
+
*
|
|
270
|
+
* Non-editable child nodes (e.g. tokens, which render as read-only chips)
|
|
271
|
+
* are excluded from the searchable flat text. Each is replaced by a single
|
|
272
|
+
* sentinel character so that adjacent editable segments cannot bridge across
|
|
273
|
+
* the token to form a false match, while keeping segment offsets aligned.
|
|
274
|
+
*
|
|
275
|
+
* @param {RTETextBlock} block - The text block to flatten.
|
|
276
|
+
* @returns {BlockFlatCache} The flat text string and segment mapping.
|
|
277
|
+
*/
|
|
278
|
+
buildTextBlockFlat(block) {
|
|
279
|
+
const segments = [];
|
|
280
|
+
const flatParts = [];
|
|
281
|
+
let cursor = 0;
|
|
282
|
+
for (const node of block.children) {
|
|
283
|
+
if (!node.isContentEditable()) {
|
|
284
|
+
flatParts.push(NON_EDITABLE_SENTINEL);
|
|
285
|
+
cursor += NON_EDITABLE_SENTINEL.length;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
const len = node.text.length;
|
|
289
|
+
segments.push({ node, start: cursor, end: cursor + len });
|
|
290
|
+
flatParts.push(node.text);
|
|
291
|
+
cursor += len;
|
|
292
|
+
}
|
|
293
|
+
return {
|
|
294
|
+
flatText: flatParts.join(''),
|
|
295
|
+
segments,
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Builds the flat text and segment table for a RTECodeBlock.
|
|
300
|
+
*
|
|
301
|
+
* @param {RTECodeBlock} block - The code block to flatten.
|
|
302
|
+
* @returns {BlockFlatCache} The flat text string and segment mapping.
|
|
303
|
+
*/
|
|
304
|
+
buildCodeBlockFlat(block) {
|
|
305
|
+
const codeNode = block.children[0];
|
|
306
|
+
if (!codeNode) {
|
|
307
|
+
return { flatText: '', segments: [] };
|
|
308
|
+
}
|
|
309
|
+
const flatText = codeNode.text;
|
|
310
|
+
return {
|
|
311
|
+
flatText,
|
|
312
|
+
segments: [{ node: codeNode, start: 0, end: flatText.length }],
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Maps a flat [matchStart, matchEnd) range back to individual node positions.
|
|
317
|
+
*
|
|
318
|
+
* @param {(TextSegment | CodeSegment)[]} segments - The segment table.
|
|
319
|
+
* @param {number} matchStart - Inclusive start in the flat text.
|
|
320
|
+
* @param {number} matchEnd - Exclusive end in the flat text.
|
|
321
|
+
* @returns {NodePosition[]} Ordered list of node-local positions spanning the match.
|
|
322
|
+
*/
|
|
323
|
+
flatOffsetToNodePositions(segments, matchStart, matchEnd) {
|
|
324
|
+
const positions = [];
|
|
325
|
+
for (const segment of segments) {
|
|
326
|
+
if (segment.end <= matchStart) {
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (segment.start >= matchEnd) {
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
const localStart = Math.max(0, matchStart - segment.start);
|
|
333
|
+
const localEnd = Math.min(segment.end, matchEnd) - segment.start;
|
|
334
|
+
positions.push({ node: segment.node, startOffset: localStart, endOffset: localEnd });
|
|
335
|
+
}
|
|
336
|
+
return positions;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Builds the current find options from the shared context.
|
|
340
|
+
*
|
|
341
|
+
* @returns {FindOptions} The options for the search engine.
|
|
342
|
+
*/
|
|
343
|
+
getFindOptions() {
|
|
344
|
+
return { matchCase: this.matchCase, wholeWords: this.wholeWords };
|
|
345
|
+
}
|
|
346
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { FindReplaceControllerAbstract, } from './find-replace-controller.abstract';
|
|
2
|
+
/**
|
|
3
|
+
* Replace controller — adds mutation capabilities on top of the shared
|
|
4
|
+
* find state.
|
|
5
|
+
*
|
|
6
|
+
* Shares state with {@link FindController} via the injected
|
|
7
|
+
* {@link FindReplaceControllerContext}, so both controllers always operate
|
|
8
|
+
* on the same search results and highlight overlays.
|
|
9
|
+
*/
|
|
10
|
+
export class ReplaceController extends FindReplaceControllerAbstract {
|
|
11
|
+
constructor(context) {
|
|
12
|
+
super(context);
|
|
13
|
+
/** The replacement string used by replace() and replaceAll(). Updated via setReplacement(). */
|
|
14
|
+
this.replacement = '';
|
|
15
|
+
this.flushFn = null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Stores the flush callback used to commit content changes to the editor.
|
|
19
|
+
* Called by the toolbar renderer after obtaining it from the extension context.
|
|
20
|
+
*
|
|
21
|
+
* Calling `flushValue` once — even after mutating multiple nodes — creates a
|
|
22
|
+
* single entry in the editor's undo stack, so the entire replace/replaceAll
|
|
23
|
+
* operation is undone as one atomic step.
|
|
24
|
+
*
|
|
25
|
+
* @param {(value: VegaRTEContent) => void} fn - The flush function.
|
|
26
|
+
* @returns {void} No return value.
|
|
27
|
+
*/
|
|
28
|
+
setFlushValue(fn) {
|
|
29
|
+
this.flushFn = fn;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Stores the replacement text for the next replace() or replaceAll() call.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} text - The replacement string.
|
|
35
|
+
* @returns {void} No return value.
|
|
36
|
+
*/
|
|
37
|
+
setReplacement(text) {
|
|
38
|
+
this.replacement = text;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Replaces the current match with the stored replacement text,
|
|
42
|
+
* advances to the next match, and refreshes highlights.
|
|
43
|
+
* An empty replacement string deletes the matched text.
|
|
44
|
+
*
|
|
45
|
+
* No-op when there is no current match or no host.
|
|
46
|
+
*
|
|
47
|
+
* @returns {FindReplaceResult} Updated match position and total.
|
|
48
|
+
*/
|
|
49
|
+
replace() {
|
|
50
|
+
const currentMatch = this.context.state.getCurrentMatch();
|
|
51
|
+
if (currentMatch && this.context.hostRef && this.flushFn) {
|
|
52
|
+
const previousIndex = this.context.state.getCurrentIndex();
|
|
53
|
+
this.applyMatchReplacement(currentMatch);
|
|
54
|
+
this.flushFn(this.context.hostRef.value);
|
|
55
|
+
this.context.state.clear();
|
|
56
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
57
|
+
// setCurrentIndex clamps to [0, total-1], so passing previousIndex
|
|
58
|
+
// directly keeps the cursor as close as possible to the replaced position
|
|
59
|
+
// rather than wrapping around when previousIndex >= total.
|
|
60
|
+
this.context.state.setCurrentIndex(previousIndex);
|
|
61
|
+
}
|
|
62
|
+
return this.applyAndGetResult();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Replaces all matches with the stored replacement text in a single operation
|
|
66
|
+
* (one flushValue call = one Undo step), then re-runs the search.
|
|
67
|
+
* An empty replacement string deletes all matched text.
|
|
68
|
+
*
|
|
69
|
+
* No-op when there are no matches or no host.
|
|
70
|
+
*
|
|
71
|
+
* @returns {FindReplaceResult} Updated match position and total.
|
|
72
|
+
*/
|
|
73
|
+
replaceAll() {
|
|
74
|
+
if (this.context.state.getTotal() > 0 && this.flushFn && this.context.hostRef) {
|
|
75
|
+
const matches = this.context.state.getMatches();
|
|
76
|
+
// Iterate in reverse so that mutating a later match does not shift the
|
|
77
|
+
// startOffset/endOffset of earlier matches that have not yet been processed.
|
|
78
|
+
for (let i = matches.length - 1; i >= 0; i -= 1) {
|
|
79
|
+
this.applyMatchReplacement(matches[i]);
|
|
80
|
+
}
|
|
81
|
+
this.flushFn(this.context.hostRef.value);
|
|
82
|
+
this.context.state.clear();
|
|
83
|
+
this.context.state.search(this.context.hostRef.value, this.context.keyword);
|
|
84
|
+
}
|
|
85
|
+
return this.applyAndGetResult();
|
|
86
|
+
}
|
|
87
|
+
// ─── Private ──────────────────────────────────────────────────────────────────
|
|
88
|
+
/**
|
|
89
|
+
* Directly mutates the matched nodes in the live content tree.
|
|
90
|
+
* `position.node` is already a reference into `this.context.hostRef.value`,
|
|
91
|
+
* so no cloning or path navigation is needed.
|
|
92
|
+
*
|
|
93
|
+
* For multi-node (cross-span) matches the first node receives the replacement
|
|
94
|
+
* text and every subsequent node has its matched slice deleted.
|
|
95
|
+
*
|
|
96
|
+
* This method mutates the content tree in place. The caller is
|
|
97
|
+
* responsible for calling `state.clear()` afterwards to invalidate the
|
|
98
|
+
* flat-text cache, which uses reference equality and will not detect the
|
|
99
|
+
* in-place change automatically.
|
|
100
|
+
*
|
|
101
|
+
* @param {FindMatch} match - The match to replace.
|
|
102
|
+
* @returns {void} No return value.
|
|
103
|
+
*/
|
|
104
|
+
applyMatchReplacement(match) {
|
|
105
|
+
match.nodes.forEach((position, index) => {
|
|
106
|
+
const replacementText = index === 0 ? this.replacement : '';
|
|
107
|
+
position.node.text =
|
|
108
|
+
position.node.text.slice(0, position.startOffset) +
|
|
109
|
+
replacementText +
|
|
110
|
+
position.node.text.slice(position.endOffset);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { VegaInternalIconManager } from '../../../../../../helpers/icon/internal-icon-manager';
|
|
2
|
+
import { DomNodeSubjectObserverFactory } from '../../../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-observer-factory';
|
|
3
|
+
import { VegaChange, VegaClick, VegaPopoverHide, VegaPopoverShow, } from '../../../../../../helpers/event-manager/event-id/vega-event-id';
|
|
4
|
+
import { VegaRTEToolbarButtonRenderer } from '../../../base-toolbar-button-renderer';
|
|
5
|
+
import findReplaceIcon from '../../assets/find-and-replace';
|
|
6
|
+
import { createFindReplaceControllerContext, } from '../controllers/find-replace-controller.abstract';
|
|
7
|
+
import { FindController } from '../controllers/find-controller';
|
|
8
|
+
import { ReplaceController } from '../controllers/replace-controller';
|
|
9
|
+
import { VegaInternalTranslation } from '../../../../../../helpers/translation/internal-translation-controller';
|
|
10
|
+
import { debounce } from '../../../../../../utils/timer';
|
|
11
|
+
/**
|
|
12
|
+
* Toolbar button renderer for the Find & Replace extension.
|
|
13
|
+
*
|
|
14
|
+
* Responsible only for UI concerns:
|
|
15
|
+
* - Renders the toolbar button wrapped in a vega-popover.
|
|
16
|
+
* - Wires panel events to the {@link FindController} and {@link ReplaceController}.
|
|
17
|
+
* - Pushes controller results back to the panel display.
|
|
18
|
+
*
|
|
19
|
+
* Both controllers share a single {@link FindReplaceControllerContext} so they
|
|
20
|
+
* operate on the same search state and highlight overlays.
|
|
21
|
+
*/
|
|
22
|
+
export class FindReplaceToolbarButtonRenderer extends VegaRTEToolbarButtonRenderer {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.sharedContext = createFindReplaceControllerContext();
|
|
26
|
+
this.findController = new FindController(this.sharedContext);
|
|
27
|
+
this.replaceController = new ReplaceController(this.sharedContext);
|
|
28
|
+
this.panelRef = null;
|
|
29
|
+
this.popoverRef = null;
|
|
30
|
+
this.isPopoverOpen = false;
|
|
31
|
+
this.scrollOnNextRefresh = false;
|
|
32
|
+
this.debouncedRefresh = debounce(this.onContentChanged, 100, this);
|
|
33
|
+
/* eslint-disable jsdoc/require-jsdoc */
|
|
34
|
+
this.panelActionHandlers = {
|
|
35
|
+
'find': () => this.findController.find(),
|
|
36
|
+
'prev': () => this.findController.prev(),
|
|
37
|
+
'next': () => this.findController.next(),
|
|
38
|
+
'replace': () => {
|
|
39
|
+
this.scrollOnNextRefresh = true;
|
|
40
|
+
return this.replaceController.replace();
|
|
41
|
+
},
|
|
42
|
+
'replace-all': () => {
|
|
43
|
+
this.scrollOnNextRefresh = true;
|
|
44
|
+
return this.replaceController.replaceAll();
|
|
45
|
+
},
|
|
46
|
+
'match-case': (data) => this.findController.setMatchCase(data),
|
|
47
|
+
'whole-words': (data) => this.findController.setWholeWords(data),
|
|
48
|
+
'close': () => this.closePanel(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/* eslint-enable jsdoc/require-jsdoc */
|
|
52
|
+
/**
|
|
53
|
+
* @inheritDoc
|
|
54
|
+
*/
|
|
55
|
+
render(h, editorContext) {
|
|
56
|
+
this.syncEditorState(editorContext);
|
|
57
|
+
return h('vega-popover', {
|
|
58
|
+
trigger: 'none',
|
|
59
|
+
alignment: 'start',
|
|
60
|
+
placement: 'bottom',
|
|
61
|
+
showArrow: false,
|
|
62
|
+
isScreenPosition: true,
|
|
63
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
64
|
+
ref: (ref) => {
|
|
65
|
+
if (ref) {
|
|
66
|
+
this.popoverRef = ref;
|
|
67
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaPopoverHide, () => {
|
|
68
|
+
this.isPopoverOpen = false;
|
|
69
|
+
this.findController.clear();
|
|
70
|
+
this.updatePanel({ current: 0, total: 0 });
|
|
71
|
+
});
|
|
72
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaPopoverShow, () => {
|
|
73
|
+
this.isPopoverOpen = true;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
}, [
|
|
78
|
+
h('div', { slot: 'popover' }, [
|
|
79
|
+
h('vega-rich-text-find-replace-panel', {
|
|
80
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
81
|
+
ref: (ref) => {
|
|
82
|
+
if (ref) {
|
|
83
|
+
this.panelRef = ref;
|
|
84
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, (e) => {
|
|
85
|
+
if (e.detail.type === 'keyword') {
|
|
86
|
+
this.updatePanel(this.findController.setKeyword(e.detail.value));
|
|
87
|
+
}
|
|
88
|
+
else if (e.detail.type === 'replace') {
|
|
89
|
+
this.replaceController.setReplacement(e.detail.value);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaClick, (payload) => {
|
|
93
|
+
this.handlePanelAction(payload.detail);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
]),
|
|
99
|
+
h('div', { slot: 'popover-content' }, this.renderButton(h, editorContext, {
|
|
100
|
+
icon: 'rte-find-replace',
|
|
101
|
+
tooltip: { text: VegaInternalTranslation.t('Find and replace') },
|
|
102
|
+
})),
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Toggles the popover open/close when the toolbar button is clicked.
|
|
107
|
+
*/
|
|
108
|
+
handleButtonClick() {
|
|
109
|
+
if (this.popoverRef) {
|
|
110
|
+
if (this.isPopoverOpen) {
|
|
111
|
+
void this.popoverRef.hide();
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
void this.popoverRef.show();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/* istanbul ignore next */
|
|
119
|
+
/**
|
|
120
|
+
* Not used — this button has no dropdown.
|
|
121
|
+
*/
|
|
122
|
+
handleDropdownClick() {
|
|
123
|
+
// no-op
|
|
124
|
+
}
|
|
125
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
126
|
+
/**
|
|
127
|
+
* Synchronizes internal state with the editor context on each render cycle.
|
|
128
|
+
* Registers the host reference and content-change listener, and hides the
|
|
129
|
+
* popover if the toolbar item becomes hidden while open.
|
|
130
|
+
*
|
|
131
|
+
* @param {VegaRTEToolbarRenderContext} editorContext - The render context.
|
|
132
|
+
*/
|
|
133
|
+
syncEditorState(editorContext) {
|
|
134
|
+
this.findController.setHost(editorContext.host);
|
|
135
|
+
const extensionContext = this.getExtensionContext(editorContext.host);
|
|
136
|
+
if (extensionContext) {
|
|
137
|
+
this.replaceController.setFlushValue(extensionContext.flushValue);
|
|
138
|
+
}
|
|
139
|
+
DomNodeSubjectObserverFactory.addUniqueObserverToNode(editorContext.host, VegaChange, this.debouncedRefresh);
|
|
140
|
+
if (this.isHidden(editorContext) && this.isPopoverOpen && this.popoverRef) {
|
|
141
|
+
void this.popoverRef.hide();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Dispatches panel button actions to the controller.
|
|
146
|
+
*
|
|
147
|
+
* @param {FindReplacePanelAction} panelAction - The structured action emitted by the panel.
|
|
148
|
+
*/
|
|
149
|
+
handlePanelAction(panelAction) {
|
|
150
|
+
const { action, data } = panelAction;
|
|
151
|
+
const handler = this.panelActionHandlers[action];
|
|
152
|
+
if (handler) {
|
|
153
|
+
const result = handler(data);
|
|
154
|
+
if (result) {
|
|
155
|
+
this.updatePanel(result);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Pushes result to the panel counter display.
|
|
161
|
+
*
|
|
162
|
+
* @param {FindReplaceResult} result - The current/total values.
|
|
163
|
+
*/
|
|
164
|
+
updatePanel(result) {
|
|
165
|
+
if (this.panelRef) {
|
|
166
|
+
void this.panelRef.updateResult(result.current, result.total);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Content changed — ask the controller to refresh search results.
|
|
171
|
+
*/
|
|
172
|
+
onContentChanged() {
|
|
173
|
+
if (!this.isPopoverOpen) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const shouldScroll = this.scrollOnNextRefresh;
|
|
177
|
+
this.scrollOnNextRefresh = false;
|
|
178
|
+
const result = this.findController.refresh(shouldScroll);
|
|
179
|
+
if (result) {
|
|
180
|
+
this.updatePanel(result);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Closes the panel popover.
|
|
185
|
+
*/
|
|
186
|
+
closePanel() {
|
|
187
|
+
if (this.popoverRef) {
|
|
188
|
+
void this.popoverRef.hide();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
(() => {
|
|
193
|
+
VegaInternalIconManager.register({ 'rte-find-replace': findReplaceIcon });
|
|
194
|
+
})();
|