@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
|
@@ -8,17 +8,17 @@ const internalVegaZIndexManager = require('./internal-vega-z-index-manager-f03dd
|
|
|
8
8
|
const dynamicSlimmer = require('./dynamic-slimmer-f31fdfd7.js');
|
|
9
9
|
const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-273d62ef.js');
|
|
10
10
|
const internalVegaEventManager = require('./internal-vega-event-manager-7196a847.js');
|
|
11
|
-
const internalTranslationController = require('./internal-translation-controller-
|
|
12
|
-
const internalCalendarPeriodFactory = require('./internal-calendar-period-factory-
|
|
13
|
-
const contentState = require('./content-state-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
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
17
|
const internalIconManager = require('./internal-icon-manager-40bcac72.js');
|
|
18
18
|
const vegaNonceManager = require('./vega-nonce-manager-df69d3ed.js');
|
|
19
19
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-c82df135.js');
|
|
20
20
|
const vegaEventId = require('./vega-event-id-df22d80e.js');
|
|
21
|
-
const splitCellOperation = require('./split-cell-operation-
|
|
21
|
+
const splitCellOperation = require('./split-cell-operation-9e3ab88d.js');
|
|
22
22
|
const changeManager = require('./change-manager-a297e4d2.js');
|
|
23
23
|
const vegaInternalEventId = require('./vega-internal-event-id-ecc5b87a.js');
|
|
24
24
|
const remoteInvocationRegistry = require('./remote-invocation-registry-fc22fdd0.js');
|
|
@@ -27,7 +27,8 @@ const tryGetDocument = require('./try-get-document-c0ebd39a.js');
|
|
|
27
27
|
const pixel = require('./pixel-98f2a10c.js');
|
|
28
28
|
const object = require('./object-b53e9416.js');
|
|
29
29
|
const timer = require('./timer-5f33058b.js');
|
|
30
|
-
const replaceSelectedTextAction = require('./replace-selected-text-action-
|
|
30
|
+
const replaceSelectedTextAction = require('./replace-selected-text-action-a31563ed.js');
|
|
31
|
+
const copy = require('./copy-d021c780.js');
|
|
31
32
|
|
|
32
33
|
const VegaLoaderRuntimeMetricsPayloadDefinition = [
|
|
33
34
|
{
|
|
@@ -1769,7 +1770,7 @@ class VegaRTELanguageExtension extends linkExtension.VegaRTEExtension {
|
|
|
1769
1770
|
*/
|
|
1770
1771
|
prepareBeforeLoad(host) {
|
|
1771
1772
|
this.languageToolbarButtonRenderer = new RTELanguageToolbarButtonRenderer(this.languageList, this.languageChangeCallBack, this.languageState.selectedLanguage);
|
|
1772
|
-
this.registerToolbarButtonRenderer(
|
|
1773
|
+
this.registerToolbarButtonRenderer(VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY, this.languageToolbarButtonRenderer, host);
|
|
1773
1774
|
}
|
|
1774
1775
|
/**
|
|
1775
1776
|
* Initializes the language extension.
|
|
@@ -1861,6 +1862,7 @@ class VegaRTELanguageExtension extends linkExtension.VegaRTEExtension {
|
|
|
1861
1862
|
return result;
|
|
1862
1863
|
}
|
|
1863
1864
|
}
|
|
1865
|
+
VegaRTELanguageExtension.TOOLBAR_BUTTON_KEY = 'languages';
|
|
1864
1866
|
|
|
1865
1867
|
const INSERT_FUNCTION_BLOCK = 'INSERT_FUNCTION_BLOCK';
|
|
1866
1868
|
/**
|
|
@@ -2653,7 +2655,7 @@ class VegaRTEFunctionExtension extends linkExtension.VegaRTEExtension {
|
|
|
2653
2655
|
}
|
|
2654
2656
|
/** @inheritDoc */
|
|
2655
2657
|
prepareBeforeLoad(host) {
|
|
2656
|
-
this.registerToolbarButtonRenderer(
|
|
2658
|
+
this.registerToolbarButtonRenderer(VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY, new FunctionToolbarButtonRenderer(), host);
|
|
2657
2659
|
}
|
|
2658
2660
|
/**
|
|
2659
2661
|
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
@@ -2677,6 +2679,7 @@ class VegaRTEFunctionExtension extends linkExtension.VegaRTEExtension {
|
|
|
2677
2679
|
linkExtension.VegaRTEExtension.registerActionHandlerInterceptor(codeBlock.RTETextBlock.name, codeBlock.ModifyContentActionType.INSERT_NEW_PARAGRAPH, new PreventNewParagraphInterceptor());
|
|
2678
2680
|
linkExtension.VegaRTEExtension.registerActionHandlerInterceptor(codeBlock.RTETextBlock.name, codeBlock.ModifyContentActionType.PASTE_CONTENT, new PreventPasteContentInterceptor());
|
|
2679
2681
|
})();
|
|
2682
|
+
VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY = 'functions';
|
|
2680
2683
|
|
|
2681
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}";
|
|
2682
2685
|
|
|
@@ -7313,7 +7316,7 @@ class VegaRTETableExtension extends linkExtension.VegaRTEExtension {
|
|
|
7313
7316
|
this.tableHeadCellRenderer = new RTETableHeadCellRenderer();
|
|
7314
7317
|
this.tableSelection = new RTETableSelection();
|
|
7315
7318
|
splitCellOperation.RTETableColorManager.setTableColors(colors);
|
|
7316
|
-
this.registerToolbarButtonRenderer(
|
|
7319
|
+
this.registerToolbarButtonRenderer(VegaRTETableExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
|
|
7317
7320
|
this.registerBlockBasicStrategies(splitCellOperation.RTETableBlock.name);
|
|
7318
7321
|
this.registerBlockBasicStrategies(splitCellOperation.RTETableHeadBlock.name);
|
|
7319
7322
|
this.registerBlockBasicStrategies(splitCellOperation.RTETableHeadCellBlock.name);
|
|
@@ -7401,6 +7404,7 @@ class VegaRTETableExtension extends linkExtension.VegaRTEExtension {
|
|
|
7401
7404
|
linkExtension.VegaRTEExtension.registerFilterStylesStrategy(splitCellOperation.RTETableCellBlock.dtoName, new TableCellFilterStylesStrategy());
|
|
7402
7405
|
linkExtension.VegaRTEExtension.registerFilterStylesStrategy(splitCellOperation.RTETableHeadCellBlock.dtoName, new TableCellFilterStylesStrategy('th'));
|
|
7403
7406
|
})();
|
|
7407
|
+
VegaRTETableExtension.TOOLBAR_BUTTON_KEY = 'table';
|
|
7404
7408
|
|
|
7405
7409
|
/**
|
|
7406
7410
|
* Horizontal line node — a decorator node representing `<hr>` in the editor.
|
|
@@ -7898,7 +7902,7 @@ class VegaRTEHorizontalLineExtension extends linkExtension.VegaRTEExtension {
|
|
|
7898
7902
|
// Register the renderer
|
|
7899
7903
|
this.registerRenderer('horizontal-line', this.blockRenderer);
|
|
7900
7904
|
// Register the toolbar button
|
|
7901
|
-
this.registerToolbarButtonRenderer(
|
|
7905
|
+
this.registerToolbarButtonRenderer(VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer);
|
|
7902
7906
|
// Register HTML → DTO conversion strategy
|
|
7903
7907
|
this.registerElementToBlockDTOClassStrategy(new HrToHorizontalLineBlockStrategy());
|
|
7904
7908
|
// Register filter styles strategy for source edit round-trip
|
|
@@ -7913,6 +7917,7 @@ class VegaRTEHorizontalLineExtension extends linkExtension.VegaRTEExtension {
|
|
|
7913
7917
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(contentState.RTEImageBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
|
|
7914
7918
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(RTEHorizontalLineBlock.name, INSERT_HORIZONTAL_LINE_BLOCK, insertStrategy);
|
|
7915
7919
|
})();
|
|
7920
|
+
VegaRTEHorizontalLineExtension.TOOLBAR_BUTTON_KEY = 'horizontalLine';
|
|
7916
7921
|
|
|
7917
7922
|
const ARROW_CHARACTERS = [
|
|
7918
7923
|
{ character: '←', title: 'leftwards simple arrow' },
|
|
@@ -8410,7 +8415,7 @@ class VegaRTESpecialCharactersExtension extends linkExtension.VegaRTEExtension {
|
|
|
8410
8415
|
}
|
|
8411
8416
|
/** @inheritDoc */
|
|
8412
8417
|
prepareBeforeLoad(host) {
|
|
8413
|
-
this.registerToolbarButtonRenderer(
|
|
8418
|
+
this.registerToolbarButtonRenderer(VegaRTESpecialCharactersExtension.TOOLBAR_BUTTON_KEY, new RTESpecialCharactersToolbarButtonRenderer(this.categories), host);
|
|
8414
8419
|
}
|
|
8415
8420
|
/**
|
|
8416
8421
|
* Builds the final list of special character categories from the provided config.
|
|
@@ -8429,6 +8434,1200 @@ class VegaRTESpecialCharactersExtension extends linkExtension.VegaRTEExtension {
|
|
|
8429
8434
|
return [...defaultCategories, ...config.categories];
|
|
8430
8435
|
}
|
|
8431
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
|
+
};
|
|
8442
|
+
|
|
8443
|
+
/**
|
|
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.
|
|
8448
|
+
*/
|
|
8449
|
+
class BlockSearchStrategy {
|
|
8450
|
+
}
|
|
8451
|
+
|
|
8452
|
+
/**
|
|
8453
|
+
* Handles RTECodeBlock — a searchable leaf block whose text lives in children[0].text.
|
|
8454
|
+
*/
|
|
8455
|
+
class CodeBlockSearchStrategy extends BlockSearchStrategy {
|
|
8456
|
+
/**
|
|
8457
|
+
* @inheritDoc
|
|
8458
|
+
*/
|
|
8459
|
+
canHandle(block) {
|
|
8460
|
+
return block instanceof codeBlock.RTECodeBlock;
|
|
8461
|
+
}
|
|
8462
|
+
/**
|
|
8463
|
+
* @inheritDoc
|
|
8464
|
+
*/
|
|
8465
|
+
collect(block) {
|
|
8466
|
+
return [block];
|
|
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 {
|
|
8478
|
+
/**
|
|
8479
|
+
* @inheritDoc
|
|
8480
|
+
*/
|
|
8481
|
+
canHandle(block) {
|
|
8482
|
+
return block instanceof contentState.RTEListItemBlock;
|
|
8483
|
+
}
|
|
8484
|
+
/**
|
|
8485
|
+
* @inheritDoc
|
|
8486
|
+
*/
|
|
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;
|
|
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 {
|
|
8504
|
+
/**
|
|
8505
|
+
* @inheritDoc
|
|
8506
|
+
*/
|
|
8507
|
+
canHandle(block) {
|
|
8508
|
+
return block instanceof codeBlock.RTETextBlock;
|
|
8509
|
+
}
|
|
8510
|
+
/**
|
|
8511
|
+
* @inheritDoc
|
|
8512
|
+
*/
|
|
8513
|
+
collect(block) {
|
|
8514
|
+
return [block];
|
|
8515
|
+
}
|
|
8516
|
+
}
|
|
8517
|
+
|
|
8518
|
+
/**
|
|
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).
|
|
8524
|
+
*/
|
|
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));
|
|
8531
|
+
}
|
|
8532
|
+
/**
|
|
8533
|
+
* @inheritDoc
|
|
8534
|
+
*/
|
|
8535
|
+
collect(block, recurse) {
|
|
8536
|
+
return recurse(block.children);
|
|
8537
|
+
}
|
|
8538
|
+
}
|
|
8539
|
+
|
|
8540
|
+
/**
|
|
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.
|
|
8549
|
+
*
|
|
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
|
|
8559
|
+
*/
|
|
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
|
+
}
|
|
8579
|
+
/**
|
|
8580
|
+
* Runs a fresh search over the given content and replaces all previous results.
|
|
8581
|
+
*
|
|
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.
|
|
8589
|
+
*/
|
|
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;
|
|
8629
|
+
}
|
|
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;
|
|
8638
|
+
}
|
|
8639
|
+
/**
|
|
8640
|
+
* Moves to the previous match, wrapping around to the last.
|
|
8641
|
+
*/
|
|
8642
|
+
prev() {
|
|
8643
|
+
if (this.matches.length === 0) {
|
|
8644
|
+
return;
|
|
8645
|
+
}
|
|
8646
|
+
this.currentIndex = (this.currentIndex - 1 + this.matches.length) % this.matches.length;
|
|
8647
|
+
}
|
|
8648
|
+
/**
|
|
8649
|
+
* Sets the current index directly. Clamps to valid range.
|
|
8650
|
+
*
|
|
8651
|
+
* @param {number} index - The desired index.
|
|
8652
|
+
*/
|
|
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));
|
|
8659
|
+
}
|
|
8660
|
+
/**
|
|
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.
|
|
8664
|
+
*/
|
|
8665
|
+
getCurrentMatch() {
|
|
8666
|
+
var _a;
|
|
8667
|
+
return (_a = this.matches[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
|
|
8668
|
+
}
|
|
8669
|
+
/**
|
|
8670
|
+
* Returns all matches from the last search.
|
|
8671
|
+
*
|
|
8672
|
+
* @returns {ReadonlyArray<FindMatch>} All matches from the last search.
|
|
8673
|
+
*/
|
|
8674
|
+
getMatches() {
|
|
8675
|
+
return this.matches;
|
|
8676
|
+
}
|
|
8677
|
+
/**
|
|
8678
|
+
* Returns the total number of matches from the last search.
|
|
8679
|
+
*
|
|
8680
|
+
* @returns {number} The total number of matches.
|
|
8681
|
+
*/
|
|
8682
|
+
getTotal() {
|
|
8683
|
+
return this.matches.length;
|
|
8684
|
+
}
|
|
8685
|
+
/**
|
|
8686
|
+
* Returns the 0-based index of the current match, or -1 when there are no results.
|
|
8687
|
+
*
|
|
8688
|
+
* @returns {number} The 0-based index, or -1 when there are no results.
|
|
8689
|
+
*/
|
|
8690
|
+
getCurrentIndex() {
|
|
8691
|
+
return this.currentIndex;
|
|
8692
|
+
}
|
|
8693
|
+
/**
|
|
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.
|
|
8715
|
+
*
|
|
8716
|
+
* @param {boolean} enabled - Whether to enable case-sensitive matching.
|
|
8717
|
+
*/
|
|
8718
|
+
setMatchCase(enabled) {
|
|
8719
|
+
this.matchCase = enabled;
|
|
8720
|
+
}
|
|
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;
|
|
8728
|
+
}
|
|
8729
|
+
// ─── Private helpers ──────────────────────────────────────────────────────────
|
|
8730
|
+
/**
|
|
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.
|
|
8734
|
+
*
|
|
8735
|
+
* @param {VegaRTEContent} content - The incoming content reference.
|
|
8736
|
+
*/
|
|
8737
|
+
invalidateCacheIfNeeded(content) {
|
|
8738
|
+
if (content !== this.cachedContent) {
|
|
8739
|
+
this.flatCache = new WeakMap();
|
|
8740
|
+
this.cachedContent = content;
|
|
8741
|
+
}
|
|
8742
|
+
}
|
|
8743
|
+
/**
|
|
8744
|
+
* Builds a RegExp from the keyword and search options.
|
|
8745
|
+
*
|
|
8746
|
+
* @param {string} keyword - The raw user input.
|
|
8747
|
+
* @param {FindOptions} options - Search options.
|
|
8748
|
+
* @returns {RegExp} The compiled regular expression.
|
|
8749
|
+
*/
|
|
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';
|
|
8432
9631
|
|
|
8433
9632
|
/**
|
|
8434
9633
|
* Default line height options used by the line-height extension when no
|
|
@@ -8829,7 +10028,7 @@ class VegaRTELineHeightExtension extends linkExtension.VegaRTEExtension {
|
|
|
8829
10028
|
*/
|
|
8830
10029
|
prepareBeforeLoad(host) {
|
|
8831
10030
|
this.toolbarButtonRenderer = new RTELineHeightToolbarButtonRenderer(this.options);
|
|
8832
|
-
this.registerToolbarButtonRenderer(
|
|
10031
|
+
this.registerToolbarButtonRenderer(VegaRTELineHeightExtension.TOOLBAR_BUTTON_KEY, this.toolbarButtonRenderer, host);
|
|
8833
10032
|
}
|
|
8834
10033
|
}
|
|
8835
10034
|
(() => {
|
|
@@ -8839,6 +10038,396 @@ class VegaRTELineHeightExtension extends linkExtension.VegaRTEExtension {
|
|
|
8839
10038
|
attachLineHeightFromJson(BlockClass);
|
|
8840
10039
|
});
|
|
8841
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';
|
|
8842
10431
|
|
|
8843
10432
|
/**
|
|
8844
10433
|
* Insert a new children to the nearest position of the parent container
|
|
@@ -8958,7 +10547,7 @@ class VegaRTETokenExtension extends linkExtension.VegaRTEExtension {
|
|
|
8958
10547
|
}
|
|
8959
10548
|
/** @inheritDoc */
|
|
8960
10549
|
prepareBeforeLoad(host) {
|
|
8961
|
-
this.registerToolbarButtonRenderer(
|
|
10550
|
+
this.registerToolbarButtonRenderer(VegaRTETokenExtension.TOOLBAR_BUTTON_KEY, new RTETokenToolbarButtonRenderer(this.tokenList), host);
|
|
8962
10551
|
}
|
|
8963
10552
|
}
|
|
8964
10553
|
(() => {
|
|
@@ -8966,8 +10555,10 @@ class VegaRTETokenExtension extends linkExtension.VegaRTEExtension {
|
|
|
8966
10555
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(codeBlock.RTETextBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
8967
10556
|
linkExtension.VegaRTEExtension.registerActionHandleStrategy(contentState.RTEListItemBlock.name, 'INSERT_TOKEN_NODE', insertTokenNodeStrategy);
|
|
8968
10557
|
})();
|
|
10558
|
+
VegaRTETokenExtension.TOOLBAR_BUTTON_KEY = 'token';
|
|
8969
10559
|
|
|
8970
10560
|
exports.ActionHandlerInterceptor = ActionHandlerInterceptor;
|
|
10561
|
+
exports.DeleteSelectedContentAction = DeleteSelectedContentAction;
|
|
8971
10562
|
exports.InsertNodeToNearestRootAction = InsertNodeToNearestRootAction;
|
|
8972
10563
|
exports.RTELanguageToolbarButtonRenderer = RTELanguageToolbarButtonRenderer;
|
|
8973
10564
|
exports.RTETokenNode = RTETokenNode;
|
|
@@ -8977,7 +10568,10 @@ exports.VegaCalendarPeriodFactory = VegaCalendarPeriodFactory;
|
|
|
8977
10568
|
exports.VegaEventManager = VegaEventManager$1;
|
|
8978
10569
|
exports.VegaLoader = VegaLoader;
|
|
8979
10570
|
exports.VegaNotify = VegaNotify;
|
|
10571
|
+
exports.VegaRTECopyExtension = VegaRTECopyExtension;
|
|
10572
|
+
exports.VegaRTECutExtension = VegaRTECutExtension;
|
|
8980
10573
|
exports.VegaRTEDefaultLineHeightOptions = VegaRTEDefaultLineHeightOptions;
|
|
10574
|
+
exports.VegaRTEFindReplaceExtension = VegaRTEFindReplaceExtension;
|
|
8981
10575
|
exports.VegaRTEFunctionExtension = VegaRTEFunctionExtension;
|
|
8982
10576
|
exports.VegaRTEHorizontalLineExtension = VegaRTEHorizontalLineExtension;
|
|
8983
10577
|
exports.VegaRTELanguageExtension = VegaRTELanguageExtension;
|