@heartlandone/vega 2.74.0-RTE-table-preview → 2.74.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-be2e868e.js → app-globals-e9f2edcf.js} +17 -18
- package/dist/cjs/{code-block-22ee2550.js → code-block-c8ae7e0a.js} +3 -34
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-3486cbc0.js → component-value-history-controller-slimmer.abstract-13968181.js} +5 -26
- package/dist/cjs/{design-token-505997df.js → design-token-4e23c50a.js} +1 -1
- package/dist/cjs/{content-state-0be6fda3.js → dto-renderer-manager-ca753971.js} +58 -15
- package/dist/cjs/{element-appender-slimmer-26420c09.js → element-appender-slimmer-dc769946.js} +6 -6
- package/dist/cjs/{form-field-controller-slimmer-56c551ea.js → form-field-controller-slimmer-6e3e14fd.js} +2 -2
- package/dist/cjs/function-extension-5972c73c.js +2927 -0
- package/dist/cjs/{image-annotation-action-462fd073.js → image-annotation-action-92df8979.js} +3 -3
- package/dist/cjs/index-58ea899e.js +0 -4
- package/dist/cjs/{index-fc538f17.js → index-638a0f0d.js} +1 -1
- package/dist/cjs/index.cjs.js +38 -43
- package/dist/cjs/{language-extension-414149c2.js → language-extension-d78389f9.js} +8 -8
- package/dist/cjs/loader.cjs.js +8 -13
- package/dist/cjs/{public-rules-2d18cf41.js → public-rules-23a86d33.js} +4 -4
- package/dist/cjs/{range-439a0c0c.js → range-80f19554.js} +1 -1
- package/dist/cjs/{responsive-format-facade-0ececeb3.js → responsive-format-facade-8d195366.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-5a4f3626.js → rich-text-editor-required-rule-80304585.js} +2 -2
- package/dist/cjs/{string-input-formatter-slimmer-a8f4a9b1.js → string-input-formatter-slimmer-338bbd73.js} +2 -2
- package/dist/cjs/{style-formatter-142500c0.js → style-formatter-dbda894b.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-011866d9.js → sub-state-notify-slimmer-1efa69c4.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-23d43f1e.js → sub-state-observer-slimmer-6afa62f5.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -10
- package/dist/cjs/vega-app-header-button.cjs.entry.js +6 -10
- package/dist/cjs/vega-box.cjs.entry.js +7 -11
- package/dist/cjs/vega-button-circle.cjs.entry.js +6 -10
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +5 -9
- package/dist/cjs/vega-calendar_4.cjs.entry.js +3 -3
- package/dist/cjs/vega-card.cjs.entry.js +6 -10
- package/dist/cjs/vega-carousel.cjs.entry.js +5 -9
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +6 -10
- package/dist/cjs/vega-code-block.cjs.entry.js +4 -4
- package/dist/cjs/vega-color-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -3
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +11 -15
- package/dist/cjs/vega-dialog_2.cjs.entry.js +13 -17
- package/dist/cjs/vega-divider.cjs.entry.js +6 -10
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -12
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -10
- package/dist/cjs/vega-flex.cjs.entry.js +7 -11
- package/dist/cjs/vega-font.cjs.entry.js +6 -10
- package/dist/cjs/vega-form.cjs.entry.js +4 -4
- package/dist/cjs/vega-grid.cjs.entry.js +6 -10
- package/dist/cjs/vega-icon.cjs.entry.js +6 -10
- package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -12
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-passcode.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +6 -10
- package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-select.cjs.entry.js +7 -10
- package/dist/cjs/vega-input.cjs.entry.js +5 -5
- package/dist/cjs/{vega-internal-event-id-73334b4b.js → vega-internal-event-id-f2465f1b.js} +0 -4
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +13 -17
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +7 -11
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination.cjs.entry.js +5 -9
- package/dist/cjs/vega-popover_2.cjs.entry.js +7 -11
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +7 -11
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +9 -10
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +53 -59
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -12
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +11 -15
- package/dist/cjs/vega-signature-capture.cjs.entry.js +8 -12
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_11.cjs.entry.js +13 -16
- package/dist/cjs/vega-textarea.cjs.entry.js +3 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +8 -12
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +3 -3
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -10
- package/dist/cjs/vega.cjs.js +8 -13
- package/dist/collection/collection-manifest.json +0 -10
- package/dist/collection/components/vega-dropdown/vega-dropdown.js +2 -2
- package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +0 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +2 -24
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +1 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +1 -18
- package/dist/collection/components/vega-rich-text-editor/public-api.js +0 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/extension-controller.js +0 -20
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +2 -23
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +0 -252
- package/dist/collection/components/vega-rich-text-editor/test/spec-utils.js +2 -5
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +0 -4
- package/dist/collection/global/scripts/before-vega-load.js +0 -2
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +0 -2
- package/dist/collection/utils/spec-utils.js +3 -4
- package/dist/esm/{app-globals-8b873b6f.js → app-globals-9203a3e5.js} +6 -7
- package/dist/esm/{child-nodes-event-prevent-slimmer-a6afdb1e.js → child-nodes-event-prevent-slimmer-e6f98de5.js} +1 -1
- package/dist/esm/{code-block-76b29be1.js → code-block-4e0d321d.js} +5 -36
- package/dist/esm/{component-value-history-controller-slimmer.abstract-e1b0e163.js → component-value-history-controller-slimmer.abstract-0ab0d9f0.js} +6 -27
- package/dist/esm/{design-token-8fedb532.js → design-token-175c4c0c.js} +1 -1
- package/dist/esm/{dom-node-subject-observer-factory-e998eba4.js → dom-node-subject-observer-factory-1aaa1159.js} +1 -1
- package/dist/esm/{content-state-03f1d302.js → dto-renderer-manager-402e89d0.js} +59 -14
- package/dist/esm/{element-appender-slimmer-7b9326e2.js → element-appender-slimmer-7e7aa230.js} +4 -4
- package/dist/esm/{event-emit-slimmer-bbf6668c.js → event-emit-slimmer-2d791d0e.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-a0cff4d3.js → form-field-controller-slimmer-257928c1.js} +3 -3
- package/dist/esm/function-extension-45e413ff.js +2908 -0
- package/dist/esm/{image-annotation-action-47cdc068.js → image-annotation-action-2cdbbd57.js} +3 -3
- package/dist/esm/index-090d31ca.js +0 -4
- package/dist/esm/{index-da7e5fe5.js → index-0d487fae.js} +2 -2
- package/dist/esm/index.js +13 -17
- package/dist/esm/{internal-vega-event-manager-e799c54a.js → internal-vega-event-manager-fdee2a0a.js} +1 -1
- package/dist/esm/{language-extension-de6e6caf.js → language-extension-4bed2436.js} +2 -2
- package/dist/esm/loader.js +10 -15
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{public-rules-c48cc5c9.js → public-rules-05e83e40.js} +5 -5
- package/dist/esm/{range-af6150a8.js → range-5086f250.js} +1 -1
- package/dist/esm/{responsive-format-facade-16da4623.js → responsive-format-facade-f995d6de.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-7255832e.js → rich-text-editor-required-rule-0d1147a8.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-82f85b0b.js → string-input-formatter-slimmer-3a42d9b8.js} +3 -3
- package/dist/esm/{style-formatter-6ca58f6b.js → style-formatter-f4067407.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-4060c333.js → sub-state-notify-slimmer-71b9bbd5.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-bfa5e63e.js → sub-state-observer-slimmer-41a1b380.js} +2 -2
- package/dist/esm/vega-accordion.entry.js +9 -13
- package/dist/esm/vega-app-header-button.entry.js +10 -14
- package/dist/esm/vega-banner.entry.js +3 -3
- package/dist/esm/vega-box.entry.js +9 -13
- package/dist/esm/vega-breadcrumb.entry.js +4 -4
- package/dist/esm/vega-button-circle.entry.js +10 -14
- package/dist/esm/vega-button-group_2.entry.js +7 -7
- package/dist/esm/vega-button-link.entry.js +4 -4
- package/dist/esm/vega-button.entry.js +9 -13
- package/dist/esm/vega-calendar_4.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +8 -12
- package/dist/esm/vega-carousel.entry.js +8 -12
- package/dist/esm/vega-checkbox_2.entry.js +7 -7
- package/dist/esm/vega-chip.entry.js +10 -14
- package/dist/esm/vega-code-block.entry.js +8 -8
- package/dist/esm/vega-color-picker.entry.js +6 -6
- package/dist/esm/vega-combo-box.entry.js +7 -7
- package/dist/esm/vega-date-picker_2.entry.js +15 -19
- package/dist/esm/vega-dialog_2.entry.js +10 -14
- package/dist/esm/vega-divider.entry.js +8 -12
- package/dist/esm/vega-dropdown_5.entry.js +13 -16
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +6 -6
- package/dist/esm/vega-flag-icon.entry.js +8 -12
- package/dist/esm/vega-flex.entry.js +9 -13
- package/dist/esm/vega-font.entry.js +8 -12
- package/dist/esm/vega-form.entry.js +8 -8
- package/dist/esm/vega-grid.entry.js +8 -12
- package/dist/esm/vega-icon.entry.js +8 -12
- package/dist/esm/vega-image-uploader.entry.js +11 -15
- package/dist/esm/vega-input-credit-card.entry.js +7 -7
- package/dist/esm/vega-input-numeric.entry.js +8 -8
- package/dist/esm/vega-input-passcode.entry.js +7 -7
- package/dist/esm/vega-input-phone-number.entry.js +10 -14
- package/dist/esm/vega-input-range.entry.js +7 -7
- package/dist/esm/vega-input-select.entry.js +11 -14
- package/dist/esm/vega-input.entry.js +8 -8
- package/dist/esm/{vega-internal-event-id-3edc9b4e.js → vega-internal-event-id-4a06d705.js} +1 -3
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +12 -16
- package/dist/esm/vega-loader-wrapper_2.entry.js +7 -11
- package/dist/esm/vega-page-notification_2.entry.js +1 -1
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +9 -13
- package/dist/esm/vega-popover_2.entry.js +10 -14
- package/dist/esm/vega-progress-tracker_2.entry.js +10 -14
- package/dist/esm/vega-radio_2.entry.js +7 -7
- package/dist/esm/vega-rich-text-content.entry.js +7 -8
- package/dist/esm/vega-rich-text-editor_4.entry.js +34 -40
- package/dist/esm/vega-segment-control.entry.js +3 -3
- package/dist/esm/vega-selection-chip_2.entry.js +12 -16
- package/dist/esm/vega-selection-tile_2.entry.js +8 -8
- package/dist/esm/vega-sidenav_3.entry.js +10 -14
- package/dist/esm/vega-signature-capture.entry.js +11 -15
- package/dist/esm/vega-stepper.entry.js +7 -7
- package/dist/esm/vega-tab-group_2.entry.js +4 -4
- package/dist/esm/vega-table_11.entry.js +11 -14
- package/dist/esm/vega-textarea.entry.js +7 -7
- package/dist/esm/vega-time-picker_2.entry.js +12 -16
- package/dist/esm/vega-toggle-switch.entry.js +6 -6
- package/dist/esm/vega-tooltip_2.entry.js +8 -12
- package/dist/esm/vega.js +10 -15
- package/dist/sri/vega-sri-manifest.json +304 -704
- package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +2 -2
- package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +5 -2
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +6 -10
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +2 -15
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +2 -39
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/extension-controller.d.ts +0 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.d.ts +0 -9
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +6 -19
- package/dist/types/components/vega-rich-text-editor/test/spec-utils.d.ts +0 -4
- package/dist/types/components.d.ts +3 -140
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +0 -2
- package/dist/types/types/components.type.d.ts +0 -4
- package/dist/types/utils/spec-utils.d.ts +3 -2
- package/dist/vega/index.esm.js +1 -57
- package/dist/vega/p-05feab84.entry.js +1 -0
- package/dist/vega/p-071f9d00.entry.js +1 -0
- package/dist/vega/p-0f601e59.entry.js +1 -0
- package/dist/vega/{p-c00adad9.js → p-184d8443.js} +1 -1
- package/dist/vega/p-1a7e97d2.entry.js +1 -0
- package/dist/vega/{p-24766b9d.entry.js → p-2409a475.entry.js} +1 -1
- package/dist/vega/{p-99e3dcab.js → p-29618be2.js} +1 -1
- package/dist/vega/{p-206245d2.entry.js → p-2ae5ad30.entry.js} +1 -1
- package/dist/vega/{p-d2033624.js → p-301096ee.js} +1 -1
- package/dist/vega/{p-16af7681.js → p-30e7544c.js} +1 -1
- package/dist/vega/p-310a6294.entry.js +1 -0
- package/dist/vega/{p-08b4d097.entry.js → p-3162a7fd.entry.js} +1 -1
- package/dist/vega/{p-7ca9f6f1.js → p-3226c208.js} +1 -1
- package/dist/vega/p-3398f553.entry.js +1 -0
- package/dist/vega/{p-b91c2c9d.js → p-3566ad76.js} +1 -1
- package/dist/vega/p-370ee9e3.entry.js +1 -0
- package/dist/vega/p-38b8efe5.entry.js +1 -0
- package/dist/vega/p-398220f5.entry.js +1 -0
- package/dist/vega/p-3a279b71.js +1 -0
- package/dist/vega/{p-c3d388b5.entry.js → p-3b32e75d.entry.js} +1 -1
- package/dist/vega/p-3ebc8b5b.entry.js +1 -0
- package/dist/vega/p-3f56d184.entry.js +1 -0
- package/dist/vega/p-42b7b5df.js +1 -0
- package/dist/vega/{p-9aac9879.entry.js → p-44bc9ea9.entry.js} +1 -1
- package/dist/vega/p-451ddd84.js +1 -0
- package/dist/vega/{p-a924c1e2.entry.js → p-4957f07a.entry.js} +1 -1
- package/dist/vega/p-59fa3f68.js +1 -0
- package/dist/vega/p-5a0c92db.entry.js +1 -0
- package/dist/vega/p-5b71c85e.js +1 -0
- package/dist/vega/{p-ddf81373.js → p-5be29f14.js} +1 -1
- package/dist/vega/p-5c492358.entry.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-8162980c.js → p-674fe99e.js} +1 -1
- package/dist/vega/{p-dd5d917b.entry.js → p-676eaf3f.entry.js} +1 -1
- package/dist/vega/{p-c335088c.js → p-697eb0e1.js} +1 -1
- package/dist/vega/{p-e797bf8d.entry.js → p-6b9d2996.entry.js} +1 -1
- package/dist/vega/{p-1f4a814e.entry.js → p-6e84e451.entry.js} +1 -1
- package/dist/vega/p-73383099.js +1 -0
- package/dist/vega/{p-ac4bd1f8.js → p-748eb5a2.js} +1 -1
- package/dist/vega/p-779cd090.entry.js +1 -0
- package/dist/vega/{p-216f3436.entry.js → p-7a8c4cf8.entry.js} +1 -1
- package/dist/vega/p-7c238c19.entry.js +1 -0
- package/dist/vega/{p-86caa739.entry.js → p-7f9acdf7.entry.js} +1 -1
- package/dist/vega/{p-d4e35d2e.entry.js → p-82dbff54.entry.js} +1 -1
- package/dist/vega/{p-ff57c872.js → p-8bd496b4.js} +1 -1
- package/dist/vega/p-94cf46ca.entry.js +1 -0
- package/dist/vega/p-950bf9a9.entry.js +1 -0
- package/dist/vega/p-95b11cdd.entry.js +1 -0
- package/dist/vega/{p-c9541fc2.entry.js → p-96797fee.entry.js} +1 -1
- package/dist/vega/p-99676172.entry.js +1 -0
- package/dist/vega/{p-f6eab527.entry.js → p-9b673fd4.entry.js} +1 -1
- package/dist/vega/p-9b7daab0.entry.js +1 -0
- package/dist/vega/{p-73688c4e.entry.js → p-9d8e2939.entry.js} +1 -1
- package/dist/vega/{p-d466baf7.js → p-9ea8eb49.js} +1 -1
- package/dist/vega/{p-780cbfb0.entry.js → p-9fb71d8c.entry.js} +1 -1
- package/dist/vega/{p-63246470.js → p-a2d1c2f3.js} +1 -1
- package/dist/vega/{p-d07d04e0.entry.js → p-a58bdbad.entry.js} +1 -1
- package/dist/vega/{p-e788598a.entry.js → p-a5d4d168.entry.js} +1 -1
- package/dist/vega/p-a6dfef41.entry.js +1 -0
- package/dist/vega/p-a7f151fe.entry.js +1 -0
- package/dist/vega/p-b007d0d5.entry.js +1 -0
- package/dist/vega/p-b0ed81e2.js +1 -0
- package/dist/vega/p-b18c12cb.entry.js +1 -0
- package/dist/vega/p-b19d4e26.entry.js +1 -0
- package/dist/vega/p-b4be03bb.entry.js +1 -0
- package/dist/vega/p-ba223773.entry.js +1 -0
- package/dist/vega/p-bb9db84a.entry.js +1 -0
- package/dist/vega/{p-8ac453cb.entry.js → p-be0b67b8.entry.js} +1 -1
- package/dist/vega/p-c34feecd.entry.js +1 -0
- package/dist/vega/p-c4700277.entry.js +1 -0
- package/dist/vega/{p-3bc7e162.entry.js → p-c7194674.entry.js} +1 -1
- package/dist/vega/p-c796307d.entry.js +1 -0
- package/dist/vega/{p-fa34ace2.entry.js → p-c7f292dd.entry.js} +1 -1
- package/dist/vega/p-ca9b4af9.entry.js +1 -0
- package/dist/vega/p-cadd84ec.entry.js +1 -0
- package/dist/vega/p-ce2ffff7.js +1 -0
- package/dist/vega/p-e3fa091a.js +1 -0
- package/dist/vega/{p-12a97dad.entry.js → p-ead1da57.entry.js} +1 -1
- package/dist/vega/p-edbecf19.entry.js +1 -0
- package/dist/vega/{p-c8ad47c9.js → p-f0bde406.js} +1 -1
- package/dist/vega/{p-5367eaab.js → p-f2c8c363.js} +1 -1
- package/dist/vega/{p-a6e03df4.entry.js → p-f38a4be2.entry.js} +1 -1
- package/dist/vega/{p-813b2915.entry.js → p-f6cd7a08.entry.js} +1 -1
- package/dist/vega/p-f844f3f1.entry.js +1 -0
- package/dist/vega/p-f92752d2.entry.js +1 -0
- package/dist/vega/p-fbda4a20.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -172
- package/package.json +1 -1
- package/dist/cjs/align-left-4a76df69.js +0 -22
- package/dist/cjs/dto-renderer-manager-ae5fcbba.js +0 -58
- package/dist/cjs/styles.constants-3aff0b56.js +0 -1306
- package/dist/cjs/table-extension-2a20da57.js +0 -6018
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +0 -1313
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-children-remove-interceptor.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-content-delete-interceptor.js +0 -26
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-row-insert-interceptor.js +0 -23
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-block-strategy.js +0 -25
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-column-strategy.js +0 -57
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-row-strategy.js +0 -57
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-block-strategy.js +0 -54
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-column-strategy.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-row-strategy.js +0 -117
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/select-table-column-strategy.js +0 -22
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/table-column-strategy.abstract.js +0 -19
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-row-strategy.js +0 -133
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-table-column-strategy.js +0 -99
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-cell-properties-strategy.js +0 -23
- package/dist/collection/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-properties-strategy.js +0 -29
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/delete-table-block-action.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/delete-table-column-action.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/delete-table-row-action.js +0 -18
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/insert-table-block-action.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/insert-table-column-action.js +0 -19
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/insert-table-row-action.js +0 -26
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/select-table-column-action.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-annotations-action.js +0 -18
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-caption-action.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-cell-annotations-action.js +0 -18
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/table-head-cell-annotations-action.js +0 -18
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/toggle-header-row-action.js +0 -13
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/toggle-header-table-column-action.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/extensions/table/actions/update-table-properties-action.js +0 -38
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.js +0 -97
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler.js +0 -69
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-cell-annotation-handler.js +0 -82
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotation-handler/table-head-cell-annotation-handler.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.js +0 -91
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.js +0 -57
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.js +0 -121
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-head-cell-annotation.js +0 -40
- package/dist/collection/components/vega-rich-text-editor/extensions/table/constants/styles.constants.js +0 -21
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-block.js +0 -119
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-body-block.js +0 -56
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.js +0 -69
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.js +0 -66
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-block.js +0 -60
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.js +0 -53
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-row-block.js +0 -60
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/caption-to-caption-block-strategy.js +0 -50
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/table-to-table-block-strategy.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tbody-to-table-body-block-strategy.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/td-to-table-cell-block-strategy.js +0 -71
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/thead-to-table-head-block-strategy.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tr-to-table-row-block-strategy.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-body-renderer.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-caption-renderer.js +0 -22
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-cell-renderer.js +0 -74
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-dynamic-popover-renderer.js +0 -254
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-head-cell-renderer.js +0 -12
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-head-renderer.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-renderer.js +0 -149
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-row-renderer.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/extensions/table/renderers/table-setting-popover-renderer.js +0 -148
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/caption-operation.js +0 -78
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-cancel-event-handler.js +0 -17
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-change-event-handler.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-save-event-handler.js +0 -19
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties.js +0 -131
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/column-operation.js +0 -109
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/row-operation.js +0 -132
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/setting-event-handler.abstract.js +0 -44
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-cancel-event-handler.js +0 -19
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-change-event-handler.js +0 -20
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-save-event-handler.js +0 -20
- package/dist/collection/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties.js +0 -50
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +0 -152
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-icon.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-selection.js +0 -371
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-toolbar-button-renderer.js +0 -234
- package/dist/collection/components/vega-rich-text-editor/extensions/table/utils/utils.js +0 -102
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-bottom.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-middle.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-top.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-center-horizontal.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-left.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-right.js +0 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/controllers/vega-rich-text-table-properties-color-controller.js +0 -27
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-cell-properties-form-field-renderer.js +0 -106
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-basic-form-field-renderer.abstract.js +0 -259
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-field-renderer.js +0 -58
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-renderer.js +0 -93
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/vega-rich-text-table-properties.css +0 -148
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/vega-rich-text-table-properties.js +0 -241
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/controllers/selection-widget-keyboard-controller.js +0 -36
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/renderers/selection-widget-renderer.js +0 -83
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/vega-rich-text-table-selection-widget.css +0 -41
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/vega-rich-text-table-selection-widget.js +0 -80
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/assets/icon.js +0 -20
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/caption-button-slimmer.js +0 -27
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/cell-properties-button-slimmer.js +0 -26
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/column-button-slimmer.js +0 -86
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/row-button-slimmer.js +0 -101
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-properties-button-slimmer.js +0 -26
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-setting-button-slimmer.abstract.js +0 -75
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/vega-rich-text-table-setting-renderer.js +0 -50
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/vega-rich-text-table-setting.css +0 -20
- package/dist/collection/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/vega-rich-text-table-setting.js +0 -215
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/annotation-handler-registration.test.js +0 -164
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-annotation-handler.test.js +0 -293
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-cell-annotation-handler.test.js +0 -295
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-head-cell-annotation-handler.test.js +0 -415
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/caption-operation.test.js +0 -99
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-annotation.test.js +0 -89
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-caption-annotations.test.js +0 -79
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-cell-annotation.test.js +0 -128
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-dto.test.js +0 -517
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-element-to-dto-strategies.test.js +0 -1450
- package/dist/collection/components/vega-rich-text-editor/test/extensions/table/table-test-utils.js +0 -172
- package/dist/esm/align-left-7f959adf.js +0 -17
- package/dist/esm/dto-renderer-manager-12bc9121.js +0 -56
- package/dist/esm/styles.constants-0dd6f7fa.js +0 -1277
- package/dist/esm/table-extension-c83b7a56.js +0 -5998
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +0 -1307
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-children-remove-interceptor.d.ts +0 -25
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-cell-content-delete-interceptor.d.ts +0 -20
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-interceptors/prevent-row-insert-interceptor.d.ts +0 -19
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-block-strategy.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-column-strategy.d.ts +0 -31
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/delete-table-row-strategy.d.ts +0 -28
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-block-strategy.d.ts +0 -27
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-column-strategy.d.ts +0 -19
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/insert-table-row-strategy.d.ts +0 -27
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/select-table-column-strategy.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/table-column-strategy.abstract.d.ts +0 -20
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-row-strategy.d.ts +0 -41
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/toggle-header-table-column-strategy.d.ts +0 -45
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-cell-properties-strategy.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/extensions/table/action-handler-strategies/update-table-properties-strategy.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/delete-table-block-action.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/delete-table-column-action.d.ts +0 -15
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/delete-table-row-action.d.ts +0 -17
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/insert-table-block-action.d.ts +0 -20
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/insert-table-column-action.d.ts +0 -23
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/insert-table-row-action.d.ts +0 -23
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/select-table-column-action.d.ts +0 -18
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-annotations-action.d.ts +0 -16
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-caption-action.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-cell-annotations-action.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/table-head-cell-annotations-action.d.ts +0 -15
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/toggle-header-row-action.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/toggle-header-table-column-action.d.ts +0 -16
- package/dist/types/components/vega-rich-text-editor/extensions/table/actions/update-table-properties-action.d.ts +0 -18
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler-base.d.ts +0 -43
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-annotation-handler.d.ts +0 -26
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-cell-annotation-handler.d.ts +0 -42
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotation-handler/table-head-cell-annotation-handler.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.d.ts +0 -64
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.d.ts +0 -26
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.d.ts +0 -67
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-head-cell-annotation.d.ts +0 -22
- package/dist/types/components/vega-rich-text-editor/extensions/table/constants/styles.constants.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-block.d.ts +0 -79
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-body-block.d.ts +0 -42
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.d.ts +0 -41
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.d.ts +0 -45
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-block.d.ts +0 -42
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.d.ts +0 -34
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-row-block.d.ts +0 -44
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/caption-to-caption-block-strategy.d.ts +0 -29
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/table-to-table-block-strategy.d.ts +0 -26
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tbody-to-table-body-block-strategy.d.ts +0 -26
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/td-to-table-cell-block-strategy.d.ts +0 -27
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/thead-to-table-head-block-strategy.d.ts +0 -26
- package/dist/types/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/tr-to-table-row-block-strategy.d.ts +0 -26
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-body-renderer.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-caption-renderer.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-cell-renderer.d.ts +0 -37
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-dynamic-popover-renderer.d.ts +0 -88
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-head-cell-renderer.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-head-renderer.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-renderer.d.ts +0 -61
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-row-renderer.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/extensions/table/renderers/table-setting-popover-renderer.d.ts +0 -66
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/caption-operation.d.ts +0 -36
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-cancel-event-handler.d.ts +0 -17
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-change-event-handler.d.ts +0 -15
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties-save-event-handler.d.ts +0 -17
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/cell-properties.d.ts +0 -62
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/column-operation.d.ts +0 -55
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/row-operation.d.ts +0 -61
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/setting-event-handler.abstract.d.ts +0 -47
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-cancel-event-handler.d.ts +0 -19
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-change-event-handler.d.ts +0 -17
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties-save-event-handler.d.ts +0 -17
- package/dist/types/components/vega-rich-text-editor/extensions/table/setting-event-handlers/table-properties.d.ts +0 -33
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-extension.d.ts +0 -36
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-icon.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-selection.d.ts +0 -149
- package/dist/types/components/vega-rich-text-editor/extensions/table/table-toolbar-button-renderer.d.ts +0 -86
- package/dist/types/components/vega-rich-text-editor/extensions/table/utils/utils.d.ts +0 -53
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-bottom.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-middle.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/align-top.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-center-horizontal.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-left.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/assets/objects-align-right.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/controllers/vega-rich-text-table-properties-color-controller.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-cell-properties-form-field-renderer.d.ts +0 -49
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-basic-form-field-renderer.abstract.d.ts +0 -99
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-field-renderer.d.ts +0 -27
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/slimmers/renderers/vega-rich-text-table-properties-form-renderer.d.ts +0 -33
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-properties/vega-rich-text-table-properties.d.ts +0 -57
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/controllers/selection-widget-keyboard-controller.d.ts +0 -15
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/slimmers/renderers/selection-widget-renderer.d.ts +0 -31
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-selection-widget/vega-rich-text-table-selection-widget.d.ts +0 -27
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/assets/icon.d.ts +0 -2
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/caption-button-slimmer.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/cell-properties-button-slimmer.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/column-button-slimmer.d.ts +0 -28
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/row-button-slimmer.d.ts +0 -36
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-properties-button-slimmer.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/table-setting-button-slimmer.abstract.d.ts +0 -36
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/slimmers/renderers/vega-rich-text-table-setting-renderer.d.ts +0 -11
- package/dist/types/components/vega-rich-text-editor/extensions/table/vega-rich-text-table-setting/vega-rich-text-table-setting.d.ts +0 -55
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/annotation-handler-registration.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-annotation-handler.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-cell-annotation-handler.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/annotation-handler/table-head-cell-annotation-handler.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/caption-operation.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-annotation.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-caption-annotations.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-cell-annotation.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-dto.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-element-to-dto-strategies.test.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/test/extensions/table/table-test-utils.d.ts +0 -11
- package/dist/vega/app-globals-955a2b3b.js +0 -427
- package/dist/vega/child-nodes-event-prevent-slimmer-a604a6dd.js +0 -156
- package/dist/vega/design-token-56b26205.js +0 -402
- package/dist/vega/element-appender-slimmer-8355fb28.js +0 -1508
- package/dist/vega/event-emit-slimmer-7a14f5e9.js +0 -265
- package/dist/vega/internal-vega-event-manager-8c62c88e.js +0 -458
- package/dist/vega/p-068ee55e.entry.js +0 -1
- package/dist/vega/p-088f4613.entry.js +0 -1
- package/dist/vega/p-0e4cecbd.entry.js +0 -1
- package/dist/vega/p-10ffb765.js +0 -1
- package/dist/vega/p-151b1deb.js +0 -1
- package/dist/vega/p-1b44db34.js +0 -1
- package/dist/vega/p-1bda4016.entry.js +0 -1
- package/dist/vega/p-213be5e9.entry.js +0 -1
- package/dist/vega/p-224a4f3f.entry.js +0 -1
- package/dist/vega/p-22c76be7.entry.js +0 -1
- package/dist/vega/p-22da15d7.entry.js +0 -1
- package/dist/vega/p-29a9c8f5.entry.js +0 -1
- package/dist/vega/p-34a994a1.entry.js +0 -1
- package/dist/vega/p-39d56e3d.js +0 -1
- package/dist/vega/p-40660c09.js +0 -1
- package/dist/vega/p-50a506ea.entry.js +0 -1
- package/dist/vega/p-550ce71a.entry.js +0 -1
- package/dist/vega/p-5d2704c1.entry.js +0 -1
- package/dist/vega/p-61ae4e9c.entry.js +0 -1
- package/dist/vega/p-6665d083.entry.js +0 -1
- package/dist/vega/p-69af3422.entry.js +0 -1
- package/dist/vega/p-6d9731c1.entry.js +0 -1
- package/dist/vega/p-6f08e3e1.entry.js +0 -1
- package/dist/vega/p-7172332a.entry.js +0 -1
- package/dist/vega/p-73689ec0.entry.js +0 -1
- package/dist/vega/p-79e8236a.entry.js +0 -1
- package/dist/vega/p-82ec9721.entry.js +0 -1
- package/dist/vega/p-8a4d8139.entry.js +0 -1
- package/dist/vega/p-98b78c75.entry.js +0 -1
- package/dist/vega/p-a007b493.entry.js +0 -1
- package/dist/vega/p-a439e59b.entry.js +0 -1
- package/dist/vega/p-a4d0ab07.js +0 -1
- package/dist/vega/p-ab0e013c.entry.js +0 -1
- package/dist/vega/p-abf871cd.entry.js +0 -1
- package/dist/vega/p-c674b07c.js +0 -1
- package/dist/vega/p-c6d98c60.entry.js +0 -1
- package/dist/vega/p-c78fe943.js +0 -1
- package/dist/vega/p-d1349401.entry.js +0 -1
- package/dist/vega/p-d4719c14.entry.js +0 -1
- package/dist/vega/p-d55365b9.entry.js +0 -1
- package/dist/vega/p-db482ee1.js +0 -1
- package/dist/vega/p-dc2813eb.entry.js +0 -1
- package/dist/vega/p-e0cefd90.entry.js +0 -1
- package/dist/vega/p-e13c163c.entry.js +0 -1
- package/dist/vega/p-f4b46f6b.entry.js +0 -1
- package/dist/vega/p-f519cdc3.entry.js +0 -1
- package/dist/vega/p-fbfb4c70.entry.js +0 -1
- package/dist/vega/p-fcabf0dc.js +0 -1
- package/dist/vega/p-ff921d10.js +0 -1
- package/dist/vega/p-ff9a0e6e.js +0 -1
- package/dist/vega/public-api-8dd022fa.js +0 -6043
- package/dist/vega/public-api-baaf7593.js +0 -4
- package/dist/vega/responsive-format-facade-98596535.js +0 -913
- package/dist/vega/style-formatter-0ae102e9.js +0 -32
- package/dist/vega/vega-accordion.entry.js +0 -291
- package/dist/vega/vega-app-header-button.entry.js +0 -452
- package/dist/vega/vega-banner.entry.js +0 -351
- package/dist/vega/vega-box.entry.js +0 -353
- package/dist/vega/vega-breadcrumb.entry.js +0 -249
- package/dist/vega/vega-button-circle.entry.js +0 -245
- package/dist/vega/vega-button-group.entry.js +0 -203
- package/dist/vega/vega-button-link.entry.js +0 -226
- package/dist/vega/vega-button.entry.js +0 -259
- package/dist/vega/vega-calendar.entry.js +0 -3884
- package/dist/vega/vega-card.entry.js +0 -226
- package/dist/vega/vega-carousel.entry.js +0 -540
- package/dist/vega/vega-checkbox-group.entry.js +0 -266
- package/dist/vega/vega-checkbox.entry.js +0 -335
- package/dist/vega/vega-chip.entry.js +0 -321
- package/dist/vega/vega-code-block.entry.js +0 -4372
- package/dist/vega/vega-color-picker.entry.js +0 -258
- package/dist/vega/vega-combo-box.entry.js +0 -748
- package/dist/vega/vega-date-picker-calendar.entry.js +0 -1381
- package/dist/vega/vega-date-picker.entry.js +0 -1646
- package/dist/vega/vega-dialog.entry.js +0 -158
- package/dist/vega/vega-divider.entry.js +0 -179
- package/dist/vega/vega-dropdown-content-box.entry.js +0 -57
- package/dist/vega/vega-dropdown-item.entry.js +0 -352
- package/dist/vega/vega-dropdown.entry.js +0 -2136
- package/dist/vega/vega-field-label.entry.js +0 -182
- package/dist/vega/vega-file-uploader.entry.js +0 -751
- package/dist/vega/vega-flag-icon.entry.js +0 -216
- package/dist/vega/vega-flex.entry.js +0 -224
- package/dist/vega/vega-font.entry.js +0 -327
- package/dist/vega/vega-form.entry.js +0 -1008
- package/dist/vega/vega-grid.entry.js +0 -129
- package/dist/vega/vega-icon.entry.js +0 -256
- package/dist/vega/vega-image-uploader.entry.js +0 -977
- package/dist/vega/vega-input-credit-card.entry.js +0 -549
- package/dist/vega/vega-input-numeric.entry.js +0 -471
- package/dist/vega/vega-input-passcode.entry.js +0 -728
- package/dist/vega/vega-input-phone-number.entry.js +0 -9143
- package/dist/vega/vega-input-range.entry.js +0 -693
- package/dist/vega/vega-input-select.entry.js +0 -1268
- package/dist/vega/vega-input.entry.js +0 -1735
- package/dist/vega/vega-item-toggle.entry.js +0 -190
- package/dist/vega/vega-left-nav-group.entry.js +0 -433
- package/dist/vega/vega-left-nav-link.entry.js +0 -317
- package/dist/vega/vega-left-nav-section.entry.js +0 -97
- package/dist/vega/vega-left-nav.entry.js +0 -654
- package/dist/vega/vega-loading-indicator.entry.js +0 -209
- package/dist/vega/vega-modal.entry.js +0 -1287
- package/dist/vega/vega-nav-card.entry.js +0 -163
- package/dist/vega/vega-pagination-page-selector-mobile.entry.js +0 -214
- package/dist/vega/vega-pagination.entry.js +0 -629
- package/dist/vega/vega-popover-content-box.entry.js +0 -101
- package/dist/vega/vega-popover.entry.js +0 -362
- package/dist/vega/vega-progress-tracker.entry.js +0 -757
- package/dist/vega/vega-radio-group.entry.js +0 -496
- package/dist/vega/vega-radio.entry.js +0 -272
- package/dist/vega/vega-rich-text-editor-toolbar-button.entry.js +0 -169
- package/dist/vega/vega-rich-text-editor.entry.js +0 -4107
- package/dist/vega/vega-rich-text-image-editor.entry.js +0 -216
- package/dist/vega/vega-rich-text-link-editor.entry.js +0 -238
- package/dist/vega/vega-rich-text-table-properties.entry.js +0 -641
- package/dist/vega/vega-rich-text-table-setting.entry.js +0 -525
- package/dist/vega/vega-segment-control.entry.js +0 -350
- package/dist/vega/vega-selection-chip-group.entry.js +0 -447
- package/dist/vega/vega-selection-chip.entry.js +0 -443
- package/dist/vega/vega-selection-tile-group.entry.js +0 -438
- package/dist/vega/vega-selection-tile.entry.js +0 -409
- package/dist/vega/vega-sidenav-link.entry.js +0 -160
- package/dist/vega/vega-sidenav.entry.js +0 -766
- package/dist/vega/vega-signature-capture.entry.js +0 -589
- package/dist/vega/vega-stepper.entry.js +0 -292
- package/dist/vega/vega-tab-group-panel.entry.js +0 -79
- package/dist/vega/vega-tab-group.entry.js +0 -1281
- package/dist/vega/vega-table-body.entry.js +0 -48
- package/dist/vega/vega-table-cell.entry.js +0 -243
- package/dist/vega/vega-table-foot-cell.entry.js +0 -169
- package/dist/vega/vega-table-foot-row.entry.js +0 -219
- package/dist/vega/vega-table-foot.entry.js +0 -136
- package/dist/vega/vega-table-head-cell.entry.js +0 -339
- package/dist/vega/vega-table-head-row.entry.js +0 -416
- package/dist/vega/vega-table-head.entry.js +0 -113
- package/dist/vega/vega-table-row.entry.js +0 -666
- package/dist/vega/vega-table.entry.js +0 -3707
- package/dist/vega/vega-textarea.entry.js +0 -329
- package/dist/vega/vega-time-picker.entry.js +0 -2039
- package/dist/vega/vega-toggle-switch.entry.js +0 -194
- package/dist/vega/vega-tooltip.entry.js +0 -339
- package/style/vega-icons.css +0 -17266
|
@@ -1,4107 +0,0 @@
|
|
|
1
|
-
import { h, g as Host, F as Fragment, r as registerInstance, e as createEvent, i as getElement } from './index-01a2f9c9.js';
|
|
2
|
-
import { V as VegaSlimmer, b as MapToComponentField, M as MapToComponentMethod, a as InjectVegaSlimmer, m as methodPlaceholder, e as InjectVegaGlobalSlimmer } from './vega-slimmer-core-83fd0e22.js';
|
|
3
|
-
import { V as VegaComponentUsageRuntimeMetricsSlimmer } from './component-usage-runtime-metrics-0513698f.js';
|
|
4
|
-
import { s as sanitizeVegaComponent } from './component-0cff85cf.js';
|
|
5
|
-
import { c as createEnterKeyHandlerToTriggerClick } from './accessibility-e5fd0fab.js';
|
|
6
|
-
import { C as ChangeManager } from './change-manager-b115783e.js';
|
|
7
|
-
import { d as domNodeSubjectFactory } from './dom-node-subject-factory-5798693b.js';
|
|
8
|
-
import { c as VegaInternalComponentDidRender, e as VegaInternalRichTextEditorFlushChanges, H as VegaInternalRichTextEditDeleteSelectedNodes, I as VegaInternalRichTextImageClick, J as VegaInternalRichTextImageDeleteButtonClicked } from './vega-internal-event-id-b65a01a3.js';
|
|
9
|
-
import { R as RTEDTORendererManager } from './dto-renderer-manager-12bc9121.js';
|
|
10
|
-
import { i as isNonNullable } from './type-guard-09acedc9.js';
|
|
11
|
-
import { a as VegaInternalIconManager } from './internal-icon-manager-9279071a.js';
|
|
12
|
-
import { b as RTETextNode, a1 as BoldAnnotationAction, z as NodeAnnotationTypeEnum, a2 as ItalicAnnotationAction, a3 as UnderlineAnnotationAction, e as RTETextBlock, T as TextStyleAnnotationAction, a4 as TextStyleAnnotation, a5 as BoldAnnotation, v as BlockAnnotationTypeEnum, a6 as ClearFormattingAnnotationAction, a7 as CodeAnnotationAction, a8 as StrikethroughAnnotationAction, X as SelectionChangeAction, Y as LinkAnnotationAction, a9 as IndentAnnotationAction, M as ModifyContentAction, c as ModifyContentActionType, W as RTECodeBlockNode, A as ActionHandleStrategyRegistry, H as HorizontalAlignmentAnnotationAction, s as stateEntityRenderingRegistry, h as AppendChildrenAction, Z as ZERO_WIDTH_SPACE, U as UpdateTextAction, j as InsertChildrenBeforeAction, J as SplitBlockWithNodeAction, m as RemoveChildrenAction, G as ReplaceChildNodesAction, y as RTECodeBlock, I as InsertChildrenAfterAction, V as VegaRTEPresetToolbarItems } from './code-block-b5f8fc8a.js';
|
|
13
|
-
import { V as VisualModeToolbarButtonSlimmer, I as ImageAnnotationAction, T as TextNodeRenderingRegistry, b as ToolbarButtonSlimmer, a as TextColorToolbarButtonSlimmer } from './image-annotation-action-c3a7fe36.js';
|
|
14
|
-
import { D as DomNodeSubjectObserverFactory } from './dom-node-subject-observer-factory-3b49c6b3.js';
|
|
15
|
-
import { V as VegaDropdownClick, h as VegaChange, U as VegaImageInserted } from './vega-event-id-61c8bd9f.js';
|
|
16
|
-
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-8565f08b.js';
|
|
17
|
-
import { a as waitForComponentDidRender } from './index-b04c1ee0.js';
|
|
18
|
-
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-316ebdb1.js';
|
|
19
|
-
import { c as createEventEmitSlimmer } from './event-emit-slimmer-61db3eef.js';
|
|
20
|
-
import { c as createSubStateNotifySlimmer } from './sub-state-notify-slimmer-2c2e1a57.js';
|
|
21
|
-
import { f as RTEImageNode, b as RTEListItemBlock, V as VegaRTEContent, M as MergeTwoBlocksNodesAction, I as InsertNewParagraphAction, S as StylePreservator, i as ElementToDtoStrategyProcessor, c as RTEImageBlock } from './content-state-fc9d98e0.js';
|
|
22
|
-
import { A as AlignLeft, a as AlignCenter, b as AlignRight, c as AlignJustify } from './align-justify-a14601e9.js';
|
|
23
|
-
import { R as RTESelectionState, C as ComponentValueHistoryControllerSlimmer, A as AutoRunWhenReRenderTaskQueueSlimmer, a as SelectionController } from './component-value-history-controller-slimmer.abstract-bacd9d3c.js';
|
|
24
|
-
import { F as FORM_ELEMENT_VALUE_CHANGE, D as DARK_MODE_CHANGE } from './static-subject-title-6fdf8c8b.js';
|
|
25
|
-
import { O as Observer } from './observer-3959f9dd.js';
|
|
26
|
-
import { d as debounce } from './timer-9321173b.js';
|
|
27
|
-
import { D as DarkModeStateControllerSlimmer } from './dark-mode-state-controller-slimmer-32138407.js';
|
|
28
|
-
import { R as RichTextEditorRequiredRule } from './rich-text-editor-required-rule-e3cd87ea.js';
|
|
29
|
-
import { C as ChildNodesEventPreventSlimmer } from './child-nodes-event-prevent-slimmer-fcfc9c8b.js';
|
|
30
|
-
import './index-9fdb7060.js';
|
|
31
|
-
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-e2a2f76c.js';
|
|
32
|
-
import { i as isArrayEqual } from './array-a1d98264.js';
|
|
33
|
-
import { T as TranslationSlimmer } from './translation-slimmer-3c4e2876.js';
|
|
34
|
-
import './ui-5f775fd9.js';
|
|
35
|
-
import './breakpoints-d9faf11c.js';
|
|
36
|
-
import './ui-189dae23.js';
|
|
37
|
-
import './typography-396de03f.js';
|
|
38
|
-
import './index-81ce67e2.js';
|
|
39
|
-
import './string-a953eafc.js';
|
|
40
|
-
import './object-66c37948.js';
|
|
41
|
-
import './page-resize-observer-slimmer-ee8774a6.js';
|
|
42
|
-
import './try-get-document-bef0f526.js';
|
|
43
|
-
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
44
|
-
import './mutation-observer-slimmer-7065c745.js';
|
|
45
|
-
import './mutation-observer-filters-6c515793.js';
|
|
46
|
-
import './sub-state-observer-slimmer-4fc8b3da.js';
|
|
47
|
-
import './internal-vega-event-manager-826279b7.js';
|
|
48
|
-
import './range-429fb0e2.js';
|
|
49
|
-
import './synchronize-task-queue-ac8acc3b.js';
|
|
50
|
-
import './keyboard-manager-slimmer-a7b44d74.js';
|
|
51
|
-
import './keyboard-manager-3c463777.js';
|
|
52
|
-
import './vega-env-manager-8f8dc473.js';
|
|
53
|
-
import './feature-flag-controller-24b9f956.js';
|
|
54
|
-
import './index-1f9eab8f.js';
|
|
55
|
-
import './_commonjsHelpers-2088bffa.js';
|
|
56
|
-
import './vega-nonce-manager-497e5eb5.js';
|
|
57
|
-
import './number-4398f2e1.js';
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Class to format HTML code with proper indentation and style cleanup.
|
|
61
|
-
*/
|
|
62
|
-
class CodeFormatter {
|
|
63
|
-
constructor() {
|
|
64
|
-
/**
|
|
65
|
-
* Formats a given HTML source string by applying indentation and cleaning up styles.
|
|
66
|
-
*
|
|
67
|
-
* @param {string} source - The HTML source string to format.
|
|
68
|
-
* @param {CodeFormatOptions} options - Formatting options.
|
|
69
|
-
* @returns {string} The formatted HTML string.
|
|
70
|
-
*/
|
|
71
|
-
this.format = (source, options = {}) => {
|
|
72
|
-
const { tabWidth = 4, useTabs = true } = options;
|
|
73
|
-
const indentUnit = useTabs ? '\t' : ' ';
|
|
74
|
-
const INDENT = indentUnit.repeat(tabWidth);
|
|
75
|
-
const tagRegex = /(<\/?[^>]+>)/g;
|
|
76
|
-
// Split source into tokens using tag boundaries while filtering out empty strings
|
|
77
|
-
const tokens = source.split(tagRegex).filter((t) => t.length > 0);
|
|
78
|
-
let indentLevel = 0;
|
|
79
|
-
let output = '';
|
|
80
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
81
|
-
let token = tokens[i];
|
|
82
|
-
// Decrease indentation for closing tags
|
|
83
|
-
if (token.startsWith('</')) {
|
|
84
|
-
indentLevel = Math.max(0, indentLevel - 1);
|
|
85
|
-
}
|
|
86
|
-
const indent = INDENT.repeat(indentLevel);
|
|
87
|
-
if (token.startsWith('<')) {
|
|
88
|
-
// Clean and normalize inline style attributes
|
|
89
|
-
token = token.replace(/style\s*=\s*"([^"]*)"/g, (_, styleContent) => {
|
|
90
|
-
return `style="${this.formatStyle(styleContent)}"`;
|
|
91
|
-
});
|
|
92
|
-
const tagName = CodeFormatter.getTagName(token);
|
|
93
|
-
const isInline = CodeFormatter.INLINE_TAGS.has(tagName);
|
|
94
|
-
// Inline tag grouping: e.g., <strong>Text</strong> stays on one line
|
|
95
|
-
if (isInline && i + 2 < tokens.length && tokens[i + 2] === `</${tagName}>`) {
|
|
96
|
-
// Group consecutive inline tags
|
|
97
|
-
let inlineGroup = `${token}${tokens[i + 1]}${tokens[i + 2]}`;
|
|
98
|
-
i += 2;
|
|
99
|
-
// Keep merging consecutive inline tag pairs
|
|
100
|
-
while (i + 2 < tokens.length &&
|
|
101
|
-
tokens[i + 1].startsWith('<') &&
|
|
102
|
-
CodeFormatter.INLINE_TAGS.has(CodeFormatter.getTagName(tokens[i + 1])) &&
|
|
103
|
-
tokens[i + 3] === `</${CodeFormatter.getTagName(tokens[i + 1])}>`) {
|
|
104
|
-
inlineGroup += `${tokens[i + 1]}${tokens[i + 2]}${tokens[i + 3]}`;
|
|
105
|
-
i += 3;
|
|
106
|
-
}
|
|
107
|
-
output += `${indent}${inlineGroup}\n`;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
output += `${indent}${token}\n`;
|
|
111
|
-
// Increase indentation for non-void opening tags
|
|
112
|
-
if (!token.startsWith('</') &&
|
|
113
|
-
!token.endsWith('/>') &&
|
|
114
|
-
!/^<br|^<img|^<meta|^<input|^<hr/i.test(token)) {
|
|
115
|
-
indentLevel++;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
// Add plain text content with current indentation
|
|
121
|
-
const text = token;
|
|
122
|
-
if (text.length > 0) {
|
|
123
|
-
output += `${INDENT.repeat(indentLevel)}${text}\n`;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return output.trim();
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Extracts the tag name from an HTML tag string.
|
|
132
|
-
*
|
|
133
|
-
* @param {string} tag - A raw HTML tag string
|
|
134
|
-
* @returns {string} The lowercase tag name, or an empty string if no match is found.
|
|
135
|
-
*/
|
|
136
|
-
static getTagName(tag) {
|
|
137
|
-
var _a;
|
|
138
|
-
const match = tag.match(/^<\/?([a-z0-9]+)/i);
|
|
139
|
-
return (_a = match === null || match === void 0 ? void 0 : match[1].toLowerCase()) !== null && _a !== void 0 ? _a : '';
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Formats a CSS style string by trimming white space and ensuring consistent semicolon spacing.
|
|
143
|
-
*
|
|
144
|
-
* @param {string} style - The CSS style string to format.
|
|
145
|
-
* @returns {string} The formatted style string.
|
|
146
|
-
*/
|
|
147
|
-
formatStyle(style) {
|
|
148
|
-
return style
|
|
149
|
-
.split(';')
|
|
150
|
-
.map((s) => s.trim())
|
|
151
|
-
.filter(Boolean)
|
|
152
|
-
.join('; ');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
CodeFormatter.INLINE_TAGS = new Set([
|
|
156
|
-
'span',
|
|
157
|
-
'strong',
|
|
158
|
-
'em',
|
|
159
|
-
'a',
|
|
160
|
-
'b',
|
|
161
|
-
'i',
|
|
162
|
-
'u',
|
|
163
|
-
'small',
|
|
164
|
-
'abbr',
|
|
165
|
-
'code',
|
|
166
|
-
'b',
|
|
167
|
-
'u',
|
|
168
|
-
's',
|
|
169
|
-
'mark',
|
|
170
|
-
'time',
|
|
171
|
-
'del',
|
|
172
|
-
'ins',
|
|
173
|
-
]);
|
|
174
|
-
const CodeFormatter$1 = new CodeFormatter();
|
|
175
|
-
|
|
176
|
-
var __decorate$w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
177
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
178
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
179
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
180
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
181
|
-
};
|
|
182
|
-
class VegaRichTextEditorRenderer extends VegaSlimmer {
|
|
183
|
-
constructor() {
|
|
184
|
-
super(...arguments);
|
|
185
|
-
this.renderHintMessage = () => {
|
|
186
|
-
return h("vega-text", null, this.hint);
|
|
187
|
-
};
|
|
188
|
-
this.renderTextContent = () => {
|
|
189
|
-
return (h("div", { class: {
|
|
190
|
-
'rich-text-editor-container': true,
|
|
191
|
-
'disabled': this.disabled,
|
|
192
|
-
'vega-hidden': this.sourceView,
|
|
193
|
-
}, style: { minHeight: `${this.rows * 24}px` }, onClick: this.richTextContentFocus, role: "textbox", tabIndex: !this.disabled ? -1 : 0, onKeyDown: createEnterKeyHandlerToTriggerClick(), ref: (node) => (this.richTextContainerRef = node) },
|
|
194
|
-
h("vega-rich-text-content", { ref: (ref) => (this.richTextContentRef = ref), content: this.value, extensions: this.extensions }),
|
|
195
|
-
this.renderCharacterCounter()));
|
|
196
|
-
};
|
|
197
|
-
this.renderCharacterCounter = () => {
|
|
198
|
-
return (h("div", { class: {
|
|
199
|
-
'text-editor-counter': true,
|
|
200
|
-
'counter-exceed-max-length': false,
|
|
201
|
-
}, style: { display: 'none' } },
|
|
202
|
-
h("span", null, "0"),
|
|
203
|
-
h("span", null, "/100")));
|
|
204
|
-
};
|
|
205
|
-
this.renderErrorMessage = () => {
|
|
206
|
-
return h("div", { class: "vega-error vega-hidden" });
|
|
207
|
-
};
|
|
208
|
-
this.richTextContentFocus = () => {
|
|
209
|
-
void this.richTextContentRef.vegaFocus();
|
|
210
|
-
};
|
|
211
|
-
this.renderSourceViewContent = () => {
|
|
212
|
-
if (!this.allowSourceEdit)
|
|
213
|
-
return;
|
|
214
|
-
const sourceViewValue = this.sourceView ? CodeFormatter$1.format(this.value.toHtml()) : '';
|
|
215
|
-
return (h("div", { class: {
|
|
216
|
-
'source-view-container': true,
|
|
217
|
-
'vega-hidden': !this.sourceView,
|
|
218
|
-
} },
|
|
219
|
-
h("vega-code-block", { ref: (ref) => (this.sourceCodeBlockRef = ref), disabled: this.disabled, value: { language: 'html', code: sourceViewValue } })));
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Component lifecycle - [componentDidRender]{@link VegaRichTextEditor.componentDidRender}
|
|
224
|
-
*/
|
|
225
|
-
componentDidRender() {
|
|
226
|
-
ChangeManager.notify(domNodeSubjectFactory.getSubject(this.host, VegaInternalComponentDidRender), {});
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Returns the HTMLElement reference of the rich text container.
|
|
230
|
-
*
|
|
231
|
-
* @returns {HTMLDivElement} An HTMLElement representing the rich text container is being returned.
|
|
232
|
-
*/
|
|
233
|
-
getRichTextContainerRef() {
|
|
234
|
-
return this.richTextContainerRef;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Returns the HTMLElement reference of the rich text content area.
|
|
238
|
-
*
|
|
239
|
-
* @returns {Nullable<HTMLVegaRichTextContentElement>} An HTMLVegaRichTextContentElement is being returned.
|
|
240
|
-
*/
|
|
241
|
-
getRichTextContentRef() {
|
|
242
|
-
return this.richTextContentRef;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Returns the HTMLElement reference of the rich text outermost layer.
|
|
246
|
-
*
|
|
247
|
-
* @returns {HTMLVegaFlexElement} An HTMLVegaFlexElement is being returned.
|
|
248
|
-
*/
|
|
249
|
-
getRichTextWrapperRef() {
|
|
250
|
-
return this.richTextWrapperRef;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Returns the rich text editor component editable element
|
|
254
|
-
*
|
|
255
|
-
* @returns {Nullable<HTMLDivElement>} The div element which has property contenteditable
|
|
256
|
-
*/
|
|
257
|
-
getRTEEditableElementRef() {
|
|
258
|
-
if (this.richTextContentRef && this.richTextContentRef.shadowRoot) {
|
|
259
|
-
return this.richTextContentRef.shadowRoot.querySelector('.rich-text-content');
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
getSourceCode() {
|
|
263
|
-
if (this.sourceCodeBlockRef) {
|
|
264
|
-
return this.sourceCodeBlockRef.value.code;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
render() {
|
|
268
|
-
return h(Host, null, this.renderRichTextEditor());
|
|
269
|
-
}
|
|
270
|
-
renderRichTextEditor() {
|
|
271
|
-
return (h("vega-flex", { direction: "col", gap: "0", ref: (flex) => (this.richTextWrapperRef = flex) },
|
|
272
|
-
this.renderLabel(),
|
|
273
|
-
this.hint && this.renderHintMessage(),
|
|
274
|
-
this.toolbarRenderer.render(),
|
|
275
|
-
this.renderContent(),
|
|
276
|
-
this.renderErrorMessage()));
|
|
277
|
-
}
|
|
278
|
-
renderLabel() {
|
|
279
|
-
return (this.label && (h("vega-field-label", { onClick: this.richTextContentFocus, isFieldRequired: this.required, disabled: this.disabled, label: this.label })));
|
|
280
|
-
}
|
|
281
|
-
renderContent() {
|
|
282
|
-
return (h(Fragment, null,
|
|
283
|
-
this.renderTextContent(),
|
|
284
|
-
this.renderSourceViewContent()));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
__decorate$w([
|
|
288
|
-
MapToComponentField()
|
|
289
|
-
], VegaRichTextEditorRenderer.prototype, "host", void 0);
|
|
290
|
-
__decorate$w([
|
|
291
|
-
MapToComponentField()
|
|
292
|
-
], VegaRichTextEditorRenderer.prototype, "toolbarRenderer", void 0);
|
|
293
|
-
__decorate$w([
|
|
294
|
-
MapToComponentField()
|
|
295
|
-
], VegaRichTextEditorRenderer.prototype, "label", void 0);
|
|
296
|
-
__decorate$w([
|
|
297
|
-
MapToComponentField()
|
|
298
|
-
], VegaRichTextEditorRenderer.prototype, "required", void 0);
|
|
299
|
-
__decorate$w([
|
|
300
|
-
MapToComponentField()
|
|
301
|
-
], VegaRichTextEditorRenderer.prototype, "hint", void 0);
|
|
302
|
-
__decorate$w([
|
|
303
|
-
MapToComponentField()
|
|
304
|
-
], VegaRichTextEditorRenderer.prototype, "disabled", void 0);
|
|
305
|
-
__decorate$w([
|
|
306
|
-
MapToComponentField()
|
|
307
|
-
], VegaRichTextEditorRenderer.prototype, "rows", void 0);
|
|
308
|
-
__decorate$w([
|
|
309
|
-
MapToComponentField()
|
|
310
|
-
], VegaRichTextEditorRenderer.prototype, "placeholder", void 0);
|
|
311
|
-
__decorate$w([
|
|
312
|
-
MapToComponentField()
|
|
313
|
-
], VegaRichTextEditorRenderer.prototype, "value", void 0);
|
|
314
|
-
__decorate$w([
|
|
315
|
-
MapToComponentField()
|
|
316
|
-
], VegaRichTextEditorRenderer.prototype, "sourceView", void 0);
|
|
317
|
-
__decorate$w([
|
|
318
|
-
MapToComponentField()
|
|
319
|
-
], VegaRichTextEditorRenderer.prototype, "toolbarItems", void 0);
|
|
320
|
-
__decorate$w([
|
|
321
|
-
MapToComponentField()
|
|
322
|
-
], VegaRichTextEditorRenderer.prototype, "sourceEditConfig", void 0);
|
|
323
|
-
__decorate$w([
|
|
324
|
-
MapToComponentField()
|
|
325
|
-
], VegaRichTextEditorRenderer.prototype, "allowSourceEdit", void 0);
|
|
326
|
-
__decorate$w([
|
|
327
|
-
MapToComponentField()
|
|
328
|
-
], VegaRichTextEditorRenderer.prototype, "extensions", void 0);
|
|
329
|
-
__decorate$w([
|
|
330
|
-
MapToComponentMethod('componentDidRender')
|
|
331
|
-
], VegaRichTextEditorRenderer.prototype, "componentDidRender", null);
|
|
332
|
-
|
|
333
|
-
var __decorate$v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
334
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
335
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
336
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
337
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
338
|
-
};
|
|
339
|
-
class ToolbarRenderer extends VegaSlimmer {
|
|
340
|
-
constructor() {
|
|
341
|
-
super(...arguments);
|
|
342
|
-
this.getToolbarBtnRenderer = (type) => {
|
|
343
|
-
switch (type) {
|
|
344
|
-
case 'clearStyle':
|
|
345
|
-
return this.clearStyleToolbarButtonSlimmer;
|
|
346
|
-
case 'bold':
|
|
347
|
-
return this.boldToolbarButtonSlimmer;
|
|
348
|
-
case 'textStyles':
|
|
349
|
-
return this.textStylesToolbarButtonSlimmer;
|
|
350
|
-
case 'italic':
|
|
351
|
-
return this.italicToolbarButtonSlimmer;
|
|
352
|
-
case 'underline':
|
|
353
|
-
return this.underlineToolbarButtonSlimmer;
|
|
354
|
-
case 'textColor':
|
|
355
|
-
return this.textColorToolbarButtonSlimmer;
|
|
356
|
-
case 'moreIndent':
|
|
357
|
-
return this.moreIndentToolbarButtonSlimmer;
|
|
358
|
-
case 'lessIndent':
|
|
359
|
-
return this.lessIndentToolbarButtonSlimmer;
|
|
360
|
-
case 'code':
|
|
361
|
-
return this.codeToolbarButtonSlimmer;
|
|
362
|
-
case 'strikethrough':
|
|
363
|
-
return this.strikethroughToolbarButtonSlimmer;
|
|
364
|
-
case 'link':
|
|
365
|
-
return this.linkToolbarButtonSlimmer;
|
|
366
|
-
case 'image':
|
|
367
|
-
return this.imageToolbarButtonSlimmer;
|
|
368
|
-
case 'bulletsNumbers':
|
|
369
|
-
return this.bulletsNumbersToolbarButtonSlimmer;
|
|
370
|
-
case 'horizontalAlignment':
|
|
371
|
-
return this.horizontalAlignmentToolbarButtonSlimmer;
|
|
372
|
-
case 'codeBlock':
|
|
373
|
-
return this.codeBlockToolbarButtonSlimmer;
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
render() {
|
|
378
|
-
const [renderedItems, totalVisibleCount] = this.renderToolbarItems();
|
|
379
|
-
return (h("vega-flex", { gap: "size-8", alignItems: "center", flexWrap: "wrap" },
|
|
380
|
-
this.allowSourceEdit && (h(Fragment, null,
|
|
381
|
-
h("div", { class: "toolbar-btn-group" }, this.sourceEditToolbarButtonSlimmer.render()),
|
|
382
|
-
this.toolbarItems.length > 0 && totalVisibleCount > 0 && this.renderVegaDivider())),
|
|
383
|
-
renderedItems));
|
|
384
|
-
}
|
|
385
|
-
renderVegaDivider() {
|
|
386
|
-
return (h("vega-box", { height: "size-32" },
|
|
387
|
-
h("vega-divider", { direction: "vertical" })));
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Renders the toolbar items based on the configured toolbar groups and items.
|
|
391
|
-
*
|
|
392
|
-
* @returns {[HTMLElement[], number]} A tuple containing the rendered toolbar items and the count of displayed items.
|
|
393
|
-
*/
|
|
394
|
-
renderToolbarItems() {
|
|
395
|
-
let totalVisibleCount = 0;
|
|
396
|
-
const renderedItems = this.toolbarItems.map((group) => {
|
|
397
|
-
let visibleCountPerGroup = 0;
|
|
398
|
-
const groupElement = group
|
|
399
|
-
.map((item) => {
|
|
400
|
-
const presetRenderer = this.getToolbarBtnRenderer(item);
|
|
401
|
-
const customRenderer = RTEDTORendererManager.getRTEToolbarButtonRenderer(item);
|
|
402
|
-
if (presetRenderer) {
|
|
403
|
-
if (!presetRenderer.isHidden()) {
|
|
404
|
-
totalVisibleCount++;
|
|
405
|
-
visibleCountPerGroup++;
|
|
406
|
-
}
|
|
407
|
-
return presetRenderer.render();
|
|
408
|
-
}
|
|
409
|
-
else if (customRenderer) {
|
|
410
|
-
const renderContext = {
|
|
411
|
-
sourceEditMode: this.sourceView,
|
|
412
|
-
host: this.host,
|
|
413
|
-
rteRange: this.selectionController.getCurrentRange(),
|
|
414
|
-
};
|
|
415
|
-
if (!customRenderer.isHidden(renderContext)) {
|
|
416
|
-
totalVisibleCount++;
|
|
417
|
-
visibleCountPerGroup++;
|
|
418
|
-
}
|
|
419
|
-
return customRenderer.render(h, renderContext);
|
|
420
|
-
}
|
|
421
|
-
return null;
|
|
422
|
-
})
|
|
423
|
-
.filter(isNonNullable);
|
|
424
|
-
return (h("div", { class: { 'toolbar-btn-group': true, 'vega-hidden': visibleCountPerGroup < 1 } }, groupElement));
|
|
425
|
-
});
|
|
426
|
-
return [renderedItems, totalVisibleCount];
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
__decorate$v([
|
|
430
|
-
MapToComponentField()
|
|
431
|
-
], ToolbarRenderer.prototype, "toolbarItems", void 0);
|
|
432
|
-
__decorate$v([
|
|
433
|
-
MapToComponentField()
|
|
434
|
-
], ToolbarRenderer.prototype, "allowSourceEdit", void 0);
|
|
435
|
-
__decorate$v([
|
|
436
|
-
MapToComponentField()
|
|
437
|
-
], ToolbarRenderer.prototype, "host", void 0);
|
|
438
|
-
__decorate$v([
|
|
439
|
-
MapToComponentField()
|
|
440
|
-
], ToolbarRenderer.prototype, "clearStyleToolbarButtonSlimmer", void 0);
|
|
441
|
-
__decorate$v([
|
|
442
|
-
MapToComponentField()
|
|
443
|
-
], ToolbarRenderer.prototype, "boldToolbarButtonSlimmer", void 0);
|
|
444
|
-
__decorate$v([
|
|
445
|
-
MapToComponentField()
|
|
446
|
-
], ToolbarRenderer.prototype, "textStylesToolbarButtonSlimmer", void 0);
|
|
447
|
-
__decorate$v([
|
|
448
|
-
MapToComponentField()
|
|
449
|
-
], ToolbarRenderer.prototype, "italicToolbarButtonSlimmer", void 0);
|
|
450
|
-
__decorate$v([
|
|
451
|
-
MapToComponentField()
|
|
452
|
-
], ToolbarRenderer.prototype, "underlineToolbarButtonSlimmer", void 0);
|
|
453
|
-
__decorate$v([
|
|
454
|
-
MapToComponentField()
|
|
455
|
-
], ToolbarRenderer.prototype, "textColorToolbarButtonSlimmer", void 0);
|
|
456
|
-
__decorate$v([
|
|
457
|
-
MapToComponentField()
|
|
458
|
-
], ToolbarRenderer.prototype, "bulletsNumbersToolbarButtonSlimmer", void 0);
|
|
459
|
-
__decorate$v([
|
|
460
|
-
MapToComponentField()
|
|
461
|
-
], ToolbarRenderer.prototype, "horizontalAlignmentToolbarButtonSlimmer", void 0);
|
|
462
|
-
__decorate$v([
|
|
463
|
-
MapToComponentField()
|
|
464
|
-
], ToolbarRenderer.prototype, "strikethroughToolbarButtonSlimmer", void 0);
|
|
465
|
-
__decorate$v([
|
|
466
|
-
MapToComponentField()
|
|
467
|
-
], ToolbarRenderer.prototype, "imageToolbarButtonSlimmer", void 0);
|
|
468
|
-
__decorate$v([
|
|
469
|
-
MapToComponentField()
|
|
470
|
-
], ToolbarRenderer.prototype, "moreIndentToolbarButtonSlimmer", void 0);
|
|
471
|
-
__decorate$v([
|
|
472
|
-
MapToComponentField()
|
|
473
|
-
], ToolbarRenderer.prototype, "lessIndentToolbarButtonSlimmer", void 0);
|
|
474
|
-
__decorate$v([
|
|
475
|
-
MapToComponentField()
|
|
476
|
-
], ToolbarRenderer.prototype, "codeToolbarButtonSlimmer", void 0);
|
|
477
|
-
__decorate$v([
|
|
478
|
-
MapToComponentField()
|
|
479
|
-
], ToolbarRenderer.prototype, "linkToolbarButtonSlimmer", void 0);
|
|
480
|
-
__decorate$v([
|
|
481
|
-
MapToComponentField()
|
|
482
|
-
], ToolbarRenderer.prototype, "codeBlockToolbarButtonSlimmer", void 0);
|
|
483
|
-
__decorate$v([
|
|
484
|
-
MapToComponentField()
|
|
485
|
-
], ToolbarRenderer.prototype, "sourceEditToolbarButtonSlimmer", void 0);
|
|
486
|
-
__decorate$v([
|
|
487
|
-
MapToComponentField()
|
|
488
|
-
], ToolbarRenderer.prototype, "selectionController", void 0);
|
|
489
|
-
__decorate$v([
|
|
490
|
-
MapToComponentField()
|
|
491
|
-
], ToolbarRenderer.prototype, "sourceView", void 0);
|
|
492
|
-
|
|
493
|
-
const bold = {
|
|
494
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32H80 96 224c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128H96 80 32c-17.7 0-32-14.3-32-32s14.3-32 32-32H48V256 96H32C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64H112V224H224zM112 288V416H256c35.3 0 64-28.7 64-64s-28.7-64-64-64H224 112z"/></svg>`,
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
498
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
499
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
500
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
501
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
502
|
-
};
|
|
503
|
-
class BoldToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
504
|
-
constructor() {
|
|
505
|
-
super({
|
|
506
|
-
icon: 'bold',
|
|
507
|
-
tooltip: {
|
|
508
|
-
text: 'Bold',
|
|
509
|
-
},
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
onClick() {
|
|
513
|
-
const bold = this.isSelected();
|
|
514
|
-
this.selectionController
|
|
515
|
-
.getSelectedNodes()
|
|
516
|
-
.filter((node) => node instanceof RTETextNode)
|
|
517
|
-
.forEach((node) => node.apply(new BoldAnnotationAction(!bold)));
|
|
518
|
-
}
|
|
519
|
-
isSelected() {
|
|
520
|
-
const selectedNodes = this.selectionController
|
|
521
|
-
.getSelectedNodes()
|
|
522
|
-
.filter((node) => node instanceof RTETextNode);
|
|
523
|
-
return (selectedNodes.length > 0 &&
|
|
524
|
-
selectedNodes.every((node) => { var _a; return (_a = node.getAnnotationByType(NodeAnnotationTypeEnum.BOLD)) === null || _a === void 0 ? void 0 : _a.bold; }));
|
|
525
|
-
}
|
|
526
|
-
isDisabled() {
|
|
527
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
528
|
-
return (super.isDisabled() ||
|
|
529
|
-
selectedNodes.some((node) => {
|
|
530
|
-
var _a;
|
|
531
|
-
return ((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
532
|
-
this.shouldDisabledToolbar(node, BoldAnnotationAction.name);
|
|
533
|
-
}));
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
(() => {
|
|
537
|
-
VegaInternalIconManager.register({ bold });
|
|
538
|
-
})();
|
|
539
|
-
__decorate$u([
|
|
540
|
-
MapToComponentField()
|
|
541
|
-
], BoldToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
542
|
-
|
|
543
|
-
const italic = {
|
|
544
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M128 64c0-17.7 14.3-32 32-32H352c17.7 0 32 14.3 32 32s-14.3 32-32 32H293.3L160 416h64c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H90.7L224 96H160c-17.7 0-32-14.3-32-32z"/></svg>`,
|
|
545
|
-
};
|
|
546
|
-
|
|
547
|
-
var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
548
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
549
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
550
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
551
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
552
|
-
};
|
|
553
|
-
class ItalicToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
554
|
-
constructor() {
|
|
555
|
-
super({
|
|
556
|
-
icon: 'italic',
|
|
557
|
-
tooltip: { text: 'Italic' },
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
isSelected() {
|
|
561
|
-
const selectedNodes = this.selectionController
|
|
562
|
-
.getSelectedNodes()
|
|
563
|
-
.filter((node) => node instanceof RTETextNode);
|
|
564
|
-
return (selectedNodes.length > 0 &&
|
|
565
|
-
selectedNodes.every((node) => { var _a; return (_a = node.getAnnotationByType(NodeAnnotationTypeEnum.ITALIC)) === null || _a === void 0 ? void 0 : _a.italic; }));
|
|
566
|
-
}
|
|
567
|
-
onClick() {
|
|
568
|
-
const italic = this.isSelected();
|
|
569
|
-
this.selectionController
|
|
570
|
-
.getSelectedNodes()
|
|
571
|
-
.filter((node) => node instanceof RTETextNode)
|
|
572
|
-
.forEach((node) => node.apply(new ItalicAnnotationAction(!italic)));
|
|
573
|
-
}
|
|
574
|
-
isDisabled() {
|
|
575
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
576
|
-
return (super.isDisabled() ||
|
|
577
|
-
selectedNodes.some((node) => {
|
|
578
|
-
var _a;
|
|
579
|
-
return ((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
580
|
-
this.shouldDisabledToolbar(node, ItalicAnnotationAction.name);
|
|
581
|
-
}));
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
(() => {
|
|
585
|
-
VegaInternalIconManager.register({ italic });
|
|
586
|
-
})();
|
|
587
|
-
__decorate$t([
|
|
588
|
-
MapToComponentField()
|
|
589
|
-
], ItalicToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
590
|
-
|
|
591
|
-
const underline = {
|
|
592
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M16 64c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H128V224c0 53 43 96 96 96s96-43 96-96V96H304c-17.7 0-32-14.3-32-32s14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H384V224c0 88.4-71.6 160-160 160s-160-71.6-160-160V96H48C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32z"/></svg>`,
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
596
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
597
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
598
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
599
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
600
|
-
};
|
|
601
|
-
class UnderlineToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
602
|
-
constructor() {
|
|
603
|
-
super({
|
|
604
|
-
icon: 'underline',
|
|
605
|
-
tooltip: { text: 'Underline' },
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
isSelected() {
|
|
609
|
-
const selectedNodes = this.selectionController
|
|
610
|
-
.getSelectedNodes()
|
|
611
|
-
.filter((node) => node instanceof RTETextNode);
|
|
612
|
-
return (selectedNodes.length > 0 &&
|
|
613
|
-
selectedNodes.every((node) => {
|
|
614
|
-
var _a;
|
|
615
|
-
return (_a = node.getAnnotationByType(NodeAnnotationTypeEnum.UNDERLINE)) === null || _a === void 0 ? void 0 : _a.underline;
|
|
616
|
-
}));
|
|
617
|
-
}
|
|
618
|
-
onClick() {
|
|
619
|
-
const selected = this.isSelected();
|
|
620
|
-
this.selectionController
|
|
621
|
-
.getSelectedNodes()
|
|
622
|
-
.filter((node) => node instanceof RTETextNode)
|
|
623
|
-
.forEach((node) => node.apply(new UnderlineAnnotationAction(!selected)));
|
|
624
|
-
}
|
|
625
|
-
isDisabled() {
|
|
626
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
627
|
-
return (super.isDisabled() ||
|
|
628
|
-
selectedNodes.some((node) => {
|
|
629
|
-
var _a;
|
|
630
|
-
return ((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
631
|
-
this.shouldDisabledToolbar(node, UnderlineAnnotationAction.name);
|
|
632
|
-
}));
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
(() => {
|
|
636
|
-
VegaInternalIconManager.register({ underline });
|
|
637
|
-
})();
|
|
638
|
-
__decorate$s([
|
|
639
|
-
MapToComponentField()
|
|
640
|
-
], UnderlineToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
641
|
-
|
|
642
|
-
const textSize = {
|
|
643
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M64 128V96h96l0 320H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H256c17.7 0 32-14.3 32-32s-14.3-32-32-32H224l0-320h96v32c0 17.7 14.3 32 32 32s32-14.3 32-32V80c0-26.5-21.5-48-48-48H192 48C21.5 32 0 53.5 0 80v48c0 17.7 14.3 32 32 32s32-14.3 32-32zM384 304V288h64l0 128H432c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H512l0-128h64v16c0 17.7 14.3 32 32 32s32-14.3 32-32V272c0-26.5-21.5-48-48-48H368c-26.5 0-48 21.5-48 48v32c0 17.7 14.3 32 32 32s32-14.3 32-32z"/></svg>`,
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
647
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
648
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
649
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
650
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
651
|
-
};
|
|
652
|
-
class TextStylesToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
653
|
-
constructor() {
|
|
654
|
-
super({
|
|
655
|
-
icon: 'text-size',
|
|
656
|
-
tooltip: { text: 'Text Styles' },
|
|
657
|
-
});
|
|
658
|
-
this.handleDropdownItemClick = (payload) => {
|
|
659
|
-
const selectedType = payload.detail;
|
|
660
|
-
const boldByDefault = TextStylesToolbarButtonSlimmer.items.find((item) => item.key === selectedType).bold;
|
|
661
|
-
const selectedTextBlocks = this.selectionController
|
|
662
|
-
.getSelectedBlocks()
|
|
663
|
-
.filter((block) => block instanceof RTETextBlock);
|
|
664
|
-
if (selectedTextBlocks.length > 0) {
|
|
665
|
-
selectedTextBlocks.forEach((item) => {
|
|
666
|
-
item.apply(new TextStyleAnnotationAction(selectedType, boldByDefault));
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
else {
|
|
670
|
-
void this.focusController.focusOnLastTextNode({ newLine: true }).then(() => {
|
|
671
|
-
this.selectionController
|
|
672
|
-
.getSelectedBlocks()
|
|
673
|
-
.filter((node) => node instanceof RTETextBlock)
|
|
674
|
-
.forEach((item) => {
|
|
675
|
-
item.apply(new TextStyleAnnotationAction(selectedType, boldByDefault));
|
|
676
|
-
});
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
renderBtnWrapper(renderBtn) {
|
|
682
|
-
return (h("vega-dropdown", { selectType: "single", trigger: "click", alignment: "center", selectedSourceKey: this.getSelectedSourceKey(), ref: (ref) => {
|
|
683
|
-
this.addDropdownObserver(ref);
|
|
684
|
-
} },
|
|
685
|
-
renderBtn({ showArrowIcon: true }),
|
|
686
|
-
h("div", Object.assign({ slot: "items" }, super.preventLostFocus()), this.renderDropdownContent())));
|
|
687
|
-
}
|
|
688
|
-
renderDropdownContent() {
|
|
689
|
-
return (h(Fragment, null, TextStylesToolbarButtonSlimmer.items.map((item) => {
|
|
690
|
-
const textStyleAnnotation = new TextStyleAnnotation(item.key);
|
|
691
|
-
const boldAnnotation = new BoldAnnotation(item.bold);
|
|
692
|
-
return (h("vega-dropdown-item", { key: item.key, itemKey: item.key },
|
|
693
|
-
h("vega-box", { padding: { right: 'size-20' } },
|
|
694
|
-
h("div", { style: Object.assign(Object.assign({}, textStyleAnnotation.renderStyle({ standalone: true })), boldAnnotation.renderStyle({ standalone: true })) }, this.translationSlimmer.t(item.label)))));
|
|
695
|
-
})));
|
|
696
|
-
}
|
|
697
|
-
isSelected() {
|
|
698
|
-
return false;
|
|
699
|
-
}
|
|
700
|
-
isDisabled() {
|
|
701
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
702
|
-
return (super.isDisabled() ||
|
|
703
|
-
selectedBlocks.some((node) => this.shouldDisabledToolbar(node, TextStyleAnnotationAction.name)));
|
|
704
|
-
}
|
|
705
|
-
addDropdownObserver(dropdownRef) {
|
|
706
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, VegaDropdownClick, this.handleDropdownItemClick);
|
|
707
|
-
}
|
|
708
|
-
getSelectedSourceKey() {
|
|
709
|
-
var _a;
|
|
710
|
-
const currentSelectedBlocks = this.selectionController
|
|
711
|
-
.getSelectedBlocks()
|
|
712
|
-
.filter((block) => block instanceof RTETextBlock);
|
|
713
|
-
const isSameType = currentSelectedBlocks.length > 0 &&
|
|
714
|
-
currentSelectedBlocks.every((block) => block.type === currentSelectedBlocks[0].type);
|
|
715
|
-
if (isSameType) {
|
|
716
|
-
const blockAnnotation = currentSelectedBlocks[0].getAnnotationByType(BlockAnnotationTypeEnum.TEXT_STYLE);
|
|
717
|
-
return (_a = blockAnnotation === null || blockAnnotation === void 0 ? void 0 : blockAnnotation.textStyle) !== null && _a !== void 0 ? _a : '';
|
|
718
|
-
}
|
|
719
|
-
return '';
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
(() => {
|
|
723
|
-
VegaInternalIconManager.register({
|
|
724
|
-
'text-size': textSize,
|
|
725
|
-
});
|
|
726
|
-
})();
|
|
727
|
-
TextStylesToolbarButtonSlimmer.items = [
|
|
728
|
-
{
|
|
729
|
-
key: 'title',
|
|
730
|
-
label: 'Title',
|
|
731
|
-
bold: true,
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
key: 'subtitle',
|
|
735
|
-
label: 'Subtitle',
|
|
736
|
-
},
|
|
737
|
-
{
|
|
738
|
-
key: 'heading-1',
|
|
739
|
-
label: 'Heading 1',
|
|
740
|
-
bold: true,
|
|
741
|
-
},
|
|
742
|
-
{
|
|
743
|
-
key: 'heading-2',
|
|
744
|
-
label: 'Heading 2',
|
|
745
|
-
bold: true,
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
key: 'heading-3',
|
|
749
|
-
label: 'Heading 3',
|
|
750
|
-
bold: true,
|
|
751
|
-
},
|
|
752
|
-
{
|
|
753
|
-
key: 'paragraph',
|
|
754
|
-
label: 'Paragraph',
|
|
755
|
-
},
|
|
756
|
-
];
|
|
757
|
-
__decorate$r([
|
|
758
|
-
MapToComponentField()
|
|
759
|
-
], TextStylesToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
760
|
-
__decorate$r([
|
|
761
|
-
MapToComponentField()
|
|
762
|
-
], TextStylesToolbarButtonSlimmer.prototype, "focusController", void 0);
|
|
763
|
-
|
|
764
|
-
const TextSlash = {
|
|
765
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96H503L497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32H376.1h-.3H204.5c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96H333.7L301.3 210.8l-94.5-74.1zM243.3 416H192c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H309.8l17.6-62.1L272.9 311 243.3 416z"/></svg>`,
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
769
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
770
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
771
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
772
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
773
|
-
};
|
|
774
|
-
class ClearStyleToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
775
|
-
constructor() {
|
|
776
|
-
super({
|
|
777
|
-
icon: 'text-slash',
|
|
778
|
-
tooltip: {
|
|
779
|
-
text: 'Clear Style',
|
|
780
|
-
},
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
isSelected() {
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
onClick() {
|
|
787
|
-
this.selectionController
|
|
788
|
-
.getSelectedNodes()
|
|
789
|
-
.filter((node) => node instanceof RTETextNode)
|
|
790
|
-
.forEach((node) => {
|
|
791
|
-
node.apply(new ClearFormattingAnnotationAction());
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
isDisabled() {
|
|
795
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
796
|
-
return (super.isDisabled() ||
|
|
797
|
-
selectedNodes.some((node) => this.shouldDisabledToolbar(node, ClearFormattingAnnotationAction.name)));
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
(() => {
|
|
801
|
-
VegaInternalIconManager.register({
|
|
802
|
-
'text-slash': TextSlash,
|
|
803
|
-
});
|
|
804
|
-
})();
|
|
805
|
-
__decorate$q([
|
|
806
|
-
MapToComponentField()
|
|
807
|
-
], ClearStyleToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
808
|
-
|
|
809
|
-
const codeSimple = {
|
|
810
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6zm146.7 0L498.7 256 361.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3z"/></svg>`,
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
var __decorate$p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
814
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
815
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
816
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
817
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
818
|
-
};
|
|
819
|
-
class CodeToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
820
|
-
constructor() {
|
|
821
|
-
super({
|
|
822
|
-
icon: 'code-simple',
|
|
823
|
-
tooltip: { text: 'Code' },
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
onClick() {
|
|
827
|
-
const selected = this.isSelected();
|
|
828
|
-
this.selectionController
|
|
829
|
-
.getSelectedNodes()
|
|
830
|
-
.filter((node) => node instanceof RTETextNode)
|
|
831
|
-
.forEach((node) => node.apply(new CodeAnnotationAction(!selected)));
|
|
832
|
-
}
|
|
833
|
-
isSelected() {
|
|
834
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
835
|
-
return (selectedNodes.length > 0 &&
|
|
836
|
-
selectedNodes
|
|
837
|
-
.filter((node) => node instanceof RTETextNode)
|
|
838
|
-
.map((node) => node.getAnnotationByType(NodeAnnotationTypeEnum.CODE))
|
|
839
|
-
.every((annotation) => annotation && annotation.code));
|
|
840
|
-
}
|
|
841
|
-
isDisabled() {
|
|
842
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
843
|
-
return (super.isDisabled() ||
|
|
844
|
-
selectedNodes.some((node) => node.getAnnotationByType(NodeAnnotationTypeEnum.LINK) ||
|
|
845
|
-
this.shouldDisabledToolbar(node, CodeAnnotationAction.name)));
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
(() => {
|
|
849
|
-
VegaInternalIconManager.register({ 'code-simple': codeSimple });
|
|
850
|
-
})();
|
|
851
|
-
__decorate$p([
|
|
852
|
-
MapToComponentField()
|
|
853
|
-
], CodeToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
854
|
-
|
|
855
|
-
const strikethrough = {
|
|
856
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path fill="currentColor" d="M332.2 319.9c17.22 12.17 22.33 26.51 18.61 48.21c-3.031 17.59-10.88 29.34-24.72 36.99c-35.44 19.75-108.5 11.96-186-19.68c-16.34-6.686-35.03 1.156-41.72 17.53s1.188 35.05 17.53 41.71c31.75 12.93 95.69 35.37 157.6 35.37c29.62 0 58.81-5.156 83.72-18.96c30.81-17.09 50.44-45.46 56.72-82.11c3.998-23.27 2.168-42.58-3.488-59.05H332.2zM488 239.9l-176.5-.0309c-15.85-5.613-31.83-10.34-46.7-14.62c-85.47-24.62-110.9-39.05-103.7-81.33c2.5-14.53 10.16-25.96 22.72-34.03c20.47-13.15 64.06-23.84 155.4 .3438c17.09 4.531 34.59-5.654 39.13-22.74c4.531-17.09-5.656-34.59-22.75-39.12c-91.31-24.18-160.7-21.62-206.3 7.654C121.8 73.72 103.6 101.1 98.09 133.1C89.26 184.5 107.9 217.3 137.2 239.9L24 239.9c-13.25 0-24 10.75-24 23.1c0 13.25 10.75 23.1 24 23.1h464c13.25 0 24-10.75 24-23.1C512 250.7 501.3 239.9 488 239.9z"/></svg>`,
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
var __decorate$o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
860
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
861
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
862
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
863
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
864
|
-
};
|
|
865
|
-
class StrikethroughToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
866
|
-
constructor() {
|
|
867
|
-
super({
|
|
868
|
-
icon: 'strikethrough',
|
|
869
|
-
tooltip: { text: 'Strikethrough' },
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
isSelected() {
|
|
873
|
-
const selectedNodes = this.selectionController
|
|
874
|
-
.getSelectedNodes()
|
|
875
|
-
.filter((node) => node instanceof RTETextNode);
|
|
876
|
-
return (selectedNodes.length > 0 &&
|
|
877
|
-
selectedNodes.every((node) => {
|
|
878
|
-
var _a;
|
|
879
|
-
return (_a = node.getAnnotationByType(NodeAnnotationTypeEnum.STRIKETHROUGH)) === null || _a === void 0 ? void 0 : _a.strikethrough;
|
|
880
|
-
}));
|
|
881
|
-
}
|
|
882
|
-
onClick() {
|
|
883
|
-
const selected = this.isSelected();
|
|
884
|
-
this.selectionController
|
|
885
|
-
.getSelectedNodes()
|
|
886
|
-
.filter((node) => node instanceof RTETextNode)
|
|
887
|
-
.forEach((node) => node.apply(new StrikethroughAnnotationAction(!selected)));
|
|
888
|
-
}
|
|
889
|
-
isDisabled() {
|
|
890
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
891
|
-
return (super.isDisabled() ||
|
|
892
|
-
selectedNodes.some((node) => {
|
|
893
|
-
var _a;
|
|
894
|
-
return ((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
895
|
-
this.shouldDisabledToolbar(node, StrikethroughAnnotationAction.name);
|
|
896
|
-
}));
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
(() => {
|
|
900
|
-
VegaInternalIconManager.register({ strikethrough });
|
|
901
|
-
})();
|
|
902
|
-
__decorate$o([
|
|
903
|
-
MapToComponentField()
|
|
904
|
-
], StrikethroughToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
905
|
-
|
|
906
|
-
const link = {
|
|
907
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M562.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L405.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C189.5 251.2 196 330 246 380c56.5 56.5 148 56.5 204.5 0L562.8 267.7zM43.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C57 372 57 321 88.5 289.5L200.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C416.5 260.8 410 182 360 132c-56.5-56.5-148-56.5-204.5 0L43.2 244.3z"/></svg>`,
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
911
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
912
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
913
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
914
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
915
|
-
};
|
|
916
|
-
class LinkToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
917
|
-
constructor() {
|
|
918
|
-
super({
|
|
919
|
-
icon: 'link',
|
|
920
|
-
tooltip: {
|
|
921
|
-
text: 'Link',
|
|
922
|
-
},
|
|
923
|
-
});
|
|
924
|
-
this.handleLinkEditorChange = ({ detail, }) => {
|
|
925
|
-
switch (detail.action) {
|
|
926
|
-
case 'link': {
|
|
927
|
-
const { url, text } = detail.payload;
|
|
928
|
-
const textChanged = text !== this.currentSelectedText;
|
|
929
|
-
const groupKey = generateUUID();
|
|
930
|
-
this.currentSelectedNodes.forEach((node) => {
|
|
931
|
-
node.apply(new SelectionChangeAction(this.currentRange)).apply(new LinkAnnotationAction({
|
|
932
|
-
link: { href: url, groupKey: groupKey },
|
|
933
|
-
newText: textChanged ? text : undefined,
|
|
934
|
-
needMergeNode: textChanged && this.currentSelectedNodes.length > 1,
|
|
935
|
-
type: 'link',
|
|
936
|
-
}));
|
|
937
|
-
});
|
|
938
|
-
return;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
}
|
|
943
|
-
renderBtnWrapper(renderBtn) {
|
|
944
|
-
return (h("div", { class: "toolbar-btn-link-wrapper", ref: (ref) => (this.linkBtnWrapperRef = ref) },
|
|
945
|
-
renderBtn(),
|
|
946
|
-
h("vega-rich-text-link-editor", { resetStatusAfterHide: false, status: "linkEdit", ref: (ref) => {
|
|
947
|
-
if (ref) {
|
|
948
|
-
this.linkEditorRef = ref;
|
|
949
|
-
}
|
|
950
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, this.handleLinkEditorChange);
|
|
951
|
-
} })));
|
|
952
|
-
}
|
|
953
|
-
isSelected() {
|
|
954
|
-
return false;
|
|
955
|
-
}
|
|
956
|
-
isDisabled() {
|
|
957
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
958
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
959
|
-
return (super.isDisabled() ||
|
|
960
|
-
selectedBlocks.length > 1 ||
|
|
961
|
-
selectedNodes.some((node) => {
|
|
962
|
-
var _a;
|
|
963
|
-
return this.shouldDisabledToolbar(node, LinkAnnotationAction.name) ||
|
|
964
|
-
node.getAnnotationByType(NodeAnnotationTypeEnum.LINK) ||
|
|
965
|
-
((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code);
|
|
966
|
-
}));
|
|
967
|
-
}
|
|
968
|
-
onClick() {
|
|
969
|
-
this.currentRange = this.selectionController.getCurrentRange().toNativeRange();
|
|
970
|
-
this.currentSelectedNodes = this.selectionController.getSelectedNodes();
|
|
971
|
-
if (this.currentRange) {
|
|
972
|
-
this.currentSelectedText = this.currentRange.toString();
|
|
973
|
-
if (this.currentSelectedNodes.length > 0) {
|
|
974
|
-
this.linkEditorRef.record = {
|
|
975
|
-
text: this.currentSelectedText,
|
|
976
|
-
url: '',
|
|
977
|
-
};
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
// Set target prop and call show method at the first time to make sure showing later than overrides method call focusController.focusOnLastTextNode()
|
|
981
|
-
// Element appender will control the show and hide logic except for the first time.
|
|
982
|
-
if (!this.linkEditorRef.target) {
|
|
983
|
-
this.linkEditorRef.target = this.linkBtnWrapperRef;
|
|
984
|
-
void waitForComponentDidRender(this.linkEditorRef).then(() => {
|
|
985
|
-
void this.linkEditorRef.show();
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
(() => {
|
|
991
|
-
VegaInternalIconManager.register({ link: link });
|
|
992
|
-
})();
|
|
993
|
-
__decorate$n([
|
|
994
|
-
MapToComponentField()
|
|
995
|
-
], LinkToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
996
|
-
|
|
997
|
-
const indent = {
|
|
998
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M0 64C0 46.3 14.3 32 32 32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32zm32 96H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3V176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"/></svg>`,
|
|
999
|
-
};
|
|
1000
|
-
|
|
1001
|
-
var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1002
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1003
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1004
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1005
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1006
|
-
};
|
|
1007
|
-
class MoreIndentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1008
|
-
constructor() {
|
|
1009
|
-
super({
|
|
1010
|
-
icon: 'indent',
|
|
1011
|
-
tooltip: {
|
|
1012
|
-
text: 'More Indent',
|
|
1013
|
-
},
|
|
1014
|
-
});
|
|
1015
|
-
}
|
|
1016
|
-
isSelected() {
|
|
1017
|
-
return false;
|
|
1018
|
-
}
|
|
1019
|
-
isDisabled() {
|
|
1020
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1021
|
-
return (super.isDisabled() ||
|
|
1022
|
-
selectedBlocks.some((node) => this.shouldDisabledToolbar(node, IndentAnnotationAction.name)));
|
|
1023
|
-
}
|
|
1024
|
-
onClick() {
|
|
1025
|
-
this.selectionController.getSelectedBlocks().forEach((item) => {
|
|
1026
|
-
var _a, _b;
|
|
1027
|
-
const indent = (_b = (_a = item.getAnnotationByType(BlockAnnotationTypeEnum.INDENT)) === null || _a === void 0 ? void 0 : _a.indent) !== null && _b !== void 0 ? _b : 0;
|
|
1028
|
-
item.apply(new IndentAnnotationAction(indent + 1));
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
(() => {
|
|
1033
|
-
VegaInternalIconManager.register({ indent: indent });
|
|
1034
|
-
})();
|
|
1035
|
-
__decorate$m([
|
|
1036
|
-
MapToComponentField()
|
|
1037
|
-
], MoreIndentToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1038
|
-
|
|
1039
|
-
const outdent = {
|
|
1040
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M6 64C6 46.3 20.3 32 38 32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38C20.3 96 6 81.7 6 64zM198 192c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32zm32 96H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H230c-17.7 0-32-14.3-32-32s14.3-32 32-32zM6 448c0-17.7 14.3-32 32-32H422c17.7 0 32 14.3 32 32s-14.3 32-32 32H38c-17.7 0-32-14.3-32-32zm.2-179.4c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6V335.3c0 13.3-15.3 20.8-25.8 12.6L6.2 268.6z"/></svg>`,
|
|
1041
|
-
};
|
|
1042
|
-
|
|
1043
|
-
var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1044
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1045
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1046
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1047
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1048
|
-
};
|
|
1049
|
-
class LessIndentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1050
|
-
constructor() {
|
|
1051
|
-
super({
|
|
1052
|
-
icon: 'outdent',
|
|
1053
|
-
tooltip: {
|
|
1054
|
-
text: 'Less Indent',
|
|
1055
|
-
},
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
isSelected() {
|
|
1059
|
-
return false;
|
|
1060
|
-
}
|
|
1061
|
-
isDisabled() {
|
|
1062
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1063
|
-
return (super.isDisabled() ||
|
|
1064
|
-
selectedBlocks.some((node) => this.shouldDisabledToolbar(node, IndentAnnotationAction.name)));
|
|
1065
|
-
}
|
|
1066
|
-
onClick() {
|
|
1067
|
-
this.selectionController.getSelectedBlocks().forEach((item) => {
|
|
1068
|
-
var _a, _b;
|
|
1069
|
-
const indent = (_b = (_a = item.getAnnotationByType(BlockAnnotationTypeEnum.INDENT)) === null || _a === void 0 ? void 0 : _a.indent) !== null && _b !== void 0 ? _b : 0;
|
|
1070
|
-
const newIndent = indent > 1 ? indent - 1 : 0;
|
|
1071
|
-
item.apply(new IndentAnnotationAction(newIndent));
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
(() => {
|
|
1076
|
-
VegaInternalIconManager.register({ outdent: outdent });
|
|
1077
|
-
})();
|
|
1078
|
-
__decorate$l([
|
|
1079
|
-
MapToComponentField()
|
|
1080
|
-
], LessIndentToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1081
|
-
|
|
1082
|
-
const image = {
|
|
1083
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>`,
|
|
1084
|
-
};
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Update the image node property url after the image uploaded.
|
|
1088
|
-
*
|
|
1089
|
-
* @example currentImageNode.apply(new ImageUpdateUrlAction(url))
|
|
1090
|
-
*/
|
|
1091
|
-
class ImageUpdateUrlAction extends ModifyContentAction {
|
|
1092
|
-
constructor(newUrl) {
|
|
1093
|
-
super();
|
|
1094
|
-
this.type = ModifyContentActionType.UPDATE_IMAGE_NODE_URL;
|
|
1095
|
-
this.url = newUrl;
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1100
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1101
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1102
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1103
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1104
|
-
};
|
|
1105
|
-
class ImageToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1106
|
-
constructor() {
|
|
1107
|
-
super({
|
|
1108
|
-
icon: 'image',
|
|
1109
|
-
tooltip: { text: 'Image' },
|
|
1110
|
-
});
|
|
1111
|
-
this.onClick = () => {
|
|
1112
|
-
this.inputElementRef.click();
|
|
1113
|
-
};
|
|
1114
|
-
/**
|
|
1115
|
-
* The below method is e2e-test covered in
|
|
1116
|
-
* @see{module:should-update-url-properly-when-upload-images}
|
|
1117
|
-
*/
|
|
1118
|
-
/* istanbul ignore next */
|
|
1119
|
-
this.fileInputChange = (e) => {
|
|
1120
|
-
e.stopPropagation();
|
|
1121
|
-
const input = e.target;
|
|
1122
|
-
if (!input.files.length) {
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
const node = this.insertImageController.insertImageToCaretPosition(URL.createObjectURL(input.files[0]));
|
|
1126
|
-
if (!this.updateNodeURLMap) {
|
|
1127
|
-
this.updateNodeURLMap = new Map();
|
|
1128
|
-
}
|
|
1129
|
-
this.updateNodeURLMap.set(node, (url) => {
|
|
1130
|
-
node.apply(new ImageUpdateUrlAction(url));
|
|
1131
|
-
});
|
|
1132
|
-
const payload = {
|
|
1133
|
-
file: input.files[0],
|
|
1134
|
-
sendBackUploadedURLCallback: this.updateNodeURLMap.get(node),
|
|
1135
|
-
};
|
|
1136
|
-
this.imageInsertedEventEmitter.emit(payload);
|
|
1137
|
-
input.value = '';
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
renderBtnWrapper(renderBtn) {
|
|
1141
|
-
return (h("vega-box", null,
|
|
1142
|
-
renderBtn({ showArrowIcon: false }),
|
|
1143
|
-
h("input", { type: "file", style: { display: 'none' }, ref: (node) => (this.inputElementRef = node), accept: "image/*", onChange: this.fileInputChange })));
|
|
1144
|
-
}
|
|
1145
|
-
isSelected() {
|
|
1146
|
-
return false;
|
|
1147
|
-
}
|
|
1148
|
-
isDisabled() {
|
|
1149
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1150
|
-
const selectedBlock = this.selectionController.getSelectedBlocks()[0];
|
|
1151
|
-
return (super.isDisabled() ||
|
|
1152
|
-
selectedNodes.some((node) => node.getAnnotationByType(NodeAnnotationTypeEnum.LINK)) ||
|
|
1153
|
-
this.shouldDisabledToolbar(selectedBlock, ModifyContentActionType.INSERT_IMAGE_TO_BLOCK));
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
(() => {
|
|
1157
|
-
VegaInternalIconManager.register({ image: image });
|
|
1158
|
-
})();
|
|
1159
|
-
__decorate$k([
|
|
1160
|
-
MapToComponentField()
|
|
1161
|
-
], ImageToolbarButtonSlimmer.prototype, "insertImageController", void 0);
|
|
1162
|
-
__decorate$k([
|
|
1163
|
-
MapToComponentField()
|
|
1164
|
-
], ImageToolbarButtonSlimmer.prototype, "imageInsertedEventEmitter", void 0);
|
|
1165
|
-
__decorate$k([
|
|
1166
|
-
MapToComponentField()
|
|
1167
|
-
], ImageToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1168
|
-
|
|
1169
|
-
const ListUL = {
|
|
1170
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H192zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"/></svg>`,
|
|
1171
|
-
};
|
|
1172
|
-
|
|
1173
|
-
const ListOL = {
|
|
1174
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M24 56c0-13.3 10.7-24 24-24H80c13.3 0 24 10.7 24 24V176h16c13.3 0 24 10.7 24 24s-10.7 24-24 24H40c-13.3 0-24-10.7-24-24s10.7-24 24-24H56V80H48C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432H120c13.3 0 24 10.7 24 24s-10.7 24-24 24H32c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H224c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>`,
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* Action to toggle bullet annotation
|
|
1179
|
-
*/
|
|
1180
|
-
class TransformListAction extends ModifyContentAction {
|
|
1181
|
-
constructor(listType, selectedBlocks) {
|
|
1182
|
-
super();
|
|
1183
|
-
this.type = ModifyContentActionType.TRANSFORM_LIST_BLOCK;
|
|
1184
|
-
this.isFlushable = true;
|
|
1185
|
-
this.listType = listType;
|
|
1186
|
-
this.selectedBlocks = selectedBlocks;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
/**
|
|
1191
|
-
* Action to toggle bullet annotation
|
|
1192
|
-
*/
|
|
1193
|
-
class TransformParagraphAction extends ModifyContentAction {
|
|
1194
|
-
constructor(selectedBlocks) {
|
|
1195
|
-
super();
|
|
1196
|
-
this.type = ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK;
|
|
1197
|
-
this.isFlushable = true;
|
|
1198
|
-
this.selectedBlocks = selectedBlocks;
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1203
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1204
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1205
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1206
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1207
|
-
};
|
|
1208
|
-
class BulletsToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1209
|
-
constructor() {
|
|
1210
|
-
super({
|
|
1211
|
-
icon: 'list-ul',
|
|
1212
|
-
tooltip: {
|
|
1213
|
-
text: 'Bullets',
|
|
1214
|
-
},
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
isSelected() {
|
|
1218
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1219
|
-
return this.isListType(selectedBlocks);
|
|
1220
|
-
}
|
|
1221
|
-
onClick() {
|
|
1222
|
-
if (this.isSelected()) {
|
|
1223
|
-
this.deselectBulletList();
|
|
1224
|
-
}
|
|
1225
|
-
else {
|
|
1226
|
-
this.selectBulletList();
|
|
1227
|
-
}
|
|
1228
|
-
void this.popoverRef.hide();
|
|
1229
|
-
}
|
|
1230
|
-
isDisabled() {
|
|
1231
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1232
|
-
return (super.isDisabled() ||
|
|
1233
|
-
selectedNodes.some((node) => node instanceof RTEImageNode || node instanceof RTECodeBlockNode));
|
|
1234
|
-
}
|
|
1235
|
-
isListType(selectedBlocks, type = 'bullet-list') {
|
|
1236
|
-
return (selectedBlocks.length > 0 &&
|
|
1237
|
-
selectedBlocks.every((block) => block instanceof RTEListItemBlock && block.parent.type === type));
|
|
1238
|
-
}
|
|
1239
|
-
/**
|
|
1240
|
-
* Deselect bullet list item to convert it to default paragraph
|
|
1241
|
-
*/
|
|
1242
|
-
deselectBulletList() {
|
|
1243
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1244
|
-
if (selectedBlocks[0]) {
|
|
1245
|
-
selectedBlocks[0].parent.apply(new TransformParagraphAction(selectedBlocks));
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
/**
|
|
1249
|
-
* Select texts or list items or texts and list items to convert it to bullet list
|
|
1250
|
-
*/
|
|
1251
|
-
selectBulletList() {
|
|
1252
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1253
|
-
if (selectedBlocks[0]) {
|
|
1254
|
-
const selectedFirstBlock = selectedBlocks[0].type === 'list-item'
|
|
1255
|
-
? selectedBlocks[0].parent
|
|
1256
|
-
: selectedBlocks[0];
|
|
1257
|
-
selectedFirstBlock.apply(new TransformListAction('bullet-list', selectedBlocks));
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
__decorate$j([
|
|
1262
|
-
MapToComponentField()
|
|
1263
|
-
], BulletsToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1264
|
-
__decorate$j([
|
|
1265
|
-
MapToComponentField()
|
|
1266
|
-
], BulletsToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1267
|
-
|
|
1268
|
-
var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1269
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1270
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1271
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1272
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1273
|
-
};
|
|
1274
|
-
class NumbersToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1275
|
-
constructor() {
|
|
1276
|
-
super({
|
|
1277
|
-
icon: 'list-ol',
|
|
1278
|
-
tooltip: { text: 'Numbers' },
|
|
1279
|
-
});
|
|
1280
|
-
}
|
|
1281
|
-
isSelected() {
|
|
1282
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1283
|
-
return this.isListType(selectedBlocks);
|
|
1284
|
-
}
|
|
1285
|
-
onClick() {
|
|
1286
|
-
if (this.isSelected()) {
|
|
1287
|
-
this.deselectNumberList();
|
|
1288
|
-
}
|
|
1289
|
-
else {
|
|
1290
|
-
this.selectNumberList();
|
|
1291
|
-
}
|
|
1292
|
-
void this.popoverRef.hide();
|
|
1293
|
-
}
|
|
1294
|
-
isDisabled() {
|
|
1295
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1296
|
-
return (super.isDisabled() ||
|
|
1297
|
-
selectedNodes.some((node) => node instanceof RTEImageNode || node instanceof RTECodeBlockNode));
|
|
1298
|
-
}
|
|
1299
|
-
isListType(selectedBlocks, type = 'number-list') {
|
|
1300
|
-
return (selectedBlocks.length > 0 &&
|
|
1301
|
-
selectedBlocks.every((block) => block instanceof RTEListItemBlock && block.parent.type === type));
|
|
1302
|
-
}
|
|
1303
|
-
/**
|
|
1304
|
-
* Deselect bullet list item to convert it to default paragraph
|
|
1305
|
-
*/
|
|
1306
|
-
deselectNumberList() {
|
|
1307
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1308
|
-
if (selectedBlocks[0]) {
|
|
1309
|
-
selectedBlocks[0].parent.apply(new TransformParagraphAction(selectedBlocks));
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Select texts or list items or texts and list items to convert it to bullet list
|
|
1314
|
-
*/
|
|
1315
|
-
selectNumberList() {
|
|
1316
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1317
|
-
if (selectedBlocks[0]) {
|
|
1318
|
-
const selectedFirstBlock = selectedBlocks[0].type === 'list-item'
|
|
1319
|
-
? selectedBlocks[0].parent
|
|
1320
|
-
: selectedBlocks[0];
|
|
1321
|
-
selectedFirstBlock.apply(new TransformListAction('number-list', selectedBlocks));
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
__decorate$i([
|
|
1326
|
-
MapToComponentField()
|
|
1327
|
-
], NumbersToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1328
|
-
__decorate$i([
|
|
1329
|
-
MapToComponentField()
|
|
1330
|
-
], NumbersToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1331
|
-
|
|
1332
|
-
var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1333
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1334
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1335
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1336
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1337
|
-
};
|
|
1338
|
-
class BulletsNumbersToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1339
|
-
constructor() {
|
|
1340
|
-
super({
|
|
1341
|
-
icon: 'list-ul',
|
|
1342
|
-
tooltip: {
|
|
1343
|
-
text: 'Bullets',
|
|
1344
|
-
},
|
|
1345
|
-
});
|
|
1346
|
-
this.bulletsToolbarButtonSlimmer = new BulletsToolbarButtonSlimmer();
|
|
1347
|
-
this.numbersToolbarButtonSlimmer = new NumbersToolbarButtonSlimmer();
|
|
1348
|
-
}
|
|
1349
|
-
componentWillRender() {
|
|
1350
|
-
if (this.numbersToolbarButtonSlimmer.isSelected()) {
|
|
1351
|
-
super.setIcon('list-ol');
|
|
1352
|
-
}
|
|
1353
|
-
else {
|
|
1354
|
-
super.setIcon('list-ul');
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
renderBtnWrapper(renderBtn) {
|
|
1358
|
-
return (h("vega-popover", { showArrow: false, trigger: "click", placement: "bottom", alignment: "center", ref: (ref) => (this.popoverRef = ref) },
|
|
1359
|
-
h("div", { slot: "popover-content" }, renderBtn({ showArrowIcon: true })),
|
|
1360
|
-
h("div", { slot: "popover" }, this.renderContent())));
|
|
1361
|
-
}
|
|
1362
|
-
renderContent() {
|
|
1363
|
-
return (h("vega-flex", { gap: "size-8", "justify-content": "center" },
|
|
1364
|
-
h("div", null, this.bulletsToolbarButtonSlimmer.render()),
|
|
1365
|
-
h("div", null, this.numbersToolbarButtonSlimmer.render())));
|
|
1366
|
-
}
|
|
1367
|
-
isSelected() {
|
|
1368
|
-
return false;
|
|
1369
|
-
}
|
|
1370
|
-
isDisabled() {
|
|
1371
|
-
return super.isDisabled() || this.shouldDisabledListToolbar();
|
|
1372
|
-
}
|
|
1373
|
-
shouldDisabledListToolbar() {
|
|
1374
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1375
|
-
return selectedBlocks.some((block) => {
|
|
1376
|
-
return (block &&
|
|
1377
|
-
(this.unableToConvertListOrParagraph(block) || this.unableToInsertBlock(block.parent)));
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
/**
|
|
1381
|
-
* Check if unable to insert blocks before or after the given block.
|
|
1382
|
-
*
|
|
1383
|
-
* @param {RTEBlock | VegaRTEContent} block - The block to check.
|
|
1384
|
-
* @returns {boolean} - Boolean result.
|
|
1385
|
-
*/
|
|
1386
|
-
unableToInsertBlock(block) {
|
|
1387
|
-
return !(ActionHandleStrategyRegistry.canHandle(ModifyContentActionType.INSERT_CHILDREN_AFTER, block) ||
|
|
1388
|
-
ActionHandleStrategyRegistry.canHandle(ModifyContentActionType.INSERT_CHILDREN_BEFORE, block));
|
|
1389
|
-
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Check if unable to convert the block to list or paragraph.
|
|
1392
|
-
*
|
|
1393
|
-
* @param {RTEBlock} block - The block to check.
|
|
1394
|
-
* @returns {boolean} - Boolean result.
|
|
1395
|
-
*/
|
|
1396
|
-
unableToConvertListOrParagraph(block) {
|
|
1397
|
-
return (!ActionHandleStrategyRegistry.canHandle(ModifyContentActionType.TRANSFORM_LIST_BLOCK, block) &&
|
|
1398
|
-
!ActionHandleStrategyRegistry.canHandle(ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK, block.parent));
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
(() => {
|
|
1402
|
-
VegaInternalIconManager.register({
|
|
1403
|
-
'list-ul': ListUL,
|
|
1404
|
-
'list-ol': ListOL,
|
|
1405
|
-
});
|
|
1406
|
-
})();
|
|
1407
|
-
__decorate$h([
|
|
1408
|
-
MapToComponentField()
|
|
1409
|
-
], BulletsNumbersToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1410
|
-
__decorate$h([
|
|
1411
|
-
InjectVegaSlimmer()
|
|
1412
|
-
], BulletsNumbersToolbarButtonSlimmer.prototype, "bulletsToolbarButtonSlimmer", void 0);
|
|
1413
|
-
__decorate$h([
|
|
1414
|
-
InjectVegaSlimmer()
|
|
1415
|
-
], BulletsNumbersToolbarButtonSlimmer.prototype, "numbersToolbarButtonSlimmer", void 0);
|
|
1416
|
-
__decorate$h([
|
|
1417
|
-
MapToComponentMethod('componentWillRender')
|
|
1418
|
-
], BulletsNumbersToolbarButtonSlimmer.prototype, "componentWillRender", null);
|
|
1419
|
-
|
|
1420
|
-
var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1421
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1422
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1423
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1424
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1425
|
-
};
|
|
1426
|
-
class LeftAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1427
|
-
constructor() {
|
|
1428
|
-
super({
|
|
1429
|
-
icon: 'align-left',
|
|
1430
|
-
tooltip: {
|
|
1431
|
-
text: 'Left Align',
|
|
1432
|
-
},
|
|
1433
|
-
});
|
|
1434
|
-
}
|
|
1435
|
-
isSelected() {
|
|
1436
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1437
|
-
return (selectedBlocks.length > 0 &&
|
|
1438
|
-
selectedBlocks.every((block) => {
|
|
1439
|
-
var _a;
|
|
1440
|
-
return ((_a = block.getAnnotationByType(BlockAnnotationTypeEnum.ALIGNMENT)) === null || _a === void 0 ? void 0 : _a.textAlign) === 'left';
|
|
1441
|
-
}));
|
|
1442
|
-
}
|
|
1443
|
-
onClick() {
|
|
1444
|
-
this.selectionController
|
|
1445
|
-
.getSelectedBlocks()
|
|
1446
|
-
.forEach((item) => item.apply(new HorizontalAlignmentAnnotationAction('left')));
|
|
1447
|
-
void this.popoverRef.hide();
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
(() => {
|
|
1451
|
-
VegaInternalIconManager.register({
|
|
1452
|
-
'align-left': AlignLeft,
|
|
1453
|
-
});
|
|
1454
|
-
})();
|
|
1455
|
-
__decorate$g([
|
|
1456
|
-
MapToComponentField()
|
|
1457
|
-
], LeftAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1458
|
-
__decorate$g([
|
|
1459
|
-
MapToComponentField()
|
|
1460
|
-
], LeftAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1461
|
-
|
|
1462
|
-
var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1463
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1464
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1465
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1466
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1467
|
-
};
|
|
1468
|
-
class CenterAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1469
|
-
constructor() {
|
|
1470
|
-
super({
|
|
1471
|
-
icon: 'align-center',
|
|
1472
|
-
tooltip: {
|
|
1473
|
-
text: 'Center Align',
|
|
1474
|
-
},
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
|
-
isSelected() {
|
|
1478
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1479
|
-
return (selectedBlocks.length > 0 &&
|
|
1480
|
-
selectedBlocks.every((block) => {
|
|
1481
|
-
var _a;
|
|
1482
|
-
return ((_a = block.getAnnotationByType(BlockAnnotationTypeEnum.ALIGNMENT)) === null || _a === void 0 ? void 0 : _a.textAlign) === 'center';
|
|
1483
|
-
}));
|
|
1484
|
-
}
|
|
1485
|
-
onClick() {
|
|
1486
|
-
this.selectionController
|
|
1487
|
-
.getSelectedBlocks()
|
|
1488
|
-
.forEach((item) => item.apply(new HorizontalAlignmentAnnotationAction('center')));
|
|
1489
|
-
void this.popoverRef.hide();
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
(() => {
|
|
1493
|
-
VegaInternalIconManager.register({
|
|
1494
|
-
'align-center': AlignCenter,
|
|
1495
|
-
});
|
|
1496
|
-
})();
|
|
1497
|
-
__decorate$f([
|
|
1498
|
-
MapToComponentField()
|
|
1499
|
-
], CenterAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1500
|
-
__decorate$f([
|
|
1501
|
-
MapToComponentField()
|
|
1502
|
-
], CenterAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1503
|
-
|
|
1504
|
-
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1505
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1506
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1507
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1508
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1509
|
-
};
|
|
1510
|
-
class RightAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1511
|
-
constructor() {
|
|
1512
|
-
super({
|
|
1513
|
-
icon: 'align-right',
|
|
1514
|
-
tooltip: {
|
|
1515
|
-
text: 'Right Align',
|
|
1516
|
-
},
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
isSelected() {
|
|
1520
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1521
|
-
return (selectedBlocks.length > 0 &&
|
|
1522
|
-
selectedBlocks.every((block) => {
|
|
1523
|
-
var _a;
|
|
1524
|
-
return ((_a = block.getAnnotationByType(BlockAnnotationTypeEnum.ALIGNMENT)) === null || _a === void 0 ? void 0 : _a.textAlign) === 'right';
|
|
1525
|
-
}));
|
|
1526
|
-
}
|
|
1527
|
-
onClick() {
|
|
1528
|
-
this.selectionController
|
|
1529
|
-
.getSelectedBlocks()
|
|
1530
|
-
.forEach((item) => item.apply(new HorizontalAlignmentAnnotationAction('right')));
|
|
1531
|
-
void this.popoverRef.hide();
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
(() => {
|
|
1535
|
-
VegaInternalIconManager.register({
|
|
1536
|
-
'align-right': AlignRight,
|
|
1537
|
-
});
|
|
1538
|
-
})();
|
|
1539
|
-
__decorate$e([
|
|
1540
|
-
MapToComponentField()
|
|
1541
|
-
], RightAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1542
|
-
__decorate$e([
|
|
1543
|
-
MapToComponentField()
|
|
1544
|
-
], RightAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1545
|
-
|
|
1546
|
-
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1547
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1548
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1549
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1550
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1551
|
-
};
|
|
1552
|
-
class JustifyAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1553
|
-
constructor() {
|
|
1554
|
-
super({
|
|
1555
|
-
icon: 'align-justify',
|
|
1556
|
-
tooltip: {
|
|
1557
|
-
text: 'Justified',
|
|
1558
|
-
},
|
|
1559
|
-
});
|
|
1560
|
-
}
|
|
1561
|
-
isSelected() {
|
|
1562
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1563
|
-
return (selectedBlocks.length > 0 &&
|
|
1564
|
-
selectedBlocks.every((block) => {
|
|
1565
|
-
var _a;
|
|
1566
|
-
return ((_a = block.getAnnotationByType(BlockAnnotationTypeEnum.ALIGNMENT)) === null || _a === void 0 ? void 0 : _a.textAlign) === 'justify';
|
|
1567
|
-
}));
|
|
1568
|
-
}
|
|
1569
|
-
onClick() {
|
|
1570
|
-
this.selectionController
|
|
1571
|
-
.getSelectedBlocks()
|
|
1572
|
-
.forEach((item) => item.apply(new HorizontalAlignmentAnnotationAction('justify')));
|
|
1573
|
-
void this.popoverRef.hide();
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
(() => {
|
|
1577
|
-
VegaInternalIconManager.register({
|
|
1578
|
-
'align-justify': AlignJustify,
|
|
1579
|
-
});
|
|
1580
|
-
})();
|
|
1581
|
-
__decorate$d([
|
|
1582
|
-
MapToComponentField()
|
|
1583
|
-
], JustifyAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1584
|
-
__decorate$d([
|
|
1585
|
-
MapToComponentField()
|
|
1586
|
-
], JustifyAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1587
|
-
|
|
1588
|
-
var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1589
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1590
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1591
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1592
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1593
|
-
};
|
|
1594
|
-
class HorizontalAlignmentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1595
|
-
constructor() {
|
|
1596
|
-
super({
|
|
1597
|
-
icon: 'align-left',
|
|
1598
|
-
tooltip: {
|
|
1599
|
-
text: 'Left Align',
|
|
1600
|
-
},
|
|
1601
|
-
});
|
|
1602
|
-
this.leftAlignToolbarButtonSlimmer = new LeftAlignToolbarButtonSlimmer();
|
|
1603
|
-
this.centerAlignToolbarButtonSlimmer = new CenterAlignToolbarButtonSlimmer();
|
|
1604
|
-
this.rightAlignToolbarButtonSlimmer = new RightAlignToolbarButtonSlimmer();
|
|
1605
|
-
this.justifiedToolbarButtonSlimmer = new JustifyAlignToolbarButtonSlimmer();
|
|
1606
|
-
}
|
|
1607
|
-
componentWillRender() {
|
|
1608
|
-
if (this.leftAlignToolbarButtonSlimmer.isSelected()) {
|
|
1609
|
-
super.setIcon('align-left');
|
|
1610
|
-
}
|
|
1611
|
-
else if (this.centerAlignToolbarButtonSlimmer.isSelected()) {
|
|
1612
|
-
super.setIcon('align-center');
|
|
1613
|
-
}
|
|
1614
|
-
else if (this.rightAlignToolbarButtonSlimmer.isSelected()) {
|
|
1615
|
-
super.setIcon('align-right');
|
|
1616
|
-
}
|
|
1617
|
-
else if (this.justifiedToolbarButtonSlimmer.isSelected()) {
|
|
1618
|
-
super.setIcon('align-justify');
|
|
1619
|
-
}
|
|
1620
|
-
else {
|
|
1621
|
-
super.setIcon('align-left');
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1624
|
-
renderBtnWrapper(renderBtn) {
|
|
1625
|
-
return (h("vega-popover", { trigger: "click", showArrow: false, alignment: "center", placement: "bottom", ref: (ref) => (this.popoverRef = ref) },
|
|
1626
|
-
h("div", { slot: "popover-content" }, renderBtn({ showArrowIcon: true })),
|
|
1627
|
-
h("div", { slot: "popover" }, this.renderContent())));
|
|
1628
|
-
}
|
|
1629
|
-
renderContent() {
|
|
1630
|
-
return (h("vega-flex", { gap: "size-8", "justify-content": "center" },
|
|
1631
|
-
h("div", null, this.leftAlignToolbarButtonSlimmer.render()),
|
|
1632
|
-
h("div", null, this.centerAlignToolbarButtonSlimmer.render()),
|
|
1633
|
-
h("div", null, this.rightAlignToolbarButtonSlimmer.render()),
|
|
1634
|
-
h("div", null, this.justifiedToolbarButtonSlimmer.render())));
|
|
1635
|
-
}
|
|
1636
|
-
isSelected() {
|
|
1637
|
-
return false;
|
|
1638
|
-
}
|
|
1639
|
-
isDisabled() {
|
|
1640
|
-
return (super.isDisabled() ||
|
|
1641
|
-
this.selectionController
|
|
1642
|
-
.getSelectedBlocks()
|
|
1643
|
-
.some((block) => this.shouldDisabledToolbar(block, HorizontalAlignmentAnnotationAction.name)));
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
__decorate$c([
|
|
1647
|
-
MapToComponentField()
|
|
1648
|
-
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1649
|
-
__decorate$c([
|
|
1650
|
-
InjectVegaSlimmer()
|
|
1651
|
-
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "leftAlignToolbarButtonSlimmer", void 0);
|
|
1652
|
-
__decorate$c([
|
|
1653
|
-
InjectVegaSlimmer()
|
|
1654
|
-
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "centerAlignToolbarButtonSlimmer", void 0);
|
|
1655
|
-
__decorate$c([
|
|
1656
|
-
InjectVegaSlimmer()
|
|
1657
|
-
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "rightAlignToolbarButtonSlimmer", void 0);
|
|
1658
|
-
__decorate$c([
|
|
1659
|
-
InjectVegaSlimmer()
|
|
1660
|
-
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "justifiedToolbarButtonSlimmer", void 0);
|
|
1661
|
-
__decorate$c([
|
|
1662
|
-
MapToComponentMethod('componentWillRender')
|
|
1663
|
-
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "componentWillRender", null);
|
|
1664
|
-
|
|
1665
|
-
/**
|
|
1666
|
-
* Represents the state of the RTE
|
|
1667
|
-
*/
|
|
1668
|
-
class RTEEditorState {
|
|
1669
|
-
constructor(content, selection) {
|
|
1670
|
-
this.content = content.clone(true);
|
|
1671
|
-
this.selection = selection.clone();
|
|
1672
|
-
this.refreshSelectionNodes();
|
|
1673
|
-
}
|
|
1674
|
-
/**
|
|
1675
|
-
* Clones the editor state, updating the content and selection based on the provided content.
|
|
1676
|
-
*
|
|
1677
|
-
* @returns {RTEEditorState} A new instance of RTEEditorState with the updated content and selection.
|
|
1678
|
-
*/
|
|
1679
|
-
clone() {
|
|
1680
|
-
return new RTEEditorState(this.content, this.selection);
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* Refreshes the selection nodes in the editor state.
|
|
1684
|
-
*/
|
|
1685
|
-
refreshSelectionNodes() {
|
|
1686
|
-
const { startNode: oldStartNode, endNode: oldEndNode, startOffset, endOffset, } = this.selection.range;
|
|
1687
|
-
if (oldStartNode && oldEndNode) {
|
|
1688
|
-
const startNode = this.content.findNodeById(oldStartNode.id);
|
|
1689
|
-
const endNode = this.content.findNodeById(oldEndNode.id);
|
|
1690
|
-
if (startNode && endNode) {
|
|
1691
|
-
this.selection.range.updateRTERange({
|
|
1692
|
-
startNode,
|
|
1693
|
-
endNode,
|
|
1694
|
-
startOffset,
|
|
1695
|
-
endOffset,
|
|
1696
|
-
});
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1703
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1704
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1705
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1706
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1707
|
-
};
|
|
1708
|
-
/**
|
|
1709
|
-
* The value controller is responsible for updating the value of the rich text editor.
|
|
1710
|
-
*/
|
|
1711
|
-
class ValueController extends VegaSlimmer {
|
|
1712
|
-
/**
|
|
1713
|
-
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.connectedCallback}
|
|
1714
|
-
*/
|
|
1715
|
-
connectedCallback() {
|
|
1716
|
-
const flushChangesWithDebounce = debounce(() => {
|
|
1717
|
-
void this.valueController.flushChanges(this.value);
|
|
1718
|
-
}, ValueController.VALUE_CHANGE_DEBOUNCE_TIME, this);
|
|
1719
|
-
this.flushChangeObserver = new Observer(this.isAcceptableFlushChange.bind(this), flushChangesWithDebounce);
|
|
1720
|
-
ChangeManager.register(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorFlushChanges), this.flushChangeObserver);
|
|
1721
|
-
}
|
|
1722
|
-
/**
|
|
1723
|
-
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.disconnectedCallback}
|
|
1724
|
-
*/
|
|
1725
|
-
disconnectedCallback() {
|
|
1726
|
-
ChangeManager.unregister(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorFlushChanges), this.flushChangeObserver);
|
|
1727
|
-
}
|
|
1728
|
-
/**
|
|
1729
|
-
* Component lifecycle - [componentWillLoad]{@link VegaRichTextEditor.componentWillLoad}
|
|
1730
|
-
*/
|
|
1731
|
-
componentWillLoad() {
|
|
1732
|
-
if (this.value && !(this.value instanceof VegaRTEContent)) {
|
|
1733
|
-
this.value = VegaRTEContent.fromJSON(this.value);
|
|
1734
|
-
}
|
|
1735
|
-
this.registerEditorRefAndContent();
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Watches the value of the editor and updates the internal value.
|
|
1739
|
-
*/
|
|
1740
|
-
watchValueUpdate() {
|
|
1741
|
-
const autoMatchFormat = this.sourceEditConfig.autoMatchFormat;
|
|
1742
|
-
if (this.value && !(this.value instanceof VegaRTEContent)) {
|
|
1743
|
-
this.value = VegaRTEContent.fromJSON(this.value, { autoMatchFormat });
|
|
1744
|
-
}
|
|
1745
|
-
else if (!this.value || this.value.children.length === 0) {
|
|
1746
|
-
this.value = VegaRTEContent.createEmptyContent({ autoMatchFormat });
|
|
1747
|
-
}
|
|
1748
|
-
else {
|
|
1749
|
-
this.changeEventEmitter.emit(this.value);
|
|
1750
|
-
ChangeManager.notify(FORM_ELEMENT_VALUE_CHANGE, {
|
|
1751
|
-
host: this.host,
|
|
1752
|
-
detail: this.value,
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
this.registerEditorRefAndContent();
|
|
1756
|
-
}
|
|
1757
|
-
/**
|
|
1758
|
-
* Updates the value of the editor and restore the selection.
|
|
1759
|
-
*
|
|
1760
|
-
* @param {VegaRTEContent} newValue The new value to set.
|
|
1761
|
-
* @param {boolean} recordHistory - Whether to record the change in history.
|
|
1762
|
-
*/
|
|
1763
|
-
async flushChanges(newValue, recordHistory = true) {
|
|
1764
|
-
this.value = newValue.clone();
|
|
1765
|
-
if (recordHistory) {
|
|
1766
|
-
this.historyController.registerHistory(new RTEEditorState(this.value, new RTESelectionState(this.selectionController.getCurrentRange())));
|
|
1767
|
-
}
|
|
1768
|
-
await waitForComponentDidRender(this.host);
|
|
1769
|
-
}
|
|
1770
|
-
/**
|
|
1771
|
-
* Determines whether the observer should accept changes.
|
|
1772
|
-
*
|
|
1773
|
-
* @returns {boolean} Always returns true in the current implementation.
|
|
1774
|
-
*/
|
|
1775
|
-
isAcceptableFlushChange() {
|
|
1776
|
-
return true;
|
|
1777
|
-
}
|
|
1778
|
-
/**
|
|
1779
|
-
* Register the host element and the current content.
|
|
1780
|
-
*/
|
|
1781
|
-
registerEditorRefAndContent() {
|
|
1782
|
-
if (this.host && this.host.value) {
|
|
1783
|
-
stateEntityRenderingRegistry.register(this.host, this.host.value);
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
ValueController.VALUE_CHANGE_DEBOUNCE_TIME = 50;
|
|
1788
|
-
__decorate$b([
|
|
1789
|
-
MapToComponentField()
|
|
1790
|
-
], ValueController.prototype, "host", void 0);
|
|
1791
|
-
__decorate$b([
|
|
1792
|
-
MapToComponentField({ writable: true })
|
|
1793
|
-
], ValueController.prototype, "value", void 0);
|
|
1794
|
-
__decorate$b([
|
|
1795
|
-
MapToComponentField()
|
|
1796
|
-
], ValueController.prototype, "changeEventEmitter", void 0);
|
|
1797
|
-
__decorate$b([
|
|
1798
|
-
MapToComponentField()
|
|
1799
|
-
], ValueController.prototype, "valueController", void 0);
|
|
1800
|
-
__decorate$b([
|
|
1801
|
-
MapToComponentField()
|
|
1802
|
-
], ValueController.prototype, "historyController", void 0);
|
|
1803
|
-
__decorate$b([
|
|
1804
|
-
MapToComponentField()
|
|
1805
|
-
], ValueController.prototype, "selectionController", void 0);
|
|
1806
|
-
__decorate$b([
|
|
1807
|
-
MapToComponentField()
|
|
1808
|
-
], ValueController.prototype, "sourceEditConfig", void 0);
|
|
1809
|
-
__decorate$b([
|
|
1810
|
-
MapToComponentMethod('connectedCallback')
|
|
1811
|
-
], ValueController.prototype, "connectedCallback", null);
|
|
1812
|
-
__decorate$b([
|
|
1813
|
-
MapToComponentMethod('disconnectedCallback')
|
|
1814
|
-
], ValueController.prototype, "disconnectedCallback", null);
|
|
1815
|
-
__decorate$b([
|
|
1816
|
-
MapToComponentMethod('componentWillLoad')
|
|
1817
|
-
], ValueController.prototype, "componentWillLoad", null);
|
|
1818
|
-
__decorate$b([
|
|
1819
|
-
MapToComponentMethod('watchValueUpdate')
|
|
1820
|
-
], ValueController.prototype, "watchValueUpdate", null);
|
|
1821
|
-
|
|
1822
|
-
/**
|
|
1823
|
-
* The rich text content controller
|
|
1824
|
-
*/
|
|
1825
|
-
class RichTextContentController {
|
|
1826
|
-
constructor(editor) {
|
|
1827
|
-
this.editor = editor;
|
|
1828
|
-
}
|
|
1829
|
-
/**
|
|
1830
|
-
* Sync rich text content editable with disabled property
|
|
1831
|
-
*
|
|
1832
|
-
*/
|
|
1833
|
-
syncRichTextContentEditable() {
|
|
1834
|
-
this.editor.richTextContentEditable = !this.editor.disabled;
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
const ROOT_CONTAINER_CLASS_NAME = 'rich-text-content';
|
|
1839
|
-
/** This code snippet is defining an abstract class named `BaseHandler` with an abstract method `execute`. */
|
|
1840
|
-
class BaseHandler {
|
|
1841
|
-
/**
|
|
1842
|
-
* The function `execute` initializes the current state and selection, and then handles an event if provided.
|
|
1843
|
-
*
|
|
1844
|
-
* @param {VegaRTEContent} currentState - The current state of the VegaRTE content.
|
|
1845
|
-
* @param {SelectionController} selectionController - Manages the selection of items in the user interface.
|
|
1846
|
-
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
1847
|
-
* @param {InputEvent} [event] - It is used to pass an input event to the method for handling.
|
|
1848
|
-
*/
|
|
1849
|
-
execute(currentState, selectionController, richTextEditor, event) {
|
|
1850
|
-
this.initCurrentStateAndSelection(currentState, selectionController);
|
|
1851
|
-
this.setCurrentRichTextEditor(richTextEditor);
|
|
1852
|
-
this.handleEvent(event);
|
|
1853
|
-
}
|
|
1854
|
-
/**
|
|
1855
|
-
* The function `isRootContainer` checks if an HTML element is a root container with a class of 'rich-text-content'.
|
|
1856
|
-
*
|
|
1857
|
-
* @param {HTMLElement} element - HTMLElement
|
|
1858
|
-
* @returns {boolean} The boolean value
|
|
1859
|
-
*/
|
|
1860
|
-
isRootContainer(element) {
|
|
1861
|
-
return (element &&
|
|
1862
|
-
element.nodeType === Node.ELEMENT_NODE &&
|
|
1863
|
-
element.classList.contains(ROOT_CONTAINER_CLASS_NAME));
|
|
1864
|
-
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Checks if a given HTML element represents an empty paragraph containing only a line break element.
|
|
1867
|
-
*
|
|
1868
|
-
* @param {HTMLElement} node - An HTMLElement node that represents a paragraph element in the HTML document.
|
|
1869
|
-
* @returns {boolean} boolean result
|
|
1870
|
-
*/
|
|
1871
|
-
isEmptyParagraph(node) {
|
|
1872
|
-
return node && node.childNodes && node.childNodes.length === 0;
|
|
1873
|
-
}
|
|
1874
|
-
/**
|
|
1875
|
-
* Removes selected nodes within a range in a rich text editor content.
|
|
1876
|
-
* The method is only used for different nodes are selected
|
|
1877
|
-
*
|
|
1878
|
-
* @param {boolean} [mergeNode] Merge start node and end node or not, default value is false.
|
|
1879
|
-
* @returns {RTENode} The range start node, usually the start node is the first item of selectedNodes, if the selectedNodes is all removed, the start node will be a new text node.
|
|
1880
|
-
*/
|
|
1881
|
-
removeSelectionRange(mergeNode = false) {
|
|
1882
|
-
ChangeManager.notify(domNodeSubjectFactory.getSubject(this.richTextEditorRef, VegaInternalRichTextEditDeleteSelectedNodes), { host: this.richTextEditorRef, detail: mergeNode });
|
|
1883
|
-
const range = this.selectionController.getCurrentRange();
|
|
1884
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1885
|
-
return range.startNode || selectedNodes[0];
|
|
1886
|
-
}
|
|
1887
|
-
/**
|
|
1888
|
-
* Creates a new paragraph with an empty text node and returns it.
|
|
1889
|
-
*
|
|
1890
|
-
* @returns {RTETextBlock} An empty paragraph with a unique identifier and a text node appended to it.
|
|
1891
|
-
*/
|
|
1892
|
-
createEmptyParagraph() {
|
|
1893
|
-
const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
|
|
1894
|
-
const textNode = new RTETextNode(`${paragraph.id}1`, '', paragraph);
|
|
1895
|
-
paragraph.apply(new AppendChildrenAction([textNode]));
|
|
1896
|
-
return paragraph;
|
|
1897
|
-
}
|
|
1898
|
-
/**
|
|
1899
|
-
* The function initializes the current state and selection controller in TypeScript.
|
|
1900
|
-
*
|
|
1901
|
-
* @param {VegaRTEContent} currentState - The current state of a Vega runtime environment content.
|
|
1902
|
-
* @param {SelectionController} selectionController - It is used to manage the selection of content within the VegaRTE editor.
|
|
1903
|
-
*/
|
|
1904
|
-
initCurrentStateAndSelection(currentState, selectionController) {
|
|
1905
|
-
this.currentState = currentState;
|
|
1906
|
-
this.selectionController = selectionController;
|
|
1907
|
-
}
|
|
1908
|
-
/**
|
|
1909
|
-
* Queries the rich text editor element from the input event target.
|
|
1910
|
-
*
|
|
1911
|
-
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
1912
|
-
*/
|
|
1913
|
-
setCurrentRichTextEditor(richTextEditor) {
|
|
1914
|
-
this.richTextEditorRef = richTextEditor;
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
|
|
1918
|
-
/**
|
|
1919
|
-
* Replace the text node selected content to new text
|
|
1920
|
-
*
|
|
1921
|
-
* @example selectedNode.apply(new ReplaceSelectedTextAction(insertText))
|
|
1922
|
-
*/
|
|
1923
|
-
class ReplaceSelectedTextAction extends ModifyContentAction {
|
|
1924
|
-
constructor(text, currentRange) {
|
|
1925
|
-
super();
|
|
1926
|
-
this.type = ModifyContentActionType.REPLACE_SELECTED_TEXT;
|
|
1927
|
-
this.textToBeInsert = '';
|
|
1928
|
-
this.textToBeInsert = text;
|
|
1929
|
-
this.currentRange = currentRange;
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
/**
|
|
1934
|
-
* Action to type character into a decorator node
|
|
1935
|
-
*
|
|
1936
|
-
* @example decoratorNode.parent.apply(new InsertTextToDecoratorNodeAction(decoratorNode, '', 0 | 1))
|
|
1937
|
-
*/
|
|
1938
|
-
class InsertTextToDecoratorNodeAction extends ModifyContentAction {
|
|
1939
|
-
constructor(decoratorNode, text, offset) {
|
|
1940
|
-
super();
|
|
1941
|
-
this.type = ModifyContentActionType.INSERT_TEXT_TO_DECORATOR_NODE;
|
|
1942
|
-
this.text = '';
|
|
1943
|
-
this.offset = 0;
|
|
1944
|
-
this.decoratorNode = decoratorNode;
|
|
1945
|
-
this.text = text;
|
|
1946
|
-
this.offset = offset;
|
|
1947
|
-
}
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
/** Handles inserting text into a VegaRTEContent based on the current selection and input event. User input character will trigger this callback */
|
|
1951
|
-
class InsertTextHandler extends BaseHandler {
|
|
1952
|
-
/**
|
|
1953
|
-
* Update the state value when user type character
|
|
1954
|
-
*
|
|
1955
|
-
* @param {InputEvent} event - The input event object
|
|
1956
|
-
*/
|
|
1957
|
-
handleEvent(event) {
|
|
1958
|
-
const text = event.data;
|
|
1959
|
-
const currentRange = this.selectionController.getCurrentRange();
|
|
1960
|
-
const { startContainer, startOffset } = currentRange;
|
|
1961
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1962
|
-
if (selectedNodes.length < 2) {
|
|
1963
|
-
if (!selectedNodes.length && this.isRootContainer(startContainer)) {
|
|
1964
|
-
const cursorNode = this.insertTextToRoot(text);
|
|
1965
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, text.length);
|
|
1966
|
-
}
|
|
1967
|
-
else if (selectedNodes[0] instanceof RTETextNode) {
|
|
1968
|
-
if (selectedNodes[0].isContentEditable()) {
|
|
1969
|
-
let nextOffset = startOffset + text.length;
|
|
1970
|
-
let updateFlag = false;
|
|
1971
|
-
let cursorNode = selectedNodes[0];
|
|
1972
|
-
if (cursorNode.text === '\n') {
|
|
1973
|
-
cursorNode = this.insertTextToLineBreakNode(cursorNode, text);
|
|
1974
|
-
updateFlag = true;
|
|
1975
|
-
}
|
|
1976
|
-
else {
|
|
1977
|
-
if (startContainer.nodeValue === ZERO_WIDTH_SPACE &&
|
|
1978
|
-
startOffset === ZERO_WIDTH_SPACE.length &&
|
|
1979
|
-
cursorNode.isEmpty()) {
|
|
1980
|
-
startContainer.nodeValue = '';
|
|
1981
|
-
nextOffset = nextOffset - ZERO_WIDTH_SPACE.length;
|
|
1982
|
-
}
|
|
1983
|
-
if (cursorNode instanceof RTETextNode) {
|
|
1984
|
-
updateFlag = true;
|
|
1985
|
-
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
updateFlag &&
|
|
1989
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(nextOffset, cursorNode['text'].length));
|
|
1990
|
-
}
|
|
1991
|
-
else {
|
|
1992
|
-
selectedNodes[0].parent.apply(new InsertTextToDecoratorNodeAction(selectedNodes[0], text, startOffset));
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
else {
|
|
1997
|
-
// The selected nodes is multiple nodes
|
|
1998
|
-
const cursorNode = this.removeSelectionRange(true);
|
|
1999
|
-
if (cursorNode instanceof RTETextNode) {
|
|
2000
|
-
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
2001
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(startOffset + text.length, cursorNode.text.length));
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
/**
|
|
2006
|
-
* Insert the text in root element when root container is empty, should create text block and text node
|
|
2007
|
-
*
|
|
2008
|
-
* @param {string} text The insert text
|
|
2009
|
-
* @returns {RTETextNode} The new create text node
|
|
2010
|
-
*/
|
|
2011
|
-
insertTextToRoot(text) {
|
|
2012
|
-
if (this.currentState &&
|
|
2013
|
-
this.currentState.children[0] &&
|
|
2014
|
-
this.currentState.children[0] instanceof RTETextBlock) {
|
|
2015
|
-
const firstNode = this.currentState.children[0].children[0];
|
|
2016
|
-
firstNode.apply(new UpdateTextAction(text));
|
|
2017
|
-
return firstNode;
|
|
2018
|
-
}
|
|
2019
|
-
}
|
|
2020
|
-
/**
|
|
2021
|
-
* Insert text to a line break node need a special logic if the line break has a next text node.
|
|
2022
|
-
*
|
|
2023
|
-
* @param {RTETextNode} lineBreakNode The current line break node, the text value is \n
|
|
2024
|
-
* @param {string} text The text need to insert
|
|
2025
|
-
* @returns {Nullable<RTETextNode>} The new text node or the current line break node
|
|
2026
|
-
*/
|
|
2027
|
-
insertTextToLineBreakNode(lineBreakNode, text) {
|
|
2028
|
-
const { startOffset, endOffset } = this.selectionController.getCurrentRange();
|
|
2029
|
-
const textBlock = lineBreakNode.parent;
|
|
2030
|
-
if (textBlock instanceof RTETextBlock) {
|
|
2031
|
-
const index = textBlock.children.indexOf(lineBreakNode);
|
|
2032
|
-
if (startOffset === 0 && startOffset === endOffset && textBlock.children[index + 1]) {
|
|
2033
|
-
const newTextNode = lineBreakNode.cloneWithText(text);
|
|
2034
|
-
textBlock.apply(new InsertChildrenBeforeAction(lineBreakNode, newTextNode));
|
|
2035
|
-
return newTextNode;
|
|
2036
|
-
}
|
|
2037
|
-
else {
|
|
2038
|
-
lineBreakNode.apply(new UpdateTextAction(text));
|
|
2039
|
-
return lineBreakNode;
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
|
-
/** Insert a paragraph in a rich text editor based on the current selection and event. User type enter will trigger this callback */
|
|
2046
|
-
class InsertParagraphHandler extends BaseHandler {
|
|
2047
|
-
/**
|
|
2048
|
-
* Create new paragraph node and add node to state value
|
|
2049
|
-
*/
|
|
2050
|
-
handleEvent() {
|
|
2051
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2052
|
-
if (selectedBlocks.length) {
|
|
2053
|
-
if (selectedBlocks.length < 2) {
|
|
2054
|
-
this.breakSingleBlock();
|
|
2055
|
-
}
|
|
2056
|
-
else {
|
|
2057
|
-
this.breakMultipleBlocks();
|
|
2058
|
-
}
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
/**
|
|
2062
|
-
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
2063
|
-
*/
|
|
2064
|
-
breakMultipleBlocks() {
|
|
2065
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2066
|
-
const range = this.selectionController.getCurrentRange();
|
|
2067
|
-
const cursorNode = this.removeSelectionRange();
|
|
2068
|
-
// If the start or end block contains a list item block, it needs to be processed separately
|
|
2069
|
-
if ((selectedBlocks.length && selectedBlocks[0].type === 'list-item') ||
|
|
2070
|
-
selectedBlocks[selectedBlocks.length - 1].type === 'list-item') {
|
|
2071
|
-
const firstBlock = cursorNode.parent;
|
|
2072
|
-
const lastBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
2073
|
-
/**
|
|
2074
|
-
* First block is list item
|
|
2075
|
-
* --before--
|
|
2076
|
-
* ul
|
|
2077
|
-
* - li
|
|
2078
|
-
* p
|
|
2079
|
-
* - span
|
|
2080
|
-
* --after--
|
|
2081
|
-
* ul
|
|
2082
|
-
* - li
|
|
2083
|
-
* - li
|
|
2084
|
-
*/
|
|
2085
|
-
/**
|
|
2086
|
-
* End block is list item
|
|
2087
|
-
* --before--
|
|
2088
|
-
* p
|
|
2089
|
-
* - span
|
|
2090
|
-
* ul
|
|
2091
|
-
* - li
|
|
2092
|
-
* --after--
|
|
2093
|
-
* p
|
|
2094
|
-
* - span
|
|
2095
|
-
* p
|
|
2096
|
-
* - span
|
|
2097
|
-
*/
|
|
2098
|
-
if (firstBlock.type !== lastBlock.type &&
|
|
2099
|
-
range.startContainer.nodeType === range.endContainer.nodeType) {
|
|
2100
|
-
firstBlock.apply(new MergeTwoBlocksNodesAction(lastBlock));
|
|
2101
|
-
const splitAction = new SplitBlockWithNodeAction(cursorNode, cursorNode['text'].length);
|
|
2102
|
-
firstBlock.apply(splitAction);
|
|
2103
|
-
this.switchCaretPositionToNextElement(splitAction.newBlock);
|
|
2104
|
-
return;
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
|
|
2108
|
-
}
|
|
2109
|
-
/**
|
|
2110
|
-
* Handles breaking a single block in an RTE editor based on the current selection and position.
|
|
2111
|
-
*/
|
|
2112
|
-
breakSingleBlock() {
|
|
2113
|
-
const cursorNode = this.removeSelectionRange();
|
|
2114
|
-
const currentBlock = cursorNode.parent;
|
|
2115
|
-
const { startOffset } = this.selectionController.getCurrentRange();
|
|
2116
|
-
if (currentBlock) {
|
|
2117
|
-
const breakAction = new InsertNewParagraphAction(cursorNode, startOffset);
|
|
2118
|
-
currentBlock.apply(breakAction);
|
|
2119
|
-
this.switchCaretPositionToNextElement(breakAction.newBlock);
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* Moves the caret to the next block element in a rich text editor.
|
|
2124
|
-
*
|
|
2125
|
-
* @param {RTEBlock} newBlock - Represents a new create block element in a rich text editor.
|
|
2126
|
-
*/
|
|
2127
|
-
switchCaretPositionToNextElement(newBlock) {
|
|
2128
|
-
if (newBlock && newBlock.children) {
|
|
2129
|
-
this.selectionController.enqueueSelectionRangeFutureState(newBlock.children[0], 0);
|
|
2130
|
-
}
|
|
2131
|
-
}
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
/**
|
|
2135
|
-
* Split the block with a split point node
|
|
2136
|
-
*
|
|
2137
|
-
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2138
|
-
*/
|
|
2139
|
-
class LineBreakSingleBlockAction extends ModifyContentAction {
|
|
2140
|
-
constructor(startContainerNode, startOffset) {
|
|
2141
|
-
super();
|
|
2142
|
-
this.type = ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK;
|
|
2143
|
-
this.startContainerNode = startContainerNode;
|
|
2144
|
-
this.startOffset = startOffset;
|
|
2145
|
-
}
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
/**
|
|
2149
|
-
* Split the block with a split point node
|
|
2150
|
-
*
|
|
2151
|
-
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2152
|
-
*/
|
|
2153
|
-
class lineBreakMultipleBlocksAction extends ModifyContentAction {
|
|
2154
|
-
constructor(selectedBlocks) {
|
|
2155
|
-
super();
|
|
2156
|
-
this.type = ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS;
|
|
2157
|
-
this.selectedBlocks = selectedBlocks;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
/** User press shift + enter will tigger this callback */
|
|
2162
|
-
class InsertLineBreakHandler extends BaseHandler {
|
|
2163
|
-
/**
|
|
2164
|
-
* Create new line break node and add node to state value
|
|
2165
|
-
*/
|
|
2166
|
-
handleEvent() {
|
|
2167
|
-
const range = this.selectionController.getCurrentRange();
|
|
2168
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2169
|
-
if (this.isRootContainer(range.startContainer)) {
|
|
2170
|
-
this.breakNewBlock();
|
|
2171
|
-
}
|
|
2172
|
-
if (selectedBlocks.length) {
|
|
2173
|
-
if (selectedBlocks.length < 2) {
|
|
2174
|
-
this.breakSingleBlock();
|
|
2175
|
-
}
|
|
2176
|
-
else {
|
|
2177
|
-
this.breakMultipleBlocks();
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
/**
|
|
2182
|
-
* Insert the \n in text element when root container is empty, should create text block and text node
|
|
2183
|
-
* <p>
|
|
2184
|
-
* <span></span>
|
|
2185
|
-
* <span></span>
|
|
2186
|
-
* </p>
|
|
2187
|
-
*/
|
|
2188
|
-
breakNewBlock() {
|
|
2189
|
-
if (this.currentState &&
|
|
2190
|
-
this.currentState.children[0] &&
|
|
2191
|
-
this.currentState.children[0] instanceof RTETextBlock) {
|
|
2192
|
-
const lineBreakAction = new LineBreakSingleBlockAction(this.currentState.children[0].children[0], 0);
|
|
2193
|
-
this.currentState.children[0].apply(lineBreakAction);
|
|
2194
|
-
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
|
-
* If the selected node is a text node
|
|
2199
|
-
* <p>
|
|
2200
|
-
* <span>text</span>
|
|
2201
|
-
* </p>
|
|
2202
|
-
* Insert a line break and the selected node will be split into three text nodes
|
|
2203
|
-
* <p>
|
|
2204
|
-
* <span>te</span>
|
|
2205
|
-
* <br>
|
|
2206
|
-
* <span>xt</span>
|
|
2207
|
-
* </p>
|
|
2208
|
-
*/
|
|
2209
|
-
breakSingleBlock() {
|
|
2210
|
-
const range = this.selectionController.getCurrentRange();
|
|
2211
|
-
const cursorNode = this.removeSelectionRange();
|
|
2212
|
-
const currentBlock = cursorNode.parent;
|
|
2213
|
-
if (currentBlock) {
|
|
2214
|
-
const lineBreakAction = new LineBreakSingleBlockAction(cursorNode, range.startOffset);
|
|
2215
|
-
currentBlock.apply(lineBreakAction);
|
|
2216
|
-
if (lineBreakAction.lineBreakNode) {
|
|
2217
|
-
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
/**
|
|
2222
|
-
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
2223
|
-
*/
|
|
2224
|
-
breakMultipleBlocks() {
|
|
2225
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2226
|
-
const cursorNode = this.removeSelectionRange();
|
|
2227
|
-
const lineBreakAction = new lineBreakMultipleBlocksAction(selectedBlocks);
|
|
2228
|
-
cursorNode.parent.apply(lineBreakAction);
|
|
2229
|
-
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2230
|
-
}
|
|
2231
|
-
/**
|
|
2232
|
-
* Moves the caret to the next node element in a rich text editor.
|
|
2233
|
-
*
|
|
2234
|
-
* @param {RTENode} lineBreakNode - Represents a node element in a rich text editor.
|
|
2235
|
-
*/
|
|
2236
|
-
switchCaretPositionToSpecifiedNode(lineBreakNode) {
|
|
2237
|
-
this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(lineBreakNode), 0);
|
|
2238
|
-
}
|
|
2239
|
-
/**
|
|
2240
|
-
* Returns the next sibling node of a given block element in a rich text editor.
|
|
2241
|
-
*
|
|
2242
|
-
* @param {RTENode} lineBreakNode - The `lineBreakNode` parameter is of type `RTENode`, which is used to represent the new line break element in a rich text editor.
|
|
2243
|
-
* @returns {RTENode} The next sibling node of the current line break element, or the current node if next node is not exists.
|
|
2244
|
-
*/
|
|
2245
|
-
getNextRTENode(lineBreakNode) {
|
|
2246
|
-
const index = lineBreakNode.parent.children.indexOf(lineBreakNode);
|
|
2247
|
-
const nextNode = lineBreakNode.parent.children[index + 1];
|
|
2248
|
-
return nextNode || lineBreakNode;
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
/**
|
|
2253
|
-
* Delete text or image when press delete
|
|
2254
|
-
*
|
|
2255
|
-
* @example currentBlock.apply(new DeleteBlockContentAction(startContainerNode, startOffset))
|
|
2256
|
-
*/
|
|
2257
|
-
class DeleteBlockContentAction extends ModifyContentAction {
|
|
2258
|
-
constructor(startContainerNode, startOffset) {
|
|
2259
|
-
super();
|
|
2260
|
-
this.type = ModifyContentActionType.DELETE_BLOCK_CONTENT;
|
|
2261
|
-
this.startContainerNode = startContainerNode;
|
|
2262
|
-
this.startOffset = startOffset;
|
|
2263
|
-
}
|
|
2264
|
-
}
|
|
2265
|
-
|
|
2266
|
-
/** Handles the deletion of content within a VegaRTE editor. User press backspace or delete will trigger this method */
|
|
2267
|
-
class DeleteContentHandler extends BaseHandler {
|
|
2268
|
-
/**
|
|
2269
|
-
* Delete the selected node from the current state.
|
|
2270
|
-
*/
|
|
2271
|
-
handleEvent() {
|
|
2272
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2273
|
-
if (selectedBlocks.length < 2) {
|
|
2274
|
-
this.deleteContentWithSingleBlock();
|
|
2275
|
-
}
|
|
2276
|
-
else {
|
|
2277
|
-
this.deleteContentWithMultipleNodes();
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Handles the deletion of content within a single block in an RTE editor.
|
|
2282
|
-
*/
|
|
2283
|
-
deleteContentWithSingleBlock() {
|
|
2284
|
-
const range = this.selectionController.getCurrentRange();
|
|
2285
|
-
const { startOffset, endOffset, startContainer, endContainer } = range;
|
|
2286
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2287
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2288
|
-
if (startOffset !== endOffset || startContainer !== endContainer) {
|
|
2289
|
-
this.deleteContentWithMultipleNodes();
|
|
2290
|
-
}
|
|
2291
|
-
else if (selectedBlocks[0]) {
|
|
2292
|
-
const deleteAction = new DeleteBlockContentAction(selectedNodes[0], startOffset);
|
|
2293
|
-
selectedBlocks[0].apply(deleteAction);
|
|
2294
|
-
if (deleteAction.previousNode) {
|
|
2295
|
-
const nextOffset = deleteAction.previousNode === selectedNodes[0]
|
|
2296
|
-
? Math.max(0, startOffset - 1)
|
|
2297
|
-
: deleteAction.previousNode.getRangeEndOffset();
|
|
2298
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.previousNode, nextOffset);
|
|
2299
|
-
}
|
|
2300
|
-
else if (deleteAction.nextNode) {
|
|
2301
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.nextNode, 0);
|
|
2302
|
-
}
|
|
2303
|
-
else if (this.currentState.children.length === 0) {
|
|
2304
|
-
// Add a empty paragraph if delete all content to make sure the caret position
|
|
2305
|
-
this.insertDefaultParagraph();
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
/**
|
|
2310
|
-
* Deletes the content within multiple nodes selected by the user.
|
|
2311
|
-
*/
|
|
2312
|
-
deleteContentWithMultipleNodes() {
|
|
2313
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2314
|
-
const cursorNode = this.removeSelectionRange(true);
|
|
2315
|
-
const lastSelectedNode = selectedNodes[selectedNodes.length - 1];
|
|
2316
|
-
if (selectedNodes.length > 1 &&
|
|
2317
|
-
lastSelectedNode instanceof RTETextNode &&
|
|
2318
|
-
lastSelectedNode.isEmpty()) {
|
|
2319
|
-
lastSelectedNode.parent.apply(new RemoveChildrenAction(lastSelectedNode));
|
|
2320
|
-
}
|
|
2321
|
-
this.convertFirstBlockToParagraph(cursorNode.parent);
|
|
2322
|
-
}
|
|
2323
|
-
/**
|
|
2324
|
-
* If the first block is not paragraph, convert the block to paragraph after delete all text
|
|
2325
|
-
*
|
|
2326
|
-
* @param {RTEBlock} block - The first block instance
|
|
2327
|
-
*/
|
|
2328
|
-
convertFirstBlockToParagraph(block) {
|
|
2329
|
-
const firstBlock = this.currentState.children[0];
|
|
2330
|
-
if (firstBlock === block &&
|
|
2331
|
-
block instanceof RTETextBlock &&
|
|
2332
|
-
block.children.length === 1 &&
|
|
2333
|
-
block.children[0].isEmpty() &&
|
|
2334
|
-
block.type !== 'paragraph') {
|
|
2335
|
-
const paragraph = this.createEmptyParagraph();
|
|
2336
|
-
paragraph.apply(new ReplaceChildNodesAction(block.children));
|
|
2337
|
-
block.parent.apply(new InsertChildrenBeforeAction(block, paragraph));
|
|
2338
|
-
block.parent.apply(new RemoveChildrenAction(block));
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
/**
|
|
2342
|
-
* Creates a new paragraph element with a text node and appends it to the current state.
|
|
2343
|
-
*/
|
|
2344
|
-
insertDefaultParagraph() {
|
|
2345
|
-
const paragraph = this.createEmptyParagraph();
|
|
2346
|
-
this.currentState.apply(new AppendChildrenAction([paragraph]));
|
|
2347
|
-
this.selectionController.enqueueSelectionRangeFutureState(paragraph.children[0], 1);
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
/**
|
|
2352
|
-
* Action to paste new content into current block.
|
|
2353
|
-
*
|
|
2354
|
-
* @example functionBlock.apply(new PasteContentAction(blocksToBeInserted, startNode, startOffset))
|
|
2355
|
-
* @example host.value.apply(new PasteContentAction(blocksToBeInserted, startNode, startOffset))
|
|
2356
|
-
*/
|
|
2357
|
-
class PasteContentAction extends ModifyContentAction {
|
|
2358
|
-
constructor(blocksToBeInserted, startNode, startOffset, rteRange) {
|
|
2359
|
-
super();
|
|
2360
|
-
this.type = ModifyContentActionType.PASTE_CONTENT;
|
|
2361
|
-
this.blocksToBeInserted = blocksToBeInserted;
|
|
2362
|
-
this.startNode = startNode;
|
|
2363
|
-
this.startOffset = startOffset;
|
|
2364
|
-
this.rteRange = rteRange;
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
|
|
2368
|
-
/**
|
|
2369
|
-
* Handle user paste
|
|
2370
|
-
*/
|
|
2371
|
-
class InsertPasteHandler extends BaseHandler {
|
|
2372
|
-
/**
|
|
2373
|
-
* Update the state value when user paste html elements.
|
|
2374
|
-
*
|
|
2375
|
-
* @param {InputEvent} event - Paste event.
|
|
2376
|
-
*/
|
|
2377
|
-
handleEvent(event) {
|
|
2378
|
-
const blocks = this.parsePastedElements(event);
|
|
2379
|
-
const { startContainer } = this.selectionController.getCurrentRange();
|
|
2380
|
-
if (this.isRootContainer(startContainer)) {
|
|
2381
|
-
this.insertBlocksToRoot(blocks);
|
|
2382
|
-
// TODO: Need to check below logic, it seems not correct https://gethired.atlassian.net/browse/VD-7779
|
|
2383
|
-
}
|
|
2384
|
-
else if (this.isEmptyParagraph(startContainer)) {
|
|
2385
|
-
this.insertBlocksBeforeEmptyBlock(blocks);
|
|
2386
|
-
}
|
|
2387
|
-
else {
|
|
2388
|
-
this.insertBlocksToContent(blocks);
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
/**
|
|
2392
|
-
* Insert the blocks to root
|
|
2393
|
-
*
|
|
2394
|
-
* @param { RTEContentBlock[]} blocks - blocks
|
|
2395
|
-
*/
|
|
2396
|
-
insertBlocksToRoot(blocks) {
|
|
2397
|
-
this.currentState.apply(new AppendChildrenAction(blocks));
|
|
2398
|
-
}
|
|
2399
|
-
/**
|
|
2400
|
-
* Insert the blocks to content
|
|
2401
|
-
*
|
|
2402
|
-
* @param { RTEContentBlock[]} blocks - blocks
|
|
2403
|
-
*/
|
|
2404
|
-
insertBlocksToContent(blocks) {
|
|
2405
|
-
const cursorNode = this.removeSelectionRange();
|
|
2406
|
-
if (cursorNode && cursorNode.parent) {
|
|
2407
|
-
const { startOffset } = this.selectionController.getCurrentRange();
|
|
2408
|
-
const pasteAction = new PasteContentAction(blocks, cursorNode, startOffset);
|
|
2409
|
-
cursorNode.parent.apply(pasteAction);
|
|
2410
|
-
if (pasteAction.futureFocusBlock) {
|
|
2411
|
-
this.switchCaretPositionToNextElement(pasteAction.futureFocusBlock);
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
/**
|
|
2416
|
-
* Insert the blocks before to current block
|
|
2417
|
-
*
|
|
2418
|
-
* @param { RTEContentBlock[]} blocks - blocks
|
|
2419
|
-
*/
|
|
2420
|
-
insertBlocksBeforeEmptyBlock(blocks) {
|
|
2421
|
-
const cursorNode = this.removeSelectionRange();
|
|
2422
|
-
/* istanbul ignore next */
|
|
2423
|
-
const currentBlock = cursorNode === null || cursorNode === void 0 ? void 0 : cursorNode.parent;
|
|
2424
|
-
if (currentBlock) {
|
|
2425
|
-
const pasteAction = new PasteContentAction(blocks, currentBlock.children[0], 0, this.selectionController.getCurrentRange());
|
|
2426
|
-
currentBlock.apply(pasteAction);
|
|
2427
|
-
if (pasteAction.futureFocusBlock) {
|
|
2428
|
-
this.switchCaretPositionToNextElement(pasteAction.futureFocusBlock);
|
|
2429
|
-
}
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
/**
|
|
2433
|
-
* Format and parse elements from user paste with simple style preservation.
|
|
2434
|
-
*
|
|
2435
|
-
* @param {InputEvent} event - Paste event.
|
|
2436
|
-
* @returns {RTEContentBlock[]} - RTEContentBlock.
|
|
2437
|
-
*/
|
|
2438
|
-
parsePastedElements(event) {
|
|
2439
|
-
let pastedHTML = event.dataTransfer.getData('text/html');
|
|
2440
|
-
if (!pastedHTML) {
|
|
2441
|
-
const pastedText = event.dataTransfer.getData('text/plain');
|
|
2442
|
-
pastedHTML = this.parsePlainText(pastedText);
|
|
2443
|
-
}
|
|
2444
|
-
const context = StylePreservator.preserve(pastedHTML);
|
|
2445
|
-
const safeHtml = context.getProcessedHtml();
|
|
2446
|
-
const parser = new DOMParser();
|
|
2447
|
-
const parsedDoc = parser.parseFromString(safeHtml, 'text/html');
|
|
2448
|
-
const htmlElements = Array.from(parsedDoc.body.childNodes);
|
|
2449
|
-
context.restore(htmlElements);
|
|
2450
|
-
return ElementToDtoStrategyProcessor.process(htmlElements)
|
|
2451
|
-
.filter(Boolean)
|
|
2452
|
-
.map((output) => output.toDto())
|
|
2453
|
-
.filter(Boolean);
|
|
2454
|
-
}
|
|
2455
|
-
/**
|
|
2456
|
-
* Moves the caret to the next block element in a rich text editor.
|
|
2457
|
-
*
|
|
2458
|
-
* @param {RTEBlock} newBlock - Represents a new create block element in a rich text editor.
|
|
2459
|
-
*/
|
|
2460
|
-
switchCaretPositionToNextElement(newBlock) {
|
|
2461
|
-
if (newBlock && newBlock.children) {
|
|
2462
|
-
this.selectionController.enqueueSelectionRangeFutureState(newBlock.children[0], 0);
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
/**
|
|
2466
|
-
* Parses the content of a plain text and formats it into HTML.
|
|
2467
|
-
*
|
|
2468
|
-
* @param {string} content - The content of plain text.
|
|
2469
|
-
* @returns {string} - The formatted HTML string.
|
|
2470
|
-
*/
|
|
2471
|
-
parsePlainText(content) {
|
|
2472
|
-
const lines = content.split('\n');
|
|
2473
|
-
return lines
|
|
2474
|
-
.map((line) => {
|
|
2475
|
-
if (line === '') {
|
|
2476
|
-
return '<p>\n</p>';
|
|
2477
|
-
}
|
|
2478
|
-
return `<p>${line}</p>`;
|
|
2479
|
-
})
|
|
2480
|
-
.join('');
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
|
-
|
|
2484
|
-
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2485
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2486
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2487
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2488
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2489
|
-
};
|
|
2490
|
-
/** Used to monitoring the user input actions by event listener */
|
|
2491
|
-
class UserInputController extends VegaSlimmer {
|
|
2492
|
-
constructor() {
|
|
2493
|
-
super(...arguments);
|
|
2494
|
-
this.insertTextHandler = new InsertTextHandler();
|
|
2495
|
-
this.insertParagraphHandler = new InsertParagraphHandler();
|
|
2496
|
-
this.insertLineBreakHandler = new InsertLineBreakHandler();
|
|
2497
|
-
this.deleteContentHandler = new DeleteContentHandler();
|
|
2498
|
-
this.insertPasteHandler = new InsertPasteHandler();
|
|
2499
|
-
/**
|
|
2500
|
-
* When a user performs an input action within the editable element, this function is triggered.
|
|
2501
|
-
*
|
|
2502
|
-
* @param {InputEvent} e the before input event object
|
|
2503
|
-
*/
|
|
2504
|
-
this.handleUserInputAction = (e) => {
|
|
2505
|
-
const inputType = e.inputType;
|
|
2506
|
-
e.preventDefault();
|
|
2507
|
-
this.initValueIfEmpty();
|
|
2508
|
-
// The insertCompositionText type input event can not be prevented, so we process the current action by insertCompositionTextController.
|
|
2509
|
-
// If the focus node is a non-editable element, we do not process the input event.
|
|
2510
|
-
if (inputType === 'insertCompositionText' || this.isFocusNodeNonEditable()) {
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
this.insertCompositionTextController.removeObserver();
|
|
2514
|
-
let updateFlag = false;
|
|
2515
|
-
switch (inputType) {
|
|
2516
|
-
case 'insertParagraph':
|
|
2517
|
-
updateFlag = true;
|
|
2518
|
-
this.insertParagraphHandler.execute(this.value, this.selectionController, this.host, e);
|
|
2519
|
-
break;
|
|
2520
|
-
case 'insertText':
|
|
2521
|
-
updateFlag = true;
|
|
2522
|
-
this.insertTextHandler.execute(this.value, this.selectionController, this.host, e);
|
|
2523
|
-
break;
|
|
2524
|
-
case 'insertLineBreak':
|
|
2525
|
-
updateFlag = true;
|
|
2526
|
-
this.insertLineBreakHandler.execute(this.value, this.selectionController, this.host, e);
|
|
2527
|
-
break;
|
|
2528
|
-
case 'deleteContentBackward':
|
|
2529
|
-
updateFlag = true;
|
|
2530
|
-
this.deleteContentHandler.execute(this.value, this.selectionController, this.host, e);
|
|
2531
|
-
break;
|
|
2532
|
-
case 'insertFromPaste':
|
|
2533
|
-
updateFlag = true;
|
|
2534
|
-
this.insertPasteHandler.execute(this.value, this.selectionController, this.host, e);
|
|
2535
|
-
break;
|
|
2536
|
-
}
|
|
2537
|
-
if (updateFlag) {
|
|
2538
|
-
void this.valueController.flushChanges(this.value);
|
|
2539
|
-
}
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
|
-
/**
|
|
2543
|
-
* Adds event listener to an editable HTML element to handle user input actions.
|
|
2544
|
-
*/
|
|
2545
|
-
addActionListener() {
|
|
2546
|
-
const editableElement = this.getEditableElementRef();
|
|
2547
|
-
if (editableElement) {
|
|
2548
|
-
editableElement.addEventListener('beforeinput', this.handleUserInputAction);
|
|
2549
|
-
editableElement.addEventListener('drop', this.preventDropEvent);
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
/**
|
|
2553
|
-
* Removes event listener for user input actions from an editable HTML div element.
|
|
2554
|
-
*/
|
|
2555
|
-
removeActionListener() {
|
|
2556
|
-
const editableElement = this.getEditableElementRef();
|
|
2557
|
-
if (editableElement) {
|
|
2558
|
-
editableElement.removeEventListener('beforeinput', this.handleUserInputAction);
|
|
2559
|
-
editableElement.removeEventListener('drop', this.preventDropEvent);
|
|
2560
|
-
}
|
|
2561
|
-
}
|
|
2562
|
-
/**
|
|
2563
|
-
* The function `getEditableElementRef` returns a reference to the editable HTMLDivElement within a rich text editor.
|
|
2564
|
-
*
|
|
2565
|
-
* @returns {Nullable<HTMLDivElement>} A reference to an HTMLDivElement element that is editable.
|
|
2566
|
-
*/
|
|
2567
|
-
getEditableElementRef() {
|
|
2568
|
-
if (!this.editableElementRef) {
|
|
2569
|
-
this.editableElementRef = this.vegaRichTextEditorRenderer.getRTEEditableElementRef();
|
|
2570
|
-
}
|
|
2571
|
-
return this.editableElementRef;
|
|
2572
|
-
}
|
|
2573
|
-
/**
|
|
2574
|
-
* Prevents the default behavior of a drag event.
|
|
2575
|
-
*
|
|
2576
|
-
* @param {DragEvent} e - drop event object
|
|
2577
|
-
*/
|
|
2578
|
-
preventDropEvent(e) {
|
|
2579
|
-
e.preventDefault();
|
|
2580
|
-
}
|
|
2581
|
-
/**
|
|
2582
|
-
* Initializes the value to an empty array if it is currently empty.
|
|
2583
|
-
*/
|
|
2584
|
-
initValueIfEmpty() {
|
|
2585
|
-
if (!this.value) {
|
|
2586
|
-
const id = generateUUID();
|
|
2587
|
-
const defaultParagraph = [
|
|
2588
|
-
{ id, type: 'paragraph', nodes: [{ id: `${id}1`, type: 'text', text: '' }] },
|
|
2589
|
-
];
|
|
2590
|
-
void this.valueController.flushChanges(VegaRTEContent.fromJSON(defaultParagraph));
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
/**
|
|
2594
|
-
* The code block placeholder element is non-editable, so we need to check if the focus node is a code block placeholder element.
|
|
2595
|
-
*
|
|
2596
|
-
* @returns {boolean} - Returns true if the focus node is a code block placeholder element, otherwise false.
|
|
2597
|
-
*/
|
|
2598
|
-
isFocusNodeNonEditable() {
|
|
2599
|
-
const { startContainer, endContainer } = this.selectionController.getCurrentRange();
|
|
2600
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2601
|
-
if (startContainer && startContainer === endContainer && selectedNodes.length === 0) {
|
|
2602
|
-
const focusElement = startContainer.nodeType === Node.ELEMENT_NODE
|
|
2603
|
-
? startContainer
|
|
2604
|
-
: startContainer.parentElement;
|
|
2605
|
-
return (focusElement &&
|
|
2606
|
-
focusElement.classList.contains(RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME));
|
|
2607
|
-
}
|
|
2608
|
-
return false;
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
__decorate$a([
|
|
2612
|
-
MapToComponentField()
|
|
2613
|
-
], UserInputController.prototype, "host", void 0);
|
|
2614
|
-
__decorate$a([
|
|
2615
|
-
MapToComponentField()
|
|
2616
|
-
], UserInputController.prototype, "value", void 0);
|
|
2617
|
-
__decorate$a([
|
|
2618
|
-
MapToComponentField()
|
|
2619
|
-
], UserInputController.prototype, "valueController", void 0);
|
|
2620
|
-
__decorate$a([
|
|
2621
|
-
MapToComponentField()
|
|
2622
|
-
], UserInputController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
2623
|
-
__decorate$a([
|
|
2624
|
-
MapToComponentField()
|
|
2625
|
-
], UserInputController.prototype, "selectionController", void 0);
|
|
2626
|
-
__decorate$a([
|
|
2627
|
-
MapToComponentField()
|
|
2628
|
-
], UserInputController.prototype, "insertCompositionTextController", void 0);
|
|
2629
|
-
__decorate$a([
|
|
2630
|
-
MapToComponentMethod('componentDidLoad')
|
|
2631
|
-
], UserInputController.prototype, "addActionListener", null);
|
|
2632
|
-
__decorate$a([
|
|
2633
|
-
MapToComponentMethod('disconnectedCallback')
|
|
2634
|
-
], UserInputController.prototype, "removeActionListener", null);
|
|
2635
|
-
|
|
2636
|
-
/**
|
|
2637
|
-
* Insert the image to current block. if the block is not image block, this will split the block to two blocks
|
|
2638
|
-
*
|
|
2639
|
-
* @example block.apply(new InsertImageToBlockAction(node, offset, imageNode))
|
|
2640
|
-
*/
|
|
2641
|
-
class InsertImageToBlockAction extends ModifyContentAction {
|
|
2642
|
-
constructor(splitPointNode, startOffsetOfNode, imageBlockToBeInserted) {
|
|
2643
|
-
super();
|
|
2644
|
-
this.isFlushable = true;
|
|
2645
|
-
this.type = ModifyContentActionType.INSERT_IMAGE_TO_BLOCK;
|
|
2646
|
-
this.splitPointNode = splitPointNode;
|
|
2647
|
-
this.startOffsetOfNode = startOffsetOfNode;
|
|
2648
|
-
this.imageBlockToBeInserted = imageBlockToBeInserted;
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
|
|
2652
|
-
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2653
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2654
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2655
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2656
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2657
|
-
};
|
|
2658
|
-
/** Used to control the insert image tool button actions */
|
|
2659
|
-
class InsertImageController extends VegaSlimmer {
|
|
2660
|
-
/**
|
|
2661
|
-
* Insert a image to current state
|
|
2662
|
-
*
|
|
2663
|
-
* @param {string} imageUrl The image url
|
|
2664
|
-
* @returns {RTEImageNode} RTEImageNode
|
|
2665
|
-
*/
|
|
2666
|
-
insertImageToCaretPosition(imageUrl) {
|
|
2667
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2668
|
-
const imageBlock = new RTEImageBlock(generateUUID());
|
|
2669
|
-
const newImageNode = new RTEImageNode(generateUUID(), imageUrl, imageBlock);
|
|
2670
|
-
newImageNode.apply(new ImageAnnotationAction('md', ''));
|
|
2671
|
-
imageBlock.apply(new AppendChildrenAction([newImageNode]));
|
|
2672
|
-
if (selectedBlocks.length < 1 || this.value.children.length < 1) {
|
|
2673
|
-
this.value.apply(new AppendChildrenAction([imageBlock]));
|
|
2674
|
-
void this.valueController.flushChanges(this.value);
|
|
2675
|
-
}
|
|
2676
|
-
else {
|
|
2677
|
-
const { startOffset } = this.selectionController.getCurrentRange();
|
|
2678
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2679
|
-
selectedBlocks[0].apply(new InsertImageToBlockAction(selectedNodes[0], startOffset, imageBlock));
|
|
2680
|
-
}
|
|
2681
|
-
this.updateCaretPosition(newImageNode);
|
|
2682
|
-
return newImageNode;
|
|
2683
|
-
}
|
|
2684
|
-
/**
|
|
2685
|
-
* Add image selected observer
|
|
2686
|
-
*/
|
|
2687
|
-
registerObserver() {
|
|
2688
|
-
this.registerImageSelectedObserver();
|
|
2689
|
-
}
|
|
2690
|
-
/**
|
|
2691
|
-
* remove the observer when component removed
|
|
2692
|
-
*/
|
|
2693
|
-
unRegisterObserver() {
|
|
2694
|
-
this.removeImageSelectedObserver();
|
|
2695
|
-
}
|
|
2696
|
-
/**
|
|
2697
|
-
* Updates the caret position to the parent element of a new image node.
|
|
2698
|
-
*
|
|
2699
|
-
* @param {RTEImageNode} newImageNode - An image node in a rich text editor.
|
|
2700
|
-
*/
|
|
2701
|
-
updateCaretPosition(newImageNode) {
|
|
2702
|
-
this.selectionController.enqueueSelectionRangeFutureState(newImageNode, 1);
|
|
2703
|
-
}
|
|
2704
|
-
/**
|
|
2705
|
-
* The current selected node should be current image node after click image.
|
|
2706
|
-
*/
|
|
2707
|
-
registerImageSelectedObserver() {
|
|
2708
|
-
const richTextContentRef = this.vegaRichTextEditorRenderer.getRichTextContentRef();
|
|
2709
|
-
if (richTextContentRef) {
|
|
2710
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(richTextContentRef, VegaInternalRichTextImageClick, (payload) => {
|
|
2711
|
-
const range = this.selectionController.getCurrentRange();
|
|
2712
|
-
if (!range || range.startContainer !== payload.host || range.startOffset !== 0) {
|
|
2713
|
-
const imageNode = stateEntityRenderingRegistry.getEntityByDOM(payload.host.querySelector('img'));
|
|
2714
|
-
this.selectionController.enqueueSelectionRangeFutureState(imageNode, 0, imageNode, 0, true);
|
|
2715
|
-
}
|
|
2716
|
-
});
|
|
2717
|
-
/*
|
|
2718
|
-
* The below method is e2e-test covered in
|
|
2719
|
-
* @see{module:vega-rich-text-editor-image-click-delete-button}
|
|
2720
|
-
*/
|
|
2721
|
-
/* istanbul ignore next */
|
|
2722
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(richTextContentRef, VegaInternalRichTextImageDeleteButtonClicked, (payload) => {
|
|
2723
|
-
const range = this.selectionController.getCurrentRange();
|
|
2724
|
-
if (!range || range.startContainer !== payload.host || range.startOffset !== 1) {
|
|
2725
|
-
this.selectionController.enqueueSelectionRangeFutureState(payload.host, 1, payload.host, 1, true);
|
|
2726
|
-
}
|
|
2727
|
-
});
|
|
2728
|
-
}
|
|
2729
|
-
}
|
|
2730
|
-
/**
|
|
2731
|
-
* remove the observer after component delete
|
|
2732
|
-
*/
|
|
2733
|
-
removeImageSelectedObserver() {
|
|
2734
|
-
const richTextContentRef = this.vegaRichTextEditorRenderer.getRichTextContentRef();
|
|
2735
|
-
if (richTextContentRef) {
|
|
2736
|
-
DomNodeSubjectObserverFactory.removeUniqueObserverFromNode(richTextContentRef, VegaInternalRichTextImageClick);
|
|
2737
|
-
DomNodeSubjectObserverFactory.removeUniqueObserverFromNode(richTextContentRef, VegaInternalRichTextImageDeleteButtonClicked);
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2741
|
-
__decorate$9([
|
|
2742
|
-
MapToComponentField()
|
|
2743
|
-
], InsertImageController.prototype, "selectionController", void 0);
|
|
2744
|
-
__decorate$9([
|
|
2745
|
-
MapToComponentField()
|
|
2746
|
-
], InsertImageController.prototype, "value", void 0);
|
|
2747
|
-
__decorate$9([
|
|
2748
|
-
MapToComponentField()
|
|
2749
|
-
], InsertImageController.prototype, "valueController", void 0);
|
|
2750
|
-
__decorate$9([
|
|
2751
|
-
MapToComponentField()
|
|
2752
|
-
], InsertImageController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
2753
|
-
__decorate$9([
|
|
2754
|
-
MapToComponentMethod('componentDidLoad')
|
|
2755
|
-
], InsertImageController.prototype, "registerObserver", null);
|
|
2756
|
-
__decorate$9([
|
|
2757
|
-
MapToComponentMethod('disconnectedCallback')
|
|
2758
|
-
], InsertImageController.prototype, "unRegisterObserver", null);
|
|
2759
|
-
|
|
2760
|
-
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2761
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2762
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2763
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2764
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2765
|
-
};
|
|
2766
|
-
/**
|
|
2767
|
-
* Focus controller for RTE
|
|
2768
|
-
*/
|
|
2769
|
-
class FocusController extends VegaSlimmer {
|
|
2770
|
-
constructor() {
|
|
2771
|
-
super(...arguments);
|
|
2772
|
-
/**
|
|
2773
|
-
* Do a focus on the last text node of the last block
|
|
2774
|
-
*
|
|
2775
|
-
* @param {RTEContentBlock} lastBlock - The last block of the content
|
|
2776
|
-
*/
|
|
2777
|
-
this.doFocusOnLastTextNode = async (lastBlock) => {
|
|
2778
|
-
const lastNode = lastBlock.getLastNode();
|
|
2779
|
-
const dom = stateEntityRenderingRegistry.getDOMByEntity(lastNode);
|
|
2780
|
-
if (dom) {
|
|
2781
|
-
if (!lastNode.isContentEditable()) {
|
|
2782
|
-
this.setCaretRangeToNodeEnd(dom.parentElement, lastNode.getRangeEndOffset());
|
|
2783
|
-
}
|
|
2784
|
-
else {
|
|
2785
|
-
this.setCaretRangeToNodeEnd(dom.firstChild, dom.firstChild.nodeValue.length);
|
|
2786
|
-
}
|
|
2787
|
-
await this.vegaRichTextEditorRenderer.getRichTextContentRef().vegaFocus();
|
|
2788
|
-
}
|
|
2789
|
-
};
|
|
2790
|
-
}
|
|
2791
|
-
/**
|
|
2792
|
-
* Focus on the last text node of the last block.
|
|
2793
|
-
*
|
|
2794
|
-
* @param {{ newLine?: boolean }} options - The options of the method
|
|
2795
|
-
* @param {boolean} options.newLine - Should a new line be added before the last text node
|
|
2796
|
-
* @returns {Promise<void>} - A promise that resolves when the focus is set
|
|
2797
|
-
*/
|
|
2798
|
-
async focusOnLastTextNode(options) {
|
|
2799
|
-
const lastBlock = this.value.children[this.value.children.length - 1];
|
|
2800
|
-
if (!(lastBlock instanceof RTETextBlock) || (options === null || options === void 0 ? void 0 : options.newLine)) {
|
|
2801
|
-
const newTextBlock = RTETextBlock.from({
|
|
2802
|
-
id: generateUUID(),
|
|
2803
|
-
type: 'paragraph',
|
|
2804
|
-
nodes: [{ id: generateUUID(), type: 'text', text: '' }],
|
|
2805
|
-
});
|
|
2806
|
-
lastBlock.parent.apply(new InsertChildrenAfterAction(lastBlock, newTextBlock));
|
|
2807
|
-
await this.valueController.flushChanges(this.value);
|
|
2808
|
-
await this.doFocusOnLastTextNode(newTextBlock);
|
|
2809
|
-
}
|
|
2810
|
-
else {
|
|
2811
|
-
await this.doFocusOnLastTextNode(lastBlock);
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
/**
|
|
2815
|
-
* Move the caret to the end of the node
|
|
2816
|
-
*
|
|
2817
|
-
* @param {Node} targetNode - The node to move the caret to
|
|
2818
|
-
* @param {number} offset - The offset to move the caret to
|
|
2819
|
-
*/
|
|
2820
|
-
setCaretRangeToNodeEnd(targetNode, offset) {
|
|
2821
|
-
const range = new Range();
|
|
2822
|
-
range.setStart(targetNode, offset);
|
|
2823
|
-
this.selectionController.setSelectionRange(range);
|
|
2824
|
-
}
|
|
2825
|
-
}
|
|
2826
|
-
__decorate$8([
|
|
2827
|
-
MapToComponentField()
|
|
2828
|
-
], FocusController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
2829
|
-
__decorate$8([
|
|
2830
|
-
MapToComponentField()
|
|
2831
|
-
], FocusController.prototype, "selectionController", void 0);
|
|
2832
|
-
__decorate$8([
|
|
2833
|
-
MapToComponentField()
|
|
2834
|
-
], FocusController.prototype, "valueController", void 0);
|
|
2835
|
-
__decorate$8([
|
|
2836
|
-
MapToComponentField()
|
|
2837
|
-
], FocusController.prototype, "value", void 0);
|
|
2838
|
-
|
|
2839
|
-
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2840
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2841
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2842
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2843
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2844
|
-
};
|
|
2845
|
-
/**
|
|
2846
|
-
* Controller for the text node color
|
|
2847
|
-
*/
|
|
2848
|
-
class TextNodeColorController extends VegaSlimmer {
|
|
2849
|
-
/**
|
|
2850
|
-
* Component lifecycle - [connectedCallback]
|
|
2851
|
-
* Register an observer to watch for dark mode updates, which will update the color of text node .
|
|
2852
|
-
*/
|
|
2853
|
-
connectedCallback() {
|
|
2854
|
-
this.observer = new Observer(this.isAcceptObserver.bind(this), (isDark) => {
|
|
2855
|
-
const textNodeElements = TextNodeRenderingRegistry.getTextNodeElements();
|
|
2856
|
-
textNodeElements.forEach((textColorAnnotation, element) => {
|
|
2857
|
-
element.style.color = isDark
|
|
2858
|
-
? textColorAnnotation.textColor.dark
|
|
2859
|
-
: textColorAnnotation.textColor.light;
|
|
2860
|
-
});
|
|
2861
|
-
});
|
|
2862
|
-
ChangeManager.register(DARK_MODE_CHANGE, this.observer);
|
|
2863
|
-
}
|
|
2864
|
-
/**
|
|
2865
|
-
* cancel dark mode observer when disconnectedCallback
|
|
2866
|
-
*/
|
|
2867
|
-
disconnectResizeObserver() {
|
|
2868
|
-
ChangeManager.unregister(DARK_MODE_CHANGE, this.observer);
|
|
2869
|
-
}
|
|
2870
|
-
/**
|
|
2871
|
-
* Determines whether the observer should accept changes.
|
|
2872
|
-
*
|
|
2873
|
-
* @returns {boolean} Always returns true in the current implementation.
|
|
2874
|
-
*/
|
|
2875
|
-
isAcceptObserver() {
|
|
2876
|
-
return true;
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
__decorate$7([
|
|
2880
|
-
MapToComponentMethod('connectedCallback')
|
|
2881
|
-
], TextNodeColorController.prototype, "connectedCallback", null);
|
|
2882
|
-
__decorate$7([
|
|
2883
|
-
MapToComponentMethod('disconnectedCallback')
|
|
2884
|
-
], TextNodeColorController.prototype, "disconnectResizeObserver", null);
|
|
2885
|
-
|
|
2886
|
-
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2887
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2888
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2889
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2890
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2891
|
-
};
|
|
2892
|
-
/** Handles inserting composition text into a VegaRTEContent based on the current selection and input event. User input character will trigger this callback */
|
|
2893
|
-
class InsertCompositionTextController extends VegaSlimmer {
|
|
2894
|
-
constructor() {
|
|
2895
|
-
super(...arguments);
|
|
2896
|
-
this.insertCompositionTextEndFlag = true;
|
|
2897
|
-
this.observerOptions = {
|
|
2898
|
-
characterData: true,
|
|
2899
|
-
characterDataOldValue: true,
|
|
2900
|
-
subtree: true,
|
|
2901
|
-
childList: true,
|
|
2902
|
-
};
|
|
2903
|
-
/**
|
|
2904
|
-
* The current method is called when the insert text is update by the Pinyin input or the word correction plugin.
|
|
2905
|
-
*
|
|
2906
|
-
* @param {MutationRecord[]} records - The mutation record object array.
|
|
2907
|
-
*/
|
|
2908
|
-
this.updateTextFromDom = (records) => {
|
|
2909
|
-
let updateFlag = false;
|
|
2910
|
-
if (this.insertCompositionTextEndFlag !== false) {
|
|
2911
|
-
records.forEach((record) => {
|
|
2912
|
-
const { target, oldValue } = record;
|
|
2913
|
-
if (target.nodeType === Node.TEXT_NODE && target.parentElement) {
|
|
2914
|
-
const richTextNode = stateEntityRenderingRegistry.getEntityByDOM(target.parentElement);
|
|
2915
|
-
const newValue = target.textContent;
|
|
2916
|
-
if (richTextNode instanceof RTETextNode &&
|
|
2917
|
-
richTextNode.isContentEditable() &&
|
|
2918
|
-
richTextNode.parent instanceof RTETextBlock) {
|
|
2919
|
-
updateFlag = this.updateCurrentNodeText(richTextNode, newValue, oldValue);
|
|
2920
|
-
}
|
|
2921
|
-
else if (newValue) {
|
|
2922
|
-
// The text element should removed if insert text to the image block.
|
|
2923
|
-
target.parentElement.removeChild(target);
|
|
2924
|
-
updateFlag = true;
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
});
|
|
2928
|
-
}
|
|
2929
|
-
if (updateFlag) {
|
|
2930
|
-
void this.valueController.flushChanges(this.value);
|
|
2931
|
-
}
|
|
2932
|
-
};
|
|
2933
|
-
/**
|
|
2934
|
-
* Processes mutation records related to character data and updates the text content of a rich text node accordingly.
|
|
2935
|
-
*
|
|
2936
|
-
* @param {MutationRecord[]} records - Each `MutationRecord` object represents a single mutation that occurred in the DOM.
|
|
2937
|
-
*/
|
|
2938
|
-
this.handleObserver = (records) => {
|
|
2939
|
-
if (records.every((record) => record.type === 'characterData')) {
|
|
2940
|
-
this.updateTextFromDom(records);
|
|
2941
|
-
}
|
|
2942
|
-
};
|
|
2943
|
-
/**
|
|
2944
|
-
* An event handler function that is triggered when the composition of text input starts. In this case,
|
|
2945
|
-
* it sets the `insertCompositionTextEndFlag` property of the `UserInputController` class to `false`.
|
|
2946
|
-
*/
|
|
2947
|
-
this.handleCompositionStart = () => {
|
|
2948
|
-
this.insertCompositionTextEndFlag = false;
|
|
2949
|
-
ChangeManager.notify(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditDeleteSelectedNodes), { host: this.host, detail: true });
|
|
2950
|
-
};
|
|
2951
|
-
/**
|
|
2952
|
-
* An event handler function that is triggered when the composition of text input ends. In this case,
|
|
2953
|
-
* it sets the `insertCompositionTextEndFlag` property of the `UserInputController` class to `true`.
|
|
2954
|
-
*
|
|
2955
|
-
* @param {CompositionEvent} event The composition event instance
|
|
2956
|
-
*/
|
|
2957
|
-
this.handleCompositionEnd = (event) => {
|
|
2958
|
-
this.insertCompositionTextEndFlag = true;
|
|
2959
|
-
const insertData = event.data;
|
|
2960
|
-
if (insertData) {
|
|
2961
|
-
this.dispatchInsertTextEvent(insertData);
|
|
2962
|
-
}
|
|
2963
|
-
};
|
|
2964
|
-
}
|
|
2965
|
-
/**
|
|
2966
|
-
* The function `initMutationObserver` initializes a MutationObserver on an editable HTML element if it exists.
|
|
2967
|
-
*/
|
|
2968
|
-
initMutationObserver() {
|
|
2969
|
-
if (this.mutationObserver) {
|
|
2970
|
-
const editableElement = this.getEditableElementRef();
|
|
2971
|
-
if (editableElement) {
|
|
2972
|
-
this.mutationObserver.disconnect();
|
|
2973
|
-
this.mutationObserver.observe(editableElement, this.observerOptions);
|
|
2974
|
-
}
|
|
2975
|
-
}
|
|
2976
|
-
}
|
|
2977
|
-
/**
|
|
2978
|
-
* Disconnects the mutation observer if it exists.
|
|
2979
|
-
*/
|
|
2980
|
-
removeObserver() {
|
|
2981
|
-
if (this.mutationObserver) {
|
|
2982
|
-
this.mutationObserver.disconnect();
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
/**
|
|
2986
|
-
* The method is to get the composition text insert end or not.
|
|
2987
|
-
*
|
|
2988
|
-
* @returns {boolean} The false is main that insert composition text process is end.
|
|
2989
|
-
*/
|
|
2990
|
-
isComposing() {
|
|
2991
|
-
return !this.insertCompositionTextEndFlag;
|
|
2992
|
-
}
|
|
2993
|
-
/**
|
|
2994
|
-
* Adds event listener to an editable HTML element to handle composition text insert actions.
|
|
2995
|
-
*/
|
|
2996
|
-
addCompositionTextEventListener() {
|
|
2997
|
-
const editableElement = this.getEditableElementRef();
|
|
2998
|
-
if (editableElement) {
|
|
2999
|
-
editableElement.addEventListener('compositionstart', this.handleCompositionStart);
|
|
3000
|
-
editableElement.addEventListener('compositionend', this.handleCompositionEnd);
|
|
3001
|
-
}
|
|
3002
|
-
this.mutationObserver = new MutationObserver(this.handleObserver);
|
|
3003
|
-
this.initMutationObserver();
|
|
3004
|
-
}
|
|
3005
|
-
/**
|
|
3006
|
-
* Removes event listener to an editable HTML element to handle composition text insert actions.
|
|
3007
|
-
*/
|
|
3008
|
-
removeCompositionTextEventListener() {
|
|
3009
|
-
const editableElement = this.getEditableElementRef();
|
|
3010
|
-
if (editableElement) {
|
|
3011
|
-
editableElement.removeEventListener('compositionstart', this.handleCompositionStart);
|
|
3012
|
-
editableElement.removeEventListener('compositionend', this.handleCompositionEnd);
|
|
3013
|
-
}
|
|
3014
|
-
this.removeObserver();
|
|
3015
|
-
}
|
|
3016
|
-
/**
|
|
3017
|
-
* re-connect the observer after the props change and component did render
|
|
3018
|
-
*/
|
|
3019
|
-
reConnectObserver() {
|
|
3020
|
-
this.initMutationObserver();
|
|
3021
|
-
}
|
|
3022
|
-
/**
|
|
3023
|
-
* Insert text to a line break node need a special logic if the line break has a next text node.
|
|
3024
|
-
*
|
|
3025
|
-
* @param {RTETextNode} currentNode The current line break node, the text value is \n
|
|
3026
|
-
*/
|
|
3027
|
-
appendLineBreakNode(currentNode) {
|
|
3028
|
-
const textBlock = currentNode.parent;
|
|
3029
|
-
const index = textBlock.children.indexOf(currentNode);
|
|
3030
|
-
if (textBlock.children[index + 1]) {
|
|
3031
|
-
const newTextNode = currentNode.cloneWithText('\n');
|
|
3032
|
-
textBlock.apply(new InsertChildrenBeforeAction(textBlock.children[index + 1], newTextNode));
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
/**
|
|
3036
|
-
* Updates the text content of a rich text node and handles line breaks.
|
|
3037
|
-
*
|
|
3038
|
-
* @param {RTETextNode} richTextNode - The current rich text node.
|
|
3039
|
-
* @param {string} newValue - The target element textContent
|
|
3040
|
-
* @param {Nullable<string>} oldValue - The target element old textContent
|
|
3041
|
-
* @returns {Nullable<boolean>} The node text is updated or not
|
|
3042
|
-
*/
|
|
3043
|
-
updateCurrentNodeText(richTextNode, newValue, oldValue) {
|
|
3044
|
-
const insertText = this.removeZeroWidthSpace(newValue.replace(/(\n)$/, ''));
|
|
3045
|
-
if (richTextNode.text !== insertText) {
|
|
3046
|
-
const { startOffset } = this.selectionController.getCurrentRange();
|
|
3047
|
-
const currentIsLineBreakNode = richTextNode.text === '\n';
|
|
3048
|
-
richTextNode.apply(new UpdateTextAction(insertText));
|
|
3049
|
-
if (currentIsLineBreakNode) {
|
|
3050
|
-
this.appendLineBreakNode(richTextNode);
|
|
3051
|
-
}
|
|
3052
|
-
const lengthGap = oldValue ? oldValue.length - newValue.length : 0;
|
|
3053
|
-
const newOffset = Math.min(insertText.length, startOffset - lengthGap);
|
|
3054
|
-
this.selectionController.enqueueSelectionRangeFutureState(richTextNode, Math.max(0, newOffset));
|
|
3055
|
-
return true;
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
/**
|
|
3059
|
-
* The function `getEditableElementRef` returns a reference to the editable HTMLDivElement within a rich text editor.
|
|
3060
|
-
*
|
|
3061
|
-
* @returns {Nullable<HTMLDivElement>} A reference to an HTMLDivElement element that is editable.
|
|
3062
|
-
*/
|
|
3063
|
-
getEditableElementRef() {
|
|
3064
|
-
if (!this.editableElementRef) {
|
|
3065
|
-
this.editableElementRef = this.vegaRichTextEditorRenderer.getRTEEditableElementRef();
|
|
3066
|
-
}
|
|
3067
|
-
return this.editableElementRef;
|
|
3068
|
-
}
|
|
3069
|
-
/**
|
|
3070
|
-
* Remove the ZERO_WIDTH_SPACE from the text.
|
|
3071
|
-
*
|
|
3072
|
-
* @param {string} text The input text that could include ZERO_WIDTH_SPACE.
|
|
3073
|
-
* @returns {string} The result text.
|
|
3074
|
-
*/
|
|
3075
|
-
removeZeroWidthSpace(text) {
|
|
3076
|
-
if (text.startsWith(ZERO_WIDTH_SPACE)) {
|
|
3077
|
-
return text.slice(ZERO_WIDTH_SPACE.length);
|
|
3078
|
-
}
|
|
3079
|
-
else if (text.endsWith(ZERO_WIDTH_SPACE)) {
|
|
3080
|
-
return text.slice(0, text.length - ZERO_WIDTH_SPACE.length);
|
|
3081
|
-
}
|
|
3082
|
-
return text;
|
|
3083
|
-
}
|
|
3084
|
-
/**
|
|
3085
|
-
* Dispatch a insert text event to handle the composition text insert logic.
|
|
3086
|
-
*
|
|
3087
|
-
* @param {string} text - The text need to insert.
|
|
3088
|
-
*/
|
|
3089
|
-
dispatchInsertTextEvent(text) {
|
|
3090
|
-
const inputEvent = new CustomEvent('beforeinput');
|
|
3091
|
-
inputEvent['data'] = text;
|
|
3092
|
-
inputEvent['inputType'] = 'insertText';
|
|
3093
|
-
this.editableElementRef.dispatchEvent(inputEvent);
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
__decorate$6([
|
|
3097
|
-
MapToComponentField()
|
|
3098
|
-
], InsertCompositionTextController.prototype, "selectionController", void 0);
|
|
3099
|
-
__decorate$6([
|
|
3100
|
-
MapToComponentField()
|
|
3101
|
-
], InsertCompositionTextController.prototype, "host", void 0);
|
|
3102
|
-
__decorate$6([
|
|
3103
|
-
MapToComponentField()
|
|
3104
|
-
], InsertCompositionTextController.prototype, "value", void 0);
|
|
3105
|
-
__decorate$6([
|
|
3106
|
-
MapToComponentField()
|
|
3107
|
-
], InsertCompositionTextController.prototype, "valueController", void 0);
|
|
3108
|
-
__decorate$6([
|
|
3109
|
-
MapToComponentField()
|
|
3110
|
-
], InsertCompositionTextController.prototype, "userInputController", void 0);
|
|
3111
|
-
__decorate$6([
|
|
3112
|
-
MapToComponentField()
|
|
3113
|
-
], InsertCompositionTextController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
3114
|
-
__decorate$6([
|
|
3115
|
-
MapToComponentMethod('componentDidLoad')
|
|
3116
|
-
], InsertCompositionTextController.prototype, "addCompositionTextEventListener", null);
|
|
3117
|
-
__decorate$6([
|
|
3118
|
-
MapToComponentMethod('disconnectedCallback')
|
|
3119
|
-
], InsertCompositionTextController.prototype, "removeCompositionTextEventListener", null);
|
|
3120
|
-
__decorate$6([
|
|
3121
|
-
MapToComponentMethod('componentDidRender')
|
|
3122
|
-
], InsertCompositionTextController.prototype, "reConnectObserver", null);
|
|
3123
|
-
|
|
3124
|
-
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3125
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3126
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3127
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3128
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3129
|
-
};
|
|
3130
|
-
/**
|
|
3131
|
-
* The `DeleteSelectedNodesController` class provides methods to delete selected nodes.
|
|
3132
|
-
*/
|
|
3133
|
-
class DeleteSelectedNodesController extends VegaSlimmer {
|
|
3134
|
-
constructor() {
|
|
3135
|
-
super(...arguments);
|
|
3136
|
-
/**
|
|
3137
|
-
* Deletes the selected nodes.
|
|
3138
|
-
*
|
|
3139
|
-
* @param {NotifyObserverPayload<boolean>} payload The notify payload
|
|
3140
|
-
* @param {boolean} payload.detail The delete process need merge start node and end node or not, default value is true.
|
|
3141
|
-
*/
|
|
3142
|
-
this.deleteActionProcess = (payload) => {
|
|
3143
|
-
const range = this.selectionController.getCurrentRange();
|
|
3144
|
-
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
3145
|
-
if (startContainer !== endContainer || startOffset !== endOffset) {
|
|
3146
|
-
const cursorNode = this.removeSelectionRange();
|
|
3147
|
-
const mergeStartAndEndFlag = payload && payload.detail ? payload.detail : false;
|
|
3148
|
-
if (mergeStartAndEndFlag) {
|
|
3149
|
-
this.mergeRangeStartAndEnd(startContainer, endContainer);
|
|
3150
|
-
}
|
|
3151
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
|
|
3152
|
-
}
|
|
3153
|
-
};
|
|
3154
|
-
}
|
|
3155
|
-
/**
|
|
3156
|
-
* Adds the observer to the host element.
|
|
3157
|
-
*/
|
|
3158
|
-
addDeleteObserver() {
|
|
3159
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(this.host, VegaInternalRichTextEditDeleteSelectedNodes, this.deleteActionProcess);
|
|
3160
|
-
}
|
|
3161
|
-
/**
|
|
3162
|
-
* Removes the observer from the host element.
|
|
3163
|
-
*/
|
|
3164
|
-
removeDeleteObserver() {
|
|
3165
|
-
DomNodeSubjectObserverFactory.removeUniqueObserverFromNode(this.host, VegaInternalRichTextEditDeleteSelectedNodes);
|
|
3166
|
-
}
|
|
3167
|
-
/**
|
|
3168
|
-
* Removes selected nodes within a range in a rich text editor content.
|
|
3169
|
-
* The method is only used for different nodes are selected
|
|
3170
|
-
*
|
|
3171
|
-
* @returns {RTENode} The range start node, usually the start node is the first item of selectedNodes, if the selectedNodes is all removed, the start node will be a new text node.
|
|
3172
|
-
*/
|
|
3173
|
-
removeSelectionRange() {
|
|
3174
|
-
const range = this.selectionController.getCurrentRange();
|
|
3175
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
3176
|
-
const { endOffset, startOffset } = range;
|
|
3177
|
-
const startNode = selectedNodes[0];
|
|
3178
|
-
const endNode = selectedNodes[selectedNodes.length - 1];
|
|
3179
|
-
if (selectedNodes.length > 1) {
|
|
3180
|
-
// Remove all selected nodes except start node and end node(the end image node will be removed), the start node need to get the index of the block
|
|
3181
|
-
const shouldRemovedItems = selectedNodes.filter((item) => {
|
|
3182
|
-
if (item.isContentEditable()) {
|
|
3183
|
-
return item !== startNode && item !== endNode;
|
|
3184
|
-
}
|
|
3185
|
-
else {
|
|
3186
|
-
return (item !== startNode &&
|
|
3187
|
-
(item !== endNode || this.isEndNodeFullyInTheRange(endNode, endOffset, item)));
|
|
3188
|
-
}
|
|
3189
|
-
});
|
|
3190
|
-
shouldRemovedItems.forEach((item) => {
|
|
3191
|
-
item.parent.apply(new RemoveChildrenAction(item));
|
|
3192
|
-
});
|
|
3193
|
-
}
|
|
3194
|
-
this.removeRangeStartAndEndSelectedText();
|
|
3195
|
-
/**
|
|
3196
|
-
* if the range start node is image and the item is selected, so we need remove the image item, the image block will be removed if the item is the only item.
|
|
3197
|
-
* but before remove the image block, we need insert a paragraph to make sure the start block and start node could be get correct before insert text or break paragraph action.
|
|
3198
|
-
* the code block node should do the same logic.
|
|
3199
|
-
*/
|
|
3200
|
-
if (!startNode.isContentEditable() &&
|
|
3201
|
-
this.isStartNodeFullyInTheRange(startNode, endNode, startOffset, endOffset)) {
|
|
3202
|
-
// the image block will be deleted when the image is the only item
|
|
3203
|
-
if (startNode.parent.children.length === 1) {
|
|
3204
|
-
const paragraph = this.createEmptyParagraph();
|
|
3205
|
-
let shouldDeleteBlock = startNode.parent;
|
|
3206
|
-
// if the node grand parent is html block and the html block only has one child, we need insert the paragraph before the html block to jump out the html block
|
|
3207
|
-
if (shouldDeleteBlock.parent &&
|
|
3208
|
-
!(shouldDeleteBlock.parent instanceof VegaRTEContent) &&
|
|
3209
|
-
shouldDeleteBlock.parent.children.length === 1) {
|
|
3210
|
-
shouldDeleteBlock = shouldDeleteBlock.parent;
|
|
3211
|
-
}
|
|
3212
|
-
shouldDeleteBlock.parent.apply(new InsertChildrenBeforeAction(shouldDeleteBlock, paragraph));
|
|
3213
|
-
startNode.parent.apply(new RemoveChildrenAction(startNode));
|
|
3214
|
-
return paragraph.children[0];
|
|
3215
|
-
}
|
|
3216
|
-
else if (startNode === startNode.parent.children[0]) {
|
|
3217
|
-
// the start node should be the next image item if the image is first item
|
|
3218
|
-
startNode.parent.apply(new RemoveChildrenAction(startNode));
|
|
3219
|
-
return startNode.parent.children[0];
|
|
3220
|
-
}
|
|
3221
|
-
}
|
|
3222
|
-
return startNode;
|
|
3223
|
-
}
|
|
3224
|
-
/**
|
|
3225
|
-
* Removes the selected text at the start and end of a range in a Rich Text Editor.
|
|
3226
|
-
*/
|
|
3227
|
-
removeRangeStartAndEndSelectedText() {
|
|
3228
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
3229
|
-
const currentRange = this.selectionController.getCurrentRange();
|
|
3230
|
-
if (selectedNodes[0] instanceof RTETextNode && selectedNodes[0].isContentEditable()) {
|
|
3231
|
-
selectedNodes[0].apply(new ReplaceSelectedTextAction('', currentRange));
|
|
3232
|
-
}
|
|
3233
|
-
const endNode = selectedNodes[selectedNodes.length - 1];
|
|
3234
|
-
if (selectedNodes.length > 1 && endNode instanceof RTETextNode && endNode.isContentEditable()) {
|
|
3235
|
-
selectedNodes[selectedNodes.length - 1].apply(new ReplaceSelectedTextAction('', currentRange));
|
|
3236
|
-
}
|
|
3237
|
-
}
|
|
3238
|
-
/**
|
|
3239
|
-
* Creates a new paragraph with an empty text node and returns it.
|
|
3240
|
-
*
|
|
3241
|
-
* @returns {RTETextBlock} An empty paragraph with a unique identifier and a text node appended to it.
|
|
3242
|
-
*/
|
|
3243
|
-
createEmptyParagraph() {
|
|
3244
|
-
const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
|
|
3245
|
-
const textNode = new RTETextNode(`${paragraph.id}1`, '', paragraph);
|
|
3246
|
-
paragraph.apply(new AppendChildrenAction([textNode]));
|
|
3247
|
-
return paragraph;
|
|
3248
|
-
}
|
|
3249
|
-
/**
|
|
3250
|
-
* Merges text nodes in a rich text editor.
|
|
3251
|
-
*
|
|
3252
|
-
* @param {Node} startContainer - Start text node element
|
|
3253
|
-
* @param {Node} endContainer - End text node element
|
|
3254
|
-
*/
|
|
3255
|
-
mergeRangeStartAndEnd(startContainer, endContainer) {
|
|
3256
|
-
if (startContainer !== endContainer) {
|
|
3257
|
-
if (startContainer.nodeType === Node.TEXT_NODE && endContainer.nodeType === Node.TEXT_NODE) {
|
|
3258
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
3259
|
-
const startRTENode = selectedNodes[0];
|
|
3260
|
-
const endRTENode = selectedNodes[selectedNodes.length - 1];
|
|
3261
|
-
if (startRTENode && startRTENode.parent && endRTENode && endRTENode.parent) {
|
|
3262
|
-
const endBlock = endRTENode.parent;
|
|
3263
|
-
if (this.shouldMergeTextNode(startRTENode, endRTENode)) {
|
|
3264
|
-
startRTENode.apply(new UpdateTextAction(startRTENode.text + endRTENode.text));
|
|
3265
|
-
if (startRTENode.parent === endRTENode.parent) {
|
|
3266
|
-
startRTENode.parent.apply(new RemoveChildrenAction(endRTENode));
|
|
3267
|
-
}
|
|
3268
|
-
else {
|
|
3269
|
-
endRTENode.parent.apply(new RemoveChildrenAction(endRTENode.parent.children[0]));
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
if (startRTENode instanceof RTETextNode &&
|
|
3273
|
-
endRTENode instanceof RTETextNode &&
|
|
3274
|
-
startRTENode.parent !== endRTENode.parent) {
|
|
3275
|
-
startRTENode.parent.apply(new AppendChildrenAction(endBlock.children));
|
|
3276
|
-
endBlock.children = [];
|
|
3277
|
-
}
|
|
3278
|
-
if (endBlock.children.length < 1) {
|
|
3279
|
-
endBlock.parent.apply(new RemoveChildrenAction(endBlock));
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
}
|
|
3285
|
-
/**
|
|
3286
|
-
* Compares the annotations of two RTETextNodes to determine if they can be merged.
|
|
3287
|
-
*
|
|
3288
|
-
* @param {RTETextNode} nodeA - node A
|
|
3289
|
-
* @param {RTETextNode} nodeB - node B
|
|
3290
|
-
* @returns {boolean} true or false
|
|
3291
|
-
*/
|
|
3292
|
-
shouldMergeTextNode(nodeA, nodeB) {
|
|
3293
|
-
const { annotations: annotationsA } = nodeA.toJSON();
|
|
3294
|
-
const { annotations: annotationsB } = nodeB.toJSON();
|
|
3295
|
-
return (nodeA instanceof RTETextNode &&
|
|
3296
|
-
nodeB instanceof RTETextNode &&
|
|
3297
|
-
JSON.stringify(annotationsA) === JSON.stringify(annotationsB));
|
|
3298
|
-
}
|
|
3299
|
-
/**
|
|
3300
|
-
* Check the decorator node is fully in the range end.
|
|
3301
|
-
*
|
|
3302
|
-
* @param {RTENode} rangeEndNode - The end node of the range
|
|
3303
|
-
* @param {number} endOffset - The end offset of the range
|
|
3304
|
-
* @param {RTENode<RTEBlock>} checkedNode - The checked decorator node
|
|
3305
|
-
* @returns {boolean} - Whether the end node is fully within the range
|
|
3306
|
-
*/
|
|
3307
|
-
isEndNodeFullyInTheRange(rangeEndNode, endOffset, checkedNode) {
|
|
3308
|
-
if (checkedNode instanceof RTECodeBlockNode) {
|
|
3309
|
-
return true;
|
|
3310
|
-
}
|
|
3311
|
-
else {
|
|
3312
|
-
return checkedNode === rangeEndNode && endOffset !== 0;
|
|
3313
|
-
}
|
|
3314
|
-
}
|
|
3315
|
-
/**
|
|
3316
|
-
* Check if the start decorator node is fully in the range.
|
|
3317
|
-
*
|
|
3318
|
-
* @param {RTENode<RTEBlock>} rangeStartNode - The start node of the range
|
|
3319
|
-
* @param {RTENode} rangeEndNode - The end node of the range
|
|
3320
|
-
* @param {number} startOffset - The start offset of the range
|
|
3321
|
-
* @param {number} endOffset - The end offset of the range
|
|
3322
|
-
* @returns {boolean} - Whether the start node is fully within the range
|
|
3323
|
-
*/
|
|
3324
|
-
isStartNodeFullyInTheRange(rangeStartNode, rangeEndNode, startOffset, endOffset) {
|
|
3325
|
-
if (rangeStartNode instanceof RTECodeBlockNode) {
|
|
3326
|
-
return true;
|
|
3327
|
-
}
|
|
3328
|
-
else {
|
|
3329
|
-
return startOffset === 0 && (rangeEndNode !== rangeStartNode || endOffset !== 0);
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3333
|
-
__decorate$5([
|
|
3334
|
-
MapToComponentField()
|
|
3335
|
-
], DeleteSelectedNodesController.prototype, "host", void 0);
|
|
3336
|
-
__decorate$5([
|
|
3337
|
-
MapToComponentField()
|
|
3338
|
-
], DeleteSelectedNodesController.prototype, "selectionController", void 0);
|
|
3339
|
-
__decorate$5([
|
|
3340
|
-
MapToComponentField()
|
|
3341
|
-
], DeleteSelectedNodesController.prototype, "value", void 0);
|
|
3342
|
-
__decorate$5([
|
|
3343
|
-
MapToComponentMethod('connectedCallback')
|
|
3344
|
-
], DeleteSelectedNodesController.prototype, "addDeleteObserver", null);
|
|
3345
|
-
__decorate$5([
|
|
3346
|
-
MapToComponentMethod('disconnectedCallback')
|
|
3347
|
-
], DeleteSelectedNodesController.prototype, "removeDeleteObserver", null);
|
|
3348
|
-
|
|
3349
|
-
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3350
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3351
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3352
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3353
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3354
|
-
};
|
|
3355
|
-
/**
|
|
3356
|
-
* History controller for RTE.
|
|
3357
|
-
*/
|
|
3358
|
-
class HistoryController extends ComponentValueHistoryControllerSlimmer {
|
|
3359
|
-
constructor() {
|
|
3360
|
-
super(...arguments);
|
|
3361
|
-
/**
|
|
3362
|
-
* Gets the effective target elements for the RTE history.
|
|
3363
|
-
*
|
|
3364
|
-
* @returns {HTMLElement[]} - An array of effective target elements.
|
|
3365
|
-
*/
|
|
3366
|
-
this.getEffectiveTargets = () => {
|
|
3367
|
-
return [this.vegaRichTextEditorRenderer.getRTEEditableElementRef()];
|
|
3368
|
-
};
|
|
3369
|
-
/**
|
|
3370
|
-
* Gets the ineffective target elements for the RTE history.
|
|
3371
|
-
*
|
|
3372
|
-
* @returns {HTMLElement[]} - An array of ineffective target elements.
|
|
3373
|
-
*/
|
|
3374
|
-
this.getIneffectiveTargets = () => {
|
|
3375
|
-
const editorElementRef = this.vegaRichTextEditorRenderer.getRTEEditableElementRef();
|
|
3376
|
-
let result = [];
|
|
3377
|
-
if (editorElementRef) {
|
|
3378
|
-
result = Array.from(editorElementRef.querySelectorAll('.code-block-container'));
|
|
3379
|
-
}
|
|
3380
|
-
return result;
|
|
3381
|
-
};
|
|
3382
|
-
}
|
|
3383
|
-
/**
|
|
3384
|
-
* Component lifecycle - [componentDidLoad]
|
|
3385
|
-
*/
|
|
3386
|
-
registerInitState() {
|
|
3387
|
-
if (this.value) {
|
|
3388
|
-
this.registerHistory(new RTEEditorState(this.value, new RTESelectionState(this.selectionController.getCurrentRange())), true);
|
|
3389
|
-
}
|
|
3390
|
-
}
|
|
3391
|
-
/**
|
|
3392
|
-
* Restores the previous state from the undo stack.
|
|
3393
|
-
*/
|
|
3394
|
-
async undo() {
|
|
3395
|
-
if (this.undoStack.length > 1) {
|
|
3396
|
-
const clonedState = this.undoStack.pop().clone();
|
|
3397
|
-
this.redoStack.push(clonedState);
|
|
3398
|
-
const prev = this.undoStack[this.undoStack.length - 1];
|
|
3399
|
-
if (prev) {
|
|
3400
|
-
await this.restoreState(prev);
|
|
3401
|
-
}
|
|
3402
|
-
}
|
|
3403
|
-
}
|
|
3404
|
-
/**
|
|
3405
|
-
* Restores the next state from the redo stack.
|
|
3406
|
-
*/
|
|
3407
|
-
async redo() {
|
|
3408
|
-
if (this.redoStack.length > 0) {
|
|
3409
|
-
const clonedState = this.redoStack.pop().clone();
|
|
3410
|
-
this.undoStack.push(clonedState);
|
|
3411
|
-
await this.restoreState(clonedState);
|
|
3412
|
-
}
|
|
3413
|
-
}
|
|
3414
|
-
/**
|
|
3415
|
-
* Restores the editor state based on the provided history state.
|
|
3416
|
-
*
|
|
3417
|
-
* @param {RTEEditorState} state - The state to restore to.
|
|
3418
|
-
*/
|
|
3419
|
-
async restoreState(state) {
|
|
3420
|
-
const { content, selection } = state.clone();
|
|
3421
|
-
this.selectionController.setSelectionState(selection);
|
|
3422
|
-
await this.valueController.flushChanges(content, false);
|
|
3423
|
-
}
|
|
3424
|
-
}
|
|
3425
|
-
__decorate$4([
|
|
3426
|
-
MapToComponentField()
|
|
3427
|
-
], HistoryController.prototype, "host", void 0);
|
|
3428
|
-
__decorate$4([
|
|
3429
|
-
MapToComponentField()
|
|
3430
|
-
], HistoryController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
3431
|
-
__decorate$4([
|
|
3432
|
-
MapToComponentField()
|
|
3433
|
-
], HistoryController.prototype, "valueController", void 0);
|
|
3434
|
-
__decorate$4([
|
|
3435
|
-
MapToComponentField()
|
|
3436
|
-
], HistoryController.prototype, "value", void 0);
|
|
3437
|
-
__decorate$4([
|
|
3438
|
-
MapToComponentField()
|
|
3439
|
-
], HistoryController.prototype, "selectionController", void 0);
|
|
3440
|
-
__decorate$4([
|
|
3441
|
-
MapToComponentMethod('componentDidLoad')
|
|
3442
|
-
], HistoryController.prototype, "registerInitState", null);
|
|
3443
|
-
|
|
3444
|
-
const rectangleCode = {
|
|
3445
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill='currentColor' d="M320.1 175L384.1 239C394.3 248.4 394.3 263.6 384.1 272.1L320.1 336.1C311.6 346.3 296.4 346.3 287 336.1C277.7 327.6 277.7 312.4 287 303L334.1 256L287 208.1C277.7 199.6 277.7 184.4 287 175C296.4 165.7 311.6 165.7 320.1 175V175zM177.9 256L224.1 303C234.3 312.4 234.3 327.6 224.1 336.1C215.6 346.3 200.4 346.3 191 336.1L127 272.1C117.7 263.6 117.7 248.4 127 239L191 175C200.4 165.7 215.6 165.7 224.1 175C234.3 184.4 234.3 199.6 224.1 208.1L177.9 256zM448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM448 80H64C55.16 80 48 87.16 48 96V416C48 424.8 55.16 432 64 432H448C456.8 432 464 424.8 464 416V96C464 87.16 456.8 80 448 80z"/></svg>`,
|
|
3446
|
-
};
|
|
3447
|
-
|
|
3448
|
-
/**
|
|
3449
|
-
* Transform the selected blocks to a code block.
|
|
3450
|
-
*
|
|
3451
|
-
* @example firstBlock.parent.apply(new TransformToCodeBlockAction(selectedBlocks))
|
|
3452
|
-
*/
|
|
3453
|
-
class TransformToCodeBlockAction extends ModifyContentAction {
|
|
3454
|
-
constructor(selectedBlocks) {
|
|
3455
|
-
super();
|
|
3456
|
-
this.type = ModifyContentActionType.TRANSFORM_TO_CODE_BLOCK;
|
|
3457
|
-
this.selectedBlocks = selectedBlocks;
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3460
|
-
|
|
3461
|
-
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3462
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3463
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3464
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3465
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3466
|
-
};
|
|
3467
|
-
/**
|
|
3468
|
-
* The code block toolbar button slimmer.
|
|
3469
|
-
*/
|
|
3470
|
-
class CodeBlockToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
3471
|
-
constructor() {
|
|
3472
|
-
super({
|
|
3473
|
-
icon: 'rectangle-code',
|
|
3474
|
-
tooltip: { text: 'Code Block' },
|
|
3475
|
-
});
|
|
3476
|
-
}
|
|
3477
|
-
/**
|
|
3478
|
-
* The selected blocks should convert to a code block.
|
|
3479
|
-
*/
|
|
3480
|
-
onClick() {
|
|
3481
|
-
const selected = this.isSelected();
|
|
3482
|
-
if (!selected) {
|
|
3483
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
3484
|
-
const parentBlock = selectedBlocks[0].parent;
|
|
3485
|
-
const transformToCodeBlockAction = new TransformToCodeBlockAction(selectedBlocks);
|
|
3486
|
-
parentBlock.apply(transformToCodeBlockAction);
|
|
3487
|
-
void this.valueController.flushChanges(this.value);
|
|
3488
|
-
this.selectionController.enqueueSelectionRangeFutureState(transformToCodeBlockAction.newCodeBlock.children[0], 0);
|
|
3489
|
-
}
|
|
3490
|
-
}
|
|
3491
|
-
/**
|
|
3492
|
-
* The button will be selected if the selected blocks all code block.
|
|
3493
|
-
*
|
|
3494
|
-
* @returns {boolean} - The code block should selected or not.
|
|
3495
|
-
*/
|
|
3496
|
-
isSelected() {
|
|
3497
|
-
const selectBlocks = this.selectionController.getSelectedBlocks();
|
|
3498
|
-
if (selectBlocks.length && selectBlocks.every((block) => block.type === 'code-block')) {
|
|
3499
|
-
return true;
|
|
3500
|
-
}
|
|
3501
|
-
return false;
|
|
3502
|
-
}
|
|
3503
|
-
isDisabled() {
|
|
3504
|
-
const selectBlocks = this.selectionController.getSelectedBlocks();
|
|
3505
|
-
return (super.isDisabled() ||
|
|
3506
|
-
selectBlocks.some((block) => !(block instanceof RTECodeBlock) && this.shouldDisabledCodeBlockToolbar(block)));
|
|
3507
|
-
}
|
|
3508
|
-
shouldDisabledCodeBlockToolbar(block) {
|
|
3509
|
-
return (block &&
|
|
3510
|
-
!(block instanceof RTETextBlock &&
|
|
3511
|
-
ActionHandleStrategyRegistry.canHandle(ModifyContentActionType.TRANSFORM_TO_CODE_BLOCK, block.parent)));
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
(() => {
|
|
3515
|
-
VegaInternalIconManager.register({ 'rectangle-code': rectangleCode });
|
|
3516
|
-
})();
|
|
3517
|
-
__decorate$3([
|
|
3518
|
-
MapToComponentField()
|
|
3519
|
-
], CodeBlockToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
3520
|
-
__decorate$3([
|
|
3521
|
-
MapToComponentField()
|
|
3522
|
-
], CodeBlockToolbarButtonSlimmer.prototype, "valueController", void 0);
|
|
3523
|
-
__decorate$3([
|
|
3524
|
-
MapToComponentField()
|
|
3525
|
-
], CodeBlockToolbarButtonSlimmer.prototype, "value", void 0);
|
|
3526
|
-
|
|
3527
|
-
/**
|
|
3528
|
-
* The rich text internal code block selection controller.
|
|
3529
|
-
*/
|
|
3530
|
-
class InternalCodeBlockSelectionController extends AutoRunWhenReRenderTaskQueueSlimmer {
|
|
3531
|
-
constructor() {
|
|
3532
|
-
super(1);
|
|
3533
|
-
this.focusNodeOffset = 0;
|
|
3534
|
-
/**
|
|
3535
|
-
* The method invoke after the component re-render.
|
|
3536
|
-
*/
|
|
3537
|
-
this.doTask = async () => {
|
|
3538
|
-
await this.focusTheCodeBlock(this.shouldFocusNode);
|
|
3539
|
-
};
|
|
3540
|
-
}
|
|
3541
|
-
/**
|
|
3542
|
-
* Update the internal code block selection.
|
|
3543
|
-
*
|
|
3544
|
-
* @param {RTECodeBlockNode} startNode - The internal code block node DTO.
|
|
3545
|
-
* @param {number} startOffset - The content offset.
|
|
3546
|
-
* @param {boolean} immediatelyRun - Whether to invoke the method immediately.
|
|
3547
|
-
*/
|
|
3548
|
-
enqueueSelectionRangeFutureState(startNode, startOffset, immediatelyRun) {
|
|
3549
|
-
this.shouldFocusNode = startNode;
|
|
3550
|
-
this.focusNodeOffset = startOffset;
|
|
3551
|
-
super.enqueueTheTaskIntoQueue(immediatelyRun);
|
|
3552
|
-
}
|
|
3553
|
-
/**
|
|
3554
|
-
* Check the code block is actually selected or not. Because the Code block is a shadow dom, so can't detect the content selected state.
|
|
3555
|
-
* We add two placeholder spans at the begin and end position, we could check the placeholder spans selected state to make sure the code block is selected or not.
|
|
3556
|
-
*
|
|
3557
|
-
*
|
|
3558
|
-
* @example
|
|
3559
|
-
* <div>
|
|
3560
|
-
* <span></span>
|
|
3561
|
-
* <vega-code-block></vega-code-block>
|
|
3562
|
-
* <span><span>
|
|
3563
|
-
* </div>
|
|
3564
|
-
* @param {RTECodeBlock} codeBlock - The code block DTO.
|
|
3565
|
-
* @param {Range} range - The range instance.
|
|
3566
|
-
* @returns {boolean} - The boolean result.
|
|
3567
|
-
*/
|
|
3568
|
-
isCodeBlockSelected(codeBlock, range) {
|
|
3569
|
-
const codeBlockNode = codeBlock.children[0];
|
|
3570
|
-
const entityDom = stateEntityRenderingRegistry.getDOMByEntity(codeBlockNode);
|
|
3571
|
-
return (codeBlock.isSelected() ||
|
|
3572
|
-
(entityDom &&
|
|
3573
|
-
range.intersectsNode(entityDom.nextSibling) &&
|
|
3574
|
-
range.intersectsNode(entityDom.previousSibling)));
|
|
3575
|
-
}
|
|
3576
|
-
/**
|
|
3577
|
-
* Focus the code block component.
|
|
3578
|
-
*
|
|
3579
|
-
* @param {RTECodeBlockNode} node - The code block node DTO.
|
|
3580
|
-
*/
|
|
3581
|
-
async focusTheCodeBlock(node) {
|
|
3582
|
-
await Promise.resolve();
|
|
3583
|
-
const entityDom = stateEntityRenderingRegistry.getDOMByEntity(node);
|
|
3584
|
-
if (entityDom) {
|
|
3585
|
-
void entityDom.doFocus();
|
|
3586
|
-
}
|
|
3587
|
-
}
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3590
|
-
const displayCode = {
|
|
3591
|
-
icon: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path fill="currentColor" d="M512 48c8.8 0 16 7.2 16 16V352c0 8.8-7.2 16-16 16H336.5c-.3 0-.6 0-.8 0H240.4c-.3 0-.6 0-.8 0H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H512zM64 416H211.7l-8 48H152c-13.3 0-24 10.7-24 24s10.7 24 24 24h72H352h72c13.3 0 24-10.7 24-24s-10.7-24-24-24H372.3l-8-48H512c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64C28.7 0 0 28.7 0 64V352c0 35.3 28.7 64 64 64zm188.3 48l8-48h55.3l8 48H252.3zM249 177c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-48 48c-9.4 9.4-9.4 24.6 0 33.9l48 48c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-31-31 31-31zM361 143c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l31 31-31 31c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l48-48c9.4-9.4 9.4-24.6 0-33.9l-48-48z"/></svg>`,
|
|
3592
|
-
};
|
|
3593
|
-
|
|
3594
|
-
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3595
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3596
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3597
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3598
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3599
|
-
};
|
|
3600
|
-
class SourceEditToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
3601
|
-
constructor() {
|
|
3602
|
-
super({
|
|
3603
|
-
icon: 'display-code',
|
|
3604
|
-
tooltip: {
|
|
3605
|
-
text: 'Edit Source',
|
|
3606
|
-
},
|
|
3607
|
-
autoFocusOnClick: false,
|
|
3608
|
-
});
|
|
3609
|
-
}
|
|
3610
|
-
async onClick() {
|
|
3611
|
-
const isSelected = this.sourceView;
|
|
3612
|
-
if (isSelected) {
|
|
3613
|
-
await this.saveSourceCode();
|
|
3614
|
-
}
|
|
3615
|
-
else {
|
|
3616
|
-
this.selectionController.setSelectionRange(new Range());
|
|
3617
|
-
}
|
|
3618
|
-
this.sourceView = !isSelected;
|
|
3619
|
-
}
|
|
3620
|
-
isSelected() {
|
|
3621
|
-
return this.sourceView;
|
|
3622
|
-
}
|
|
3623
|
-
isDisabled() {
|
|
3624
|
-
return super.isDisabled();
|
|
3625
|
-
}
|
|
3626
|
-
async saveSourceCode() {
|
|
3627
|
-
const sourceViewValue = this.vegaRichTextEditorRenderer.getSourceCode();
|
|
3628
|
-
if (!sourceViewValue && this.value.isEmpty()) {
|
|
3629
|
-
return;
|
|
3630
|
-
}
|
|
3631
|
-
if (typeof sourceViewValue === 'string') {
|
|
3632
|
-
await this.valueController.flushChanges(VegaRTEContent.fromHtml(sourceViewValue, {
|
|
3633
|
-
autoMatchFormat: this.sourceEditConfig.autoMatchFormat,
|
|
3634
|
-
}));
|
|
3635
|
-
}
|
|
3636
|
-
}
|
|
3637
|
-
}
|
|
3638
|
-
(() => {
|
|
3639
|
-
VegaInternalIconManager.register({ 'display-code': displayCode });
|
|
3640
|
-
})();
|
|
3641
|
-
__decorate$2([
|
|
3642
|
-
MapToComponentField({ writable: true })
|
|
3643
|
-
], SourceEditToolbarButtonSlimmer.prototype, "sourceView", void 0);
|
|
3644
|
-
__decorate$2([
|
|
3645
|
-
MapToComponentField()
|
|
3646
|
-
], SourceEditToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
3647
|
-
__decorate$2([
|
|
3648
|
-
MapToComponentField()
|
|
3649
|
-
], SourceEditToolbarButtonSlimmer.prototype, "valueController", void 0);
|
|
3650
|
-
__decorate$2([
|
|
3651
|
-
MapToComponentField()
|
|
3652
|
-
], SourceEditToolbarButtonSlimmer.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
3653
|
-
__decorate$2([
|
|
3654
|
-
MapToComponentField()
|
|
3655
|
-
], SourceEditToolbarButtonSlimmer.prototype, "sourceEditConfig", void 0);
|
|
3656
|
-
__decorate$2([
|
|
3657
|
-
MapToComponentField()
|
|
3658
|
-
], SourceEditToolbarButtonSlimmer.prototype, "value", void 0);
|
|
3659
|
-
|
|
3660
|
-
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3661
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3662
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3663
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3664
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3665
|
-
};
|
|
3666
|
-
/**
|
|
3667
|
-
* Inject the editor context to the extensions.
|
|
3668
|
-
*/
|
|
3669
|
-
class RTEExtensionController extends VegaSlimmer {
|
|
3670
|
-
constructor() {
|
|
3671
|
-
super(...arguments);
|
|
3672
|
-
/**
|
|
3673
|
-
* Flush the editor value to the host. Auto focus the last node if autoFocusLastNode is true.
|
|
3674
|
-
*
|
|
3675
|
-
* @param {VegaRTEContent} value - The content value to flush.
|
|
3676
|
-
* @param {boolean} autoFocusLastNode - Whether to auto-focus the last node after flushing.
|
|
3677
|
-
*/
|
|
3678
|
-
this.flushValue = (value, autoFocusLastNode = false) => {
|
|
3679
|
-
if (this.host && value) {
|
|
3680
|
-
void this.valueController.flushChanges(value, true);
|
|
3681
|
-
if (autoFocusLastNode) {
|
|
3682
|
-
const lastNode = this.host.value.getLastNode();
|
|
3683
|
-
if (lastNode) {
|
|
3684
|
-
this.selectionController.enqueueSelectionRangeFutureState(lastNode, lastNode.getRangeEndOffset());
|
|
3685
|
-
}
|
|
3686
|
-
}
|
|
3687
|
-
}
|
|
3688
|
-
};
|
|
3689
|
-
/**
|
|
3690
|
-
* Check if the editor is in source edit mode.
|
|
3691
|
-
*
|
|
3692
|
-
* @returns {boolean} - Whether the editor is in source edit mode.
|
|
3693
|
-
*/
|
|
3694
|
-
this.isSourceEditMode = () => {
|
|
3695
|
-
return this.sourceView;
|
|
3696
|
-
};
|
|
3697
|
-
/**
|
|
3698
|
-
* Get the currently selected nodes in the editor.
|
|
3699
|
-
*
|
|
3700
|
-
* @returns {RTENode[]} - An array of currently selected RTENode objects.
|
|
3701
|
-
*/
|
|
3702
|
-
this.getSelectedNodes = () => {
|
|
3703
|
-
return this.selectionController.getSelectedNodes();
|
|
3704
|
-
};
|
|
3705
|
-
}
|
|
3706
|
-
/**
|
|
3707
|
-
* Initializes the extension context for all registered extensions.
|
|
3708
|
-
* This method is called when the component is connected and whenever the extensions property changes.
|
|
3709
|
-
*/
|
|
3710
|
-
initialExtensionContext() {
|
|
3711
|
-
if (this.extensions && this.host) {
|
|
3712
|
-
for (const extension of this.extensions) {
|
|
3713
|
-
extension.initialExtension({
|
|
3714
|
-
host: this.host,
|
|
3715
|
-
flushValue: this.flushValue,
|
|
3716
|
-
isSourceEditMode: this.isSourceEditMode,
|
|
3717
|
-
getSelectedNodes: this.getSelectedNodes,
|
|
3718
|
-
setSelectedNodes: this.selectionController.setSelectedNodes.bind(this.selectionController),
|
|
3719
|
-
getSelection: this.selectionController.getSelection.bind(this.selectionController),
|
|
3720
|
-
});
|
|
3721
|
-
}
|
|
3722
|
-
}
|
|
3723
|
-
}
|
|
3724
|
-
/**
|
|
3725
|
-
* Destroys all registered extensions.
|
|
3726
|
-
*/
|
|
3727
|
-
destroyExtension() {
|
|
3728
|
-
if (this.extensions) {
|
|
3729
|
-
for (const extension of this.extensions) {
|
|
3730
|
-
extension.destroyExtension();
|
|
3731
|
-
}
|
|
3732
|
-
}
|
|
3733
|
-
}
|
|
3734
|
-
/**
|
|
3735
|
-
* Update extension context when extensions property changes.
|
|
3736
|
-
*
|
|
3737
|
-
* @param {VegaRTEExtension[]} newValue - New extensions array.
|
|
3738
|
-
* @param {VegaRTEExtension[]} oldValue - Old extensions array.
|
|
3739
|
-
*/
|
|
3740
|
-
handleExtensionsChange(newValue, oldValue) {
|
|
3741
|
-
if (oldValue) {
|
|
3742
|
-
for (const extension of oldValue) {
|
|
3743
|
-
extension.destroyExtension();
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
if (!isArrayEqual(newValue, oldValue, false, (a, b) => a === b ? 0 : 1)) {
|
|
3747
|
-
this.initialExtensionContext();
|
|
3748
|
-
}
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
__decorate$1([
|
|
3752
|
-
MapToComponentField()
|
|
3753
|
-
], RTEExtensionController.prototype, "extensions", void 0);
|
|
3754
|
-
__decorate$1([
|
|
3755
|
-
MapToComponentField()
|
|
3756
|
-
], RTEExtensionController.prototype, "host", void 0);
|
|
3757
|
-
__decorate$1([
|
|
3758
|
-
MapToComponentField()
|
|
3759
|
-
], RTEExtensionController.prototype, "sourceView", void 0);
|
|
3760
|
-
__decorate$1([
|
|
3761
|
-
MapToComponentField()
|
|
3762
|
-
], RTEExtensionController.prototype, "valueController", void 0);
|
|
3763
|
-
__decorate$1([
|
|
3764
|
-
MapToComponentField()
|
|
3765
|
-
], RTEExtensionController.prototype, "selectionController", void 0);
|
|
3766
|
-
__decorate$1([
|
|
3767
|
-
MapToComponentMethod('componentDidLoad')
|
|
3768
|
-
], RTEExtensionController.prototype, "initialExtensionContext", null);
|
|
3769
|
-
__decorate$1([
|
|
3770
|
-
MapToComponentMethod('disconnectedCallback')
|
|
3771
|
-
], RTEExtensionController.prototype, "destroyExtension", null);
|
|
3772
|
-
__decorate$1([
|
|
3773
|
-
MapToComponentMethod('watchExtensions')
|
|
3774
|
-
], RTEExtensionController.prototype, "handleExtensionsChange", null);
|
|
3775
|
-
|
|
3776
|
-
const vegaRichTextEditorCss = ":host{display:block}:host vega-field-label{margin-bottom:8px}:host vega-text{margin-bottom:16px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host vega-text{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host vega-text{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host vega-text{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container{display:flex;box-sizing:content-box;position:relative;box-sizing:content-box;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:8px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));margin-top:12px;overflow:auto;resize:vertical;padding-top:12px;padding-right:16px;padding-bottom:32px;padding-left:16px}:host .rich-text-editor-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host .rich-text-editor-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-focus, 19, 98, 226, 1))}:host .rich-text-editor-container.disabled{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .rich-text-editor-container.disabled:hover,:host .rich-text-editor-container.disabled:focus-within{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host .rich-text-editor-container.disabled:focus-within{outline:none}:host .rich-text-editor-container.disabled vega-rich-text-content{pointer-events:none;opacity:0.35}:host .rich-text-editor-container.error{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host .rich-text-editor-container.error:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host .rich-text-editor-container.error:focus-within{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:3px;border:1px solid rgba(var(--v-border-color-input-field-danger-focus, 233, 71, 104, 1))}:host .rich-text-editor-container .text-editor-counter{position:absolute;bottom:8px;right:8px;display:flex;padding-left:4px;padding-right:4px;padding-top:2px;padding-bottom:2px;border-radius:4px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1));background-color:rgba(var(--v-bg-textarea-count, 4, 4, 28, 0.6))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container .text-editor-counter{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container .text-editor-counter{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container .text-editor-counter{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .rich-text-editor-container .text-editor-counter.counter-exceed-max-length{background-color:rgba(var(--v-bg-textarea-counter-exceed-max-length, 214, 46, 81))}.toolbar-btn-group{display:flex;justify-content:center;align-items:center}.toolbar-btn-group>*:not(:first-child):not(:last-child) ::part(rich-text-editor-toolbar-button){border-radius:0px}.toolbar-btn-group>*:first-child:not(:last-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:4px;border-bottom-left-radius:4px;border-top-right-radius:0px;border-bottom-right-radius:0px}.toolbar-btn-group>*:last-child:not(:first-child) ::part(rich-text-editor-toolbar-button){border-top-left-radius:0px;border-bottom-left-radius:0px;border-top-right-radius:4px;border-bottom-right-radius:4px}.toolbar-btn-group>*:not(:first-child) ::part(rich-text-editor-toolbar-button){margin-left:-1px}.toolbar-btn-group .toolbar-btn-color-preview-box{display:flex;border:1px solid rgba(var(--v-border-chip, 205, 209, 211, 1));box-sizing:border-box;border-radius:4px;width:16px;height:16px;justify-content:center;align-items:center;margin-left:6px}.toolbar-btn-group .toolbar-btn-color-preview-box.disabled{opacity:0.35}.toolbar-btn-group .toolbar-btn-link-wrapper{position:relative}.toolbar-btn-group .toolbar-btn-link-wrapper vega-rich-text-link-editor{position:absolute;bottom:0;left:0;right:0}.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1));display:block;margin-top:12px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none !important}.source-view-container{margin-top:12px}.source-view-container vega-code-block::part(editor-toolbar){display:none}";
|
|
3777
|
-
|
|
3778
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3779
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3780
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
3781
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
3782
|
-
else
|
|
3783
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
3784
|
-
if (d = decorators[i])
|
|
3785
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3786
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3787
|
-
};
|
|
3788
|
-
const VegaRichTextEditor = class {
|
|
3789
|
-
constructor(hostRef) {
|
|
3790
|
-
registerInstance(this, hostRef);
|
|
3791
|
-
this.vegaChange = createEvent(this, "vegaChange", 7);
|
|
3792
|
-
this.change = createEvent(this, "change", 7);
|
|
3793
|
-
this.vegaImageInserted = createEvent(this, "vegaImageInserted", 7);
|
|
3794
|
-
this.imageInserted = createEvent(this, "imageInserted", 7);
|
|
3795
|
-
this.globalSlimmers = {};
|
|
3796
|
-
this.translationSlimmer = new TranslationSlimmer();
|
|
3797
|
-
this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
|
|
3798
|
-
this.formFieldController = new FormFieldControllerSlimmer({
|
|
3799
|
-
propertyRules: [
|
|
3800
|
-
{
|
|
3801
|
-
propertyName: 'required',
|
|
3802
|
-
ruleFactory: (isRequired) => isRequired ? new RichTextEditorRequiredRule() : null,
|
|
3803
|
-
},
|
|
3804
|
-
],
|
|
3805
|
-
validationRulesName: 'validationRules',
|
|
3806
|
-
defaultValue: null,
|
|
3807
|
-
attributeGetter: (propertyName) => this[propertyName],
|
|
3808
|
-
inputContainerGetter: () => this.vegaRichTextEditorRenderer.getRichTextContainerRef(),
|
|
3809
|
-
touchableAreaGetter: () => [this.vegaRichTextEditorRenderer.getRichTextContentRef()],
|
|
3810
|
-
});
|
|
3811
|
-
this.changeEventEmitter = createEventEmitSlimmer(VegaRichTextEditor, VegaChange);
|
|
3812
|
-
this.vegaRichTextEditorRenderer = new VegaRichTextEditorRenderer();
|
|
3813
|
-
this.valueController = new ValueController();
|
|
3814
|
-
this.selectionController = new SelectionController();
|
|
3815
|
-
this.focusController = new FocusController();
|
|
3816
|
-
this.darkModeStateControllerSlimmer = new DarkModeStateControllerSlimmer();
|
|
3817
|
-
this.toolbarRenderer = new ToolbarRenderer();
|
|
3818
|
-
this.clearStyleToolbarButtonSlimmer = new ClearStyleToolbarButtonSlimmer();
|
|
3819
|
-
this.boldToolbarButtonSlimmer = new BoldToolbarButtonSlimmer();
|
|
3820
|
-
this.italicToolbarButtonSlimmer = new ItalicToolbarButtonSlimmer();
|
|
3821
|
-
this.underlineToolbarButtonSlimmer = new UnderlineToolbarButtonSlimmer();
|
|
3822
|
-
this.textColorToolbarButtonSlimmer = new TextColorToolbarButtonSlimmer();
|
|
3823
|
-
this.textStylesToolbarButtonSlimmer = new TextStylesToolbarButtonSlimmer();
|
|
3824
|
-
this.codeToolbarButtonSlimmer = new CodeToolbarButtonSlimmer();
|
|
3825
|
-
this.strikethroughToolbarButtonSlimmer = new StrikethroughToolbarButtonSlimmer();
|
|
3826
|
-
this.imageToolbarButtonSlimmer = new ImageToolbarButtonSlimmer();
|
|
3827
|
-
this.linkToolbarButtonSlimmer = new LinkToolbarButtonSlimmer();
|
|
3828
|
-
this.moreIndentToolbarButtonSlimmer = new MoreIndentToolbarButtonSlimmer();
|
|
3829
|
-
this.lessIndentToolbarButtonSlimmer = new LessIndentToolbarButtonSlimmer();
|
|
3830
|
-
this.bulletsNumbersToolbarButtonSlimmer = new BulletsNumbersToolbarButtonSlimmer();
|
|
3831
|
-
this.horizontalAlignmentToolbarButtonSlimmer = new HorizontalAlignmentToolbarButtonSlimmer();
|
|
3832
|
-
this.codeBlockToolbarButtonSlimmer = new CodeBlockToolbarButtonSlimmer();
|
|
3833
|
-
this.sourceEditToolbarButtonSlimmer = new SourceEditToolbarButtonSlimmer();
|
|
3834
|
-
this.placeholderNotifySlimmer = createSubStateNotifySlimmer(VegaRichTextEditor, 'placeholder', 'watchPlaceholder');
|
|
3835
|
-
this.disabledNotifySlimmer = createSubStateNotifySlimmer(VegaRichTextEditor, 'richTextContentEditable', 'watchRichTextContentEditable');
|
|
3836
|
-
this.richTextContentController = new RichTextContentController(this);
|
|
3837
|
-
this.userInputController = new UserInputController();
|
|
3838
|
-
this.insertImageController = new InsertImageController();
|
|
3839
|
-
this.insertCompositionTextController = new InsertCompositionTextController();
|
|
3840
|
-
this.imageInsertedEventEmitter = createEventEmitSlimmer(VegaRichTextEditor, VegaImageInserted);
|
|
3841
|
-
this.changeEventPreventSlimmer = new ChildNodesEventPreventSlimmer([VegaChange], () => this.vegaRichTextEditorRenderer.getRichTextWrapperRef());
|
|
3842
|
-
this.textNodeColorController = new TextNodeColorController();
|
|
3843
|
-
this.deleteSelectedNodesController = new DeleteSelectedNodesController();
|
|
3844
|
-
this.historyController = new HistoryController();
|
|
3845
|
-
this.internalCodeBlockSelectionController = new InternalCodeBlockSelectionController();
|
|
3846
|
-
this.rteExtensionController = new RTEExtensionController();
|
|
3847
|
-
this.richTextContentEditable = true;
|
|
3848
|
-
this.selectionMap = new Map();
|
|
3849
|
-
this.isInDarkMode = VegaInternalThemeManager.isDarkMode();
|
|
3850
|
-
this.sourceView = false;
|
|
3851
|
-
/**
|
|
3852
|
-
* Specifies the label for the rich text editor.
|
|
3853
|
-
*
|
|
3854
|
-
* It provides descriptive text that helps identify the
|
|
3855
|
-
* purpose or content expected in the rich text editor.
|
|
3856
|
-
*
|
|
3857
|
-
* @vegaVersion 2.34.0
|
|
3858
|
-
*/
|
|
3859
|
-
this.label = '';
|
|
3860
|
-
/**
|
|
3861
|
-
* Determines whether the rich text editor field is required.
|
|
3862
|
-
*
|
|
3863
|
-
* @vegaVersion 2.34.0
|
|
3864
|
-
*/
|
|
3865
|
-
this.required = false;
|
|
3866
|
-
/**
|
|
3867
|
-
* Specifies a placeholder string that displays as a
|
|
3868
|
-
* temporary hint or example within the rich text editor.
|
|
3869
|
-
*
|
|
3870
|
-
* It indicates the expected format or pattern of
|
|
3871
|
-
* the input within the rich text editor.
|
|
3872
|
-
*
|
|
3873
|
-
* @vegaVersion 2.34.0
|
|
3874
|
-
*/
|
|
3875
|
-
this.placeholder = '';
|
|
3876
|
-
/**
|
|
3877
|
-
* Specifies whether the rich text editor is disabled.
|
|
3878
|
-
*
|
|
3879
|
-
* @vegaVersion 2.34.0
|
|
3880
|
-
*/
|
|
3881
|
-
this.disabled = false;
|
|
3882
|
-
/**
|
|
3883
|
-
* Provides a supplementary prompt message that assists users in
|
|
3884
|
-
* understanding the expected value within the rich text editor.
|
|
3885
|
-
*
|
|
3886
|
-
* @vegaVersion 2.34.0
|
|
3887
|
-
*/
|
|
3888
|
-
this.hint = '';
|
|
3889
|
-
/**
|
|
3890
|
-
* Specifies editable section rows for the rich text editor
|
|
3891
|
-
*
|
|
3892
|
-
* @vegaVersion 2.34.0
|
|
3893
|
-
*/
|
|
3894
|
-
this.rows = 4;
|
|
3895
|
-
/**
|
|
3896
|
-
* Specifies the value of the rich text editor, which can be either VegaRTEContent or VegaRTEContentBlock.
|
|
3897
|
-
* It is recommended to use the VegaRTEContent type.
|
|
3898
|
-
* Only in exceptional cases should the original data in the VegaRTEContentBlock type be used.
|
|
3899
|
-
*
|
|
3900
|
-
* @vegaVersion 2.34.0
|
|
3901
|
-
* @defaultValue [{id:'UUID', type:'paragraph', nodes:[{id: 'UUID',type: 'text',text:''}]}]
|
|
3902
|
-
*/
|
|
3903
|
-
// eslint-disable-next-line @stencil/strict-mutable
|
|
3904
|
-
this.value = VegaRTEContent.createEmptyContent();
|
|
3905
|
-
/**
|
|
3906
|
-
* Specifies the built-in toolbar items available in the rich-text editor.
|
|
3907
|
-
*
|
|
3908
|
-
* @vegaVersion 2.34.0
|
|
3909
|
-
*/
|
|
3910
|
-
this.toolbarItems = VegaRTEPresetToolbarItems;
|
|
3911
|
-
/**
|
|
3912
|
-
* Determines whether to allow source edit mode in the rich text editor.
|
|
3913
|
-
*
|
|
3914
|
-
* @vegaVersion 2.59.0
|
|
3915
|
-
*/
|
|
3916
|
-
this.allowSourceEdit = false;
|
|
3917
|
-
/**
|
|
3918
|
-
* Specifies the configuration options for source edit mode.
|
|
3919
|
-
* It includes settings such as autoMatchFormat, which controls whether the editor automatically matches formatting when switching to source edit mode.
|
|
3920
|
-
*
|
|
3921
|
-
* @vegaVersion 2.59.0
|
|
3922
|
-
*/
|
|
3923
|
-
this.sourceEditConfig = { autoMatchFormat: true };
|
|
3924
|
-
/**
|
|
3925
|
-
* Specifies the validation status of the rich text editor component.
|
|
3926
|
-
*
|
|
3927
|
-
* @vegaVersion 2.34.0
|
|
3928
|
-
*/
|
|
3929
|
-
/* eslint-disable-next-line @stencil/strict-mutable */
|
|
3930
|
-
this.isValid = null;
|
|
3931
|
-
/**
|
|
3932
|
-
* Determines whether automatic validation should be implemented for
|
|
3933
|
-
* the rich text editor.
|
|
3934
|
-
*
|
|
3935
|
-
* @vegaVersion 2.34.0
|
|
3936
|
-
*/
|
|
3937
|
-
this.autoValidation = true;
|
|
3938
|
-
/**
|
|
3939
|
-
* Defines custom validation rules for the rich text editor.
|
|
3940
|
-
*
|
|
3941
|
-
* @vegaVersion 2.34.0
|
|
3942
|
-
*/
|
|
3943
|
-
this.validationRules = [];
|
|
3944
|
-
/**
|
|
3945
|
-
* Specifies the configuration for the rich text editor extensions.
|
|
3946
|
-
*
|
|
3947
|
-
* @vegaVersion 2.62.0
|
|
3948
|
-
*/
|
|
3949
|
-
this.extensions = [];
|
|
3950
|
-
}
|
|
3951
|
-
watchRichTextContentEditable() {
|
|
3952
|
-
methodPlaceholder();
|
|
3953
|
-
}
|
|
3954
|
-
watchPlaceholder() {
|
|
3955
|
-
methodPlaceholder();
|
|
3956
|
-
}
|
|
3957
|
-
watchDisabled() {
|
|
3958
|
-
this.richTextContentController.syncRichTextContentEditable();
|
|
3959
|
-
}
|
|
3960
|
-
watchValueUpdate() {
|
|
3961
|
-
methodPlaceholder();
|
|
3962
|
-
}
|
|
3963
|
-
watchValidationRules() {
|
|
3964
|
-
methodPlaceholder();
|
|
3965
|
-
}
|
|
3966
|
-
watchExtensions() {
|
|
3967
|
-
methodPlaceholder();
|
|
3968
|
-
}
|
|
3969
|
-
componentWillLoad() {
|
|
3970
|
-
this.richTextContentController.syncRichTextContentEditable();
|
|
3971
|
-
}
|
|
3972
|
-
render() {
|
|
3973
|
-
return sanitizeVegaComponent(this.vegaRichTextEditorRenderer.render(), this.host);
|
|
3974
|
-
}
|
|
3975
|
-
get host() { return getElement(this); }
|
|
3976
|
-
static get watchers() { return {
|
|
3977
|
-
"richTextContentEditable": ["watchRichTextContentEditable"],
|
|
3978
|
-
"placeholder": ["watchPlaceholder"],
|
|
3979
|
-
"disabled": ["watchDisabled"],
|
|
3980
|
-
"value": ["watchValueUpdate"],
|
|
3981
|
-
"validationRules": ["watchValidationRules"],
|
|
3982
|
-
"extensions": ["watchExtensions"]
|
|
3983
|
-
}; }
|
|
3984
|
-
};
|
|
3985
|
-
__decorate([
|
|
3986
|
-
InjectVegaGlobalSlimmer()
|
|
3987
|
-
], VegaRichTextEditor.prototype, "globalSlimmers", void 0);
|
|
3988
|
-
__decorate([
|
|
3989
|
-
InjectVegaSlimmer()
|
|
3990
|
-
], VegaRichTextEditor.prototype, "translationSlimmer", void 0);
|
|
3991
|
-
__decorate([
|
|
3992
|
-
InjectVegaSlimmer()
|
|
3993
|
-
], VegaRichTextEditor.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
|
|
3994
|
-
__decorate([
|
|
3995
|
-
InjectVegaSlimmer()
|
|
3996
|
-
], VegaRichTextEditor.prototype, "formFieldController", void 0);
|
|
3997
|
-
__decorate([
|
|
3998
|
-
InjectVegaSlimmer()
|
|
3999
|
-
], VegaRichTextEditor.prototype, "changeEventEmitter", void 0);
|
|
4000
|
-
__decorate([
|
|
4001
|
-
InjectVegaSlimmer()
|
|
4002
|
-
], VegaRichTextEditor.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
4003
|
-
__decorate([
|
|
4004
|
-
InjectVegaSlimmer()
|
|
4005
|
-
], VegaRichTextEditor.prototype, "valueController", void 0);
|
|
4006
|
-
__decorate([
|
|
4007
|
-
InjectVegaSlimmer()
|
|
4008
|
-
], VegaRichTextEditor.prototype, "selectionController", void 0);
|
|
4009
|
-
__decorate([
|
|
4010
|
-
InjectVegaSlimmer()
|
|
4011
|
-
], VegaRichTextEditor.prototype, "focusController", void 0);
|
|
4012
|
-
__decorate([
|
|
4013
|
-
InjectVegaSlimmer()
|
|
4014
|
-
], VegaRichTextEditor.prototype, "darkModeStateControllerSlimmer", void 0);
|
|
4015
|
-
__decorate([
|
|
4016
|
-
InjectVegaSlimmer()
|
|
4017
|
-
], VegaRichTextEditor.prototype, "toolbarRenderer", void 0);
|
|
4018
|
-
__decorate([
|
|
4019
|
-
InjectVegaSlimmer()
|
|
4020
|
-
], VegaRichTextEditor.prototype, "clearStyleToolbarButtonSlimmer", void 0);
|
|
4021
|
-
__decorate([
|
|
4022
|
-
InjectVegaSlimmer()
|
|
4023
|
-
], VegaRichTextEditor.prototype, "boldToolbarButtonSlimmer", void 0);
|
|
4024
|
-
__decorate([
|
|
4025
|
-
InjectVegaSlimmer()
|
|
4026
|
-
], VegaRichTextEditor.prototype, "italicToolbarButtonSlimmer", void 0);
|
|
4027
|
-
__decorate([
|
|
4028
|
-
InjectVegaSlimmer()
|
|
4029
|
-
], VegaRichTextEditor.prototype, "underlineToolbarButtonSlimmer", void 0);
|
|
4030
|
-
__decorate([
|
|
4031
|
-
InjectVegaSlimmer()
|
|
4032
|
-
], VegaRichTextEditor.prototype, "textColorToolbarButtonSlimmer", void 0);
|
|
4033
|
-
__decorate([
|
|
4034
|
-
InjectVegaSlimmer()
|
|
4035
|
-
], VegaRichTextEditor.prototype, "textStylesToolbarButtonSlimmer", void 0);
|
|
4036
|
-
__decorate([
|
|
4037
|
-
InjectVegaSlimmer()
|
|
4038
|
-
], VegaRichTextEditor.prototype, "codeToolbarButtonSlimmer", void 0);
|
|
4039
|
-
__decorate([
|
|
4040
|
-
InjectVegaSlimmer()
|
|
4041
|
-
], VegaRichTextEditor.prototype, "strikethroughToolbarButtonSlimmer", void 0);
|
|
4042
|
-
__decorate([
|
|
4043
|
-
InjectVegaSlimmer()
|
|
4044
|
-
], VegaRichTextEditor.prototype, "imageToolbarButtonSlimmer", void 0);
|
|
4045
|
-
__decorate([
|
|
4046
|
-
InjectVegaSlimmer()
|
|
4047
|
-
], VegaRichTextEditor.prototype, "linkToolbarButtonSlimmer", void 0);
|
|
4048
|
-
__decorate([
|
|
4049
|
-
InjectVegaSlimmer()
|
|
4050
|
-
], VegaRichTextEditor.prototype, "moreIndentToolbarButtonSlimmer", void 0);
|
|
4051
|
-
__decorate([
|
|
4052
|
-
InjectVegaSlimmer()
|
|
4053
|
-
], VegaRichTextEditor.prototype, "lessIndentToolbarButtonSlimmer", void 0);
|
|
4054
|
-
__decorate([
|
|
4055
|
-
InjectVegaSlimmer()
|
|
4056
|
-
], VegaRichTextEditor.prototype, "bulletsNumbersToolbarButtonSlimmer", void 0);
|
|
4057
|
-
__decorate([
|
|
4058
|
-
InjectVegaSlimmer()
|
|
4059
|
-
], VegaRichTextEditor.prototype, "horizontalAlignmentToolbarButtonSlimmer", void 0);
|
|
4060
|
-
__decorate([
|
|
4061
|
-
InjectVegaSlimmer()
|
|
4062
|
-
], VegaRichTextEditor.prototype, "codeBlockToolbarButtonSlimmer", void 0);
|
|
4063
|
-
__decorate([
|
|
4064
|
-
InjectVegaSlimmer()
|
|
4065
|
-
], VegaRichTextEditor.prototype, "sourceEditToolbarButtonSlimmer", void 0);
|
|
4066
|
-
__decorate([
|
|
4067
|
-
InjectVegaSlimmer()
|
|
4068
|
-
], VegaRichTextEditor.prototype, "placeholderNotifySlimmer", void 0);
|
|
4069
|
-
__decorate([
|
|
4070
|
-
InjectVegaSlimmer()
|
|
4071
|
-
], VegaRichTextEditor.prototype, "disabledNotifySlimmer", void 0);
|
|
4072
|
-
__decorate([
|
|
4073
|
-
InjectVegaSlimmer()
|
|
4074
|
-
], VegaRichTextEditor.prototype, "richTextContentController", void 0);
|
|
4075
|
-
__decorate([
|
|
4076
|
-
InjectVegaSlimmer()
|
|
4077
|
-
], VegaRichTextEditor.prototype, "userInputController", void 0);
|
|
4078
|
-
__decorate([
|
|
4079
|
-
InjectVegaSlimmer()
|
|
4080
|
-
], VegaRichTextEditor.prototype, "insertImageController", void 0);
|
|
4081
|
-
__decorate([
|
|
4082
|
-
InjectVegaSlimmer()
|
|
4083
|
-
], VegaRichTextEditor.prototype, "insertCompositionTextController", void 0);
|
|
4084
|
-
__decorate([
|
|
4085
|
-
InjectVegaSlimmer()
|
|
4086
|
-
], VegaRichTextEditor.prototype, "imageInsertedEventEmitter", void 0);
|
|
4087
|
-
__decorate([
|
|
4088
|
-
InjectVegaSlimmer()
|
|
4089
|
-
], VegaRichTextEditor.prototype, "changeEventPreventSlimmer", void 0);
|
|
4090
|
-
__decorate([
|
|
4091
|
-
InjectVegaSlimmer()
|
|
4092
|
-
], VegaRichTextEditor.prototype, "textNodeColorController", void 0);
|
|
4093
|
-
__decorate([
|
|
4094
|
-
InjectVegaSlimmer()
|
|
4095
|
-
], VegaRichTextEditor.prototype, "deleteSelectedNodesController", void 0);
|
|
4096
|
-
__decorate([
|
|
4097
|
-
InjectVegaSlimmer()
|
|
4098
|
-
], VegaRichTextEditor.prototype, "historyController", void 0);
|
|
4099
|
-
__decorate([
|
|
4100
|
-
InjectVegaSlimmer()
|
|
4101
|
-
], VegaRichTextEditor.prototype, "internalCodeBlockSelectionController", void 0);
|
|
4102
|
-
__decorate([
|
|
4103
|
-
InjectVegaSlimmer()
|
|
4104
|
-
], VegaRichTextEditor.prototype, "rteExtensionController", void 0);
|
|
4105
|
-
VegaRichTextEditor.style = vegaRichTextEditorCss;
|
|
4106
|
-
|
|
4107
|
-
export { VegaRichTextEditor as vega_rich_text_editor };
|