@heartlandone/vega 2.49.1 → 2.50.0-RTE-preview
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-65622aeb.js → app-globals-8e811cac.js} +6 -6
- package/dist/cjs/{child-nodes-event-prevent-slimmer-cc193ee1.js → child-nodes-event-prevent-slimmer-26ecfb15.js} +1 -1
- package/dist/cjs/{content-state-6a48bcb5.js → code-block-4cd8bccd.js} +1166 -1131
- package/dist/cjs/content-state-6cb98931.js +2496 -0
- package/dist/cjs/{design-token-cba4222e.js → design-token-8b48cb59.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-4a26ecb2.js → element-appender-slimmer-d6b975e6.js} +3 -3
- package/dist/cjs/{event-emit-slimmer-8247249c.js → event-emit-slimmer-ee7a8c06.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-4b0af5bc.js → form-field-controller-slimmer-88cbb139.js} +4 -4
- package/dist/cjs/{image-annotation-action-9c2b9c8e.js → image-annotation-action-f36b1a72.js} +65 -35
- package/dist/cjs/{index-c4dec3aa.js → index-4dd54e6b.js} +1 -1
- package/dist/cjs/{index-09acd3c9.js → index-7700600c.js} +9 -0
- package/dist/cjs/index.cjs.js +17 -16
- package/dist/cjs/{internal-vega-event-manager-c9948b59.js → internal-vega-event-manager-58afcde7.js} +1 -0
- package/dist/cjs/loader.cjs.js +11 -9
- package/dist/cjs/{public-rules-10ec636d.js → public-rules-555271e0.js} +8 -6
- package/dist/cjs/{responsive-format-facade-263d49f6.js → responsive-format-facade-8ce41c8a.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-5faded94.js → rich-text-editor-required-rule-d1b38bf7.js} +1 -1
- package/dist/cjs/selection-controller-828990cc.js +765 -0
- package/dist/cjs/string-39438062.js +24 -0
- package/dist/cjs/{string-input-formatter-slimmer-50322824.js → string-input-formatter-slimmer-9e7d7ce2.js} +2 -2
- package/dist/cjs/{style-formatter-ae0ef7fc.js → style-formatter-2294d77f.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-7f437b19.js → sub-state-notify-slimmer-f3ee01b7.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-e90362cd.js → sub-state-observer-slimmer-e1a00b74.js} +1 -1
- package/dist/cjs/{translation-212b1875.js → translation-e5003a00.js} +5 -0
- package/dist/cjs/{translation-slimmer-d1512c6d.js → translation-slimmer-127a0f83.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +11 -9
- package/dist/cjs/vega-app-footer.cjs.entry.js +1 -1
- package/dist/cjs/vega-app-header-button.cjs.entry.js +12 -10
- package/dist/cjs/vega-backdrop.cjs.entry.js +1 -1
- package/dist/cjs/vega-banner.cjs.entry.js +3 -3
- package/dist/cjs/vega-bar-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-box.cjs.entry.js +11 -9
- package/dist/cjs/vega-brand-logo.cjs.entry.js +1 -1
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/vega-button-circle.cjs.entry.js +12 -10
- package/dist/cjs/vega-button-group_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-button-link.cjs.entry.js +4 -4
- package/dist/cjs/vega-button.cjs.entry.js +11 -9
- package/dist/cjs/vega-calendar_3.cjs.entry.js +9 -9
- package/dist/cjs/vega-card.cjs.entry.js +10 -8
- package/dist/cjs/vega-carousel.cjs.entry.js +10 -8
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-chip.cjs.entry.js +12 -10
- package/dist/cjs/vega-code-block.cjs.entry.js +4073 -0
- package/dist/cjs/vega-color-picker.cjs.entry.js +8 -8
- package/dist/cjs/vega-combo-box.cjs.entry.js +9 -9
- package/dist/cjs/vega-counter-badge.cjs.entry.js +1 -1
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +17 -16
- package/dist/cjs/vega-dialog_2.cjs.entry.js +12 -10
- package/dist/cjs/vega-divider.cjs.entry.js +10 -8
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +15 -13
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +9 -9
- package/dist/cjs/vega-flag-icon.cjs.entry.js +10 -8
- package/dist/cjs/vega-flex.cjs.entry.js +11 -9
- package/dist/cjs/vega-font.cjs.entry.js +10 -8
- package/dist/cjs/vega-form.cjs.entry.js +10 -10
- package/dist/cjs/vega-grid.cjs.entry.js +10 -8
- package/dist/cjs/vega-hint.cjs.entry.js +1 -1
- package/dist/cjs/vega-icon.cjs.entry.js +10 -8
- package/dist/cjs/vega-image-uploader.cjs.entry.js +14 -13
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +9 -9
- package/dist/cjs/vega-input-numeric.cjs.entry.js +10 -10
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +12 -11
- package/dist/cjs/vega-input-range.cjs.entry.js +10 -10
- package/dist/cjs/vega-input-select.cjs.entry.js +19 -18
- package/dist/cjs/vega-input.cjs.entry.js +10 -10
- package/dist/cjs/{vega-internal-event-id-bfea9b93.js → vega-internal-event-id-62371952.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +13 -11
- package/dist/cjs/vega-line-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +9 -7
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination.cjs.entry.js +12 -10
- package/dist/cjs/vega-pie-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-popover_2.cjs.entry.js +11 -9
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +311 -137
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +1225 -2502
- package/dist/cjs/vega-section-title.cjs.entry.js +1 -1
- package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +14 -13
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +12 -10
- package/dist/cjs/vega-signature-capture.cjs.entry.js +14 -13
- package/dist/cjs/{vega-skeleton-loader-controller-db868c98.js → vega-skeleton-loader-controller-83e05b6c.js} +1 -1
- package/dist/cjs/vega-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
- package/dist/cjs/vega-stepper.cjs.entry.js +9 -9
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-table_8.cjs.entry.js +14 -12
- package/dist/cjs/vega-text.cjs.entry.js +1 -1
- package/dist/cjs/vega-textarea.cjs.entry.js +9 -9
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +15 -14
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +8 -8
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +10 -8
- package/dist/cjs/vega.cjs.js +11 -9
- package/dist/collection/collection-manifest.json +7 -1
- package/dist/collection/components/vega-code-block/assets/copy.js +3 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.js +62 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.js +48 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.js +99 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.js +50 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.js +57 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +255 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.js +266 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.js +44 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.js +123 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +67 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.js +122 -0
- package/dist/collection/components/vega-code-block/types.js +10 -0
- package/dist/collection/components/vega-code-block/vega-code-block.css +158 -0
- package/dist/collection/components/vega-code-block/vega-code-block.js +399 -0
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +5 -5
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +2 -0
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +60 -5
- package/dist/collection/components/vega-rich-text-editor/assets/file-code.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/rectangle-code.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +77 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-code-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-code-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +14 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.js +65 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +26 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +16 -7
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +12 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +89 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +3 -7
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +74 -12
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +69 -2
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +106 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +15 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +12 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +66 -2
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +56 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +26 -9
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +81 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +15 -2
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.js +5 -22
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +9 -93
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +62 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +121 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +2 -23
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.js +81 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +47 -7
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.js +0 -27
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +19 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +155 -15
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +6 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +3 -20
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +59 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +3 -20
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-not-li-child-to-rte-list-item-block.js +7 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +4 -7
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +7 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +7 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +25 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.js +64 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +59 -53
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +21 -8
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +65 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +6 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +31 -3
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +23 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +247 -27
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/code-block.test.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +1793 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +41 -4
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.js +61 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +7 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +18 -1
- package/dist/collection/helpers/code-format/code-formatter.js +108 -0
- package/dist/collection/helpers/code-format/test/code-formatter.test.js +362 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +2 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.js +47 -0
- package/dist/collection/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.js +46 -0
- package/dist/collection/helpers/translation/locales/en.js +5 -0
- package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +5 -0
- package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +17 -15
- package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +1 -0
- package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
- package/dist/collection/utils/string.js +10 -0
- package/dist/esm/{app-globals-1f8c30e9.js → app-globals-9058ac3b.js} +6 -6
- package/dist/esm/{child-nodes-event-prevent-slimmer-5d45361e.js → child-nodes-event-prevent-slimmer-1142fb79.js} +1 -1
- package/dist/esm/{content-state-dbc9f635.js → code-block-8b5bd928.js} +1141 -1122
- package/dist/esm/content-state-8c3f862b.js +2489 -0
- package/dist/esm/{design-token-0699f0ca.js → design-token-bd436e0d.js} +1 -1
- package/dist/esm/{dom-node-subject-factory-f77cf9cc.js → dom-node-subject-factory-eb6bba5d.js} +1 -1
- package/dist/esm/{dom-node-subject-observer-factory-715dccf9.js → dom-node-subject-observer-factory-6083d518.js} +1 -1
- package/dist/esm/{element-appender-slimmer-96cb54e2.js → element-appender-slimmer-baf5e249.js} +5 -5
- package/dist/esm/{event-emit-slimmer-b7d511f6.js → event-emit-slimmer-480d3b54.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-89a72ee7.js → form-field-controller-slimmer-bfb4034d.js} +6 -6
- package/dist/esm/{image-annotation-action-1aa938ab.js → image-annotation-action-a8b860ad.js} +57 -28
- package/dist/esm/{index-187f71d1.js → index-d0a47531.js} +9 -0
- package/dist/esm/{index-4aa167d6.js → index-db0ec3ee.js} +2 -2
- package/dist/esm/index.js +12 -11
- package/dist/esm/{internal-vega-event-manager-87dc436c.js → internal-vega-event-manager-56c6469a.js} +2 -1
- package/dist/esm/loader.js +12 -10
- 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-5cf6aa95.js → public-rules-90fbd41a.js} +8 -6
- package/dist/esm/{responsive-format-facade-42f3fcfa.js → responsive-format-facade-827de03a.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-6a7cd3ee.js → rich-text-editor-required-rule-0d470d82.js} +1 -1
- package/dist/esm/selection-controller-dd4f4407.js +759 -0
- package/dist/esm/string-a953eafc.js +21 -0
- package/dist/esm/{string-input-formatter-slimmer-c61f82d6.js → string-input-formatter-slimmer-0d30b976.js} +3 -3
- package/dist/esm/{style-formatter-cb00c709.js → style-formatter-232842f5.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-4e3cf09d.js → sub-state-notify-slimmer-04e06501.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-be7a6ce3.js → sub-state-observer-slimmer-b4c2ddc3.js} +2 -2
- package/dist/esm/{translation-cf7f020a.js → translation-71e0711d.js} +5 -0
- package/dist/esm/{translation-slimmer-88966d5c.js → translation-slimmer-e6b130bf.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +13 -11
- package/dist/esm/vega-app-footer.entry.js +1 -1
- package/dist/esm/vega-app-header-button.entry.js +14 -12
- package/dist/esm/vega-backdrop.entry.js +1 -1
- package/dist/esm/vega-banner.entry.js +5 -5
- package/dist/esm/vega-bar-chart.entry.js +1 -1
- package/dist/esm/vega-box.entry.js +12 -10
- package/dist/esm/vega-brand-logo.entry.js +1 -1
- package/dist/esm/vega-breadcrumb.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +14 -12
- package/dist/esm/vega-button-group_2.entry.js +9 -9
- package/dist/esm/vega-button-link.entry.js +6 -6
- package/dist/esm/vega-button.entry.js +13 -11
- package/dist/esm/vega-calendar_3.entry.js +11 -11
- package/dist/esm/vega-card.entry.js +11 -9
- package/dist/esm/vega-carousel.entry.js +12 -10
- package/dist/esm/vega-checkbox_2.entry.js +11 -11
- package/dist/esm/vega-chip.entry.js +14 -12
- package/dist/esm/vega-code-block.entry.js +4069 -0
- package/dist/esm/vega-color-picker.entry.js +10 -10
- package/dist/esm/vega-combo-box.entry.js +11 -11
- package/dist/esm/vega-counter-badge.entry.js +1 -1
- package/dist/esm/vega-date-picker_2.entry.js +19 -18
- package/dist/esm/vega-dialog_2.entry.js +14 -12
- package/dist/esm/vega-divider.entry.js +11 -9
- package/dist/esm/vega-dropdown_5.entry.js +17 -15
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +1 -1
- package/dist/esm/vega-field-label.entry.js +5 -5
- package/dist/esm/vega-file-uploader.entry.js +11 -11
- package/dist/esm/vega-flag-icon.entry.js +11 -9
- package/dist/esm/vega-flex.entry.js +12 -10
- package/dist/esm/vega-font.entry.js +11 -9
- package/dist/esm/vega-form.entry.js +12 -12
- package/dist/esm/vega-grid.entry.js +11 -9
- package/dist/esm/vega-hint.entry.js +1 -1
- package/dist/esm/vega-icon.entry.js +11 -9
- package/dist/esm/vega-image-uploader.entry.js +16 -15
- package/dist/esm/vega-input-credit-card.entry.js +11 -11
- package/dist/esm/vega-input-numeric.entry.js +12 -12
- package/dist/esm/vega-input-phone-number.entry.js +14 -13
- package/dist/esm/vega-input-range.entry.js +12 -12
- package/dist/esm/vega-input-select.entry.js +21 -20
- package/dist/esm/vega-input.entry.js +12 -12
- package/dist/esm/{vega-internal-event-id-85ad403f.js → vega-internal-event-id-820393ad.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +5 -5
- package/dist/esm/vega-left-nav_5.entry.js +15 -13
- package/dist/esm/vega-line-chart.entry.js +1 -1
- package/dist/esm/vega-loader-wrapper_2.entry.js +10 -8
- package/dist/esm/vega-page-notification_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +6 -6
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +6 -6
- package/dist/esm/vega-pagination.entry.js +14 -12
- package/dist/esm/vega-pie-chart.entry.js +1 -1
- package/dist/esm/vega-popover_2.entry.js +13 -11
- package/dist/esm/vega-progress-tracker.entry.js +5 -5
- package/dist/esm/vega-radio_2.entry.js +11 -11
- package/dist/esm/vega-rich-text-content.entry.js +305 -131
- package/dist/esm/vega-rich-text-editor_4.entry.js +1132 -2409
- package/dist/esm/vega-section-title.entry.js +1 -1
- package/dist/esm/vega-segment-control.entry.js +5 -5
- package/dist/esm/vega-selection-chip_2.entry.js +16 -15
- package/dist/esm/vega-selection-tile_2.entry.js +12 -12
- package/dist/esm/vega-sidenav_3.entry.js +14 -12
- package/dist/esm/vega-signature-capture.entry.js +16 -15
- package/dist/esm/{vega-skeleton-loader-controller-c2a8bd27.js → vega-skeleton-loader-controller-878e1b28.js} +1 -1
- package/dist/esm/vega-skeleton.entry.js +1 -1
- package/dist/esm/vega-slot-container.entry.js +1 -1
- package/dist/esm/vega-stepper.entry.js +11 -11
- package/dist/esm/vega-tab-group_2.entry.js +6 -6
- package/dist/esm/vega-table_8.entry.js +16 -14
- package/dist/esm/vega-text.entry.js +1 -1
- package/dist/esm/vega-textarea.entry.js +11 -11
- package/dist/esm/vega-time-picker_2.entry.js +17 -16
- package/dist/esm/vega-toggle-switch.entry.js +10 -10
- package/dist/esm/vega-tooltip_2.entry.js +12 -10
- package/dist/esm/vega.js +12 -10
- package/dist/types/components/vega-code-block/assets/copy.d.ts +3 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.d.ts +40 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.d.ts +19 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.d.ts +43 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.d.ts +23 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.d.ts +21 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.d.ts +100 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.d.ts +93 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.d.ts +21 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.d.ts +57 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.d.ts +23 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.d.ts +50 -0
- package/dist/types/components/vega-code-block/types.d.ts +19 -0
- package/dist/types/components/vega-code-block/vega-code-block.d.ts +116 -0
- package/dist/types/components/vega-rich-text-editor/assets/file-code.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/rectangle-code.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +4 -5
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/remove-code-block-action.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +17 -4
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.d.ts +40 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +6 -4
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +48 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +15 -3
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +3 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +39 -4
- package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +56 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +20 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +14 -4
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +46 -2
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +7 -2
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.d.ts +4 -11
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +39 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.d.ts +1 -15
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +65 -26
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +64 -6
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +3 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +30 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +2 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +2 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +7 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +17 -23
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +6 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +4 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +8 -2
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/code-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +7 -0
- package/dist/types/components.d.ts +95 -0
- package/dist/types/helpers/code-format/code-formatter.d.ts +34 -0
- package/dist/types/helpers/code-format/test/code-formatter.test.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.d.ts +20 -0
- package/dist/types/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.d.ts +1 -0
- package/dist/types/helpers/translation/interface.d.ts +6 -1
- package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +26 -0
- package/dist/types/types/components.type.d.ts +1 -0
- package/dist/types/utils/string.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-0104207d.entry.js +1 -0
- package/dist/vega/p-010f1715.entry.js +1 -0
- package/dist/vega/p-01593f9d.js +1 -0
- package/dist/vega/p-020b04ed.js +1 -0
- package/dist/vega/p-02841589.js +1 -0
- package/dist/vega/p-03cfb331.entry.js +9 -0
- package/dist/vega/{p-b649e86e.entry.js → p-0bff8716.entry.js} +1 -1
- package/dist/vega/p-1056a049.entry.js +1 -0
- package/dist/vega/p-10e41bbe.js +1 -0
- package/dist/vega/{p-83ef9e7d.entry.js → p-12e6173c.entry.js} +1 -1
- package/dist/vega/{p-54add0d2.js → p-1397ba3f.js} +1 -1
- package/dist/vega/p-13d9a1fd.entry.js +1 -0
- package/dist/vega/p-13eae47f.entry.js +1 -0
- package/dist/vega/p-1630864e.entry.js +1 -0
- package/dist/vega/p-1b335e30.entry.js +1 -0
- package/dist/vega/{p-8ade44bf.js → p-1e194737.js} +1 -1
- package/dist/vega/{p-252e42c7.entry.js → p-1f346008.entry.js} +1 -1
- package/dist/vega/p-1f86ab76.entry.js +1 -0
- package/dist/vega/p-1fe746ab.entry.js +1 -0
- package/dist/vega/{p-8c388b58.entry.js → p-211c028f.entry.js} +1 -1
- package/dist/vega/p-21d26bb4.js +2 -0
- package/dist/vega/{p-b351ace3.entry.js → p-23e6f2b2.entry.js} +1 -1
- package/dist/vega/p-268aea63.js +1 -0
- package/dist/vega/{p-a01f149d.entry.js → p-27ccf34d.entry.js} +1 -1
- package/dist/vega/{p-913eb7f9.entry.js → p-29f9be26.entry.js} +1 -1
- package/dist/vega/{p-27003a81.entry.js → p-30dcf606.entry.js} +1 -1
- package/dist/vega/{p-89ab72e3.js → p-3c20ae84.js} +1 -1
- package/dist/vega/p-4172fb81.js +1 -0
- package/dist/vega/{p-45f696b4.js → p-419697c6.js} +1 -1
- package/dist/vega/p-427e4cee.entry.js +1 -0
- package/dist/vega/p-4604ed0e.entry.js +1 -0
- package/dist/vega/{p-8d283666.js → p-4ab3df00.js} +1 -1
- package/dist/vega/{p-72ecfd40.js → p-4e8fb53a.js} +1 -1
- package/dist/vega/p-50a3ae3d.js +1 -0
- package/dist/vega/{p-b847a143.entry.js → p-50b80d76.entry.js} +1 -1
- package/dist/vega/p-531ffb18.entry.js +1 -0
- package/dist/vega/p-53daeb45.entry.js +1 -0
- package/dist/vega/p-54fdd401.entry.js +1 -0
- package/dist/vega/{p-47ff95ba.entry.js → p-5741ecf0.entry.js} +1 -1
- package/dist/vega/{p-6cabdb36.js → p-58f8928a.js} +1 -1
- package/dist/vega/{p-4a32a6c0.entry.js → p-5c4cb804.entry.js} +1 -1
- package/dist/vega/{p-a46bc9f1.entry.js → p-5ce386c8.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-0079088b.entry.js → p-5fd5a538.entry.js} +1 -1
- package/dist/vega/{p-0969877b.entry.js → p-64f452fe.entry.js} +1 -1
- package/dist/vega/p-66759f4e.js +1 -0
- package/dist/vega/{p-bc2dd43d.js → p-6ea42854.js} +1 -1
- package/dist/vega/p-70f25341.entry.js +1 -0
- package/dist/vega/{p-ec1f2d21.entry.js → p-737bccb9.entry.js} +1 -1
- package/dist/vega/{p-bcb10ae3.entry.js → p-7503fe08.entry.js} +1 -1
- package/dist/vega/{p-46714da3.entry.js → p-7b0a4688.entry.js} +1 -1
- package/dist/vega/p-7def7b74.entry.js +1 -0
- package/dist/vega/{p-48517a5d.entry.js → p-7f5a85c6.entry.js} +1 -1
- package/dist/vega/p-825ae7c4.js +1 -0
- package/dist/vega/p-831c4144.entry.js +1 -0
- package/dist/vega/p-85dc08b4.entry.js +1 -0
- package/dist/vega/{p-a821bcf3.js → p-86782109.js} +1 -1
- package/dist/vega/p-87459914.js +1 -0
- package/dist/vega/{p-1971d980.entry.js → p-87a1fc77.entry.js} +1 -1
- package/dist/vega/p-89565247.entry.js +1 -0
- package/dist/vega/{p-7088ead9.entry.js → p-89e915e9.entry.js} +1 -1
- package/dist/vega/{p-81fbfb6d.entry.js → p-8aa7e56e.entry.js} +1 -1
- package/dist/vega/p-94263ece.entry.js +1 -0
- package/dist/vega/{p-d0007822.entry.js → p-9524e48a.entry.js} +1 -1
- package/dist/vega/{p-147e3cbd.entry.js → p-991b4717.entry.js} +1 -1
- package/dist/vega/{p-647025dd.entry.js → p-99b9b320.entry.js} +1 -1
- package/dist/vega/{p-aea89be5.entry.js → p-9ba14b7c.entry.js} +1 -1
- package/dist/vega/p-9cb79f8d.entry.js +1 -0
- package/dist/vega/p-9e3f52f0.entry.js +1 -0
- package/dist/vega/{p-6586e2a2.entry.js → p-a0e122a6.entry.js} +1 -1
- package/dist/vega/{p-9803042f.entry.js → p-b0fe6c0f.entry.js} +1 -1
- package/dist/vega/{p-b2bca332.entry.js → p-b518e1a0.entry.js} +1 -1
- package/dist/vega/p-b538e81a.entry.js +1 -0
- package/dist/vega/p-b824baf7.entry.js +1 -0
- package/dist/vega/{p-2fadef27.entry.js → p-b959b4d4.entry.js} +1 -1
- package/dist/vega/{p-54f17c2e.entry.js → p-bb4f0fa1.entry.js} +1 -1
- package/dist/vega/{p-2da83c2a.js → p-bbb39d6f.js} +1 -1
- package/dist/vega/{p-cfda64fd.entry.js → p-bc8fd0ee.entry.js} +1 -1
- package/dist/vega/p-bcaf8375.entry.js +1 -0
- package/dist/vega/{p-02d7d948.entry.js → p-bec90ff3.entry.js} +1 -1
- package/dist/vega/p-c6b94dde.entry.js +1 -0
- package/dist/vega/{p-c754b32c.js → p-ce6b62c4.js} +1 -1
- package/dist/vega/{p-5e34ea25.entry.js → p-d00fbc11.entry.js} +1 -1
- package/dist/vega/{p-10a40dfb.entry.js → p-d2a2af2c.entry.js} +1 -1
- package/dist/vega/p-d64b20c2.js +1 -0
- package/dist/vega/p-da779940.entry.js +1 -0
- package/dist/vega/{p-a7dcb2a3.js → p-db910162.js} +1 -1
- package/dist/vega/{p-6f81fe1e.js → p-e1a2a701.js} +1 -1
- package/dist/vega/p-e3694aa5.entry.js +1 -0
- package/dist/vega/p-e7318c4c.entry.js +1 -0
- package/dist/vega/{p-a5c39ba2.entry.js → p-e8fc027e.entry.js} +1 -1
- package/dist/vega/{p-6a830bc5.entry.js → p-e92ecb78.entry.js} +1 -1
- package/dist/vega/p-e969c3f4.entry.js +1 -0
- package/dist/vega/{p-61eb7f32.entry.js → p-ec8b7f01.entry.js} +1 -1
- package/dist/vega/p-eed9bda2.entry.js +1 -0
- package/dist/vega/p-f4c54c98.entry.js +1 -0
- package/dist/vega/{p-5160a6b9.entry.js → p-f5fc80bc.entry.js} +1 -1
- package/dist/vega/p-f67be7ef.js +1 -0
- package/dist/vega/{p-5e3a15a1.js → p-f9fafc55.js} +1 -1
- package/dist/vega/{p-27e56c67.entry.js → p-fc21fb2d.entry.js} +1 -1
- package/dist/vega/p-fed9220b.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +2 -1
- package/dist/cjs/string-21427167.js +0 -13
- package/dist/esm/string-be824360.js +0 -11
- package/dist/vega/p-06adb37e.entry.js +0 -1
- package/dist/vega/p-06c5fe97.entry.js +0 -1
- package/dist/vega/p-0bb29d98.js +0 -1
- package/dist/vega/p-0ed7a098.entry.js +0 -1
- package/dist/vega/p-0f6b3a89.entry.js +0 -1
- package/dist/vega/p-136f665b.entry.js +0 -1
- package/dist/vega/p-1503f791.js +0 -1
- package/dist/vega/p-16fd7c32.js +0 -1
- package/dist/vega/p-1a263af1.entry.js +0 -1
- package/dist/vega/p-1af4771a.entry.js +0 -1
- package/dist/vega/p-1c298d5a.js +0 -2
- package/dist/vega/p-1c63afd2.entry.js +0 -1
- package/dist/vega/p-1e05b7b4.entry.js +0 -1
- package/dist/vega/p-1ea863a6.entry.js +0 -1
- package/dist/vega/p-271b30b9.entry.js +0 -1
- package/dist/vega/p-2d1d4f33.entry.js +0 -1
- package/dist/vega/p-353b3ded.entry.js +0 -1
- package/dist/vega/p-44b0a005.js +0 -1
- package/dist/vega/p-4e76904e.entry.js +0 -1
- package/dist/vega/p-4ec0d36f.entry.js +0 -1
- package/dist/vega/p-5c954088.entry.js +0 -1
- package/dist/vega/p-646a9198.entry.js +0 -1
- package/dist/vega/p-6d7d923b.js +0 -1
- package/dist/vega/p-6e898779.js +0 -1
- package/dist/vega/p-77492977.entry.js +0 -1
- package/dist/vega/p-804f71b3.js +0 -1
- package/dist/vega/p-8789d34d.entry.js +0 -1
- package/dist/vega/p-8813c0ac.entry.js +0 -1
- package/dist/vega/p-8a85c7af.entry.js +0 -1
- package/dist/vega/p-8ba43640.entry.js +0 -1
- package/dist/vega/p-98c64d77.entry.js +0 -1
- package/dist/vega/p-9f3539a4.entry.js +0 -1
- package/dist/vega/p-b42aea55.entry.js +0 -1
- package/dist/vega/p-b5d70ee0.entry.js +0 -1
- package/dist/vega/p-bf1894ec.js +0 -1
- package/dist/vega/p-bfb344e1.entry.js +0 -1
- package/dist/vega/p-c9a4e79a.entry.js +0 -1
- package/dist/vega/p-dbc82247.js +0 -1
- package/dist/vega/p-e2e36d2b.entry.js +0 -1
- package/dist/vega/p-ef8272b5.entry.js +0 -1
- package/dist/vega/p-f4c1d961.js +0 -1
- package/dist/vega/p-f5279deb.entry.js +0 -1
- package/dist/vega/p-f8033cd3.entry.js +0 -1
- package/dist/vega/p-fe63bd50.entry.js +0 -1
|
@@ -1,59 +1,170 @@
|
|
|
1
|
-
import { h, H as Host, F as Fragment, r as registerInstance, c as createEvent, g as getElement } from './index-
|
|
2
|
-
import { c as MapToComponentField, M as MapToComponentMethod, V as VegaSlimmer, I as InjectVegaSlimmer
|
|
1
|
+
import { h, H as Host, F as Fragment, r as registerInstance, c as createEvent, g as getElement } from './index-d0a47531.js';
|
|
2
|
+
import { c as MapToComponentField, M as MapToComponentMethod, V as VegaSlimmer, I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
3
3
|
import { V as VegaComponentUsageRuntimeMetricsSlimmer, I as InjectVegaGlobalSlimmer } from './component-usage-runtime-metrics-385c7124.js';
|
|
4
|
-
import {
|
|
4
|
+
import { s as sanitizeVegaComponent } from './component-cae24190.js';
|
|
5
5
|
import { c as createEnterKeyHandlerToTriggerClick } from './accessibility-e5fd0fab.js';
|
|
6
6
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
7
|
-
import { d as domNodeSubjectFactory, b as VegaDropdownClick, f as VegaChange, P as VegaImageInserted, a as VegaClick, M as VegaPopoverShow, N as VegaPopoverHide } from './dom-node-subject-factory-
|
|
8
|
-
import { V as VegaInternalComponentDidRender,
|
|
9
|
-
import { b as ToolbarButtonSlimmer, I as ImageAnnotationAction, T as TextNodeRenderingRegistry, a as TextColorToolbarButtonSlimmer } from './image-annotation-action-1aa938ab.js';
|
|
7
|
+
import { d as domNodeSubjectFactory, b as VegaDropdownClick, f as VegaChange, P as VegaImageInserted, a as VegaClick, M as VegaPopoverShow, N as VegaPopoverHide } from './dom-node-subject-factory-eb6bba5d.js';
|
|
8
|
+
import { V as VegaInternalComponentDidRender, a as VegaInternalRichTextEditorFlushChanges, v as VegaInternalRichTextEditDeleteSelectedNodes, w as VegaInternalRichTextImageClick, x as VegaInternalRichTextImageDeleteButtonClicked, r as VegaInternalPopoverUpdateTarget } from './vega-internal-event-id-820393ad.js';
|
|
10
9
|
import { V as VegaInternalIconManager } from './internal-icon-manager-58cf8aa6.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { g as RTETextNode, Y as BoldAnnotationAction, N as NodeAnnotationTypeEnum, V as RTECodeBlockNode, _ as ItalicAnnotationAction, $ as UnderlineAnnotationAction, d as RTETextBlock, a0 as TextStyleAnnotationAction, a1 as TextStyleAnnotation, a2 as BoldAnnotation, w as BlockAnnotationTypeEnum, a3 as ClearFormattingAnnotationAction, a4 as CodeAnnotationAction, a5 as StrikethroughAnnotationAction, P as SelectionChangeAction, L as LinkAnnotationAction, a as RTEImageNode, a6 as IndentAnnotationAction, M as ModifyContentAction, f as ModifyContentActionType, H as HorizontalAlignmentAnnotationAction, c as AppendChildNodesAction, Z as ZERO_WIDTH_SPACE, a7 as UpdateTextAction, a8 as MergeTwoBlocksNodesAction, S as SplitBlockWithNodeAction, R as RemoveChildAction, b as ReplaceChildNodesAction, e as InsertBlocksBeforeAction, I as InsertBlocksAfterAction, z as RTECodeBlock, F as stateEntityRenderingRegistry } from './code-block-8b5bd928.js';
|
|
11
|
+
import { V as VisualModeToolbarButtonSlimmer, I as ImageAnnotationAction, T as TextNodeRenderingRegistry, b as ToolbarButtonSlimmer, a as TextColorToolbarButtonSlimmer } from './image-annotation-action-a8b860ad.js';
|
|
12
|
+
import { D as DomNodeSubjectObserverFactory } from './dom-node-subject-observer-factory-6083d518.js';
|
|
13
13
|
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-8ada793f.js';
|
|
14
|
-
import { a as waitForComponentDidRender } from './index-
|
|
15
|
-
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-
|
|
16
|
-
import { c as createEventEmitSlimmer } from './event-emit-slimmer-
|
|
17
|
-
import { c as createSubStateNotifySlimmer } from './sub-state-notify-slimmer-
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { O as Observer } from './observer-3959f9dd.js';
|
|
21
|
-
import { f as findParent, r as rgbToHex } from './ui-ed1283bb.js';
|
|
14
|
+
import { a as waitForComponentDidRender } from './index-db0ec3ee.js';
|
|
15
|
+
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-bfb4034d.js';
|
|
16
|
+
import { c as createEventEmitSlimmer } from './event-emit-slimmer-480d3b54.js';
|
|
17
|
+
import { c as createSubStateNotifySlimmer } from './sub-state-notify-slimmer-04e06501.js';
|
|
18
|
+
import { a as RTEListItemBlock, V as VegaRTEContent, B as BreakSingleBlockAction, E as ElementToDtoStrategyProcessor, R as RTEImageBlock } from './content-state-8c3f862b.js';
|
|
19
|
+
import { R as RTESelectionState, A as AutoRunWhenReRenderTaskQueueSlimmer, b as SelectionController } from './selection-controller-dd4f4407.js';
|
|
22
20
|
import { b as FORM_ELEMENT_VALUE_CHANGE, D as DARK_MODE_CHANGE } from './static-subject-title-ca83d6b6.js';
|
|
21
|
+
import { O as Observer } from './observer-3959f9dd.js';
|
|
22
|
+
import { d as debounce } from './timer-9321173b.js';
|
|
23
23
|
import { D as DarkModeStateControllerSlimmer } from './dark-mode-state-controller-slimmer-f1c2c299.js';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { T as TranslationSlimmer } from './translation-slimmer-88966d5c.js';
|
|
24
|
+
import { R as RichTextEditorRequiredRule } from './rich-text-editor-required-rule-0d470d82.js';
|
|
25
|
+
import { C as ChildNodesEventPreventSlimmer } from './child-nodes-event-prevent-slimmer-1142fb79.js';
|
|
26
|
+
import { T as TranslationSlimmer } from './translation-slimmer-e6b130bf.js';
|
|
28
27
|
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-2ada8e22.js';
|
|
29
28
|
import { K as KeyboardManagerSlimmer } from './keyboard-manager-slimmer-42bf9773.js';
|
|
30
29
|
import { c as chevronDown } from './chevron-down-4a75d28e.js';
|
|
31
30
|
import { t as trashCan } from './trash-can-8819a939.js';
|
|
31
|
+
import { f as findParent } from './ui-ed1283bb.js';
|
|
32
32
|
import { r as remoteInvocationRegistry } from './remote-invocation-registry-d69245c2.js';
|
|
33
33
|
import './icon-manager-638dd4d4.js';
|
|
34
|
+
import './type-guard-158f6d7a.js';
|
|
35
|
+
import './breakpoints-d9faf11c.js';
|
|
36
|
+
import './ui-8424715a.js';
|
|
37
|
+
import './regex-dfe11abf.js';
|
|
38
|
+
import './typography-396de03f.js';
|
|
39
|
+
import './string-a953eafc.js';
|
|
34
40
|
import './dynamic-slimmer-90b8af32.js';
|
|
35
41
|
import './wait-for-vega-handler-b18eb955.js';
|
|
36
|
-
import './
|
|
37
|
-
import './translation-cf7f020a.js';
|
|
42
|
+
import './translation-71e0711d.js';
|
|
38
43
|
import './page-resize-observer-slimmer-15a84d26.js';
|
|
39
|
-
import './ui-8424715a.js';
|
|
40
|
-
import './breakpoints-d9faf11c.js';
|
|
41
44
|
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
42
45
|
import './mutation-observer-slimmer-6cef9549.js';
|
|
43
46
|
import './mutation-observer-filters-1a054fb0.js';
|
|
44
47
|
import './array-7888f339.js';
|
|
45
48
|
import './number-4398f2e1.js';
|
|
46
|
-
import './sub-state-observer-slimmer-
|
|
47
|
-
import './internal-vega-event-manager-
|
|
48
|
-
import './
|
|
49
|
-
import './typography-396de03f.js';
|
|
49
|
+
import './sub-state-observer-slimmer-b4c2ddc3.js';
|
|
50
|
+
import './internal-vega-event-manager-56c6469a.js';
|
|
51
|
+
import './synchronize-task-queue-ac8acc3b.js';
|
|
50
52
|
import './vega-env-manager-8f8dc473.js';
|
|
51
53
|
import './feature-flag-controller-0fbe8fb0.js';
|
|
52
54
|
import './index-44c794b4.js';
|
|
53
55
|
import './_commonjsHelpers-9943807e.js';
|
|
54
56
|
import './keyboard-manager-262be5ce.js';
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Class to format HTML code with proper indentation and style cleanup.
|
|
60
|
+
*/
|
|
61
|
+
class CodeFormatter {
|
|
62
|
+
constructor() {
|
|
63
|
+
/**
|
|
64
|
+
* Formats a given HTML source string by applying indentation and cleaning up styles.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} source - The HTML source string to format.
|
|
67
|
+
* @param {CodeFormatOptions} options - Formatting options.
|
|
68
|
+
* @returns {string} The formatted HTML string.
|
|
69
|
+
*/
|
|
70
|
+
this.format = (source, options = {}) => {
|
|
71
|
+
const { tabWidth = 4, useTabs = true } = options;
|
|
72
|
+
const indentUnit = useTabs ? '\t' : ' ';
|
|
73
|
+
const INDENT = indentUnit.repeat(tabWidth);
|
|
74
|
+
const tagRegex = /(<\/?[^>]+>)/g;
|
|
75
|
+
// Split source into tokens using tag boundaries while filtering out empty strings
|
|
76
|
+
const tokens = source.split(tagRegex).filter((t) => t.trim().length > 0);
|
|
77
|
+
let indentLevel = 0;
|
|
78
|
+
let output = '';
|
|
79
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
80
|
+
let token = tokens[i];
|
|
81
|
+
// Decrease indentation for closing tags
|
|
82
|
+
if (token.startsWith('</')) {
|
|
83
|
+
indentLevel = Math.max(0, indentLevel - 1);
|
|
84
|
+
}
|
|
85
|
+
const indent = INDENT.repeat(indentLevel);
|
|
86
|
+
if (token.startsWith('<')) {
|
|
87
|
+
// Clean and normalize inline style attributes
|
|
88
|
+
token = token.replace(/style\s*=\s*"([^"]*)"/g, (_, styleContent) => {
|
|
89
|
+
return `style="${this.formatStyle(styleContent)}"`;
|
|
90
|
+
});
|
|
91
|
+
const tagName = CodeFormatter.getTagName(token);
|
|
92
|
+
const isInline = CodeFormatter.INLINE_TAGS.has(tagName);
|
|
93
|
+
// Inline tag grouping: e.g., <strong>Text</strong> stays on one line
|
|
94
|
+
if (isInline && i + 2 < tokens.length && tokens[i + 2] === `</${tagName}>`) {
|
|
95
|
+
// Group consecutive inline tags
|
|
96
|
+
let inlineGroup = `${token}${tokens[i + 1]}${tokens[i + 2]}`;
|
|
97
|
+
i += 2;
|
|
98
|
+
// Keep merging consecutive inline tag pairs
|
|
99
|
+
while (i + 2 < tokens.length &&
|
|
100
|
+
tokens[i + 1].startsWith('<') &&
|
|
101
|
+
CodeFormatter.INLINE_TAGS.has(CodeFormatter.getTagName(tokens[i + 1])) &&
|
|
102
|
+
tokens[i + 3] === `</${CodeFormatter.getTagName(tokens[i + 1])}>`) {
|
|
103
|
+
inlineGroup += `${tokens[i + 1]}${tokens[i + 2]}${tokens[i + 3]}`;
|
|
104
|
+
i += 3;
|
|
105
|
+
}
|
|
106
|
+
output += `${indent}${inlineGroup}\n`;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
output += `${indent}${token}\n`;
|
|
110
|
+
// Increase indentation for non-void opening tags
|
|
111
|
+
if (!token.startsWith('</') &&
|
|
112
|
+
!token.endsWith('/>') &&
|
|
113
|
+
!/^<br|^<img|^<meta|^<input|^<hr/i.test(token)) {
|
|
114
|
+
indentLevel++;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Add plain text content with current indentation
|
|
120
|
+
const text = token;
|
|
121
|
+
if (text.length > 0) {
|
|
122
|
+
output += `${INDENT.repeat(indentLevel)}${text}\n`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return output.trim();
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Extracts the tag name from an HTML tag string.
|
|
131
|
+
*
|
|
132
|
+
* @param {string} tag - A raw HTML tag string
|
|
133
|
+
* @returns {string} The lowercase tag name, or an empty string if no match is found.
|
|
134
|
+
*/
|
|
135
|
+
static getTagName(tag) {
|
|
136
|
+
var _a;
|
|
137
|
+
const match = tag.match(/^<\/?([a-z0-9]+)/i);
|
|
138
|
+
return (_a = match === null || match === void 0 ? void 0 : match[1].toLowerCase()) !== null && _a !== void 0 ? _a : '';
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Formats a CSS style string by trimming white space and ensuring consistent semicolon spacing.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} style - The CSS style string to format.
|
|
144
|
+
* @returns {string} The formatted style string.
|
|
145
|
+
*/
|
|
146
|
+
formatStyle(style) {
|
|
147
|
+
return style
|
|
148
|
+
.split(';')
|
|
149
|
+
.map((s) => s.trim())
|
|
150
|
+
.filter(Boolean)
|
|
151
|
+
.join('; ');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
CodeFormatter.INLINE_TAGS = new Set([
|
|
155
|
+
'span',
|
|
156
|
+
'strong',
|
|
157
|
+
'em',
|
|
158
|
+
'a',
|
|
159
|
+
'b',
|
|
160
|
+
'i',
|
|
161
|
+
'u',
|
|
162
|
+
'small',
|
|
163
|
+
'abbr',
|
|
164
|
+
]);
|
|
165
|
+
const CodeFormatter$1 = new CodeFormatter();
|
|
166
|
+
|
|
167
|
+
var __decorate$B = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
57
168
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
58
169
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
59
170
|
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;
|
|
@@ -69,6 +180,7 @@ class VegaRichTextEditorRenderer extends VegaSlimmer {
|
|
|
69
180
|
return (h("div", { class: {
|
|
70
181
|
'rich-text-editor-container': true,
|
|
71
182
|
'disabled': this.disabled,
|
|
183
|
+
'vega-hidden': this.sourceView,
|
|
72
184
|
}, style: { minHeight: `${this.rows * 24}px` }, onClick: this.richTextContentFocus, role: "textbox", tabIndex: !this.disabled ? -1 : 0, onKeyDown: createEnterKeyHandlerToTriggerClick(), ref: (node) => (this.richTextContainerRef = node) },
|
|
73
185
|
h("vega-rich-text-content", { ref: (ref) => (this.richTextContentRef = ref), content: this.value }),
|
|
74
186
|
this.renderCharacterCounter()));
|
|
@@ -87,6 +199,16 @@ class VegaRichTextEditorRenderer extends VegaSlimmer {
|
|
|
87
199
|
this.richTextContentFocus = () => {
|
|
88
200
|
void this.richTextContentRef.vegaFocus();
|
|
89
201
|
};
|
|
202
|
+
this.renderSourceViewContent = () => {
|
|
203
|
+
if (this.toolbarItems && !this.toolbarItems.flat().includes('sourceEdit'))
|
|
204
|
+
return;
|
|
205
|
+
const sourceViewValue = this.value.toHtml();
|
|
206
|
+
return (h("div", { class: {
|
|
207
|
+
'source-view-container': true,
|
|
208
|
+
'vega-hidden': !this.sourceView,
|
|
209
|
+
} },
|
|
210
|
+
h("vega-code-block", { ref: (ref) => (this.sourceCodeBlockRef = ref), disabled: this.disabled, value: { language: 'html', code: CodeFormatter$1.format(sourceViewValue) } })));
|
|
211
|
+
};
|
|
90
212
|
}
|
|
91
213
|
/**
|
|
92
214
|
* Component lifecycle - [componentDidRender]{@link VegaRichTextEditor.componentDidRender}
|
|
@@ -105,7 +227,7 @@ class VegaRichTextEditorRenderer extends VegaSlimmer {
|
|
|
105
227
|
/**
|
|
106
228
|
* Returns the HTMLElement reference of the rich text content area.
|
|
107
229
|
*
|
|
108
|
-
* @returns {HTMLVegaRichTextContentElement} An HTMLVegaRichTextContentElement is being returned.
|
|
230
|
+
* @returns {Nullable<HTMLVegaRichTextContentElement>} An HTMLVegaRichTextContentElement is being returned.
|
|
109
231
|
*/
|
|
110
232
|
getRichTextContentRef() {
|
|
111
233
|
return this.richTextContentRef;
|
|
@@ -128,6 +250,11 @@ class VegaRichTextEditorRenderer extends VegaSlimmer {
|
|
|
128
250
|
return this.richTextContentRef.shadowRoot.querySelector('.rich-text-content');
|
|
129
251
|
}
|
|
130
252
|
}
|
|
253
|
+
getSourceCode() {
|
|
254
|
+
if (this.sourceCodeBlockRef) {
|
|
255
|
+
return this.sourceCodeBlockRef.value.code;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
131
258
|
render() {
|
|
132
259
|
return h(Host, null, this.renderRichTextEditor());
|
|
133
260
|
}
|
|
@@ -136,45 +263,56 @@ class VegaRichTextEditorRenderer extends VegaSlimmer {
|
|
|
136
263
|
this.renderLabel(),
|
|
137
264
|
this.hint && this.renderHintMessage(),
|
|
138
265
|
this.toolbarRenderer.render(),
|
|
139
|
-
this.
|
|
266
|
+
this.renderContent(),
|
|
140
267
|
this.renderErrorMessage()));
|
|
141
268
|
}
|
|
142
269
|
renderLabel() {
|
|
143
270
|
return (this.label && (h("vega-field-label", { onClick: this.richTextContentFocus, isFieldRequired: this.required, disabled: this.disabled, label: this.label })));
|
|
144
271
|
}
|
|
272
|
+
renderContent() {
|
|
273
|
+
return (h(Fragment, null,
|
|
274
|
+
this.renderTextContent(),
|
|
275
|
+
this.renderSourceViewContent()));
|
|
276
|
+
}
|
|
145
277
|
}
|
|
146
|
-
__decorate$
|
|
278
|
+
__decorate$B([
|
|
147
279
|
MapToComponentField()
|
|
148
280
|
], VegaRichTextEditorRenderer.prototype, "host", void 0);
|
|
149
|
-
__decorate$
|
|
281
|
+
__decorate$B([
|
|
150
282
|
MapToComponentField()
|
|
151
283
|
], VegaRichTextEditorRenderer.prototype, "toolbarRenderer", void 0);
|
|
152
|
-
__decorate$
|
|
284
|
+
__decorate$B([
|
|
153
285
|
MapToComponentField()
|
|
154
286
|
], VegaRichTextEditorRenderer.prototype, "label", void 0);
|
|
155
|
-
__decorate$
|
|
287
|
+
__decorate$B([
|
|
156
288
|
MapToComponentField()
|
|
157
289
|
], VegaRichTextEditorRenderer.prototype, "required", void 0);
|
|
158
|
-
__decorate$
|
|
290
|
+
__decorate$B([
|
|
159
291
|
MapToComponentField()
|
|
160
292
|
], VegaRichTextEditorRenderer.prototype, "hint", void 0);
|
|
161
|
-
__decorate$
|
|
293
|
+
__decorate$B([
|
|
162
294
|
MapToComponentField()
|
|
163
295
|
], VegaRichTextEditorRenderer.prototype, "disabled", void 0);
|
|
164
|
-
__decorate$
|
|
296
|
+
__decorate$B([
|
|
165
297
|
MapToComponentField()
|
|
166
298
|
], VegaRichTextEditorRenderer.prototype, "rows", void 0);
|
|
167
|
-
__decorate$
|
|
299
|
+
__decorate$B([
|
|
168
300
|
MapToComponentField()
|
|
169
301
|
], VegaRichTextEditorRenderer.prototype, "placeholder", void 0);
|
|
170
|
-
__decorate$
|
|
302
|
+
__decorate$B([
|
|
171
303
|
MapToComponentField()
|
|
172
304
|
], VegaRichTextEditorRenderer.prototype, "value", void 0);
|
|
173
|
-
__decorate$
|
|
305
|
+
__decorate$B([
|
|
306
|
+
MapToComponentField()
|
|
307
|
+
], VegaRichTextEditorRenderer.prototype, "sourceView", void 0);
|
|
308
|
+
__decorate$B([
|
|
309
|
+
MapToComponentField()
|
|
310
|
+
], VegaRichTextEditorRenderer.prototype, "toolbarItems", void 0);
|
|
311
|
+
__decorate$B([
|
|
174
312
|
MapToComponentMethod('componentDidRender')
|
|
175
313
|
], VegaRichTextEditorRenderer.prototype, "componentDidRender", null);
|
|
176
314
|
|
|
177
|
-
var __decorate$
|
|
315
|
+
var __decorate$A = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
178
316
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
179
317
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
180
318
|
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;
|
|
@@ -213,6 +351,10 @@ class ToolbarRenderer extends VegaSlimmer {
|
|
|
213
351
|
return this.bulletsNumbersToolbarButtonSlimmer;
|
|
214
352
|
case 'horizontalAlignment':
|
|
215
353
|
return this.horizontalAlignmentToolbarButtonSlimmer;
|
|
354
|
+
case 'codeBlock':
|
|
355
|
+
return this.codeBlockToolbarButtonSlimmer;
|
|
356
|
+
case 'sourceEdit':
|
|
357
|
+
return this.sourceEditToolbarButtonSlimmer;
|
|
216
358
|
}
|
|
217
359
|
};
|
|
218
360
|
}
|
|
@@ -224,63 +366,69 @@ class ToolbarRenderer extends VegaSlimmer {
|
|
|
224
366
|
})));
|
|
225
367
|
}
|
|
226
368
|
}
|
|
227
|
-
__decorate$
|
|
369
|
+
__decorate$A([
|
|
228
370
|
MapToComponentField()
|
|
229
371
|
], ToolbarRenderer.prototype, "toolbarItems", void 0);
|
|
230
|
-
__decorate$
|
|
372
|
+
__decorate$A([
|
|
231
373
|
MapToComponentField()
|
|
232
374
|
], ToolbarRenderer.prototype, "clearStyleToolbarButtonSlimmer", void 0);
|
|
233
|
-
__decorate$
|
|
375
|
+
__decorate$A([
|
|
234
376
|
MapToComponentField()
|
|
235
377
|
], ToolbarRenderer.prototype, "boldToolbarButtonSlimmer", void 0);
|
|
236
|
-
__decorate$
|
|
378
|
+
__decorate$A([
|
|
237
379
|
MapToComponentField()
|
|
238
380
|
], ToolbarRenderer.prototype, "textStylesToolbarButtonSlimmer", void 0);
|
|
239
|
-
__decorate$
|
|
381
|
+
__decorate$A([
|
|
240
382
|
MapToComponentField()
|
|
241
383
|
], ToolbarRenderer.prototype, "italicToolbarButtonSlimmer", void 0);
|
|
242
|
-
__decorate$
|
|
384
|
+
__decorate$A([
|
|
243
385
|
MapToComponentField()
|
|
244
386
|
], ToolbarRenderer.prototype, "underlineToolbarButtonSlimmer", void 0);
|
|
245
|
-
__decorate$
|
|
387
|
+
__decorate$A([
|
|
246
388
|
MapToComponentField()
|
|
247
389
|
], ToolbarRenderer.prototype, "textColorToolbarButtonSlimmer", void 0);
|
|
248
|
-
__decorate$
|
|
390
|
+
__decorate$A([
|
|
249
391
|
MapToComponentField()
|
|
250
392
|
], ToolbarRenderer.prototype, "bulletsNumbersToolbarButtonSlimmer", void 0);
|
|
251
|
-
__decorate$
|
|
393
|
+
__decorate$A([
|
|
252
394
|
MapToComponentField()
|
|
253
395
|
], ToolbarRenderer.prototype, "horizontalAlignmentToolbarButtonSlimmer", void 0);
|
|
254
|
-
__decorate$
|
|
396
|
+
__decorate$A([
|
|
255
397
|
MapToComponentField()
|
|
256
398
|
], ToolbarRenderer.prototype, "strikethroughToolbarButtonSlimmer", void 0);
|
|
257
|
-
__decorate$
|
|
399
|
+
__decorate$A([
|
|
258
400
|
MapToComponentField()
|
|
259
401
|
], ToolbarRenderer.prototype, "imageToolbarButtonSlimmer", void 0);
|
|
260
|
-
__decorate$
|
|
402
|
+
__decorate$A([
|
|
261
403
|
MapToComponentField()
|
|
262
404
|
], ToolbarRenderer.prototype, "moreIndentToolbarButtonSlimmer", void 0);
|
|
263
|
-
__decorate$
|
|
405
|
+
__decorate$A([
|
|
264
406
|
MapToComponentField()
|
|
265
407
|
], ToolbarRenderer.prototype, "lessIndentToolbarButtonSlimmer", void 0);
|
|
266
|
-
__decorate$
|
|
408
|
+
__decorate$A([
|
|
267
409
|
MapToComponentField()
|
|
268
410
|
], ToolbarRenderer.prototype, "codeToolbarButtonSlimmer", void 0);
|
|
269
|
-
__decorate$
|
|
411
|
+
__decorate$A([
|
|
270
412
|
MapToComponentField()
|
|
271
413
|
], ToolbarRenderer.prototype, "linkToolbarButtonSlimmer", void 0);
|
|
414
|
+
__decorate$A([
|
|
415
|
+
MapToComponentField()
|
|
416
|
+
], ToolbarRenderer.prototype, "codeBlockToolbarButtonSlimmer", void 0);
|
|
417
|
+
__decorate$A([
|
|
418
|
+
MapToComponentField()
|
|
419
|
+
], ToolbarRenderer.prototype, "sourceEditToolbarButtonSlimmer", void 0);
|
|
272
420
|
|
|
273
421
|
const bold = {
|
|
274
422
|
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>`,
|
|
275
423
|
};
|
|
276
424
|
|
|
277
|
-
var __decorate$
|
|
425
|
+
var __decorate$z = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
278
426
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
279
427
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
280
428
|
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;
|
|
281
429
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
282
430
|
};
|
|
283
|
-
class BoldToolbarButtonSlimmer extends
|
|
431
|
+
class BoldToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
284
432
|
constructor() {
|
|
285
433
|
super({
|
|
286
434
|
icon: 'bold',
|
|
@@ -308,7 +456,8 @@ class BoldToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
308
456
|
return (super.isDisabled() ||
|
|
309
457
|
selectedNodes.some((node) => {
|
|
310
458
|
var _a;
|
|
311
|
-
return
|
|
459
|
+
return node instanceof RTECodeBlockNode ||
|
|
460
|
+
((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
312
461
|
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE);
|
|
313
462
|
}));
|
|
314
463
|
}
|
|
@@ -316,7 +465,7 @@ class BoldToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
316
465
|
(() => {
|
|
317
466
|
VegaInternalIconManager.register({ bold });
|
|
318
467
|
})();
|
|
319
|
-
__decorate$
|
|
468
|
+
__decorate$z([
|
|
320
469
|
MapToComponentField()
|
|
321
470
|
], BoldToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
322
471
|
|
|
@@ -324,32 +473,13 @@ const italic = {
|
|
|
324
473
|
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>`,
|
|
325
474
|
};
|
|
326
475
|
|
|
327
|
-
|
|
328
|
-
* Action to toggle the italic annotation
|
|
329
|
-
*/
|
|
330
|
-
class ItalicAnnotationAction extends TextSplittableAction {
|
|
331
|
-
constructor(italic) {
|
|
332
|
-
super();
|
|
333
|
-
this.isFlushable = true;
|
|
334
|
-
this.italic = italic;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Converts the action to an annotation
|
|
338
|
-
*
|
|
339
|
-
* @returns {ItalicAnnotation} The annotation
|
|
340
|
-
*/
|
|
341
|
-
toAnnotation() {
|
|
342
|
-
return new ItalicAnnotation(this.italic);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
var __decorate$x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
476
|
+
var __decorate$y = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
347
477
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
348
478
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
349
479
|
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;
|
|
350
480
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
351
481
|
};
|
|
352
|
-
class ItalicToolbarButtonSlimmer extends
|
|
482
|
+
class ItalicToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
353
483
|
constructor() {
|
|
354
484
|
super({
|
|
355
485
|
icon: 'italic',
|
|
@@ -375,7 +505,8 @@ class ItalicToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
375
505
|
return (super.isDisabled() ||
|
|
376
506
|
selectedNodes.some((node) => {
|
|
377
507
|
var _a;
|
|
378
|
-
return
|
|
508
|
+
return node instanceof RTECodeBlockNode ||
|
|
509
|
+
((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
379
510
|
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE);
|
|
380
511
|
}));
|
|
381
512
|
}
|
|
@@ -383,7 +514,7 @@ class ItalicToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
383
514
|
(() => {
|
|
384
515
|
VegaInternalIconManager.register({ italic });
|
|
385
516
|
})();
|
|
386
|
-
__decorate$
|
|
517
|
+
__decorate$y([
|
|
387
518
|
MapToComponentField()
|
|
388
519
|
], ItalicToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
389
520
|
|
|
@@ -391,32 +522,13 @@ const underline = {
|
|
|
391
522
|
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>`,
|
|
392
523
|
};
|
|
393
524
|
|
|
394
|
-
|
|
395
|
-
* Action to toggle the underline annotation
|
|
396
|
-
*/
|
|
397
|
-
class UnderlineAnnotationAction extends TextSplittableAction {
|
|
398
|
-
constructor(underline) {
|
|
399
|
-
super();
|
|
400
|
-
this.isFlushable = true;
|
|
401
|
-
this.underline = underline;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Converts the action to an annotation
|
|
405
|
-
*
|
|
406
|
-
* @returns {Annotation} the annotation
|
|
407
|
-
*/
|
|
408
|
-
toAnnotation() {
|
|
409
|
-
return new UnderlineAnnotation(this.underline);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
var __decorate$w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
525
|
+
var __decorate$x = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
414
526
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
415
527
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
416
528
|
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;
|
|
417
529
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
418
530
|
};
|
|
419
|
-
class UnderlineToolbarButtonSlimmer extends
|
|
531
|
+
class UnderlineToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
420
532
|
constructor() {
|
|
421
533
|
super({
|
|
422
534
|
icon: 'underline',
|
|
@@ -445,7 +557,8 @@ class UnderlineToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
445
557
|
return (super.isDisabled() ||
|
|
446
558
|
selectedNodes.some((node) => {
|
|
447
559
|
var _a;
|
|
448
|
-
return
|
|
560
|
+
return node instanceof RTECodeBlockNode ||
|
|
561
|
+
((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
449
562
|
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE);
|
|
450
563
|
}));
|
|
451
564
|
}
|
|
@@ -453,7 +566,7 @@ class UnderlineToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
453
566
|
(() => {
|
|
454
567
|
VegaInternalIconManager.register({ underline });
|
|
455
568
|
})();
|
|
456
|
-
__decorate$
|
|
569
|
+
__decorate$x([
|
|
457
570
|
MapToComponentField()
|
|
458
571
|
], UnderlineToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
459
572
|
|
|
@@ -461,13 +574,13 @@ const textSize = {
|
|
|
461
574
|
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>`,
|
|
462
575
|
};
|
|
463
576
|
|
|
464
|
-
var __decorate$
|
|
577
|
+
var __decorate$w = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
465
578
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
466
579
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
467
580
|
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;
|
|
468
581
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
469
582
|
};
|
|
470
|
-
class TextStylesToolbarButtonSlimmer extends
|
|
583
|
+
class TextStylesToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
471
584
|
constructor() {
|
|
472
585
|
super({
|
|
473
586
|
icon: 'text-size',
|
|
@@ -509,7 +622,7 @@ class TextStylesToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
509
622
|
const boldAnnotation = new BoldAnnotation(item.bold);
|
|
510
623
|
return (h("vega-dropdown-item", { key: item.key, itemKey: item.key },
|
|
511
624
|
h("vega-box", { padding: { right: 'size-20' } },
|
|
512
|
-
h("div", { style: Object.assign(Object.assign({}, textStyleAnnotation.
|
|
625
|
+
h("div", { style: Object.assign(Object.assign({}, textStyleAnnotation.renderStyle({ standalone: true })), boldAnnotation.renderStyle({ standalone: true })) }, this.translationSlimmer.t(item.label)))));
|
|
513
626
|
})));
|
|
514
627
|
}
|
|
515
628
|
isSelected() {
|
|
@@ -518,7 +631,8 @@ class TextStylesToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
518
631
|
isDisabled() {
|
|
519
632
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
520
633
|
return (super.isDisabled() ||
|
|
521
|
-
selectedNodes.some((node) => node
|
|
634
|
+
selectedNodes.some((node) => node instanceof RTECodeBlockNode ||
|
|
635
|
+
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE)));
|
|
522
636
|
}
|
|
523
637
|
addDropdownObserver(dropdownRef) {
|
|
524
638
|
DomNodeSubjectObserverFactory.addUniqueObserverToNode(dropdownRef, VegaDropdownClick, this.handleDropdownItemClick);
|
|
@@ -571,10 +685,10 @@ TextStylesToolbarButtonSlimmer.items = [
|
|
|
571
685
|
label: 'Paragraph',
|
|
572
686
|
},
|
|
573
687
|
];
|
|
574
|
-
__decorate$
|
|
688
|
+
__decorate$w([
|
|
575
689
|
MapToComponentField()
|
|
576
690
|
], TextStylesToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
577
|
-
__decorate$
|
|
691
|
+
__decorate$w([
|
|
578
692
|
MapToComponentField()
|
|
579
693
|
], TextStylesToolbarButtonSlimmer.prototype, "focusController", void 0);
|
|
580
694
|
|
|
@@ -582,13 +696,13 @@ const TextSlash = {
|
|
|
582
696
|
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>`,
|
|
583
697
|
};
|
|
584
698
|
|
|
585
|
-
var __decorate$
|
|
699
|
+
var __decorate$v = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
586
700
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
587
701
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
588
702
|
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;
|
|
589
703
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
590
704
|
};
|
|
591
|
-
class ClearStyleToolbarButtonSlimmer extends
|
|
705
|
+
class ClearStyleToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
592
706
|
constructor() {
|
|
593
707
|
super({
|
|
594
708
|
icon: 'text-slash',
|
|
@@ -611,7 +725,8 @@ class ClearStyleToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
611
725
|
isDisabled() {
|
|
612
726
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
613
727
|
return (super.isDisabled() ||
|
|
614
|
-
selectedNodes.some((node) => node
|
|
728
|
+
selectedNodes.some((node) => node instanceof RTECodeBlockNode ||
|
|
729
|
+
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE)));
|
|
615
730
|
}
|
|
616
731
|
}
|
|
617
732
|
(() => {
|
|
@@ -619,7 +734,7 @@ class ClearStyleToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
619
734
|
'text-slash': TextSlash,
|
|
620
735
|
});
|
|
621
736
|
})();
|
|
622
|
-
__decorate$
|
|
737
|
+
__decorate$v([
|
|
623
738
|
MapToComponentField()
|
|
624
739
|
], ClearStyleToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
625
740
|
|
|
@@ -627,13 +742,13 @@ const codeSimple = {
|
|
|
627
742
|
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>`,
|
|
628
743
|
};
|
|
629
744
|
|
|
630
|
-
var __decorate$
|
|
745
|
+
var __decorate$u = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
631
746
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
632
747
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
633
748
|
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;
|
|
634
749
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
635
750
|
};
|
|
636
|
-
class CodeToolbarButtonSlimmer extends
|
|
751
|
+
class CodeToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
637
752
|
constructor() {
|
|
638
753
|
super({
|
|
639
754
|
icon: 'code-simple',
|
|
@@ -658,14 +773,15 @@ class CodeToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
658
773
|
isDisabled() {
|
|
659
774
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
660
775
|
return (super.isDisabled() ||
|
|
661
|
-
selectedNodes.some((node) => node
|
|
776
|
+
selectedNodes.some((node) => node instanceof RTECodeBlockNode ||
|
|
777
|
+
node.getAnnotationByType(NodeAnnotationTypeEnum.LINK) ||
|
|
662
778
|
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE)));
|
|
663
779
|
}
|
|
664
780
|
}
|
|
665
781
|
(() => {
|
|
666
782
|
VegaInternalIconManager.register({ 'code-simple': codeSimple });
|
|
667
783
|
})();
|
|
668
|
-
__decorate$
|
|
784
|
+
__decorate$u([
|
|
669
785
|
MapToComponentField()
|
|
670
786
|
], CodeToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
671
787
|
|
|
@@ -673,32 +789,13 @@ const strikethrough = {
|
|
|
673
789
|
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>`,
|
|
674
790
|
};
|
|
675
791
|
|
|
676
|
-
|
|
677
|
-
* Action to toggle the strikethrough annotation
|
|
678
|
-
*/
|
|
679
|
-
class StrikethroughAnnotationAction extends TextSplittableAction {
|
|
680
|
-
constructor(underline) {
|
|
681
|
-
super();
|
|
682
|
-
this.isFlushable = true;
|
|
683
|
-
this.strikethrough = underline;
|
|
684
|
-
}
|
|
685
|
-
/**
|
|
686
|
-
* Converts the action to an annotation
|
|
687
|
-
*
|
|
688
|
-
* @returns {Annotation} the annotation
|
|
689
|
-
*/
|
|
690
|
-
toAnnotation() {
|
|
691
|
-
return new StrikethroughAnnotation(this.strikethrough);
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
792
|
+
var __decorate$t = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
696
793
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
697
794
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
698
795
|
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;
|
|
699
796
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
700
797
|
};
|
|
701
|
-
class StrikethroughToolbarButtonSlimmer extends
|
|
798
|
+
class StrikethroughToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
702
799
|
constructor() {
|
|
703
800
|
super({
|
|
704
801
|
icon: 'strikethrough',
|
|
@@ -727,7 +824,8 @@ class StrikethroughToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
727
824
|
return (super.isDisabled() ||
|
|
728
825
|
selectedNodes.some((node) => {
|
|
729
826
|
var _a;
|
|
730
|
-
return
|
|
827
|
+
return node instanceof RTECodeBlockNode ||
|
|
828
|
+
((_a = node.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code) ||
|
|
731
829
|
node.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE);
|
|
732
830
|
}));
|
|
733
831
|
}
|
|
@@ -735,7 +833,7 @@ class StrikethroughToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
735
833
|
(() => {
|
|
736
834
|
VegaInternalIconManager.register({ strikethrough });
|
|
737
835
|
})();
|
|
738
|
-
__decorate$
|
|
836
|
+
__decorate$t([
|
|
739
837
|
MapToComponentField()
|
|
740
838
|
], StrikethroughToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
741
839
|
|
|
@@ -743,32 +841,13 @@ const link = {
|
|
|
743
841
|
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>`,
|
|
744
842
|
};
|
|
745
843
|
|
|
746
|
-
|
|
747
|
-
* Action to change the selection range
|
|
748
|
-
*/
|
|
749
|
-
class SelectionChangeAction extends AnnotationAction {
|
|
750
|
-
constructor(range) {
|
|
751
|
-
super();
|
|
752
|
-
this.isFlushable = false;
|
|
753
|
-
this.range = range;
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* Converts the action to an annotation
|
|
757
|
-
*
|
|
758
|
-
* @returns {SelectionRangeAnnotation} The annotation
|
|
759
|
-
*/
|
|
760
|
-
toAnnotation() {
|
|
761
|
-
return new SelectionRangeAnnotation(this.range);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
844
|
+
var __decorate$s = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
766
845
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
767
846
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
768
847
|
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;
|
|
769
848
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
770
849
|
};
|
|
771
|
-
class LinkToolbarButtonSlimmer extends
|
|
850
|
+
class LinkToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
772
851
|
constructor() {
|
|
773
852
|
super({
|
|
774
853
|
icon: 'link',
|
|
@@ -844,7 +923,7 @@ class LinkToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
844
923
|
(() => {
|
|
845
924
|
VegaInternalIconManager.register({ link: link });
|
|
846
925
|
})();
|
|
847
|
-
__decorate$
|
|
926
|
+
__decorate$s([
|
|
848
927
|
MapToComponentField()
|
|
849
928
|
], LinkToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
850
929
|
|
|
@@ -852,32 +931,13 @@ const indent = {
|
|
|
852
931
|
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>`,
|
|
853
932
|
};
|
|
854
933
|
|
|
855
|
-
|
|
856
|
-
* Action to toggle block indent annotation
|
|
857
|
-
*/
|
|
858
|
-
class IndentAnnotationAction extends AnnotationAction {
|
|
859
|
-
constructor(indent) {
|
|
860
|
-
super();
|
|
861
|
-
this.isFlushable = true;
|
|
862
|
-
this.indent = indent;
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* Converts the action to an annotation
|
|
866
|
-
*
|
|
867
|
-
* @returns {Annotation} The annotation
|
|
868
|
-
*/
|
|
869
|
-
toAnnotation() {
|
|
870
|
-
return new IndentAnnotation(this.indent);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
934
|
+
var __decorate$r = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
875
935
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
876
936
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
877
937
|
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;
|
|
878
938
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
879
939
|
};
|
|
880
|
-
class MoreIndentToolbarButtonSlimmer extends
|
|
940
|
+
class MoreIndentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
881
941
|
constructor() {
|
|
882
942
|
super({
|
|
883
943
|
icon: 'indent',
|
|
@@ -893,7 +953,7 @@ class MoreIndentToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
893
953
|
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
894
954
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
895
955
|
return (super.isDisabled() ||
|
|
896
|
-
selectedBlocks.some((node) => node.type === 'list-item') ||
|
|
956
|
+
selectedBlocks.some((node) => node.type === 'list-item' || node.type === 'code-block') ||
|
|
897
957
|
selectedNodes.some((node) => node instanceof RTEImageNode));
|
|
898
958
|
}
|
|
899
959
|
onClick() {
|
|
@@ -907,7 +967,7 @@ class MoreIndentToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
907
967
|
(() => {
|
|
908
968
|
VegaInternalIconManager.register({ indent: indent });
|
|
909
969
|
})();
|
|
910
|
-
__decorate$
|
|
970
|
+
__decorate$r([
|
|
911
971
|
MapToComponentField()
|
|
912
972
|
], MoreIndentToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
913
973
|
|
|
@@ -915,13 +975,13 @@ const outdent = {
|
|
|
915
975
|
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>`,
|
|
916
976
|
};
|
|
917
977
|
|
|
918
|
-
var __decorate$
|
|
978
|
+
var __decorate$q = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
919
979
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
920
980
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
921
981
|
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;
|
|
922
982
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
923
983
|
};
|
|
924
|
-
class LessIndentToolbarButtonSlimmer extends
|
|
984
|
+
class LessIndentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
925
985
|
constructor() {
|
|
926
986
|
super({
|
|
927
987
|
icon: 'outdent',
|
|
@@ -937,7 +997,7 @@ class LessIndentToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
937
997
|
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
938
998
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
939
999
|
return (super.isDisabled() ||
|
|
940
|
-
selectedBlocks.some((node) => node.type === 'list-item') ||
|
|
1000
|
+
selectedBlocks.some((node) => node.type === 'list-item' || node.type === 'code-block') ||
|
|
941
1001
|
selectedNodes.some((node) => node instanceof RTEImageNode));
|
|
942
1002
|
}
|
|
943
1003
|
onClick() {
|
|
@@ -952,7 +1012,7 @@ class LessIndentToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
952
1012
|
(() => {
|
|
953
1013
|
VegaInternalIconManager.register({ outdent: outdent });
|
|
954
1014
|
})();
|
|
955
|
-
__decorate$
|
|
1015
|
+
__decorate$q([
|
|
956
1016
|
MapToComponentField()
|
|
957
1017
|
], LessIndentToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
958
1018
|
|
|
@@ -973,13 +1033,13 @@ class ImageUpdateUrlAction extends ModifyContentAction {
|
|
|
973
1033
|
}
|
|
974
1034
|
}
|
|
975
1035
|
|
|
976
|
-
var __decorate$
|
|
1036
|
+
var __decorate$p = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
977
1037
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
978
1038
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
979
1039
|
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;
|
|
980
1040
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
981
1041
|
};
|
|
982
|
-
class ImageToolbarButtonSlimmer extends
|
|
1042
|
+
class ImageToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
983
1043
|
constructor() {
|
|
984
1044
|
super({
|
|
985
1045
|
icon: 'image',
|
|
@@ -1031,13 +1091,13 @@ class ImageToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1031
1091
|
(() => {
|
|
1032
1092
|
VegaInternalIconManager.register({ image: image });
|
|
1033
1093
|
})();
|
|
1034
|
-
__decorate$
|
|
1094
|
+
__decorate$p([
|
|
1035
1095
|
MapToComponentField()
|
|
1036
1096
|
], ImageToolbarButtonSlimmer.prototype, "insertImageController", void 0);
|
|
1037
|
-
__decorate$
|
|
1097
|
+
__decorate$p([
|
|
1038
1098
|
MapToComponentField()
|
|
1039
1099
|
], ImageToolbarButtonSlimmer.prototype, "imageInsertedEventEmitter", void 0);
|
|
1040
|
-
__decorate$
|
|
1100
|
+
__decorate$p([
|
|
1041
1101
|
MapToComponentField()
|
|
1042
1102
|
], ImageToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1043
1103
|
|
|
@@ -1074,13 +1134,13 @@ class TransformParagraphAction extends ModifyContentAction {
|
|
|
1074
1134
|
}
|
|
1075
1135
|
}
|
|
1076
1136
|
|
|
1077
|
-
var __decorate$
|
|
1137
|
+
var __decorate$o = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1078
1138
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1079
1139
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1080
1140
|
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;
|
|
1081
1141
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1082
1142
|
};
|
|
1083
|
-
class BulletsToolbarButtonSlimmer extends
|
|
1143
|
+
class BulletsToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1084
1144
|
constructor() {
|
|
1085
1145
|
super({
|
|
1086
1146
|
icon: 'list-ul',
|
|
@@ -1104,7 +1164,8 @@ class BulletsToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1104
1164
|
}
|
|
1105
1165
|
isDisabled() {
|
|
1106
1166
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1107
|
-
return super.isDisabled() ||
|
|
1167
|
+
return (super.isDisabled() ||
|
|
1168
|
+
selectedNodes.some((node) => node instanceof RTEImageNode || node instanceof RTECodeBlockNode));
|
|
1108
1169
|
}
|
|
1109
1170
|
isListType(selectedBlocks, type = 'bullet-list') {
|
|
1110
1171
|
return (selectedBlocks.length > 0 &&
|
|
@@ -1132,20 +1193,20 @@ class BulletsToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1132
1193
|
}
|
|
1133
1194
|
}
|
|
1134
1195
|
}
|
|
1135
|
-
__decorate$
|
|
1196
|
+
__decorate$o([
|
|
1136
1197
|
MapToComponentField()
|
|
1137
1198
|
], BulletsToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1138
|
-
__decorate$
|
|
1199
|
+
__decorate$o([
|
|
1139
1200
|
MapToComponentField()
|
|
1140
1201
|
], BulletsToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1141
1202
|
|
|
1142
|
-
var __decorate$
|
|
1203
|
+
var __decorate$n = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1143
1204
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1144
1205
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1145
1206
|
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;
|
|
1146
1207
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1147
1208
|
};
|
|
1148
|
-
class NumbersToolbarButtonSlimmer extends
|
|
1209
|
+
class NumbersToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1149
1210
|
constructor() {
|
|
1150
1211
|
super({
|
|
1151
1212
|
icon: 'list-ol',
|
|
@@ -1167,7 +1228,8 @@ class NumbersToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1167
1228
|
}
|
|
1168
1229
|
isDisabled() {
|
|
1169
1230
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1170
|
-
return super.isDisabled() ||
|
|
1231
|
+
return (super.isDisabled() ||
|
|
1232
|
+
selectedNodes.some((node) => node instanceof RTEImageNode || node instanceof RTECodeBlockNode));
|
|
1171
1233
|
}
|
|
1172
1234
|
isListType(selectedBlocks, type = 'number-list') {
|
|
1173
1235
|
return (selectedBlocks.length > 0 &&
|
|
@@ -1195,20 +1257,20 @@ class NumbersToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1195
1257
|
}
|
|
1196
1258
|
}
|
|
1197
1259
|
}
|
|
1198
|
-
__decorate$
|
|
1260
|
+
__decorate$n([
|
|
1199
1261
|
MapToComponentField()
|
|
1200
1262
|
], NumbersToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1201
|
-
__decorate$
|
|
1263
|
+
__decorate$n([
|
|
1202
1264
|
MapToComponentField()
|
|
1203
1265
|
], NumbersToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1204
1266
|
|
|
1205
|
-
var __decorate$
|
|
1267
|
+
var __decorate$m = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1206
1268
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1207
1269
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1208
1270
|
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;
|
|
1209
1271
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1210
1272
|
};
|
|
1211
|
-
class BulletsNumbersToolbarButtonSlimmer extends
|
|
1273
|
+
class BulletsNumbersToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1212
1274
|
constructor() {
|
|
1213
1275
|
super({
|
|
1214
1276
|
icon: 'list-ul',
|
|
@@ -1242,7 +1304,8 @@ class BulletsNumbersToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1242
1304
|
}
|
|
1243
1305
|
isDisabled() {
|
|
1244
1306
|
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1245
|
-
return super.isDisabled() ||
|
|
1307
|
+
return (super.isDisabled() ||
|
|
1308
|
+
selectedNodes.some((node) => node instanceof RTEImageNode || node instanceof RTECodeBlockNode));
|
|
1246
1309
|
}
|
|
1247
1310
|
}
|
|
1248
1311
|
(() => {
|
|
@@ -1251,49 +1314,30 @@ class BulletsNumbersToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1251
1314
|
'list-ol': ListOL,
|
|
1252
1315
|
});
|
|
1253
1316
|
})();
|
|
1254
|
-
__decorate$
|
|
1317
|
+
__decorate$m([
|
|
1255
1318
|
MapToComponentField()
|
|
1256
1319
|
], BulletsNumbersToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1257
|
-
__decorate$
|
|
1320
|
+
__decorate$m([
|
|
1258
1321
|
InjectVegaSlimmer()
|
|
1259
1322
|
], BulletsNumbersToolbarButtonSlimmer.prototype, "bulletsToolbarButtonSlimmer", void 0);
|
|
1260
|
-
__decorate$
|
|
1323
|
+
__decorate$m([
|
|
1261
1324
|
InjectVegaSlimmer()
|
|
1262
1325
|
], BulletsNumbersToolbarButtonSlimmer.prototype, "numbersToolbarButtonSlimmer", void 0);
|
|
1263
|
-
__decorate$
|
|
1326
|
+
__decorate$m([
|
|
1264
1327
|
MapToComponentMethod('componentWillRender')
|
|
1265
1328
|
], BulletsNumbersToolbarButtonSlimmer.prototype, "componentWillRender", null);
|
|
1266
1329
|
|
|
1267
|
-
/**
|
|
1268
|
-
* Action to toggle block horizontal alignment annotation
|
|
1269
|
-
*/
|
|
1270
|
-
class HorizontalAlignmentAnnotationAction extends AnnotationAction {
|
|
1271
|
-
constructor(textAlign) {
|
|
1272
|
-
super();
|
|
1273
|
-
this.isFlushable = true;
|
|
1274
|
-
this.textAlign = textAlign;
|
|
1275
|
-
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Converts the action to an annotation
|
|
1278
|
-
*
|
|
1279
|
-
* @returns {HorizontalAlignmentAnnotation} The annotation
|
|
1280
|
-
*/
|
|
1281
|
-
toAnnotation() {
|
|
1282
|
-
return new HorizontalAlignmentAnnotation(this.textAlign);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
1330
|
const AlignLeft = {
|
|
1287
1331
|
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="M288 64c0 17.7-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32H256c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H256c17.7 0 32 14.3 32 32zM0 192c0-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-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,
|
|
1288
1332
|
};
|
|
1289
1333
|
|
|
1290
|
-
var __decorate$
|
|
1334
|
+
var __decorate$l = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1291
1335
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1292
1336
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1293
1337
|
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;
|
|
1294
1338
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1295
1339
|
};
|
|
1296
|
-
class LeftAlignToolbarButtonSlimmer extends
|
|
1340
|
+
class LeftAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1297
1341
|
constructor() {
|
|
1298
1342
|
super({
|
|
1299
1343
|
icon: 'align-left',
|
|
@@ -1322,10 +1366,10 @@ class LeftAlignToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1322
1366
|
'align-left': AlignLeft,
|
|
1323
1367
|
});
|
|
1324
1368
|
})();
|
|
1325
|
-
__decorate$
|
|
1369
|
+
__decorate$l([
|
|
1326
1370
|
MapToComponentField()
|
|
1327
1371
|
], LeftAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1328
|
-
__decorate$
|
|
1372
|
+
__decorate$l([
|
|
1329
1373
|
MapToComponentField()
|
|
1330
1374
|
], LeftAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1331
1375
|
|
|
@@ -1333,13 +1377,13 @@ const AlignCenter = {
|
|
|
1333
1377
|
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="M352 64c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 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 32zM352 320c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32s14.3 32 32 32H320c17.7 0 32-14.3 32-32z"/></svg>`,
|
|
1334
1378
|
};
|
|
1335
1379
|
|
|
1336
|
-
var __decorate$
|
|
1380
|
+
var __decorate$k = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1337
1381
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1338
1382
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1339
1383
|
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;
|
|
1340
1384
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1341
1385
|
};
|
|
1342
|
-
class CenterAlignToolbarButtonSlimmer extends
|
|
1386
|
+
class CenterAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1343
1387
|
constructor() {
|
|
1344
1388
|
super({
|
|
1345
1389
|
icon: 'align-center',
|
|
@@ -1368,10 +1412,10 @@ class CenterAlignToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1368
1412
|
'align-center': AlignCenter,
|
|
1369
1413
|
});
|
|
1370
1414
|
})();
|
|
1371
|
-
__decorate$
|
|
1415
|
+
__decorate$k([
|
|
1372
1416
|
MapToComponentField()
|
|
1373
1417
|
], CenterAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1374
|
-
__decorate$
|
|
1418
|
+
__decorate$k([
|
|
1375
1419
|
MapToComponentField()
|
|
1376
1420
|
], CenterAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1377
1421
|
|
|
@@ -1379,13 +1423,13 @@ const AlignRight = {
|
|
|
1379
1423
|
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="M448 64c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32zM0 192c0-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-32zM448 448c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,
|
|
1380
1424
|
};
|
|
1381
1425
|
|
|
1382
|
-
var __decorate$
|
|
1426
|
+
var __decorate$j = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1383
1427
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1384
1428
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1385
1429
|
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;
|
|
1386
1430
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1387
1431
|
};
|
|
1388
|
-
class RightAlignToolbarButtonSlimmer extends
|
|
1432
|
+
class RightAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1389
1433
|
constructor() {
|
|
1390
1434
|
super({
|
|
1391
1435
|
icon: 'align-right',
|
|
@@ -1414,10 +1458,10 @@ class RightAlignToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1414
1458
|
'align-right': AlignRight,
|
|
1415
1459
|
});
|
|
1416
1460
|
})();
|
|
1417
|
-
__decorate$
|
|
1461
|
+
__decorate$j([
|
|
1418
1462
|
MapToComponentField()
|
|
1419
1463
|
], RightAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1420
|
-
__decorate$
|
|
1464
|
+
__decorate$j([
|
|
1421
1465
|
MapToComponentField()
|
|
1422
1466
|
], RightAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1423
1467
|
|
|
@@ -1425,13 +1469,13 @@ const AlignJustify = {
|
|
|
1425
1469
|
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="M448 64c0-17.7-14.3-32-32-32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32zm0 256c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32zM0 192c0 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 32zM448 448c0-17.7-14.3-32-32-32H32c-17.7 0-32 14.3-32 32s14.3 32 32 32H416c17.7 0 32-14.3 32-32z"/></svg>`,
|
|
1426
1470
|
};
|
|
1427
1471
|
|
|
1428
|
-
var __decorate$
|
|
1472
|
+
var __decorate$i = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1429
1473
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1430
1474
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1431
1475
|
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;
|
|
1432
1476
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1433
1477
|
};
|
|
1434
|
-
class JustifyAlignToolbarButtonSlimmer extends
|
|
1478
|
+
class JustifyAlignToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1435
1479
|
constructor() {
|
|
1436
1480
|
super({
|
|
1437
1481
|
icon: 'align-justify',
|
|
@@ -1460,20 +1504,20 @@ class JustifyAlignToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1460
1504
|
'align-justify': AlignJustify,
|
|
1461
1505
|
});
|
|
1462
1506
|
})();
|
|
1463
|
-
__decorate$
|
|
1507
|
+
__decorate$i([
|
|
1464
1508
|
MapToComponentField()
|
|
1465
1509
|
], JustifyAlignToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1466
|
-
__decorate$
|
|
1510
|
+
__decorate$i([
|
|
1467
1511
|
MapToComponentField()
|
|
1468
1512
|
], JustifyAlignToolbarButtonSlimmer.prototype, "popoverRef", void 0);
|
|
1469
1513
|
|
|
1470
|
-
var __decorate$
|
|
1514
|
+
var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1471
1515
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1472
1516
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1473
1517
|
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;
|
|
1474
1518
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1475
1519
|
};
|
|
1476
|
-
class HorizontalAlignmentToolbarButtonSlimmer extends
|
|
1520
|
+
class HorizontalAlignmentToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
1477
1521
|
constructor() {
|
|
1478
1522
|
super({
|
|
1479
1523
|
icon: 'align-left',
|
|
@@ -1518,2279 +1562,703 @@ class HorizontalAlignmentToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
|
1518
1562
|
isSelected() {
|
|
1519
1563
|
return false;
|
|
1520
1564
|
}
|
|
1565
|
+
isDisabled() {
|
|
1566
|
+
return (super.isDisabled() ||
|
|
1567
|
+
this.selectionController
|
|
1568
|
+
.getSelectedBlocks()
|
|
1569
|
+
.some((block) => block.type === 'code-block'));
|
|
1570
|
+
}
|
|
1521
1571
|
}
|
|
1522
|
-
__decorate$
|
|
1572
|
+
__decorate$h([
|
|
1523
1573
|
MapToComponentField()
|
|
1524
1574
|
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
1525
|
-
__decorate$
|
|
1575
|
+
__decorate$h([
|
|
1526
1576
|
InjectVegaSlimmer()
|
|
1527
1577
|
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "leftAlignToolbarButtonSlimmer", void 0);
|
|
1528
|
-
__decorate$
|
|
1578
|
+
__decorate$h([
|
|
1529
1579
|
InjectVegaSlimmer()
|
|
1530
1580
|
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "centerAlignToolbarButtonSlimmer", void 0);
|
|
1531
|
-
__decorate$
|
|
1581
|
+
__decorate$h([
|
|
1532
1582
|
InjectVegaSlimmer()
|
|
1533
1583
|
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "rightAlignToolbarButtonSlimmer", void 0);
|
|
1534
|
-
__decorate$
|
|
1584
|
+
__decorate$h([
|
|
1535
1585
|
InjectVegaSlimmer()
|
|
1536
1586
|
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "justifiedToolbarButtonSlimmer", void 0);
|
|
1537
|
-
__decorate$
|
|
1587
|
+
__decorate$h([
|
|
1538
1588
|
MapToComponentMethod('componentWillRender')
|
|
1539
1589
|
], HorizontalAlignmentToolbarButtonSlimmer.prototype, "componentWillRender", null);
|
|
1540
1590
|
|
|
1541
|
-
let processing = false;
|
|
1542
1591
|
/**
|
|
1543
|
-
*
|
|
1544
|
-
* Cypress test case added in https://github.com/heartlandpayments/Vega/pull/1561/files#diff-83bdbaaf47fc156ab878099aa1f21b0e8ab92abe5852521299f1fb6efab001c2R300
|
|
1592
|
+
* Represents the state of the RTE
|
|
1545
1593
|
*/
|
|
1546
|
-
class
|
|
1547
|
-
constructor() {
|
|
1548
|
-
this.
|
|
1549
|
-
this.
|
|
1594
|
+
class RTEEditorState {
|
|
1595
|
+
constructor(content, selection) {
|
|
1596
|
+
this.content = content.clone(true);
|
|
1597
|
+
this.selection = selection.clone();
|
|
1598
|
+
this.refreshSelectionNodes();
|
|
1550
1599
|
}
|
|
1551
1600
|
/**
|
|
1552
|
-
*
|
|
1601
|
+
* Clones the editor state, updating the content and selection based on the provided content.
|
|
1553
1602
|
*
|
|
1554
|
-
* @
|
|
1555
|
-
* @returns {Range} - A Range object.
|
|
1603
|
+
* @returns {RTEEditorState} A new instance of RTEEditorState with the updated content and selection.
|
|
1556
1604
|
*/
|
|
1557
|
-
|
|
1558
|
-
return this.
|
|
1605
|
+
clone() {
|
|
1606
|
+
return new RTEEditorState(this.content, this.selection);
|
|
1559
1607
|
}
|
|
1560
1608
|
/**
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
* @param {Range} range - The range of selection.
|
|
1609
|
+
* Refreshes the selection nodes in the editor state.
|
|
1564
1610
|
*/
|
|
1565
|
-
|
|
1566
|
-
this.
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
|
|
1611
|
+
refreshSelectionNodes() {
|
|
1612
|
+
const { startNode: oldStartNode, endNode: oldEndNode, startOffset, endOffset, } = this.selection.range;
|
|
1613
|
+
if (oldStartNode && oldEndNode) {
|
|
1614
|
+
const startNode = this.content.findNodeById(oldStartNode.id);
|
|
1615
|
+
const endNode = this.content.findNodeById(oldEndNode.id);
|
|
1616
|
+
if (startNode && endNode) {
|
|
1617
|
+
this.selection.range.updateRTERange({
|
|
1618
|
+
startNode,
|
|
1619
|
+
endNode,
|
|
1620
|
+
startOffset,
|
|
1621
|
+
endOffset,
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1572
1624
|
}
|
|
1573
1625
|
}
|
|
1574
|
-
/**
|
|
1575
|
-
* Clears all ranges.
|
|
1576
|
-
*/
|
|
1577
|
-
removeAllRanges() {
|
|
1578
|
-
this.ranges = [];
|
|
1579
|
-
this.rangeCount = 0;
|
|
1580
|
-
}
|
|
1581
1626
|
}
|
|
1627
|
+
|
|
1628
|
+
var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1629
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1630
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1631
|
+
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;
|
|
1632
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1633
|
+
};
|
|
1582
1634
|
/**
|
|
1583
|
-
*
|
|
1584
|
-
*
|
|
1585
|
-
* - On Chromium, calling document.getSelection will not pierce into the Shadow DOM and gives you some unhelpful high-level element.
|
|
1586
|
-
* But it does expose the non-standard getSelection method on the ShadowRoot.
|
|
1587
|
-
*
|
|
1588
|
-
* - On Firefox, it does not implement ShadowRoot.getSelection,
|
|
1589
|
-
* but document.getSelection will pierce through shadow dom and give you the exact element.
|
|
1590
|
-
*
|
|
1591
|
-
* - On Safari, Selection.getComposedRanges is supported as of v17. On versions before that,
|
|
1592
|
-
* ShadowRoot.getSelection is not supported and apparently document.getSelection does not pierce the Shadow DOM, meaning you are just out of luck.
|
|
1593
|
-
*
|
|
1594
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot#shadowroot.getselection
|
|
1595
|
-
* https://stackoverflow.com/a/70523247
|
|
1635
|
+
* The value controller is responsible for updating the value of the rich text editor.
|
|
1596
1636
|
*/
|
|
1597
|
-
class
|
|
1598
|
-
constructor() {
|
|
1599
|
-
this.supportShadowSelection = typeof window.ShadowRoot.prototype['getSelection'] === 'function';
|
|
1600
|
-
this.supportBeforeInput = typeof window.InputEvent.prototype.getTargetRanges === 'function';
|
|
1601
|
-
this.isFirefox = window.navigator.userAgent.toLowerCase().indexOf('firefox') > 0;
|
|
1602
|
-
this.listen();
|
|
1603
|
-
}
|
|
1637
|
+
class ValueController extends VegaSlimmer {
|
|
1604
1638
|
/**
|
|
1605
|
-
*
|
|
1606
|
-
* For other browser which not support shadowroot.getSelection, we use this.selection which is built by us.
|
|
1607
|
-
* For browser which supported shadowroot.getSelection, we use shadowRoot.getselection().
|
|
1608
|
-
*
|
|
1609
|
-
* @param {ShadowRoot} shadow - A shadow.
|
|
1610
|
-
* @returns {Nullable<Selection>} - The shadow selection.
|
|
1639
|
+
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.connectedCallback}
|
|
1611
1640
|
*/
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
? this.getFirefoxSelection()
|
|
1619
|
-
: this.polyfilledShadowSelection;
|
|
1620
|
-
}
|
|
1641
|
+
connectedCallback() {
|
|
1642
|
+
const flushChangesWithDebounce = debounce(() => {
|
|
1643
|
+
void this.valueController.flushChanges(this.value);
|
|
1644
|
+
}, ValueController.VALUE_CHANGE_DEBOUNCE_TIME, this);
|
|
1645
|
+
this.flushChangeObserver = new Observer(this.isAcceptableFlushChange.bind(this), flushChangesWithDebounce);
|
|
1646
|
+
ChangeManager.register(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorFlushChanges), this.flushChangeObserver);
|
|
1621
1647
|
}
|
|
1622
1648
|
/**
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1625
|
-
* Example:
|
|
1626
|
-
*
|
|
1627
|
-
* <span>span1</span><span>span2</span><span>span3</span>
|
|
1628
|
-
*
|
|
1629
|
-
* In firefox, while selected `span2`, the range be likely to:
|
|
1630
|
-
* range:
|
|
1631
|
-
* startContainer: #text 'span1'
|
|
1632
|
-
* startOffset: 5
|
|
1633
|
-
* endContainer: #text 'span3'
|
|
1634
|
-
* endOffset: 0
|
|
1635
|
-
* start is end of brefore node and end is start of after node.
|
|
1636
|
-
*
|
|
1637
|
-
* So we should modify the startContainer and endContainer here.
|
|
1638
|
-
*
|
|
1639
|
-
* modified range:
|
|
1640
|
-
* startContainer: #text 'span2'
|
|
1641
|
-
* startOffset: 0
|
|
1642
|
-
* endContainer: #text 'span2'
|
|
1643
|
-
* endOffset: 5
|
|
1644
|
-
*
|
|
1645
|
-
* @returns {Selection} - document selection
|
|
1649
|
+
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.disconnectedCallback}
|
|
1646
1650
|
*/
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
const range = selection.getRangeAt(0);
|
|
1650
|
-
const startNode = range.startContainer;
|
|
1651
|
-
const endNode = range.endContainer;
|
|
1652
|
-
if (startNode !== endNode && startNode.textContent.length === range.startOffset) {
|
|
1653
|
-
const nextSibling = startNode.nodeType === Node.TEXT_NODE
|
|
1654
|
-
? startNode.parentNode.nextSibling
|
|
1655
|
-
: startNode.nextSibling;
|
|
1656
|
-
range.setStart(nextSibling.firstChild, 0);
|
|
1657
|
-
}
|
|
1658
|
-
if (endNode !== startNode && range.endOffset === 0) {
|
|
1659
|
-
const previousSibling = endNode.nodeType === Node.TEXT_NODE
|
|
1660
|
-
? endNode.parentNode.previousSibling
|
|
1661
|
-
: endNode.previousSibling;
|
|
1662
|
-
range.setEnd(previousSibling.lastChild, previousSibling.lastChild.textContent.length);
|
|
1663
|
-
}
|
|
1664
|
-
return selection;
|
|
1651
|
+
disconnectedCallback() {
|
|
1652
|
+
ChangeManager.unregister(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorFlushChanges), this.flushChangeObserver);
|
|
1665
1653
|
}
|
|
1666
1654
|
/**
|
|
1667
|
-
*
|
|
1655
|
+
* Component lifecycle - [componentWillLoad]{@link VegaRichTextEditor.componentWillLoad}
|
|
1668
1656
|
*/
|
|
1669
|
-
|
|
1670
|
-
if (this.
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
window.addEventListener('selectionchange', () => {
|
|
1674
|
-
if (!processing) {
|
|
1675
|
-
processing = true;
|
|
1676
|
-
const active = getActiveElement();
|
|
1677
|
-
if (active && active.hasAttribute('contenteditable')) {
|
|
1678
|
-
// This command will not actually work, it only trigger the `beforeinput` event,
|
|
1679
|
-
// the `beforeinput` event will prevented this command work.
|
|
1680
|
-
document.execCommand('indent');
|
|
1681
|
-
}
|
|
1682
|
-
else {
|
|
1683
|
-
this.polyfilledShadowSelection.removeAllRanges();
|
|
1684
|
-
}
|
|
1685
|
-
processing = false;
|
|
1686
|
-
}
|
|
1687
|
-
}, true);
|
|
1688
|
-
window.addEventListener('beforeinput', (event) => {
|
|
1689
|
-
if (processing) {
|
|
1690
|
-
const ranges = event.getTargetRanges();
|
|
1691
|
-
const range = ranges[0];
|
|
1692
|
-
const newRange = new Range();
|
|
1693
|
-
newRange.setStart(range.startContainer, range.startOffset);
|
|
1694
|
-
newRange.setEnd(range.endContainer, range.endOffset);
|
|
1695
|
-
this.polyfilledShadowSelection.removeAllRanges();
|
|
1696
|
-
this.polyfilledShadowSelection.addRange(newRange);
|
|
1697
|
-
event.preventDefault();
|
|
1698
|
-
event.stopImmediatePropagation();
|
|
1699
|
-
}
|
|
1700
|
-
}, true);
|
|
1657
|
+
componentWillLoad() {
|
|
1658
|
+
if (this.value && !(this.value instanceof VegaRTEContent)) {
|
|
1659
|
+
this.value = VegaRTEContent.fromJSON(this.value);
|
|
1660
|
+
}
|
|
1701
1661
|
}
|
|
1702
|
-
}
|
|
1703
|
-
const ShadowSelectionPolyfill$1 = new ShadowSelectionPolyfill();
|
|
1704
|
-
|
|
1705
|
-
/** Manages selection range for a rich text editor, providing methods to set, sync, and create native ranges based on RTENodes and Nodes. */
|
|
1706
|
-
class RTERange {
|
|
1707
1662
|
/**
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1710
|
-
* @param {Node} [startContainer] The range start element.
|
|
1711
|
-
* @param {Node} [endContainer] The range end element.
|
|
1712
|
-
* @param {number} [startOffset] The range start element content offset, default value is 0.
|
|
1713
|
-
* @param {number} [endOffset] The range end element content offset, default value is 0.
|
|
1714
|
-
* @param {RTENode} [startNode] The range start node, the start node could be null if the start element is root element.
|
|
1715
|
-
* @param {RTENode} [endNode] The range start node, the start node could be null if the start element is root element.
|
|
1716
|
-
* @param {Range} [nativeRange] The browser native range instance.
|
|
1663
|
+
* Watches the value of the editor and updates the internal value.
|
|
1717
1664
|
*/
|
|
1718
|
-
|
|
1719
|
-
this.
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
this.
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1665
|
+
watchValueUpdate() {
|
|
1666
|
+
if (this.value && !(this.value instanceof VegaRTEContent)) {
|
|
1667
|
+
this.value = VegaRTEContent.fromJSON(this.value);
|
|
1668
|
+
}
|
|
1669
|
+
else if (!this.value || this.value.blocks.length === 0) {
|
|
1670
|
+
this.value = VegaRTEContent.createEmptyContent();
|
|
1671
|
+
}
|
|
1672
|
+
else {
|
|
1673
|
+
this.changeEventEmitter.emit(this.value);
|
|
1674
|
+
ChangeManager.notify(FORM_ELEMENT_VALUE_CHANGE, {
|
|
1675
|
+
host: this.host,
|
|
1676
|
+
detail: this.value,
|
|
1677
|
+
});
|
|
1729
1678
|
}
|
|
1730
1679
|
}
|
|
1731
1680
|
/**
|
|
1732
|
-
*
|
|
1733
|
-
* The start container could be null when the dom node should be create after re-render.
|
|
1681
|
+
* Updates the value of the editor and restore the selection.
|
|
1734
1682
|
*
|
|
1735
|
-
* @
|
|
1683
|
+
* @param {VegaRTEContent} newValue The new value to set.
|
|
1684
|
+
* @param {boolean} recordHistory - Whether to record the change in history.
|
|
1736
1685
|
*/
|
|
1737
|
-
|
|
1738
|
-
|
|
1686
|
+
async flushChanges(newValue, recordHistory = true) {
|
|
1687
|
+
if (recordHistory) {
|
|
1688
|
+
this.historyController.registerHistory(new RTEEditorState(newValue, new RTESelectionState(this.selectionController.getCurrentRange())));
|
|
1689
|
+
}
|
|
1690
|
+
this.value = newValue.clone();
|
|
1691
|
+
await waitForComponentDidRender(this.host);
|
|
1739
1692
|
}
|
|
1740
1693
|
/**
|
|
1741
|
-
*
|
|
1742
|
-
* The end container could be null when the dom node should be create after re-render.
|
|
1694
|
+
* Determines whether the observer should accept changes.
|
|
1743
1695
|
*
|
|
1744
|
-
* @returns {
|
|
1696
|
+
* @returns {boolean} Always returns true in the current implementation.
|
|
1745
1697
|
*/
|
|
1746
|
-
|
|
1747
|
-
return
|
|
1698
|
+
isAcceptableFlushChange() {
|
|
1699
|
+
return true;
|
|
1748
1700
|
}
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1701
|
+
}
|
|
1702
|
+
ValueController.VALUE_CHANGE_DEBOUNCE_TIME = 50;
|
|
1703
|
+
__decorate$g([
|
|
1704
|
+
MapToComponentField()
|
|
1705
|
+
], ValueController.prototype, "host", void 0);
|
|
1706
|
+
__decorate$g([
|
|
1707
|
+
MapToComponentField({ writable: true })
|
|
1708
|
+
], ValueController.prototype, "value", void 0);
|
|
1709
|
+
__decorate$g([
|
|
1710
|
+
MapToComponentField()
|
|
1711
|
+
], ValueController.prototype, "changeEventEmitter", void 0);
|
|
1712
|
+
__decorate$g([
|
|
1713
|
+
MapToComponentField()
|
|
1714
|
+
], ValueController.prototype, "valueController", void 0);
|
|
1715
|
+
__decorate$g([
|
|
1716
|
+
MapToComponentField()
|
|
1717
|
+
], ValueController.prototype, "historyController", void 0);
|
|
1718
|
+
__decorate$g([
|
|
1719
|
+
MapToComponentField()
|
|
1720
|
+
], ValueController.prototype, "selectionController", void 0);
|
|
1721
|
+
__decorate$g([
|
|
1722
|
+
MapToComponentMethod('connectedCallback')
|
|
1723
|
+
], ValueController.prototype, "connectedCallback", null);
|
|
1724
|
+
__decorate$g([
|
|
1725
|
+
MapToComponentMethod('disconnectedCallback')
|
|
1726
|
+
], ValueController.prototype, "disconnectedCallback", null);
|
|
1727
|
+
__decorate$g([
|
|
1728
|
+
MapToComponentMethod('componentWillLoad')
|
|
1729
|
+
], ValueController.prototype, "componentWillLoad", null);
|
|
1730
|
+
__decorate$g([
|
|
1731
|
+
MapToComponentMethod('watchValueUpdate')
|
|
1732
|
+
], ValueController.prototype, "watchValueUpdate", null);
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* The rich text content controller
|
|
1736
|
+
*/
|
|
1737
|
+
class RichTextContentController {
|
|
1738
|
+
constructor(editor) {
|
|
1739
|
+
this.editor = editor;
|
|
1757
1740
|
}
|
|
1758
1741
|
/**
|
|
1759
|
-
*
|
|
1760
|
-
* The end RTENode could be null when the range end node is the root element of the rich text editor.
|
|
1742
|
+
* Sync rich text content editable with disabled property
|
|
1761
1743
|
*
|
|
1762
|
-
* @returns {Nullable<RTENode>} The range start element.
|
|
1763
1744
|
*/
|
|
1764
|
-
|
|
1765
|
-
|
|
1745
|
+
syncRichTextContentEditable() {
|
|
1746
|
+
this.editor.richTextContentEditable = !this.editor.disabled;
|
|
1766
1747
|
}
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
const ROOT_CONTAINER_CLASS_NAME = 'rich-text-content';
|
|
1751
|
+
/** This code snippet is defining an abstract class named `BaseHandler` with an abstract method `execute`. */
|
|
1752
|
+
class BaseHandler {
|
|
1767
1753
|
/**
|
|
1768
|
-
*
|
|
1754
|
+
* The function `execute` initializes the current state and selection, and then handles an event if provided.
|
|
1769
1755
|
*
|
|
1770
|
-
* @
|
|
1756
|
+
* @param {VegaRTEContent} currentState - The current state of the VegaRTE content.
|
|
1757
|
+
* @param {SelectionController} selectionController - Manages the selection of items in the user interface.
|
|
1758
|
+
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
1759
|
+
* @param {InputEvent} [event] - It is used to pass an input event to the method for handling.
|
|
1771
1760
|
*/
|
|
1772
|
-
|
|
1773
|
-
|
|
1761
|
+
execute(currentState, selectionController, richTextEditor, event) {
|
|
1762
|
+
this.initCurrentStateAndSelection(currentState, selectionController);
|
|
1763
|
+
this.setCurrentRichTextEditor(richTextEditor);
|
|
1764
|
+
this.handleEvent(event);
|
|
1774
1765
|
}
|
|
1775
1766
|
/**
|
|
1776
|
-
*
|
|
1767
|
+
* The function `isRootContainer` checks if an HTML element is a root container with a class of 'rich-text-content'.
|
|
1777
1768
|
*
|
|
1778
|
-
* @
|
|
1769
|
+
* @param {HTMLElement} element - HTMLElement
|
|
1770
|
+
* @returns {boolean} The boolean value
|
|
1779
1771
|
*/
|
|
1780
|
-
|
|
1781
|
-
return
|
|
1772
|
+
isRootContainer(element) {
|
|
1773
|
+
return (element &&
|
|
1774
|
+
element.nodeType === Node.ELEMENT_NODE &&
|
|
1775
|
+
element.classList.contains(ROOT_CONTAINER_CLASS_NAME));
|
|
1782
1776
|
}
|
|
1783
1777
|
/**
|
|
1784
|
-
*
|
|
1785
|
-
* This method will called after modify the content, the start node and end node should be rte node.
|
|
1786
|
-
* This method will called after selectionchange event emit, the start node and end node should be the html node.
|
|
1778
|
+
* Checks if a given HTML element represents an empty paragraph containing only a line break element.
|
|
1787
1779
|
*
|
|
1788
|
-
* @param {
|
|
1789
|
-
* @
|
|
1790
|
-
* @returns {RTERange} - The new RTERange instance
|
|
1780
|
+
* @param {HTMLElement} node - An HTMLElement node that represents a paragraph element in the HTML document.
|
|
1781
|
+
* @returns {boolean} boolean result
|
|
1791
1782
|
*/
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
this._startOffset = startOffset;
|
|
1795
|
-
this._endOffset = endOffset;
|
|
1796
|
-
const startNode = options.startNode;
|
|
1797
|
-
const endNode = options.endNode;
|
|
1798
|
-
if (startNode instanceof RTENode) {
|
|
1799
|
-
this._startNode = startNode;
|
|
1800
|
-
this._endNode = endNode;
|
|
1801
|
-
const startContainer = this.getElementByRTENode(this._startNode);
|
|
1802
|
-
const endContainer = this._startNode === this._endNode ? startContainer : this.getElementByRTENode(this._endNode);
|
|
1803
|
-
if (startContainer) {
|
|
1804
|
-
this._startContainer = startContainer;
|
|
1805
|
-
this._endContainer = endContainer;
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
else {
|
|
1809
|
-
// The selectionchange callback has a 50 ms delay, so we need to check the next range is the same as the current ret range.
|
|
1810
|
-
this._startContainer = startNode;
|
|
1811
|
-
this._endContainer = endNode;
|
|
1812
|
-
this._startNode = this.getRTENodeByElement(this._startContainer);
|
|
1813
|
-
this._endNode =
|
|
1814
|
-
this._startContainer === this._endContainer
|
|
1815
|
-
? this._startNode
|
|
1816
|
-
: this.getRTENodeByElement(this._endContainer);
|
|
1817
|
-
if (nativeRange) {
|
|
1818
|
-
this._oldNativeRange = nativeRange;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
return new RTERange(this._startContainer, this._endContainer, this._startOffset, this._endOffset, this._startNode, this._endNode, this._oldNativeRange);
|
|
1783
|
+
isEmptyParagraph(node) {
|
|
1784
|
+
return node && node.childNodes && node.childNodes.length === 0;
|
|
1822
1785
|
}
|
|
1823
1786
|
/**
|
|
1824
|
-
*
|
|
1787
|
+
* Removes selected nodes within a range in a rich text editor content.
|
|
1788
|
+
* The method is only used for different nodes are selected
|
|
1825
1789
|
*
|
|
1826
|
-
* @
|
|
1790
|
+
* @param {boolean} [mergeNode] Merge start node and end node or not, default value is false.
|
|
1791
|
+
* @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.
|
|
1827
1792
|
*/
|
|
1828
|
-
|
|
1829
|
-
|
|
1793
|
+
removeSelectionRange(mergeNode = false) {
|
|
1794
|
+
ChangeManager.notify(domNodeSubjectFactory.getSubject(this.richTextEditorRef, VegaInternalRichTextEditDeleteSelectedNodes), { host: this.richTextEditorRef, detail: mergeNode });
|
|
1795
|
+
const range = this.selectionController.getCurrentRange();
|
|
1796
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1797
|
+
return range.startNode || selectedNodes[0];
|
|
1830
1798
|
}
|
|
1831
1799
|
/**
|
|
1832
|
-
* Creates a
|
|
1833
|
-
* Invoke this method to get the future range state if the range content modified.
|
|
1834
|
-
* Invoke this method to get the native range instance if range start node and end node not defined
|
|
1800
|
+
* Creates a new paragraph with an empty text node and returns it.
|
|
1835
1801
|
*
|
|
1836
|
-
* @returns {
|
|
1802
|
+
* @returns {RTETextBlock} An empty paragraph with a unique identifier and a text node appended to it.
|
|
1837
1803
|
*/
|
|
1838
|
-
|
|
1839
|
-
const
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
range.setStart(startContainer, this._startOffset);
|
|
1844
|
-
range.setEnd(endContainer, this._endOffset);
|
|
1845
|
-
this._startContainer = startContainer;
|
|
1846
|
-
this._endContainer = endContainer;
|
|
1847
|
-
this._oldNativeRange = range;
|
|
1848
|
-
return range;
|
|
1849
|
-
}
|
|
1850
|
-
else if (this._oldNativeRange) {
|
|
1851
|
-
return this._oldNativeRange;
|
|
1852
|
-
}
|
|
1804
|
+
createEmptyParagraph() {
|
|
1805
|
+
const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
|
|
1806
|
+
const textNode = new RTETextNode(`${paragraph.id}1`, '', paragraph);
|
|
1807
|
+
paragraph.apply(new AppendChildNodesAction([textNode]));
|
|
1808
|
+
return paragraph;
|
|
1853
1809
|
}
|
|
1854
1810
|
/**
|
|
1855
|
-
*
|
|
1811
|
+
* The function initializes the current state and selection controller in TypeScript.
|
|
1856
1812
|
*
|
|
1857
|
-
* @param {
|
|
1858
|
-
* @
|
|
1813
|
+
* @param {VegaRTEContent} currentState - The current state of a Vega runtime environment content.
|
|
1814
|
+
* @param {SelectionController} selectionController - It is used to manage the selection of content within the VegaRTE editor.
|
|
1859
1815
|
*/
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
if (element) {
|
|
1864
|
-
return node instanceof RTEImageNode
|
|
1865
|
-
? findParent(element, 'vega-rich-text-image-editor')
|
|
1866
|
-
: element.firstChild;
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1816
|
+
initCurrentStateAndSelection(currentState, selectionController) {
|
|
1817
|
+
this.currentState = currentState;
|
|
1818
|
+
this.selectionController = selectionController;
|
|
1869
1819
|
}
|
|
1870
1820
|
/**
|
|
1871
|
-
*
|
|
1821
|
+
* Queries the rich text editor element from the input event target.
|
|
1872
1822
|
*
|
|
1873
|
-
* @param {
|
|
1874
|
-
* @returns { Nullable<RTENode>} Returns a nullable `RTENode` object.
|
|
1823
|
+
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
1875
1824
|
*/
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
const registerElement = element.nodeType === Node.TEXT_NODE
|
|
1879
|
-
? element.parentElement
|
|
1880
|
-
: element.nodeName === 'VEGA-RICH-TEXT-IMAGE-EDITOR'
|
|
1881
|
-
? element.querySelector('img')
|
|
1882
|
-
: element;
|
|
1883
|
-
return stateEntityRenderingRegistry.getEntityByDOM(registerElement);
|
|
1884
|
-
}
|
|
1825
|
+
setCurrentRichTextEditor(richTextEditor) {
|
|
1826
|
+
this.richTextEditorRef = richTextEditor;
|
|
1885
1827
|
}
|
|
1886
1828
|
}
|
|
1887
1829
|
|
|
1888
1830
|
/**
|
|
1889
|
-
*
|
|
1831
|
+
* Insert a new node before a existing node
|
|
1832
|
+
*
|
|
1833
|
+
* @example currentNode.parentBlock.apply(new InsertNodesBeforeAction(currentNode, newNode, ...))
|
|
1890
1834
|
*/
|
|
1891
|
-
class
|
|
1892
|
-
constructor(
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
*
|
|
1898
|
-
* @returns {RTESelectionState} A new instance of RTESelectionState with the updated range.
|
|
1899
|
-
*/
|
|
1900
|
-
clone() {
|
|
1901
|
-
const newRange = this.range.clone();
|
|
1902
|
-
return new RTESelectionState(newRange);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
1907
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1908
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1909
|
-
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;
|
|
1910
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1911
|
-
};
|
|
1912
|
-
/**
|
|
1913
|
-
* The text selection controller
|
|
1914
|
-
*/
|
|
1915
|
-
class SelectionController extends VegaSlimmer {
|
|
1916
|
-
constructor() {
|
|
1917
|
-
super(...arguments);
|
|
1918
|
-
this.currentRange = new RTERange();
|
|
1919
|
-
this.updateCaretPositionTaskQueue = new SynchronizeTaskQueue(1);
|
|
1920
|
-
this.handleSelectionWithDebounce = debounce(this.handleSelectionChange, SelectionController.SELECTION_CHANGE_DEBOUNCE_TIME, this);
|
|
1921
|
-
this.pendingRestoreSelectionNodes = [];
|
|
1922
|
-
/**
|
|
1923
|
-
* Sets the next selection state with specified start and end nodes, offsets, and a timestamp.
|
|
1924
|
-
*
|
|
1925
|
-
* Example:
|
|
1926
|
-
* Before insert text start offset is 0, the new start offset should update to 1
|
|
1927
|
-
* Before delete text start offset is 1, the new start offset should update to 0
|
|
1928
|
-
*
|
|
1929
|
-
*/
|
|
1930
|
-
this.createUpdateSelectionRangeTask = async () => {
|
|
1931
|
-
// add await Promise.resolve to put the code behind to a micro task
|
|
1932
|
-
await Promise.resolve();
|
|
1933
|
-
const range = this.currentRange.toNativeRange();
|
|
1934
|
-
if (range) {
|
|
1935
|
-
this.setSelectionRange(range);
|
|
1936
|
-
}
|
|
1937
|
-
};
|
|
1938
|
-
}
|
|
1939
|
-
/**
|
|
1940
|
-
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.connectedCallback}
|
|
1941
|
-
*/
|
|
1942
|
-
connectedCallback() {
|
|
1943
|
-
this.registerSelectionRangeChangeObserver();
|
|
1944
|
-
}
|
|
1945
|
-
/**
|
|
1946
|
-
* Component lifecycle - [disconnectedCallback]{@link VegaRichTextEditor.disconnectedCallback}
|
|
1947
|
-
*/
|
|
1948
|
-
disconnectedCallback() {
|
|
1949
|
-
ChangeManager.unregister(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorSelectionRangeChange), this.selectionRangeChangeObserver);
|
|
1950
|
-
}
|
|
1951
|
-
/**
|
|
1952
|
-
* Component lifecycle - [componentDidLoad]{@link VegaRichTextEditor.componentDidLoad}
|
|
1953
|
-
*/
|
|
1954
|
-
componentDidLoad() {
|
|
1955
|
-
document.addEventListener('selectionchange', this.handleSelectionWithDebounce);
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
|
-
* Watches the internal value of the editor
|
|
1959
|
-
*/
|
|
1960
|
-
watchValueUpdate() {
|
|
1961
|
-
this.prepareRestoreSelectionState();
|
|
1962
|
-
this.restoreSelection();
|
|
1963
|
-
}
|
|
1964
|
-
/**
|
|
1965
|
-
* Update the caret position after the component re-render
|
|
1966
|
-
*/
|
|
1967
|
-
async updateCaretPosition() {
|
|
1968
|
-
if (this.updateCaretPositionTaskQueue.queue.length) {
|
|
1969
|
-
await this.updateCaretPositionTaskQueue.runTask();
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
/**
|
|
1973
|
-
* Get the current RTE selection range
|
|
1974
|
-
*
|
|
1975
|
-
* @returns {RTERange} - The current RTE selection range
|
|
1976
|
-
*/
|
|
1977
|
-
getCurrentRange() {
|
|
1978
|
-
return this.currentRange;
|
|
1979
|
-
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Get the selected rich text node
|
|
1982
|
-
*
|
|
1983
|
-
* @returns {RTENode[]} Selected rich text nodes
|
|
1984
|
-
*/
|
|
1985
|
-
getSelectedNodes() {
|
|
1986
|
-
return Array.from(this.selectionMap.values()).flat();
|
|
1987
|
-
}
|
|
1988
|
-
/**
|
|
1989
|
-
* Get the selected rich text blocks
|
|
1990
|
-
*
|
|
1991
|
-
* @returns {RTEBlock[]} Selected rich text blocks
|
|
1992
|
-
*/
|
|
1993
|
-
getSelectedBlocks() {
|
|
1994
|
-
return Array.from(this.selectionMap.keys());
|
|
1995
|
-
}
|
|
1996
|
-
/**
|
|
1997
|
-
* Set the selection state
|
|
1998
|
-
*
|
|
1999
|
-
* @param {RTESelectionState} state - The selection state to set
|
|
2000
|
-
*/
|
|
2001
|
-
setSelectionState(state) {
|
|
2002
|
-
this.selectionState = state;
|
|
2003
|
-
}
|
|
2004
|
-
/**
|
|
2005
|
-
* Sets the next selection state with specified start and end nodes, offsets, push the update task to a queue
|
|
2006
|
-
*
|
|
2007
|
-
* @param {SelectionStateType['startNode']} startNode - The starting node of the selection range. It is a Node object representing the node where the selection range starts.
|
|
2008
|
-
* @param {number} startOffset - The `startNode` where the selection range should start. It indicates the position within the `startNode` where the selection should begin.
|
|
2009
|
-
* @param {SelectionStateType['endNode']} [endNode] - The ending node of the selection range. If a value is provided for `endNode`, it will be used as the ending node of the selection range.
|
|
2010
|
-
* @param {number} [endOffset] - The ending offset within the `endNode` where the selection range should end.
|
|
2011
|
-
* @param {boolean} [immediatelyRun] - Should the task run immediately. default is false
|
|
2012
|
-
*/
|
|
2013
|
-
enqueueSelectionRangeFutureState(startNode, startOffset, endNode, endOffset, immediatelyRun = false) {
|
|
2014
|
-
endNode = endNode || startNode;
|
|
2015
|
-
endOffset = endOffset || endOffset === 0 ? endOffset : startOffset;
|
|
2016
|
-
this.currentRange = this.currentRange.updateRTERange({ startNode, endNode, startOffset, endOffset });
|
|
2017
|
-
void this.updateCaretPositionTaskQueue.enqueue({
|
|
2018
|
-
/** Add task to the queue and run it until component did render */
|
|
2019
|
-
run: async () => {
|
|
2020
|
-
try {
|
|
2021
|
-
await this.createUpdateSelectionRangeTask();
|
|
2022
|
-
}
|
|
2023
|
-
catch (e) {
|
|
2024
|
-
LogUtility.error('Set range error.', e);
|
|
2025
|
-
}
|
|
2026
|
-
},
|
|
2027
|
-
}, immediatelyRun);
|
|
2028
|
-
}
|
|
2029
|
-
/**
|
|
2030
|
-
* Set selection with a new range
|
|
2031
|
-
*
|
|
2032
|
-
* @param {Range} range - The range to set
|
|
2033
|
-
*/
|
|
2034
|
-
setSelectionRange(range) {
|
|
2035
|
-
const selection = this.getSelection();
|
|
2036
|
-
if (selection) {
|
|
2037
|
-
selection.removeAllRanges();
|
|
2038
|
-
selection.addRange(range);
|
|
2039
|
-
this.saveSelection();
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
/**
|
|
2043
|
-
* Save the current selection range detail
|
|
2044
|
-
*/
|
|
2045
|
-
saveSelection() {
|
|
2046
|
-
const selection = this.getSelection();
|
|
2047
|
-
// The range is out of date if the queue is not empty, or the range is update by the composition text insert, so we should not update the RTERange
|
|
2048
|
-
if (selection &&
|
|
2049
|
-
selection.rangeCount > 0 &&
|
|
2050
|
-
this.updateCaretPositionTaskQueue.queue.length === 0 &&
|
|
2051
|
-
!this.insertCompositionTextController.isComposing()) {
|
|
2052
|
-
const range = selection.getRangeAt(0);
|
|
2053
|
-
const { startContainer: startNode, endContainer: endNode, startOffset, endOffset } = range;
|
|
2054
|
-
this.currentRange = this.currentRange.updateRTERange({ startNode, endNode, startOffset, endOffset }, range);
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
/**
|
|
2058
|
-
* Restore the selection to the current selected nodes
|
|
2059
|
-
*/
|
|
2060
|
-
restoreSelection() {
|
|
2061
|
-
if (this.selectionState) {
|
|
2062
|
-
const { startNode, endNode, startOffset, endOffset } = this.selectionState.range;
|
|
2063
|
-
if (startNode instanceof RTETextNode && startNode === endNode && startNode.text.length === 0) {
|
|
2064
|
-
this.enqueueSelectionRangeFutureState(startNode, ZERO_WIDTH_SPACE.length);
|
|
2065
|
-
}
|
|
2066
|
-
else {
|
|
2067
|
-
this.enqueueSelectionRangeFutureState(startNode, startOffset, endNode, endOffset);
|
|
2068
|
-
}
|
|
2069
|
-
this.selectionState = null;
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
/**
|
|
2073
|
-
* Get the rich text content selected range
|
|
2074
|
-
*
|
|
2075
|
-
* @returns {Selection} A [Selection](https://developer.mozilla.org/en-US/docs/Web/API/Selection) object
|
|
2076
|
-
*/
|
|
2077
|
-
getSelection() {
|
|
2078
|
-
const richTextContentRef = this.vegaRichTextEditorRenderer.getRichTextContentRef();
|
|
2079
|
-
return ShadowSelectionPolyfill$1.getSelection(richTextContentRef.shadowRoot);
|
|
2080
|
-
}
|
|
2081
|
-
/**
|
|
2082
|
-
* Get selected rich text
|
|
2083
|
-
*/
|
|
2084
|
-
handleSelectionChange() {
|
|
2085
|
-
if (this.disabled)
|
|
2086
|
-
return;
|
|
2087
|
-
const selection = this.getSelection();
|
|
2088
|
-
if (!selection || selection.rangeCount === 0)
|
|
2089
|
-
return;
|
|
2090
|
-
this.clearSelectionMap();
|
|
2091
|
-
this.saveSelection();
|
|
2092
|
-
const range = selection.getRangeAt(0);
|
|
2093
|
-
const commonAncestor = range.commonAncestorContainer;
|
|
2094
|
-
const selectedNodes = [];
|
|
2095
|
-
/**
|
|
2096
|
-
* Rich text node filter
|
|
2097
|
-
*
|
|
2098
|
-
* @param {Node} node - Start node
|
|
2099
|
-
*/
|
|
2100
|
-
const filterNode = (node) => {
|
|
2101
|
-
if (!range.intersectsNode(node)) {
|
|
2102
|
-
return;
|
|
2103
|
-
}
|
|
2104
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
2105
|
-
const currentNode = node.parentElement;
|
|
2106
|
-
const nodeEntity = stateEntityRenderingRegistry.getEntityByDOM(currentNode);
|
|
2107
|
-
if (nodeEntity instanceof RTENode) {
|
|
2108
|
-
selectedNodes.push(nodeEntity);
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
}
|
|
2112
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
2113
|
-
const entityElement = node.nodeName === 'VEGA-RICH-TEXT-IMAGE-EDITOR'
|
|
2114
|
-
? node.querySelector('img')
|
|
2115
|
-
: node;
|
|
2116
|
-
const nodeEntity = stateEntityRenderingRegistry.getEntityByDOM(entityElement);
|
|
2117
|
-
if (nodeEntity instanceof RTENode) {
|
|
2118
|
-
selectedNodes.push(nodeEntity);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
|
-
node.childNodes.forEach(filterNode);
|
|
2123
|
-
};
|
|
2124
|
-
filterNode(commonAncestor);
|
|
2125
|
-
selectedNodes.forEach((node) => {
|
|
2126
|
-
if (this.selectionMap.has(node.parentBlock)) {
|
|
2127
|
-
this.selectionMap.get(node.parentBlock).push(node);
|
|
2128
|
-
}
|
|
2129
|
-
else {
|
|
2130
|
-
this.selectionMap.set(node.parentBlock, [node]);
|
|
2131
|
-
}
|
|
2132
|
-
});
|
|
2133
|
-
this.getSelectedNodes().forEach((node) => node.apply(new SelectionChangeAction(range)));
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* Clear the selection map
|
|
2137
|
-
*/
|
|
2138
|
-
clearSelectionMap() {
|
|
2139
|
-
this.getSelectedNodes().forEach((node) => {
|
|
2140
|
-
node.annotationMap.delete(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
2141
|
-
});
|
|
2142
|
-
this.selectionMap = new Map();
|
|
2143
|
-
}
|
|
2144
|
-
/**
|
|
2145
|
-
* Check if the selection range change is acceptable
|
|
2146
|
-
*
|
|
2147
|
-
* @returns {boolean} - Returns a boolean value.
|
|
2148
|
-
*/
|
|
2149
|
-
isAcceptableSelectionRangeChange() {
|
|
2150
|
-
return true;
|
|
2151
|
-
}
|
|
2152
|
-
/**
|
|
2153
|
-
* Register the selection range change observer
|
|
2154
|
-
*/
|
|
2155
|
-
registerSelectionRangeChangeObserver() {
|
|
2156
|
-
this.selectionRangeChangeObserver = new Observer(this.isAcceptableSelectionRangeChange.bind(this), (payload) => {
|
|
2157
|
-
this.pendingRestoreSelectionNodes.push(payload.node);
|
|
2158
|
-
});
|
|
2159
|
-
ChangeManager.register(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorSelectionRangeChange), this.selectionRangeChangeObserver);
|
|
2160
|
-
}
|
|
2161
|
-
/**
|
|
2162
|
-
* Prepare the selection state to restore
|
|
2163
|
-
*/
|
|
2164
|
-
prepareRestoreSelectionState() {
|
|
2165
|
-
if (this.pendingRestoreSelectionNodes.length > 0) {
|
|
2166
|
-
const startNode = this.pendingRestoreSelectionNodes[0];
|
|
2167
|
-
const endNode = this.pendingRestoreSelectionNodes.length > 1
|
|
2168
|
-
? this.pendingRestoreSelectionNodes[this.pendingRestoreSelectionNodes.length - 1]
|
|
2169
|
-
: startNode;
|
|
2170
|
-
const { startOffset, endOffset, endContainer, startContainer } = this.currentRange;
|
|
2171
|
-
const nodesInCurrentRange = stateEntityRenderingRegistry.getDOMByEntity(startNode) === startContainer.parentElement &&
|
|
2172
|
-
stateEntityRenderingRegistry.getDOMByEntity(endNode) === endContainer.parentElement;
|
|
2173
|
-
if (nodesInCurrentRange) {
|
|
2174
|
-
this.currentRange = this.currentRange.updateRTERange({
|
|
2175
|
-
startNode,
|
|
2176
|
-
endNode,
|
|
2177
|
-
startOffset,
|
|
2178
|
-
endOffset,
|
|
2179
|
-
});
|
|
2180
|
-
this.selectionState = new RTESelectionState(this.currentRange);
|
|
2181
|
-
}
|
|
2182
|
-
else {
|
|
2183
|
-
this.currentRange = this.currentRange.updateRTERange({
|
|
2184
|
-
startNode,
|
|
2185
|
-
endNode,
|
|
2186
|
-
startOffset: 0,
|
|
2187
|
-
endOffset: endNode.text.length,
|
|
2188
|
-
});
|
|
2189
|
-
this.selectionState = new RTESelectionState(this.currentRange);
|
|
2190
|
-
}
|
|
2191
|
-
this.pendingRestoreSelectionNodes = [];
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
}
|
|
2195
|
-
SelectionController.SELECTION_CHANGE_DEBOUNCE_TIME = 50;
|
|
2196
|
-
__decorate$f([
|
|
2197
|
-
MapToComponentField()
|
|
2198
|
-
], SelectionController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
2199
|
-
__decorate$f([
|
|
2200
|
-
MapToComponentField({ writable: true })
|
|
2201
|
-
], SelectionController.prototype, "selectionMap", void 0);
|
|
2202
|
-
__decorate$f([
|
|
2203
|
-
MapToComponentField()
|
|
2204
|
-
], SelectionController.prototype, "host", void 0);
|
|
2205
|
-
__decorate$f([
|
|
2206
|
-
MapToComponentField()
|
|
2207
|
-
], SelectionController.prototype, "value", void 0);
|
|
2208
|
-
__decorate$f([
|
|
2209
|
-
MapToComponentField()
|
|
2210
|
-
], SelectionController.prototype, "disabled", void 0);
|
|
2211
|
-
__decorate$f([
|
|
2212
|
-
MapToComponentField()
|
|
2213
|
-
], SelectionController.prototype, "valueController", void 0);
|
|
2214
|
-
__decorate$f([
|
|
2215
|
-
MapToComponentField()
|
|
2216
|
-
], SelectionController.prototype, "insertCompositionTextController", void 0);
|
|
2217
|
-
__decorate$f([
|
|
2218
|
-
MapToComponentField()
|
|
2219
|
-
], SelectionController.prototype, "historyController", void 0);
|
|
2220
|
-
__decorate$f([
|
|
2221
|
-
MapToComponentMethod('connectedCallback')
|
|
2222
|
-
], SelectionController.prototype, "connectedCallback", null);
|
|
2223
|
-
__decorate$f([
|
|
2224
|
-
MapToComponentMethod('disconnectedCallback')
|
|
2225
|
-
], SelectionController.prototype, "disconnectedCallback", null);
|
|
2226
|
-
__decorate$f([
|
|
2227
|
-
MapToComponentMethod('componentDidLoad')
|
|
2228
|
-
], SelectionController.prototype, "componentDidLoad", null);
|
|
2229
|
-
__decorate$f([
|
|
2230
|
-
MapToComponentMethod('watchValueUpdate')
|
|
2231
|
-
], SelectionController.prototype, "watchValueUpdate", null);
|
|
2232
|
-
__decorate$f([
|
|
2233
|
-
MapToComponentMethod('componentDidUpdate')
|
|
2234
|
-
], SelectionController.prototype, "updateCaretPosition", null);
|
|
2235
|
-
|
|
2236
|
-
/**
|
|
2237
|
-
* Represents the state of the RTE
|
|
2238
|
-
*/
|
|
2239
|
-
class RTEEditorState {
|
|
2240
|
-
constructor(content, selection) {
|
|
2241
|
-
this.content = content.clone(true);
|
|
2242
|
-
this.selection = selection.clone();
|
|
2243
|
-
this.refreshSelectionNodes();
|
|
2244
|
-
}
|
|
2245
|
-
/**
|
|
2246
|
-
* Clones the editor state, updating the content and selection based on the provided content.
|
|
2247
|
-
*
|
|
2248
|
-
* @returns {RTEEditorState} A new instance of RTEEditorState with the updated content and selection.
|
|
2249
|
-
*/
|
|
2250
|
-
clone() {
|
|
2251
|
-
return new RTEEditorState(this.content, this.selection);
|
|
2252
|
-
}
|
|
2253
|
-
/**
|
|
2254
|
-
* Refreshes the selection nodes in the editor state.
|
|
2255
|
-
*/
|
|
2256
|
-
refreshSelectionNodes() {
|
|
2257
|
-
const { startNode: oldStartNode, endNode: oldEndNode, startOffset, endOffset, } = this.selection.range;
|
|
2258
|
-
if (oldStartNode && oldEndNode) {
|
|
2259
|
-
const startNode = this.content.findNodeById(oldStartNode.id);
|
|
2260
|
-
const endNode = this.content.findNodeById(oldEndNode.id);
|
|
2261
|
-
if (startNode && endNode) {
|
|
2262
|
-
this.selection.range.updateRTERange({
|
|
2263
|
-
startNode,
|
|
2264
|
-
endNode,
|
|
2265
|
-
startOffset,
|
|
2266
|
-
endOffset,
|
|
2267
|
-
});
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2274
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2275
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2276
|
-
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;
|
|
2277
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2278
|
-
};
|
|
2279
|
-
/**
|
|
2280
|
-
* The value controller is responsible for updating the value of the rich text editor.
|
|
2281
|
-
*/
|
|
2282
|
-
class ValueController extends VegaSlimmer {
|
|
2283
|
-
/**
|
|
2284
|
-
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.connectedCallback}
|
|
2285
|
-
*/
|
|
2286
|
-
connectedCallback() {
|
|
2287
|
-
const flushChangesWithDebounce = debounce(() => {
|
|
2288
|
-
void this.valueController.flushChanges(this.value);
|
|
2289
|
-
}, ValueController.VALUE_CHANGE_DEBOUNCE_TIME, this);
|
|
2290
|
-
this.flushChangeObserver = new Observer(this.isAcceptableFlushChange.bind(this), flushChangesWithDebounce);
|
|
2291
|
-
ChangeManager.register(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorFlushChanges), this.flushChangeObserver);
|
|
2292
|
-
}
|
|
2293
|
-
/**
|
|
2294
|
-
* Component lifecycle - [connectedCallback]{@link VegaRichTextEditor.disconnectedCallback}
|
|
2295
|
-
*/
|
|
2296
|
-
disconnectedCallback() {
|
|
2297
|
-
ChangeManager.unregister(domNodeSubjectFactory.getSubject(this.host, VegaInternalRichTextEditorFlushChanges), this.flushChangeObserver);
|
|
2298
|
-
}
|
|
2299
|
-
/**
|
|
2300
|
-
* Component lifecycle - [componentWillLoad]{@link VegaRichTextEditor.componentWillLoad}
|
|
2301
|
-
*/
|
|
2302
|
-
componentWillLoad() {
|
|
2303
|
-
if (this.value && !(this.value instanceof VegaRTEContent)) {
|
|
2304
|
-
this.value = VegaRTEContent.fromJSON(this.value);
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
/**
|
|
2308
|
-
* Watches the value of the editor and updates the internal value.
|
|
2309
|
-
*/
|
|
2310
|
-
watchValueUpdate() {
|
|
2311
|
-
if (this.value && !(this.value instanceof VegaRTEContent)) {
|
|
2312
|
-
this.value = VegaRTEContent.fromJSON(this.value);
|
|
2313
|
-
}
|
|
2314
|
-
else if (!this.value || this.value.blocks.length === 0) {
|
|
2315
|
-
this.value = VegaRTEContent.createEmptyContent();
|
|
2316
|
-
}
|
|
2317
|
-
else {
|
|
2318
|
-
this.changeEventEmitter.emit(this.value);
|
|
2319
|
-
ChangeManager.notify(FORM_ELEMENT_VALUE_CHANGE, {
|
|
2320
|
-
host: this.host,
|
|
2321
|
-
detail: this.value,
|
|
2322
|
-
});
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
/**
|
|
2326
|
-
* Updates the value of the editor and restore the selection.
|
|
2327
|
-
*
|
|
2328
|
-
* @param {VegaRTEContent} newValue The new value to set.
|
|
2329
|
-
* @param {boolean} recordHistory - Whether to record the change in history.
|
|
2330
|
-
*/
|
|
2331
|
-
async flushChanges(newValue, recordHistory = true) {
|
|
2332
|
-
if (recordHistory) {
|
|
2333
|
-
this.historyController.registerHistory(new RTEEditorState(newValue, new RTESelectionState(this.selectionController.getCurrentRange())));
|
|
2334
|
-
}
|
|
2335
|
-
this.value = newValue.clone();
|
|
2336
|
-
await waitForComponentDidRender(this.host);
|
|
2337
|
-
}
|
|
2338
|
-
/**
|
|
2339
|
-
* Determines whether the observer should accept changes.
|
|
2340
|
-
*
|
|
2341
|
-
* @returns {boolean} Always returns true in the current implementation.
|
|
2342
|
-
*/
|
|
2343
|
-
isAcceptableFlushChange() {
|
|
2344
|
-
return true;
|
|
2345
|
-
}
|
|
2346
|
-
}
|
|
2347
|
-
ValueController.VALUE_CHANGE_DEBOUNCE_TIME = 50;
|
|
2348
|
-
__decorate$e([
|
|
2349
|
-
MapToComponentField()
|
|
2350
|
-
], ValueController.prototype, "host", void 0);
|
|
2351
|
-
__decorate$e([
|
|
2352
|
-
MapToComponentField({ writable: true })
|
|
2353
|
-
], ValueController.prototype, "value", void 0);
|
|
2354
|
-
__decorate$e([
|
|
2355
|
-
MapToComponentField()
|
|
2356
|
-
], ValueController.prototype, "changeEventEmitter", void 0);
|
|
2357
|
-
__decorate$e([
|
|
2358
|
-
MapToComponentField()
|
|
2359
|
-
], ValueController.prototype, "valueController", void 0);
|
|
2360
|
-
__decorate$e([
|
|
2361
|
-
MapToComponentField()
|
|
2362
|
-
], ValueController.prototype, "historyController", void 0);
|
|
2363
|
-
__decorate$e([
|
|
2364
|
-
MapToComponentField()
|
|
2365
|
-
], ValueController.prototype, "selectionController", void 0);
|
|
2366
|
-
__decorate$e([
|
|
2367
|
-
MapToComponentMethod('connectedCallback')
|
|
2368
|
-
], ValueController.prototype, "connectedCallback", null);
|
|
2369
|
-
__decorate$e([
|
|
2370
|
-
MapToComponentMethod('disconnectedCallback')
|
|
2371
|
-
], ValueController.prototype, "disconnectedCallback", null);
|
|
2372
|
-
__decorate$e([
|
|
2373
|
-
MapToComponentMethod('componentWillLoad')
|
|
2374
|
-
], ValueController.prototype, "componentWillLoad", null);
|
|
2375
|
-
__decorate$e([
|
|
2376
|
-
MapToComponentMethod('watchValueUpdate')
|
|
2377
|
-
], ValueController.prototype, "watchValueUpdate", null);
|
|
2378
|
-
|
|
2379
|
-
/**
|
|
2380
|
-
* The rich text content controller
|
|
2381
|
-
*/
|
|
2382
|
-
class RichTextContentController {
|
|
2383
|
-
constructor(editor) {
|
|
2384
|
-
this.editor = editor;
|
|
2385
|
-
}
|
|
2386
|
-
/**
|
|
2387
|
-
* Sync rich text content editable with disabled property
|
|
2388
|
-
*
|
|
2389
|
-
*/
|
|
2390
|
-
syncRichTextContentEditable() {
|
|
2391
|
-
this.editor.richTextContentEditable = !this.editor.disabled;
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
const ROOT_CONTAINER_CLASS_NAME = 'rich-text-content';
|
|
2396
|
-
/** This code snippet is defining an abstract class named `BaseHandler` with an abstract method `execute`. */
|
|
2397
|
-
class BaseHandler {
|
|
2398
|
-
/**
|
|
2399
|
-
* The function `execute` initializes the current state and selection, and then handles an event if provided.
|
|
2400
|
-
*
|
|
2401
|
-
* @param {VegaRTEContent} currentState - The current state of the VegaRTE content.
|
|
2402
|
-
* @param {SelectionController} selectionController - Manages the selection of items in the user interface.
|
|
2403
|
-
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
2404
|
-
* @param {InputEvent} [event] - It is used to pass an input event to the method for handling.
|
|
2405
|
-
*/
|
|
2406
|
-
execute(currentState, selectionController, richTextEditor, event) {
|
|
2407
|
-
this.initCurrentStateAndSelection(currentState, selectionController);
|
|
2408
|
-
this.setCurrentRichTextEditor(richTextEditor);
|
|
2409
|
-
this.handleEvent(event);
|
|
2410
|
-
}
|
|
2411
|
-
/**
|
|
2412
|
-
* The function `isRootContainer` checks if an HTML element is a root container with a class of 'rich-text-content'.
|
|
2413
|
-
*
|
|
2414
|
-
* @param {HTMLElement} element - HTMLElement
|
|
2415
|
-
* @returns {boolean} The boolean value
|
|
2416
|
-
*/
|
|
2417
|
-
isRootContainer(element) {
|
|
2418
|
-
return (element &&
|
|
2419
|
-
element.nodeType === Node.ELEMENT_NODE &&
|
|
2420
|
-
element.classList.contains(ROOT_CONTAINER_CLASS_NAME));
|
|
2421
|
-
}
|
|
2422
|
-
/**
|
|
2423
|
-
* Checks if a given HTML element represents an empty paragraph containing only a line break element.
|
|
2424
|
-
*
|
|
2425
|
-
* @param {HTMLElement} node - An HTMLElement node that represents a paragraph element in the HTML document.
|
|
2426
|
-
* @returns {boolean} boolean result
|
|
2427
|
-
*/
|
|
2428
|
-
isEmptyParagraph(node) {
|
|
2429
|
-
return node && node.childNodes && node.childNodes.length === 0;
|
|
2430
|
-
}
|
|
2431
|
-
/**
|
|
2432
|
-
* Removes selected nodes within a range in a rich text editor content.
|
|
2433
|
-
* The method is only used for different nodes are selected
|
|
2434
|
-
*
|
|
2435
|
-
* @param {boolean} [mergeNode] Merge start node and end node or not, default value is false.
|
|
2436
|
-
* @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.
|
|
2437
|
-
*/
|
|
2438
|
-
removeSelectionRange(mergeNode = false) {
|
|
2439
|
-
ChangeManager.notify(domNodeSubjectFactory.getSubject(this.richTextEditorRef, VegaInternalRichTextEditDeleteSelectedNodes), { host: this.richTextEditorRef, detail: mergeNode });
|
|
2440
|
-
const range = this.selectionController.getCurrentRange();
|
|
2441
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2442
|
-
return range.startNode || selectedNodes[0];
|
|
2443
|
-
}
|
|
2444
|
-
/**
|
|
2445
|
-
* Creates a new paragraph with an empty text node and returns it.
|
|
2446
|
-
*
|
|
2447
|
-
* @returns {RTETextBlock} An empty paragraph with a unique identifier and a text node appended to it.
|
|
2448
|
-
*/
|
|
2449
|
-
createEmptyParagraph() {
|
|
2450
|
-
const paragraph = new RTETextBlock(generateUUID(), 'paragraph');
|
|
2451
|
-
const textNode = new RTETextNode(`${paragraph.id}1`, '', paragraph);
|
|
2452
|
-
paragraph.apply(new AppendChildNodesAction([textNode]));
|
|
2453
|
-
return paragraph;
|
|
2454
|
-
}
|
|
2455
|
-
/**
|
|
2456
|
-
* The function initializes the current state and selection controller in TypeScript.
|
|
2457
|
-
*
|
|
2458
|
-
* @param {VegaRTEContent} currentState - The current state of a Vega runtime environment content.
|
|
2459
|
-
* @param {SelectionController} selectionController - It is used to manage the selection of content within the VegaRTE editor.
|
|
2460
|
-
*/
|
|
2461
|
-
initCurrentStateAndSelection(currentState, selectionController) {
|
|
2462
|
-
this.currentState = currentState;
|
|
2463
|
-
this.selectionController = selectionController;
|
|
2464
|
-
}
|
|
2465
|
-
/**
|
|
2466
|
-
* Queries the rich text editor element from the input event target.
|
|
2467
|
-
*
|
|
2468
|
-
* @param {HTMLElement} richTextEditor - The current rich text editor component
|
|
2469
|
-
*/
|
|
2470
|
-
setCurrentRichTextEditor(richTextEditor) {
|
|
2471
|
-
this.richTextEditorRef = richTextEditor;
|
|
2472
|
-
}
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
|
-
/**
|
|
2476
|
-
* Insert a new node before a existing node
|
|
2477
|
-
*
|
|
2478
|
-
* @example currentNode.parentBlock.apply(new InsertNodesBeforeAction(currentNode, newNode, ...))
|
|
2479
|
-
*/
|
|
2480
|
-
class InsertNodesBeforeAction extends ModifyContentAction {
|
|
2481
|
-
constructor(referNode, ...nodesToBeInserted) {
|
|
2482
|
-
super();
|
|
2483
|
-
this.type = ModifyContentActionType.INSERT_NODES_BEFORE;
|
|
2484
|
-
this.referNode = referNode;
|
|
2485
|
-
this.nodesToBeInserted = nodesToBeInserted;
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
/**
|
|
2490
|
-
* Replace the text node selected content to new text
|
|
2491
|
-
*
|
|
2492
|
-
* @example selectedNode.apply(new ReplaceSelectedTextAction(insertText))
|
|
2493
|
-
*/
|
|
2494
|
-
class ReplaceSelectedTextAction extends ModifyContentAction {
|
|
2495
|
-
constructor(text, currentRange) {
|
|
2496
|
-
super();
|
|
2497
|
-
this.type = ModifyContentActionType.REPLACE_SELECTED_TEXT;
|
|
2498
|
-
this.textToBeInsert = '';
|
|
2499
|
-
this.textToBeInsert = text;
|
|
2500
|
-
this.currentRange = currentRange;
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
/** Handles inserting text into a VegaRTEContent based on the current selection and input event. User input character will trigger this callback */
|
|
2505
|
-
class InsertTextHandler extends BaseHandler {
|
|
2506
|
-
/**
|
|
2507
|
-
* Update the state value when user type character
|
|
2508
|
-
*
|
|
2509
|
-
* @param {InputEvent} event - The input event object
|
|
2510
|
-
*/
|
|
2511
|
-
handleEvent(event) {
|
|
2512
|
-
const text = event.data;
|
|
2513
|
-
const currentRange = this.selectionController.getCurrentRange();
|
|
2514
|
-
const { startContainer, startOffset } = currentRange;
|
|
2515
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2516
|
-
if (selectedNodes.length < 2) {
|
|
2517
|
-
if (!selectedNodes.length && this.isRootContainer(startContainer)) {
|
|
2518
|
-
const cursorNode = this.insertTextToRoot(text);
|
|
2519
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, text.length);
|
|
2520
|
-
}
|
|
2521
|
-
else if (selectedNodes[0] instanceof RTETextNode) {
|
|
2522
|
-
let nextOffset = startOffset + text.length;
|
|
2523
|
-
let updateFlag = false;
|
|
2524
|
-
let cursorNode = selectedNodes[0];
|
|
2525
|
-
if (cursorNode.text === '\n') {
|
|
2526
|
-
cursorNode = this.insertTextToLineBreakNode(cursorNode, text);
|
|
2527
|
-
updateFlag = true;
|
|
2528
|
-
}
|
|
2529
|
-
else {
|
|
2530
|
-
if (startContainer.nodeValue === ZERO_WIDTH_SPACE &&
|
|
2531
|
-
startOffset === ZERO_WIDTH_SPACE.length &&
|
|
2532
|
-
cursorNode.isEmpty()) {
|
|
2533
|
-
startContainer.nodeValue = '';
|
|
2534
|
-
nextOffset = nextOffset - ZERO_WIDTH_SPACE.length;
|
|
2535
|
-
}
|
|
2536
|
-
if (cursorNode instanceof RTETextNode) {
|
|
2537
|
-
updateFlag = true;
|
|
2538
|
-
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
updateFlag &&
|
|
2542
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(nextOffset, cursorNode['text'].length));
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
else {
|
|
2546
|
-
// The selected nodes is multiple nodes
|
|
2547
|
-
const cursorNode = this.removeSelectionRange(true);
|
|
2548
|
-
if (cursorNode instanceof RTETextNode) {
|
|
2549
|
-
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
2550
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(startOffset + text.length, cursorNode.text.length));
|
|
2551
|
-
}
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
/**
|
|
2555
|
-
* Insert the text in root element when root container is empty, should create text block and text node
|
|
2556
|
-
*
|
|
2557
|
-
* @param {string} text The insert text
|
|
2558
|
-
* @returns {RTETextNode} The new create text node
|
|
2559
|
-
*/
|
|
2560
|
-
insertTextToRoot(text) {
|
|
2561
|
-
if (this.currentState &&
|
|
2562
|
-
this.currentState.blocks[0] &&
|
|
2563
|
-
this.currentState.blocks[0] instanceof RTETextBlock) {
|
|
2564
|
-
const firstNode = this.currentState.blocks[0].nodes[0];
|
|
2565
|
-
firstNode.apply(new UpdateTextAction(text));
|
|
2566
|
-
return firstNode;
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
/**
|
|
2570
|
-
* Insert text to a line break node need a special logic if the line break has a next text node.
|
|
2571
|
-
*
|
|
2572
|
-
* @param {RTETextNode} lineBreakNode The current line break node, the text value is \n
|
|
2573
|
-
* @param {string} text The text need to insert
|
|
2574
|
-
* @returns {Nullable<RTETextNode>} The new text node or the current line break node
|
|
2575
|
-
*/
|
|
2576
|
-
insertTextToLineBreakNode(lineBreakNode, text) {
|
|
2577
|
-
const { startOffset, endOffset } = this.selectionController.getCurrentRange();
|
|
2578
|
-
const textBlock = lineBreakNode.parentBlock;
|
|
2579
|
-
const index = textBlock.nodes.indexOf(lineBreakNode);
|
|
2580
|
-
if (startOffset === 0 && startOffset === endOffset && textBlock.nodes[index + 1]) {
|
|
2581
|
-
const newTextNode = lineBreakNode.cloneWithText(text);
|
|
2582
|
-
textBlock.apply(new InsertNodesBeforeAction(lineBreakNode, newTextNode));
|
|
2583
|
-
return newTextNode;
|
|
2584
|
-
}
|
|
2585
|
-
else {
|
|
2586
|
-
lineBreakNode.apply(new UpdateTextAction(text));
|
|
2587
|
-
return lineBreakNode;
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
|
|
2592
|
-
/** Insert a paragraph in a rich text editor based on the current selection and event. User type enter will trigger this callback */
|
|
2593
|
-
class InsertParagraphHandler extends BaseHandler {
|
|
2594
|
-
/**
|
|
2595
|
-
* Create new paragraph node and add node to state value
|
|
2596
|
-
*/
|
|
2597
|
-
handleEvent() {
|
|
2598
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2599
|
-
if (selectedBlocks.length < 2) {
|
|
2600
|
-
this.breakSingleBlock();
|
|
2601
|
-
}
|
|
2602
|
-
else {
|
|
2603
|
-
this.breakMultipleBlocks();
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
/**
|
|
2607
|
-
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
2608
|
-
*/
|
|
2609
|
-
breakMultipleBlocks() {
|
|
2610
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2611
|
-
const range = this.selectionController.getCurrentRange();
|
|
2612
|
-
const cursorNode = this.removeSelectionRange();
|
|
2613
|
-
// If the start or end block contains a list item block, it needs to be processed separately
|
|
2614
|
-
if ((selectedBlocks.length && selectedBlocks[0].type === 'list-item') ||
|
|
2615
|
-
selectedBlocks[selectedBlocks.length - 1].type === 'list-item') {
|
|
2616
|
-
const firstBlock = cursorNode.parentBlock;
|
|
2617
|
-
const lastBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
2618
|
-
/**
|
|
2619
|
-
* First block is list item
|
|
2620
|
-
* --before--
|
|
2621
|
-
* ul
|
|
2622
|
-
* - li
|
|
2623
|
-
* p
|
|
2624
|
-
* - span
|
|
2625
|
-
* --after--
|
|
2626
|
-
* ul
|
|
2627
|
-
* - li
|
|
2628
|
-
* - li
|
|
2629
|
-
*/
|
|
2630
|
-
/**
|
|
2631
|
-
* End block is list item
|
|
2632
|
-
* --before--
|
|
2633
|
-
* p
|
|
2634
|
-
* - span
|
|
2635
|
-
* ul
|
|
2636
|
-
* - li
|
|
2637
|
-
* --after--
|
|
2638
|
-
* p
|
|
2639
|
-
* - span
|
|
2640
|
-
* p
|
|
2641
|
-
* - span
|
|
2642
|
-
*/
|
|
2643
|
-
if (firstBlock.type !== lastBlock.type &&
|
|
2644
|
-
range.startContainer.nodeType === range.endContainer.nodeType) {
|
|
2645
|
-
firstBlock.apply(new MergeTwoBlocksNodesAction(lastBlock));
|
|
2646
|
-
const splitAction = new SplitBlockWithNodeAction(cursorNode, cursorNode['text'].length);
|
|
2647
|
-
firstBlock.apply(splitAction);
|
|
2648
|
-
this.switchCaretPositionToNextElement(splitAction.newBlock);
|
|
2649
|
-
return;
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
|
|
2653
|
-
}
|
|
2654
|
-
/**
|
|
2655
|
-
* Handles breaking a single block in an RTE editor based on the current selection and position.
|
|
2656
|
-
*/
|
|
2657
|
-
breakSingleBlock() {
|
|
2658
|
-
const cursorNode = this.removeSelectionRange();
|
|
2659
|
-
const currentBlock = cursorNode.parentBlock;
|
|
2660
|
-
const { startOffset } = this.selectionController.getCurrentRange();
|
|
2661
|
-
if (currentBlock) {
|
|
2662
|
-
const breakAction = new BreakSingleBlockAction(cursorNode, startOffset);
|
|
2663
|
-
currentBlock.apply(breakAction);
|
|
2664
|
-
this.switchCaretPositionToNextElement(breakAction.newBlock);
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
/**
|
|
2668
|
-
* Moves the caret to the next block element in a rich text editor.
|
|
2669
|
-
*
|
|
2670
|
-
* @param {RTEBlock} newBlock - Represents a new create block element in a rich text editor.
|
|
2671
|
-
*/
|
|
2672
|
-
switchCaretPositionToNextElement(newBlock) {
|
|
2673
|
-
if (newBlock && newBlock['nodes']) {
|
|
2674
|
-
this.selectionController.enqueueSelectionRangeFutureState(newBlock['nodes'][0], 0);
|
|
2675
|
-
}
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
|
-
/**
|
|
2680
|
-
* Split the block with a split point node
|
|
2681
|
-
*
|
|
2682
|
-
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2683
|
-
*/
|
|
2684
|
-
class LineBreakSingleBlockAction extends ModifyContentAction {
|
|
2685
|
-
constructor(startContainerNode, startOffset) {
|
|
2686
|
-
super();
|
|
2687
|
-
this.type = ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK;
|
|
2688
|
-
this.startContainerNode = startContainerNode;
|
|
2689
|
-
this.startOffset = startOffset;
|
|
2690
|
-
}
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
/**
|
|
2694
|
-
* Split the block with a split point node
|
|
2695
|
-
*
|
|
2696
|
-
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2697
|
-
*/
|
|
2698
|
-
class lineBreakMultipleBlocksAction extends ModifyContentAction {
|
|
2699
|
-
constructor(selectedBlocks) {
|
|
2700
|
-
super();
|
|
2701
|
-
this.type = ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS;
|
|
2702
|
-
this.selectedBlocks = selectedBlocks;
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
|
|
2706
|
-
/** User press shift + enter will tigger this callback */
|
|
2707
|
-
class InsertLineBreakHandler extends BaseHandler {
|
|
2708
|
-
/**
|
|
2709
|
-
* Create new line break node and add node to state value
|
|
2710
|
-
*/
|
|
2711
|
-
handleEvent() {
|
|
2712
|
-
const range = this.selectionController.getCurrentRange();
|
|
2713
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2714
|
-
if (this.isRootContainer(range.startContainer)) {
|
|
2715
|
-
this.breakNewBlock();
|
|
2716
|
-
}
|
|
2717
|
-
if (selectedBlocks.length < 2) {
|
|
2718
|
-
this.breakSingleBlock();
|
|
2719
|
-
}
|
|
2720
|
-
else {
|
|
2721
|
-
this.breakMultipleBlocks();
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
/**
|
|
2725
|
-
* Insert the \n in text element when root container is empty, should create text block and text node
|
|
2726
|
-
* <p>
|
|
2727
|
-
* <span></span>
|
|
2728
|
-
* <span></span>
|
|
2729
|
-
* </p>
|
|
2730
|
-
*/
|
|
2731
|
-
breakNewBlock() {
|
|
2732
|
-
if (this.currentState &&
|
|
2733
|
-
this.currentState.blocks[0] &&
|
|
2734
|
-
this.currentState.blocks[0] instanceof RTETextBlock) {
|
|
2735
|
-
const lineBreakAction = new LineBreakSingleBlockAction(this.currentState.blocks[0].nodes[0], 0);
|
|
2736
|
-
this.currentState.blocks[0].apply(lineBreakAction);
|
|
2737
|
-
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2738
|
-
}
|
|
2739
|
-
}
|
|
2740
|
-
/**
|
|
2741
|
-
* If the selected node is a text node
|
|
2742
|
-
* <p>
|
|
2743
|
-
* <span>text</span>
|
|
2744
|
-
* </p>
|
|
2745
|
-
* Insert a line break and the selected node will be split into three text nodes
|
|
2746
|
-
* <p>
|
|
2747
|
-
* <span>te</span>
|
|
2748
|
-
* <br>
|
|
2749
|
-
* <span>xt</span>
|
|
2750
|
-
* </p>
|
|
2751
|
-
*/
|
|
2752
|
-
breakSingleBlock() {
|
|
2753
|
-
const range = this.selectionController.getCurrentRange();
|
|
2754
|
-
const cursorNode = this.removeSelectionRange();
|
|
2755
|
-
const currentBlock = cursorNode.parentBlock;
|
|
2756
|
-
if (currentBlock) {
|
|
2757
|
-
const lineBreakAction = new LineBreakSingleBlockAction(cursorNode, range.startOffset);
|
|
2758
|
-
currentBlock.apply(lineBreakAction);
|
|
2759
|
-
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2762
|
-
/**
|
|
2763
|
-
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
2764
|
-
*/
|
|
2765
|
-
breakMultipleBlocks() {
|
|
2766
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2767
|
-
const cursorNode = this.removeSelectionRange();
|
|
2768
|
-
const lineBreakAction = new lineBreakMultipleBlocksAction(selectedBlocks);
|
|
2769
|
-
cursorNode.parentBlock.apply(lineBreakAction);
|
|
2770
|
-
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2771
|
-
}
|
|
2772
|
-
/**
|
|
2773
|
-
* Moves the caret to the next node element in a rich text editor.
|
|
2774
|
-
*
|
|
2775
|
-
* @param {RTENode} lineBreakNode - Represents a node element in a rich text editor.
|
|
2776
|
-
*/
|
|
2777
|
-
switchCaretPositionToSpecifiedNode(lineBreakNode) {
|
|
2778
|
-
this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(lineBreakNode), 0);
|
|
2779
|
-
}
|
|
2780
|
-
/**
|
|
2781
|
-
* Returns the next sibling node of a given block element in a rich text editor.
|
|
2782
|
-
*
|
|
2783
|
-
* @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.
|
|
2784
|
-
* @returns {RTENode} The next sibling node of the current line break element, or the current node if next node is not exists.
|
|
2785
|
-
*/
|
|
2786
|
-
getNextRTENode(lineBreakNode) {
|
|
2787
|
-
const index = lineBreakNode.parentBlock['nodes'].indexOf(lineBreakNode);
|
|
2788
|
-
const nextNode = lineBreakNode.parentBlock['nodes'][index + 1];
|
|
2789
|
-
return nextNode || lineBreakNode;
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
/**
|
|
2794
|
-
* Delete text or image when press delete
|
|
2795
|
-
*
|
|
2796
|
-
* @example currentBlock.apply(new DeleteBlockContentAction(startContainerNode, startOffset))
|
|
2797
|
-
*/
|
|
2798
|
-
class DeleteBlockContentAction extends ModifyContentAction {
|
|
2799
|
-
constructor(startContainerNode, startOffset) {
|
|
2800
|
-
super();
|
|
2801
|
-
this.type = ModifyContentActionType.DELETE_BLOCK_CONTENT;
|
|
2802
|
-
this.startContainerNode = startContainerNode;
|
|
2803
|
-
this.startOffset = startOffset;
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
|
|
2807
|
-
/** Handles the deletion of content within a VegaRTE editor. User press backspace or delete will trigger this method */
|
|
2808
|
-
class DeleteContentHandler extends BaseHandler {
|
|
2809
|
-
/**
|
|
2810
|
-
* Delete the selected node from the current state.
|
|
2811
|
-
*/
|
|
2812
|
-
handleEvent() {
|
|
2813
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2814
|
-
if (selectedBlocks.length < 2) {
|
|
2815
|
-
this.deleteContentWithSingleBlock();
|
|
2816
|
-
}
|
|
2817
|
-
else {
|
|
2818
|
-
this.deleteContentWithMultipleNodes();
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
/**
|
|
2822
|
-
* Handles the deletion of content within a single block in an RTE editor.
|
|
2823
|
-
*/
|
|
2824
|
-
deleteContentWithSingleBlock() {
|
|
2825
|
-
const range = this.selectionController.getCurrentRange();
|
|
2826
|
-
const { startOffset, endOffset, startContainer, endContainer } = range;
|
|
2827
|
-
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2828
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2829
|
-
if (startOffset !== endOffset || startContainer !== endContainer) {
|
|
2830
|
-
this.deleteContentWithMultipleNodes();
|
|
2831
|
-
}
|
|
2832
|
-
else if (selectedBlocks[0]) {
|
|
2833
|
-
const deleteAction = new DeleteBlockContentAction(selectedNodes[0], startOffset);
|
|
2834
|
-
selectedBlocks[0].apply(deleteAction);
|
|
2835
|
-
if (deleteAction.previousNode) {
|
|
2836
|
-
const nextOffset = deleteAction.previousNode === selectedNodes[0]
|
|
2837
|
-
? Math.max(0, startOffset - 1)
|
|
2838
|
-
: this.getNodeEndOffset(deleteAction.previousNode);
|
|
2839
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.previousNode, nextOffset);
|
|
2840
|
-
}
|
|
2841
|
-
else if (deleteAction.nextNode) {
|
|
2842
|
-
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.nextNode, 0);
|
|
2843
|
-
}
|
|
2844
|
-
else if (this.currentState.blocks.length === 0) {
|
|
2845
|
-
// Add a empty paragraph if delete all content to make sure the caret position
|
|
2846
|
-
this.insertDefaultParagraph();
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
/**
|
|
2851
|
-
* Deletes the content within multiple nodes selected by the user.
|
|
2852
|
-
*/
|
|
2853
|
-
deleteContentWithMultipleNodes() {
|
|
2854
|
-
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2855
|
-
const cursorNode = this.removeSelectionRange(true);
|
|
2856
|
-
const lastSelectedNode = selectedNodes[selectedNodes.length - 1];
|
|
2857
|
-
if (selectedNodes.length > 1 &&
|
|
2858
|
-
lastSelectedNode instanceof RTETextNode &&
|
|
2859
|
-
lastSelectedNode.isEmpty()) {
|
|
2860
|
-
lastSelectedNode.parentBlock.apply(new RemoveChildAction(lastSelectedNode));
|
|
2861
|
-
}
|
|
2862
|
-
this.convertFirstBlockToParagraph(cursorNode.parentBlock);
|
|
2863
|
-
}
|
|
2864
|
-
/**
|
|
2865
|
-
* If the first block is not paragraph, convert the block to paragraph after delete all text
|
|
2866
|
-
*
|
|
2867
|
-
* @param {RTEBlock} block - The first block instance
|
|
2868
|
-
*/
|
|
2869
|
-
convertFirstBlockToParagraph(block) {
|
|
2870
|
-
const firstBlock = this.currentState.blocks[0];
|
|
2871
|
-
if (firstBlock === block &&
|
|
2872
|
-
block instanceof RTETextBlock &&
|
|
2873
|
-
block.nodes.length === 1 &&
|
|
2874
|
-
block.nodes[0].isEmpty() &&
|
|
2875
|
-
block.type !== 'paragraph') {
|
|
2876
|
-
const paragraph = this.createEmptyParagraph();
|
|
2877
|
-
paragraph.apply(new ReplaceChildNodesAction(block.nodes));
|
|
2878
|
-
block.parent.apply(new InsertBlocksBeforeAction(block, paragraph));
|
|
2879
|
-
block.parent.apply(new RemoveChildAction(block));
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
/**
|
|
2883
|
-
* Creates a new paragraph element with a text node and appends it to the current state.
|
|
2884
|
-
*/
|
|
2885
|
-
insertDefaultParagraph() {
|
|
2886
|
-
const paragraph = this.createEmptyParagraph();
|
|
2887
|
-
this.currentState.apply(new AppendChildNodesAction([paragraph]));
|
|
2888
|
-
this.selectionController.enqueueSelectionRangeFutureState(paragraph.nodes[0], 1);
|
|
2889
|
-
}
|
|
2890
|
-
/**
|
|
2891
|
-
* Returns the end offset of a given node in a Rich Text Editor based on its type and text content.
|
|
2892
|
-
*
|
|
2893
|
-
* @param {RTENode} node - text node or image node
|
|
2894
|
-
* @returns {number} Returns a number value.
|
|
2895
|
-
*/
|
|
2896
|
-
getNodeEndOffset(node) {
|
|
2897
|
-
if (node.type === 'IMAGE') {
|
|
2898
|
-
return 1;
|
|
2899
|
-
}
|
|
2900
|
-
else if (node.type === 'TEXT') {
|
|
2901
|
-
return node['text'] === '\n' ? 0 : node['text'].length;
|
|
2902
|
-
}
|
|
1835
|
+
class InsertNodesBeforeAction extends ModifyContentAction {
|
|
1836
|
+
constructor(referNode, ...nodesToBeInserted) {
|
|
1837
|
+
super();
|
|
1838
|
+
this.type = ModifyContentActionType.INSERT_NODES_BEFORE;
|
|
1839
|
+
this.referNode = referNode;
|
|
1840
|
+
this.nodesToBeInserted = nodesToBeInserted;
|
|
2903
1841
|
}
|
|
2904
1842
|
}
|
|
2905
1843
|
|
|
2906
1844
|
/**
|
|
2907
|
-
*
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
}
|
|
2911
|
-
/**
|
|
2912
|
-
* Class to represent the output of a strategy applied to HTML elements
|
|
1845
|
+
* Replace the text node selected content to new text
|
|
1846
|
+
*
|
|
1847
|
+
* @example selectedNode.apply(new ReplaceSelectedTextAction(insertText))
|
|
2913
1848
|
*/
|
|
2914
|
-
class
|
|
2915
|
-
constructor(
|
|
2916
|
-
|
|
2917
|
-
this.
|
|
2918
|
-
this.
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
* Set children output.
|
|
2922
|
-
*
|
|
2923
|
-
* @param {ElementToDTOStrategyOutput[]} childrenOutput - children outputs.
|
|
2924
|
-
*/
|
|
2925
|
-
setChildrenOutput(childrenOutput) {
|
|
2926
|
-
this.childrenOutput = childrenOutput;
|
|
2927
|
-
}
|
|
2928
|
-
/**
|
|
2929
|
-
* Transform current output and children output to DTO
|
|
2930
|
-
*
|
|
2931
|
-
* @returns {Nullable<RTEContentBlock>} - DTO.
|
|
2932
|
-
*/
|
|
2933
|
-
toDto() {
|
|
2934
|
-
const currentBlock = this.currentStrategy.handle(this.currentElements);
|
|
2935
|
-
if (this.childrenOutput.length > 0 && currentBlock) {
|
|
2936
|
-
this.currentStrategy.appendChildBlocks(currentBlock, this.childrenOutput
|
|
2937
|
-
.map((childOutput) => childOutput.toDto())
|
|
2938
|
-
.filter(isNonNullable));
|
|
2939
|
-
}
|
|
2940
|
-
return currentBlock;
|
|
1849
|
+
class ReplaceSelectedTextAction extends ModifyContentAction {
|
|
1850
|
+
constructor(text, currentRange) {
|
|
1851
|
+
super();
|
|
1852
|
+
this.type = ModifyContentActionType.REPLACE_SELECTED_TEXT;
|
|
1853
|
+
this.textToBeInsert = '';
|
|
1854
|
+
this.textToBeInsert = text;
|
|
1855
|
+
this.currentRange = currentRange;
|
|
2941
1856
|
}
|
|
2942
1857
|
}
|
|
2943
1858
|
|
|
2944
|
-
/**
|
|
2945
|
-
class
|
|
1859
|
+
/** Handles inserting text into a VegaRTEContent based on the current selection and input event. User input character will trigger this callback */
|
|
1860
|
+
class InsertTextHandler extends BaseHandler {
|
|
2946
1861
|
/**
|
|
2947
|
-
*
|
|
2948
|
-
* flat the child nodes.
|
|
2949
|
-
*
|
|
2950
|
-
* Example:
|
|
2951
|
-
* <li>
|
|
2952
|
-
* <u><i>text1</i></u>
|
|
2953
|
-
* <span style='font-weight: bold;'><span>text2</span></span>
|
|
2954
|
-
* text3
|
|
2955
|
-
* </li>
|
|
2956
|
-
* will tranform to:
|
|
2957
|
-
* <li>
|
|
2958
|
-
* <span>text1</span> // with underline and italic annotations
|
|
2959
|
-
* <span>text2</span> // with bold annotations
|
|
2960
|
-
* <span>text3</span> // no annotations
|
|
2961
|
-
* </li>
|
|
1862
|
+
* Update the state value when user type character
|
|
2962
1863
|
*
|
|
2963
|
-
* @param {
|
|
2964
|
-
* @param {VegaRTETextAnnotations | VegaRTECodeAnnotations} annotations - Parent annotations.
|
|
2965
|
-
* @returns {VegaRTETextNode[]} - Text node DTO.
|
|
1864
|
+
* @param {InputEvent} event - The input event object
|
|
2966
1865
|
*/
|
|
2967
|
-
|
|
2968
|
-
const
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
text: String(child.textContent),
|
|
2977
|
-
annotations: annotations,
|
|
2978
|
-
});
|
|
1866
|
+
handleEvent(event) {
|
|
1867
|
+
const text = event.data;
|
|
1868
|
+
const currentRange = this.selectionController.getCurrentRange();
|
|
1869
|
+
const { startContainer, startOffset } = currentRange;
|
|
1870
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
1871
|
+
if (selectedNodes.length < 2) {
|
|
1872
|
+
if (!selectedNodes.length && this.isRootContainer(startContainer)) {
|
|
1873
|
+
const cursorNode = this.insertTextToRoot(text);
|
|
1874
|
+
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, text.length);
|
|
2979
1875
|
}
|
|
2980
|
-
else {
|
|
2981
|
-
|
|
1876
|
+
else if (selectedNodes[0] instanceof RTETextNode) {
|
|
1877
|
+
let nextOffset = startOffset + text.length;
|
|
1878
|
+
let updateFlag = false;
|
|
1879
|
+
let cursorNode = selectedNodes[0];
|
|
1880
|
+
if (cursorNode.text === '\n') {
|
|
1881
|
+
cursorNode = this.insertTextToLineBreakNode(cursorNode, text);
|
|
1882
|
+
updateFlag = true;
|
|
1883
|
+
}
|
|
1884
|
+
else {
|
|
1885
|
+
if (startContainer.nodeValue === ZERO_WIDTH_SPACE &&
|
|
1886
|
+
startOffset === ZERO_WIDTH_SPACE.length &&
|
|
1887
|
+
cursorNode.isEmpty()) {
|
|
1888
|
+
startContainer.nodeValue = '';
|
|
1889
|
+
nextOffset = nextOffset - ZERO_WIDTH_SPACE.length;
|
|
1890
|
+
}
|
|
1891
|
+
if (cursorNode instanceof RTETextNode) {
|
|
1892
|
+
updateFlag = true;
|
|
1893
|
+
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
updateFlag &&
|
|
1897
|
+
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(nextOffset, cursorNode['text'].length));
|
|
2982
1898
|
}
|
|
2983
|
-
});
|
|
2984
|
-
return childNodes;
|
|
2985
|
-
}
|
|
2986
|
-
/**
|
|
2987
|
-
* Generate annotations map for block element.
|
|
2988
|
-
*
|
|
2989
|
-
* @param {HTMLElement} element - current element.
|
|
2990
|
-
* @returns {VegaRTEBlockAnnotations} - Text block annotations.
|
|
2991
|
-
*/
|
|
2992
|
-
generateBlockAnnotations(element) {
|
|
2993
|
-
const annotations = {};
|
|
2994
|
-
const textAlign = this.getTextAlign(element);
|
|
2995
|
-
const indent = this.getIndent(element);
|
|
2996
|
-
if (textAlign)
|
|
2997
|
-
annotations.textAlign = textAlign;
|
|
2998
|
-
if (indent)
|
|
2999
|
-
annotations.indent = indent;
|
|
3000
|
-
return annotations;
|
|
3001
|
-
}
|
|
3002
|
-
/**
|
|
3003
|
-
* Generate annotations map for text node element.
|
|
3004
|
-
*
|
|
3005
|
-
* @param {HTMLElement} element - current element.
|
|
3006
|
-
* @param {VegaRTETextAnnotations | VegaRTECodeAnnotations} parentAnnotations - parent annotations
|
|
3007
|
-
* @returns {VegaRTETextAnnotations | VegaRTECodeAnnotations} - Text node annotations.
|
|
3008
|
-
*/
|
|
3009
|
-
generateTextNodeAnnotations(element, parentAnnotations = {}) {
|
|
3010
|
-
if (this.isCode(element))
|
|
3011
|
-
return { code: true };
|
|
3012
|
-
const annotations = {
|
|
3013
|
-
bold: this.isBold(element),
|
|
3014
|
-
italic: this.isItalic(element),
|
|
3015
|
-
underline: this.isUnderline(element),
|
|
3016
|
-
strikethrough: this.isStrikethrough(element),
|
|
3017
|
-
};
|
|
3018
|
-
parentAnnotations.bold && (annotations.bold = true);
|
|
3019
|
-
parentAnnotations.underline && (annotations.underline = true);
|
|
3020
|
-
parentAnnotations.italic && (annotations.italic = true);
|
|
3021
|
-
parentAnnotations.strikethrough && (annotations.strikethrough = true);
|
|
3022
|
-
const color = this.getColor(element);
|
|
3023
|
-
const link = this.getLink(element);
|
|
3024
|
-
if (color)
|
|
3025
|
-
annotations.textColor = color;
|
|
3026
|
-
if (link)
|
|
3027
|
-
annotations.link = link;
|
|
3028
|
-
return annotations;
|
|
3029
|
-
}
|
|
3030
|
-
/**
|
|
3031
|
-
* Check is a invalid text node.
|
|
3032
|
-
*
|
|
3033
|
-
* @param {HTMLElement} element - Current node element.
|
|
3034
|
-
* @returns {boolean} - boolean.
|
|
3035
|
-
*/
|
|
3036
|
-
isInvalidTextNode(element) {
|
|
3037
|
-
if (element.nodeValue && element.nodeValue.includes('\t')) {
|
|
3038
|
-
const value = element.nodeValue.replace(/\n|\t/gm, '');
|
|
3039
|
-
if (value.length === 0)
|
|
3040
|
-
return true;
|
|
3041
|
-
}
|
|
3042
|
-
return false;
|
|
3043
|
-
}
|
|
3044
|
-
/**
|
|
3045
|
-
* Is code element.
|
|
3046
|
-
*
|
|
3047
|
-
* @param {HTMLElement} element - current element.
|
|
3048
|
-
* @returns {boolean} - boolean.
|
|
3049
|
-
*/
|
|
3050
|
-
isCode(element) {
|
|
3051
|
-
return (element.classList.contains('v-rte--code') ||
|
|
3052
|
-
element.nodeName === 'CODE' ||
|
|
3053
|
-
element.style.fontFamily === 'monospace');
|
|
3054
|
-
}
|
|
3055
|
-
/**
|
|
3056
|
-
* Is bold element.
|
|
3057
|
-
*
|
|
3058
|
-
* @param {HTMLElement} element - current element.
|
|
3059
|
-
* @returns {boolean} - boolean.
|
|
3060
|
-
*/
|
|
3061
|
-
isBold(element) {
|
|
3062
|
-
return (element.nodeName === 'STRONG' ||
|
|
3063
|
-
element.nodeName === 'B' ||
|
|
3064
|
-
element.style.fontWeight === 'bold' ||
|
|
3065
|
-
element.style.fontWeight === '700');
|
|
3066
|
-
}
|
|
3067
|
-
/**
|
|
3068
|
-
* Is italic element.
|
|
3069
|
-
*
|
|
3070
|
-
* @param {HTMLElement} element - current element.
|
|
3071
|
-
* @returns {boolean} - boolean.
|
|
3072
|
-
*/
|
|
3073
|
-
isItalic(element) {
|
|
3074
|
-
return element.nodeName === 'I' || element.style.fontStyle === 'italic' || element.nodeName === 'EM';
|
|
3075
|
-
}
|
|
3076
|
-
/**
|
|
3077
|
-
* Is underline element.
|
|
3078
|
-
*
|
|
3079
|
-
* @param {HTMLElement} element - current element.
|
|
3080
|
-
* @returns {boolean} - boolean.
|
|
3081
|
-
*/
|
|
3082
|
-
isUnderline(element) {
|
|
3083
|
-
return (element.style.textDecoration.includes('underline') ||
|
|
3084
|
-
element.nodeName === 'U' ||
|
|
3085
|
-
element.nodeName === 'INS' ||
|
|
3086
|
-
element.classList.contains('v-rte--underline'));
|
|
3087
|
-
}
|
|
3088
|
-
/**
|
|
3089
|
-
* Is strikethrough element.
|
|
3090
|
-
*
|
|
3091
|
-
* @param {HTMLElement} element - current element.
|
|
3092
|
-
* @returns {boolean} - boolean.
|
|
3093
|
-
*/
|
|
3094
|
-
isStrikethrough(element) {
|
|
3095
|
-
return (element.style.textDecoration.includes('line-through') ||
|
|
3096
|
-
element.nodeName === 'S' ||
|
|
3097
|
-
element.nodeName === 'DEL' ||
|
|
3098
|
-
element.classList.contains('v-rte--strikethrough'));
|
|
3099
|
-
}
|
|
3100
|
-
/**
|
|
3101
|
-
* Get current color of element.
|
|
3102
|
-
*
|
|
3103
|
-
* @param {HTMLElement} element - current element.
|
|
3104
|
-
* @returns {Nullable<string>} - color.
|
|
3105
|
-
*/
|
|
3106
|
-
getColor(element) {
|
|
3107
|
-
var _a;
|
|
3108
|
-
const color = element.style.color;
|
|
3109
|
-
const hexColor = (_a = rgbToHex(color)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
3110
|
-
if (hexColor) {
|
|
3111
|
-
const colorSchema = RTE_TEXT_COLORS.find((schema) => schema.light === hexColor || schema.dark === hexColor);
|
|
3112
|
-
if (colorSchema)
|
|
3113
|
-
return colorSchema.key;
|
|
3114
|
-
return null;
|
|
3115
1899
|
}
|
|
3116
1900
|
else {
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
1901
|
+
// The selected nodes is multiple nodes
|
|
1902
|
+
const cursorNode = this.removeSelectionRange(true);
|
|
1903
|
+
if (cursorNode instanceof RTETextNode) {
|
|
1904
|
+
cursorNode.apply(new ReplaceSelectedTextAction(text, currentRange));
|
|
1905
|
+
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, Math.min(startOffset + text.length, cursorNode.text.length));
|
|
3121
1906
|
}
|
|
3122
|
-
return null;
|
|
3123
|
-
}
|
|
3124
|
-
}
|
|
3125
|
-
/**
|
|
3126
|
-
* Get current link of element.
|
|
3127
|
-
*
|
|
3128
|
-
* @param {HTMLElement} element - current element.
|
|
3129
|
-
* @returns {Nullable<VegaRTELink>} - link.
|
|
3130
|
-
*/
|
|
3131
|
-
getLink(element) {
|
|
3132
|
-
if (element.nodeName === 'A') {
|
|
3133
|
-
return {
|
|
3134
|
-
href: element.href,
|
|
3135
|
-
groupKey: generateUUID(),
|
|
3136
|
-
};
|
|
3137
1907
|
}
|
|
3138
|
-
return null;
|
|
3139
1908
|
}
|
|
3140
1909
|
/**
|
|
3141
|
-
*
|
|
1910
|
+
* Insert the text in root element when root container is empty, should create text block and text node
|
|
3142
1911
|
*
|
|
3143
|
-
* @param {
|
|
3144
|
-
* @returns {
|
|
1912
|
+
* @param {string} text The insert text
|
|
1913
|
+
* @returns {RTETextNode} The new create text node
|
|
3145
1914
|
*/
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
return
|
|
3153
|
-
}
|
|
3154
|
-
else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
|
|
3155
|
-
return 'right';
|
|
3156
|
-
}
|
|
3157
|
-
else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
|
|
3158
|
-
return 'justify';
|
|
3159
|
-
}
|
|
3160
|
-
const style = element.style;
|
|
3161
|
-
switch (style.textAlign) {
|
|
3162
|
-
case 'center':
|
|
3163
|
-
return 'center';
|
|
3164
|
-
case 'right':
|
|
3165
|
-
return 'right';
|
|
3166
|
-
case 'justify':
|
|
3167
|
-
return 'justify';
|
|
3168
|
-
case 'left':
|
|
3169
|
-
return 'left';
|
|
3170
|
-
default:
|
|
3171
|
-
return null;
|
|
1915
|
+
insertTextToRoot(text) {
|
|
1916
|
+
if (this.currentState &&
|
|
1917
|
+
this.currentState.blocks[0] &&
|
|
1918
|
+
this.currentState.blocks[0] instanceof RTETextBlock) {
|
|
1919
|
+
const firstNode = this.currentState.blocks[0].nodes[0];
|
|
1920
|
+
firstNode.apply(new UpdateTextAction(text));
|
|
1921
|
+
return firstNode;
|
|
3172
1922
|
}
|
|
3173
1923
|
}
|
|
3174
1924
|
/**
|
|
3175
|
-
*
|
|
1925
|
+
* Insert text to a line break node need a special logic if the line break has a next text node.
|
|
3176
1926
|
*
|
|
3177
|
-
* @param {
|
|
3178
|
-
* @
|
|
1927
|
+
* @param {RTETextNode} lineBreakNode The current line break node, the text value is \n
|
|
1928
|
+
* @param {string} text The text need to insert
|
|
1929
|
+
* @returns {Nullable<RTETextNode>} The new text node or the current line break node
|
|
3179
1930
|
*/
|
|
3180
|
-
|
|
3181
|
-
const
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
switch (margins.length) {
|
|
3189
|
-
case 4:
|
|
3190
|
-
marginLeft = margins[3];
|
|
3191
|
-
break;
|
|
3192
|
-
case 2:
|
|
3193
|
-
case 3:
|
|
3194
|
-
marginLeft = margins[1];
|
|
3195
|
-
break;
|
|
3196
|
-
default:
|
|
3197
|
-
marginLeft = margins[0];
|
|
3198
|
-
break;
|
|
3199
|
-
}
|
|
1931
|
+
insertTextToLineBreakNode(lineBreakNode, text) {
|
|
1932
|
+
const { startOffset, endOffset } = this.selectionController.getCurrentRange();
|
|
1933
|
+
const textBlock = lineBreakNode.parentBlock;
|
|
1934
|
+
const index = textBlock.nodes.indexOf(lineBreakNode);
|
|
1935
|
+
if (startOffset === 0 && startOffset === endOffset && textBlock.nodes[index + 1]) {
|
|
1936
|
+
const newTextNode = lineBreakNode.cloneWithText(text);
|
|
1937
|
+
textBlock.apply(new InsertNodesBeforeAction(lineBreakNode, newTextNode));
|
|
1938
|
+
return newTextNode;
|
|
3200
1939
|
}
|
|
3201
1940
|
else {
|
|
3202
|
-
|
|
1941
|
+
lineBreakNode.apply(new UpdateTextAction(text));
|
|
1942
|
+
return lineBreakNode;
|
|
3203
1943
|
}
|
|
3204
|
-
const marginLeftNumber = Number(marginLeft.replace('px', ''));
|
|
3205
|
-
return marginLeftNumber && marginLeftNumber >= 0 ? Math.floor(marginLeftNumber / 16) : null;
|
|
3206
1944
|
}
|
|
3207
1945
|
}
|
|
3208
1946
|
|
|
3209
|
-
/**
|
|
3210
|
-
class
|
|
1947
|
+
/** Insert a paragraph in a rich text editor based on the current selection and event. User type enter will trigger this callback */
|
|
1948
|
+
class InsertParagraphHandler extends BaseHandler {
|
|
3211
1949
|
/**
|
|
3212
|
-
*
|
|
3213
|
-
*
|
|
3214
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3215
|
-
* @param {number} currentIndex - Current element index.
|
|
3216
|
-
* @returns {number} - can be handled element count.
|
|
1950
|
+
* Create new paragraph node and add node to state value
|
|
3217
1951
|
*/
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
(ContinueInlineToRTETextBlockStrategy.canHandleTags.includes(element.nodeName) &&
|
|
3224
|
-
!(element.textContent === '' && element.querySelector('IMG')))) {
|
|
3225
|
-
count++;
|
|
1952
|
+
handleEvent() {
|
|
1953
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1954
|
+
if (selectedBlocks.length) {
|
|
1955
|
+
if (selectedBlocks.length < 2) {
|
|
1956
|
+
this.breakSingleBlock();
|
|
3226
1957
|
}
|
|
3227
1958
|
else {
|
|
3228
|
-
|
|
1959
|
+
this.breakMultipleBlocks();
|
|
3229
1960
|
}
|
|
3230
1961
|
}
|
|
3231
|
-
return count;
|
|
3232
|
-
}
|
|
3233
|
-
/**
|
|
3234
|
-
* Parse to a text block.
|
|
3235
|
-
*
|
|
3236
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3237
|
-
* @returns {Nullable<RTEContentBlock>} - Text block.
|
|
3238
|
-
*/
|
|
3239
|
-
handle(elementsArray) {
|
|
3240
|
-
const parent = elementsArray[0].parentElement;
|
|
3241
|
-
const nodes = this.generateChildNodes(elementsArray, this.generateTextNodeAnnotations(parent));
|
|
3242
|
-
if (nodes.length === 0)
|
|
3243
|
-
return null;
|
|
3244
|
-
return RTETextBlock.from({
|
|
3245
|
-
id: generateUUID(),
|
|
3246
|
-
type: 'paragraph',
|
|
3247
|
-
nodes: nodes,
|
|
3248
|
-
annotations: this.generateBlockAnnotations(parent),
|
|
3249
|
-
});
|
|
3250
|
-
}
|
|
3251
|
-
/* istanbul ignore next */
|
|
3252
|
-
/**
|
|
3253
|
-
* Append child blocks.
|
|
3254
|
-
*/
|
|
3255
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3256
|
-
appendChildBlocks() { }
|
|
3257
|
-
/**
|
|
3258
|
-
* Should continue process to child elements.
|
|
3259
|
-
*
|
|
3260
|
-
* @returns {boolean} - boolean.
|
|
3261
|
-
*/
|
|
3262
|
-
shouldProceedToElementChildren() {
|
|
3263
|
-
return false;
|
|
3264
|
-
}
|
|
3265
|
-
}
|
|
3266
|
-
ContinueInlineToRTETextBlockStrategy.canHandleTags = [
|
|
3267
|
-
'SPAN',
|
|
3268
|
-
'STRONG',
|
|
3269
|
-
'CODE',
|
|
3270
|
-
'I',
|
|
3271
|
-
'EM',
|
|
3272
|
-
'S',
|
|
3273
|
-
'U',
|
|
3274
|
-
'A',
|
|
3275
|
-
'VEGA-RICH-TEXT-LINK-EDITOR',
|
|
3276
|
-
'B',
|
|
3277
|
-
'INS',
|
|
3278
|
-
'DEL',
|
|
3279
|
-
];
|
|
3280
|
-
|
|
3281
|
-
/** Transform ul element to list block DTO */
|
|
3282
|
-
class UlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
3283
|
-
/**
|
|
3284
|
-
* Can be handle.
|
|
3285
|
-
*
|
|
3286
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3287
|
-
* @param {number} currentIndex - Current element index.
|
|
3288
|
-
* @returns {number} - can be handled element count.
|
|
3289
|
-
*/
|
|
3290
|
-
canHandle(elementsArray, currentIndex) {
|
|
3291
|
-
return elementsArray[currentIndex].tagName === 'UL' ? 1 : 0;
|
|
3292
|
-
}
|
|
3293
|
-
/**
|
|
3294
|
-
* Parse to a block.
|
|
3295
|
-
*
|
|
3296
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3297
|
-
* @returns {Nullable<RTEContentBlock>} - Bullet list block.
|
|
3298
|
-
*/
|
|
3299
|
-
handle(elementsArray) {
|
|
3300
|
-
if (elementsArray[0].childNodes.length === 0)
|
|
3301
|
-
return null;
|
|
3302
|
-
return RTEListBlock.from({
|
|
3303
|
-
id: generateUUID(),
|
|
3304
|
-
type: 'bullet-list',
|
|
3305
|
-
blocks: [],
|
|
3306
|
-
annotations: this.generateBlockAnnotations(elementsArray[0]),
|
|
3307
|
-
});
|
|
3308
|
-
}
|
|
3309
|
-
/**
|
|
3310
|
-
* Append child list item blocks to current list block.
|
|
3311
|
-
*
|
|
3312
|
-
* @param {RTEListBlock} currentBlock - Current list block.
|
|
3313
|
-
* @param {RTEListItemBlock[]} childBlocks - Current list item blocks.
|
|
3314
|
-
*/
|
|
3315
|
-
appendChildBlocks(currentBlock, childBlocks) {
|
|
3316
|
-
currentBlock.blocks = childBlocks;
|
|
3317
|
-
childBlocks.forEach((block) => (block.parent = currentBlock));
|
|
3318
|
-
}
|
|
3319
|
-
/**
|
|
3320
|
-
* Should continue process to child elements.
|
|
3321
|
-
*
|
|
3322
|
-
* @returns {boolean} - boolean.
|
|
3323
|
-
*/
|
|
3324
|
-
shouldProceedToElementChildren() {
|
|
3325
|
-
return true;
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
/** Transform li element to list item block DTO */
|
|
3330
|
-
class LiToRTEListItemBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
3331
|
-
/**
|
|
3332
|
-
* Can be handle.
|
|
3333
|
-
*
|
|
3334
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3335
|
-
* @param {number} currentIndex - Current element index.
|
|
3336
|
-
* @returns {number} - can be handled element count.
|
|
3337
|
-
*/
|
|
3338
|
-
canHandle(elementsArray, currentIndex) {
|
|
3339
|
-
return elementsArray[currentIndex].tagName === 'LI' ? 1 : 0;
|
|
3340
|
-
}
|
|
3341
|
-
/**
|
|
3342
|
-
* Parse to a list item block.
|
|
3343
|
-
*
|
|
3344
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3345
|
-
* @returns {Nullable<RTEContentBlock>} - List item block.
|
|
3346
|
-
*/
|
|
3347
|
-
handle(elementsArray) {
|
|
3348
|
-
if (elementsArray[0].childNodes.length === 0)
|
|
3349
|
-
return null;
|
|
3350
|
-
return RTEListItemBlock.from({
|
|
3351
|
-
id: generateUUID(),
|
|
3352
|
-
type: 'list-item',
|
|
3353
|
-
nodes: this.generateChildNodes(Array.from(elementsArray[0].childNodes).filter((item) => !['UL', 'OL'].includes(item.nodeName)), this.generateTextNodeAnnotations(elementsArray[0])),
|
|
3354
|
-
annotations: this.generateBlockAnnotations(elementsArray[0]),
|
|
3355
|
-
});
|
|
3356
|
-
}
|
|
3357
|
-
/**
|
|
3358
|
-
* Append child list blocks to current list item block.
|
|
3359
|
-
*
|
|
3360
|
-
* @param {RTEListBlock} currentBlock - Current list item block.
|
|
3361
|
-
* @param {RTEListItemBlock[]} childBlocks - Current list blocks.
|
|
3362
|
-
*/
|
|
3363
|
-
appendChildBlocks(currentBlock, childBlocks) {
|
|
3364
|
-
currentBlock.children = childBlocks.filter((block) => ['bullet-list', 'number-list'].includes(block.type));
|
|
3365
|
-
}
|
|
3366
|
-
/**
|
|
3367
|
-
* Should continue process to child elements.
|
|
3368
|
-
*
|
|
3369
|
-
* @returns {boolean} - boolean.
|
|
3370
|
-
*/
|
|
3371
|
-
shouldProceedToElementChildren() {
|
|
3372
|
-
return true;
|
|
3373
|
-
}
|
|
3374
|
-
}
|
|
3375
|
-
|
|
3376
|
-
/** Transform inline block element to text block DTO */
|
|
3377
|
-
class InlineBlockToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
3378
|
-
/**
|
|
3379
|
-
* Can be handle.
|
|
3380
|
-
*
|
|
3381
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3382
|
-
* @param {number} currentIndex - Current element index.
|
|
3383
|
-
* @returns {number} - can be handled element count.
|
|
3384
|
-
*/
|
|
3385
|
-
canHandle(elementsArray, currentIndex) {
|
|
3386
|
-
return [
|
|
3387
|
-
'heading-1',
|
|
3388
|
-
'heading-2',
|
|
3389
|
-
'heading-3',
|
|
3390
|
-
'heading-4',
|
|
3391
|
-
'heading-5',
|
|
3392
|
-
'heading-6',
|
|
3393
|
-
'title',
|
|
3394
|
-
'subtitle',
|
|
3395
|
-
].includes(this.getElementType(elementsArray[currentIndex]))
|
|
3396
|
-
? 1
|
|
3397
|
-
: 0;
|
|
3398
1962
|
}
|
|
3399
1963
|
/**
|
|
3400
|
-
*
|
|
3401
|
-
*
|
|
3402
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3403
|
-
* @returns {Nullable<RTEContentBlock>} - Text block.
|
|
1964
|
+
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
3404
1965
|
*/
|
|
3405
|
-
|
|
3406
|
-
const
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
type
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
1966
|
+
breakMultipleBlocks() {
|
|
1967
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
1968
|
+
const range = this.selectionController.getCurrentRange();
|
|
1969
|
+
const cursorNode = this.removeSelectionRange();
|
|
1970
|
+
// If the start or end block contains a list item block, it needs to be processed separately
|
|
1971
|
+
if ((selectedBlocks.length && selectedBlocks[0].type === 'list-item') ||
|
|
1972
|
+
selectedBlocks[selectedBlocks.length - 1].type === 'list-item') {
|
|
1973
|
+
const firstBlock = cursorNode.parentBlock;
|
|
1974
|
+
const lastBlock = selectedBlocks[selectedBlocks.length - 1];
|
|
1975
|
+
/**
|
|
1976
|
+
* First block is list item
|
|
1977
|
+
* --before--
|
|
1978
|
+
* ul
|
|
1979
|
+
* - li
|
|
1980
|
+
* p
|
|
1981
|
+
* - span
|
|
1982
|
+
* --after--
|
|
1983
|
+
* ul
|
|
1984
|
+
* - li
|
|
1985
|
+
* - li
|
|
1986
|
+
*/
|
|
1987
|
+
/**
|
|
1988
|
+
* End block is list item
|
|
1989
|
+
* --before--
|
|
1990
|
+
* p
|
|
1991
|
+
* - span
|
|
1992
|
+
* ul
|
|
1993
|
+
* - li
|
|
1994
|
+
* --after--
|
|
1995
|
+
* p
|
|
1996
|
+
* - span
|
|
1997
|
+
* p
|
|
1998
|
+
* - span
|
|
1999
|
+
*/
|
|
2000
|
+
if (firstBlock.type !== lastBlock.type &&
|
|
2001
|
+
range.startContainer.nodeType === range.endContainer.nodeType) {
|
|
2002
|
+
firstBlock.apply(new MergeTwoBlocksNodesAction(lastBlock));
|
|
2003
|
+
const splitAction = new SplitBlockWithNodeAction(cursorNode, cursorNode['text'].length);
|
|
2004
|
+
firstBlock.apply(splitAction);
|
|
2005
|
+
this.switchCaretPositionToNextElement(splitAction.newBlock);
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
this.selectionController.enqueueSelectionRangeFutureState(cursorNode, range.startOffset);
|
|
3415
2010
|
}
|
|
3416
|
-
/* istanbul ignore next */
|
|
3417
|
-
/**
|
|
3418
|
-
* Append child blocks.
|
|
3419
|
-
*/
|
|
3420
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3421
|
-
appendChildBlocks() { }
|
|
3422
2011
|
/**
|
|
3423
|
-
*
|
|
3424
|
-
*
|
|
3425
|
-
* @returns {boolean} - boolean.
|
|
2012
|
+
* Handles breaking a single block in an RTE editor based on the current selection and position.
|
|
3426
2013
|
*/
|
|
3427
|
-
|
|
3428
|
-
|
|
2014
|
+
breakSingleBlock() {
|
|
2015
|
+
const cursorNode = this.removeSelectionRange();
|
|
2016
|
+
const currentBlock = cursorNode.parentBlock;
|
|
2017
|
+
const { startOffset } = this.selectionController.getCurrentRange();
|
|
2018
|
+
if (currentBlock) {
|
|
2019
|
+
const breakAction = new BreakSingleBlockAction(cursorNode, startOffset);
|
|
2020
|
+
currentBlock.apply(breakAction);
|
|
2021
|
+
this.switchCaretPositionToNextElement(breakAction.newBlock);
|
|
2022
|
+
}
|
|
3429
2023
|
}
|
|
3430
2024
|
/**
|
|
3431
|
-
*
|
|
2025
|
+
* Moves the caret to the next block element in a rich text editor.
|
|
3432
2026
|
*
|
|
3433
|
-
* @param {
|
|
3434
|
-
* @returns {string} - node type.
|
|
2027
|
+
* @param {RTEBlock} newBlock - Represents a new create block element in a rich text editor.
|
|
3435
2028
|
*/
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
return element.getAttribute('data-type');
|
|
3440
|
-
}
|
|
3441
|
-
switch ((_a = element.style) === null || _a === void 0 ? void 0 : _a.fontSize) {
|
|
3442
|
-
case '36px':
|
|
3443
|
-
return 'title';
|
|
3444
|
-
case '28px':
|
|
3445
|
-
return 'subtitle';
|
|
3446
|
-
case '22px':
|
|
3447
|
-
return 'heading-1';
|
|
3448
|
-
case '20px':
|
|
3449
|
-
return 'heading-2';
|
|
3450
|
-
case '18px':
|
|
3451
|
-
return 'heading-3';
|
|
3452
|
-
}
|
|
3453
|
-
switch (element.nodeName) {
|
|
3454
|
-
case 'H1':
|
|
3455
|
-
return 'heading-1';
|
|
3456
|
-
case 'H2':
|
|
3457
|
-
return 'heading-2';
|
|
3458
|
-
case 'H3':
|
|
3459
|
-
return 'heading-3';
|
|
3460
|
-
case 'H4':
|
|
3461
|
-
return 'heading-4';
|
|
3462
|
-
case 'H5':
|
|
3463
|
-
return 'heading-5';
|
|
3464
|
-
case 'H6':
|
|
3465
|
-
return 'heading-6';
|
|
3466
|
-
default:
|
|
3467
|
-
return '';
|
|
2029
|
+
switchCaretPositionToNextElement(newBlock) {
|
|
2030
|
+
if (newBlock && newBlock['nodes']) {
|
|
2031
|
+
this.selectionController.enqueueSelectionRangeFutureState(newBlock['nodes'][0], 0);
|
|
3468
2032
|
}
|
|
3469
2033
|
}
|
|
3470
2034
|
}
|
|
3471
2035
|
|
|
3472
|
-
/**
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
}
|
|
3484
|
-
/**
|
|
3485
|
-
* Parse to a image block.
|
|
3486
|
-
*
|
|
3487
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3488
|
-
* @returns {Nullable<RTEContentBlock>} - Image block.
|
|
3489
|
-
*/
|
|
3490
|
-
handle(elementsArray) {
|
|
3491
|
-
const element = elementsArray[0];
|
|
3492
|
-
return RTEImageBlock.from({
|
|
3493
|
-
id: generateUUID(),
|
|
3494
|
-
type: 'image',
|
|
3495
|
-
nodes: [
|
|
3496
|
-
{
|
|
3497
|
-
id: generateUUID(),
|
|
3498
|
-
type: 'image',
|
|
3499
|
-
url: element.src,
|
|
3500
|
-
annotations: {
|
|
3501
|
-
size: 'md',
|
|
3502
|
-
alt: element.alt,
|
|
3503
|
-
},
|
|
3504
|
-
},
|
|
3505
|
-
],
|
|
3506
|
-
annotations: this.generateBlockAnnotations(element),
|
|
3507
|
-
});
|
|
3508
|
-
}
|
|
3509
|
-
/* istanbul ignore next */
|
|
3510
|
-
/**
|
|
3511
|
-
* Append child blocks.
|
|
3512
|
-
*/
|
|
3513
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3514
|
-
appendChildBlocks() { }
|
|
3515
|
-
/**
|
|
3516
|
-
* Should continue process to child elements.
|
|
3517
|
-
*
|
|
3518
|
-
* @returns {boolean} - boolean.
|
|
3519
|
-
*/
|
|
3520
|
-
shouldProceedToElementChildren() {
|
|
3521
|
-
return false;
|
|
2036
|
+
/**
|
|
2037
|
+
* Split the block with a split point node
|
|
2038
|
+
*
|
|
2039
|
+
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2040
|
+
*/
|
|
2041
|
+
class LineBreakSingleBlockAction extends ModifyContentAction {
|
|
2042
|
+
constructor(startContainerNode, startOffset) {
|
|
2043
|
+
super();
|
|
2044
|
+
this.type = ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK;
|
|
2045
|
+
this.startContainerNode = startContainerNode;
|
|
2046
|
+
this.startOffset = startOffset;
|
|
3522
2047
|
}
|
|
3523
2048
|
}
|
|
3524
2049
|
|
|
3525
|
-
/**
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
return elementsArray[currentIndex].tagName === 'VEGA-RICH-TEXT-IMAGE-EDITOR' ? 1 : 0;
|
|
2050
|
+
/**
|
|
2051
|
+
* Split the block with a split point node
|
|
2052
|
+
*
|
|
2053
|
+
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2054
|
+
*/
|
|
2055
|
+
class lineBreakMultipleBlocksAction extends ModifyContentAction {
|
|
2056
|
+
constructor(selectedBlocks) {
|
|
2057
|
+
super();
|
|
2058
|
+
this.type = ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS;
|
|
2059
|
+
this.selectedBlocks = selectedBlocks;
|
|
3536
2060
|
}
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
/** User press shift + enter will tigger this callback */
|
|
2064
|
+
class InsertLineBreakHandler extends BaseHandler {
|
|
3537
2065
|
/**
|
|
3538
|
-
*
|
|
3539
|
-
*
|
|
3540
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3541
|
-
* @returns {Nullable<RTEContentBlock>} - Image block.
|
|
2066
|
+
* Create new line break node and add node to state value
|
|
3542
2067
|
*/
|
|
3543
|
-
|
|
3544
|
-
const
|
|
3545
|
-
const
|
|
3546
|
-
if (
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
size: element.size || 'md',
|
|
3557
|
-
alt: element.alt,
|
|
3558
|
-
},
|
|
3559
|
-
},
|
|
3560
|
-
],
|
|
3561
|
-
annotations: this.generateBlockAnnotations(element),
|
|
3562
|
-
});
|
|
2068
|
+
handleEvent() {
|
|
2069
|
+
const range = this.selectionController.getCurrentRange();
|
|
2070
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2071
|
+
if (this.isRootContainer(range.startContainer)) {
|
|
2072
|
+
this.breakNewBlock();
|
|
2073
|
+
}
|
|
2074
|
+
if (selectedBlocks.length) {
|
|
2075
|
+
if (selectedBlocks.length < 2) {
|
|
2076
|
+
this.breakSingleBlock();
|
|
2077
|
+
}
|
|
2078
|
+
else {
|
|
2079
|
+
this.breakMultipleBlocks();
|
|
2080
|
+
}
|
|
3563
2081
|
}
|
|
3564
2082
|
}
|
|
3565
|
-
/* istanbul ignore next */
|
|
3566
|
-
/**
|
|
3567
|
-
* Append child blocks.
|
|
3568
|
-
*/
|
|
3569
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3570
|
-
appendChildBlocks() { }
|
|
3571
2083
|
/**
|
|
3572
|
-
*
|
|
3573
|
-
*
|
|
3574
|
-
*
|
|
2084
|
+
* Insert the \n in text element when root container is empty, should create text block and text node
|
|
2085
|
+
* <p>
|
|
2086
|
+
* <span></span>
|
|
2087
|
+
* <span></span>
|
|
2088
|
+
* </p>
|
|
3575
2089
|
*/
|
|
3576
|
-
|
|
3577
|
-
|
|
2090
|
+
breakNewBlock() {
|
|
2091
|
+
if (this.currentState &&
|
|
2092
|
+
this.currentState.blocks[0] &&
|
|
2093
|
+
this.currentState.blocks[0] instanceof RTETextBlock) {
|
|
2094
|
+
const lineBreakAction = new LineBreakSingleBlockAction(this.currentState.blocks[0].nodes[0], 0);
|
|
2095
|
+
this.currentState.blocks[0].apply(lineBreakAction);
|
|
2096
|
+
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2097
|
+
}
|
|
3578
2098
|
}
|
|
3579
|
-
}
|
|
3580
|
-
|
|
3581
|
-
/** Transform ol element to list block DTO */
|
|
3582
|
-
class OlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
3583
2099
|
/**
|
|
3584
|
-
*
|
|
3585
|
-
*
|
|
3586
|
-
*
|
|
3587
|
-
*
|
|
3588
|
-
*
|
|
2100
|
+
* If the selected node is a text node
|
|
2101
|
+
* <p>
|
|
2102
|
+
* <span>text</span>
|
|
2103
|
+
* </p>
|
|
2104
|
+
* Insert a line break and the selected node will be split into three text nodes
|
|
2105
|
+
* <p>
|
|
2106
|
+
* <span>te</span>
|
|
2107
|
+
* <br>
|
|
2108
|
+
* <span>xt</span>
|
|
2109
|
+
* </p>
|
|
3589
2110
|
*/
|
|
3590
|
-
|
|
3591
|
-
|
|
2111
|
+
breakSingleBlock() {
|
|
2112
|
+
const range = this.selectionController.getCurrentRange();
|
|
2113
|
+
const cursorNode = this.removeSelectionRange();
|
|
2114
|
+
const currentBlock = cursorNode.parentBlock;
|
|
2115
|
+
if (currentBlock) {
|
|
2116
|
+
const lineBreakAction = new LineBreakSingleBlockAction(cursorNode, range.startOffset);
|
|
2117
|
+
currentBlock.apply(lineBreakAction);
|
|
2118
|
+
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
2119
|
+
}
|
|
3592
2120
|
}
|
|
3593
2121
|
/**
|
|
3594
|
-
*
|
|
3595
|
-
*
|
|
3596
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3597
|
-
* @returns {Nullable<RTEContentBlock>} - Number list block.
|
|
2122
|
+
* Handles breaking blocks in an RTE editor based on the current selection and position.
|
|
3598
2123
|
*/
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
blocks: [],
|
|
3606
|
-
annotations: this.generateBlockAnnotations(elementsArray[0]),
|
|
3607
|
-
});
|
|
2124
|
+
breakMultipleBlocks() {
|
|
2125
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2126
|
+
const cursorNode = this.removeSelectionRange();
|
|
2127
|
+
const lineBreakAction = new lineBreakMultipleBlocksAction(selectedBlocks);
|
|
2128
|
+
cursorNode.parentBlock.apply(lineBreakAction);
|
|
2129
|
+
this.switchCaretPositionToSpecifiedNode(lineBreakAction.lineBreakNode);
|
|
3608
2130
|
}
|
|
3609
2131
|
/**
|
|
3610
|
-
*
|
|
2132
|
+
* Moves the caret to the next node element in a rich text editor.
|
|
3611
2133
|
*
|
|
3612
|
-
* @param {
|
|
3613
|
-
* @param {RTEListItemBlock[]} childBlocks - Current list item blocks.
|
|
2134
|
+
* @param {RTENode} lineBreakNode - Represents a node element in a rich text editor.
|
|
3614
2135
|
*/
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
childBlocks.forEach((block) => (block.parent = currentBlock));
|
|
2136
|
+
switchCaretPositionToSpecifiedNode(lineBreakNode) {
|
|
2137
|
+
this.selectionController.enqueueSelectionRangeFutureState(this.getNextRTENode(lineBreakNode), 0);
|
|
3618
2138
|
}
|
|
3619
2139
|
/**
|
|
3620
|
-
*
|
|
2140
|
+
* Returns the next sibling node of a given block element in a rich text editor.
|
|
3621
2141
|
*
|
|
3622
|
-
* @
|
|
2142
|
+
* @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.
|
|
2143
|
+
* @returns {RTENode} The next sibling node of the current line break element, or the current node if next node is not exists.
|
|
3623
2144
|
*/
|
|
3624
|
-
|
|
3625
|
-
|
|
2145
|
+
getNextRTENode(lineBreakNode) {
|
|
2146
|
+
const index = lineBreakNode.parentBlock['nodes'].indexOf(lineBreakNode);
|
|
2147
|
+
const nextNode = lineBreakNode.parentBlock['nodes'][index + 1];
|
|
2148
|
+
return nextNode || lineBreakNode;
|
|
3626
2149
|
}
|
|
3627
2150
|
}
|
|
3628
2151
|
|
|
3629
|
-
/**
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
return element.nodeType === Node.ELEMENT_NODE &&
|
|
3641
|
-
element.textContent === '' &&
|
|
3642
|
-
element.querySelector('img')
|
|
3643
|
-
? 1
|
|
3644
|
-
: 0;
|
|
3645
|
-
}
|
|
3646
|
-
/**
|
|
3647
|
-
* Parse to a image block.
|
|
3648
|
-
*
|
|
3649
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3650
|
-
* @returns {Nullable<RTEContentBlock>} - Image block.
|
|
3651
|
-
*/
|
|
3652
|
-
handle(elementsArray) {
|
|
3653
|
-
const element = elementsArray[0].querySelector('img');
|
|
3654
|
-
return RTEImageBlock.from({
|
|
3655
|
-
id: generateUUID(),
|
|
3656
|
-
type: 'image',
|
|
3657
|
-
nodes: [
|
|
3658
|
-
{
|
|
3659
|
-
id: generateUUID(),
|
|
3660
|
-
type: 'image',
|
|
3661
|
-
url: element.src,
|
|
3662
|
-
annotations: {
|
|
3663
|
-
size: 'md',
|
|
3664
|
-
alt: element.alt,
|
|
3665
|
-
},
|
|
3666
|
-
},
|
|
3667
|
-
],
|
|
3668
|
-
annotations: this.generateBlockAnnotations(element),
|
|
3669
|
-
});
|
|
3670
|
-
}
|
|
3671
|
-
/* istanbul ignore next */
|
|
3672
|
-
/**
|
|
3673
|
-
* Append child blocks.
|
|
3674
|
-
*/
|
|
3675
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3676
|
-
appendChildBlocks() { }
|
|
3677
|
-
/**
|
|
3678
|
-
* Should continue process to child elements.
|
|
3679
|
-
*
|
|
3680
|
-
* @returns {boolean} - boolean.
|
|
3681
|
-
*/
|
|
3682
|
-
shouldProceedToElementChildren() {
|
|
3683
|
-
return false;
|
|
2152
|
+
/**
|
|
2153
|
+
* Delete text or image when press delete
|
|
2154
|
+
*
|
|
2155
|
+
* @example currentBlock.apply(new DeleteBlockContentAction(startContainerNode, startOffset))
|
|
2156
|
+
*/
|
|
2157
|
+
class DeleteBlockContentAction extends ModifyContentAction {
|
|
2158
|
+
constructor(startContainerNode, startOffset) {
|
|
2159
|
+
super();
|
|
2160
|
+
this.type = ModifyContentActionType.DELETE_BLOCK_CONTENT;
|
|
2161
|
+
this.startContainerNode = startContainerNode;
|
|
2162
|
+
this.startOffset = startOffset;
|
|
3684
2163
|
}
|
|
3685
2164
|
}
|
|
3686
2165
|
|
|
3687
|
-
/**
|
|
3688
|
-
class
|
|
2166
|
+
/** Handles the deletion of content within a VegaRTE editor. User press backspace or delete will trigger this method */
|
|
2167
|
+
class DeleteContentHandler extends BaseHandler {
|
|
3689
2168
|
/**
|
|
3690
|
-
*
|
|
3691
|
-
*
|
|
3692
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3693
|
-
* @param {number} currentIndex - Current element index.
|
|
3694
|
-
* @returns {number} - can be handled element count.
|
|
2169
|
+
* Delete the selected node from the current state.
|
|
3695
2170
|
*/
|
|
3696
|
-
|
|
3697
|
-
const
|
|
3698
|
-
|
|
3699
|
-
|
|
2171
|
+
handleEvent() {
|
|
2172
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2173
|
+
if (selectedBlocks.length < 2) {
|
|
2174
|
+
this.deleteContentWithSingleBlock();
|
|
2175
|
+
}
|
|
2176
|
+
else {
|
|
2177
|
+
this.deleteContentWithMultipleNodes();
|
|
2178
|
+
}
|
|
3700
2179
|
}
|
|
3701
2180
|
/**
|
|
3702
|
-
*
|
|
3703
|
-
*
|
|
3704
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3705
|
-
* @returns {Nullable<RTEContentBlock>} - List item block.
|
|
2181
|
+
* Handles the deletion of content within a single block in an RTE editor.
|
|
3706
2182
|
*/
|
|
3707
|
-
|
|
3708
|
-
const
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
2183
|
+
deleteContentWithSingleBlock() {
|
|
2184
|
+
const range = this.selectionController.getCurrentRange();
|
|
2185
|
+
const { startOffset, endOffset, startContainer, endContainer } = range;
|
|
2186
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
2187
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2188
|
+
if (startOffset !== endOffset || startContainer !== endContainer) {
|
|
2189
|
+
this.deleteContentWithMultipleNodes();
|
|
2190
|
+
}
|
|
2191
|
+
else if (selectedBlocks[0]) {
|
|
2192
|
+
const deleteAction = new DeleteBlockContentAction(selectedNodes[0], startOffset);
|
|
2193
|
+
selectedBlocks[0].apply(deleteAction);
|
|
2194
|
+
if (deleteAction.previousNode) {
|
|
2195
|
+
const nextOffset = deleteAction.previousNode === selectedNodes[0]
|
|
2196
|
+
? Math.max(0, startOffset - 1)
|
|
2197
|
+
: this.getNodeEndOffset(deleteAction.previousNode);
|
|
2198
|
+
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.previousNode, nextOffset);
|
|
2199
|
+
}
|
|
2200
|
+
else if (deleteAction.nextNode) {
|
|
2201
|
+
this.selectionController.enqueueSelectionRangeFutureState(deleteAction.nextNode, 0);
|
|
2202
|
+
}
|
|
2203
|
+
else if (this.currentState.blocks.length === 0) {
|
|
2204
|
+
// Add a empty paragraph if delete all content to make sure the caret position
|
|
2205
|
+
this.insertDefaultParagraph();
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
3717
2208
|
}
|
|
3718
|
-
/* istanbul ignore next */
|
|
3719
2209
|
/**
|
|
3720
|
-
*
|
|
3721
|
-
*/
|
|
3722
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3723
|
-
appendChildBlocks() { }
|
|
3724
|
-
/**
|
|
3725
|
-
* Should continue process to child elements.
|
|
3726
|
-
*
|
|
3727
|
-
* @returns {boolean} - boolean.
|
|
2210
|
+
* Deletes the content within multiple nodes selected by the user.
|
|
3728
2211
|
*/
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
new OlToRTEListBlockStrategy(),
|
|
3740
|
-
new ULNotLiChildToRTEListItemBlockStrategy(),
|
|
3741
|
-
new LiToRTEListItemBlockStrategy(),
|
|
3742
|
-
new InlineBlockToRTETextBlockStrategy(),
|
|
3743
|
-
new ImgToRTEImageBlockStrategy(),
|
|
3744
|
-
new VegaImageToRTEImageBlockStrategy(),
|
|
3745
|
-
new SpanImageToRTEImageBlockStrategy(),
|
|
3746
|
-
new ContinueInlineToRTETextBlockStrategy(),
|
|
3747
|
-
];
|
|
2212
|
+
deleteContentWithMultipleNodes() {
|
|
2213
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2214
|
+
const cursorNode = this.removeSelectionRange(true);
|
|
2215
|
+
const lastSelectedNode = selectedNodes[selectedNodes.length - 1];
|
|
2216
|
+
if (selectedNodes.length > 1 &&
|
|
2217
|
+
lastSelectedNode instanceof RTETextNode &&
|
|
2218
|
+
lastSelectedNode.isEmpty()) {
|
|
2219
|
+
lastSelectedNode.parentBlock.apply(new RemoveChildAction(lastSelectedNode));
|
|
2220
|
+
}
|
|
2221
|
+
this.convertFirstBlockToParagraph(cursorNode.parentBlock);
|
|
3748
2222
|
}
|
|
3749
2223
|
/**
|
|
3750
|
-
*
|
|
2224
|
+
* If the first block is not paragraph, convert the block to paragraph after delete all text
|
|
3751
2225
|
*
|
|
3752
|
-
* @param {
|
|
3753
|
-
* @returns {ElementToDTOStrategyOutput[]} - outputs.
|
|
2226
|
+
* @param {RTEBlock} block - The first block instance
|
|
3754
2227
|
*/
|
|
3755
|
-
|
|
3756
|
-
const
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
if (canHandledCount === 1 && strategy.shouldProceedToElementChildren()) {
|
|
3767
|
-
output.setChildrenOutput(this.process(Array.from(handledElements[0].childNodes)));
|
|
3768
|
-
}
|
|
3769
|
-
outputs.push(output);
|
|
3770
|
-
i += canHandledCount - 1;
|
|
3771
|
-
break;
|
|
3772
|
-
}
|
|
3773
|
-
}
|
|
3774
|
-
if (canHandledCount === 0 && i < elements.length) {
|
|
3775
|
-
const elementChildren = Array.from(elements[i].childNodes);
|
|
3776
|
-
const childrenOutputs = this.process(Array.from(elementChildren));
|
|
3777
|
-
if (childrenOutputs.length > 0) {
|
|
3778
|
-
outputs.push(...childrenOutputs);
|
|
3779
|
-
}
|
|
3780
|
-
}
|
|
2228
|
+
convertFirstBlockToParagraph(block) {
|
|
2229
|
+
const firstBlock = this.currentState.blocks[0];
|
|
2230
|
+
if (firstBlock === block &&
|
|
2231
|
+
block instanceof RTETextBlock &&
|
|
2232
|
+
block.nodes.length === 1 &&
|
|
2233
|
+
block.nodes[0].isEmpty() &&
|
|
2234
|
+
block.type !== 'paragraph') {
|
|
2235
|
+
const paragraph = this.createEmptyParagraph();
|
|
2236
|
+
paragraph.apply(new ReplaceChildNodesAction(block.nodes));
|
|
2237
|
+
block.parent.apply(new InsertBlocksBeforeAction(block, paragraph));
|
|
2238
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
3781
2239
|
}
|
|
3782
|
-
return outputs;
|
|
3783
2240
|
}
|
|
3784
2241
|
/**
|
|
3785
|
-
*
|
|
2242
|
+
* Creates a new paragraph element with a text node and appends it to the current state.
|
|
2243
|
+
*/
|
|
2244
|
+
insertDefaultParagraph() {
|
|
2245
|
+
const paragraph = this.createEmptyParagraph();
|
|
2246
|
+
this.currentState.apply(new AppendChildNodesAction([paragraph]));
|
|
2247
|
+
this.selectionController.enqueueSelectionRangeFutureState(paragraph.nodes[0], 1);
|
|
2248
|
+
}
|
|
2249
|
+
/**
|
|
2250
|
+
* Returns the end offset of a given node in a Rich Text Editor based on its type and text content.
|
|
3786
2251
|
*
|
|
3787
|
-
* @param {
|
|
3788
|
-
* @returns {
|
|
2252
|
+
* @param {RTENode} node - text node or image node
|
|
2253
|
+
* @returns {number} Returns a number value.
|
|
3789
2254
|
*/
|
|
3790
|
-
|
|
3791
|
-
if (
|
|
3792
|
-
return
|
|
3793
|
-
|
|
2255
|
+
getNodeEndOffset(node) {
|
|
2256
|
+
if (node.type === 'IMAGE') {
|
|
2257
|
+
return 1;
|
|
2258
|
+
}
|
|
2259
|
+
else if (node.type === 'TEXT') {
|
|
2260
|
+
return node['text'] === '\n' ? 0 : node['text'].length;
|
|
2261
|
+
}
|
|
3794
2262
|
}
|
|
3795
2263
|
}
|
|
3796
2264
|
|
|
@@ -3798,10 +2266,6 @@ class ElementToDtoStrategyProcessor {
|
|
|
3798
2266
|
* Handle user paste
|
|
3799
2267
|
*/
|
|
3800
2268
|
class InsertPasteHandler extends BaseHandler {
|
|
3801
|
-
constructor() {
|
|
3802
|
-
super(...arguments);
|
|
3803
|
-
this.elementToDTOProcessor = new ElementToDtoStrategyProcessor();
|
|
3804
|
-
}
|
|
3805
2269
|
/**
|
|
3806
2270
|
* Update the state value when user paste html elements.
|
|
3807
2271
|
*
|
|
@@ -3853,8 +2317,10 @@ class InsertPasteHandler extends BaseHandler {
|
|
|
3853
2317
|
const cursorNode = this.removeSelectionRange();
|
|
3854
2318
|
/* istanbul ignore next */
|
|
3855
2319
|
const currentBlock = cursorNode === null || cursorNode === void 0 ? void 0 : cursorNode.parentBlock;
|
|
3856
|
-
|
|
3857
|
-
|
|
2320
|
+
if (currentBlock) {
|
|
2321
|
+
currentBlock.parent.apply(new InsertBlocksBeforeAction(currentBlock, ...blocks));
|
|
2322
|
+
this.switchCaretPositionToNextElement(currentBlock);
|
|
2323
|
+
}
|
|
3858
2324
|
}
|
|
3859
2325
|
/**
|
|
3860
2326
|
* Format and parse elements from user paste.
|
|
@@ -3863,11 +2329,14 @@ class InsertPasteHandler extends BaseHandler {
|
|
|
3863
2329
|
* @returns {RTEContentBlock[]} - RTEContentBlock.
|
|
3864
2330
|
*/
|
|
3865
2331
|
parsePastedElements(event) {
|
|
3866
|
-
|
|
2332
|
+
let pastedHTML = event.dataTransfer.getData('text/html');
|
|
2333
|
+
if (!pastedHTML) {
|
|
2334
|
+
const pastedText = event.dataTransfer.getData('text/plain');
|
|
2335
|
+
pastedHTML = this.parsePlainText(pastedText);
|
|
2336
|
+
}
|
|
3867
2337
|
const tempContainer = document.createElement('div');
|
|
3868
2338
|
tempContainer.innerHTML = pastedHTML;
|
|
3869
|
-
return
|
|
3870
|
-
.process(Array.from(tempContainer.childNodes))
|
|
2339
|
+
return ElementToDtoStrategyProcessor.process(Array.from(tempContainer.childNodes))
|
|
3871
2340
|
.filter(Boolean)
|
|
3872
2341
|
.map((output) => output.toDto())
|
|
3873
2342
|
.filter(Boolean);
|
|
@@ -3882,9 +2351,23 @@ class InsertPasteHandler extends BaseHandler {
|
|
|
3882
2351
|
this.selectionController.enqueueSelectionRangeFutureState(newBlock['nodes'][0], 0);
|
|
3883
2352
|
}
|
|
3884
2353
|
}
|
|
2354
|
+
/**
|
|
2355
|
+
* Parses the content of a plain text and formats it into HTML.
|
|
2356
|
+
*
|
|
2357
|
+
* @param {string} content - The content of plain text.
|
|
2358
|
+
* @returns {string} - The formatted HTML string.
|
|
2359
|
+
*/
|
|
2360
|
+
parsePlainText(content) {
|
|
2361
|
+
const lines = content.split('\n');
|
|
2362
|
+
return lines
|
|
2363
|
+
.map((line) => {
|
|
2364
|
+
return `<span>${line}</span>`;
|
|
2365
|
+
})
|
|
2366
|
+
.join('<span>\n</span>');
|
|
2367
|
+
}
|
|
3885
2368
|
}
|
|
3886
2369
|
|
|
3887
|
-
var __decorate$
|
|
2370
|
+
var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3888
2371
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3889
2372
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3890
2373
|
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;
|
|
@@ -3909,7 +2392,8 @@ class UserInputController extends VegaSlimmer {
|
|
|
3909
2392
|
e.preventDefault();
|
|
3910
2393
|
this.initValueIfEmpty();
|
|
3911
2394
|
// The insertCompositionText type input event can not be prevented, so we process the current action by insertCompositionTextController.
|
|
3912
|
-
|
|
2395
|
+
// If the focus node is a non-editable element, we do not process the input event.
|
|
2396
|
+
if (inputType === 'insertCompositionText' || this.isFocusNodeNonEditable()) {
|
|
3913
2397
|
return;
|
|
3914
2398
|
}
|
|
3915
2399
|
this.insertCompositionTextController.removeObserver();
|
|
@@ -3937,7 +2421,7 @@ class UserInputController extends VegaSlimmer {
|
|
|
3937
2421
|
break;
|
|
3938
2422
|
}
|
|
3939
2423
|
if (updateFlag) {
|
|
3940
|
-
this.
|
|
2424
|
+
void this.valueController.flushChanges(this.value);
|
|
3941
2425
|
}
|
|
3942
2426
|
};
|
|
3943
2427
|
}
|
|
@@ -3972,12 +2456,6 @@ class UserInputController extends VegaSlimmer {
|
|
|
3972
2456
|
}
|
|
3973
2457
|
return this.editableElementRef;
|
|
3974
2458
|
}
|
|
3975
|
-
/**
|
|
3976
|
-
* Notifies a change manager with the host and value details and logs the current value.
|
|
3977
|
-
*/
|
|
3978
|
-
notifyComponentFlushValue() {
|
|
3979
|
-
void this.valueController.flushChanges(this.value);
|
|
3980
|
-
}
|
|
3981
2459
|
/**
|
|
3982
2460
|
* Prevents the default behavior of a drag event.
|
|
3983
2461
|
*
|
|
@@ -3998,29 +2476,46 @@ class UserInputController extends VegaSlimmer {
|
|
|
3998
2476
|
void this.valueController.flushChanges(VegaRTEContent.fromJSON(defaultParagraph));
|
|
3999
2477
|
}
|
|
4000
2478
|
}
|
|
2479
|
+
/**
|
|
2480
|
+
* The code block placeholder element is non-editable, so we need to check if the focus node is a code block placeholder element.
|
|
2481
|
+
*
|
|
2482
|
+
* @returns {boolean} - Returns true if the focus node is a code block placeholder element, otherwise false.
|
|
2483
|
+
*/
|
|
2484
|
+
isFocusNodeNonEditable() {
|
|
2485
|
+
const { startContainer, endContainer } = this.selectionController.getCurrentRange();
|
|
2486
|
+
const selectedNodes = this.selectionController.getSelectedNodes();
|
|
2487
|
+
if (startContainer && startContainer === endContainer && selectedNodes.length === 0) {
|
|
2488
|
+
const focusElement = startContainer.nodeType === Node.ELEMENT_NODE
|
|
2489
|
+
? startContainer
|
|
2490
|
+
: startContainer.parentElement;
|
|
2491
|
+
return (focusElement &&
|
|
2492
|
+
focusElement.classList.contains(RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME));
|
|
2493
|
+
}
|
|
2494
|
+
return false;
|
|
2495
|
+
}
|
|
4001
2496
|
}
|
|
4002
|
-
__decorate$
|
|
2497
|
+
__decorate$f([
|
|
4003
2498
|
MapToComponentField()
|
|
4004
2499
|
], UserInputController.prototype, "host", void 0);
|
|
4005
|
-
__decorate$
|
|
2500
|
+
__decorate$f([
|
|
4006
2501
|
MapToComponentField()
|
|
4007
2502
|
], UserInputController.prototype, "value", void 0);
|
|
4008
|
-
__decorate$
|
|
2503
|
+
__decorate$f([
|
|
4009
2504
|
MapToComponentField()
|
|
4010
2505
|
], UserInputController.prototype, "valueController", void 0);
|
|
4011
|
-
__decorate$
|
|
2506
|
+
__decorate$f([
|
|
4012
2507
|
MapToComponentField()
|
|
4013
2508
|
], UserInputController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
4014
|
-
__decorate$
|
|
2509
|
+
__decorate$f([
|
|
4015
2510
|
MapToComponentField()
|
|
4016
2511
|
], UserInputController.prototype, "selectionController", void 0);
|
|
4017
|
-
__decorate$
|
|
2512
|
+
__decorate$f([
|
|
4018
2513
|
MapToComponentField()
|
|
4019
2514
|
], UserInputController.prototype, "insertCompositionTextController", void 0);
|
|
4020
|
-
__decorate$
|
|
2515
|
+
__decorate$f([
|
|
4021
2516
|
MapToComponentMethod('componentDidLoad')
|
|
4022
2517
|
], UserInputController.prototype, "addActionListener", null);
|
|
4023
|
-
__decorate$
|
|
2518
|
+
__decorate$f([
|
|
4024
2519
|
MapToComponentMethod('disconnectedCallback')
|
|
4025
2520
|
], UserInputController.prototype, "removeActionListener", null);
|
|
4026
2521
|
|
|
@@ -4040,7 +2535,7 @@ class InsertImageToBlockAction extends ModifyContentAction {
|
|
|
4040
2535
|
}
|
|
4041
2536
|
}
|
|
4042
2537
|
|
|
4043
|
-
var __decorate$
|
|
2538
|
+
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4044
2539
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4045
2540
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4046
2541
|
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;
|
|
@@ -4129,26 +2624,26 @@ class InsertImageController extends VegaSlimmer {
|
|
|
4129
2624
|
}
|
|
4130
2625
|
}
|
|
4131
2626
|
}
|
|
4132
|
-
__decorate$
|
|
2627
|
+
__decorate$e([
|
|
4133
2628
|
MapToComponentField()
|
|
4134
2629
|
], InsertImageController.prototype, "selectionController", void 0);
|
|
4135
|
-
__decorate$
|
|
2630
|
+
__decorate$e([
|
|
4136
2631
|
MapToComponentField()
|
|
4137
2632
|
], InsertImageController.prototype, "value", void 0);
|
|
4138
|
-
__decorate$
|
|
2633
|
+
__decorate$e([
|
|
4139
2634
|
MapToComponentField()
|
|
4140
2635
|
], InsertImageController.prototype, "valueController", void 0);
|
|
4141
|
-
__decorate$
|
|
2636
|
+
__decorate$e([
|
|
4142
2637
|
MapToComponentField()
|
|
4143
2638
|
], InsertImageController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
4144
|
-
__decorate$
|
|
2639
|
+
__decorate$e([
|
|
4145
2640
|
MapToComponentMethod('componentDidLoad')
|
|
4146
2641
|
], InsertImageController.prototype, "registerObserver", null);
|
|
4147
|
-
__decorate$
|
|
2642
|
+
__decorate$e([
|
|
4148
2643
|
MapToComponentMethod('disconnectedCallback')
|
|
4149
2644
|
], InsertImageController.prototype, "unRegisterObserver", null);
|
|
4150
2645
|
|
|
4151
|
-
var __decorate$
|
|
2646
|
+
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4152
2647
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4153
2648
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4154
2649
|
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;
|
|
@@ -4204,20 +2699,20 @@ class FocusController extends VegaSlimmer {
|
|
|
4204
2699
|
this.selectionController.setSelectionRange(range);
|
|
4205
2700
|
}
|
|
4206
2701
|
}
|
|
4207
|
-
__decorate$
|
|
2702
|
+
__decorate$d([
|
|
4208
2703
|
MapToComponentField()
|
|
4209
2704
|
], FocusController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
4210
|
-
__decorate$
|
|
2705
|
+
__decorate$d([
|
|
4211
2706
|
MapToComponentField()
|
|
4212
2707
|
], FocusController.prototype, "selectionController", void 0);
|
|
4213
|
-
__decorate$
|
|
2708
|
+
__decorate$d([
|
|
4214
2709
|
MapToComponentField()
|
|
4215
2710
|
], FocusController.prototype, "valueController", void 0);
|
|
4216
|
-
__decorate$
|
|
2711
|
+
__decorate$d([
|
|
4217
2712
|
MapToComponentField()
|
|
4218
2713
|
], FocusController.prototype, "value", void 0);
|
|
4219
2714
|
|
|
4220
|
-
var __decorate$
|
|
2715
|
+
var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4221
2716
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4222
2717
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4223
2718
|
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;
|
|
@@ -4257,14 +2752,14 @@ class TextNodeColorController extends VegaSlimmer {
|
|
|
4257
2752
|
return true;
|
|
4258
2753
|
}
|
|
4259
2754
|
}
|
|
4260
|
-
__decorate$
|
|
2755
|
+
__decorate$c([
|
|
4261
2756
|
MapToComponentMethod('connectedCallback')
|
|
4262
2757
|
], TextNodeColorController.prototype, "connectedCallback", null);
|
|
4263
|
-
__decorate$
|
|
2758
|
+
__decorate$c([
|
|
4264
2759
|
MapToComponentMethod('disconnectedCallback')
|
|
4265
2760
|
], TextNodeColorController.prototype, "disconnectResizeObserver", null);
|
|
4266
2761
|
|
|
4267
|
-
var __decorate$
|
|
2762
|
+
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4268
2763
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4269
2764
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4270
2765
|
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;
|
|
@@ -4472,35 +2967,35 @@ class InsertCompositionTextController extends VegaSlimmer {
|
|
|
4472
2967
|
this.editableElementRef.dispatchEvent(inputEvent);
|
|
4473
2968
|
}
|
|
4474
2969
|
}
|
|
4475
|
-
__decorate$
|
|
2970
|
+
__decorate$b([
|
|
4476
2971
|
MapToComponentField()
|
|
4477
2972
|
], InsertCompositionTextController.prototype, "selectionController", void 0);
|
|
4478
|
-
__decorate$
|
|
2973
|
+
__decorate$b([
|
|
4479
2974
|
MapToComponentField()
|
|
4480
2975
|
], InsertCompositionTextController.prototype, "host", void 0);
|
|
4481
|
-
__decorate$
|
|
2976
|
+
__decorate$b([
|
|
4482
2977
|
MapToComponentField()
|
|
4483
2978
|
], InsertCompositionTextController.prototype, "value", void 0);
|
|
4484
|
-
__decorate$
|
|
2979
|
+
__decorate$b([
|
|
4485
2980
|
MapToComponentField()
|
|
4486
2981
|
], InsertCompositionTextController.prototype, "valueController", void 0);
|
|
4487
|
-
__decorate$
|
|
2982
|
+
__decorate$b([
|
|
4488
2983
|
MapToComponentField()
|
|
4489
2984
|
], InsertCompositionTextController.prototype, "userInputController", void 0);
|
|
4490
|
-
__decorate$
|
|
2985
|
+
__decorate$b([
|
|
4491
2986
|
MapToComponentField()
|
|
4492
2987
|
], InsertCompositionTextController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
4493
|
-
__decorate$
|
|
2988
|
+
__decorate$b([
|
|
4494
2989
|
MapToComponentMethod('componentDidLoad')
|
|
4495
2990
|
], InsertCompositionTextController.prototype, "addCompositionTextEventListener", null);
|
|
4496
|
-
__decorate$
|
|
2991
|
+
__decorate$b([
|
|
4497
2992
|
MapToComponentMethod('disconnectedCallback')
|
|
4498
2993
|
], InsertCompositionTextController.prototype, "removeCompositionTextEventListener", null);
|
|
4499
|
-
__decorate$
|
|
2994
|
+
__decorate$b([
|
|
4500
2995
|
MapToComponentMethod('componentDidRender')
|
|
4501
2996
|
], InsertCompositionTextController.prototype, "reConnectObserver", null);
|
|
4502
2997
|
|
|
4503
|
-
var __decorate$
|
|
2998
|
+
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4504
2999
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4505
3000
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4506
3001
|
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;
|
|
@@ -4558,7 +3053,10 @@ class DeleteSelectedNodesController extends VegaSlimmer {
|
|
|
4558
3053
|
if (selectedNodes.length > 1) {
|
|
4559
3054
|
// 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
|
|
4560
3055
|
const shouldRemovedItems = selectedNodes.filter((item) => {
|
|
4561
|
-
if (item
|
|
3056
|
+
if (item instanceof RTECodeBlockNode) {
|
|
3057
|
+
return item !== startNode;
|
|
3058
|
+
}
|
|
3059
|
+
else if (item.type !== 'IMAGE') {
|
|
4562
3060
|
return item !== startNode && item !== endNode;
|
|
4563
3061
|
}
|
|
4564
3062
|
else {
|
|
@@ -4572,7 +3070,8 @@ class DeleteSelectedNodesController extends VegaSlimmer {
|
|
|
4572
3070
|
this.removeRangeStartAndEndSelectedText();
|
|
4573
3071
|
/**
|
|
4574
3072
|
* 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.
|
|
4575
|
-
* 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
|
|
3073
|
+
* 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.
|
|
3074
|
+
* the code block node should do the same logic.
|
|
4576
3075
|
*/
|
|
4577
3076
|
if (startNode instanceof RTEImageNode &&
|
|
4578
3077
|
startOffset !== 1 &&
|
|
@@ -4590,6 +3089,12 @@ class DeleteSelectedNodesController extends VegaSlimmer {
|
|
|
4590
3089
|
return startNode.parentBlock.nodes[0];
|
|
4591
3090
|
}
|
|
4592
3091
|
}
|
|
3092
|
+
else if (startNode instanceof RTECodeBlockNode) {
|
|
3093
|
+
const paragraph = this.createEmptyParagraph();
|
|
3094
|
+
startNode.parentBlock.parent.apply(new InsertBlocksBeforeAction(startNode.parentBlock, paragraph));
|
|
3095
|
+
startNode.parentBlock.apply(new RemoveChildAction(startNode));
|
|
3096
|
+
return paragraph.nodes[0];
|
|
3097
|
+
}
|
|
4593
3098
|
return startNode;
|
|
4594
3099
|
}
|
|
4595
3100
|
/**
|
|
@@ -4639,7 +3144,9 @@ class DeleteSelectedNodesController extends VegaSlimmer {
|
|
|
4639
3144
|
endRTENode.parentBlock.apply(new RemoveChildAction(endRTENode.parentBlock.nodes[0]));
|
|
4640
3145
|
}
|
|
4641
3146
|
}
|
|
4642
|
-
if (startRTENode
|
|
3147
|
+
if (startRTENode instanceof RTETextNode &&
|
|
3148
|
+
endRTENode instanceof RTETextNode &&
|
|
3149
|
+
startRTENode.parentBlock !== endRTENode.parentBlock) {
|
|
4643
3150
|
startRTENode.parentBlock.apply(new AppendChildNodesAction(endBlock.nodes));
|
|
4644
3151
|
endBlock.nodes = [];
|
|
4645
3152
|
}
|
|
@@ -4660,26 +3167,28 @@ class DeleteSelectedNodesController extends VegaSlimmer {
|
|
|
4660
3167
|
shouldMergeTextNode(nodeA, nodeB) {
|
|
4661
3168
|
const { annotations: annotationsA } = nodeA.toJSON();
|
|
4662
3169
|
const { annotations: annotationsB } = nodeB.toJSON();
|
|
4663
|
-
return
|
|
3170
|
+
return (nodeA instanceof RTETextNode &&
|
|
3171
|
+
nodeB instanceof RTETextNode &&
|
|
3172
|
+
JSON.stringify(annotationsA) === JSON.stringify(annotationsB));
|
|
4664
3173
|
}
|
|
4665
3174
|
}
|
|
4666
|
-
__decorate$
|
|
3175
|
+
__decorate$a([
|
|
4667
3176
|
MapToComponentField()
|
|
4668
3177
|
], DeleteSelectedNodesController.prototype, "host", void 0);
|
|
4669
|
-
__decorate$
|
|
3178
|
+
__decorate$a([
|
|
4670
3179
|
MapToComponentField()
|
|
4671
3180
|
], DeleteSelectedNodesController.prototype, "selectionController", void 0);
|
|
4672
|
-
__decorate$
|
|
3181
|
+
__decorate$a([
|
|
4673
3182
|
MapToComponentField()
|
|
4674
3183
|
], DeleteSelectedNodesController.prototype, "value", void 0);
|
|
4675
|
-
__decorate$
|
|
3184
|
+
__decorate$a([
|
|
4676
3185
|
MapToComponentMethod('connectedCallback')
|
|
4677
3186
|
], DeleteSelectedNodesController.prototype, "addDeleteObserver", null);
|
|
4678
|
-
__decorate$
|
|
3187
|
+
__decorate$a([
|
|
4679
3188
|
MapToComponentMethod('disconnectedCallback')
|
|
4680
3189
|
], DeleteSelectedNodesController.prototype, "removeDeleteObserver", null);
|
|
4681
3190
|
|
|
4682
|
-
var __decorate$
|
|
3191
|
+
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4683
3192
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4684
3193
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4685
3194
|
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;
|
|
@@ -4793,26 +3302,227 @@ class HistoryController extends KeyboardManagerSlimmer {
|
|
|
4793
3302
|
];
|
|
4794
3303
|
}
|
|
4795
3304
|
}
|
|
4796
|
-
__decorate$
|
|
3305
|
+
__decorate$9([
|
|
4797
3306
|
MapToComponentField()
|
|
4798
3307
|
], HistoryController.prototype, "host", void 0);
|
|
4799
|
-
__decorate$
|
|
3308
|
+
__decorate$9([
|
|
4800
3309
|
MapToComponentField()
|
|
4801
3310
|
], HistoryController.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
4802
|
-
__decorate$
|
|
3311
|
+
__decorate$9([
|
|
4803
3312
|
MapToComponentField()
|
|
4804
3313
|
], HistoryController.prototype, "valueController", void 0);
|
|
4805
|
-
__decorate$
|
|
3314
|
+
__decorate$9([
|
|
4806
3315
|
MapToComponentField()
|
|
4807
3316
|
], HistoryController.prototype, "value", void 0);
|
|
4808
|
-
__decorate$
|
|
3317
|
+
__decorate$9([
|
|
4809
3318
|
MapToComponentField()
|
|
4810
3319
|
], HistoryController.prototype, "selectionController", void 0);
|
|
4811
|
-
__decorate$
|
|
3320
|
+
__decorate$9([
|
|
4812
3321
|
MapToComponentMethod('componentDidLoad')
|
|
4813
3322
|
], HistoryController.prototype, "registerInitState", null);
|
|
4814
3323
|
|
|
4815
|
-
const
|
|
3324
|
+
const rectangleCode = {
|
|
3325
|
+
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>`,
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3328
|
+
/**
|
|
3329
|
+
* Transform the selected blocks to a code block.
|
|
3330
|
+
*
|
|
3331
|
+
* @example firstBlock.parent.apply(new TransformToCodeBlockAction(selectedBlocks))
|
|
3332
|
+
*/
|
|
3333
|
+
class TransformToCodeBlockAction extends ModifyContentAction {
|
|
3334
|
+
constructor(selectedBlocks) {
|
|
3335
|
+
super();
|
|
3336
|
+
this.type = ModifyContentActionType.TRANSFORM_TO_CODE_BLOCK;
|
|
3337
|
+
this.selectedBlocks = selectedBlocks;
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3342
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3343
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3344
|
+
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;
|
|
3345
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3346
|
+
};
|
|
3347
|
+
/**
|
|
3348
|
+
* The code block toolbar button slimmer.
|
|
3349
|
+
*/
|
|
3350
|
+
class CodeBlockToolbarButtonSlimmer extends VisualModeToolbarButtonSlimmer {
|
|
3351
|
+
constructor() {
|
|
3352
|
+
super({
|
|
3353
|
+
icon: 'rectangle-code',
|
|
3354
|
+
tooltip: { text: 'Code Block' },
|
|
3355
|
+
});
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* The selected blocks should convert to a code block.
|
|
3359
|
+
*/
|
|
3360
|
+
onClick() {
|
|
3361
|
+
const selected = this.isSelected();
|
|
3362
|
+
if (!selected) {
|
|
3363
|
+
const selectedBlocks = this.selectionController.getSelectedBlocks();
|
|
3364
|
+
const parentBlock = selectedBlocks[0].parent;
|
|
3365
|
+
const transformToCodeBlockAction = new TransformToCodeBlockAction(selectedBlocks);
|
|
3366
|
+
parentBlock.apply(transformToCodeBlockAction);
|
|
3367
|
+
void this.valueController.flushChanges(this.value);
|
|
3368
|
+
this.selectionController.enqueueSelectionRangeFutureState(transformToCodeBlockAction.newCodeBlock.nodes[0], 0);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
/**
|
|
3372
|
+
* The button will be selected if the selected blocks all code block.
|
|
3373
|
+
*
|
|
3374
|
+
* @returns {boolean} - The code block should selected or not.
|
|
3375
|
+
*/
|
|
3376
|
+
isSelected() {
|
|
3377
|
+
const selectBlocks = this.selectionController.getSelectedBlocks();
|
|
3378
|
+
if (selectBlocks.length && selectBlocks.every((block) => block.type === 'code-block')) {
|
|
3379
|
+
return true;
|
|
3380
|
+
}
|
|
3381
|
+
return false;
|
|
3382
|
+
}
|
|
3383
|
+
isDisabled() {
|
|
3384
|
+
const selectBlocks = this.selectionController.getSelectedBlocks();
|
|
3385
|
+
return (super.isDisabled() ||
|
|
3386
|
+
selectBlocks.some((block) => block.type === 'image' || block.type === 'list-item'));
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
(() => {
|
|
3390
|
+
VegaInternalIconManager.register({ 'rectangle-code': rectangleCode });
|
|
3391
|
+
})();
|
|
3392
|
+
__decorate$8([
|
|
3393
|
+
MapToComponentField()
|
|
3394
|
+
], CodeBlockToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
3395
|
+
__decorate$8([
|
|
3396
|
+
MapToComponentField()
|
|
3397
|
+
], CodeBlockToolbarButtonSlimmer.prototype, "valueController", void 0);
|
|
3398
|
+
__decorate$8([
|
|
3399
|
+
MapToComponentField()
|
|
3400
|
+
], CodeBlockToolbarButtonSlimmer.prototype, "value", void 0);
|
|
3401
|
+
|
|
3402
|
+
/**
|
|
3403
|
+
* The rich text internal code block selection controller.
|
|
3404
|
+
*/
|
|
3405
|
+
class InternalCodeBlockSelectionController extends AutoRunWhenReRenderTaskQueueSlimmer {
|
|
3406
|
+
constructor() {
|
|
3407
|
+
super(1);
|
|
3408
|
+
this.focusNodeOffset = 0;
|
|
3409
|
+
/**
|
|
3410
|
+
* The method invoke after the component re-render.
|
|
3411
|
+
*/
|
|
3412
|
+
this.doTask = async () => {
|
|
3413
|
+
await this.focusTheCodeBlock(this.shouldFocusNode);
|
|
3414
|
+
};
|
|
3415
|
+
}
|
|
3416
|
+
/**
|
|
3417
|
+
* Update the internal code block selection.
|
|
3418
|
+
*
|
|
3419
|
+
* @param {RTECodeBlockNode} startNode - The internal code block node DTO.
|
|
3420
|
+
* @param {number} startOffset - The content offset.
|
|
3421
|
+
* @param {boolean} immediatelyRun - Whether to invoke the method immediately.
|
|
3422
|
+
*/
|
|
3423
|
+
enqueueSelectionRangeFutureState(startNode, startOffset, immediatelyRun) {
|
|
3424
|
+
this.shouldFocusNode = startNode;
|
|
3425
|
+
this.focusNodeOffset = startOffset;
|
|
3426
|
+
super.enqueueTheTaskIntoQueue(immediatelyRun);
|
|
3427
|
+
}
|
|
3428
|
+
/**
|
|
3429
|
+
* 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.
|
|
3430
|
+
* 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.
|
|
3431
|
+
*
|
|
3432
|
+
*
|
|
3433
|
+
* @example
|
|
3434
|
+
* <div>
|
|
3435
|
+
* <span></span>
|
|
3436
|
+
* <vega-code-block></vega-code-block>
|
|
3437
|
+
* <span><span>
|
|
3438
|
+
* </div>
|
|
3439
|
+
* @param {RTECodeBlock} codeBlock - The code block DTO.
|
|
3440
|
+
* @param {Range} range - The range instance.
|
|
3441
|
+
* @returns {boolean} - The boolean result.
|
|
3442
|
+
*/
|
|
3443
|
+
isCodeBlockSelected(codeBlock, range) {
|
|
3444
|
+
const codeBlockNode = codeBlock.nodes[0];
|
|
3445
|
+
const entityDom = stateEntityRenderingRegistry.getDOMByEntity(codeBlockNode);
|
|
3446
|
+
return (codeBlock.isSelected() ||
|
|
3447
|
+
(entityDom &&
|
|
3448
|
+
range.intersectsNode(entityDom.nextSibling) &&
|
|
3449
|
+
range.intersectsNode(entityDom.previousSibling)));
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* Focus the code block component.
|
|
3453
|
+
*
|
|
3454
|
+
* @param {RTECodeBlockNode} node - The code block node DTO.
|
|
3455
|
+
*/
|
|
3456
|
+
async focusTheCodeBlock(node) {
|
|
3457
|
+
await Promise.resolve();
|
|
3458
|
+
const entityDom = stateEntityRenderingRegistry.getDOMByEntity(node);
|
|
3459
|
+
if (entityDom) {
|
|
3460
|
+
void entityDom.doFocus();
|
|
3461
|
+
}
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
const fileCode = {
|
|
3466
|
+
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="M64 464c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16H224v80c0 17.7 14.3 32 32 32h80V448c0 8.8-7.2 16-16 16H64zM64 0C28.7 0 0 28.7 0 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V154.5c0-17-6.7-33.3-18.7-45.3L274.7 18.7C262.7 6.7 246.5 0 229.5 0H64zm97 289c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0L79 303c-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-31zM257 255c-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>`,
|
|
3467
|
+
};
|
|
3468
|
+
|
|
3469
|
+
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
3470
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3471
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3472
|
+
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;
|
|
3473
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3474
|
+
};
|
|
3475
|
+
class SourceEditToolbarButtonSlimmer extends ToolbarButtonSlimmer {
|
|
3476
|
+
constructor() {
|
|
3477
|
+
super({
|
|
3478
|
+
icon: 'file-code',
|
|
3479
|
+
tooltip: {
|
|
3480
|
+
text: 'Edit Source',
|
|
3481
|
+
},
|
|
3482
|
+
autoFocusOnClick: false,
|
|
3483
|
+
});
|
|
3484
|
+
}
|
|
3485
|
+
async onClick() {
|
|
3486
|
+
const isSelected = this.sourceView;
|
|
3487
|
+
if (isSelected) {
|
|
3488
|
+
await this.saveSourceCode();
|
|
3489
|
+
}
|
|
3490
|
+
else {
|
|
3491
|
+
this.selectionController.setSelectionRange(new Range());
|
|
3492
|
+
}
|
|
3493
|
+
this.sourceView = !isSelected;
|
|
3494
|
+
}
|
|
3495
|
+
isSelected() {
|
|
3496
|
+
return this.sourceView;
|
|
3497
|
+
}
|
|
3498
|
+
isDisabled() {
|
|
3499
|
+
return super.isDisabled();
|
|
3500
|
+
}
|
|
3501
|
+
async saveSourceCode() {
|
|
3502
|
+
const sourceViewValue = this.vegaRichTextEditorRenderer.getSourceCode();
|
|
3503
|
+
if (typeof sourceViewValue === 'string') {
|
|
3504
|
+
const sourceCode = sourceViewValue.replace(/[\t\n]/g, '');
|
|
3505
|
+
await this.valueController.flushChanges(VegaRTEContent.fromHtml(sourceCode));
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
(() => {
|
|
3510
|
+
VegaInternalIconManager.register({ 'file-code': fileCode });
|
|
3511
|
+
})();
|
|
3512
|
+
__decorate$7([
|
|
3513
|
+
MapToComponentField({ writable: true })
|
|
3514
|
+
], SourceEditToolbarButtonSlimmer.prototype, "sourceView", void 0);
|
|
3515
|
+
__decorate$7([
|
|
3516
|
+
MapToComponentField()
|
|
3517
|
+
], SourceEditToolbarButtonSlimmer.prototype, "selectionController", void 0);
|
|
3518
|
+
__decorate$7([
|
|
3519
|
+
MapToComponentField()
|
|
3520
|
+
], SourceEditToolbarButtonSlimmer.prototype, "valueController", void 0);
|
|
3521
|
+
__decorate$7([
|
|
3522
|
+
MapToComponentField()
|
|
3523
|
+
], SourceEditToolbarButtonSlimmer.prototype, "vegaRichTextEditorRenderer", void 0);
|
|
3524
|
+
|
|
3525
|
+
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;font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;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}@media screen and (min-width: 768px) and (max-width: 1023px){:host .rich-text-editor-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .rich-text-editor-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .rich-text-editor-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}: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}: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}";
|
|
4816
3526
|
|
|
4817
3527
|
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
4818
3528
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4868,6 +3578,8 @@ const VegaRichTextEditor = class {
|
|
|
4868
3578
|
this.lessIndentToolbarButtonSlimmer = new LessIndentToolbarButtonSlimmer();
|
|
4869
3579
|
this.bulletsNumbersToolbarButtonSlimmer = new BulletsNumbersToolbarButtonSlimmer();
|
|
4870
3580
|
this.horizontalAlignmentToolbarButtonSlimmer = new HorizontalAlignmentToolbarButtonSlimmer();
|
|
3581
|
+
this.codeBlockToolbarButtonSlimmer = new CodeBlockToolbarButtonSlimmer();
|
|
3582
|
+
this.sourceEditToolbarButtonSlimmer = new SourceEditToolbarButtonSlimmer();
|
|
4871
3583
|
this.placeholderNotifySlimmer = createSubStateNotifySlimmer(VegaRichTextEditor, 'placeholder', 'watchPlaceholder');
|
|
4872
3584
|
this.disabledNotifySlimmer = createSubStateNotifySlimmer(VegaRichTextEditor, 'richTextContentEditable', 'watchRichTextContentEditable');
|
|
4873
3585
|
this.richTextContentController = new RichTextContentController(this);
|
|
@@ -4879,9 +3591,11 @@ const VegaRichTextEditor = class {
|
|
|
4879
3591
|
this.textNodeColorController = new TextNodeColorController();
|
|
4880
3592
|
this.deleteSelectedNodesController = new DeleteSelectedNodesController();
|
|
4881
3593
|
this.historyController = new HistoryController();
|
|
3594
|
+
this.internalCodeBlockSelectionController = new InternalCodeBlockSelectionController();
|
|
4882
3595
|
this.richTextContentEditable = true;
|
|
4883
3596
|
this.selectionMap = new Map();
|
|
4884
3597
|
this.isInDarkMode = VegaInternalThemeManager.isDarkMode();
|
|
3598
|
+
this.sourceView = false;
|
|
4885
3599
|
/**
|
|
4886
3600
|
* Specifies the label for the rich text editor.
|
|
4887
3601
|
*
|
|
@@ -5073,6 +3787,12 @@ __decorate$6([
|
|
|
5073
3787
|
__decorate$6([
|
|
5074
3788
|
InjectVegaSlimmer()
|
|
5075
3789
|
], VegaRichTextEditor.prototype, "horizontalAlignmentToolbarButtonSlimmer", void 0);
|
|
3790
|
+
__decorate$6([
|
|
3791
|
+
InjectVegaSlimmer()
|
|
3792
|
+
], VegaRichTextEditor.prototype, "codeBlockToolbarButtonSlimmer", void 0);
|
|
3793
|
+
__decorate$6([
|
|
3794
|
+
InjectVegaSlimmer()
|
|
3795
|
+
], VegaRichTextEditor.prototype, "sourceEditToolbarButtonSlimmer", void 0);
|
|
5076
3796
|
__decorate$6([
|
|
5077
3797
|
InjectVegaSlimmer()
|
|
5078
3798
|
], VegaRichTextEditor.prototype, "placeholderNotifySlimmer", void 0);
|
|
@@ -5106,6 +3826,9 @@ __decorate$6([
|
|
|
5106
3826
|
__decorate$6([
|
|
5107
3827
|
InjectVegaSlimmer()
|
|
5108
3828
|
], VegaRichTextEditor.prototype, "historyController", void 0);
|
|
3829
|
+
__decorate$6([
|
|
3830
|
+
InjectVegaSlimmer()
|
|
3831
|
+
], VegaRichTextEditor.prototype, "internalCodeBlockSelectionController", void 0);
|
|
5109
3832
|
VegaRichTextEditor.style = vegaRichTextEditorCss;
|
|
5110
3833
|
|
|
5111
3834
|
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|