@heartlandone/vega 2.34.0 → 2.35.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-4e819773.js → app-globals-fb3693cc.js} +22 -21
- package/dist/cjs/{change-manager-bda1d107.js → change-manager-a297e4d2.js} +1 -1
- package/dist/cjs/{child-nodes-event-prevent-slimmer-e1a6e5ad.js → child-nodes-event-prevent-slimmer-96c3c4ae.js} +3 -3
- package/dist/cjs/{child-nodes-notify-observer-slimmer-03a3f79e.js → child-nodes-notify-observer-slimmer-be92f366.js} +5 -5
- package/dist/cjs/{component-63af66ea.js → component-73a88c4e.js} +1 -1
- package/dist/cjs/{component-global-style-slimmer-6b64a26c.js → component-global-style-slimmer-6749808c.js} +1 -1
- package/dist/cjs/{component-usage-runtime-metrics-019d3c00.js → component-usage-runtime-metrics-dcb32c24.js} +1 -1
- package/dist/cjs/content-state-3e4467a3.js +134 -0
- package/dist/cjs/{create-public-api-runtime-metrics-slimmer-8c6a8fb7.js → create-public-api-runtime-metrics-slimmer-54c3f73b.js} +2 -2
- package/dist/cjs/{date-ffe382a4.js → date-0a6bb035.js} +1 -1
- package/dist/cjs/{deprecated-property-slimmer-f36e3779.js → deprecated-property-slimmer-fc729fd9.js} +2 -2
- package/dist/cjs/{design-token-908e3f69.js → design-token-30c069c1.js} +3 -3
- package/dist/cjs/{dom-node-subject-observer-factory-093462f1.js → dom-node-subject-factory-3ec114b8.js} +1 -41
- package/dist/cjs/dom-node-subject-observer-factory-5f0eae19.js +44 -0
- package/dist/cjs/{dynamic-slimmer-dc30600a.js → dynamic-slimmer-f31fdfd7.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-0dd70e61.js → element-appender-slimmer-700b7004.js} +6 -6
- package/dist/cjs/{event-emit-slimmer-a46bb411.js → event-emit-slimmer-9c223f73.js} +7 -6
- package/dist/cjs/{feature-flag-controller-e97b5f29.js → feature-flag-controller-7b22e598.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-9aeabcdc.js → form-field-controller-slimmer-7ef32059.js} +16 -15
- package/dist/cjs/global-slimmer-registry-b3bce7e0.js +297 -0
- package/dist/cjs/{icon-manager-36dcfb65.js → icon-manager-edc2400b.js} +2 -2
- package/dist/cjs/{text-color-toolbar-button-slimmer-b1c9f40e.js → image-annotation-action-d3e1699c.js} +78 -27
- package/dist/cjs/{global-slimmer-registry-dd2691b8.js → index-09acd3c9.js} +282 -296
- package/dist/cjs/index.cjs.js +27 -28
- package/dist/cjs/{inject-keyboard-manager-af37c861.js → inject-keyboard-manager-4a5c27a2.js} +1 -1
- package/dist/cjs/{internal-icon-manager-2282a62f.js → internal-icon-manager-5ccb9443.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-d7643ec6.js → internal-vega-event-manager-e5e4bcf4.js} +72 -72
- package/dist/cjs/{internal-vega-z-index-manager-e24e4309.js → internal-vega-z-index-manager-f03ddb37.js} +1 -1
- package/dist/cjs/{keyboard-manager-5afbc8f1.js → keyboard-manager-2df53b2f.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-9be2a880.js → keyboard-manager-slimmer-feba3a83.js} +2 -2
- package/dist/cjs/{content-state-3a2724f6.js → list-block-91116257.js} +1393 -679
- package/dist/cjs/loader.cjs.js +21 -21
- package/dist/cjs/{mutation-observer-slimmer-98bbbdf0.js → mutation-observer-slimmer-895b3d3e.js} +1 -1
- package/dist/cjs/{node.abstract-f8075f84.js → node-annotation.abstract-e5d3a859.js} +37 -48
- package/dist/cjs/{page-resize-observer-slimmer-e54fa9d4.js → page-resize-observer-slimmer-bb1eaebe.js} +1 -1
- package/dist/cjs/{remote-invocation-registry-71a45468.js → remote-invocation-registry-ff9af278.js} +3 -3
- package/dist/cjs/{responsive-format-facade-74079f1b.js → responsive-format-facade-4363a00d.js} +1 -1
- package/dist/cjs/{state-background-color-formatter-d32a1098.js → state-background-color-formatter-e585a027.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-297765c0.js → string-input-formatter-slimmer-6155c9f5.js} +1 -1
- package/dist/cjs/{style-formatter-5deb065f.js → style-formatter-63218b76.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-73201c53.js → sub-state-notify-slimmer-c2e08e06.js} +8 -8
- package/dist/cjs/{sub-state-observer-slimmer-10c0d402.js → sub-state-observer-slimmer-b97e46b5.js} +8 -8
- package/dist/cjs/{translation-f6b7ee84.js → translation-b9be41e0.js} +3 -3
- package/dist/cjs/{translation-slimmer-90f9f71f.js → translation-slimmer-ec76c5a2.js} +2 -2
- package/dist/cjs/{ui-b5906704.js → ui-5fd9b267.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +41 -39
- package/dist/cjs/vega-app-footer.cjs.entry.js +13 -12
- package/dist/cjs/vega-app-header-button.cjs.entry.js +42 -40
- package/dist/cjs/vega-backdrop.cjs.entry.js +9 -8
- package/dist/cjs/vega-banner.cjs.entry.js +36 -34
- package/dist/cjs/vega-bar-chart.cjs.entry.js +6 -5
- package/dist/cjs/vega-box.cjs.entry.js +13 -12
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +34 -32
- package/dist/cjs/vega-button-circle.cjs.entry.js +25 -23
- package/dist/cjs/vega-button-group_2.cjs.entry.js +32 -30
- package/dist/cjs/vega-button-link.cjs.entry.js +26 -24
- package/dist/cjs/vega-button.cjs.entry.js +26 -24
- package/dist/cjs/vega-calendar_3.cjs.entry.js +135 -133
- package/dist/cjs/vega-card.cjs.entry.js +11 -10
- package/dist/cjs/vega-carousel.cjs.entry.js +25 -23
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +46 -44
- package/dist/cjs/vega-chip.cjs.entry.js +36 -34
- package/dist/cjs/vega-color-picker.cjs.entry.js +26 -24
- package/dist/cjs/vega-combo-box.cjs.entry.js +46 -44
- package/dist/cjs/vega-counter-badge.cjs.entry.js +10 -9
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +56 -54
- package/dist/cjs/{vega-dialog-controller-aaf1f43e.js → vega-dialog-controller-fe610705.js} +2 -2
- package/dist/cjs/vega-dialog_2.cjs.entry.js +47 -45
- package/dist/cjs/vega-divider.cjs.entry.js +11 -10
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +132 -130
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +8 -7
- package/dist/cjs/vega-field-label.cjs.entry.js +22 -20
- package/dist/cjs/vega-file-uploader.cjs.entry.js +67 -65
- package/dist/cjs/vega-flex.cjs.entry.js +14 -13
- package/dist/cjs/vega-font.cjs.entry.js +14 -13
- package/dist/cjs/vega-form.cjs.entry.js +38 -36
- package/dist/cjs/vega-grid.cjs.entry.js +11 -10
- package/dist/cjs/vega-hint.cjs.entry.js +7 -6
- package/dist/cjs/vega-icon.cjs.entry.js +16 -15
- package/dist/cjs/vega-image-uploader.cjs.entry.js +51 -49
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +37 -35
- package/dist/cjs/vega-input-numeric.cjs.entry.js +30 -28
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +49 -47
- package/dist/cjs/vega-input-range.cjs.entry.js +40 -38
- package/dist/cjs/vega-input-select.cjs.entry.js +62 -60
- package/dist/cjs/vega-input.cjs.entry.js +46 -44
- package/dist/cjs/vega-item-toggle.cjs.entry.js +21 -19
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +102 -100
- package/dist/cjs/vega-line-chart.cjs.entry.js +7 -6
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +16 -15
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +20 -18
- package/dist/cjs/vega-pagination.cjs.entry.js +57 -52
- package/dist/cjs/vega-pie-chart.cjs.entry.js +7 -6
- package/dist/cjs/vega-popover_2.cjs.entry.js +34 -32
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +29 -27
- package/dist/cjs/vega-radio_2.cjs.entry.js +50 -48
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +321 -23
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +952 -737
- package/dist/cjs/vega-section-title.cjs.entry.js +15 -14
- package/dist/cjs/vega-segment-control.cjs.entry.js +24 -22
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +49 -47
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +61 -59
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +46 -44
- package/dist/cjs/vega-signature-capture.cjs.entry.js +40 -38
- package/dist/cjs/{block-annotation.abstract-4d88b939.js → vega-skeleton-loader-controller-7dac484f.js} +7 -21
- package/dist/cjs/vega-skeleton.cjs.entry.js +26 -25
- package/dist/cjs/vega-slot-container.cjs.entry.js +6 -5
- package/dist/cjs/vega-stepper.cjs.entry.js +34 -32
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +54 -52
- package/dist/cjs/vega-table_8.cjs.entry.js +185 -183
- package/dist/cjs/vega-text.cjs.entry.js +9 -8
- package/dist/cjs/vega-textarea.cjs.entry.js +34 -32
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +83 -81
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +23 -21
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +20 -19
- package/dist/cjs/vega.cjs.js +21 -21
- package/dist/collection/components/vega-pagination/vega-pagination.js +5 -2
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +22 -1
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +0 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +0 -44
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +0 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +0 -90
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +0 -11
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +0 -26
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +0 -44
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +0 -11
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +0 -42
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +67 -26
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +45 -31
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +68 -35
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +113 -50
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +23 -60
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +0 -25
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +95 -51
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +123 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +258 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +71 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +85 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +56 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +7 -3
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/image-block.test.js +0 -10
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-block.test.js +0 -48
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-item.test.js +0 -40
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +0 -39
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +0 -34
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.css +3 -0
- package/dist/esm/{app-globals-9971ccfd.js → app-globals-5b154b6d.js} +13 -12
- package/dist/esm/{change-manager-8f5b72c2.js → change-manager-6a7eb88c.js} +1 -1
- package/dist/esm/{child-nodes-event-prevent-slimmer-8ceabe63.js → child-nodes-event-prevent-slimmer-97aae8a8.js} +3 -3
- package/dist/esm/{child-nodes-notify-observer-slimmer-afc15e00.js → child-nodes-notify-observer-slimmer-289caacc.js} +4 -4
- package/dist/esm/{component-051a594c.js → component-cae24190.js} +1 -1
- package/dist/esm/{component-global-style-slimmer-631f956f.js → component-global-style-slimmer-000e0c11.js} +1 -1
- package/dist/esm/{component-usage-runtime-metrics-21813c36.js → component-usage-runtime-metrics-385c7124.js} +1 -1
- package/dist/esm/content-state-f39c4bbf.js +132 -0
- package/dist/esm/{create-public-api-runtime-metrics-slimmer-14cb4599.js → create-public-api-runtime-metrics-slimmer-9ab05523.js} +2 -2
- package/dist/esm/{date-655c0af8.js → date-732bc749.js} +1 -1
- package/dist/esm/{deprecated-property-slimmer-9ea5019c.js → deprecated-property-slimmer-43d184b3.js} +2 -2
- package/dist/esm/{design-token-20fdba82.js → design-token-d06bc718.js} +3 -3
- package/dist/esm/{dom-node-subject-observer-factory-80358591.js → dom-node-subject-factory-5831cdd4.js} +2 -41
- package/dist/esm/dom-node-subject-observer-factory-dc486a8b.js +42 -0
- package/dist/esm/{dynamic-slimmer-85746483.js → dynamic-slimmer-90b8af32.js} +1 -1
- package/dist/esm/{element-appender-slimmer-4dfa326d.js → element-appender-slimmer-d71e3109.js} +6 -6
- package/dist/esm/{event-emit-slimmer-c03cf145.js → event-emit-slimmer-f285e3ac.js} +6 -5
- package/dist/esm/{feature-flag-controller-dfde0cfa.js → feature-flag-controller-4b3fe6f8.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-de5fe574.js → form-field-controller-slimmer-af969d03.js} +10 -9
- package/dist/esm/global-slimmer-registry-17c4efd4.js +283 -0
- package/dist/esm/{icon-manager-3cef32e7.js → icon-manager-b889176b.js} +2 -2
- package/dist/esm/{text-color-toolbar-button-slimmer-d0255b98.js → image-annotation-action-a8e00f28.js} +55 -6
- package/dist/esm/{global-slimmer-registry-6887a59f.js → index-187f71d1.js} +283 -284
- package/dist/esm/index.js +20 -21
- package/dist/esm/{inject-keyboard-manager-45309420.js → inject-keyboard-manager-b0135018.js} +1 -1
- package/dist/esm/{internal-icon-manager-7fc7535a.js → internal-icon-manager-900a5bb4.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-3a3815d3.js → internal-vega-event-manager-07e1b3d9.js} +2 -2
- package/dist/esm/{internal-vega-z-index-manager-89e8b6f5.js → internal-vega-z-index-manager-7d2b54c3.js} +1 -1
- package/dist/esm/{keyboard-manager-2c06eafe.js → keyboard-manager-4c898a0d.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-fd177285.js → keyboard-manager-slimmer-f80d6835.js} +2 -2
- package/dist/esm/{content-state-acf55eb0.js → list-block-ba82c846.js} +1273 -577
- package/dist/esm/loader.js +19 -19
- package/dist/esm/{mutation-observer-slimmer-ca2cb2e8.js → mutation-observer-slimmer-6cef9549.js} +1 -1
- package/dist/esm/{node.abstract-93746055.js → node-annotation.abstract-d7d52bce.js} +35 -47
- package/dist/esm/{page-resize-observer-slimmer-8589ebc8.js → page-resize-observer-slimmer-beb7b0bd.js} +1 -1
- 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/{remote-invocation-registry-2ec6936d.js → remote-invocation-registry-d97fa3bc.js} +2 -2
- package/dist/esm/{responsive-format-facade-559ec469.js → responsive-format-facade-c2ab9c87.js} +1 -1
- package/dist/esm/{state-background-color-formatter-16031a43.js → state-background-color-formatter-121ae7d3.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-c9fb1fa1.js → string-input-formatter-slimmer-73fa06e6.js} +1 -1
- package/dist/esm/{style-formatter-51845b6d.js → style-formatter-f91471e8.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-6e97a58a.js → sub-state-notify-slimmer-48bad548.js} +4 -4
- package/dist/esm/{sub-state-observer-slimmer-0968ce04.js → sub-state-observer-slimmer-403cc4e7.js} +4 -4
- package/dist/esm/{translation-b3fe8e74.js → translation-a98970d8.js} +3 -3
- package/dist/esm/{translation-slimmer-860cd766.js → translation-slimmer-5ee9912b.js} +2 -2
- package/dist/esm/{ui-5600b48f.js → ui-62e4be97.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +17 -15
- package/dist/esm/vega-app-footer.entry.js +4 -3
- package/dist/esm/vega-app-header-button.entry.js +20 -18
- package/dist/esm/vega-backdrop.entry.js +5 -4
- package/dist/esm/vega-banner.entry.js +15 -13
- package/dist/esm/vega-bar-chart.entry.js +3 -2
- package/dist/esm/vega-box.entry.js +10 -9
- package/dist/esm/vega-breadcrumb.entry.js +13 -11
- package/dist/esm/vega-button-circle.entry.js +16 -14
- package/dist/esm/vega-button-group_2.entry.js +15 -13
- package/dist/esm/vega-button-link.entry.js +13 -11
- package/dist/esm/vega-button.entry.js +15 -13
- package/dist/esm/vega-calendar_3.entry.js +23 -21
- package/dist/esm/vega-card.entry.js +8 -7
- package/dist/esm/vega-carousel.entry.js +14 -12
- package/dist/esm/vega-checkbox_2.entry.js +19 -17
- package/dist/esm/vega-chip.entry.js +17 -15
- package/dist/esm/vega-color-picker.entry.js +16 -14
- package/dist/esm/vega-combo-box.entry.js +20 -18
- package/dist/esm/vega-counter-badge.entry.js +4 -3
- package/dist/esm/vega-date-picker_2.entry.js +31 -29
- package/dist/esm/{vega-dialog-controller-5b23f68c.js → vega-dialog-controller-34eb8967.js} +2 -2
- package/dist/esm/vega-dialog_2.entry.js +20 -18
- package/dist/esm/vega-divider.entry.js +8 -7
- package/dist/esm/vega-dropdown_5.entry.js +27 -25
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +5 -4
- package/dist/esm/vega-field-label.entry.js +11 -9
- package/dist/esm/vega-file-uploader.entry.js +19 -17
- package/dist/esm/vega-flex.entry.js +11 -10
- package/dist/esm/vega-font.entry.js +9 -8
- package/dist/esm/vega-form.entry.js +19 -17
- package/dist/esm/vega-grid.entry.js +8 -7
- package/dist/esm/vega-hint.entry.js +4 -3
- package/dist/esm/vega-icon.entry.js +11 -10
- package/dist/esm/vega-image-uploader.entry.js +21 -19
- package/dist/esm/vega-input-credit-card.entry.js +20 -18
- package/dist/esm/vega-input-numeric.entry.js +21 -19
- package/dist/esm/vega-input-phone-number.entry.js +21 -19
- package/dist/esm/vega-input-range.entry.js +19 -17
- package/dist/esm/vega-input-select.entry.js +22 -20
- package/dist/esm/vega-input.entry.js +18 -16
- package/dist/esm/vega-item-toggle.entry.js +12 -10
- package/dist/esm/vega-left-nav_5.entry.js +24 -22
- package/dist/esm/vega-line-chart.entry.js +4 -3
- package/dist/esm/vega-loader-wrapper_2.entry.js +7 -6
- package/dist/esm/vega-page-notification_2.entry.js +8 -6
- package/dist/esm/vega-pagination.entry.js +21 -16
- package/dist/esm/vega-pie-chart.entry.js +4 -3
- package/dist/esm/vega-popover_2.entry.js +18 -16
- package/dist/esm/vega-progress-tracker.entry.js +12 -10
- package/dist/esm/vega-radio_2.entry.js +21 -19
- package/dist/esm/vega-rich-text-content.entry.js +315 -17
- package/dist/esm/vega-rich-text-editor_4.entry.js +657 -442
- package/dist/esm/vega-section-title.entry.js +4 -3
- package/dist/esm/vega-segment-control.entry.js +12 -10
- package/dist/esm/vega-selection-chip_2.entry.js +21 -19
- package/dist/esm/vega-selection-tile_2.entry.js +21 -19
- package/dist/esm/vega-sidenav_3.entry.js +19 -17
- package/dist/esm/vega-signature-capture.entry.js +22 -20
- package/dist/esm/{block-annotation.abstract-b0554e2b.js → vega-skeleton-loader-controller-0aaaf1fa.js} +8 -21
- package/dist/esm/vega-skeleton.entry.js +4 -3
- package/dist/esm/vega-slot-container.entry.js +3 -2
- package/dist/esm/vega-stepper.entry.js +18 -16
- package/dist/esm/vega-tab-group_2.entry.js +14 -12
- package/dist/esm/vega-table_8.entry.js +26 -24
- package/dist/esm/vega-text.entry.js +5 -4
- package/dist/esm/vega-textarea.entry.js +18 -16
- package/dist/esm/vega-time-picker_2.entry.js +25 -23
- package/dist/esm/vega-toggle-switch.entry.js +16 -14
- package/dist/esm/vega-tooltip_2.entry.js +13 -12
- package/dist/esm/vega.js +19 -19
- package/dist/types/components/vega-pagination/vega-pagination.d.ts +1 -0
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +0 -8
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +0 -6
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +0 -14
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +2 -23
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +68 -5
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +45 -4
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +68 -4
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +110 -6
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +21 -6
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +1 -14
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +86 -4
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +111 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +32 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +38 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.d.ts +35 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +36 -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 +31 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-000b3ab0.js +1 -0
- package/dist/vega/p-00738ae9.entry.js +1 -0
- package/dist/vega/p-01d0dbe6.entry.js +1 -0
- package/dist/vega/{p-b3f9cc3a.entry.js → p-0283712e.entry.js} +2 -2
- package/dist/vega/p-032df16f.js +1 -0
- package/dist/vega/p-05f5e22b.entry.js +1 -0
- package/dist/vega/p-0945a58d.entry.js +1 -0
- package/dist/vega/p-09c5de7f.entry.js +1 -0
- package/dist/vega/p-0a8b91f5.entry.js +1 -0
- package/dist/vega/{p-f763e2eb.js → p-0af4bda9.js} +1 -1
- package/dist/vega/p-0bd9b1d9.entry.js +1 -0
- package/dist/vega/p-0c2eb135.entry.js +1 -0
- package/dist/vega/p-0da2de05.entry.js +1 -0
- package/dist/vega/p-0ee10fd7.js +1 -0
- package/dist/vega/p-12ad8ada.entry.js +1 -0
- package/dist/vega/p-14514252.entry.js +1 -0
- package/dist/vega/{p-11a19ca0.js → p-149d2801.js} +1 -1
- package/dist/vega/p-14f85e30.entry.js +1 -0
- package/dist/vega/p-19556584.entry.js +1 -0
- package/dist/vega/p-1b3e0a9f.entry.js +1 -0
- package/dist/vega/p-1c298d5a.js +2 -0
- package/dist/vega/p-1d805cc0.entry.js +1 -0
- package/dist/vega/p-1dd9f841.entry.js +1 -0
- package/dist/vega/p-211df22a.entry.js +1 -0
- package/dist/vega/p-2205ee4c.js +1 -0
- package/dist/vega/p-29b09aad.js +1 -0
- package/dist/vega/{p-443ad3b3.js → p-2d0d575f.js} +1 -1
- package/dist/vega/p-2f32a9ba.js +1 -0
- package/dist/vega/{p-368d0060.js → p-2fbda931.js} +1 -1
- package/dist/vega/p-33b62194.js +1 -0
- package/dist/vega/p-36db2554.entry.js +1 -0
- package/dist/vega/p-3a6c9b9d.entry.js +1 -0
- package/dist/vega/p-42df8a42.js +1 -0
- package/dist/vega/{p-8f93242a.js → p-4387d550.js} +1 -1
- package/dist/vega/p-45c88f7f.entry.js +1 -0
- package/dist/vega/p-45dd4698.entry.js +1 -0
- package/dist/vega/p-465fa96d.entry.js +1 -0
- package/dist/vega/{p-3b4bde3e.js → p-4b500240.js} +1 -1
- package/dist/vega/{p-e0b25eaf.js → p-4f0b56fc.js} +1 -1
- package/dist/vega/p-5298fd92.entry.js +1 -0
- package/dist/vega/p-5915634b.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-70151c27.js → p-5f589974.js} +1 -1
- package/dist/vega/p-61116634.entry.js +1 -0
- package/dist/vega/p-618b35e4.entry.js +1 -0
- package/dist/vega/p-625771d7.entry.js +1 -0
- package/dist/vega/p-6661a462.entry.js +1 -0
- package/dist/vega/{p-62774231.js → p-6705c68a.js} +1 -1
- package/dist/vega/p-68f0aa72.entry.js +1 -0
- package/dist/vega/{p-59bdf9b8.js → p-6a334573.js} +1 -1
- package/dist/vega/p-6a3989dd.js +1 -0
- package/dist/vega/{p-0e0c47ad.js → p-6a5a5c7b.js} +1 -1
- package/dist/vega/p-6c09b79a.entry.js +1 -0
- package/dist/vega/p-6d23c08b.entry.js +1 -0
- package/dist/vega/p-6d43b123.entry.js +1 -0
- package/dist/vega/p-6e1ab235.js +1 -0
- package/dist/vega/p-71eeb279.entry.js +1 -0
- package/dist/vega/p-72eee5e2.js +1 -0
- package/dist/vega/{p-eac38d87.js → p-781fd6e0.js} +1 -1
- package/dist/vega/{p-1995e98e.js → p-79ec5d69.js} +1 -1
- package/dist/vega/p-8067bd31.entry.js +1 -0
- package/dist/vega/{p-3f1b542a.js → p-81dbada7.js} +1 -1
- package/dist/vega/{p-a6a7d0c9.js → p-8284a445.js} +1 -1
- package/dist/vega/p-84113217.entry.js +1 -0
- package/dist/vega/p-843b13e6.entry.js +1 -0
- package/dist/vega/p-84f2f342.js +1 -0
- package/dist/vega/p-85365f8b.js +1 -0
- package/dist/vega/p-8ab356e8.entry.js +1 -0
- package/dist/vega/p-8ba43640.entry.js +1 -0
- package/dist/vega/p-8be7b62c.entry.js +1 -0
- package/dist/vega/p-8d69f9ef.entry.js +1 -0
- package/dist/vega/p-91aa058f.entry.js +1 -0
- package/dist/vega/{p-8c26227e.js → p-926596cc.js} +1 -1
- package/dist/vega/p-92707b74.entry.js +1 -0
- package/dist/vega/p-96f0ef53.entry.js +1 -0
- package/dist/vega/p-97453cd8.entry.js +1 -0
- package/dist/vega/{p-843a0c1c.js → p-987fbbd0.js} +1 -1
- package/dist/vega/{p-296cc56b.js → p-9b797118.js} +1 -1
- package/dist/vega/p-a01f149d.entry.js +1 -0
- package/dist/vega/p-a0e90d5d.entry.js +1 -0
- package/dist/vega/{p-3953c705.js → p-af7a3154.js} +1 -1
- package/dist/vega/p-b2bca332.entry.js +1 -0
- package/dist/vega/p-b450bf46.entry.js +1 -0
- package/dist/vega/p-b5990090.js +1 -0
- package/dist/vega/p-b64981de.entry.js +1 -0
- package/dist/vega/p-b6815874.js +1 -0
- package/dist/vega/p-b688a71b.js +1 -0
- package/dist/vega/p-b9a09a76.js +1 -0
- package/dist/vega/p-bcb10ae3.entry.js +1 -0
- package/dist/vega/{p-39836361.js → p-be12fa36.js} +1 -1
- package/dist/vega/p-c02f650e.entry.js +1 -0
- package/dist/vega/p-c2b276f7.entry.js +1 -0
- package/dist/vega/p-c51a3e3c.entry.js +1 -0
- package/dist/vega/p-c88acd87.entry.js +1 -0
- package/dist/vega/p-cb8f8458.entry.js +1 -0
- package/dist/vega/p-cda26bdf.entry.js +1 -0
- package/dist/vega/p-d09d153f.entry.js +1 -0
- package/dist/vega/p-d994874a.entry.js +1 -0
- package/dist/vega/p-dbec03ed.entry.js +1 -0
- package/dist/vega/p-dcdac4d0.entry.js +1 -0
- package/dist/vega/p-de13b747.entry.js +1 -0
- package/dist/vega/p-de25326f.js +1 -0
- package/dist/vega/{p-e1e1fcf0.js → p-de664bdd.js} +1 -1
- package/dist/vega/p-e04d4ba3.entry.js +1 -0
- package/dist/vega/p-e8f540d8.js +1 -0
- package/dist/vega/p-e923637d.entry.js +1 -0
- package/dist/vega/p-efbea85a.entry.js +1 -0
- package/dist/vega/{p-81ead59a.js → p-f31bb1fd.js} +1 -1
- package/dist/vega/p-f690539e.entry.js +1 -0
- package/dist/vega/p-f6b89936.entry.js +1 -0
- package/dist/vega/p-f84fd31c.js +1 -0
- package/dist/vega/p-fe388812.entry.js +1 -0
- package/dist/vega/{p-acf7f903.js → p-ff4bafa3.js} +1 -1
- package/dist/vega/p-ff50c204.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +3 -2
- package/dist/cjs/text-node-0d12da5a.js +0 -1077
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.js +0 -135
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.js +0 -74
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.js +0 -47
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.js +0 -39
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.js +0 -50
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.js +0 -41
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.js +0 -57
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.js +0 -56
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.js +0 -77
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.js +0 -44
- package/dist/esm/text-node-6f7d736c.js +0 -1055
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.d.ts +0 -67
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.d.ts +0 -29
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.d.ts +0 -37
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.d.ts +0 -35
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.d.ts +0 -37
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.d.ts +0 -36
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.d.ts +0 -39
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.d.ts +0 -39
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.d.ts +0 -46
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.d.ts +0 -37
- package/dist/vega/p-034e6348.entry.js +0 -1
- package/dist/vega/p-0cd2b50f.entry.js +0 -1
- package/dist/vega/p-109a00cf.entry.js +0 -1
- package/dist/vega/p-11cb477b.js +0 -1
- package/dist/vega/p-1564cc4d.entry.js +0 -1
- package/dist/vega/p-18886765.entry.js +0 -1
- package/dist/vega/p-19b26168.entry.js +0 -1
- package/dist/vega/p-21992602.entry.js +0 -1
- package/dist/vega/p-22563151.entry.js +0 -1
- package/dist/vega/p-23795da1.entry.js +0 -1
- package/dist/vega/p-29277e41.entry.js +0 -1
- package/dist/vega/p-2a7e9422.entry.js +0 -1
- package/dist/vega/p-2ca6d977.entry.js +0 -1
- package/dist/vega/p-2e419309.entry.js +0 -1
- package/dist/vega/p-2fc3af2f.js +0 -1
- package/dist/vega/p-3039bef8.js +0 -1
- package/dist/vega/p-315667f1.js +0 -1
- package/dist/vega/p-34939c97.entry.js +0 -1
- package/dist/vega/p-3897bb2d.entry.js +0 -1
- package/dist/vega/p-390c5236.entry.js +0 -1
- package/dist/vega/p-3ce31dc3.js +0 -1
- package/dist/vega/p-452e284a.js +0 -1
- package/dist/vega/p-49f4a666.js +0 -1
- package/dist/vega/p-4c41dd64.js +0 -1
- package/dist/vega/p-55beac7f.entry.js +0 -1
- package/dist/vega/p-57405834.entry.js +0 -1
- package/dist/vega/p-589e6041.entry.js +0 -1
- package/dist/vega/p-5e95402a.entry.js +0 -1
- package/dist/vega/p-5eee21b4.entry.js +0 -1
- package/dist/vega/p-62cea2e7.entry.js +0 -1
- package/dist/vega/p-65b79fd7.js +0 -1
- package/dist/vega/p-6741e2b9.entry.js +0 -1
- package/dist/vega/p-6a084fe1.entry.js +0 -1
- package/dist/vega/p-6b286226.entry.js +0 -1
- package/dist/vega/p-6b722905.entry.js +0 -1
- package/dist/vega/p-6e4b2752.entry.js +0 -1
- package/dist/vega/p-7209d03b.js +0 -1
- package/dist/vega/p-728b029a.entry.js +0 -1
- package/dist/vega/p-76fc408e.entry.js +0 -1
- package/dist/vega/p-7a9f453e.entry.js +0 -1
- package/dist/vega/p-80ccd894.entry.js +0 -1
- package/dist/vega/p-84c597c8.entry.js +0 -1
- package/dist/vega/p-8b78c6a3.entry.js +0 -1
- package/dist/vega/p-8be45a45.entry.js +0 -1
- package/dist/vega/p-8d7b45f7.entry.js +0 -1
- package/dist/vega/p-8e17b9dd.entry.js +0 -1
- package/dist/vega/p-925a2137.js +0 -1
- package/dist/vega/p-92f88033.entry.js +0 -1
- package/dist/vega/p-94de7a02.entry.js +0 -1
- package/dist/vega/p-9968e71d.entry.js +0 -1
- package/dist/vega/p-9c1eeff2.js +0 -2
- package/dist/vega/p-9d1b9e70.entry.js +0 -1
- package/dist/vega/p-a5ffe912.js +0 -1
- package/dist/vega/p-a6104aa7.js +0 -1
- package/dist/vega/p-a6169ad6.entry.js +0 -1
- package/dist/vega/p-a8bf559a.js +0 -1
- package/dist/vega/p-afec17ad.entry.js +0 -1
- package/dist/vega/p-b693c1ac.entry.js +0 -1
- package/dist/vega/p-b6af0fc1.entry.js +0 -1
- package/dist/vega/p-b9e2add4.entry.js +0 -1
- package/dist/vega/p-bd894860.entry.js +0 -1
- package/dist/vega/p-c0d6a587.entry.js +0 -1
- package/dist/vega/p-c1d97d12.entry.js +0 -1
- package/dist/vega/p-c26e6820.entry.js +0 -1
- package/dist/vega/p-c34487e1.entry.js +0 -1
- package/dist/vega/p-c532b132.entry.js +0 -1
- package/dist/vega/p-ca2fb711.js +0 -1
- package/dist/vega/p-cebf93f1.entry.js +0 -1
- package/dist/vega/p-cfdc148a.entry.js +0 -1
- package/dist/vega/p-d0351d71.entry.js +0 -1
- package/dist/vega/p-d2ab6096.entry.js +0 -1
- package/dist/vega/p-d302f052.entry.js +0 -1
- package/dist/vega/p-d35643c5.entry.js +0 -1
- package/dist/vega/p-d400a1d9.entry.js +0 -1
- package/dist/vega/p-d6732a72.entry.js +0 -1
- package/dist/vega/p-d720b06a.entry.js +0 -1
- package/dist/vega/p-d987e404.entry.js +0 -1
- package/dist/vega/p-d9b86108.entry.js +0 -1
- package/dist/vega/p-e27e115d.entry.js +0 -1
- package/dist/vega/p-e43c2a27.js +0 -1
- package/dist/vega/p-e65c8ac7.entry.js +0 -1
- package/dist/vega/p-e79057cc.js +0 -1
- package/dist/vega/p-e89e9769.entry.js +0 -1
- package/dist/vega/p-ecd64c7f.entry.js +0 -1
- package/dist/vega/p-f5b2e72a.entry.js +0 -1
- package/dist/vega/p-f6af3749.js +0 -1
- package/dist/vega/p-fc622a75.js +0 -1
|
@@ -1,12 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as ChangeManager } from './change-manager-
|
|
4
|
-
import {
|
|
5
|
-
import { M as ModifyContentAction, b as ModifyContentActionType, s as stateEntityRenderingRegistry, N as NodeAnnotation, a as NodeAnnotationTypeEnum, R as RTENode, c as NodeTypeEnum, I as InternalAnnotationTypeEnum } from './node.abstract-93746055.js';
|
|
6
|
-
import { V as VegaInternalRichTextEditorFlushChanges } from './vega-internal-event-id-4af5c6e9.js';
|
|
1
|
+
import { W as WaitForVega, B as BlockAnnotation, a as BlockAnnotationTypeEnum, M as ModifyContentAction, b as ModifyContentActionType, s as stateEntityRenderingRegistry, N as NodeAnnotation, c as NodeAnnotationTypeEnum, R as RTENode, d as NodeTypeEnum, A as Annotation, I as InternalAnnotationTypeEnum, V as VegaThemeManager } from './node-annotation.abstract-d7d52bce.js';
|
|
2
|
+
import { O as Observer, d as domNodeSubjectFactory } from './dom-node-subject-factory-5831cdd4.js';
|
|
3
|
+
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
4
|
+
import { a as VegaInternalComponentDidRender, V as VegaInternalRichTextEditorFlushChanges, b as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-4af5c6e9.js';
|
|
7
5
|
import { i as isNonNullable } from './type-guard-158f6d7a.js';
|
|
8
|
-
import
|
|
9
|
-
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-
|
|
6
|
+
import './global-slimmer-registry-17c4efd4.js';
|
|
7
|
+
import { g as generateUUID } from './create-public-api-runtime-metrics-slimmer-9ab05523.js';
|
|
8
|
+
|
|
9
|
+
/* istanbul ignore next */
|
|
10
|
+
/**
|
|
11
|
+
* Wait for all vega elements to be ready.
|
|
12
|
+
*
|
|
13
|
+
* The below method is e2e-test covered in @see{module:wait-for-vega-should-work-as-expected}
|
|
14
|
+
*/
|
|
15
|
+
const waitForVega = async () => {
|
|
16
|
+
return WaitForVega.handle();
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Wait for the component has been rendered.
|
|
20
|
+
*
|
|
21
|
+
* @param {HTMLStencilElement} componentRef - The reference to the component that needs to be rendered.
|
|
22
|
+
* @returns {Promise<unknown>} A promise that resolves when the component has been rendered.
|
|
23
|
+
*/
|
|
24
|
+
const waitForComponentDidRender = async (componentRef) => {
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
const observer = new Observer(isAcceptableComponentDidRender.bind(null), () => {
|
|
27
|
+
ChangeManager.unregister(domNodeSubjectFactory.getSubject(componentRef, VegaInternalComponentDidRender), observer);
|
|
28
|
+
resolve(null);
|
|
29
|
+
});
|
|
30
|
+
ChangeManager.register(domNodeSubjectFactory.getSubject(componentRef, VegaInternalComponentDidRender), observer);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Determines whether the observer should accept changes.
|
|
35
|
+
*
|
|
36
|
+
* @returns {boolean} Always returns true in the current implementation.
|
|
37
|
+
*/
|
|
38
|
+
const isAcceptableComponentDidRender = () => {
|
|
39
|
+
return true;
|
|
40
|
+
};
|
|
10
41
|
|
|
11
42
|
/**
|
|
12
43
|
* Annotation to make block with horizontal alignment
|
|
@@ -26,50 +57,6 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
|
|
|
26
57
|
static from(textAlign) {
|
|
27
58
|
return [BlockAnnotationTypeEnum.ALIGNMENT, new HorizontalAlignmentAnnotation(textAlign)];
|
|
28
59
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Generate the map item for the annotation by html element
|
|
31
|
-
*
|
|
32
|
-
* @param {HTMLElement} node - An html element.
|
|
33
|
-
* @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
|
|
34
|
-
*/
|
|
35
|
-
static fromHTML(node) {
|
|
36
|
-
const alignment = this.getTextAlign(node);
|
|
37
|
-
return alignment ? this.from(alignment) : null;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get the text alignment of an HTML element.
|
|
41
|
-
*
|
|
42
|
-
* @param {HTMLElement} node - An HTMLElement.
|
|
43
|
-
* @returns {Nullable<VegaRTEBlockAlignment>} text alignment.
|
|
44
|
-
*/
|
|
45
|
-
static getTextAlign(node) {
|
|
46
|
-
const classList = node.classList;
|
|
47
|
-
if (classList.contains(`v-rte--horizontal-alignment-left`)) {
|
|
48
|
-
return 'left';
|
|
49
|
-
}
|
|
50
|
-
else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
|
|
51
|
-
return 'center';
|
|
52
|
-
}
|
|
53
|
-
else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
|
|
54
|
-
return 'right';
|
|
55
|
-
}
|
|
56
|
-
else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
|
|
57
|
-
return 'justify';
|
|
58
|
-
}
|
|
59
|
-
const style = node.style;
|
|
60
|
-
switch (style.textAlign) {
|
|
61
|
-
case 'center':
|
|
62
|
-
return 'center';
|
|
63
|
-
case 'right':
|
|
64
|
-
return 'right';
|
|
65
|
-
case 'justify':
|
|
66
|
-
return 'justify';
|
|
67
|
-
case 'left':
|
|
68
|
-
return 'left';
|
|
69
|
-
default:
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
60
|
/**
|
|
74
61
|
* Generate the JSON item of the annotation
|
|
75
62
|
*
|
|
@@ -116,48 +103,6 @@ class IndentAnnotation extends BlockAnnotation {
|
|
|
116
103
|
static from(indent) {
|
|
117
104
|
return [BlockAnnotationTypeEnum.INDENT, new IndentAnnotation(indent)];
|
|
118
105
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Generate the map item for the annotation by html element
|
|
121
|
-
*
|
|
122
|
-
* @param {HTMLElement} node - An html element.
|
|
123
|
-
* @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
|
|
124
|
-
*/
|
|
125
|
-
static fromHTML(node) {
|
|
126
|
-
const marginLeft = this.getMarginLeft(node);
|
|
127
|
-
return marginLeft && marginLeft >= 0 ? this.from(Math.floor(marginLeft / 16)) : null;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Retrieves the left margin value of an HTML element.
|
|
131
|
-
*
|
|
132
|
-
* @param {HTMLElement} node - An html element.
|
|
133
|
-
* @returns {number} margin left.
|
|
134
|
-
*/
|
|
135
|
-
static getMarginLeft(node) {
|
|
136
|
-
const style = node.style;
|
|
137
|
-
let marginLeft;
|
|
138
|
-
if (style.marginLeft) {
|
|
139
|
-
marginLeft = style.marginLeft;
|
|
140
|
-
}
|
|
141
|
-
else if (style.margin) {
|
|
142
|
-
const margins = style.margin.split(' ');
|
|
143
|
-
switch (margins.length) {
|
|
144
|
-
case 4:
|
|
145
|
-
marginLeft = margins[3];
|
|
146
|
-
break;
|
|
147
|
-
case 2:
|
|
148
|
-
case 3:
|
|
149
|
-
marginLeft = margins[1];
|
|
150
|
-
break;
|
|
151
|
-
default:
|
|
152
|
-
marginLeft = margins[0];
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
return Number(marginLeft.replace('px', ''));
|
|
160
|
-
}
|
|
161
106
|
/**
|
|
162
107
|
* Generate the JSON item of the annotation
|
|
163
108
|
*
|
|
@@ -247,108 +192,39 @@ class RemoveChildAction extends ModifyContentAction {
|
|
|
247
192
|
}
|
|
248
193
|
}
|
|
249
194
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
static getTextStyle(node) {
|
|
284
|
-
if (node.nodeType !== Node.TEXT_NODE && node.hasAttribute('data-type')) {
|
|
285
|
-
return node.getAttribute('data-type');
|
|
286
|
-
}
|
|
287
|
-
switch (node.style.fontSize) {
|
|
288
|
-
case '36px':
|
|
289
|
-
return 'title';
|
|
290
|
-
case '28px':
|
|
291
|
-
return 'subtitle';
|
|
292
|
-
case '22px':
|
|
293
|
-
return 'heading-1';
|
|
294
|
-
case '20px':
|
|
295
|
-
return 'heading-2';
|
|
296
|
-
case '18px':
|
|
297
|
-
return 'heading-3';
|
|
298
|
-
}
|
|
299
|
-
switch (node.nodeName) {
|
|
300
|
-
case 'H1':
|
|
301
|
-
return 'heading-1';
|
|
302
|
-
case 'H2':
|
|
303
|
-
return 'heading-2';
|
|
304
|
-
case 'H3':
|
|
305
|
-
return 'heading-3';
|
|
306
|
-
default:
|
|
307
|
-
return 'paragraph';
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Generate the JSON representation of the annotation
|
|
312
|
-
*
|
|
313
|
-
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
314
|
-
*/
|
|
315
|
-
toJSON() {
|
|
316
|
-
return { textStyle: this.textStyle };
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Render the styles by block type
|
|
320
|
-
*
|
|
321
|
-
* @returns {AnnotationStyle} the styles to apply
|
|
322
|
-
*/
|
|
323
|
-
render() {
|
|
324
|
-
const paragraphStyle = {
|
|
325
|
-
fontFamily: 'Inter',
|
|
326
|
-
fontSize: '16px',
|
|
327
|
-
lineHeight: '22px',
|
|
328
|
-
fontWeight: '500',
|
|
329
|
-
};
|
|
330
|
-
switch (this.textStyle) {
|
|
331
|
-
case 'paragraph': {
|
|
332
|
-
return paragraphStyle;
|
|
333
|
-
}
|
|
334
|
-
case 'title': {
|
|
335
|
-
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
336
|
-
}
|
|
337
|
-
case 'subtitle': {
|
|
338
|
-
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
339
|
-
}
|
|
340
|
-
case 'heading-1': {
|
|
341
|
-
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
342
|
-
}
|
|
343
|
-
case 'heading-2': {
|
|
344
|
-
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
345
|
-
}
|
|
346
|
-
case 'heading-3': {
|
|
347
|
-
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
195
|
+
const RTE_TEXT_COLORS = [
|
|
196
|
+
{
|
|
197
|
+
key: 'black',
|
|
198
|
+
light: '#111128',
|
|
199
|
+
dark: '#E3E3E8',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
key: 'gray',
|
|
203
|
+
light: '#5E5E6D',
|
|
204
|
+
dark: '#B9B9C1',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
key: 'green',
|
|
208
|
+
light: '#01801F',
|
|
209
|
+
dark: '#59D977',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
key: 'red',
|
|
213
|
+
light: '#BD2947',
|
|
214
|
+
dark: '#FFB2B5',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
key: 'purple',
|
|
218
|
+
light: '#563D82',
|
|
219
|
+
dark: '#BEB2FF',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
key: 'teal',
|
|
223
|
+
light: '#17758F',
|
|
224
|
+
dark: '#4CD8FF',
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
const ZERO_WIDTH_SPACE = '\u200b';
|
|
352
228
|
|
|
353
229
|
/**
|
|
354
230
|
* Abstract class for block
|
|
@@ -379,23 +255,6 @@ class RTEBlock extends BlockBaseOperator {
|
|
|
379
255
|
return IndentAnnotation.from(value);
|
|
380
256
|
}
|
|
381
257
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Create annotations for block element.
|
|
384
|
-
*
|
|
385
|
-
* @param {string} type - Annotations type.
|
|
386
|
-
* @param {HTMLElement} node - current node.
|
|
387
|
-
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} - result.
|
|
388
|
-
*/
|
|
389
|
-
static createAnnotationEntityFromHTML(type, node) {
|
|
390
|
-
switch (type) {
|
|
391
|
-
case 'ALIGNMENT':
|
|
392
|
-
return HorizontalAlignmentAnnotation.fromHTML(node);
|
|
393
|
-
case 'TEXT_STYLE':
|
|
394
|
-
return TextStyleAnnotation.fromHTML(node);
|
|
395
|
-
case 'INDENT':
|
|
396
|
-
return IndentAnnotation.fromHTML(node);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
258
|
/**
|
|
400
259
|
* Class to JSON object
|
|
401
260
|
*
|
|
@@ -458,29 +317,6 @@ class RTEBlock extends BlockBaseOperator {
|
|
|
458
317
|
this.annotationMap.set(annotation.type, annotation);
|
|
459
318
|
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
460
319
|
}
|
|
461
|
-
/**
|
|
462
|
-
* Get styles from annotations
|
|
463
|
-
*
|
|
464
|
-
* @returns {AnnotationStyle} - Annotation style
|
|
465
|
-
*/
|
|
466
|
-
getStyles() {
|
|
467
|
-
return Array.from(this.annotationMap.values())
|
|
468
|
-
.filter((annotation) => annotation instanceof BlockAnnotation)
|
|
469
|
-
.map((annotation) => annotation.render())
|
|
470
|
-
.filter(isNonNullable)
|
|
471
|
-
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Get classes from annotations
|
|
475
|
-
*
|
|
476
|
-
* @returns {AnnotationStyle} - Annotation style
|
|
477
|
-
*/
|
|
478
|
-
getClasses() {
|
|
479
|
-
return Array.from(this.annotationMap.values())
|
|
480
|
-
.map((annotation) => { var _a; return (_a = annotation.renderClass) === null || _a === void 0 ? void 0 : _a.call(annotation); })
|
|
481
|
-
.filter(isNonNullable)
|
|
482
|
-
.reduce((pre, cur) => [pre, cur].join(' '), '');
|
|
483
|
-
}
|
|
484
320
|
/**
|
|
485
321
|
* Appends a list of RTENode objects to the current node's child nodes and sets the parent block of each node to the current node.
|
|
486
322
|
*
|
|
@@ -711,16 +547,6 @@ class ImageAnnotation extends NodeAnnotation {
|
|
|
711
547
|
static from(size, alt) {
|
|
712
548
|
return [NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
|
|
713
549
|
}
|
|
714
|
-
/**
|
|
715
|
-
* Generate the map item for the annotation
|
|
716
|
-
*
|
|
717
|
-
* @param {VegaRichTextImageEditorSizeType} size - size.
|
|
718
|
-
* @param {string} alt - alt.
|
|
719
|
-
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
720
|
-
*/
|
|
721
|
-
static fromHTML(size, alt) {
|
|
722
|
-
return this.from(size || 'md', alt);
|
|
723
|
-
}
|
|
724
550
|
/**
|
|
725
551
|
* Generate the JSON representation of the annotation
|
|
726
552
|
*
|
|
@@ -757,25 +583,8 @@ class ImageAnnotation extends NodeAnnotation {
|
|
|
757
583
|
}
|
|
758
584
|
|
|
759
585
|
/**
|
|
760
|
-
*
|
|
586
|
+
* Image node
|
|
761
587
|
*/
|
|
762
|
-
class ImageAnnotationAction extends AnnotationAction {
|
|
763
|
-
constructor(size, alt) {
|
|
764
|
-
super();
|
|
765
|
-
this.isFlushable = true;
|
|
766
|
-
this.size = size;
|
|
767
|
-
this.alt = alt;
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Converts the action to an annotation
|
|
771
|
-
*
|
|
772
|
-
* @returns {ImageAnnotation} The annotation
|
|
773
|
-
*/
|
|
774
|
-
toAnnotation() {
|
|
775
|
-
return new ImageAnnotation(this.size, this.alt);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
|
|
779
588
|
class RTEImageNode extends RTENode {
|
|
780
589
|
constructor(id, url, parentBlock, annotationMap) {
|
|
781
590
|
super(id, annotationMap);
|
|
@@ -783,29 +592,30 @@ class RTEImageNode extends RTENode {
|
|
|
783
592
|
this.url = url;
|
|
784
593
|
this.parentBlock = parentBlock;
|
|
785
594
|
}
|
|
786
|
-
|
|
787
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
|
|
597
|
+
*
|
|
598
|
+
* @param {VegaRTEImageNode} node - The node to be converted.
|
|
599
|
+
* @param {RTEImageBlock} parentBlock - The parent block
|
|
600
|
+
* @returns {RTEImageBlock} An instance of `RTEImageBlock`
|
|
601
|
+
*/
|
|
602
|
+
static from(node, parentBlock) {
|
|
603
|
+
const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
|
|
788
604
|
let annotations;
|
|
789
|
-
if (!
|
|
605
|
+
if (!node.annotations || Object.keys(node.annotations).length === 0) {
|
|
790
606
|
annotations = { size: 'md' };
|
|
791
607
|
}
|
|
792
608
|
else {
|
|
793
|
-
annotations =
|
|
609
|
+
annotations = node.annotations;
|
|
794
610
|
}
|
|
795
611
|
imageNode.annotationMap = new Map(Object.keys(annotations)
|
|
796
612
|
.map(() => ImageAnnotation.from(annotations.size, annotations.alt))
|
|
797
613
|
.filter(isNonNullable));
|
|
798
614
|
return imageNode;
|
|
799
615
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
: node.querySelector('img').src;
|
|
804
|
-
const size = node.size;
|
|
805
|
-
const imageNode = new RTEImageNode(generateUUID(), src, parentBlock);
|
|
806
|
-
imageNode.annotationMap = new Map([ImageAnnotation.fromHTML(size, node.alt)]);
|
|
807
|
-
return imageNode;
|
|
808
|
-
}
|
|
616
|
+
/**
|
|
617
|
+
* @inheritDoc
|
|
618
|
+
*/
|
|
809
619
|
toJSON() {
|
|
810
620
|
const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
|
|
811
621
|
const annotations = {};
|
|
@@ -817,55 +627,20 @@ class RTEImageNode extends RTENode {
|
|
|
817
627
|
}
|
|
818
628
|
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
|
|
819
629
|
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
const alt = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt;
|
|
824
|
-
const handleChange = ({ detail, }) => {
|
|
825
|
-
switch (detail.action) {
|
|
826
|
-
case 'edit': {
|
|
827
|
-
const size = detail.payload.size;
|
|
828
|
-
const alt = detail.payload.alt;
|
|
829
|
-
this.apply(new ImageAnnotationAction(size, alt));
|
|
830
|
-
break;
|
|
831
|
-
}
|
|
832
|
-
/*
|
|
833
|
-
* The below method is e2e-test covered in
|
|
834
|
-
* @see{module:vega-rich-text-editor-image-click-delete-button}
|
|
835
|
-
*/
|
|
836
|
-
/* istanbul ignore next */
|
|
837
|
-
case 'delete': {
|
|
838
|
-
const event = new InputEvent('beforeinput', {
|
|
839
|
-
inputType: 'deleteContentBackward',
|
|
840
|
-
bubbles: true,
|
|
841
|
-
});
|
|
842
|
-
setTimeout(() => {
|
|
843
|
-
stateEntityRenderingRegistry.getDOMByEntity(this).dispatchEvent(event);
|
|
844
|
-
}, 50);
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
};
|
|
849
|
-
return editable ? (h("vega-rich-text-image-editor", { style: this.getStyles(), size: size, alt: alt, ref: (ref) => {
|
|
850
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, handleChange);
|
|
851
|
-
} }, this.renderImage(editable, alt))) : (this.renderImage(editable, alt));
|
|
852
|
-
}
|
|
630
|
+
/**
|
|
631
|
+
* @inheritDoc
|
|
632
|
+
*/
|
|
853
633
|
doAnnotationActionApply(action) {
|
|
854
634
|
const annotation = action.toAnnotation();
|
|
855
635
|
this.annotationMap.set(annotation.type, annotation);
|
|
856
636
|
}
|
|
857
637
|
// placeholder method
|
|
858
638
|
/* istanbul ignore next */
|
|
639
|
+
/**
|
|
640
|
+
* @inheritDoc
|
|
641
|
+
*/
|
|
859
642
|
doModifyActionApply(action) {
|
|
860
643
|
}
|
|
861
|
-
registerRef(ref) {
|
|
862
|
-
if (ref) {
|
|
863
|
-
stateEntityRenderingRegistry.register(ref, this);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
renderImage(editable, alt) {
|
|
867
|
-
return (h("img", { style: editable ? { width: '100%' } : this.getStyles(), alt: alt, src: this.url, ref: this.registerRef.bind(this) }));
|
|
868
|
-
}
|
|
869
644
|
}
|
|
870
645
|
|
|
871
646
|
/**
|
|
@@ -910,6 +685,892 @@ class SplitBlockWithNodeAction extends ModifyContentAction {
|
|
|
910
685
|
}
|
|
911
686
|
}
|
|
912
687
|
|
|
688
|
+
/**
|
|
689
|
+
* Abstract class for annotation actions
|
|
690
|
+
*/
|
|
691
|
+
class AnnotationAction {
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Abstract class for which can be splittable
|
|
696
|
+
*/
|
|
697
|
+
class TextSplittableAction extends AnnotationAction {
|
|
698
|
+
constructor() {
|
|
699
|
+
super(...arguments);
|
|
700
|
+
/**
|
|
701
|
+
* Whether the action should split the node
|
|
702
|
+
*/
|
|
703
|
+
this.doSplit = true;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Annotation to represent a selection range
|
|
709
|
+
*/
|
|
710
|
+
class SelectionRangeAnnotation extends Annotation {
|
|
711
|
+
constructor(range) {
|
|
712
|
+
super();
|
|
713
|
+
this.type = InternalAnnotationTypeEnum.SELECTION_RANGE;
|
|
714
|
+
this.range = range;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Annotation to make text with strikethrough
|
|
720
|
+
*/
|
|
721
|
+
class StrikethroughAnnotation extends NodeAnnotation {
|
|
722
|
+
constructor(underline) {
|
|
723
|
+
super();
|
|
724
|
+
this.type = NodeAnnotationTypeEnum.STRIKETHROUGH;
|
|
725
|
+
this.strikethrough = underline;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Generate the map item for the annotation
|
|
729
|
+
*
|
|
730
|
+
* @param {Nullable<boolean>} strikethrough - Strikethrough annotation
|
|
731
|
+
* @returns {[NodeAnnotationTypeEnum.STRIKETHROUGH, StrikethroughAnnotation]} Map item for the annotation
|
|
732
|
+
*/
|
|
733
|
+
static from(strikethrough) {
|
|
734
|
+
return [NodeAnnotationTypeEnum.STRIKETHROUGH, new StrikethroughAnnotation(strikethrough)];
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Generate the JSON representation of the annotation
|
|
738
|
+
*
|
|
739
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
740
|
+
*/
|
|
741
|
+
toJSON() {
|
|
742
|
+
return {
|
|
743
|
+
strikethrough: this.strikethrough,
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Generate the class for the annotation
|
|
748
|
+
*
|
|
749
|
+
* @returns {Nullable<string>} - Annotation class
|
|
750
|
+
*/
|
|
751
|
+
renderClass() {
|
|
752
|
+
return this.strikethrough ? 'v-rte--strikethrough' : null;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Generate the style for the annotation
|
|
756
|
+
*
|
|
757
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
758
|
+
*/
|
|
759
|
+
render() {
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Annotation to make text with underline
|
|
766
|
+
*/
|
|
767
|
+
class UnderlineAnnotation extends NodeAnnotation {
|
|
768
|
+
constructor(underline) {
|
|
769
|
+
super();
|
|
770
|
+
this.type = NodeAnnotationTypeEnum.UNDERLINE;
|
|
771
|
+
this.underline = underline;
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Generate the map item for the annotation
|
|
775
|
+
*
|
|
776
|
+
* @param {boolean} underline - Underline annotation
|
|
777
|
+
* @returns {[NodeAnnotationTypeEnum.UNDERLINE, UnderlineAnnotation]} Map item for the annotation
|
|
778
|
+
*/
|
|
779
|
+
static from(underline) {
|
|
780
|
+
return [NodeAnnotationTypeEnum.UNDERLINE, new UnderlineAnnotation(underline)];
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Generate the JSON representation of the annotation
|
|
784
|
+
*
|
|
785
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
786
|
+
*/
|
|
787
|
+
toJSON() {
|
|
788
|
+
return {
|
|
789
|
+
underline: this.underline,
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Generate the class for the annotation
|
|
794
|
+
*
|
|
795
|
+
* @returns {Nullable<string>} - Annotation class
|
|
796
|
+
*/
|
|
797
|
+
renderClass() {
|
|
798
|
+
return this.underline ? 'v-rte--underline' : null;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Generate the style for the annotation
|
|
802
|
+
*
|
|
803
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
804
|
+
*/
|
|
805
|
+
render() {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Annotation to make text Italic
|
|
812
|
+
*/
|
|
813
|
+
class ItalicAnnotation extends NodeAnnotation {
|
|
814
|
+
constructor(italic) {
|
|
815
|
+
super();
|
|
816
|
+
this.type = NodeAnnotationTypeEnum.ITALIC;
|
|
817
|
+
this.italic = italic;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Generate the map item for the annotation
|
|
821
|
+
*
|
|
822
|
+
* @param {boolean} italic - Italic annotation
|
|
823
|
+
* @returns {Nullable<[NodeAnnotationTypeEnum.ITALIC, ItalicAnnotation]>} Map item for the annotation
|
|
824
|
+
*/
|
|
825
|
+
static from(italic) {
|
|
826
|
+
return [NodeAnnotationTypeEnum.ITALIC, new ItalicAnnotation(italic)];
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Generate the JSON representation of the annotation
|
|
830
|
+
*
|
|
831
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
832
|
+
*/
|
|
833
|
+
toJSON() {
|
|
834
|
+
return {
|
|
835
|
+
italic: this.italic,
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Generate the style for the annotation
|
|
840
|
+
*
|
|
841
|
+
* @returns {Nullable<AnnotationStyle>} Italic style
|
|
842
|
+
*/
|
|
843
|
+
render() {
|
|
844
|
+
return this.italic ? { 'font-style': 'italic' } : null;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Annotation to make text bold
|
|
850
|
+
*/
|
|
851
|
+
class BoldAnnotation extends NodeAnnotation {
|
|
852
|
+
constructor(bold) {
|
|
853
|
+
super();
|
|
854
|
+
this.type = NodeAnnotationTypeEnum.BOLD;
|
|
855
|
+
this.bold = bold;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Generate the map item for the annotation
|
|
859
|
+
*
|
|
860
|
+
* @param {boolean} bold - Bold annotation
|
|
861
|
+
* @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
|
|
862
|
+
*/
|
|
863
|
+
static from(bold) {
|
|
864
|
+
return [NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Generate the JSON representation of the annotation
|
|
868
|
+
*
|
|
869
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
870
|
+
*/
|
|
871
|
+
toJSON() {
|
|
872
|
+
return {
|
|
873
|
+
bold: this.bold,
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Generate the style for the annotation
|
|
878
|
+
*
|
|
879
|
+
* @returns {Nullable<AnnotationStyle>} Bold style
|
|
880
|
+
*/
|
|
881
|
+
render() {
|
|
882
|
+
return this.bold ? { 'font-weight': '700' } : null;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Annotation to host which annotations will be clear formatting
|
|
888
|
+
*/
|
|
889
|
+
class ClearFormattingAnnotation extends Annotation {
|
|
890
|
+
constructor() {
|
|
891
|
+
super(...arguments);
|
|
892
|
+
this.type = InternalAnnotationTypeEnum.CLEAR_FORMATTING;
|
|
893
|
+
this.items = [
|
|
894
|
+
NodeAnnotationTypeEnum.BOLD,
|
|
895
|
+
NodeAnnotationTypeEnum.ITALIC,
|
|
896
|
+
NodeAnnotationTypeEnum.UNDERLINE,
|
|
897
|
+
NodeAnnotationTypeEnum.STRIKETHROUGH,
|
|
898
|
+
NodeAnnotationTypeEnum.TEXT_COLOR,
|
|
899
|
+
NodeAnnotationTypeEnum.CODE,
|
|
900
|
+
];
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Annotation to make text code
|
|
906
|
+
*/
|
|
907
|
+
class CodeAnnotation extends NodeAnnotation {
|
|
908
|
+
constructor(code) {
|
|
909
|
+
super();
|
|
910
|
+
this.type = NodeAnnotationTypeEnum.CODE;
|
|
911
|
+
this.code = code;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Generate the map item for the annotation
|
|
915
|
+
*
|
|
916
|
+
* @param {boolean} code - Bold annotation
|
|
917
|
+
* @returns {[NodeAnnotationTypeEnum.CODE, CodeAnnotation]} Map item for the annotation
|
|
918
|
+
*/
|
|
919
|
+
static from(code) {
|
|
920
|
+
return [NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code)];
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Generate the JSON representation of the annotation
|
|
924
|
+
*
|
|
925
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
926
|
+
*/
|
|
927
|
+
toJSON() {
|
|
928
|
+
return {
|
|
929
|
+
code: this.code,
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Generate the class for the annotation
|
|
934
|
+
*
|
|
935
|
+
* @returns {Nullable<string>} - Annotation class
|
|
936
|
+
*/
|
|
937
|
+
renderClass() {
|
|
938
|
+
return this.code ? 'v-rte--code' : null;
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Generate the style for the annotation
|
|
942
|
+
*
|
|
943
|
+
* @returns {Nullable<AnnotationStyle>} Bold style
|
|
944
|
+
*/
|
|
945
|
+
render() {
|
|
946
|
+
return null;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Annotation to make text with text color
|
|
952
|
+
*/
|
|
953
|
+
class TextColorAnnotation extends NodeAnnotation {
|
|
954
|
+
constructor(textColor) {
|
|
955
|
+
super();
|
|
956
|
+
this.type = NodeAnnotationTypeEnum.TEXT_COLOR;
|
|
957
|
+
this.textColor = this.formatTextColor(textColor);
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Generate the map item for the annotation
|
|
961
|
+
*
|
|
962
|
+
* @param {string} textColor - text color annotation
|
|
963
|
+
* @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
|
|
964
|
+
*/
|
|
965
|
+
static from(textColor) {
|
|
966
|
+
return [NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Generate the JSON representation of the annotation
|
|
970
|
+
*
|
|
971
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
972
|
+
*/
|
|
973
|
+
toJSON() {
|
|
974
|
+
return {
|
|
975
|
+
textColor: this.textColor.key,
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Generate the class for the annotation
|
|
980
|
+
*
|
|
981
|
+
* @returns {Nullable<string>} - Annotation class
|
|
982
|
+
*/
|
|
983
|
+
renderClass() {
|
|
984
|
+
return null;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Generate the style for the annotation
|
|
988
|
+
*
|
|
989
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
990
|
+
*/
|
|
991
|
+
render() {
|
|
992
|
+
return {
|
|
993
|
+
color: VegaThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* format text color
|
|
998
|
+
*
|
|
999
|
+
* @param {string} textColor - text color
|
|
1000
|
+
* @returns {VegaRTEColorSchema} - VegaRTEColorSchema
|
|
1001
|
+
*/
|
|
1002
|
+
formatTextColor(textColor) {
|
|
1003
|
+
return (RTE_TEXT_COLORS.find((item) => item.key === textColor) || RTE_TEXT_COLORS[0]);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Annotation to make text a link
|
|
1009
|
+
*/
|
|
1010
|
+
class LinkAnnotation extends NodeAnnotation {
|
|
1011
|
+
constructor(link) {
|
|
1012
|
+
super();
|
|
1013
|
+
this.type = NodeAnnotationTypeEnum.LINK;
|
|
1014
|
+
this.link = link;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Generate the map item for the annotation
|
|
1018
|
+
*
|
|
1019
|
+
* @param {VegaRTELink} link - Bold annotation
|
|
1020
|
+
* @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
|
|
1021
|
+
*/
|
|
1022
|
+
static from(link) {
|
|
1023
|
+
return [
|
|
1024
|
+
NodeAnnotationTypeEnum.LINK,
|
|
1025
|
+
new LinkAnnotation({ href: link.href, groupKey: link.groupKey }),
|
|
1026
|
+
];
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Generate the JSON representation of the annotation
|
|
1030
|
+
*
|
|
1031
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
1032
|
+
*/
|
|
1033
|
+
toJSON() {
|
|
1034
|
+
return { link: { href: this.link.href, groupKey: this.link.groupKey } };
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Verify whether two link annotation is same or not
|
|
1038
|
+
*
|
|
1039
|
+
* @param {LinkAnnotation} annotation - Compared annotation
|
|
1040
|
+
* @returns {boolean} Whether two link annotation is same or not
|
|
1041
|
+
*/
|
|
1042
|
+
toEqual(annotation) {
|
|
1043
|
+
return this.link.groupKey === annotation.link.groupKey;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Generate the style for the annotation
|
|
1047
|
+
*
|
|
1048
|
+
* @returns {Nullable<AnnotationStyle>} Link style
|
|
1049
|
+
*/
|
|
1050
|
+
render() {
|
|
1051
|
+
return null;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Action to toggle link annotation
|
|
1057
|
+
*/
|
|
1058
|
+
class LinkAnnotationAction extends TextSplittableAction {
|
|
1059
|
+
constructor({ link, newText, needMergeNode, doSplit, }) {
|
|
1060
|
+
super();
|
|
1061
|
+
this.isFlushable = true;
|
|
1062
|
+
this.link = link;
|
|
1063
|
+
this.needMergeNode = needMergeNode;
|
|
1064
|
+
this.newText = newText;
|
|
1065
|
+
if (isNonNullable(doSplit)) {
|
|
1066
|
+
this.doSplit = doSplit;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Converts the action to an annotation
|
|
1071
|
+
*
|
|
1072
|
+
* @returns {LinkAnnotation} the annotation
|
|
1073
|
+
*/
|
|
1074
|
+
toAnnotation() {
|
|
1075
|
+
return new LinkAnnotation(this.link);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Action to toggle code annotation
|
|
1081
|
+
*/
|
|
1082
|
+
class CodeAnnotationAction extends TextSplittableAction {
|
|
1083
|
+
constructor(code) {
|
|
1084
|
+
super();
|
|
1085
|
+
this.isFlushable = true;
|
|
1086
|
+
this.code = code;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Converts the action to an annotation
|
|
1090
|
+
*
|
|
1091
|
+
* @returns {CodeAnnotation} the annotation
|
|
1092
|
+
*/
|
|
1093
|
+
toAnnotation() {
|
|
1094
|
+
return new CodeAnnotation(this.code);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Action to toggle clear formatting
|
|
1100
|
+
*/
|
|
1101
|
+
class ClearFormattingAnnotationAction extends TextSplittableAction {
|
|
1102
|
+
constructor() {
|
|
1103
|
+
super(...arguments);
|
|
1104
|
+
this.isFlushable = true;
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Converts the action to an annotation
|
|
1108
|
+
*
|
|
1109
|
+
* @returns {ClearFormattingAnnotation} the annotation
|
|
1110
|
+
*/
|
|
1111
|
+
toAnnotation() {
|
|
1112
|
+
return new ClearFormattingAnnotation();
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Update the text node property text action
|
|
1118
|
+
*
|
|
1119
|
+
* @example textNode.apply(new UpdateTextAction(newText))
|
|
1120
|
+
*/
|
|
1121
|
+
class UpdateTextAction extends ModifyContentAction {
|
|
1122
|
+
constructor(text) {
|
|
1123
|
+
super();
|
|
1124
|
+
this.type = ModifyContentActionType.UPDATE_TEXT;
|
|
1125
|
+
this.newTextContent = '';
|
|
1126
|
+
this.newTextContent = text;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Annotation to represent a link of grouped nodes
|
|
1132
|
+
*/
|
|
1133
|
+
class LinkGroupAnnotation extends Annotation {
|
|
1134
|
+
constructor(groupKey) {
|
|
1135
|
+
super();
|
|
1136
|
+
this.type = InternalAnnotationTypeEnum.LINK_GROUP;
|
|
1137
|
+
this.linkGroups = new Map();
|
|
1138
|
+
this.linkGroups = new Map([[groupKey, []]]);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Action to link a group of nodes
|
|
1144
|
+
*/
|
|
1145
|
+
class LinkGroupAnnotationAction extends AnnotationAction {
|
|
1146
|
+
constructor(groupKey, nodes) {
|
|
1147
|
+
super();
|
|
1148
|
+
this.isFlushable = false;
|
|
1149
|
+
this.groupKey = groupKey;
|
|
1150
|
+
this.nodes = nodes;
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Converts the action to an annotation
|
|
1154
|
+
*
|
|
1155
|
+
* @returns {LinkGroupAnnotation} The annotation
|
|
1156
|
+
*/
|
|
1157
|
+
toAnnotation() {
|
|
1158
|
+
return new LinkGroupAnnotation(this.groupKey);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Sync up selection action
|
|
1164
|
+
*/
|
|
1165
|
+
class SyncUpSelectionAction extends AnnotationAction {
|
|
1166
|
+
constructor() {
|
|
1167
|
+
super();
|
|
1168
|
+
this.isFlushable = false;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* annotation null
|
|
1172
|
+
*
|
|
1173
|
+
* @returns {Nullable<Annotation>} null
|
|
1174
|
+
*/
|
|
1175
|
+
toAnnotation() {
|
|
1176
|
+
return null;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* Delete the node annotation by type
|
|
1182
|
+
*/
|
|
1183
|
+
class DeleteNodeAnnotationAction extends AnnotationAction {
|
|
1184
|
+
constructor(annotationType) {
|
|
1185
|
+
super();
|
|
1186
|
+
this.isFlushable = true;
|
|
1187
|
+
this.annotationType = annotationType;
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Don't need this for this action
|
|
1191
|
+
*
|
|
1192
|
+
* @returns {Nullable<Annotation>} undefined
|
|
1193
|
+
*/
|
|
1194
|
+
toAnnotation() {
|
|
1195
|
+
return undefined;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Text node
|
|
1201
|
+
*/
|
|
1202
|
+
class RTETextNode extends RTENode {
|
|
1203
|
+
constructor(id, text, parentBlock, annotationMap) {
|
|
1204
|
+
super(id, annotationMap);
|
|
1205
|
+
this.type = NodeTypeEnum.TEXT;
|
|
1206
|
+
this.parentBlock = parentBlock;
|
|
1207
|
+
this.text = text;
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Creates an RTETextNode from a VegaRTETextNode with annotations and a parent RTETextBlock.
|
|
1211
|
+
*
|
|
1212
|
+
* @param {VegaRTETextNode} richText - A rich text node
|
|
1213
|
+
* @param {RTETextBlock} parentBlock - Parent block
|
|
1214
|
+
* @returns {RTETextNode} an RTETextNode
|
|
1215
|
+
*/
|
|
1216
|
+
static from(richText, parentBlock) {
|
|
1217
|
+
const textNode = new RTETextNode(richText.id, richText.text, parentBlock);
|
|
1218
|
+
const { annotations } = richText;
|
|
1219
|
+
if (annotations) {
|
|
1220
|
+
textNode.annotationMap = new Map(Object.keys(annotations)
|
|
1221
|
+
.map((type) => {
|
|
1222
|
+
if (annotations.link) {
|
|
1223
|
+
parentBlock.apply(new LinkGroupAnnotationAction(annotations.link.groupKey, [textNode]));
|
|
1224
|
+
}
|
|
1225
|
+
return this.createAnnotationEntity(type, annotations[type]);
|
|
1226
|
+
})
|
|
1227
|
+
.filter(isNonNullable));
|
|
1228
|
+
}
|
|
1229
|
+
return textNode;
|
|
1230
|
+
}
|
|
1231
|
+
/**
|
|
1232
|
+
* Creates different types of text annotations based on the provided type and value.
|
|
1233
|
+
*
|
|
1234
|
+
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
1235
|
+
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
1236
|
+
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
1237
|
+
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
1238
|
+
*/
|
|
1239
|
+
static createAnnotationEntity(type, value) {
|
|
1240
|
+
switch (type) {
|
|
1241
|
+
case 'bold':
|
|
1242
|
+
return BoldAnnotation.from(value);
|
|
1243
|
+
case 'italic':
|
|
1244
|
+
return ItalicAnnotation.from(value);
|
|
1245
|
+
case 'underline':
|
|
1246
|
+
return UnderlineAnnotation.from(value);
|
|
1247
|
+
case 'strikethrough':
|
|
1248
|
+
return StrikethroughAnnotation.from(value);
|
|
1249
|
+
case 'code':
|
|
1250
|
+
return CodeAnnotation.from(value);
|
|
1251
|
+
case 'textColor':
|
|
1252
|
+
return TextColorAnnotation.from(value);
|
|
1253
|
+
case 'link':
|
|
1254
|
+
return LinkAnnotation.from(value);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* @inheritDoc
|
|
1259
|
+
*/
|
|
1260
|
+
toJSON() {
|
|
1261
|
+
const annotations = Array.from(this.annotationMap.values())
|
|
1262
|
+
.filter((annotation) => annotation instanceof NodeAnnotation)
|
|
1263
|
+
.reduce((record, annotation) => {
|
|
1264
|
+
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
1265
|
+
}, {});
|
|
1266
|
+
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'text', text: this.text });
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Creates a new RTETextNode with the specified text and copies the parent block and annotation map from the original node.
|
|
1270
|
+
*
|
|
1271
|
+
* @param {string} text - The text content of the RTETextNode that will be created.
|
|
1272
|
+
* @returns {RTETextNode} An new RTETextNode
|
|
1273
|
+
*/
|
|
1274
|
+
cloneWithText(text) {
|
|
1275
|
+
return new RTETextNode(generateUUID(), text, this.parentBlock, new Map(this.annotationMap));
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Checks if a node is empty
|
|
1279
|
+
*
|
|
1280
|
+
* @returns {boolean} It returns `true` if the node is empty
|
|
1281
|
+
*/
|
|
1282
|
+
isEmpty() {
|
|
1283
|
+
return !this.text || this.text === ZERO_WIDTH_SPACE || this.text === '\n';
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* @inheritDoc
|
|
1287
|
+
*/
|
|
1288
|
+
doAnnotationActionApply(action) {
|
|
1289
|
+
const selectionRangeAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
1290
|
+
if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
|
|
1291
|
+
const { startContainer, endContainer, startOffset, endOffset } = selectionRangeAnnotation.range;
|
|
1292
|
+
const noTextRangeSelected = startContainer === endContainer && startOffset === endOffset;
|
|
1293
|
+
this.parentBlock.nodes = this.parentBlock.nodes.flatMap((item) => {
|
|
1294
|
+
if (item.id === this.id) {
|
|
1295
|
+
if (noTextRangeSelected) {
|
|
1296
|
+
return this.insertNewNode(startOffset, action);
|
|
1297
|
+
}
|
|
1298
|
+
if (this.shouldSplitSelection(selectionRangeAnnotation.range)) {
|
|
1299
|
+
return this.splitTextNode(action, selectionRangeAnnotation.range);
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
this.applyActionToNode(this, action);
|
|
1303
|
+
return this;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
return item;
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
this.applyActionToNode(this, action);
|
|
1311
|
+
}
|
|
1312
|
+
this.parentBlock.mergeNodes(action);
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* @inheritDoc
|
|
1316
|
+
*/
|
|
1317
|
+
doModifyActionApply(action) {
|
|
1318
|
+
switch (action.type) {
|
|
1319
|
+
case ModifyContentActionType.UPDATE_TEXT:
|
|
1320
|
+
this.updateText(action.newTextContent);
|
|
1321
|
+
break;
|
|
1322
|
+
case ModifyContentActionType.REPLACE_SELECTED_TEXT:
|
|
1323
|
+
this.replaceSelectedText(action.textToBeInsert, action.currentRange);
|
|
1324
|
+
break;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Split text node with range
|
|
1329
|
+
*
|
|
1330
|
+
* @param {TextSplittableAction} action - Annotation action
|
|
1331
|
+
* @param {Range} range - Selection range
|
|
1332
|
+
* @returns {RTETextNode[] | this} RTETextNode array
|
|
1333
|
+
*/
|
|
1334
|
+
splitTextNode(action, range) {
|
|
1335
|
+
const { startContainer, endContainer, startOffset } = range;
|
|
1336
|
+
const startNode = startContainer.parentElement;
|
|
1337
|
+
const endNode = endContainer.parentElement;
|
|
1338
|
+
/**
|
|
1339
|
+
* Split the text from the start offset to the end offset
|
|
1340
|
+
*
|
|
1341
|
+
* @param {string} text - The text string
|
|
1342
|
+
* @param {number} startOffset - The start offset position
|
|
1343
|
+
* @param {number} endOffset - The end offset position
|
|
1344
|
+
* @returns {RTETextNode[]} - The split text node array
|
|
1345
|
+
*/
|
|
1346
|
+
const splitText = (text, startOffset, endOffset) => {
|
|
1347
|
+
const beforeText = text.substring(0, startOffset);
|
|
1348
|
+
const selectedText = text.substring(startOffset, endOffset);
|
|
1349
|
+
const afterText = text.substring(endOffset);
|
|
1350
|
+
return [
|
|
1351
|
+
this.cloneWithText(beforeText),
|
|
1352
|
+
this.cloneWithText(selectedText),
|
|
1353
|
+
this.cloneWithText(afterText),
|
|
1354
|
+
];
|
|
1355
|
+
};
|
|
1356
|
+
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
1357
|
+
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
1358
|
+
if (startItemDto && startItemDto.id === this.id) {
|
|
1359
|
+
const endOffset = startContainer === endContainer ? range.endOffset : this.text.length;
|
|
1360
|
+
const [beforeNode, selectedNode, afterNode] = splitText(this.text, startOffset, endOffset);
|
|
1361
|
+
this.applyActionToNode(selectedNode, action);
|
|
1362
|
+
return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
|
|
1363
|
+
}
|
|
1364
|
+
else if (endItemDto && endItemDto.id === this.id) {
|
|
1365
|
+
const [beforeNode, selectedNode, afterNode] = splitText(this.text, 0, range.endOffset);
|
|
1366
|
+
this.applyActionToNode(selectedNode, action);
|
|
1367
|
+
return [beforeNode, selectedNode, afterNode].filter((node) => !!node.text);
|
|
1368
|
+
}
|
|
1369
|
+
else {
|
|
1370
|
+
this.applyActionToNode(this, action);
|
|
1371
|
+
return this;
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* Apply action to node
|
|
1376
|
+
*
|
|
1377
|
+
* @param {RTETextNode} node - Text node
|
|
1378
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
1379
|
+
*/
|
|
1380
|
+
applyActionToNode(node, action) {
|
|
1381
|
+
const annotation = action.toAnnotation();
|
|
1382
|
+
if (action instanceof SyncUpSelectionAction) {
|
|
1383
|
+
this.syncUpSelectedNodes(node);
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
// Sync up RTETextNode selected state to selection controller for any action apply, except selection range change.
|
|
1387
|
+
if (!(annotation instanceof SelectionRangeAnnotation)) {
|
|
1388
|
+
this.syncUpSelectedNodes(node);
|
|
1389
|
+
}
|
|
1390
|
+
if (action instanceof DeleteNodeAnnotationAction) {
|
|
1391
|
+
this.annotationMap.delete(action.annotationType);
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
if (annotation instanceof ClearFormattingAnnotation) {
|
|
1395
|
+
annotation.items.forEach((item) => {
|
|
1396
|
+
node.deleteAnnotationByType(item);
|
|
1397
|
+
});
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
if (annotation instanceof NodeAnnotation || annotation instanceof SelectionRangeAnnotation) {
|
|
1401
|
+
if (action instanceof LinkAnnotationAction) {
|
|
1402
|
+
if (isNonNullable(action.newText)) {
|
|
1403
|
+
node.text = action.newText;
|
|
1404
|
+
}
|
|
1405
|
+
this.parentBlock.apply(new LinkGroupAnnotationAction(action.link.groupKey, [node]));
|
|
1406
|
+
}
|
|
1407
|
+
if (action instanceof CodeAnnotationAction) {
|
|
1408
|
+
this.applyActionToNode(node, new ClearFormattingAnnotationAction());
|
|
1409
|
+
}
|
|
1410
|
+
node.annotationMap.set(annotation.type, annotation);
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* Replaces the selected text within a given range with a new text in a TypeScript class.
|
|
1416
|
+
*
|
|
1417
|
+
* @param {string} text - The new text that will replace the currently selected text within the specified range.
|
|
1418
|
+
* @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
|
|
1419
|
+
*/
|
|
1420
|
+
replaceSelectedText(text, currentRange) {
|
|
1421
|
+
if (currentRange && currentRange.startContainer && currentRange.endContainer) {
|
|
1422
|
+
const { startContainer, endContainer, startOffset, endOffset } = currentRange;
|
|
1423
|
+
const startNode = startContainer.parentElement;
|
|
1424
|
+
const endNode = endContainer.parentElement;
|
|
1425
|
+
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
1426
|
+
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
1427
|
+
let startIndex = 0, endIndex = this.text.length;
|
|
1428
|
+
if (startItemDto && startItemDto === this) {
|
|
1429
|
+
startIndex = startOffset;
|
|
1430
|
+
endIndex = startContainer === endContainer ? endOffset : endIndex;
|
|
1431
|
+
}
|
|
1432
|
+
else if (endItemDto && endItemDto === this) {
|
|
1433
|
+
endIndex = endOffset;
|
|
1434
|
+
}
|
|
1435
|
+
this.apply(new UpdateTextAction(this.text.slice(0, startIndex) + text + this.text.slice(endIndex)));
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
|
|
1440
|
+
*
|
|
1441
|
+
* @param {string} newText - The new text string
|
|
1442
|
+
*/
|
|
1443
|
+
updateText(newText) {
|
|
1444
|
+
this.text = newText;
|
|
1445
|
+
// The link node should unlink when delete all text
|
|
1446
|
+
if (!this.text && this.isLinkNode()) {
|
|
1447
|
+
this.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Checks if a node has an annotation with the key 'LINK'.
|
|
1452
|
+
*
|
|
1453
|
+
* @returns {boolean} A boolean value indicating whether the `annotationMap` has a key 'LINK'.
|
|
1454
|
+
*/
|
|
1455
|
+
isLinkNode() {
|
|
1456
|
+
return this.annotationMap.has('LINK');
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Whether a given range should be split based on various conditions within the range.
|
|
1460
|
+
*
|
|
1461
|
+
* @param {Range} range - Selection range
|
|
1462
|
+
* @returns {boolean} Returns a boolean value indicating whether the
|
|
1463
|
+
* selection range should be split.
|
|
1464
|
+
*/
|
|
1465
|
+
shouldSplitSelection(range) {
|
|
1466
|
+
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
1467
|
+
const isCrossNode = startContainer !== endContainer;
|
|
1468
|
+
const isPartialStart = startOffset > 0;
|
|
1469
|
+
const isPartialEnd = endOffset < (endContainer.textContent ? endContainer.textContent.length : 0);
|
|
1470
|
+
const isPartialSelection = isPartialStart || isPartialEnd;
|
|
1471
|
+
return isCrossNode || isPartialSelection;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Sync up the selected node by change manager
|
|
1475
|
+
*
|
|
1476
|
+
* @param {RTETextNode} selectedNode - The selected node
|
|
1477
|
+
*/
|
|
1478
|
+
syncUpSelectedNodes(selectedNode) {
|
|
1479
|
+
const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1480
|
+
if (currentNodeDom) {
|
|
1481
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, VegaInternalRichTextEditorSelectionRangeChange);
|
|
1482
|
+
if (nodeSubject) {
|
|
1483
|
+
ChangeManager.notify(nodeSubject, { node: selectedNode });
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Insert the new node at the start offset
|
|
1489
|
+
*
|
|
1490
|
+
* @param {number} startOffset - The start position offset
|
|
1491
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
1492
|
+
* @returns {RTETextNode[]} - RTETextNode array
|
|
1493
|
+
*/
|
|
1494
|
+
insertNewNode(startOffset, action) {
|
|
1495
|
+
if (startOffset === 0) {
|
|
1496
|
+
const newNode = this.cloneWithText('');
|
|
1497
|
+
this.applyActionToNode(newNode, action);
|
|
1498
|
+
return [newNode, this];
|
|
1499
|
+
}
|
|
1500
|
+
if (startOffset === this.text.length) {
|
|
1501
|
+
const newNode = this.cloneWithText('');
|
|
1502
|
+
this.applyActionToNode(newNode, action);
|
|
1503
|
+
return [this, newNode];
|
|
1504
|
+
}
|
|
1505
|
+
const beforeNode = this.cloneWithText(this.text.substring(0, startOffset));
|
|
1506
|
+
const newNode = this.cloneWithText('');
|
|
1507
|
+
const afterNode = this.cloneWithText(this.text.substring(startOffset));
|
|
1508
|
+
this.applyActionToNode(newNode, action);
|
|
1509
|
+
return [beforeNode, newNode, afterNode];
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Text style annotation
|
|
1515
|
+
*/
|
|
1516
|
+
class TextStyleAnnotation extends BlockAnnotation {
|
|
1517
|
+
constructor(textStyle) {
|
|
1518
|
+
super();
|
|
1519
|
+
this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
1520
|
+
this.textStyle = textStyle;
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Generate the map item for the annotations
|
|
1524
|
+
*
|
|
1525
|
+
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
1526
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
1527
|
+
*/
|
|
1528
|
+
static from(textStyle) {
|
|
1529
|
+
return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Generate the JSON representation of the annotation
|
|
1533
|
+
*
|
|
1534
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
1535
|
+
*/
|
|
1536
|
+
toJSON() {
|
|
1537
|
+
return { textStyle: this.textStyle };
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Render the styles by block type
|
|
1541
|
+
*
|
|
1542
|
+
* @returns {AnnotationStyle} the styles to apply
|
|
1543
|
+
*/
|
|
1544
|
+
render() {
|
|
1545
|
+
const paragraphStyle = {
|
|
1546
|
+
fontFamily: 'Inter',
|
|
1547
|
+
fontSize: '16px',
|
|
1548
|
+
lineHeight: '22px',
|
|
1549
|
+
fontWeight: '500',
|
|
1550
|
+
};
|
|
1551
|
+
switch (this.textStyle) {
|
|
1552
|
+
case 'paragraph': {
|
|
1553
|
+
return paragraphStyle;
|
|
1554
|
+
}
|
|
1555
|
+
case 'title': {
|
|
1556
|
+
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
1557
|
+
}
|
|
1558
|
+
case 'subtitle': {
|
|
1559
|
+
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
1560
|
+
}
|
|
1561
|
+
case 'heading-1': {
|
|
1562
|
+
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
1563
|
+
}
|
|
1564
|
+
case 'heading-2': {
|
|
1565
|
+
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
1566
|
+
}
|
|
1567
|
+
case 'heading-3': {
|
|
1568
|
+
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
913
1574
|
/**
|
|
914
1575
|
* Action to change the text style of a block
|
|
915
1576
|
*/
|
|
@@ -985,12 +1646,18 @@ class RTETextBlock extends RTEBlock {
|
|
|
985
1646
|
this.nodes = [];
|
|
986
1647
|
this.type = type;
|
|
987
1648
|
if (RTETextBlock.isAcceptableTextStyle(type)) {
|
|
988
|
-
|
|
1649
|
+
this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
|
|
989
1650
|
}
|
|
990
1651
|
else {
|
|
991
|
-
|
|
1652
|
+
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
992
1653
|
}
|
|
993
1654
|
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Converts a VegaRTETextBlock into an RTETextBlock.
|
|
1657
|
+
*
|
|
1658
|
+
* @param {VegaRTETextBlock} block - The block object
|
|
1659
|
+
* @returns {RTETextBlock} A RTETextBlock class
|
|
1660
|
+
*/
|
|
994
1661
|
static from(block) {
|
|
995
1662
|
const textBlock = new RTETextBlock(block.id, block.type);
|
|
996
1663
|
const { annotations } = block;
|
|
@@ -1005,17 +1672,6 @@ class RTETextBlock extends RTEBlock {
|
|
|
1005
1672
|
}
|
|
1006
1673
|
return textBlock;
|
|
1007
1674
|
}
|
|
1008
|
-
static fromHTML(node, blockType) {
|
|
1009
|
-
const textBlock = new RTETextBlock(generateUUID(), blockType);
|
|
1010
|
-
textBlock.nodes = Array.from(node.childNodes).map((item) => RTETextNode.fromHTML(item, textBlock));
|
|
1011
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1012
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1013
|
-
if (isNonNullable(item)) {
|
|
1014
|
-
textBlock.annotationMap.set(...item);
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
return textBlock;
|
|
1018
|
-
}
|
|
1019
1675
|
/**
|
|
1020
1676
|
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
1021
1677
|
* and value.
|
|
@@ -1036,9 +1692,20 @@ class RTETextBlock extends RTEBlock {
|
|
|
1036
1692
|
return super.createAnnotationEntity(type, value);
|
|
1037
1693
|
}
|
|
1038
1694
|
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Checks if a given text block type is one of the acceptable text styles.
|
|
1697
|
+
*
|
|
1698
|
+
* @param {VegaRTETextBlockType} type - The text block type
|
|
1699
|
+
* @returns {boolean} Return a boolean value indicating whether the `type` parameter is valid.
|
|
1700
|
+
*/
|
|
1039
1701
|
static isAcceptableTextStyle(type) {
|
|
1040
1702
|
return ['title', 'subtitle', 'paragraph', 'heading-1', 'heading-2', 'heading-3'].includes(type);
|
|
1041
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Merges RTETextNode nodes based on certain conditions.
|
|
1706
|
+
*
|
|
1707
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
1708
|
+
*/
|
|
1042
1709
|
mergeNodes(action) {
|
|
1043
1710
|
this.nodes = this.nodes.reduce((prev, cur) => {
|
|
1044
1711
|
const lastNode = prev.at(-1);
|
|
@@ -1055,38 +1722,39 @@ class RTETextBlock extends RTEBlock {
|
|
|
1055
1722
|
return [...prev, cur];
|
|
1056
1723
|
}, []);
|
|
1057
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* @inheritDoc
|
|
1727
|
+
*/
|
|
1058
1728
|
toJSON() {
|
|
1059
1729
|
return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1060
1730
|
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Clone the nodes to a new block
|
|
1733
|
+
*
|
|
1734
|
+
* @param {RTEBlock} nodes - The nodes will be copied
|
|
1735
|
+
* @returns {RTEBlock} New block
|
|
1736
|
+
*/
|
|
1061
1737
|
cloneWithNodes(nodes) {
|
|
1062
1738
|
const block = new RTETextBlock(generateUUID(), this.type);
|
|
1063
1739
|
block.nodes = [];
|
|
1064
1740
|
block.apply(new AppendChildNodesAction(nodes));
|
|
1065
1741
|
return block;
|
|
1066
1742
|
}
|
|
1743
|
+
/**
|
|
1744
|
+
* @inheritDoc
|
|
1745
|
+
*/
|
|
1067
1746
|
isNotEmpty() {
|
|
1068
1747
|
return this.nodes.length > 0 && this.nodes.some((node) => !node.isEmpty());
|
|
1069
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* @inheritDoc
|
|
1751
|
+
*/
|
|
1070
1752
|
getLastNode() {
|
|
1071
1753
|
return this.nodes[this.nodes.length - 1];
|
|
1072
1754
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
this.renderNodes(renderContext),
|
|
1077
|
-
children));
|
|
1078
|
-
}
|
|
1079
|
-
registerRef(ref) {
|
|
1080
|
-
if (ref) {
|
|
1081
|
-
stateEntityRenderingRegistry.register(ref, this);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
renderNodes(renderConfig = {}) {
|
|
1085
|
-
const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
1086
|
-
return linkGroupAnnotation
|
|
1087
|
-
? linkGroupAnnotation.renderNodes(this.nodes, renderConfig)
|
|
1088
|
-
: this.nodes.map((node) => node.render());
|
|
1089
|
-
}
|
|
1755
|
+
/**
|
|
1756
|
+
* @inheritDoc
|
|
1757
|
+
*/
|
|
1090
1758
|
doAnnotationActionApply(action) {
|
|
1091
1759
|
if (action instanceof TextStyleAnnotationAction) {
|
|
1092
1760
|
if (this.type !== 'list-item') {
|
|
@@ -1168,6 +1836,13 @@ class RTETextBlock extends RTEBlock {
|
|
|
1168
1836
|
break;
|
|
1169
1837
|
}
|
|
1170
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
|
|
1841
|
+
*
|
|
1842
|
+
* @param {RTETextNode} splitNode - The text node that will be split
|
|
1843
|
+
* @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
|
|
1844
|
+
* @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
|
|
1845
|
+
*/
|
|
1171
1846
|
splitTextNodeBlock(splitNode, startOffsetOfNode) {
|
|
1172
1847
|
if (splitNode) {
|
|
1173
1848
|
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
@@ -1189,13 +1864,34 @@ class RTETextBlock extends RTEBlock {
|
|
|
1189
1864
|
}
|
|
1190
1865
|
}
|
|
1191
1866
|
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Checks if the caret position is at the start of a specified RTETextNode.
|
|
1869
|
+
*
|
|
1870
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
1871
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
1872
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
1873
|
+
*/
|
|
1192
1874
|
isCaretPositionAtStart(node, startOffset) {
|
|
1193
1875
|
return node === this.nodes[0] && startOffset === 0;
|
|
1194
1876
|
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
1879
|
+
*
|
|
1880
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
1881
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
1882
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
1883
|
+
*/
|
|
1195
1884
|
isCaretPositionAtEnd(node, startOffset) {
|
|
1196
1885
|
const lastNode = this.nodes[this.nodes.length - 1];
|
|
1197
1886
|
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
1198
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* lineBreakSingleBlock
|
|
1890
|
+
*
|
|
1891
|
+
* @param {RTETextNode} splitNode -
|
|
1892
|
+
* @param {number} startOffsetOfNode -
|
|
1893
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
1894
|
+
*/
|
|
1199
1895
|
lineBreakSingleBlock(splitNode, startOffsetOfNode) {
|
|
1200
1896
|
if (splitNode) {
|
|
1201
1897
|
const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
|
|
@@ -1216,6 +1912,12 @@ class RTETextBlock extends RTEBlock {
|
|
|
1216
1912
|
return lineBreakNode;
|
|
1217
1913
|
}
|
|
1218
1914
|
}
|
|
1915
|
+
/**
|
|
1916
|
+
* lineBreakMultipleBlocks
|
|
1917
|
+
*
|
|
1918
|
+
* @param {RTEBlock[]} selectedBlocks -
|
|
1919
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
1920
|
+
*/
|
|
1219
1921
|
lineBreakMultipleBlocks(selectedBlocks) {
|
|
1220
1922
|
const beforeNodes = this['nodes'];
|
|
1221
1923
|
const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
|
|
@@ -1223,6 +1925,11 @@ class RTETextBlock extends RTEBlock {
|
|
|
1223
1925
|
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
|
|
1224
1926
|
return lineBreakNode;
|
|
1225
1927
|
}
|
|
1928
|
+
/**
|
|
1929
|
+
* deleteNodeContent
|
|
1930
|
+
*
|
|
1931
|
+
* @param {DeleteBlockContentAction} action - ModifyContentAction
|
|
1932
|
+
*/
|
|
1226
1933
|
deleteNodeContent(action) {
|
|
1227
1934
|
const startContainerNode = action.startContainerNode;
|
|
1228
1935
|
const startOffset = action.startOffset;
|
|
@@ -1264,6 +1971,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
1264
1971
|
}
|
|
1265
1972
|
/**
|
|
1266
1973
|
* Remove line break
|
|
1974
|
+
*
|
|
1267
1975
|
* @example caret at the first line
|
|
1268
1976
|
* \n
|
|
1269
1977
|
* test
|
|
@@ -1273,6 +1981,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
1273
1981
|
}
|
|
1274
1982
|
/**
|
|
1275
1983
|
* Remove line break
|
|
1984
|
+
*
|
|
1276
1985
|
* @example caret at the begin of second line
|
|
1277
1986
|
* \n
|
|
1278
1987
|
* test
|
|
@@ -1298,35 +2007,37 @@ class RTETextBlock extends RTEBlock {
|
|
|
1298
2007
|
}
|
|
1299
2008
|
}
|
|
1300
2009
|
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Remove the child node
|
|
2012
|
+
*
|
|
2013
|
+
* @param {RemoveChildAction} action - Modify action
|
|
2014
|
+
*/
|
|
1301
2015
|
removeChildNode(action) {
|
|
1302
2016
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1303
2017
|
if (this.nodes.length === 0) {
|
|
1304
2018
|
this.parent.apply(new RemoveChildAction(this));
|
|
1305
2019
|
}
|
|
1306
2020
|
}
|
|
2021
|
+
/**
|
|
2022
|
+
* mergeLineBreakNodes
|
|
2023
|
+
*
|
|
2024
|
+
* @param {RTENode[]} beforeNodes -
|
|
2025
|
+
* @param {RTETextNode} lineBreakNode -
|
|
2026
|
+
* @param {RTENode[]} afterNodes -
|
|
2027
|
+
*/
|
|
1307
2028
|
mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes) {
|
|
1308
2029
|
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
1309
2030
|
afterNodes.push(new RTETextNode(generateUUID(), '\n', this, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
|
|
1310
2031
|
}
|
|
1311
2032
|
this.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
|
|
1312
2033
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
case 'heading-2':
|
|
1321
|
-
return `h2`;
|
|
1322
|
-
case 'heading-3':
|
|
1323
|
-
return `h3`;
|
|
1324
|
-
case 'paragraph':
|
|
1325
|
-
return 'p';
|
|
1326
|
-
case 'list-item':
|
|
1327
|
-
return 'li';
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
2034
|
+
/**
|
|
2035
|
+
* breakSingleTextBlock
|
|
2036
|
+
*
|
|
2037
|
+
* @param {RTETextNode} splitNode -
|
|
2038
|
+
* @param {number} startOffsetOfNode -
|
|
2039
|
+
* @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
|
|
2040
|
+
*/
|
|
1330
2041
|
breakSingleTextBlock(splitNode, startOffsetOfNode) {
|
|
1331
2042
|
const newParagraph = this.copyInlineStyleToNewParagraph(splitNode);
|
|
1332
2043
|
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
@@ -1342,6 +2053,11 @@ class RTETextBlock extends RTEBlock {
|
|
|
1342
2053
|
}
|
|
1343
2054
|
return newParagraph;
|
|
1344
2055
|
}
|
|
2056
|
+
/**
|
|
2057
|
+
* convertParagraphToList
|
|
2058
|
+
*
|
|
2059
|
+
* @param {TransformListAction} action - ModifyContentAction
|
|
2060
|
+
*/
|
|
1345
2061
|
convertParagraphToList(action) {
|
|
1346
2062
|
const bulletList = this.parent.createList(action.listType);
|
|
1347
2063
|
const listItems = action.selectedBlocks.map((node) => this.parent.toListItem(node));
|
|
@@ -1351,6 +2067,11 @@ class RTETextBlock extends RTEBlock {
|
|
|
1351
2067
|
node.parent.apply(new RemoveChildAction(node));
|
|
1352
2068
|
});
|
|
1353
2069
|
}
|
|
2070
|
+
/**
|
|
2071
|
+
* insertImage
|
|
2072
|
+
*
|
|
2073
|
+
* @param {InsertImageToBlockAction} action - ModifyContentAction
|
|
2074
|
+
*/
|
|
1354
2075
|
insertImage(action) {
|
|
1355
2076
|
const splitNode = action.splitPointNode;
|
|
1356
2077
|
const startOffsetOfNode = action.startOffsetOfNode;
|
|
@@ -1367,6 +2088,12 @@ class RTETextBlock extends RTEBlock {
|
|
|
1367
2088
|
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
1368
2089
|
}
|
|
1369
2090
|
}
|
|
2091
|
+
/**
|
|
2092
|
+
* copyInlineStyleToNewParagraph
|
|
2093
|
+
*
|
|
2094
|
+
* @param {RTETextNode} needCopedNode -
|
|
2095
|
+
* @returns {RTETextBlock} RTETextBlock
|
|
2096
|
+
*/
|
|
1370
2097
|
copyInlineStyleToNewParagraph(needCopedNode) {
|
|
1371
2098
|
const textNode = needCopedNode.cloneWithText('');
|
|
1372
2099
|
// The link annotation don't need inherited
|
|
@@ -1386,6 +2113,12 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1386
2113
|
this.type = 'image';
|
|
1387
2114
|
this.nodes = [];
|
|
1388
2115
|
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Converts a VegaRTEImageBlock object into an RTEImageBlock object by mapping nodes and creating annotations.
|
|
2118
|
+
*
|
|
2119
|
+
* @param {VegaRTEImageBlock} block - The block object to be converted.
|
|
2120
|
+
* @returns {RTEImageBlock} An instance of `RTEImageBlock`
|
|
2121
|
+
*/
|
|
1389
2122
|
static from(block) {
|
|
1390
2123
|
const imageBlock = new RTEImageBlock(block.id);
|
|
1391
2124
|
const { annotations } = block;
|
|
@@ -1400,34 +2133,26 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1400
2133
|
}
|
|
1401
2134
|
return imageBlock;
|
|
1402
2135
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
imageBlock.nodes = nodes.map((item) => RTEImageNode.fromHTML(item, imageBlock));
|
|
1407
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1408
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1409
|
-
if (isNonNullable(item)) {
|
|
1410
|
-
imageBlock.annotationMap.set(...item);
|
|
1411
|
-
}
|
|
1412
|
-
});
|
|
1413
|
-
return imageBlock;
|
|
1414
|
-
}
|
|
2136
|
+
/**
|
|
2137
|
+
* @inheritDoc
|
|
2138
|
+
*/
|
|
1415
2139
|
toJSON() {
|
|
1416
2140
|
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1417
2141
|
}
|
|
2142
|
+
/**
|
|
2143
|
+
* @inheritDoc
|
|
2144
|
+
*/
|
|
1418
2145
|
isNotEmpty() {
|
|
1419
2146
|
return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
|
|
1420
2147
|
}
|
|
2148
|
+
/**
|
|
2149
|
+
* @inheritDoc
|
|
2150
|
+
*/
|
|
1421
2151
|
getLastNode() {
|
|
1422
2152
|
return this.nodes[this.nodes.length - 1];
|
|
1423
2153
|
}
|
|
1424
|
-
render(renderContext) {
|
|
1425
|
-
return (h("div", { style: Object.assign({}, this.getStyles()), ref: this.registerRef.bind(this), class: super.getClasses() }, this.nodes.map((node) => {
|
|
1426
|
-
return node.render(renderContext);
|
|
1427
|
-
})));
|
|
1428
|
-
}
|
|
1429
2154
|
/**
|
|
1430
|
-
* Apply modify action to block
|
|
2155
|
+
* Apply a modify action to block
|
|
1431
2156
|
*
|
|
1432
2157
|
* @param {ModifyContentAction} action - Modify action
|
|
1433
2158
|
*/
|
|
@@ -1481,11 +2206,11 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1481
2206
|
break;
|
|
1482
2207
|
}
|
|
1483
2208
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
2209
|
+
/**
|
|
2210
|
+
* Removes a specified child node from a list of nodes and triggers a parent action if the list becomes empty.
|
|
2211
|
+
*
|
|
2212
|
+
* @param {RemoveChildAction} action - Action to be performed when removing a child node from the list of nodes.
|
|
2213
|
+
*/
|
|
1489
2214
|
removeChildNode(action) {
|
|
1490
2215
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1491
2216
|
if (this.nodes.length === 0) {
|
|
@@ -1498,6 +2223,7 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1498
2223
|
*
|
|
1499
2224
|
* @param {RTEImageNode} imageNode The split point image node
|
|
1500
2225
|
* @param {number} imageOffset The cursor point 0 | 1
|
|
2226
|
+
* @returns {Nullable<RTEBlock>} The new block after split
|
|
1501
2227
|
*/
|
|
1502
2228
|
splitImageNodes(imageNode, imageOffset) {
|
|
1503
2229
|
const nodesSplitIndex = this.nodes.indexOf(imageNode);
|
|
@@ -1510,12 +2236,25 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1510
2236
|
return newBlock;
|
|
1511
2237
|
}
|
|
1512
2238
|
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Creates a new RTEImageBlock instance with the provided RTEImageNode instances appended to it.
|
|
2241
|
+
*
|
|
2242
|
+
* @param {RTEImageNode[]} nodes - An array of RTEImageNode objects that will be used to create a new RTEImageBlock instance.
|
|
2243
|
+
* @returns {RTEImageBlock} A new `RTEImageBlock` object with the provided `nodes` appended to it.
|
|
2244
|
+
*/
|
|
1513
2245
|
cloneWithNodes(nodes) {
|
|
1514
2246
|
const block = new RTEImageBlock(generateUUID());
|
|
1515
2247
|
block.nodes = [];
|
|
1516
2248
|
block.apply(new AppendChildNodesAction(nodes));
|
|
1517
2249
|
return block;
|
|
1518
2250
|
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Used to split a block of text at a specific position and insert a new paragraph block.
|
|
2253
|
+
*
|
|
2254
|
+
* @param {RTEImageNode} splitNode - The node that needs to be split into separate blocks.
|
|
2255
|
+
* @param {number} startOffsetOfNode - The index or position within the `splitNode` where the block should be broken or split.
|
|
2256
|
+
* @returns {Nullable<RTEBlock>} Returns either a new paragraph block or the new block created after splitting the original block.
|
|
2257
|
+
*/
|
|
1519
2258
|
breakSingleBlock(splitNode, startOffsetOfNode) {
|
|
1520
2259
|
const newParagraph = RTETextBlock.from({
|
|
1521
2260
|
id: generateUUID(),
|
|
@@ -1535,19 +2274,46 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1535
2274
|
}
|
|
1536
2275
|
return newParagraph;
|
|
1537
2276
|
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Breaks a single block of text at a specified offset and returns the first node of the new paragraph if created.
|
|
2279
|
+
*
|
|
2280
|
+
* @param {RTEImageNode} splitNode - It represents a node in a rich text editor that contains an image.
|
|
2281
|
+
* @param {number} startOffset - The index at which the line break should occur within the `RTEImageNode` block.
|
|
2282
|
+
* @returns {Nullable<RTETextNode>} Returning the first node of the `newParagraph` block if `newParagraph` is not null.
|
|
2283
|
+
*/
|
|
1538
2284
|
lineBreakSingleBlock(splitNode, startOffset) {
|
|
1539
2285
|
const newParagraph = this.breakSingleBlock(splitNode, startOffset);
|
|
1540
2286
|
if (newParagraph) {
|
|
1541
2287
|
return newParagraph['nodes'][0];
|
|
1542
2288
|
}
|
|
1543
2289
|
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Checks if the caret position is at the start of a specified RTEImageNode.
|
|
2292
|
+
*
|
|
2293
|
+
* @param {RTEImageNode} node - `RTEImageNode` - a node representing an image in a rich text editor.
|
|
2294
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
2295
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTEImageNode.
|
|
2296
|
+
*/
|
|
1544
2297
|
isCaretPositionAtStart(node, startOffset) {
|
|
1545
2298
|
return node === this.nodes[0] && startOffset === 0;
|
|
1546
2299
|
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Checks if the caret position is at the end of a given RTEImageNode.
|
|
2302
|
+
*
|
|
2303
|
+
* @param {RTEImageNode} node - `node` is a RTEImageNode
|
|
2304
|
+
* @param {number} startOffset - The position within the `RTEImageNode` where the caret is located.
|
|
2305
|
+
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEImageNode`.
|
|
2306
|
+
*/
|
|
1547
2307
|
isCaretPositionAtEnd(node, startOffset) {
|
|
1548
2308
|
const lastNode = this.nodes[this.nodes.length - 1];
|
|
1549
2309
|
return node === lastNode && startOffset === 1;
|
|
1550
2310
|
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Inserts a new paragraph block with a line break after a selected block of text in a rich text editor.
|
|
2313
|
+
*
|
|
2314
|
+
* @param {RTEBlock[]} selectedBlocks - An array of RTEBlock objects that represent the blocks that have been selected for a specific action in the Rich Text Editor.
|
|
2315
|
+
* @returns {Nullable<RTETextNode>} Returns a Nullable RTETextNode.
|
|
2316
|
+
*/
|
|
1551
2317
|
lineBreakMultipleBlocks(selectedBlocks) {
|
|
1552
2318
|
const newParagraph = RTETextBlock.from({
|
|
1553
2319
|
id: generateUUID(),
|
|
@@ -1562,6 +2328,11 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1562
2328
|
newParagraph.apply(new AppendChildNodesAction(afterNodes));
|
|
1563
2329
|
return newParagraph['nodes'][0];
|
|
1564
2330
|
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Deletes content from a block node based on specific conditions.
|
|
2333
|
+
*
|
|
2334
|
+
* @param {DeleteBlockContentAction} action - Delete block content action
|
|
2335
|
+
*/
|
|
1565
2336
|
deleteNodeContent(action) {
|
|
1566
2337
|
const startContainerNode = action
|
|
1567
2338
|
.startContainerNode, startOffset = action.startOffset;
|
|
@@ -1622,12 +2393,21 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1622
2393
|
}
|
|
1623
2394
|
}
|
|
1624
2395
|
|
|
2396
|
+
/**
|
|
2397
|
+
* List item block
|
|
2398
|
+
*/
|
|
1625
2399
|
class RTEListItemBlock extends RTETextBlock {
|
|
1626
2400
|
constructor(id, children) {
|
|
1627
2401
|
super(id, 'list-item');
|
|
1628
2402
|
this.children = [];
|
|
1629
2403
|
this.children = children;
|
|
1630
2404
|
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Converts a VegaRTEListItemBlock object to an RTEListItemBlock
|
|
2407
|
+
*
|
|
2408
|
+
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListItemBlock` object into an `RTEListItemBlock`.
|
|
2409
|
+
* @returns {RTEListBlock} Return an instance of `RTEListItemBlock`
|
|
2410
|
+
*/
|
|
1631
2411
|
static from(block) {
|
|
1632
2412
|
const listItemBlock = new RTEListItemBlock(block.id);
|
|
1633
2413
|
listItemBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock));
|
|
@@ -1649,42 +2429,25 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1649
2429
|
}
|
|
1650
2430
|
return listItemBlock;
|
|
1651
2431
|
}
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
.map((item) => {
|
|
1656
|
-
if (!['UL', 'OL'].includes(item.nodeName)) {
|
|
1657
|
-
return RTETextNode.fromHTML(item, listItem);
|
|
1658
|
-
}
|
|
1659
|
-
})
|
|
1660
|
-
.filter(Boolean);
|
|
1661
|
-
listItem.children = Array.from(node.childNodes)
|
|
1662
|
-
.map((item) => {
|
|
1663
|
-
if (['UL', 'OL'].includes(item.nodeName)) {
|
|
1664
|
-
const listBlock = RTEListBlock.fromHTML(item);
|
|
1665
|
-
listBlock && (listBlock.parent = listItem);
|
|
1666
|
-
return listBlock;
|
|
1667
|
-
}
|
|
1668
|
-
})
|
|
1669
|
-
.filter(Boolean);
|
|
1670
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1671
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1672
|
-
if (isNonNullable(item)) {
|
|
1673
|
-
listItem.annotationMap.set(...item);
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
return listItem;
|
|
1677
|
-
}
|
|
2432
|
+
/**
|
|
2433
|
+
* @inheritDoc
|
|
2434
|
+
*/
|
|
1678
2435
|
toJSON() {
|
|
1679
2436
|
var _a;
|
|
1680
2437
|
return Object.assign(Object.assign({}, super.toJSON()), { type: 'list-item', children: (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.toJSON()) });
|
|
1681
2438
|
}
|
|
2439
|
+
/**
|
|
2440
|
+
* @inheritDoc
|
|
2441
|
+
*/
|
|
1682
2442
|
cloneWithNodes(nodes) {
|
|
1683
2443
|
const block = new RTEListItemBlock(generateUUID());
|
|
1684
2444
|
block.nodes = [];
|
|
1685
2445
|
block.apply(new AppendChildNodesAction(nodes));
|
|
1686
2446
|
return block;
|
|
1687
2447
|
}
|
|
2448
|
+
/**
|
|
2449
|
+
* @inheritDoc
|
|
2450
|
+
*/
|
|
1688
2451
|
isNotEmpty() {
|
|
1689
2452
|
if (this.children) {
|
|
1690
2453
|
return super.isNotEmpty() || this.children.some((block) => block.isNotEmpty());
|
|
@@ -1693,6 +2456,9 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1693
2456
|
return super.isNotEmpty();
|
|
1694
2457
|
}
|
|
1695
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* @inheritDoc
|
|
2461
|
+
*/
|
|
1696
2462
|
getLastNode() {
|
|
1697
2463
|
if (this.children && this.children.length > 0) {
|
|
1698
2464
|
const childListBlock = this.children[this.children.length - 1];
|
|
@@ -1700,9 +2466,6 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1700
2466
|
}
|
|
1701
2467
|
return super.getLastNode();
|
|
1702
2468
|
}
|
|
1703
|
-
render(renderContext) {
|
|
1704
|
-
return super.render(renderContext, this.renderChildren(renderContext));
|
|
1705
|
-
}
|
|
1706
2469
|
/**
|
|
1707
2470
|
* Apply a modify action to block
|
|
1708
2471
|
*
|
|
@@ -1758,16 +2521,22 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1758
2521
|
break;
|
|
1759
2522
|
}
|
|
1760
2523
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
2524
|
+
/**
|
|
2525
|
+
* Remove the list child node
|
|
2526
|
+
*
|
|
2527
|
+
* @param {RemoveChildAction} action - Modify action
|
|
2528
|
+
*/
|
|
1765
2529
|
removeListChildNode(action) {
|
|
1766
2530
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1767
2531
|
if (this.nodes.length === 0 && (!this.children || !this.children.length)) {
|
|
1768
2532
|
this.parent.apply(new RemoveChildAction(this));
|
|
1769
2533
|
}
|
|
1770
2534
|
}
|
|
2535
|
+
/**
|
|
2536
|
+
* Remove the nest list
|
|
2537
|
+
*
|
|
2538
|
+
* @param {RemoveNestListAction} action - Modify action
|
|
2539
|
+
*/
|
|
1771
2540
|
removeNestList(action) {
|
|
1772
2541
|
if (this.children) {
|
|
1773
2542
|
if (this.children.length > 1) {
|
|
@@ -1778,15 +2547,34 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1778
2547
|
}
|
|
1779
2548
|
}
|
|
1780
2549
|
}
|
|
2550
|
+
/**
|
|
2551
|
+
* Iterates through a list of RTEListBlock and sets their parent property to the current object, then replaces the children property with the new list.
|
|
2552
|
+
*
|
|
2553
|
+
* @param {RTEListBlock[]} newList - new list that you want to replace the existing children of the current object with.
|
|
2554
|
+
*/
|
|
1781
2555
|
replaceNestList(newList) {
|
|
1782
2556
|
newList.forEach((listBlock) => {
|
|
1783
2557
|
listBlock.parent = this;
|
|
1784
2558
|
});
|
|
1785
2559
|
this.children = newList;
|
|
1786
2560
|
}
|
|
2561
|
+
/**
|
|
2562
|
+
* Split list item block
|
|
2563
|
+
*
|
|
2564
|
+
* @param {SplitBlockWithNodeAction} action - Modify action
|
|
2565
|
+
*/
|
|
1787
2566
|
splitListItemBlock(action) {
|
|
1788
2567
|
action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode);
|
|
1789
2568
|
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Breaks a single list item block at a specific position.
|
|
2571
|
+
*
|
|
2572
|
+
* @param {RTETextNode} splitNode - The node that needs to be split within a list item block.
|
|
2573
|
+
* @param {number} startOffsetOfNode - The index within the `splitNode` where the break operation should occur.
|
|
2574
|
+
* @returns {Nullable<RTEBlock>} Returns either a new `RTEListItemBlock` if the caret
|
|
2575
|
+
* position is at the end of the `splitNode`, or it returns the result of splitting the block at the
|
|
2576
|
+
* caret position if it is neither at the start nor at the end.
|
|
2577
|
+
*/
|
|
1790
2578
|
breakSingleListItemBlock(splitNode, startOffsetOfNode) {
|
|
1791
2579
|
const newListItem = new RTEListItemBlock(generateUUID());
|
|
1792
2580
|
const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
|
|
@@ -1804,6 +2592,12 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1804
2592
|
}
|
|
1805
2593
|
return newListItem;
|
|
1806
2594
|
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Breaks a list item at the end and handles the insertion of a new list item or paragraph accordingly.
|
|
2597
|
+
*
|
|
2598
|
+
* @param {RTEListItemBlock} newListItem - Item that represents a new list item to be added to the existing list.
|
|
2599
|
+
* @returns {RTEBlock} Returns a `RTEBlock`.
|
|
2600
|
+
*/
|
|
1807
2601
|
breakListItemAtEnd(newListItem) {
|
|
1808
2602
|
const lastItem = this.parent.blocks[this.parent.blocks.length - 1];
|
|
1809
2603
|
const currentItemIsEmpty = this.nodes.length === 1 && this.nodes[0].isEmpty();
|
|
@@ -1830,6 +2624,11 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1830
2624
|
}
|
|
1831
2625
|
return newListItem;
|
|
1832
2626
|
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Delete list node content
|
|
2629
|
+
*
|
|
2630
|
+
* @param {DeleteBlockContentAction} action - Modify action
|
|
2631
|
+
*/
|
|
1833
2632
|
deleteListNodeContent(action) {
|
|
1834
2633
|
const startContainerNode = action.startContainerNode;
|
|
1835
2634
|
const listBlock = startContainerNode.parentBlock.parent;
|
|
@@ -1838,9 +2637,15 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1838
2637
|
listBlock.parent.apply(new RemoveChildAction(listBlock));
|
|
1839
2638
|
}
|
|
1840
2639
|
}
|
|
2640
|
+
/**
|
|
2641
|
+
* Copy the inline style to new node
|
|
2642
|
+
*
|
|
2643
|
+
* @param {RTETextNode} needCopedNode - The node that needed to be copied to
|
|
2644
|
+
* @returns {RTETextNode} Returns a `RTETextNode`.
|
|
2645
|
+
*/
|
|
1841
2646
|
copyInlineStyleToNewNode(needCopedNode) {
|
|
1842
2647
|
const textNode = needCopedNode.cloneWithText('');
|
|
1843
|
-
// The link annotation
|
|
2648
|
+
// The link annotation doesn't need to inherit
|
|
1844
2649
|
textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
1845
2650
|
return textNode;
|
|
1846
2651
|
}
|
|
@@ -1859,6 +2664,9 @@ class RemoveNestListAction extends ModifyContentAction {
|
|
|
1859
2664
|
}
|
|
1860
2665
|
}
|
|
1861
2666
|
|
|
2667
|
+
/**
|
|
2668
|
+
* List block
|
|
2669
|
+
*/
|
|
1862
2670
|
class RTEListBlock extends RTEBlock {
|
|
1863
2671
|
constructor(id, type) {
|
|
1864
2672
|
super(id);
|
|
@@ -1866,6 +2674,12 @@ class RTEListBlock extends RTEBlock {
|
|
|
1866
2674
|
this.blocks = [];
|
|
1867
2675
|
this.type = type;
|
|
1868
2676
|
}
|
|
2677
|
+
/**
|
|
2678
|
+
* Converts a VegaRTEListBlock object to an RTEListBlock
|
|
2679
|
+
*
|
|
2680
|
+
* @param {VegaRTEListBlock} block - Converts a `VegaRTEListBlock` object into an `RTEListBlock`.
|
|
2681
|
+
* @returns {RTEListBlock} Return an instance of `RTEListBlock`
|
|
2682
|
+
*/
|
|
1869
2683
|
static from(block) {
|
|
1870
2684
|
const listBlock = new RTEListBlock(block.id, block.type);
|
|
1871
2685
|
listBlock.blocks = block.blocks.map((item) => {
|
|
@@ -1875,37 +2689,25 @@ class RTEListBlock extends RTEBlock {
|
|
|
1875
2689
|
});
|
|
1876
2690
|
return listBlock;
|
|
1877
2691
|
}
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
.map((item) => {
|
|
1882
|
-
const listItemBlock = RTEListItemBlock.fromHTML(item);
|
|
1883
|
-
listItemBlock && (listItemBlock.parent = listBlock);
|
|
1884
|
-
return listItemBlock;
|
|
1885
|
-
})
|
|
1886
|
-
.filter(Boolean);
|
|
1887
|
-
Object.keys(BlockAnnotationTypeEnum).forEach((type) => {
|
|
1888
|
-
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1889
|
-
if (isNonNullable(item)) {
|
|
1890
|
-
listBlock.annotationMap.set(...item);
|
|
1891
|
-
}
|
|
1892
|
-
});
|
|
1893
|
-
return listBlock;
|
|
1894
|
-
}
|
|
2692
|
+
/**
|
|
2693
|
+
* @inheritDoc
|
|
2694
|
+
*/
|
|
1895
2695
|
toJSON() {
|
|
1896
2696
|
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
1897
2697
|
}
|
|
2698
|
+
/**
|
|
2699
|
+
* @inheritDoc
|
|
2700
|
+
*/
|
|
1898
2701
|
isNotEmpty() {
|
|
1899
2702
|
return (this.blocks.length > 0 &&
|
|
1900
2703
|
this.blocks.some((listItemBlock) => listItemBlock.isNotEmpty()));
|
|
1901
2704
|
}
|
|
2705
|
+
/**
|
|
2706
|
+
* @inheritDoc
|
|
2707
|
+
*/
|
|
1902
2708
|
getLastNode() {
|
|
1903
2709
|
return this.blocks[this.blocks.length - 1].getLastNode();
|
|
1904
2710
|
}
|
|
1905
|
-
render(renderContext) {
|
|
1906
|
-
const BlockTag = this.type === 'number-list' ? 'ol' : 'ul';
|
|
1907
|
-
return (h(BlockTag, { ref: this.registerRef.bind(this) }, this.blocks.map((block) => block.render(renderContext))));
|
|
1908
|
-
}
|
|
1909
2711
|
/**
|
|
1910
2712
|
* Apply a modify action to block
|
|
1911
2713
|
*
|
|
@@ -1942,17 +2744,23 @@ class RTEListBlock extends RTEBlock {
|
|
|
1942
2744
|
break;
|
|
1943
2745
|
}
|
|
1944
2746
|
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Converts a RTEListItemBlock to a RTETextBlock representing a paragraph.
|
|
2749
|
+
*
|
|
2750
|
+
* @param {RTEListItemBlock} block - The block that will be covered
|
|
2751
|
+
* @returns {RTETextBlock} Returns a `RTETextBlock`.
|
|
2752
|
+
*/
|
|
1945
2753
|
toParagraph(block) {
|
|
1946
2754
|
const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
|
|
1947
2755
|
textBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
1948
2756
|
textBlock['annotationMap'] = block['annotationMap'];
|
|
1949
2757
|
return textBlock;
|
|
1950
2758
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
2759
|
+
/**
|
|
2760
|
+
* Covert block to List
|
|
2761
|
+
*
|
|
2762
|
+
* @param {TransformListAction} action - Modify action
|
|
2763
|
+
*/
|
|
1956
2764
|
convertToList(action) {
|
|
1957
2765
|
const selectedBlocks = action.selectedBlocks;
|
|
1958
2766
|
const bulletList = this.parent.createList(action.listType);
|
|
@@ -1976,6 +2784,11 @@ class RTEListBlock extends RTEBlock {
|
|
|
1976
2784
|
}
|
|
1977
2785
|
}
|
|
1978
2786
|
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Covert block to paragraph
|
|
2789
|
+
*
|
|
2790
|
+
* @param {TransformListAction} action - Modify action
|
|
2791
|
+
*/
|
|
1979
2792
|
convertToParagraph(action) {
|
|
1980
2793
|
let isSelectedFirstBlock = false;
|
|
1981
2794
|
let isSelectedLastBlock = false;
|
|
@@ -2011,6 +2824,11 @@ class RTEListBlock extends RTEBlock {
|
|
|
2011
2824
|
this.parent.apply(new RemoveChildAction(this));
|
|
2012
2825
|
}
|
|
2013
2826
|
}
|
|
2827
|
+
/**
|
|
2828
|
+
* Inserts an image block into a rich text editor block based on the parent block type.
|
|
2829
|
+
*
|
|
2830
|
+
* @param {InsertImageToBlockAction} action - Modify action
|
|
2831
|
+
*/
|
|
2014
2832
|
insertImage(action) {
|
|
2015
2833
|
const imageBlock = action.imageBlockToBeInserted;
|
|
2016
2834
|
if (this.parent['type'] !== 'list-item') {
|
|
@@ -2020,10 +2838,15 @@ class RTEListBlock extends RTEBlock {
|
|
|
2020
2838
|
this.parent.apply(action);
|
|
2021
2839
|
}
|
|
2022
2840
|
}
|
|
2841
|
+
/**
|
|
2842
|
+
* Removes a specified block and handles the removal of nested lists if necessary.
|
|
2843
|
+
*
|
|
2844
|
+
* @param {RTEBlock} blockToBeRemoved - block that will be removed
|
|
2845
|
+
*/
|
|
2023
2846
|
removeListItemBlock(blockToBeRemoved) {
|
|
2024
2847
|
super.removeChildBlock(blockToBeRemoved);
|
|
2025
2848
|
if (this.blocks.length === 0 && this.parent) {
|
|
2026
|
-
// The parent is a list item mean the current block is a nest list, so we need use RemoveNestListAction to remove the item
|
|
2849
|
+
// The parent is a list item mean the current block is a nest list, so we need to use RemoveNestListAction to remove the item
|
|
2027
2850
|
if (this.parent instanceof RTEListItemBlock) {
|
|
2028
2851
|
this.parent.apply(new RemoveNestListAction(this));
|
|
2029
2852
|
}
|
|
@@ -2034,131 +2857,4 @@ class RTEListBlock extends RTEBlock {
|
|
|
2034
2857
|
}
|
|
2035
2858
|
}
|
|
2036
2859
|
|
|
2037
|
-
|
|
2038
|
-
* Class representing the content state of the rich text editor.
|
|
2039
|
-
*/
|
|
2040
|
-
class VegaRTEContent extends BlockBaseOperator {
|
|
2041
|
-
constructor(blocks) {
|
|
2042
|
-
super();
|
|
2043
|
-
blocks.forEach((block) => {
|
|
2044
|
-
block.parent = this;
|
|
2045
|
-
});
|
|
2046
|
-
this.blocks = blocks;
|
|
2047
|
-
}
|
|
2048
|
-
/**
|
|
2049
|
-
* Converts a JSON array of blocks to a class array of RTEContentBlock.
|
|
2050
|
-
*
|
|
2051
|
-
* @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
|
|
2052
|
-
* @returns {RTEContentBlock[]} The converted array of RTEContentBlock.
|
|
2053
|
-
*/
|
|
2054
|
-
static fromJSON(value) {
|
|
2055
|
-
const blocks = value.map((block) => {
|
|
2056
|
-
switch (block.type) {
|
|
2057
|
-
case 'paragraph':
|
|
2058
|
-
case 'title':
|
|
2059
|
-
case 'subtitle':
|
|
2060
|
-
case 'heading-1':
|
|
2061
|
-
case 'heading-2':
|
|
2062
|
-
case 'heading-3': {
|
|
2063
|
-
return RTETextBlock.from(block);
|
|
2064
|
-
}
|
|
2065
|
-
case 'image':
|
|
2066
|
-
return RTEImageBlock.from(block);
|
|
2067
|
-
case 'bullet-list':
|
|
2068
|
-
case 'number-list':
|
|
2069
|
-
return RTEListBlock.from(block);
|
|
2070
|
-
default: {
|
|
2071
|
-
throw new Error(`[Vega] Unknown block type: ${block.type}`);
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
return new VegaRTEContent(blocks);
|
|
2076
|
-
}
|
|
2077
|
-
/**
|
|
2078
|
-
* Create an empty content state
|
|
2079
|
-
*
|
|
2080
|
-
* @returns {VegaRTEContent} An empty content state
|
|
2081
|
-
*/
|
|
2082
|
-
static createEmptyContent() {
|
|
2083
|
-
return VegaRTEContent.fromJSON([
|
|
2084
|
-
{
|
|
2085
|
-
id: generateUUID(),
|
|
2086
|
-
type: 'paragraph',
|
|
2087
|
-
nodes: [
|
|
2088
|
-
{
|
|
2089
|
-
id: generateUUID(),
|
|
2090
|
-
type: 'text',
|
|
2091
|
-
text: '',
|
|
2092
|
-
},
|
|
2093
|
-
],
|
|
2094
|
-
},
|
|
2095
|
-
]);
|
|
2096
|
-
}
|
|
2097
|
-
/**
|
|
2098
|
-
* Clones the content state.
|
|
2099
|
-
*
|
|
2100
|
-
* @returns {VegaRTEContent} The cloned content state.
|
|
2101
|
-
*/
|
|
2102
|
-
clone() {
|
|
2103
|
-
return new VegaRTEContent([...this.blocks]);
|
|
2104
|
-
}
|
|
2105
|
-
/**
|
|
2106
|
-
* Converts the content state to a JSON array of blocks.
|
|
2107
|
-
*
|
|
2108
|
-
* @returns {VegaRTEContentBlock[]} The JSON array of blocks.
|
|
2109
|
-
*/
|
|
2110
|
-
toJSON() {
|
|
2111
|
-
return this.blocks.map((block) => block.toJSON());
|
|
2112
|
-
}
|
|
2113
|
-
/**
|
|
2114
|
-
* Internal method to add the block item, remove the block item
|
|
2115
|
-
*
|
|
2116
|
-
* @param {ModifyContentAction} action - Modify content action
|
|
2117
|
-
*/
|
|
2118
|
-
apply(action) {
|
|
2119
|
-
switch (action.type) {
|
|
2120
|
-
case ModifyContentActionType.DELETE_CHILD:
|
|
2121
|
-
this.removeChildBlock(action.entityToBeRemoved);
|
|
2122
|
-
break;
|
|
2123
|
-
case ModifyContentActionType.APPEND_CHILD_NODES:
|
|
2124
|
-
this.appendChildBlocks(action.entityToBeAppended);
|
|
2125
|
-
break;
|
|
2126
|
-
case ModifyContentActionType.INSERT_BLOCKS_AFTER:
|
|
2127
|
-
this.replaceBlockWithBlocks(action.referBlock, [
|
|
2128
|
-
action.referBlock,
|
|
2129
|
-
...action.blocksToBeInserted,
|
|
2130
|
-
]);
|
|
2131
|
-
break;
|
|
2132
|
-
case ModifyContentActionType.INSERT_BLOCKS_BEFORE:
|
|
2133
|
-
this.replaceBlockWithBlocks(action.referBlock, [
|
|
2134
|
-
...action.blocksToBeInserted,
|
|
2135
|
-
action.referBlock,
|
|
2136
|
-
]);
|
|
2137
|
-
break;
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Convert text to list.
|
|
2142
|
-
*
|
|
2143
|
-
* @param {RTETextBlock} block - block
|
|
2144
|
-
* @returns {RTEListItemBlock} list item block dto.
|
|
2145
|
-
*/
|
|
2146
|
-
toListItem(block) {
|
|
2147
|
-
block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
2148
|
-
const listItemBlock = new RTEListItemBlock(generateUUID());
|
|
2149
|
-
listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
2150
|
-
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
2151
|
-
return listItemBlock;
|
|
2152
|
-
}
|
|
2153
|
-
/**
|
|
2154
|
-
* create list.
|
|
2155
|
-
*
|
|
2156
|
-
* @param {ListType} type - type
|
|
2157
|
-
* @returns {RTEListBlock} list block dto.
|
|
2158
|
-
*/
|
|
2159
|
-
createList(type) {
|
|
2160
|
-
return new RTEListBlock(generateUUID(), type);
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
|
|
2164
|
-
export { AppendChildNodesAction as A, BoldAnnotationAction as B, HorizontalAlignmentAnnotation as H, IndentAnnotation as I, MergeTwoBlocksNodesAction as M, RTETextBlock as R, SplitBlockWithNodeAction as S, TextStyleAnnotationAction as T, VegaRTEContent as V, TextStyleAnnotation as a, RTEImageNode as b, RTEListItemBlock as c, RemoveChildAction as d, InsertBlocksBeforeAction as e, ReplaceChildNodesAction as f, RTEImageBlock as g, RTEListBlock as h, InsertBlocksAfterAction as i, ImageAnnotationAction as j };
|
|
2860
|
+
export { AppendChildNodesAction as A, BlockBaseOperator as B, ClearFormattingAnnotationAction as C, HorizontalAlignmentAnnotation as H, ImageAnnotation as I, LinkAnnotationAction as L, MergeTwoBlocksNodesAction as M, RTEListBlock as R, SyncUpSelectionAction as S, TextSplittableAction as T, UnderlineAnnotation as U, ZERO_WIDTH_SPACE as Z, RTEImageBlock as a, RTETextBlock as b, RTEListItemBlock as c, waitForComponentDidRender as d, TextColorAnnotation as e, RTE_TEXT_COLORS as f, RTETextNode as g, AnnotationAction as h, BoldAnnotationAction as i, ItalicAnnotation as j, TextStyleAnnotationAction as k, TextStyleAnnotation as l, BoldAnnotation as m, CodeAnnotationAction as n, StrikethroughAnnotation as o, SelectionRangeAnnotation as p, IndentAnnotation as q, RTEImageNode as r, UpdateTextAction as s, RemoveChildAction as t, InsertBlocksBeforeAction as u, SplitBlockWithNodeAction as v, waitForVega as w, ReplaceChildNodesAction as x, InsertBlocksAfterAction as y };
|