@heartlandone/vega 2.34.1 → 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-48582633.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-21a166e4.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-6a5b9736.js → list-block-91116257.js} +1346 -402
- 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 +52 -50
- 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 +336 -334
- 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 +184 -182
- 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-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +22 -1
- 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/blocks/block.abstract.js +0 -24
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +67 -13
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +45 -12
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +68 -8
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +111 -36
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +23 -50
- 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 -19
- 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/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/esm/{app-globals-48531a04.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-b2270b64.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-4b036bf1.js → list-block-ba82c846.js} +1225 -299
- 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 +16 -14
- 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 +31 -29
- 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 +25 -23
- 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-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +1 -0
- 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/blocks/block.abstract.d.ts +2 -15
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +68 -4
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +45 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +68 -3
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +110 -5
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +21 -5
- 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 -2
- 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/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-494856f3.js +0 -955
- package/dist/esm/text-node-a652ca87.js +0 -933
- package/dist/vega/p-0190095c.entry.js +0 -1
- package/dist/vega/p-034e6348.entry.js +0 -1
- package/dist/vega/p-0cd2b50f.entry.js +0 -1
- package/dist/vega/p-10393104.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-3039bef8.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-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-584dcd9b.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-734ea281.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-8836c1b9.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-8f004647.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-9e732a26.entry.js +0 -1
- package/dist/vega/p-9f39dd10.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-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-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-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-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
|
|
@@ -161,6 +192,40 @@ class RemoveChildAction extends ModifyContentAction {
|
|
|
161
192
|
}
|
|
162
193
|
}
|
|
163
194
|
|
|
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';
|
|
228
|
+
|
|
164
229
|
/**
|
|
165
230
|
* Abstract class for block
|
|
166
231
|
*/
|
|
@@ -252,29 +317,6 @@ class RTEBlock extends BlockBaseOperator {
|
|
|
252
317
|
this.annotationMap.set(annotation.type, annotation);
|
|
253
318
|
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
254
319
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Get styles from annotations
|
|
257
|
-
*
|
|
258
|
-
* @returns {AnnotationStyle} - Annotation style
|
|
259
|
-
*/
|
|
260
|
-
getStyles() {
|
|
261
|
-
return Array.from(this.annotationMap.values())
|
|
262
|
-
.filter((annotation) => annotation instanceof BlockAnnotation)
|
|
263
|
-
.map((annotation) => annotation.render())
|
|
264
|
-
.filter(isNonNullable)
|
|
265
|
-
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Get classes from annotations
|
|
269
|
-
*
|
|
270
|
-
* @returns {AnnotationStyle} - Annotation style
|
|
271
|
-
*/
|
|
272
|
-
getClasses() {
|
|
273
|
-
return Array.from(this.annotationMap.values())
|
|
274
|
-
.map((annotation) => { var _a; return (_a = annotation.renderClass) === null || _a === void 0 ? void 0 : _a.call(annotation); })
|
|
275
|
-
.filter(isNonNullable)
|
|
276
|
-
.reduce((pre, cur) => [pre, cur].join(' '), '');
|
|
277
|
-
}
|
|
278
320
|
/**
|
|
279
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.
|
|
280
322
|
*
|
|
@@ -541,25 +583,8 @@ class ImageAnnotation extends NodeAnnotation {
|
|
|
541
583
|
}
|
|
542
584
|
|
|
543
585
|
/**
|
|
544
|
-
*
|
|
586
|
+
* Image node
|
|
545
587
|
*/
|
|
546
|
-
class ImageAnnotationAction extends AnnotationAction {
|
|
547
|
-
constructor(size, alt) {
|
|
548
|
-
super();
|
|
549
|
-
this.isFlushable = true;
|
|
550
|
-
this.size = size;
|
|
551
|
-
this.alt = alt;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Converts the action to an annotation
|
|
555
|
-
*
|
|
556
|
-
* @returns {ImageAnnotation} The annotation
|
|
557
|
-
*/
|
|
558
|
-
toAnnotation() {
|
|
559
|
-
return new ImageAnnotation(this.size, this.alt);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
588
|
class RTEImageNode extends RTENode {
|
|
564
589
|
constructor(id, url, parentBlock, annotationMap) {
|
|
565
590
|
super(id, annotationMap);
|
|
@@ -567,20 +592,30 @@ class RTEImageNode extends RTENode {
|
|
|
567
592
|
this.url = url;
|
|
568
593
|
this.parentBlock = parentBlock;
|
|
569
594
|
}
|
|
570
|
-
|
|
571
|
-
|
|
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);
|
|
572
604
|
let annotations;
|
|
573
|
-
if (!
|
|
605
|
+
if (!node.annotations || Object.keys(node.annotations).length === 0) {
|
|
574
606
|
annotations = { size: 'md' };
|
|
575
607
|
}
|
|
576
608
|
else {
|
|
577
|
-
annotations =
|
|
609
|
+
annotations = node.annotations;
|
|
578
610
|
}
|
|
579
611
|
imageNode.annotationMap = new Map(Object.keys(annotations)
|
|
580
612
|
.map(() => ImageAnnotation.from(annotations.size, annotations.alt))
|
|
581
613
|
.filter(isNonNullable));
|
|
582
614
|
return imageNode;
|
|
583
615
|
}
|
|
616
|
+
/**
|
|
617
|
+
* @inheritDoc
|
|
618
|
+
*/
|
|
584
619
|
toJSON() {
|
|
585
620
|
const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
|
|
586
621
|
const annotations = {};
|
|
@@ -592,55 +627,20 @@ class RTEImageNode extends RTENode {
|
|
|
592
627
|
}
|
|
593
628
|
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
|
|
594
629
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
const alt = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt;
|
|
599
|
-
const handleChange = ({ detail, }) => {
|
|
600
|
-
switch (detail.action) {
|
|
601
|
-
case 'edit': {
|
|
602
|
-
const size = detail.payload.size;
|
|
603
|
-
const alt = detail.payload.alt;
|
|
604
|
-
this.apply(new ImageAnnotationAction(size, alt));
|
|
605
|
-
break;
|
|
606
|
-
}
|
|
607
|
-
/*
|
|
608
|
-
* The below method is e2e-test covered in
|
|
609
|
-
* @see{module:vega-rich-text-editor-image-click-delete-button}
|
|
610
|
-
*/
|
|
611
|
-
/* istanbul ignore next */
|
|
612
|
-
case 'delete': {
|
|
613
|
-
const event = new InputEvent('beforeinput', {
|
|
614
|
-
inputType: 'deleteContentBackward',
|
|
615
|
-
bubbles: true,
|
|
616
|
-
});
|
|
617
|
-
setTimeout(() => {
|
|
618
|
-
stateEntityRenderingRegistry.getDOMByEntity(this).dispatchEvent(event);
|
|
619
|
-
}, 50);
|
|
620
|
-
break;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
return editable ? (h("vega-rich-text-image-editor", { style: this.getStyles(), size: size, alt: alt, ref: (ref) => {
|
|
625
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, handleChange);
|
|
626
|
-
} }, this.renderImage(editable, alt))) : (this.renderImage(editable, alt));
|
|
627
|
-
}
|
|
630
|
+
/**
|
|
631
|
+
* @inheritDoc
|
|
632
|
+
*/
|
|
628
633
|
doAnnotationActionApply(action) {
|
|
629
634
|
const annotation = action.toAnnotation();
|
|
630
635
|
this.annotationMap.set(annotation.type, annotation);
|
|
631
636
|
}
|
|
632
637
|
// placeholder method
|
|
633
638
|
/* istanbul ignore next */
|
|
639
|
+
/**
|
|
640
|
+
* @inheritDoc
|
|
641
|
+
*/
|
|
634
642
|
doModifyActionApply(action) {
|
|
635
643
|
}
|
|
636
|
-
registerRef(ref) {
|
|
637
|
-
if (ref) {
|
|
638
|
-
stateEntityRenderingRegistry.register(ref, this);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
renderImage(editable, alt) {
|
|
642
|
-
return (h("img", { style: editable ? { width: '100%' } : this.getStyles(), alt: alt, src: this.url, ref: this.registerRef.bind(this) }));
|
|
643
|
-
}
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
/**
|
|
@@ -668,20 +668,845 @@ class InsertBlocksAfterAction extends ModifyContentAction {
|
|
|
668
668
|
this.referBlock = referBlock;
|
|
669
669
|
this.blocksToBeInserted = blocksToBeInserted;
|
|
670
670
|
}
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* Split the block with a split point node.
|
|
675
|
-
* The property `newBlock` use to store the new create block if need.
|
|
676
|
-
*
|
|
677
|
-
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
678
|
-
*/
|
|
679
|
-
class SplitBlockWithNodeAction extends ModifyContentAction {
|
|
680
|
-
constructor(splitPointNode, startOffsetOfNode) {
|
|
681
|
-
super();
|
|
682
|
-
this.type = ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
|
|
683
|
-
this.splitPointNode = splitPointNode;
|
|
684
|
-
this.startOffsetOfNode = startOffsetOfNode;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Split the block with a split point node.
|
|
675
|
+
* The property `newBlock` use to store the new create block if need.
|
|
676
|
+
*
|
|
677
|
+
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
678
|
+
*/
|
|
679
|
+
class SplitBlockWithNodeAction extends ModifyContentAction {
|
|
680
|
+
constructor(splitPointNode, startOffsetOfNode) {
|
|
681
|
+
super();
|
|
682
|
+
this.type = ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
|
|
683
|
+
this.splitPointNode = splitPointNode;
|
|
684
|
+
this.startOffsetOfNode = startOffsetOfNode;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
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];
|
|
685
1510
|
}
|
|
686
1511
|
}
|
|
687
1512
|
|
|
@@ -827,6 +1652,12 @@ class RTETextBlock extends RTEBlock {
|
|
|
827
1652
|
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
828
1653
|
}
|
|
829
1654
|
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Converts a VegaRTETextBlock into an RTETextBlock.
|
|
1657
|
+
*
|
|
1658
|
+
* @param {VegaRTETextBlock} block - The block object
|
|
1659
|
+
* @returns {RTETextBlock} A RTETextBlock class
|
|
1660
|
+
*/
|
|
830
1661
|
static from(block) {
|
|
831
1662
|
const textBlock = new RTETextBlock(block.id, block.type);
|
|
832
1663
|
const { annotations } = block;
|
|
@@ -861,9 +1692,20 @@ class RTETextBlock extends RTEBlock {
|
|
|
861
1692
|
return super.createAnnotationEntity(type, value);
|
|
862
1693
|
}
|
|
863
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
|
+
*/
|
|
864
1701
|
static isAcceptableTextStyle(type) {
|
|
865
1702
|
return ['title', 'subtitle', 'paragraph', 'heading-1', 'heading-2', 'heading-3'].includes(type);
|
|
866
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Merges RTETextNode nodes based on certain conditions.
|
|
1706
|
+
*
|
|
1707
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
1708
|
+
*/
|
|
867
1709
|
mergeNodes(action) {
|
|
868
1710
|
this.nodes = this.nodes.reduce((prev, cur) => {
|
|
869
1711
|
const lastNode = prev.at(-1);
|
|
@@ -880,38 +1722,39 @@ class RTETextBlock extends RTEBlock {
|
|
|
880
1722
|
return [...prev, cur];
|
|
881
1723
|
}, []);
|
|
882
1724
|
}
|
|
1725
|
+
/**
|
|
1726
|
+
* @inheritDoc
|
|
1727
|
+
*/
|
|
883
1728
|
toJSON() {
|
|
884
1729
|
return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
|
|
885
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
|
+
*/
|
|
886
1737
|
cloneWithNodes(nodes) {
|
|
887
1738
|
const block = new RTETextBlock(generateUUID(), this.type);
|
|
888
1739
|
block.nodes = [];
|
|
889
1740
|
block.apply(new AppendChildNodesAction(nodes));
|
|
890
1741
|
return block;
|
|
891
1742
|
}
|
|
1743
|
+
/**
|
|
1744
|
+
* @inheritDoc
|
|
1745
|
+
*/
|
|
892
1746
|
isNotEmpty() {
|
|
893
1747
|
return this.nodes.length > 0 && this.nodes.some((node) => !node.isEmpty());
|
|
894
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* @inheritDoc
|
|
1751
|
+
*/
|
|
895
1752
|
getLastNode() {
|
|
896
1753
|
return this.nodes[this.nodes.length - 1];
|
|
897
1754
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
this.renderNodes(renderContext),
|
|
902
|
-
children));
|
|
903
|
-
}
|
|
904
|
-
registerRef(ref) {
|
|
905
|
-
if (ref) {
|
|
906
|
-
stateEntityRenderingRegistry.register(ref, this);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
renderNodes(renderConfig = {}) {
|
|
910
|
-
const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
911
|
-
return linkGroupAnnotation
|
|
912
|
-
? linkGroupAnnotation.renderNodes(this.nodes, renderConfig)
|
|
913
|
-
: this.nodes.map((node) => node.render());
|
|
914
|
-
}
|
|
1755
|
+
/**
|
|
1756
|
+
* @inheritDoc
|
|
1757
|
+
*/
|
|
915
1758
|
doAnnotationActionApply(action) {
|
|
916
1759
|
if (action instanceof TextStyleAnnotationAction) {
|
|
917
1760
|
if (this.type !== 'list-item') {
|
|
@@ -993,6 +1836,13 @@ class RTETextBlock extends RTEBlock {
|
|
|
993
1836
|
break;
|
|
994
1837
|
}
|
|
995
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
|
+
*/
|
|
996
1846
|
splitTextNodeBlock(splitNode, startOffsetOfNode) {
|
|
997
1847
|
if (splitNode) {
|
|
998
1848
|
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
@@ -1014,13 +1864,34 @@ class RTETextBlock extends RTEBlock {
|
|
|
1014
1864
|
}
|
|
1015
1865
|
}
|
|
1016
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
|
+
*/
|
|
1017
1874
|
isCaretPositionAtStart(node, startOffset) {
|
|
1018
1875
|
return node === this.nodes[0] && startOffset === 0;
|
|
1019
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
|
+
*/
|
|
1020
1884
|
isCaretPositionAtEnd(node, startOffset) {
|
|
1021
1885
|
const lastNode = this.nodes[this.nodes.length - 1];
|
|
1022
1886
|
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
1023
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* lineBreakSingleBlock
|
|
1890
|
+
*
|
|
1891
|
+
* @param {RTETextNode} splitNode -
|
|
1892
|
+
* @param {number} startOffsetOfNode -
|
|
1893
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
1894
|
+
*/
|
|
1024
1895
|
lineBreakSingleBlock(splitNode, startOffsetOfNode) {
|
|
1025
1896
|
if (splitNode) {
|
|
1026
1897
|
const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
|
|
@@ -1041,6 +1912,12 @@ class RTETextBlock extends RTEBlock {
|
|
|
1041
1912
|
return lineBreakNode;
|
|
1042
1913
|
}
|
|
1043
1914
|
}
|
|
1915
|
+
/**
|
|
1916
|
+
* lineBreakMultipleBlocks
|
|
1917
|
+
*
|
|
1918
|
+
* @param {RTEBlock[]} selectedBlocks -
|
|
1919
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
1920
|
+
*/
|
|
1044
1921
|
lineBreakMultipleBlocks(selectedBlocks) {
|
|
1045
1922
|
const beforeNodes = this['nodes'];
|
|
1046
1923
|
const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
|
|
@@ -1048,6 +1925,11 @@ class RTETextBlock extends RTEBlock {
|
|
|
1048
1925
|
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
|
|
1049
1926
|
return lineBreakNode;
|
|
1050
1927
|
}
|
|
1928
|
+
/**
|
|
1929
|
+
* deleteNodeContent
|
|
1930
|
+
*
|
|
1931
|
+
* @param {DeleteBlockContentAction} action - ModifyContentAction
|
|
1932
|
+
*/
|
|
1051
1933
|
deleteNodeContent(action) {
|
|
1052
1934
|
const startContainerNode = action.startContainerNode;
|
|
1053
1935
|
const startOffset = action.startOffset;
|
|
@@ -1089,6 +1971,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
1089
1971
|
}
|
|
1090
1972
|
/**
|
|
1091
1973
|
* Remove line break
|
|
1974
|
+
*
|
|
1092
1975
|
* @example caret at the first line
|
|
1093
1976
|
* \n
|
|
1094
1977
|
* test
|
|
@@ -1098,6 +1981,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
1098
1981
|
}
|
|
1099
1982
|
/**
|
|
1100
1983
|
* Remove line break
|
|
1984
|
+
*
|
|
1101
1985
|
* @example caret at the begin of second line
|
|
1102
1986
|
* \n
|
|
1103
1987
|
* test
|
|
@@ -1123,35 +2007,37 @@ class RTETextBlock extends RTEBlock {
|
|
|
1123
2007
|
}
|
|
1124
2008
|
}
|
|
1125
2009
|
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Remove the child node
|
|
2012
|
+
*
|
|
2013
|
+
* @param {RemoveChildAction} action - Modify action
|
|
2014
|
+
*/
|
|
1126
2015
|
removeChildNode(action) {
|
|
1127
2016
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1128
2017
|
if (this.nodes.length === 0) {
|
|
1129
2018
|
this.parent.apply(new RemoveChildAction(this));
|
|
1130
2019
|
}
|
|
1131
2020
|
}
|
|
2021
|
+
/**
|
|
2022
|
+
* mergeLineBreakNodes
|
|
2023
|
+
*
|
|
2024
|
+
* @param {RTENode[]} beforeNodes -
|
|
2025
|
+
* @param {RTETextNode} lineBreakNode -
|
|
2026
|
+
* @param {RTENode[]} afterNodes -
|
|
2027
|
+
*/
|
|
1132
2028
|
mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes) {
|
|
1133
2029
|
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
1134
2030
|
afterNodes.push(new RTETextNode(generateUUID(), '\n', this, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
|
|
1135
2031
|
}
|
|
1136
2032
|
this.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
|
|
1137
2033
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
case 'heading-2':
|
|
1146
|
-
return `h2`;
|
|
1147
|
-
case 'heading-3':
|
|
1148
|
-
return `h3`;
|
|
1149
|
-
case 'paragraph':
|
|
1150
|
-
return 'p';
|
|
1151
|
-
case 'list-item':
|
|
1152
|
-
return 'li';
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
2034
|
+
/**
|
|
2035
|
+
* breakSingleTextBlock
|
|
2036
|
+
*
|
|
2037
|
+
* @param {RTETextNode} splitNode -
|
|
2038
|
+
* @param {number} startOffsetOfNode -
|
|
2039
|
+
* @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
|
|
2040
|
+
*/
|
|
1155
2041
|
breakSingleTextBlock(splitNode, startOffsetOfNode) {
|
|
1156
2042
|
const newParagraph = this.copyInlineStyleToNewParagraph(splitNode);
|
|
1157
2043
|
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
@@ -1167,6 +2053,11 @@ class RTETextBlock extends RTEBlock {
|
|
|
1167
2053
|
}
|
|
1168
2054
|
return newParagraph;
|
|
1169
2055
|
}
|
|
2056
|
+
/**
|
|
2057
|
+
* convertParagraphToList
|
|
2058
|
+
*
|
|
2059
|
+
* @param {TransformListAction} action - ModifyContentAction
|
|
2060
|
+
*/
|
|
1170
2061
|
convertParagraphToList(action) {
|
|
1171
2062
|
const bulletList = this.parent.createList(action.listType);
|
|
1172
2063
|
const listItems = action.selectedBlocks.map((node) => this.parent.toListItem(node));
|
|
@@ -1176,6 +2067,11 @@ class RTETextBlock extends RTEBlock {
|
|
|
1176
2067
|
node.parent.apply(new RemoveChildAction(node));
|
|
1177
2068
|
});
|
|
1178
2069
|
}
|
|
2070
|
+
/**
|
|
2071
|
+
* insertImage
|
|
2072
|
+
*
|
|
2073
|
+
* @param {InsertImageToBlockAction} action - ModifyContentAction
|
|
2074
|
+
*/
|
|
1179
2075
|
insertImage(action) {
|
|
1180
2076
|
const splitNode = action.splitPointNode;
|
|
1181
2077
|
const startOffsetOfNode = action.startOffsetOfNode;
|
|
@@ -1192,6 +2088,12 @@ class RTETextBlock extends RTEBlock {
|
|
|
1192
2088
|
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
1193
2089
|
}
|
|
1194
2090
|
}
|
|
2091
|
+
/**
|
|
2092
|
+
* copyInlineStyleToNewParagraph
|
|
2093
|
+
*
|
|
2094
|
+
* @param {RTETextNode} needCopedNode -
|
|
2095
|
+
* @returns {RTETextBlock} RTETextBlock
|
|
2096
|
+
*/
|
|
1195
2097
|
copyInlineStyleToNewParagraph(needCopedNode) {
|
|
1196
2098
|
const textNode = needCopedNode.cloneWithText('');
|
|
1197
2099
|
// The link annotation don't need inherited
|
|
@@ -1211,6 +2113,12 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1211
2113
|
this.type = 'image';
|
|
1212
2114
|
this.nodes = [];
|
|
1213
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
|
+
*/
|
|
1214
2122
|
static from(block) {
|
|
1215
2123
|
const imageBlock = new RTEImageBlock(block.id);
|
|
1216
2124
|
const { annotations } = block;
|
|
@@ -1225,22 +2133,26 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1225
2133
|
}
|
|
1226
2134
|
return imageBlock;
|
|
1227
2135
|
}
|
|
2136
|
+
/**
|
|
2137
|
+
* @inheritDoc
|
|
2138
|
+
*/
|
|
1228
2139
|
toJSON() {
|
|
1229
2140
|
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1230
2141
|
}
|
|
2142
|
+
/**
|
|
2143
|
+
* @inheritDoc
|
|
2144
|
+
*/
|
|
1231
2145
|
isNotEmpty() {
|
|
1232
2146
|
return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
|
|
1233
2147
|
}
|
|
2148
|
+
/**
|
|
2149
|
+
* @inheritDoc
|
|
2150
|
+
*/
|
|
1234
2151
|
getLastNode() {
|
|
1235
2152
|
return this.nodes[this.nodes.length - 1];
|
|
1236
2153
|
}
|
|
1237
|
-
render(renderContext) {
|
|
1238
|
-
return (h("div", { style: Object.assign({}, this.getStyles()), ref: this.registerRef.bind(this), class: super.getClasses() }, this.nodes.map((node) => {
|
|
1239
|
-
return node.render(renderContext);
|
|
1240
|
-
})));
|
|
1241
|
-
}
|
|
1242
2154
|
/**
|
|
1243
|
-
* Apply modify action to block
|
|
2155
|
+
* Apply a modify action to block
|
|
1244
2156
|
*
|
|
1245
2157
|
* @param {ModifyContentAction} action - Modify action
|
|
1246
2158
|
*/
|
|
@@ -1294,11 +2206,11 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1294
2206
|
break;
|
|
1295
2207
|
}
|
|
1296
2208
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
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
|
+
*/
|
|
1302
2214
|
removeChildNode(action) {
|
|
1303
2215
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1304
2216
|
if (this.nodes.length === 0) {
|
|
@@ -1311,6 +2223,7 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1311
2223
|
*
|
|
1312
2224
|
* @param {RTEImageNode} imageNode The split point image node
|
|
1313
2225
|
* @param {number} imageOffset The cursor point 0 | 1
|
|
2226
|
+
* @returns {Nullable<RTEBlock>} The new block after split
|
|
1314
2227
|
*/
|
|
1315
2228
|
splitImageNodes(imageNode, imageOffset) {
|
|
1316
2229
|
const nodesSplitIndex = this.nodes.indexOf(imageNode);
|
|
@@ -1323,12 +2236,25 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1323
2236
|
return newBlock;
|
|
1324
2237
|
}
|
|
1325
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
|
+
*/
|
|
1326
2245
|
cloneWithNodes(nodes) {
|
|
1327
2246
|
const block = new RTEImageBlock(generateUUID());
|
|
1328
2247
|
block.nodes = [];
|
|
1329
2248
|
block.apply(new AppendChildNodesAction(nodes));
|
|
1330
2249
|
return block;
|
|
1331
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
|
+
*/
|
|
1332
2258
|
breakSingleBlock(splitNode, startOffsetOfNode) {
|
|
1333
2259
|
const newParagraph = RTETextBlock.from({
|
|
1334
2260
|
id: generateUUID(),
|
|
@@ -1348,19 +2274,46 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1348
2274
|
}
|
|
1349
2275
|
return newParagraph;
|
|
1350
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
|
+
*/
|
|
1351
2284
|
lineBreakSingleBlock(splitNode, startOffset) {
|
|
1352
2285
|
const newParagraph = this.breakSingleBlock(splitNode, startOffset);
|
|
1353
2286
|
if (newParagraph) {
|
|
1354
2287
|
return newParagraph['nodes'][0];
|
|
1355
2288
|
}
|
|
1356
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
|
+
*/
|
|
1357
2297
|
isCaretPositionAtStart(node, startOffset) {
|
|
1358
2298
|
return node === this.nodes[0] && startOffset === 0;
|
|
1359
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
|
+
*/
|
|
1360
2307
|
isCaretPositionAtEnd(node, startOffset) {
|
|
1361
2308
|
const lastNode = this.nodes[this.nodes.length - 1];
|
|
1362
2309
|
return node === lastNode && startOffset === 1;
|
|
1363
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
|
+
*/
|
|
1364
2317
|
lineBreakMultipleBlocks(selectedBlocks) {
|
|
1365
2318
|
const newParagraph = RTETextBlock.from({
|
|
1366
2319
|
id: generateUUID(),
|
|
@@ -1375,6 +2328,11 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1375
2328
|
newParagraph.apply(new AppendChildNodesAction(afterNodes));
|
|
1376
2329
|
return newParagraph['nodes'][0];
|
|
1377
2330
|
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Deletes content from a block node based on specific conditions.
|
|
2333
|
+
*
|
|
2334
|
+
* @param {DeleteBlockContentAction} action - Delete block content action
|
|
2335
|
+
*/
|
|
1378
2336
|
deleteNodeContent(action) {
|
|
1379
2337
|
const startContainerNode = action
|
|
1380
2338
|
.startContainerNode, startOffset = action.startOffset;
|
|
@@ -1435,12 +2393,21 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1435
2393
|
}
|
|
1436
2394
|
}
|
|
1437
2395
|
|
|
2396
|
+
/**
|
|
2397
|
+
* List item block
|
|
2398
|
+
*/
|
|
1438
2399
|
class RTEListItemBlock extends RTETextBlock {
|
|
1439
2400
|
constructor(id, children) {
|
|
1440
2401
|
super(id, 'list-item');
|
|
1441
2402
|
this.children = [];
|
|
1442
2403
|
this.children = children;
|
|
1443
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
|
+
*/
|
|
1444
2411
|
static from(block) {
|
|
1445
2412
|
const listItemBlock = new RTEListItemBlock(block.id);
|
|
1446
2413
|
listItemBlock.nodes = block.nodes.map((richText) => RTETextNode.from(richText, listItemBlock));
|
|
@@ -1462,16 +2429,25 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1462
2429
|
}
|
|
1463
2430
|
return listItemBlock;
|
|
1464
2431
|
}
|
|
2432
|
+
/**
|
|
2433
|
+
* @inheritDoc
|
|
2434
|
+
*/
|
|
1465
2435
|
toJSON() {
|
|
1466
2436
|
var _a;
|
|
1467
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()) });
|
|
1468
2438
|
}
|
|
2439
|
+
/**
|
|
2440
|
+
* @inheritDoc
|
|
2441
|
+
*/
|
|
1469
2442
|
cloneWithNodes(nodes) {
|
|
1470
2443
|
const block = new RTEListItemBlock(generateUUID());
|
|
1471
2444
|
block.nodes = [];
|
|
1472
2445
|
block.apply(new AppendChildNodesAction(nodes));
|
|
1473
2446
|
return block;
|
|
1474
2447
|
}
|
|
2448
|
+
/**
|
|
2449
|
+
* @inheritDoc
|
|
2450
|
+
*/
|
|
1475
2451
|
isNotEmpty() {
|
|
1476
2452
|
if (this.children) {
|
|
1477
2453
|
return super.isNotEmpty() || this.children.some((block) => block.isNotEmpty());
|
|
@@ -1480,6 +2456,9 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1480
2456
|
return super.isNotEmpty();
|
|
1481
2457
|
}
|
|
1482
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* @inheritDoc
|
|
2461
|
+
*/
|
|
1483
2462
|
getLastNode() {
|
|
1484
2463
|
if (this.children && this.children.length > 0) {
|
|
1485
2464
|
const childListBlock = this.children[this.children.length - 1];
|
|
@@ -1487,9 +2466,6 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1487
2466
|
}
|
|
1488
2467
|
return super.getLastNode();
|
|
1489
2468
|
}
|
|
1490
|
-
render(renderContext) {
|
|
1491
|
-
return super.render(renderContext, this.renderChildren(renderContext));
|
|
1492
|
-
}
|
|
1493
2469
|
/**
|
|
1494
2470
|
* Apply a modify action to block
|
|
1495
2471
|
*
|
|
@@ -1545,16 +2521,22 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1545
2521
|
break;
|
|
1546
2522
|
}
|
|
1547
2523
|
}
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
2524
|
+
/**
|
|
2525
|
+
* Remove the list child node
|
|
2526
|
+
*
|
|
2527
|
+
* @param {RemoveChildAction} action - Modify action
|
|
2528
|
+
*/
|
|
1552
2529
|
removeListChildNode(action) {
|
|
1553
2530
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1554
2531
|
if (this.nodes.length === 0 && (!this.children || !this.children.length)) {
|
|
1555
2532
|
this.parent.apply(new RemoveChildAction(this));
|
|
1556
2533
|
}
|
|
1557
2534
|
}
|
|
2535
|
+
/**
|
|
2536
|
+
* Remove the nest list
|
|
2537
|
+
*
|
|
2538
|
+
* @param {RemoveNestListAction} action - Modify action
|
|
2539
|
+
*/
|
|
1558
2540
|
removeNestList(action) {
|
|
1559
2541
|
if (this.children) {
|
|
1560
2542
|
if (this.children.length > 1) {
|
|
@@ -1565,15 +2547,34 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1565
2547
|
}
|
|
1566
2548
|
}
|
|
1567
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
|
+
*/
|
|
1568
2555
|
replaceNestList(newList) {
|
|
1569
2556
|
newList.forEach((listBlock) => {
|
|
1570
2557
|
listBlock.parent = this;
|
|
1571
2558
|
});
|
|
1572
2559
|
this.children = newList;
|
|
1573
2560
|
}
|
|
2561
|
+
/**
|
|
2562
|
+
* Split list item block
|
|
2563
|
+
*
|
|
2564
|
+
* @param {SplitBlockWithNodeAction} action - Modify action
|
|
2565
|
+
*/
|
|
1574
2566
|
splitListItemBlock(action) {
|
|
1575
2567
|
action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode);
|
|
1576
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
|
+
*/
|
|
1577
2578
|
breakSingleListItemBlock(splitNode, startOffsetOfNode) {
|
|
1578
2579
|
const newListItem = new RTEListItemBlock(generateUUID());
|
|
1579
2580
|
const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
|
|
@@ -1591,6 +2592,12 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1591
2592
|
}
|
|
1592
2593
|
return newListItem;
|
|
1593
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
|
+
*/
|
|
1594
2601
|
breakListItemAtEnd(newListItem) {
|
|
1595
2602
|
const lastItem = this.parent.blocks[this.parent.blocks.length - 1];
|
|
1596
2603
|
const currentItemIsEmpty = this.nodes.length === 1 && this.nodes[0].isEmpty();
|
|
@@ -1617,6 +2624,11 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1617
2624
|
}
|
|
1618
2625
|
return newListItem;
|
|
1619
2626
|
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Delete list node content
|
|
2629
|
+
*
|
|
2630
|
+
* @param {DeleteBlockContentAction} action - Modify action
|
|
2631
|
+
*/
|
|
1620
2632
|
deleteListNodeContent(action) {
|
|
1621
2633
|
const startContainerNode = action.startContainerNode;
|
|
1622
2634
|
const listBlock = startContainerNode.parentBlock.parent;
|
|
@@ -1625,9 +2637,15 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
1625
2637
|
listBlock.parent.apply(new RemoveChildAction(listBlock));
|
|
1626
2638
|
}
|
|
1627
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
|
+
*/
|
|
1628
2646
|
copyInlineStyleToNewNode(needCopedNode) {
|
|
1629
2647
|
const textNode = needCopedNode.cloneWithText('');
|
|
1630
|
-
// The link annotation
|
|
2648
|
+
// The link annotation doesn't need to inherit
|
|
1631
2649
|
textNode.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
1632
2650
|
return textNode;
|
|
1633
2651
|
}
|
|
@@ -1646,6 +2664,9 @@ class RemoveNestListAction extends ModifyContentAction {
|
|
|
1646
2664
|
}
|
|
1647
2665
|
}
|
|
1648
2666
|
|
|
2667
|
+
/**
|
|
2668
|
+
* List block
|
|
2669
|
+
*/
|
|
1649
2670
|
class RTEListBlock extends RTEBlock {
|
|
1650
2671
|
constructor(id, type) {
|
|
1651
2672
|
super(id);
|
|
@@ -1653,6 +2674,12 @@ class RTEListBlock extends RTEBlock {
|
|
|
1653
2674
|
this.blocks = [];
|
|
1654
2675
|
this.type = type;
|
|
1655
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
|
+
*/
|
|
1656
2683
|
static from(block) {
|
|
1657
2684
|
const listBlock = new RTEListBlock(block.id, block.type);
|
|
1658
2685
|
listBlock.blocks = block.blocks.map((item) => {
|
|
@@ -1662,20 +2689,25 @@ class RTEListBlock extends RTEBlock {
|
|
|
1662
2689
|
});
|
|
1663
2690
|
return listBlock;
|
|
1664
2691
|
}
|
|
2692
|
+
/**
|
|
2693
|
+
* @inheritDoc
|
|
2694
|
+
*/
|
|
1665
2695
|
toJSON() {
|
|
1666
2696
|
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
1667
2697
|
}
|
|
2698
|
+
/**
|
|
2699
|
+
* @inheritDoc
|
|
2700
|
+
*/
|
|
1668
2701
|
isNotEmpty() {
|
|
1669
2702
|
return (this.blocks.length > 0 &&
|
|
1670
2703
|
this.blocks.some((listItemBlock) => listItemBlock.isNotEmpty()));
|
|
1671
2704
|
}
|
|
2705
|
+
/**
|
|
2706
|
+
* @inheritDoc
|
|
2707
|
+
*/
|
|
1672
2708
|
getLastNode() {
|
|
1673
2709
|
return this.blocks[this.blocks.length - 1].getLastNode();
|
|
1674
2710
|
}
|
|
1675
|
-
render(renderContext) {
|
|
1676
|
-
const BlockTag = this.type === 'number-list' ? 'ol' : 'ul';
|
|
1677
|
-
return (h(BlockTag, { ref: this.registerRef.bind(this) }, this.blocks.map((block) => block.render(renderContext))));
|
|
1678
|
-
}
|
|
1679
2711
|
/**
|
|
1680
2712
|
* Apply a modify action to block
|
|
1681
2713
|
*
|
|
@@ -1712,17 +2744,23 @@ class RTEListBlock extends RTEBlock {
|
|
|
1712
2744
|
break;
|
|
1713
2745
|
}
|
|
1714
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
|
+
*/
|
|
1715
2753
|
toParagraph(block) {
|
|
1716
2754
|
const textBlock = new RTETextBlock(generateUUID(), 'paragraph');
|
|
1717
2755
|
textBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
1718
2756
|
textBlock['annotationMap'] = block['annotationMap'];
|
|
1719
2757
|
return textBlock;
|
|
1720
2758
|
}
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
2759
|
+
/**
|
|
2760
|
+
* Covert block to List
|
|
2761
|
+
*
|
|
2762
|
+
* @param {TransformListAction} action - Modify action
|
|
2763
|
+
*/
|
|
1726
2764
|
convertToList(action) {
|
|
1727
2765
|
const selectedBlocks = action.selectedBlocks;
|
|
1728
2766
|
const bulletList = this.parent.createList(action.listType);
|
|
@@ -1746,6 +2784,11 @@ class RTEListBlock extends RTEBlock {
|
|
|
1746
2784
|
}
|
|
1747
2785
|
}
|
|
1748
2786
|
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Covert block to paragraph
|
|
2789
|
+
*
|
|
2790
|
+
* @param {TransformListAction} action - Modify action
|
|
2791
|
+
*/
|
|
1749
2792
|
convertToParagraph(action) {
|
|
1750
2793
|
let isSelectedFirstBlock = false;
|
|
1751
2794
|
let isSelectedLastBlock = false;
|
|
@@ -1781,6 +2824,11 @@ class RTEListBlock extends RTEBlock {
|
|
|
1781
2824
|
this.parent.apply(new RemoveChildAction(this));
|
|
1782
2825
|
}
|
|
1783
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
|
+
*/
|
|
1784
2832
|
insertImage(action) {
|
|
1785
2833
|
const imageBlock = action.imageBlockToBeInserted;
|
|
1786
2834
|
if (this.parent['type'] !== 'list-item') {
|
|
@@ -1790,10 +2838,15 @@ class RTEListBlock extends RTEBlock {
|
|
|
1790
2838
|
this.parent.apply(action);
|
|
1791
2839
|
}
|
|
1792
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
|
+
*/
|
|
1793
2846
|
removeListItemBlock(blockToBeRemoved) {
|
|
1794
2847
|
super.removeChildBlock(blockToBeRemoved);
|
|
1795
2848
|
if (this.blocks.length === 0 && this.parent) {
|
|
1796
|
-
// 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
|
|
1797
2850
|
if (this.parent instanceof RTEListItemBlock) {
|
|
1798
2851
|
this.parent.apply(new RemoveNestListAction(this));
|
|
1799
2852
|
}
|
|
@@ -1804,131 +2857,4 @@ class RTEListBlock extends RTEBlock {
|
|
|
1804
2857
|
}
|
|
1805
2858
|
}
|
|
1806
2859
|
|
|
1807
|
-
|
|
1808
|
-
* Class representing the content state of the rich text editor.
|
|
1809
|
-
*/
|
|
1810
|
-
class VegaRTEContent extends BlockBaseOperator {
|
|
1811
|
-
constructor(blocks) {
|
|
1812
|
-
super();
|
|
1813
|
-
blocks.forEach((block) => {
|
|
1814
|
-
block.parent = this;
|
|
1815
|
-
});
|
|
1816
|
-
this.blocks = blocks;
|
|
1817
|
-
}
|
|
1818
|
-
/**
|
|
1819
|
-
* Converts a JSON array of blocks to a class array of RTEContentBlock.
|
|
1820
|
-
*
|
|
1821
|
-
* @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
|
|
1822
|
-
* @returns {RTEContentBlock[]} The converted array of RTEContentBlock.
|
|
1823
|
-
*/
|
|
1824
|
-
static fromJSON(value) {
|
|
1825
|
-
const blocks = value.map((block) => {
|
|
1826
|
-
switch (block.type) {
|
|
1827
|
-
case 'paragraph':
|
|
1828
|
-
case 'title':
|
|
1829
|
-
case 'subtitle':
|
|
1830
|
-
case 'heading-1':
|
|
1831
|
-
case 'heading-2':
|
|
1832
|
-
case 'heading-3': {
|
|
1833
|
-
return RTETextBlock.from(block);
|
|
1834
|
-
}
|
|
1835
|
-
case 'image':
|
|
1836
|
-
return RTEImageBlock.from(block);
|
|
1837
|
-
case 'bullet-list':
|
|
1838
|
-
case 'number-list':
|
|
1839
|
-
return RTEListBlock.from(block);
|
|
1840
|
-
default: {
|
|
1841
|
-
throw new Error(`[Vega] Unknown block type: ${block.type}`);
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
});
|
|
1845
|
-
return new VegaRTEContent(blocks);
|
|
1846
|
-
}
|
|
1847
|
-
/**
|
|
1848
|
-
* Create an empty content state
|
|
1849
|
-
*
|
|
1850
|
-
* @returns {VegaRTEContent} An empty content state
|
|
1851
|
-
*/
|
|
1852
|
-
static createEmptyContent() {
|
|
1853
|
-
return VegaRTEContent.fromJSON([
|
|
1854
|
-
{
|
|
1855
|
-
id: generateUUID(),
|
|
1856
|
-
type: 'paragraph',
|
|
1857
|
-
nodes: [
|
|
1858
|
-
{
|
|
1859
|
-
id: generateUUID(),
|
|
1860
|
-
type: 'text',
|
|
1861
|
-
text: '',
|
|
1862
|
-
},
|
|
1863
|
-
],
|
|
1864
|
-
},
|
|
1865
|
-
]);
|
|
1866
|
-
}
|
|
1867
|
-
/**
|
|
1868
|
-
* Clones the content state.
|
|
1869
|
-
*
|
|
1870
|
-
* @returns {VegaRTEContent} The cloned content state.
|
|
1871
|
-
*/
|
|
1872
|
-
clone() {
|
|
1873
|
-
return new VegaRTEContent([...this.blocks]);
|
|
1874
|
-
}
|
|
1875
|
-
/**
|
|
1876
|
-
* Converts the content state to a JSON array of blocks.
|
|
1877
|
-
*
|
|
1878
|
-
* @returns {VegaRTEContentBlock[]} The JSON array of blocks.
|
|
1879
|
-
*/
|
|
1880
|
-
toJSON() {
|
|
1881
|
-
return this.blocks.map((block) => block.toJSON());
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Internal method to add the block item, remove the block item
|
|
1885
|
-
*
|
|
1886
|
-
* @param {ModifyContentAction} action - Modify content action
|
|
1887
|
-
*/
|
|
1888
|
-
apply(action) {
|
|
1889
|
-
switch (action.type) {
|
|
1890
|
-
case ModifyContentActionType.DELETE_CHILD:
|
|
1891
|
-
this.removeChildBlock(action.entityToBeRemoved);
|
|
1892
|
-
break;
|
|
1893
|
-
case ModifyContentActionType.APPEND_CHILD_NODES:
|
|
1894
|
-
this.appendChildBlocks(action.entityToBeAppended);
|
|
1895
|
-
break;
|
|
1896
|
-
case ModifyContentActionType.INSERT_BLOCKS_AFTER:
|
|
1897
|
-
this.replaceBlockWithBlocks(action.referBlock, [
|
|
1898
|
-
action.referBlock,
|
|
1899
|
-
...action.blocksToBeInserted,
|
|
1900
|
-
]);
|
|
1901
|
-
break;
|
|
1902
|
-
case ModifyContentActionType.INSERT_BLOCKS_BEFORE:
|
|
1903
|
-
this.replaceBlockWithBlocks(action.referBlock, [
|
|
1904
|
-
...action.blocksToBeInserted,
|
|
1905
|
-
action.referBlock,
|
|
1906
|
-
]);
|
|
1907
|
-
break;
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
/**
|
|
1911
|
-
* Convert text to list.
|
|
1912
|
-
*
|
|
1913
|
-
* @param {RTETextBlock} block - block
|
|
1914
|
-
* @returns {RTEListItemBlock} list item block dto.
|
|
1915
|
-
*/
|
|
1916
|
-
toListItem(block) {
|
|
1917
|
-
block.nodes.map((node) => node.apply(new SyncUpSelectionAction()));
|
|
1918
|
-
const listItemBlock = new RTEListItemBlock(generateUUID());
|
|
1919
|
-
listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
1920
|
-
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
1921
|
-
return listItemBlock;
|
|
1922
|
-
}
|
|
1923
|
-
/**
|
|
1924
|
-
* create list.
|
|
1925
|
-
*
|
|
1926
|
-
* @param {ListType} type - type
|
|
1927
|
-
* @returns {RTEListBlock} list block dto.
|
|
1928
|
-
*/
|
|
1929
|
-
createList(type) {
|
|
1930
|
-
return new RTEListBlock(generateUUID(), type);
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
|
|
1934
|
-
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, RTEListBlock as g, RTEImageBlock 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 };
|