@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,6 +1,4 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
2
1
|
import { RTETextNode } from '../nodes/text-node';
|
|
3
|
-
import stateEntityRenderingRegistry from '../../slimmers/controllers/state-entity-rendering-registry';
|
|
4
2
|
import { isNonNullable } from '../../../../types/type-guard';
|
|
5
3
|
import { TextStyleAnnotation } from '../annotations/text-style-annotation';
|
|
6
4
|
import { ModifyContentActionType } from '../actions/modify-content-action.abstract';
|
|
@@ -36,6 +34,12 @@ export class RTETextBlock extends RTEBlock {
|
|
|
36
34
|
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Converts a VegaRTETextBlock into an RTETextBlock.
|
|
39
|
+
*
|
|
40
|
+
* @param {VegaRTETextBlock} block - The block object
|
|
41
|
+
* @returns {RTETextBlock} A RTETextBlock class
|
|
42
|
+
*/
|
|
39
43
|
static from(block) {
|
|
40
44
|
const textBlock = new RTETextBlock(block.id, block.type);
|
|
41
45
|
const { annotations } = block;
|
|
@@ -70,9 +74,20 @@ export class RTETextBlock extends RTEBlock {
|
|
|
70
74
|
return super.createAnnotationEntity(type, value);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Checks if a given text block type is one of the acceptable text styles.
|
|
79
|
+
*
|
|
80
|
+
* @param {VegaRTETextBlockType} type - The text block type
|
|
81
|
+
* @returns {boolean} Return a boolean value indicating whether the `type` parameter is valid.
|
|
82
|
+
*/
|
|
73
83
|
static isAcceptableTextStyle(type) {
|
|
74
84
|
return ['title', 'subtitle', 'paragraph', 'heading-1', 'heading-2', 'heading-3'].includes(type);
|
|
75
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Merges RTETextNode nodes based on certain conditions.
|
|
88
|
+
*
|
|
89
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
90
|
+
*/
|
|
76
91
|
mergeNodes(action) {
|
|
77
92
|
this.nodes = this.nodes.reduce((prev, cur) => {
|
|
78
93
|
const lastNode = prev.at(-1);
|
|
@@ -89,38 +104,39 @@ export class RTETextBlock extends RTEBlock {
|
|
|
89
104
|
return [...prev, cur];
|
|
90
105
|
}, []);
|
|
91
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* @inheritDoc
|
|
109
|
+
*/
|
|
92
110
|
toJSON() {
|
|
93
111
|
return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
|
|
94
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Clone the nodes to a new block
|
|
115
|
+
*
|
|
116
|
+
* @param {RTEBlock} nodes - The nodes will be copied
|
|
117
|
+
* @returns {RTEBlock} New block
|
|
118
|
+
*/
|
|
95
119
|
cloneWithNodes(nodes) {
|
|
96
120
|
const block = new RTETextBlock(generateUUID(), this.type);
|
|
97
121
|
block.nodes = [];
|
|
98
122
|
block.apply(new AppendChildNodesAction(nodes));
|
|
99
123
|
return block;
|
|
100
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* @inheritDoc
|
|
127
|
+
*/
|
|
101
128
|
isNotEmpty() {
|
|
102
129
|
return this.nodes.length > 0 && this.nodes.some((node) => !node.isEmpty());
|
|
103
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* @inheritDoc
|
|
133
|
+
*/
|
|
104
134
|
getLastNode() {
|
|
105
135
|
return this.nodes[this.nodes.length - 1];
|
|
106
136
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.renderNodes(renderContext),
|
|
111
|
-
children));
|
|
112
|
-
}
|
|
113
|
-
registerRef(ref) {
|
|
114
|
-
if (ref) {
|
|
115
|
-
stateEntityRenderingRegistry.register(ref, this);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
renderNodes(renderConfig = {}) {
|
|
119
|
-
const linkGroupAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
120
|
-
return linkGroupAnnotation
|
|
121
|
-
? linkGroupAnnotation.renderNodes(this.nodes, renderConfig)
|
|
122
|
-
: this.nodes.map((node) => node.render());
|
|
123
|
-
}
|
|
137
|
+
/**
|
|
138
|
+
* @inheritDoc
|
|
139
|
+
*/
|
|
124
140
|
doAnnotationActionApply(action) {
|
|
125
141
|
if (action instanceof TextStyleAnnotationAction) {
|
|
126
142
|
if (this.type !== 'list-item') {
|
|
@@ -202,6 +218,13 @@ export class RTETextBlock extends RTEBlock {
|
|
|
202
218
|
break;
|
|
203
219
|
}
|
|
204
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
|
|
223
|
+
*
|
|
224
|
+
* @param {RTETextNode} splitNode - The text node that will be split
|
|
225
|
+
* @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
|
|
226
|
+
* @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
|
|
227
|
+
*/
|
|
205
228
|
splitTextNodeBlock(splitNode, startOffsetOfNode) {
|
|
206
229
|
if (splitNode) {
|
|
207
230
|
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
@@ -223,13 +246,34 @@ export class RTETextBlock extends RTEBlock {
|
|
|
223
246
|
}
|
|
224
247
|
}
|
|
225
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Checks if the caret position is at the start of a specified RTETextNode.
|
|
251
|
+
*
|
|
252
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
253
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
254
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
255
|
+
*/
|
|
226
256
|
isCaretPositionAtStart(node, startOffset) {
|
|
227
257
|
return node === this.nodes[0] && startOffset === 0;
|
|
228
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
261
|
+
*
|
|
262
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
263
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
264
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
265
|
+
*/
|
|
229
266
|
isCaretPositionAtEnd(node, startOffset) {
|
|
230
267
|
const lastNode = this.nodes[this.nodes.length - 1];
|
|
231
268
|
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
232
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* lineBreakSingleBlock
|
|
272
|
+
*
|
|
273
|
+
* @param {RTETextNode} splitNode -
|
|
274
|
+
* @param {number} startOffsetOfNode -
|
|
275
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
276
|
+
*/
|
|
233
277
|
lineBreakSingleBlock(splitNode, startOffsetOfNode) {
|
|
234
278
|
if (splitNode) {
|
|
235
279
|
const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
|
|
@@ -250,6 +294,12 @@ export class RTETextBlock extends RTEBlock {
|
|
|
250
294
|
return lineBreakNode;
|
|
251
295
|
}
|
|
252
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* lineBreakMultipleBlocks
|
|
299
|
+
*
|
|
300
|
+
* @param {RTEBlock[]} selectedBlocks -
|
|
301
|
+
* @returns {Nullable<RTETextNode>} Nullable<RTETextNode>
|
|
302
|
+
*/
|
|
253
303
|
lineBreakMultipleBlocks(selectedBlocks) {
|
|
254
304
|
const beforeNodes = this['nodes'];
|
|
255
305
|
const lineBreakNode = new RTETextNode(generateUUID(), '\n', this);
|
|
@@ -257,6 +307,11 @@ export class RTETextBlock extends RTEBlock {
|
|
|
257
307
|
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
|
|
258
308
|
return lineBreakNode;
|
|
259
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* deleteNodeContent
|
|
312
|
+
*
|
|
313
|
+
* @param {DeleteBlockContentAction} action - ModifyContentAction
|
|
314
|
+
*/
|
|
260
315
|
deleteNodeContent(action) {
|
|
261
316
|
const startContainerNode = action.startContainerNode;
|
|
262
317
|
const startOffset = action.startOffset;
|
|
@@ -298,6 +353,7 @@ export class RTETextBlock extends RTEBlock {
|
|
|
298
353
|
}
|
|
299
354
|
/**
|
|
300
355
|
* Remove line break
|
|
356
|
+
*
|
|
301
357
|
* @example caret at the first line
|
|
302
358
|
* \n
|
|
303
359
|
* test
|
|
@@ -307,6 +363,7 @@ export class RTETextBlock extends RTEBlock {
|
|
|
307
363
|
}
|
|
308
364
|
/**
|
|
309
365
|
* Remove line break
|
|
366
|
+
*
|
|
310
367
|
* @example caret at the begin of second line
|
|
311
368
|
* \n
|
|
312
369
|
* test
|
|
@@ -332,35 +389,37 @@ export class RTETextBlock extends RTEBlock {
|
|
|
332
389
|
}
|
|
333
390
|
}
|
|
334
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* Remove the child node
|
|
394
|
+
*
|
|
395
|
+
* @param {RemoveChildAction} action - Modify action
|
|
396
|
+
*/
|
|
335
397
|
removeChildNode(action) {
|
|
336
398
|
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
337
399
|
if (this.nodes.length === 0) {
|
|
338
400
|
this.parent.apply(new RemoveChildAction(this));
|
|
339
401
|
}
|
|
340
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* mergeLineBreakNodes
|
|
405
|
+
*
|
|
406
|
+
* @param {RTENode[]} beforeNodes -
|
|
407
|
+
* @param {RTETextNode} lineBreakNode -
|
|
408
|
+
* @param {RTENode[]} afterNodes -
|
|
409
|
+
*/
|
|
341
410
|
mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes) {
|
|
342
411
|
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
343
412
|
afterNodes.push(new RTETextNode(generateUUID(), '\n', this, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
|
|
344
413
|
}
|
|
345
414
|
this.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
|
|
346
415
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
case 'heading-2':
|
|
355
|
-
return `h2`;
|
|
356
|
-
case 'heading-3':
|
|
357
|
-
return `h3`;
|
|
358
|
-
case 'paragraph':
|
|
359
|
-
return 'p';
|
|
360
|
-
case 'list-item':
|
|
361
|
-
return 'li';
|
|
362
|
-
}
|
|
363
|
-
}
|
|
416
|
+
/**
|
|
417
|
+
* breakSingleTextBlock
|
|
418
|
+
*
|
|
419
|
+
* @param {RTETextNode} splitNode -
|
|
420
|
+
* @param {number} startOffsetOfNode -
|
|
421
|
+
* @returns {Nullable<RTEBlock>} Nullable<RTEBlock>
|
|
422
|
+
*/
|
|
364
423
|
breakSingleTextBlock(splitNode, startOffsetOfNode) {
|
|
365
424
|
const newParagraph = this.copyInlineStyleToNewParagraph(splitNode);
|
|
366
425
|
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
@@ -376,6 +435,11 @@ export class RTETextBlock extends RTEBlock {
|
|
|
376
435
|
}
|
|
377
436
|
return newParagraph;
|
|
378
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* convertParagraphToList
|
|
440
|
+
*
|
|
441
|
+
* @param {TransformListAction} action - ModifyContentAction
|
|
442
|
+
*/
|
|
379
443
|
convertParagraphToList(action) {
|
|
380
444
|
const bulletList = this.parent.createList(action.listType);
|
|
381
445
|
const listItems = action.selectedBlocks.map((node) => this.parent.toListItem(node));
|
|
@@ -385,6 +449,11 @@ export class RTETextBlock extends RTEBlock {
|
|
|
385
449
|
node.parent.apply(new RemoveChildAction(node));
|
|
386
450
|
});
|
|
387
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* insertImage
|
|
454
|
+
*
|
|
455
|
+
* @param {InsertImageToBlockAction} action - ModifyContentAction
|
|
456
|
+
*/
|
|
388
457
|
insertImage(action) {
|
|
389
458
|
const splitNode = action.splitPointNode;
|
|
390
459
|
const startOffsetOfNode = action.startOffsetOfNode;
|
|
@@ -401,6 +470,12 @@ export class RTETextBlock extends RTEBlock {
|
|
|
401
470
|
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
402
471
|
}
|
|
403
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* copyInlineStyleToNewParagraph
|
|
475
|
+
*
|
|
476
|
+
* @param {RTETextNode} needCopedNode -
|
|
477
|
+
* @returns {RTETextBlock} RTETextBlock
|
|
478
|
+
*/
|
|
404
479
|
copyInlineStyleToNewParagraph(needCopedNode) {
|
|
405
480
|
const textNode = needCopedNode.cloneWithText('');
|
|
406
481
|
// The link annotation don't need inherited
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
2
1
|
import { NodeTypeEnum, RTENode } from './node.abstract';
|
|
3
|
-
import stateEntityRenderingRegistry from '../../slimmers/controllers/state-entity-rendering-registry';
|
|
4
2
|
import { ImageAnnotation } from '../annotations/image-annotation';
|
|
5
|
-
import { ImageAnnotationAction } from '../actions/image-annotation-action';
|
|
6
3
|
import { methodPlaceholder } from 'vega-slimmer/core';
|
|
7
4
|
import { NodeAnnotationTypeEnum } from '../annotations/node-annotation.abstract';
|
|
8
5
|
import { isNonNullable } from '../../../../types/type-guard';
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Image node
|
|
8
|
+
*/
|
|
11
9
|
export class RTEImageNode extends RTENode {
|
|
12
10
|
constructor(id, url, parentBlock, annotationMap) {
|
|
13
11
|
super(id, annotationMap);
|
|
@@ -15,20 +13,30 @@ export class RTEImageNode extends RTENode {
|
|
|
15
13
|
this.url = url;
|
|
16
14
|
this.parentBlock = parentBlock;
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
|
|
18
|
+
*
|
|
19
|
+
* @param {VegaRTEImageNode} node - The node to be converted.
|
|
20
|
+
* @param {RTEImageBlock} parentBlock - The parent block
|
|
21
|
+
* @returns {RTEImageBlock} An instance of `RTEImageBlock`
|
|
22
|
+
*/
|
|
23
|
+
static from(node, parentBlock) {
|
|
24
|
+
const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
|
|
20
25
|
let annotations;
|
|
21
|
-
if (!
|
|
26
|
+
if (!node.annotations || Object.keys(node.annotations).length === 0) {
|
|
22
27
|
annotations = { size: 'md' };
|
|
23
28
|
}
|
|
24
29
|
else {
|
|
25
|
-
annotations =
|
|
30
|
+
annotations = node.annotations;
|
|
26
31
|
}
|
|
27
32
|
imageNode.annotationMap = new Map(Object.keys(annotations)
|
|
28
33
|
.map(() => ImageAnnotation.from(annotations.size, annotations.alt))
|
|
29
34
|
.filter(isNonNullable));
|
|
30
35
|
return imageNode;
|
|
31
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* @inheritDoc
|
|
39
|
+
*/
|
|
32
40
|
toJSON() {
|
|
33
41
|
const imageAnnotation = this.annotationMap.get(NodeAnnotationTypeEnum.IMAGE);
|
|
34
42
|
const annotations = {};
|
|
@@ -40,54 +48,19 @@ export class RTEImageNode extends RTENode {
|
|
|
40
48
|
}
|
|
41
49
|
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
|
|
42
50
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const alt = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt;
|
|
47
|
-
const handleChange = ({ detail, }) => {
|
|
48
|
-
switch (detail.action) {
|
|
49
|
-
case 'edit': {
|
|
50
|
-
const size = detail.payload.size;
|
|
51
|
-
const alt = detail.payload.alt;
|
|
52
|
-
this.apply(new ImageAnnotationAction(size, alt));
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
/*
|
|
56
|
-
* The below method is e2e-test covered in
|
|
57
|
-
* @see{module:vega-rich-text-editor-image-click-delete-button}
|
|
58
|
-
*/
|
|
59
|
-
/* istanbul ignore next */
|
|
60
|
-
case 'delete': {
|
|
61
|
-
const event = new InputEvent('beforeinput', {
|
|
62
|
-
inputType: 'deleteContentBackward',
|
|
63
|
-
bubbles: true,
|
|
64
|
-
});
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
stateEntityRenderingRegistry.getDOMByEntity(this).dispatchEvent(event);
|
|
67
|
-
}, 50);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
return editable ? (h("vega-rich-text-image-editor", { style: this.getStyles(), size: size, alt: alt, ref: (ref) => {
|
|
73
|
-
DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, VegaChange, handleChange);
|
|
74
|
-
} }, this.renderImage(editable, alt))) : (this.renderImage(editable, alt));
|
|
75
|
-
}
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
76
54
|
doAnnotationActionApply(action) {
|
|
77
55
|
const annotation = action.toAnnotation();
|
|
78
56
|
this.annotationMap.set(annotation.type, annotation);
|
|
79
57
|
}
|
|
80
58
|
// placeholder method
|
|
81
59
|
/* istanbul ignore next */
|
|
60
|
+
/**
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
82
63
|
doModifyActionApply(action) {
|
|
83
64
|
methodPlaceholder(action);
|
|
84
65
|
}
|
|
85
|
-
registerRef(ref) {
|
|
86
|
-
if (ref) {
|
|
87
|
-
stateEntityRenderingRegistry.register(ref, this);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
renderImage(editable, alt) {
|
|
91
|
-
return (h("img", { style: editable ? { width: '100%' } : this.getStyles(), alt: alt, src: this.url, ref: this.registerRef.bind(this) }));
|
|
92
|
-
}
|
|
93
66
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NodeAnnotation } from '../annotations/node-annotation.abstract';
|
|
2
1
|
import ChangeManager from '../../../../helpers/change-manager/change-manager';
|
|
3
2
|
import stateEntityRenderingRegistry from '../../slimmers/controllers/state-entity-rendering-registry';
|
|
4
3
|
import domNodeSubjectFactory from '../../../../helpers/change-manager/subject/dom-node-subject/dom-node-subject-factory';
|
|
@@ -64,30 +63,6 @@ export class RTENode {
|
|
|
64
63
|
this.doAnnotationActionApply(action);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Get styles from annotations
|
|
69
|
-
*
|
|
70
|
-
* @returns {AnnotationStyle} - Annotation style
|
|
71
|
-
*/
|
|
72
|
-
getStyles() {
|
|
73
|
-
return Array.from(this.annotationMap.values())
|
|
74
|
-
.filter((annotation) => annotation instanceof NodeAnnotation)
|
|
75
|
-
.map((annotation) => annotation.render())
|
|
76
|
-
.filter(Boolean)
|
|
77
|
-
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get classes from annotations
|
|
81
|
-
*
|
|
82
|
-
* @returns {AnnotationStyle} - Annotation style
|
|
83
|
-
*/
|
|
84
|
-
getClasses() {
|
|
85
|
-
return Array.from(this.annotationMap.values())
|
|
86
|
-
.filter((annotation) => annotation instanceof NodeAnnotation)
|
|
87
|
-
.map((annotation) => { var _a; return (_a = annotation.renderClass) === null || _a === void 0 ? void 0 : _a.call(annotation); })
|
|
88
|
-
.filter(Boolean)
|
|
89
|
-
.reduce((pre, cur) => [pre, cur].join(' '), '');
|
|
90
|
-
}
|
|
91
66
|
/**
|
|
92
67
|
* Flush the value change
|
|
93
68
|
*/
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
2
1
|
import { NodeTypeEnum, RTENode } from './node.abstract';
|
|
3
2
|
import { NodeAnnotation, NodeAnnotationTypeEnum } from '../annotations/node-annotation.abstract';
|
|
4
3
|
import { TextSplittableAction } from '../actions/splittable-action.abstract';
|
|
5
4
|
import { SelectionRangeAnnotation } from '../annotations/selection-range-annotation';
|
|
6
5
|
import stateEntityRenderingRegistry from '../../slimmers/controllers/state-entity-rendering-registry';
|
|
7
|
-
import TextNodeElementRenderingRegistry from '../../slimmers/controllers/text-node-rendering-registry';
|
|
8
6
|
import { generateUUID } from '../../../../utils/misc';
|
|
9
7
|
import { InternalAnnotationTypeEnum } from '../annotations/annotation.abstract';
|
|
10
8
|
import { StrikethroughAnnotation } from '../annotations/strikethrough-annotation';
|
|
@@ -28,6 +26,9 @@ import ChangeManager from '../../../../helpers/change-manager/change-manager';
|
|
|
28
26
|
import { ZERO_WIDTH_SPACE } from '../../constants/constant';
|
|
29
27
|
import { SyncUpSelectionAction } from '../actions/sync-up-selection-action';
|
|
30
28
|
import { DeleteNodeAnnotationAction } from '../actions/delete-node-annotation-action';
|
|
29
|
+
/**
|
|
30
|
+
* Text node
|
|
31
|
+
*/
|
|
31
32
|
export class RTETextNode extends RTENode {
|
|
32
33
|
constructor(id, text, parentBlock, annotationMap) {
|
|
33
34
|
super(id, annotationMap);
|
|
@@ -35,6 +36,13 @@ export class RTETextNode extends RTENode {
|
|
|
35
36
|
this.parentBlock = parentBlock;
|
|
36
37
|
this.text = text;
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates an RTETextNode from a VegaRTETextNode with annotations and a parent RTETextBlock.
|
|
41
|
+
*
|
|
42
|
+
* @param {VegaRTETextNode} richText - A rich text node
|
|
43
|
+
* @param {RTETextBlock} parentBlock - Parent block
|
|
44
|
+
* @returns {RTETextNode} an RTETextNode
|
|
45
|
+
*/
|
|
38
46
|
static from(richText, parentBlock) {
|
|
39
47
|
const textNode = new RTETextNode(richText.id, richText.text, parentBlock);
|
|
40
48
|
const { annotations } = richText;
|
|
@@ -50,6 +58,14 @@ export class RTETextNode extends RTENode {
|
|
|
50
58
|
}
|
|
51
59
|
return textNode;
|
|
52
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates different types of text annotations based on the provided type and value.
|
|
63
|
+
*
|
|
64
|
+
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
65
|
+
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
66
|
+
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
67
|
+
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
68
|
+
*/
|
|
53
69
|
static createAnnotationEntity(type, value) {
|
|
54
70
|
switch (type) {
|
|
55
71
|
case 'bold':
|
|
@@ -68,6 +84,9 @@ export class RTETextNode extends RTENode {
|
|
|
68
84
|
return LinkAnnotation.from(value);
|
|
69
85
|
}
|
|
70
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* @inheritDoc
|
|
89
|
+
*/
|
|
71
90
|
toJSON() {
|
|
72
91
|
const annotations = Array.from(this.annotationMap.values())
|
|
73
92
|
.filter((annotation) => annotation instanceof NodeAnnotation)
|
|
@@ -76,19 +95,26 @@ export class RTETextNode extends RTENode {
|
|
|
76
95
|
}, {});
|
|
77
96
|
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'text', text: this.text });
|
|
78
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Creates a new RTETextNode with the specified text and copies the parent block and annotation map from the original node.
|
|
100
|
+
*
|
|
101
|
+
* @param {string} text - The text content of the RTETextNode that will be created.
|
|
102
|
+
* @returns {RTETextNode} An new RTETextNode
|
|
103
|
+
*/
|
|
79
104
|
cloneWithText(text) {
|
|
80
105
|
return new RTETextNode(generateUUID(), text, this.parentBlock, new Map(this.annotationMap));
|
|
81
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Checks if a node is empty
|
|
109
|
+
*
|
|
110
|
+
* @returns {boolean} It returns `true` if the node is empty
|
|
111
|
+
*/
|
|
82
112
|
isEmpty() {
|
|
83
113
|
return !this.text || this.text === ZERO_WIDTH_SPACE || this.text === '\n';
|
|
84
114
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return (h("code", { style: this.getStyles(), class: this.getClasses(), ref: this.registerRef.bind(this) }, this.text || ZERO_WIDTH_SPACE));
|
|
89
|
-
}
|
|
90
|
-
return (h("span", { style: this.getStyles(), class: this.getClasses(), ref: this.registerRef.bind(this) }, this.text || ZERO_WIDTH_SPACE));
|
|
91
|
-
}
|
|
115
|
+
/**
|
|
116
|
+
* @inheritDoc
|
|
117
|
+
*/
|
|
92
118
|
doAnnotationActionApply(action) {
|
|
93
119
|
const selectionRangeAnnotation = this.getAnnotationByType(InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
94
120
|
if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
|
|
@@ -115,6 +141,9 @@ export class RTETextNode extends RTENode {
|
|
|
115
141
|
}
|
|
116
142
|
this.parentBlock.mergeNodes(action);
|
|
117
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* @inheritDoc
|
|
146
|
+
*/
|
|
118
147
|
doModifyActionApply(action) {
|
|
119
148
|
switch (action.type) {
|
|
120
149
|
case ModifyContentActionType.UPDATE_TEXT:
|
|
@@ -125,19 +154,25 @@ export class RTETextNode extends RTENode {
|
|
|
125
154
|
break;
|
|
126
155
|
}
|
|
127
156
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
}
|
|
157
|
+
/**
|
|
158
|
+
* Split text node with range
|
|
159
|
+
*
|
|
160
|
+
* @param {TextSplittableAction} action - Annotation action
|
|
161
|
+
* @param {Range} range - Selection range
|
|
162
|
+
* @returns {RTETextNode[] | this} RTETextNode array
|
|
163
|
+
*/
|
|
137
164
|
splitTextNode(action, range) {
|
|
138
165
|
const { startContainer, endContainer, startOffset } = range;
|
|
139
166
|
const startNode = startContainer.parentElement;
|
|
140
167
|
const endNode = endContainer.parentElement;
|
|
168
|
+
/**
|
|
169
|
+
* Split the text from the start offset to the end offset
|
|
170
|
+
*
|
|
171
|
+
* @param {string} text - The text string
|
|
172
|
+
* @param {number} startOffset - The start offset position
|
|
173
|
+
* @param {number} endOffset - The end offset position
|
|
174
|
+
* @returns {RTETextNode[]} - The split text node array
|
|
175
|
+
*/
|
|
141
176
|
const splitText = (text, startOffset, endOffset) => {
|
|
142
177
|
const beforeText = text.substring(0, startOffset);
|
|
143
178
|
const selectedText = text.substring(startOffset, endOffset);
|
|
@@ -166,6 +201,12 @@ export class RTETextNode extends RTENode {
|
|
|
166
201
|
return this;
|
|
167
202
|
}
|
|
168
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Apply action to node
|
|
206
|
+
*
|
|
207
|
+
* @param {RTETextNode} node - Text node
|
|
208
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
209
|
+
*/
|
|
169
210
|
applyActionToNode(node, action) {
|
|
170
211
|
const annotation = action.toAnnotation();
|
|
171
212
|
if (action instanceof SyncUpSelectionAction) {
|
|
@@ -200,6 +241,12 @@ export class RTETextNode extends RTENode {
|
|
|
200
241
|
return;
|
|
201
242
|
}
|
|
202
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Replaces the selected text within a given range with a new text in a TypeScript class.
|
|
246
|
+
*
|
|
247
|
+
* @param {string} text - The new text that will replace the currently selected text within the specified range.
|
|
248
|
+
* @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
|
|
249
|
+
*/
|
|
203
250
|
replaceSelectedText(text, currentRange) {
|
|
204
251
|
if (currentRange && currentRange.startContainer && currentRange.endContainer) {
|
|
205
252
|
const { startContainer, endContainer, startOffset, endOffset } = currentRange;
|
|
@@ -218,16 +265,33 @@ export class RTETextNode extends RTENode {
|
|
|
218
265
|
this.apply(new UpdateTextAction(this.text.slice(0, startIndex) + text + this.text.slice(endIndex)));
|
|
219
266
|
}
|
|
220
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
|
|
270
|
+
*
|
|
271
|
+
* @param {string} newText - The new text string
|
|
272
|
+
*/
|
|
221
273
|
updateText(newText) {
|
|
222
274
|
this.text = newText;
|
|
223
|
-
// The link node should
|
|
275
|
+
// The link node should unlink when delete all text
|
|
224
276
|
if (!this.text && this.isLinkNode()) {
|
|
225
277
|
this.annotationMap.delete(NodeAnnotationTypeEnum.LINK);
|
|
226
278
|
}
|
|
227
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* Checks if a node has an annotation with the key 'LINK'.
|
|
282
|
+
*
|
|
283
|
+
* @returns {boolean} A boolean value indicating whether the `annotationMap` has a key 'LINK'.
|
|
284
|
+
*/
|
|
228
285
|
isLinkNode() {
|
|
229
286
|
return this.annotationMap.has('LINK');
|
|
230
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Whether a given range should be split based on various conditions within the range.
|
|
290
|
+
*
|
|
291
|
+
* @param {Range} range - Selection range
|
|
292
|
+
* @returns {boolean} Returns a boolean value indicating whether the
|
|
293
|
+
* selection range should be split.
|
|
294
|
+
*/
|
|
231
295
|
shouldSplitSelection(range) {
|
|
232
296
|
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
233
297
|
const isCrossNode = startContainer !== endContainer;
|
|
@@ -236,6 +300,11 @@ export class RTETextNode extends RTENode {
|
|
|
236
300
|
const isPartialSelection = isPartialStart || isPartialEnd;
|
|
237
301
|
return isCrossNode || isPartialSelection;
|
|
238
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Sync up the selected node by change manager
|
|
305
|
+
*
|
|
306
|
+
* @param {RTETextNode} selectedNode - The selected node
|
|
307
|
+
*/
|
|
239
308
|
syncUpSelectedNodes(selectedNode) {
|
|
240
309
|
const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
241
310
|
if (currentNodeDom) {
|
|
@@ -245,6 +314,13 @@ export class RTETextNode extends RTENode {
|
|
|
245
314
|
}
|
|
246
315
|
}
|
|
247
316
|
}
|
|
317
|
+
/**
|
|
318
|
+
* Insert the new node at the start offset
|
|
319
|
+
*
|
|
320
|
+
* @param {number} startOffset - The start position offset
|
|
321
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
322
|
+
* @returns {RTETextNode[]} - RTETextNode array
|
|
323
|
+
*/
|
|
248
324
|
insertNewNode(startOffset, action) {
|
|
249
325
|
if (startOffset === 0) {
|
|
250
326
|
const newNode = this.cloneWithText('');
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import stateEntityRenderingRegistry from '../../../slimmers/controllers/state-entity-rendering-registry';
|
|
2
|
+
import { BlockAnnotation } from '../../annotations/block-annotation.abstract';
|
|
3
|
+
import { isNonNullable } from '../../../../../types/type-guard';
|
|
4
|
+
export class RTEBlockRenderer {
|
|
5
|
+
constructor(block, renderContext) {
|
|
6
|
+
this.block = block;
|
|
7
|
+
this.renderContext = renderContext;
|
|
8
|
+
}
|
|
9
|
+
registerRef(ref) {
|
|
10
|
+
if (ref) {
|
|
11
|
+
stateEntityRenderingRegistry.register(ref, this.block);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get styles from annotations
|
|
16
|
+
*
|
|
17
|
+
* @returns {AnnotationStyle} - Annotation style
|
|
18
|
+
*/
|
|
19
|
+
getStyles() {
|
|
20
|
+
return Array.from(this.block.annotationMap.values())
|
|
21
|
+
.filter((annotation) => annotation instanceof BlockAnnotation)
|
|
22
|
+
.map((annotation) => annotation.render())
|
|
23
|
+
.filter(isNonNullable)
|
|
24
|
+
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get classes from annotations
|
|
28
|
+
*
|
|
29
|
+
* @returns {AnnotationStyle} - Annotation style
|
|
30
|
+
*/
|
|
31
|
+
getClasses() {
|
|
32
|
+
return Array.from(this.block.annotationMap.values())
|
|
33
|
+
.map((annotation) => { var _a; return (_a = annotation.renderClass) === null || _a === void 0 ? void 0 : _a.call(annotation); })
|
|
34
|
+
.filter(isNonNullable)
|
|
35
|
+
.reduce((pre, cur) => [pre, cur].join(' '), '');
|
|
36
|
+
}
|
|
37
|
+
}
|