@globalpayments/vega 2.32.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/{app-globals-19032674.js → app-globals-4e819773.js} +31 -22
- package/dist/cjs/block-annotation.abstract-4d88b939.js +875 -0
- package/dist/cjs/{breakpoints-7e2dff90.js → breakpoints-17d6c4c7.js} +2 -13
- package/dist/cjs/breakpoints-ebde4837.js +14 -0
- package/dist/cjs/{change-manager-a297e4d2.js → change-manager-bda1d107.js} +1 -1
- package/dist/cjs/{chevron-down-ca2fa88e.js → chevron-down-9847bf78.js} +0 -5
- package/dist/cjs/chevron-up-21465cf7.js +7 -0
- package/dist/cjs/{child-nodes-event-prevent-slimmer-88ed23c2.js → child-nodes-event-prevent-slimmer-e1a6e5ad.js} +3 -3
- package/dist/cjs/{child-nodes-notify-observer-slimmer-79f2f5a7.js → child-nodes-notify-observer-slimmer-03a3f79e.js} +5 -5
- package/dist/cjs/{component-73a88c4e.js → component-63af66ea.js} +1 -1
- package/dist/cjs/{component-global-style-slimmer-6749808c.js → component-global-style-slimmer-6b64a26c.js} +1 -1
- package/dist/cjs/{component-usage-runtime-metrics-1ee24991.js → component-usage-runtime-metrics-019d3c00.js} +2 -2
- package/dist/cjs/content-state-3a2724f6.js +2184 -0
- package/dist/cjs/{create-public-api-runtime-metrics-slimmer-5cc88124.js → create-public-api-runtime-metrics-slimmer-8c6a8fb7.js} +3 -3
- package/dist/cjs/{date-0a6bb035.js → date-ffe382a4.js} +1 -1
- package/dist/cjs/{deprecated-property-slimmer-fc729fd9.js → deprecated-property-slimmer-f36e3779.js} +2 -2
- package/dist/cjs/{design-token-92906579.js → design-token-908e3f69.js} +5 -5
- package/dist/cjs/{vega-event-id-81270f6a.js → dom-node-subject-observer-factory-093462f1.js} +170 -0
- package/dist/cjs/{dynamic-slimmer-f31fdfd7.js → dynamic-slimmer-dc30600a.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-415d261a.js → element-appender-slimmer-0dd70e61.js} +17 -10
- package/dist/cjs/{event-emit-slimmer-83278943.js → event-emit-slimmer-a46bb411.js} +5 -5
- package/dist/cjs/{feature-flag-controller-f9d3ce38.js → feature-flag-controller-e97b5f29.js} +3 -3
- package/dist/cjs/{form-field-controller-slimmer-2a982ead.js → form-field-controller-slimmer-9aeabcdc.js} +16 -17
- package/dist/cjs/{index-09acd3c9.js → global-slimmer-registry-dd2691b8.js} +296 -274
- package/dist/cjs/{icon-manager-3787af39.js → icon-manager-36dcfb65.js} +2 -2
- package/dist/cjs/index-8b247c17.js +325 -0
- package/dist/cjs/index.cjs.js +37 -30
- package/dist/cjs/{inject-keyboard-manager-e79a1ade.js → inject-keyboard-manager-af37c861.js} +1 -1
- package/dist/cjs/{internal-icon-manager-2ff58050.js → internal-icon-manager-2282a62f.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-5fe83465.js → internal-vega-event-manager-d7643ec6.js} +72 -68
- package/dist/cjs/{internal-vega-z-index-manager-f03ddb37.js → internal-vega-z-index-manager-e24e4309.js} +1 -1
- package/dist/cjs/{keyboard-manager-34b78600.js → keyboard-manager-5afbc8f1.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-8e2d4b5d.js → keyboard-manager-slimmer-9be2a880.js} +2 -2
- package/dist/cjs/loader.cjs.js +28 -23
- package/dist/cjs/{mutation-observer-slimmer-895b3d3e.js → mutation-observer-slimmer-98bbbdf0.js} +1 -1
- package/dist/cjs/{vega-skeleton-loader-controller-4a1eedcd.js → node.abstract-f8075f84.js} +234 -840
- package/dist/cjs/{page-resize-observer-slimmer-a8cf1874.js → page-resize-observer-slimmer-e54fa9d4.js} +2 -2
- package/dist/cjs/{remote-invocation-registry-32aaf6c2.js → remote-invocation-registry-71a45468.js} +4 -4
- package/dist/cjs/{required-field-rule-9a57b1a0.js → required-field-rule-7f9945fa.js} +2 -1
- package/dist/cjs/{responsive-format-facade-ad2f67bf.js → responsive-format-facade-74079f1b.js} +3 -3
- package/dist/cjs/{state-background-color-formatter-418b84e6.js → state-background-color-formatter-d32a1098.js} +2 -2
- package/dist/cjs/{static-subject-title-471e1793.js → static-subject-title-d66b88fb.js} +2 -0
- package/dist/cjs/{string-input-formatter-slimmer-79272527.js → string-input-formatter-slimmer-297765c0.js} +2 -2
- package/dist/cjs/{style-formatter-68f3a5f8.js → style-formatter-5deb065f.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-13f1892b.js → sub-state-notify-slimmer-73201c53.js} +6 -7
- package/dist/cjs/{sub-state-observer-slimmer-6c0b635d.js → sub-state-observer-slimmer-10c0d402.js} +6 -7
- package/dist/cjs/{synchronize-task-queue-8977cf10.js → synchronize-task-queue-1ee80e94.js} +10 -1
- package/dist/cjs/text-color-toolbar-button-slimmer-b1c9f40e.js +210 -0
- package/dist/cjs/text-node-0d12da5a.js +1077 -0
- package/dist/cjs/{translation-42c1b2c8.js → translation-f6b7ee84.js} +4 -4
- package/dist/cjs/{translation-slimmer-32aa13e7.js → translation-slimmer-90f9f71f.js} +2 -2
- package/dist/cjs/trash-can-46a5e19a.js +7 -0
- package/dist/cjs/{type-guard-a07b353b.js → type-guard-4ba85fdc.js} +18 -18
- package/dist/cjs/{ui-08f33116.js → ui-b5906704.js} +20 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +46 -47
- package/dist/cjs/vega-app-footer.cjs.entry.js +12 -13
- package/dist/cjs/vega-app-header-button.cjs.entry.js +48 -48
- package/dist/cjs/vega-backdrop.cjs.entry.js +8 -9
- package/dist/cjs/vega-banner.cjs.entry.js +36 -38
- package/dist/cjs/vega-bar-chart.cjs.entry.js +5 -6
- package/dist/cjs/vega-box.cjs.entry.js +15 -15
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +34 -36
- package/dist/cjs/vega-button-circle.cjs.entry.js +29 -30
- package/dist/cjs/vega-button-group_2.cjs.entry.js +32 -34
- package/dist/cjs/vega-button-link.cjs.entry.js +33 -28
- package/dist/cjs/vega-button.cjs.entry.js +30 -31
- package/dist/cjs/vega-calendar_3.cjs.entry.js +139 -140
- package/dist/cjs/vega-card.cjs.entry.js +13 -13
- package/dist/cjs/vega-carousel.cjs.entry.js +27 -29
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +49 -50
- package/dist/cjs/vega-chip.cjs.entry.js +39 -40
- package/dist/cjs/vega-color-picker.cjs.entry.js +29 -31
- package/dist/cjs/vega-combo-box.cjs.entry.js +52 -53
- package/dist/cjs/vega-counter-badge.cjs.entry.js +9 -10
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +149 -96
- package/dist/cjs/{vega-dialog-controller-dce8cdaf.js → vega-dialog-controller-aaf1f43e.js} +2 -2
- package/dist/cjs/vega-dialog_2.cjs.entry.js +50 -51
- package/dist/cjs/vega-divider.cjs.entry.js +13 -13
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +133 -134
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +8 -9
- package/dist/cjs/vega-field-label.cjs.entry.js +20 -23
- package/dist/cjs/vega-file-uploader.cjs.entry.js +76 -81
- package/dist/cjs/vega-flex.cjs.entry.js +18 -17
- package/dist/cjs/vega-font.cjs.entry.js +16 -16
- package/dist/cjs/vega-form.cjs.entry.js +41 -42
- package/dist/cjs/vega-grid.cjs.entry.js +13 -13
- package/dist/cjs/vega-hint.cjs.entry.js +6 -7
- package/dist/cjs/vega-icon.cjs.entry.js +18 -18
- package/dist/cjs/vega-image-uploader.cjs.entry.js +57 -58
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +42 -43
- package/dist/cjs/vega-input-numeric.cjs.entry.js +35 -36
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +51 -52
- package/dist/cjs/vega-input-range.cjs.entry.js +44 -45
- package/dist/cjs/vega-input-select.cjs.entry.js +71 -71
- package/dist/cjs/vega-input.cjs.entry.js +50 -52
- package/dist/cjs/{vega-internal-event-id-79be9bc5.js → vega-internal-event-id-85b68849.js} +12 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +19 -22
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +107 -107
- package/dist/cjs/vega-line-chart.cjs.entry.js +6 -7
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +18 -18
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +18 -21
- package/dist/cjs/vega-pagination.cjs.entry.js +53 -55
- package/dist/cjs/vega-pie-chart.cjs.entry.js +6 -7
- package/dist/cjs/vega-popover_2.cjs.entry.js +72 -37
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +27 -30
- package/dist/cjs/vega-radio_2.cjs.entry.js +53 -54
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +179 -0
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +4894 -0
- package/dist/cjs/vega-section-title.cjs.entry.js +14 -15
- package/dist/cjs/vega-segment-control.cjs.entry.js +24 -26
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +53 -54
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +64 -65
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +48 -50
- package/dist/cjs/vega-signature-capture.cjs.entry.js +44 -46
- package/dist/cjs/vega-skeleton.cjs.entry.js +25 -26
- package/dist/cjs/vega-slot-container.cjs.entry.js +5 -6
- package/dist/cjs/vega-stepper.cjs.entry.js +38 -39
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +58 -59
- package/dist/cjs/vega-table_8.cjs.entry.js +183 -183
- package/dist/cjs/vega-text.cjs.entry.js +10 -10
- package/dist/cjs/vega-textarea.cjs.entry.js +39 -40
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +88 -89
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +25 -27
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +22 -22
- package/dist/cjs/vega.cjs.js +28 -23
- package/dist/collection/collection-manifest.json +18 -0
- package/dist/collection/components/vega-button-link/vega-button-link.js +34 -1
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.js +6 -4
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-input-renderer-base.abstract.js +55 -0
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-range-input-renderer.js +5 -9
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-renderer.js +3 -1
- package/dist/collection/components/vega-date-picker/slimmers/renderers/vega-date-picker-single-input-renderer.js +5 -9
- package/dist/collection/components/vega-date-picker/vega-date-picker.css +14 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker.js +27 -0
- package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +2 -2
- package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +42 -4
- package/dist/collection/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-state-controller.js +38 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +59 -0
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +132 -0
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.js +124 -0
- package/dist/collection/components/vega-rich-text-editor/assets/align-center.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/align-justify.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/align-left.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/align-right.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/bold.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/code-simple.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/image.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/indent.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/italic.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/link.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/list-ol.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/list-ul.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/outdent.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/strikethrough.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/text-size.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/text-slash.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/text.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/underline.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +33 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/annotation-action.abstract.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.js +9 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/bold-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/break-single-block-action.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-formatting-annotation-action.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/code-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-block-content-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-node-annotation-action.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/horizontal-alignment-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/image-annotation-action.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/indent-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-image-to-block-action.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/italic-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/line-break-multiple-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/line-break-single-block-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/link-annotation-action.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/merge-two-blocks-nodes-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-child-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-nest-list-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/replace-child-nodes-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/replace-nest-list-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/replace-selected-text-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/selection-change-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/split-block-with-node-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/splittable-action.abstract.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/strikethrough-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/sync-up-selection-action.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/text-color-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/text-style-annotation-action.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-list-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-paragraph-action.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/underline-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-text-action.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/annotation.abstract.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +90 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +66 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +78 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +62 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +102 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/selection-range-annotation.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +85 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +105 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +354 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +260 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +189 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +236 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +424 -0
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +135 -0
- package/dist/collection/components/vega-rich-text-editor/dto/helper/block-base-operator.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +103 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +103 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +297 -0
- package/dist/collection/components/vega-rich-text-editor/dto/range.js +178 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/focus-controller.js +73 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.js +135 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.js +74 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.js +39 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.js +56 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.js +77 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.js +44 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +191 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +108 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +100 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +90 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +91 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +93 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.js +117 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/rich-text-content-controller.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +294 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/text-node-color-controller.js +51 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/text-node-rendering-registry.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +201 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +91 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +97 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +51 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +70 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +68 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +46 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +77 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +72 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +46 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +97 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +45 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +52 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +129 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +128 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +62 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +52 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +126 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-actions.test.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +134 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/image-block.test.js +90 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-block.test.js +224 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/list-item.test.js +228 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +173 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +172 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +93 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +433 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/range.test.js +53 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/slimmers/renderers/vega-rich-text-editor-toolbar-button-renderer.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +50 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.js +246 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +264 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +676 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/slimmers/renderers/vega-rich-text-image-editor-renderer.js +133 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.css +13 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.js +165 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.js +144 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.css +11 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.js +247 -0
- package/dist/collection/constants/ui.js +1 -0
- package/dist/collection/global/scripts/before-vega-load.js +9 -1
- package/dist/collection/helpers/change-manager/subject/static-subject/static-subject-title.js +1 -0
- package/dist/collection/helpers/common/index.js +27 -0
- package/dist/collection/helpers/common/test/wait-for-vega-handler.test.js +1 -1
- package/dist/collection/helpers/dialog/test/vega-dialog-controller.test.js +1 -1
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +5 -1
- package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +6 -0
- package/dist/collection/helpers/event-manager/test/vega-event-manager.test.js +1 -1
- package/dist/collection/helpers/feature-control/feature-flag-controller.js +1 -1
- package/dist/collection/helpers/feature-control/tests/feature-flag-controller.test.js +1 -1
- package/dist/collection/helpers/icon/test/icon-manager-controller.test.js +1 -1
- package/dist/collection/helpers/loading-indicator/tests/vega-loader-controller.test.js +1 -1
- package/dist/collection/helpers/notify/tests/vega-notify-controller.test.js +1 -1
- package/dist/collection/helpers/public-api.js +1 -0
- package/dist/collection/helpers/queue/synchronize-task-queue.js +10 -1
- package/dist/collection/helpers/queue/test/synchronize-task-queue.test.js +28 -0
- package/dist/collection/helpers/skeleton-loader/tests/vega-skeleton-loader-controller.test.js +1 -1
- package/dist/collection/helpers/slimmers/component-usage-runtime-metrics.js +1 -1
- package/dist/collection/helpers/slimmers/dark-mode-state-controller-slimmer.js +46 -0
- package/dist/collection/helpers/slimmers/element-appender-slimmer.js +10 -3
- package/dist/collection/helpers/slimmers/runtime-metrics/public-api-runtime-metrics-slimmer-base.js +1 -1
- package/dist/collection/helpers/slimmers/runtime-metrics/test/public-api-runtime-metrics-slimmer-base.test.js +1 -1
- package/dist/collection/helpers/slimmers/test/component-usage-runtime-metrics.test.js +1 -1
- package/dist/collection/helpers/slimmers/test/dark-mode-state-controller.test.js +65 -0
- package/dist/collection/helpers/theme/controllers/dark-mode-style-controller.js +45 -3
- package/dist/collection/helpers/theme/tests/theme-manager-controller.test.js +2 -2
- package/dist/collection/helpers/theme/theme-manager.js +3 -0
- package/dist/collection/helpers/validator/rules/{file-uploader-required-rule.js → object-array-required-rule.js} +3 -3
- package/dist/collection/helpers/validator/rules/required-field-rule.js +2 -1
- package/dist/collection/helpers/validator/rules/rich-text-editor-required-rule.js +57 -0
- package/dist/collection/helpers/validator/test/rules/object-array-required-rule.test.js +7 -0
- package/dist/collection/helpers/validator/test/rules/required-field-rule.test.js +11 -0
- package/dist/collection/helpers/validator/test/rules/rich-text-editor-required-rule.test.js +317 -0
- package/dist/collection/helpers/zindex/test/vega-z-index-manager.test.js +1 -1
- package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +164 -0
- package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +233 -0
- package/dist/collection/polyfill/test-polyfill/unit/index.js +1 -0
- package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
- package/dist/collection/polyfill/test-polyfill/unit/range.js +15 -0
- package/dist/collection/polyfill/test-polyfill/unit/shadow-selection.js +17 -0
- package/dist/collection/utils/spec-utils.js +2 -1
- package/dist/collection/utils/test/ui.test.js +6 -1
- package/dist/collection/utils/ui.js +18 -0
- package/dist/collection/value-model-adapters/angular-ng-model-accessor-adapter.js +1 -0
- package/dist/collection/value-model-adapters/vue-component-v-model-adaptor.js +1 -0
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/{app-globals-5084ae11.js → app-globals-9971ccfd.js} +22 -13
- package/dist/esm/block-annotation.abstract-b0554e2b.js +868 -0
- package/dist/esm/{breakpoints-36a3ed69.js → breakpoints-91116111.js} +2 -12
- package/dist/esm/breakpoints-d9faf11c.js +12 -0
- package/dist/esm/{change-manager-6a7eb88c.js → change-manager-8f5b72c2.js} +1 -1
- package/dist/esm/chevron-down-4a75d28e.js +5 -0
- package/dist/esm/chevron-up-b1989751.js +5 -0
- package/dist/esm/{child-nodes-event-prevent-slimmer-01953033.js → child-nodes-event-prevent-slimmer-8ceabe63.js} +3 -3
- package/dist/esm/{child-nodes-notify-observer-slimmer-3d52b843.js → child-nodes-notify-observer-slimmer-afc15e00.js} +4 -4
- package/dist/esm/{component-cae24190.js → component-051a594c.js} +1 -1
- package/dist/esm/{component-global-style-slimmer-000e0c11.js → component-global-style-slimmer-631f956f.js} +1 -1
- package/dist/esm/{component-usage-runtime-metrics-b3f6ac79.js → component-usage-runtime-metrics-21813c36.js} +2 -2
- package/dist/esm/content-state-acf55eb0.js +2164 -0
- package/dist/esm/{create-public-api-runtime-metrics-slimmer-cc1164bb.js → create-public-api-runtime-metrics-slimmer-14cb4599.js} +3 -3
- package/dist/esm/{date-732bc749.js → date-655c0af8.js} +1 -1
- package/dist/esm/{deprecated-property-slimmer-43d184b3.js → deprecated-property-slimmer-9ea5019c.js} +2 -2
- package/dist/esm/{design-token-2a527af3.js → design-token-20fdba82.js} +6 -6
- package/dist/esm/dom-node-subject-observer-factory-80358591.js +269 -0
- package/dist/esm/{dynamic-slimmer-90b8af32.js → dynamic-slimmer-85746483.js} +1 -1
- package/dist/esm/{element-appender-slimmer-48d826b2.js → element-appender-slimmer-4dfa326d.js} +17 -10
- package/dist/esm/{event-emit-slimmer-493e6b9d.js → event-emit-slimmer-c03cf145.js} +5 -5
- package/dist/esm/{feature-flag-controller-f72c004e.js → feature-flag-controller-dfde0cfa.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-88492678.js → form-field-controller-slimmer-de5fe574.js} +11 -12
- package/dist/esm/{index-187f71d1.js → global-slimmer-registry-6887a59f.js} +284 -275
- package/dist/esm/{icon-manager-1ee2c968.js → icon-manager-3cef32e7.js} +2 -2
- package/dist/esm/index-44c794b4.js +323 -0
- package/dist/esm/index.js +29 -23
- package/dist/esm/{inject-keyboard-manager-8a82e8c9.js → inject-keyboard-manager-45309420.js} +1 -1
- package/dist/esm/{internal-icon-manager-7004584d.js → internal-icon-manager-7fc7535a.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-48ac30f1.js → internal-vega-event-manager-3a3815d3.js} +6 -2
- package/dist/esm/{internal-vega-z-index-manager-7d2b54c3.js → internal-vega-z-index-manager-89e8b6f5.js} +1 -1
- package/dist/esm/{keyboard-manager-d1f9ddc1.js → keyboard-manager-2c06eafe.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-8723f20f.js → keyboard-manager-slimmer-fd177285.js} +2 -2
- package/dist/esm/{legend-input-processor-0cef3ebe.js → legend-input-processor-15939912.js} +1 -1
- package/dist/esm/loader.js +28 -23
- package/dist/esm/{mutation-observer-slimmer-6cef9549.js → mutation-observer-slimmer-ca2cb2e8.js} +1 -1
- package/dist/esm/{vega-skeleton-loader-controller-1911558d.js → node.abstract-93746055.js} +226 -833
- package/dist/esm/{page-resize-observer-slimmer-994c1e1b.js → page-resize-observer-slimmer-8589ebc8.js} +2 -2
- package/dist/esm/{remote-invocation-registry-1682b34e.js → remote-invocation-registry-2ec6936d.js} +2 -2
- package/dist/esm/{required-field-rule-5da360cc.js → required-field-rule-368b31fa.js} +2 -1
- package/dist/esm/{responsive-format-facade-3dc84e41.js → responsive-format-facade-559ec469.js} +3 -3
- package/dist/esm/{state-background-color-formatter-0540d006.js → state-background-color-formatter-16031a43.js} +2 -2
- package/dist/esm/{static-subject-title-500cf2a3.js → static-subject-title-e06a3840.js} +2 -1
- package/dist/esm/{string-input-formatter-slimmer-fc23bc9f.js → string-input-formatter-slimmer-c9fb1fa1.js} +2 -2
- package/dist/esm/{style-formatter-ccb2da0d.js → style-formatter-51845b6d.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-21b1c646.js → sub-state-notify-slimmer-6e97a58a.js} +5 -6
- package/dist/esm/{sub-state-observer-slimmer-8c80d874.js → sub-state-observer-slimmer-0968ce04.js} +5 -6
- package/dist/esm/{synchronize-task-queue-8f5fbbd9.js → synchronize-task-queue-ac8acc3b.js} +10 -1
- package/dist/esm/text-color-toolbar-button-slimmer-d0255b98.js +207 -0
- package/dist/esm/text-node-6f7d736c.js +1055 -0
- package/dist/esm/{translation-4eb3cf85.js → translation-b3fe8e74.js} +4 -4
- package/dist/esm/{translation-slimmer-9d07a0ff.js → translation-slimmer-860cd766.js} +2 -2
- package/dist/esm/trash-can-8819a939.js +5 -0
- package/dist/esm/{type-guard-63caf78b.js → type-guard-158f6d7a.js} +20 -20
- package/dist/esm/{typography-a8fc4764.js → typography-396de03f.js} +1 -1
- package/dist/esm/{ui-0132dbb5.js → ui-5600b48f.js} +20 -2
- package/dist/esm/vega-accordion.entry.js +22 -23
- package/dist/esm/vega-app-footer.entry.js +3 -4
- package/dist/esm/vega-app-header-button.entry.js +26 -26
- package/dist/esm/vega-backdrop.entry.js +4 -5
- package/dist/esm/vega-banner.entry.js +15 -17
- package/dist/esm/vega-bar-chart.entry.js +5 -6
- package/dist/esm/vega-box.entry.js +13 -13
- package/dist/esm/vega-breadcrumb.entry.js +13 -15
- package/dist/esm/vega-button-circle.entry.js +21 -22
- package/dist/esm/vega-button-group_2.entry.js +16 -18
- package/dist/esm/vega-button-link.entry.js +21 -16
- package/dist/esm/vega-button.entry.js +20 -21
- package/dist/esm/vega-calendar_3.entry.js +29 -30
- package/dist/esm/vega-card.entry.js +11 -11
- package/dist/esm/vega-carousel.entry.js +17 -19
- package/dist/esm/vega-checkbox_2.entry.js +24 -25
- package/dist/esm/vega-chip.entry.js +21 -22
- package/dist/esm/vega-color-picker.entry.js +19 -21
- package/dist/esm/vega-combo-box.entry.js +27 -28
- package/dist/esm/vega-counter-badge.entry.js +3 -4
- package/dist/esm/vega-date-picker_2.entry.js +128 -75
- package/dist/esm/{vega-dialog-controller-8b343a17.js → vega-dialog-controller-5b23f68c.js} +2 -2
- package/dist/esm/vega-dialog_2.entry.js +24 -25
- package/dist/esm/vega-divider.entry.js +11 -11
- package/dist/esm/vega-dropdown_5.entry.js +33 -34
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +5 -6
- package/dist/esm/vega-field-label.entry.js +9 -12
- package/dist/esm/vega-file-uploader.entry.js +27 -32
- package/dist/esm/vega-flex.entry.js +16 -15
- package/dist/esm/vega-font.entry.js +12 -12
- package/dist/esm/vega-form.entry.js +23 -24
- package/dist/esm/vega-grid.entry.js +11 -11
- package/dist/esm/vega-hint.entry.js +3 -4
- package/dist/esm/vega-icon.entry.js +14 -14
- package/dist/esm/vega-image-uploader.entry.js +28 -29
- package/dist/esm/vega-input-credit-card.entry.js +25 -26
- package/dist/esm/vega-input-numeric.entry.js +26 -27
- package/dist/esm/vega-input-phone-number.entry.js +25 -26
- package/dist/esm/vega-input-range.entry.js +23 -24
- package/dist/esm/vega-input-select.entry.js +31 -31
- package/dist/esm/vega-input.entry.js +23 -25
- package/dist/esm/{vega-internal-event-id-770faa12.js → vega-internal-event-id-4af5c6e9.js} +7 -1
- package/dist/esm/vega-item-toggle.entry.js +10 -13
- package/dist/esm/vega-left-nav_5.entry.js +32 -32
- package/dist/esm/vega-line-chart.entry.js +6 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +10 -10
- package/dist/esm/vega-page-notification_2.entry.js +6 -9
- package/dist/esm/vega-pagination.entry.js +17 -19
- package/dist/esm/vega-pie-chart.entry.js +5 -6
- package/dist/esm/vega-popover_2.entry.js +59 -24
- package/dist/esm/vega-progress-tracker.entry.js +10 -13
- package/dist/esm/vega-radio_2.entry.js +26 -27
- package/dist/esm/vega-rich-text-content.entry.js +175 -0
- package/dist/esm/vega-rich-text-editor_4.entry.js +4887 -0
- package/dist/esm/vega-section-title.entry.js +3 -4
- package/dist/esm/vega-segment-control.entry.js +12 -14
- package/dist/esm/vega-selection-chip_2.entry.js +28 -29
- package/dist/esm/vega-selection-tile_2.entry.js +26 -27
- package/dist/esm/vega-sidenav_3.entry.js +23 -25
- package/dist/esm/vega-signature-capture.entry.js +27 -29
- package/dist/esm/vega-skeleton.entry.js +3 -4
- package/dist/esm/vega-slot-container.entry.js +2 -3
- package/dist/esm/vega-stepper.entry.js +22 -23
- package/dist/esm/vega-tab-group_2.entry.js +18 -19
- package/dist/esm/vega-table_8.entry.js +33 -33
- package/dist/esm/vega-text.entry.js +6 -6
- package/dist/esm/vega-textarea.entry.js +23 -24
- package/dist/esm/vega-time-picker_2.entry.js +31 -32
- package/dist/esm/vega-toggle-switch.entry.js +18 -20
- package/dist/esm/vega-tooltip_2.entry.js +16 -16
- package/dist/esm/vega.js +28 -23
- package/dist/esm/{y-axis-input-processor-a4d6aa50.js → y-axis-input-processor-a26a57e5.js} +1 -1
- package/dist/types/components/vega-button-link/types.d.ts +1 -0
- package/dist/types/components/vega-button-link/vega-button-link.d.ts +8 -0
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +1 -0
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-input-renderer-base.abstract.d.ts +17 -0
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-range-input-renderer.d.ts +2 -4
- package/dist/types/components/vega-date-picker/slimmers/renderers/vega-date-picker-single-input-renderer.d.ts +2 -4
- package/dist/types/components/vega-date-picker/vega-date-picker.d.ts +6 -0
- package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +19 -0
- package/dist/types/components/vega-rich-text-content/slimmers/controllers/vega-rich-text-content-state-controller.d.ts +11 -0
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +20 -0
- package/dist/types/components/vega-rich-text-content/vega-rich-text-content.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/assets/align-center.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/align-justify.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/align-left.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/align-right.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/bold.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/code-simple.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/image.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/indent.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/italic.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/link.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/list-ol.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/list-ul.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/outdent.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/strikethrough.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/text-size.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/text-slash.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/text.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/underline.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/annotation-action.abstract.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/bold-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/break-single-block-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/clear-formatting-annotation-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/code-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/delete-block-content-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/delete-node-annotation-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/horizontal-alignment-annotation-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/image-annotation-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/indent-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-image-to-block-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/italic-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/line-break-multiple-block-action.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/line-break-single-block-action.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/link-annotation-action.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/merge-two-blocks-nodes-action.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/remove-child-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/remove-nest-list-action.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/replace-child-nodes-action.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/replace-nest-list-action.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/replace-selected-text-action.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/selection-change-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/split-block-with-node-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/splittable-action.abstract.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/strikethrough-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/sync-up-selection-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/text-color-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/text-style-annotation-action.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/transform-list-action.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/transform-paragraph-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/underline-annotation-action.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-text-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +50 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +41 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/selection-range-annotation.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +50 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +175 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +49 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +63 -0
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +58 -0
- package/dist/types/components/vega-rich-text-editor/dto/helper/block-base-operator.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +65 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/dto/range.d.ts +102 -0
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +175 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/focus-controller.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-handler.abstract.d.ts +67 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/element-to-dto-processor.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/image-to-dto-handler.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/inline-block-to-dto-handler.d.ts +35 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/link-to-dto-handler.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-item-to-dto-handler.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/list-to-dto-handler.d.ts +39 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/paragraph-to-dto-handler.d.ts +39 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-block-to-dto-handler.d.ts +46 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-handler/text-to-dto-handler.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +78 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +53 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.d.ts +39 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/rich-text-content-controller.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +123 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +33 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/text-node-color-controller.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/text-node-rendering-registry.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +70 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +38 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +49 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +53 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/annotations.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/image-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/list-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/list-item.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/text-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/nodes/image-node.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/nodes/text-node.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/range.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/slimmers/renderers/vega-rich-text-editor-toolbar-button-renderer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.d.ts +62 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +186 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-image-editor/slimmers/renderers/vega-rich-text-image-editor-renderer.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-image-editor/types.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-image-editor/vega-rich-text-image-editor.d.ts +46 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/slimmers/renderers/vega-rich-text-link-editor-renderer.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/types.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-link-editor/vega-rich-text-link-editor.d.ts +64 -0
- package/dist/types/components.d.ts +399 -0
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/helpers/change-manager/subject/static-subject/static-subject-title.d.ts +2 -1
- package/dist/types/helpers/common/index.d.ts +8 -0
- package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +6 -0
- package/dist/types/helpers/public-api.d.ts +1 -0
- package/dist/types/helpers/queue/synchronize-task-queue.d.ts +7 -0
- package/dist/types/helpers/slimmers/dark-mode-state-controller-slimmer.d.ts +21 -0
- package/dist/types/helpers/slimmers/element-appender-slimmer.d.ts +2 -0
- package/dist/types/helpers/slimmers/test/dark-mode-state-controller.test.d.ts +1 -0
- package/dist/types/helpers/theme/controllers/dark-mode-style-controller.d.ts +20 -0
- package/dist/types/helpers/validator/rules/form-field-validation-rule.d.ts +7 -1
- package/dist/types/helpers/validator/rules/{file-uploader-required-rule.d.ts → object-array-required-rule.d.ts} +3 -3
- package/dist/types/helpers/validator/rules/rich-text-editor-required-rule.d.ts +39 -0
- package/dist/types/helpers/validator/test/rules/object-array-required-rule.test.d.ts +1 -0
- package/dist/types/helpers/validator/test/rules/rich-text-editor-required-rule.test.d.ts +1 -0
- package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +64 -0
- package/dist/types/polyfill/shadow-selection/test/shadow-selection-polyfill.test.d.ts +0 -0
- package/dist/types/polyfill/test-polyfill/unit/index.d.ts +1 -0
- package/dist/types/polyfill/test-polyfill/unit/range.d.ts +7 -0
- package/dist/types/polyfill/test-polyfill/unit/shadow-selection.d.ts +0 -0
- package/dist/types/types/components.type.d.ts +16 -0
- package/dist/types/utils/ui.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-034e6348.entry.js +1 -0
- package/dist/vega/p-0cd2b50f.entry.js +1 -0
- package/dist/vega/{p-5453f591.js → p-0e0c47ad.js} +1 -1
- package/dist/vega/p-109a00cf.entry.js +1 -0
- package/dist/vega/p-112455b1.js +1 -0
- package/dist/vega/{p-bdb94242.js → p-11a19ca0.js} +1 -1
- package/dist/vega/{p-a04632d0.js → p-11cb477b.js} +1 -1
- package/dist/vega/p-1564cc4d.entry.js +1 -0
- package/dist/vega/p-18886765.entry.js +1 -0
- package/dist/vega/p-1995e98e.js +1 -0
- package/dist/vega/p-19b26168.entry.js +1 -0
- package/dist/vega/{p-b62f0454.js → p-1ec4b319.js} +1 -1
- package/dist/vega/p-1ec763ab.js +1 -0
- package/dist/vega/p-1fb56e14.js +1 -0
- package/dist/vega/p-21992602.entry.js +1 -0
- package/dist/vega/p-22563151.entry.js +1 -0
- package/dist/vega/p-23795da1.entry.js +1 -0
- package/dist/vega/p-29277e41.entry.js +1 -0
- package/dist/vega/{p-9b797118.js → p-296cc56b.js} +1 -1
- package/dist/vega/p-2a7e9422.entry.js +1 -0
- package/dist/vega/p-2ca6d977.entry.js +1 -0
- package/dist/vega/p-2e419309.entry.js +1 -0
- package/dist/vega/p-2fc3af2f.js +1 -0
- package/dist/vega/p-3039bef8.js +1 -0
- package/dist/vega/{p-e2acbc60.js → p-3152031c.js} +1 -1
- package/dist/vega/p-315667f1.js +1 -0
- package/dist/vega/p-34939c97.entry.js +1 -0
- package/dist/vega/{p-a46329bb.js → p-368d0060.js} +1 -1
- package/dist/vega/p-3897bb2d.entry.js +1 -0
- package/dist/vega/{p-69e63d21.entry.js → p-390c5236.entry.js} +1 -1
- package/dist/vega/{p-af7a3154.js → p-3953c705.js} +1 -1
- package/dist/vega/{p-30860766.js → p-39836361.js} +1 -1
- package/dist/vega/{p-a190c86a.js → p-3b4bde3e.js} +1 -1
- package/dist/vega/p-3ce31dc3.js +1 -0
- package/dist/vega/{p-04215e74.js → p-3f1b542a.js} +1 -1
- package/dist/vega/{p-2d0d575f.js → p-443ad3b3.js} +1 -1
- package/dist/vega/p-452e284a.js +1 -0
- package/dist/vega/p-49f4a666.js +1 -0
- package/dist/vega/p-4bcd6612.js +1 -0
- package/dist/vega/p-4c41dd64.js +1 -0
- package/dist/vega/p-55beac7f.entry.js +1 -0
- package/dist/vega/p-57405834.entry.js +1 -0
- package/dist/vega/p-589e6041.entry.js +1 -0
- package/dist/vega/{p-6a334573.js → p-59bdf9b8.js} +1 -1
- package/dist/vega/p-5e95402a.entry.js +1 -0
- package/dist/vega/p-5eee21b4.entry.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-613ddaab.js +1 -0
- package/dist/vega/{p-2d5a9f66.js → p-62774231.js} +1 -1
- package/dist/vega/p-62cea2e7.entry.js +1 -0
- package/dist/vega/p-65b79fd7.js +1 -0
- package/dist/vega/p-6741e2b9.entry.js +1 -0
- package/dist/vega/p-6a084fe1.entry.js +1 -0
- package/dist/vega/{p-760283d1.entry.js → p-6b286226.entry.js} +1 -1
- package/dist/vega/p-6b722905.entry.js +1 -0
- package/dist/vega/p-6e4b2752.entry.js +1 -0
- package/dist/vega/{p-47c87634.js → p-70151c27.js} +1 -1
- package/dist/vega/p-7209d03b.js +1 -0
- package/dist/vega/p-728b029a.entry.js +1 -0
- package/dist/vega/p-76fc408e.entry.js +1 -0
- package/dist/vega/p-7a40e033.js +1 -0
- package/dist/vega/p-7a9f453e.entry.js +1 -0
- package/dist/vega/p-80ccd894.entry.js +1 -0
- package/dist/vega/{p-ed237efc.js → p-81ead59a.js} +1 -1
- package/dist/vega/{p-987fbbd0.js → p-843a0c1c.js} +1 -1
- package/dist/vega/p-84c597c8.entry.js +1 -0
- package/dist/vega/p-8b78c6a3.entry.js +1 -0
- package/dist/vega/p-8be45a45.entry.js +1 -0
- package/dist/vega/p-8c26227e.js +1 -0
- package/dist/vega/p-8d7b45f7.entry.js +1 -0
- package/dist/vega/p-8e17b9dd.entry.js +1 -0
- package/dist/vega/p-8f93242a.js +1 -0
- package/dist/vega/p-925a2137.js +1 -0
- package/dist/vega/p-92f88033.entry.js +1 -0
- package/dist/vega/p-94de7a02.entry.js +1 -0
- package/dist/vega/p-9968e71d.entry.js +1 -0
- package/dist/vega/p-9c1eeff2.js +2 -0
- package/dist/vega/p-9d1b9e70.entry.js +1 -0
- package/dist/vega/p-a5ffe912.js +1 -0
- package/dist/vega/p-a6104aa7.js +1 -0
- package/dist/vega/p-a6169ad6.entry.js +1 -0
- package/dist/vega/{p-6a8f1251.js → p-a6a7d0c9.js} +1 -1
- package/dist/vega/p-a8bf559a.js +1 -0
- package/dist/vega/p-aacf6920.js +1 -0
- package/dist/vega/p-acf7f903.js +1 -0
- package/dist/vega/p-afec17ad.entry.js +1 -0
- package/dist/vega/p-b1f65b13.js +1 -0
- package/dist/vega/p-b3f9cc3a.entry.js +13 -0
- package/dist/vega/p-b693c1ac.entry.js +1 -0
- package/dist/vega/p-b6af0fc1.entry.js +1 -0
- package/dist/vega/p-b9e2add4.entry.js +1 -0
- package/dist/vega/p-bd894860.entry.js +1 -0
- package/dist/vega/p-c0d6a587.entry.js +1 -0
- package/dist/vega/p-c1d97d12.entry.js +1 -0
- package/dist/vega/p-c26e6820.entry.js +1 -0
- package/dist/vega/p-c34487e1.entry.js +1 -0
- package/dist/vega/p-c532b132.entry.js +1 -0
- package/dist/vega/p-ca2fb711.js +1 -0
- package/dist/vega/p-cebf93f1.entry.js +1 -0
- package/dist/vega/p-cfdc148a.entry.js +1 -0
- package/dist/vega/p-d0351d71.entry.js +1 -0
- package/dist/vega/p-d057999f.js +1 -0
- package/dist/vega/{p-c7d70786.js → p-d171cf44.js} +1 -1
- package/dist/vega/p-d2ab6096.entry.js +1 -0
- package/dist/vega/p-d302f052.entry.js +1 -0
- package/dist/vega/p-d35643c5.entry.js +1 -0
- package/dist/vega/p-d400a1d9.entry.js +1 -0
- package/dist/vega/p-d6732a72.entry.js +1 -0
- package/dist/vega/p-d720b06a.entry.js +1 -0
- package/dist/vega/{p-c59042c0.js → p-d884c644.js} +1 -1
- package/dist/vega/p-d987e404.entry.js +1 -0
- package/dist/vega/p-d9b86108.entry.js +1 -0
- package/dist/vega/p-e0b25eaf.js +1 -0
- package/dist/vega/{p-9f3b1d77.js → p-e1e1fcf0.js} +1 -1
- package/dist/vega/p-e27e115d.entry.js +1 -0
- package/dist/vega/p-e43c2a27.js +1 -0
- package/dist/vega/p-e65c8ac7.entry.js +1 -0
- package/dist/vega/p-e79057cc.js +1 -0
- package/dist/vega/p-e89e9769.entry.js +1 -0
- package/dist/vega/{p-781fd6e0.js → p-eac38d87.js} +1 -1
- package/dist/vega/p-ecd64c7f.entry.js +1 -0
- package/dist/vega/p-ed45b3b6.js +1 -0
- package/dist/vega/p-f357cf46.js +1 -0
- package/dist/vega/p-f5b2e72a.entry.js +1 -0
- package/dist/vega/p-f6af3749.js +1 -0
- package/dist/vega/p-f763e2eb.js +1 -0
- package/dist/vega/p-fc622a75.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +3 -4
- package/dist/cjs/dom-node-subject-observer-factory-2e41340d.js +0 -141
- package/dist/cjs/global-slimmer-registry-b3bce7e0.js +0 -297
- package/dist/cjs/index-40a1cd3a.js +0 -15
- package/dist/cjs/index-5792390b.js +0 -1024
- package/dist/cjs/observer-f49483e8.js +0 -32
- package/dist/collection/helpers/validator/test/rules/file-uploader-required-rule.test.js +0 -7
- package/dist/esm/chevron-down-4303bddb.js +0 -9
- package/dist/esm/dom-node-subject-observer-factory-9461cd67.js +0 -138
- package/dist/esm/global-slimmer-registry-17c4efd4.js +0 -283
- package/dist/esm/index-0830dd1d.js +0 -13
- package/dist/esm/index-0863eec6.js +0 -1019
- package/dist/esm/observer-3959f9dd.js +0 -30
- package/dist/esm/vega-event-id-0f8fc134.js +0 -103
- package/dist/vega/p-00d1904d.entry.js +0 -1
- package/dist/vega/p-039abd28.entry.js +0 -1
- package/dist/vega/p-051fd45b.entry.js +0 -1
- package/dist/vega/p-07a8cf89.entry.js +0 -1
- package/dist/vega/p-0916da7a.entry.js +0 -1
- package/dist/vega/p-0e59c3b7.entry.js +0 -1
- package/dist/vega/p-0fe89d42.js +0 -1
- package/dist/vega/p-0fecf145.js +0 -1
- package/dist/vega/p-105d0265.entry.js +0 -1
- package/dist/vega/p-11786565.entry.js +0 -1
- package/dist/vega/p-12aa4bd2.entry.js +0 -1
- package/dist/vega/p-13d34a23.entry.js +0 -1
- package/dist/vega/p-14fc5aed.entry.js +0 -1
- package/dist/vega/p-1545a693.entry.js +0 -1
- package/dist/vega/p-16bb355d.js +0 -1
- package/dist/vega/p-16bfb3cb.entry.js +0 -1
- package/dist/vega/p-1c298d5a.js +0 -2
- package/dist/vega/p-24d76337.entry.js +0 -1
- package/dist/vega/p-2b5ab7f9.entry.js +0 -1
- package/dist/vega/p-3154fb6b.entry.js +0 -1
- package/dist/vega/p-32f651f7.js +0 -1
- package/dist/vega/p-331a62d5.js +0 -1
- package/dist/vega/p-3e591b2f.entry.js +0 -1
- package/dist/vega/p-4022f395.entry.js +0 -1
- package/dist/vega/p-4163c2c2.js +0 -1
- package/dist/vega/p-47e665ba.entry.js +0 -1
- package/dist/vega/p-4963e445.entry.js +0 -1
- package/dist/vega/p-4d25df7d.js +0 -1
- package/dist/vega/p-51200fe0.entry.js +0 -1
- package/dist/vega/p-535f0758.js +0 -1
- package/dist/vega/p-5440344e.js +0 -1
- package/dist/vega/p-590870e4.js +0 -1
- package/dist/vega/p-5915634b.js +0 -1
- package/dist/vega/p-5dd6ff09.entry.js +0 -1
- package/dist/vega/p-5fbac513.js +0 -1
- package/dist/vega/p-5fe479a1.js +0 -1
- package/dist/vega/p-61f6167c.js +0 -1
- package/dist/vega/p-6556932e.entry.js +0 -1
- package/dist/vega/p-66ffdfdf.entry.js +0 -1
- package/dist/vega/p-68ad953c.js +0 -1
- package/dist/vega/p-6c6d86da.js +0 -1
- package/dist/vega/p-6ca02241.entry.js +0 -13
- package/dist/vega/p-6e1ab235.js +0 -1
- package/dist/vega/p-7002cde3.entry.js +0 -1
- package/dist/vega/p-71939bf8.entry.js +0 -1
- package/dist/vega/p-7372cd79.entry.js +0 -1
- package/dist/vega/p-7df3aa44.entry.js +0 -1
- package/dist/vega/p-810ba5c3.entry.js +0 -1
- package/dist/vega/p-83569225.entry.js +0 -1
- package/dist/vega/p-84118b6d.entry.js +0 -1
- package/dist/vega/p-848825ff.entry.js +0 -1
- package/dist/vega/p-84fa8466.js +0 -1
- package/dist/vega/p-87640a4d.entry.js +0 -1
- package/dist/vega/p-8a091eb7.js +0 -1
- package/dist/vega/p-8b084bf9.entry.js +0 -1
- package/dist/vega/p-8bd327a8.js +0 -1
- package/dist/vega/p-8d23c56b.entry.js +0 -1
- package/dist/vega/p-943e89b4.js +0 -1
- package/dist/vega/p-94861e39.entry.js +0 -1
- package/dist/vega/p-9ba085c1.entry.js +0 -1
- package/dist/vega/p-9e9ec748.js +0 -1
- package/dist/vega/p-9fbdeada.js +0 -1
- package/dist/vega/p-a00122bb.entry.js +0 -1
- package/dist/vega/p-a2b4b6c3.entry.js +0 -1
- package/dist/vega/p-a7fdb16a.js +0 -1
- package/dist/vega/p-acc14aa2.js +0 -1
- package/dist/vega/p-ae5751fb.entry.js +0 -1
- package/dist/vega/p-af086582.entry.js +0 -1
- package/dist/vega/p-b3e754da.entry.js +0 -1
- package/dist/vega/p-b4e92130.entry.js +0 -1
- package/dist/vega/p-b5990090.js +0 -1
- package/dist/vega/p-b5a6f6b9.entry.js +0 -1
- package/dist/vega/p-b8e42c11.entry.js +0 -1
- package/dist/vega/p-bb6f8b70.entry.js +0 -1
- package/dist/vega/p-c1dfdc13.js +0 -1
- package/dist/vega/p-c94ddc57.entry.js +0 -1
- package/dist/vega/p-d642c011.entry.js +0 -1
- package/dist/vega/p-da106a4d.entry.js +0 -1
- package/dist/vega/p-db94558e.entry.js +0 -1
- package/dist/vega/p-dba59bd7.entry.js +0 -1
- package/dist/vega/p-e5cd92f0.entry.js +0 -1
- package/dist/vega/p-e5e0394a.entry.js +0 -1
- package/dist/vega/p-e74a6d22.entry.js +0 -1
- package/dist/vega/p-e828ee94.entry.js +0 -1
- package/dist/vega/p-ea285b12.entry.js +0 -1
- package/dist/vega/p-ead482e6.entry.js +0 -1
- package/dist/vega/p-ec157238.js +0 -1
- package/dist/vega/p-eddcb385.entry.js +0 -1
- package/dist/vega/p-f2685ec5.entry.js +0 -1
- package/dist/vega/p-f404aa83.js +0 -1
- package/dist/vega/p-f46c930f.js +0 -1
- package/dist/vega/p-f556c3cd.entry.js +0 -1
- package/dist/vega/p-f64fb740.entry.js +0 -1
- package/dist/vega/p-f7728ead.entry.js +0 -1
- package/dist/vega/p-faea1620.js +0 -1
- package/dist/vega/p-ffb832b8.entry.js +0 -1
- /package/dist/types/{helpers/validator/test/rules/file-uploader-required-rule.test.d.ts → components/vega-rich-text-editor/test/dto/annotation-actions.test.d.ts} +0 -0
|
@@ -0,0 +1,2184 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const globalSlimmerRegistry = require('./global-slimmer-registry-dd2691b8.js');
|
|
4
|
+
const blockAnnotation_abstract = require('./block-annotation.abstract-4d88b939.js');
|
|
5
|
+
const changeManager = require('./change-manager-bda1d107.js');
|
|
6
|
+
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-093462f1.js');
|
|
7
|
+
const node_abstract = require('./node.abstract-f8075f84.js');
|
|
8
|
+
const vegaInternalEventId = require('./vega-internal-event-id-85b68849.js');
|
|
9
|
+
const typeGuard = require('./type-guard-4ba85fdc.js');
|
|
10
|
+
const textNode = require('./text-node-0d12da5a.js');
|
|
11
|
+
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-8c6a8fb7.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Annotation to make block with horizontal alignment
|
|
15
|
+
*/
|
|
16
|
+
class HorizontalAlignmentAnnotation extends blockAnnotation_abstract.BlockAnnotation {
|
|
17
|
+
constructor(textAlign) {
|
|
18
|
+
super();
|
|
19
|
+
this.type = blockAnnotation_abstract.BlockAnnotationTypeEnum.ALIGNMENT;
|
|
20
|
+
this.textAlign = textAlign;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generate the map item for the annotation
|
|
24
|
+
*
|
|
25
|
+
* @param {VegaRTEBlockAlignment} textAlign - Text alignment
|
|
26
|
+
* @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
|
|
27
|
+
*/
|
|
28
|
+
static from(textAlign) {
|
|
29
|
+
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.ALIGNMENT, new HorizontalAlignmentAnnotation(textAlign)];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate the map item for the annotation by html element
|
|
33
|
+
*
|
|
34
|
+
* @param {HTMLElement} node - An html element.
|
|
35
|
+
* @returns {[BlockAnnotationTypeEnum.ALIGNMENT, HorizontalAlignmentAnnotation]} Map item for the annotation
|
|
36
|
+
*/
|
|
37
|
+
static fromHTML(node) {
|
|
38
|
+
const alignment = this.getTextAlign(node);
|
|
39
|
+
return alignment ? this.from(alignment) : null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Get the text alignment of an HTML element.
|
|
43
|
+
*
|
|
44
|
+
* @param {HTMLElement} node - An HTMLElement.
|
|
45
|
+
* @returns {Nullable<VegaRTEBlockAlignment>} text alignment.
|
|
46
|
+
*/
|
|
47
|
+
static getTextAlign(node) {
|
|
48
|
+
const classList = node.classList;
|
|
49
|
+
if (classList.contains(`v-rte--horizontal-alignment-left`)) {
|
|
50
|
+
return 'left';
|
|
51
|
+
}
|
|
52
|
+
else if (classList.contains(`v-rte--horizontal-alignment-center`)) {
|
|
53
|
+
return 'center';
|
|
54
|
+
}
|
|
55
|
+
else if (classList.contains(`v-rte--horizontal-alignment-right`)) {
|
|
56
|
+
return 'right';
|
|
57
|
+
}
|
|
58
|
+
else if (classList.contains(`v-rte--horizontal-alignment-justify`)) {
|
|
59
|
+
return 'justify';
|
|
60
|
+
}
|
|
61
|
+
const style = node.style;
|
|
62
|
+
switch (style.textAlign) {
|
|
63
|
+
case 'center':
|
|
64
|
+
return 'center';
|
|
65
|
+
case 'right':
|
|
66
|
+
return 'right';
|
|
67
|
+
case 'justify':
|
|
68
|
+
return 'justify';
|
|
69
|
+
case 'left':
|
|
70
|
+
return 'left';
|
|
71
|
+
default:
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Generate the JSON item of the annotation
|
|
77
|
+
*
|
|
78
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
79
|
+
*/
|
|
80
|
+
toJSON() {
|
|
81
|
+
return {
|
|
82
|
+
textAlign: this.textAlign,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Generate the class for the annotation
|
|
87
|
+
*
|
|
88
|
+
* @returns {string} - Annotation class
|
|
89
|
+
*/
|
|
90
|
+
renderClass() {
|
|
91
|
+
return `v-rte--horizontal-alignment-${this.textAlign}`;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Generate the style for the annotation
|
|
95
|
+
*
|
|
96
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
97
|
+
*/
|
|
98
|
+
render() {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Annotation for block indentation
|
|
105
|
+
*/
|
|
106
|
+
class IndentAnnotation extends blockAnnotation_abstract.BlockAnnotation {
|
|
107
|
+
constructor(indent) {
|
|
108
|
+
super();
|
|
109
|
+
this.type = blockAnnotation_abstract.BlockAnnotationTypeEnum.INDENT;
|
|
110
|
+
this.indent = Math.max(0, indent);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Generate the map item for the annotation
|
|
114
|
+
*
|
|
115
|
+
* @param {number} indent - Text alignment
|
|
116
|
+
* @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
|
|
117
|
+
*/
|
|
118
|
+
static from(indent) {
|
|
119
|
+
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.INDENT, new IndentAnnotation(indent)];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Generate the map item for the annotation by html element
|
|
123
|
+
*
|
|
124
|
+
* @param {HTMLElement} node - An html element.
|
|
125
|
+
* @returns {[BlockAnnotationTypeEnum.INDENT, IndentAnnotation]} Map item for the annotation
|
|
126
|
+
*/
|
|
127
|
+
static fromHTML(node) {
|
|
128
|
+
const marginLeft = this.getMarginLeft(node);
|
|
129
|
+
return marginLeft && marginLeft >= 0 ? this.from(Math.floor(marginLeft / 16)) : null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Retrieves the left margin value of an HTML element.
|
|
133
|
+
*
|
|
134
|
+
* @param {HTMLElement} node - An html element.
|
|
135
|
+
* @returns {number} margin left.
|
|
136
|
+
*/
|
|
137
|
+
static getMarginLeft(node) {
|
|
138
|
+
const style = node.style;
|
|
139
|
+
let marginLeft;
|
|
140
|
+
if (style.marginLeft) {
|
|
141
|
+
marginLeft = style.marginLeft;
|
|
142
|
+
}
|
|
143
|
+
else if (style.margin) {
|
|
144
|
+
const margins = style.margin.split(' ');
|
|
145
|
+
switch (margins.length) {
|
|
146
|
+
case 4:
|
|
147
|
+
marginLeft = margins[3];
|
|
148
|
+
break;
|
|
149
|
+
case 2:
|
|
150
|
+
case 3:
|
|
151
|
+
marginLeft = margins[1];
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
marginLeft = margins[0];
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
return Number(marginLeft.replace('px', ''));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Generate the JSON item of the annotation
|
|
165
|
+
*
|
|
166
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
167
|
+
*/
|
|
168
|
+
toJSON() {
|
|
169
|
+
return this.indent > 0 ? { indent: this.indent } : null;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Generate the style for the annotation
|
|
173
|
+
*
|
|
174
|
+
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
175
|
+
*/
|
|
176
|
+
render() {
|
|
177
|
+
return this.indent > 0 ? { 'margin-left': `${this.indent * 16}px` } : null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** The class contains some common method to modify the blocks property */
|
|
182
|
+
class BlockBaseOperator {
|
|
183
|
+
/**
|
|
184
|
+
* Replaces a specific block with an array of blocks within a RTEContentBlock array.
|
|
185
|
+
*
|
|
186
|
+
* @param {RTEBlock} referBlock - Used as a reference block to identify the block that needs to be replaced in the `blocks` array.
|
|
187
|
+
* @param {RTEBlock[]} blocks - An array of RTEBlock objects that you want to replace the `referBlock` with in the `blocks` array.
|
|
188
|
+
*/
|
|
189
|
+
replaceBlockWithBlocks(referBlock, blocks) {
|
|
190
|
+
if (this.blocks) {
|
|
191
|
+
blocks.forEach((block) => {
|
|
192
|
+
block.parent = this;
|
|
193
|
+
});
|
|
194
|
+
this.blocks = this.blocks.flatMap((block) => {
|
|
195
|
+
if (block === referBlock) {
|
|
196
|
+
return blocks;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return block;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Appends new blocks to an array and sets their parent property to a specific type.
|
|
206
|
+
*
|
|
207
|
+
* @param {RTEBlock[]} newBlocks - An array of `RTEBlock` objects that are being passed to the `appendChildBlocks` method.
|
|
208
|
+
*/
|
|
209
|
+
appendChildBlocks(newBlocks) {
|
|
210
|
+
if (this.blocks) {
|
|
211
|
+
newBlocks.forEach((block) => {
|
|
212
|
+
block.parent = this;
|
|
213
|
+
});
|
|
214
|
+
this.blocks = this.blocks.concat(newBlocks);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Removes a specified RTEBlock from an array of blocks.
|
|
219
|
+
*
|
|
220
|
+
* @param {RTEBlock} blockToBeRemoved - The block that needs to be removed from the `blocks` array.
|
|
221
|
+
*/
|
|
222
|
+
removeChildBlock(blockToBeRemoved) {
|
|
223
|
+
if (this.blocks) {
|
|
224
|
+
this.blocks = this.blocks.filter((block) => block !== blockToBeRemoved);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Append blocks or nodes to a block */
|
|
230
|
+
class AppendChildNodesAction extends node_abstract.ModifyContentAction {
|
|
231
|
+
constructor(childNodes) {
|
|
232
|
+
super();
|
|
233
|
+
this.type = node_abstract.ModifyContentActionType.APPEND_CHILD_NODES;
|
|
234
|
+
this.entityToBeAppended = childNodes;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Delete child node or child block from the current list action
|
|
240
|
+
*
|
|
241
|
+
* @example needRemovedNode.parentBlock.apply(new RemoveChildAction(needRemovedNode))
|
|
242
|
+
* @example needRemovedBlock.parent.apply(new RemoveChildAction(needRemovedBlock))
|
|
243
|
+
*/
|
|
244
|
+
class RemoveChildAction extends node_abstract.ModifyContentAction {
|
|
245
|
+
constructor(childNode) {
|
|
246
|
+
super();
|
|
247
|
+
this.type = node_abstract.ModifyContentActionType.DELETE_CHILD;
|
|
248
|
+
this.entityToBeRemoved = childNode;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Text style annotation
|
|
254
|
+
*/
|
|
255
|
+
class TextStyleAnnotation extends blockAnnotation_abstract.BlockAnnotation {
|
|
256
|
+
constructor(textStyle) {
|
|
257
|
+
super();
|
|
258
|
+
this.type = blockAnnotation_abstract.BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
259
|
+
this.textStyle = textStyle;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Generate the map item for the annotations
|
|
263
|
+
*
|
|
264
|
+
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
265
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
266
|
+
*/
|
|
267
|
+
static from(textStyle) {
|
|
268
|
+
return [blockAnnotation_abstract.BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Generate the map item for the annotation by html element
|
|
272
|
+
*
|
|
273
|
+
* @param {HTMLElement} node - An html element.
|
|
274
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
275
|
+
*/
|
|
276
|
+
static fromHTML(node) {
|
|
277
|
+
return this.from(this.getTextStyle(node));
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get the type of block.
|
|
281
|
+
*
|
|
282
|
+
* @param {HTMLElement} node - An HTMLElement.
|
|
283
|
+
* @returns {VegaRTETextStyleType} text style type.
|
|
284
|
+
*/
|
|
285
|
+
static getTextStyle(node) {
|
|
286
|
+
if (node.nodeType !== Node.TEXT_NODE && node.hasAttribute('data-type')) {
|
|
287
|
+
return node.getAttribute('data-type');
|
|
288
|
+
}
|
|
289
|
+
switch (node.style.fontSize) {
|
|
290
|
+
case '36px':
|
|
291
|
+
return 'title';
|
|
292
|
+
case '28px':
|
|
293
|
+
return 'subtitle';
|
|
294
|
+
case '22px':
|
|
295
|
+
return 'heading-1';
|
|
296
|
+
case '20px':
|
|
297
|
+
return 'heading-2';
|
|
298
|
+
case '18px':
|
|
299
|
+
return 'heading-3';
|
|
300
|
+
}
|
|
301
|
+
switch (node.nodeName) {
|
|
302
|
+
case 'H1':
|
|
303
|
+
return 'heading-1';
|
|
304
|
+
case 'H2':
|
|
305
|
+
return 'heading-2';
|
|
306
|
+
case 'H3':
|
|
307
|
+
return 'heading-3';
|
|
308
|
+
default:
|
|
309
|
+
return 'paragraph';
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Generate the JSON representation of the annotation
|
|
314
|
+
*
|
|
315
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
316
|
+
*/
|
|
317
|
+
toJSON() {
|
|
318
|
+
return { textStyle: this.textStyle };
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Render the styles by block type
|
|
322
|
+
*
|
|
323
|
+
* @returns {AnnotationStyle} the styles to apply
|
|
324
|
+
*/
|
|
325
|
+
render() {
|
|
326
|
+
const paragraphStyle = {
|
|
327
|
+
fontFamily: 'Inter',
|
|
328
|
+
fontSize: '16px',
|
|
329
|
+
lineHeight: '22px',
|
|
330
|
+
fontWeight: '500',
|
|
331
|
+
};
|
|
332
|
+
switch (this.textStyle) {
|
|
333
|
+
case 'paragraph': {
|
|
334
|
+
return paragraphStyle;
|
|
335
|
+
}
|
|
336
|
+
case 'title': {
|
|
337
|
+
return { fontFamily: 'Inter', fontSize: '36px', lineHeight: '40px', fontWeight: '500' };
|
|
338
|
+
}
|
|
339
|
+
case 'subtitle': {
|
|
340
|
+
return { fontFamily: 'Inter', fontSize: '28px', lineHeight: '32px', fontWeight: '500' };
|
|
341
|
+
}
|
|
342
|
+
case 'heading-1': {
|
|
343
|
+
return { fontFamily: 'Inter', fontSize: '22px', lineHeight: '24px', fontWeight: '500' };
|
|
344
|
+
}
|
|
345
|
+
case 'heading-2': {
|
|
346
|
+
return { fontFamily: 'Inter', fontSize: '20px', lineHeight: '24px', fontWeight: '500' };
|
|
347
|
+
}
|
|
348
|
+
case 'heading-3': {
|
|
349
|
+
return { fontFamily: 'Inter', fontSize: '18px', lineHeight: '22px', fontWeight: '500' };
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Abstract class for block
|
|
357
|
+
*/
|
|
358
|
+
class RTEBlock extends BlockBaseOperator {
|
|
359
|
+
constructor(id) {
|
|
360
|
+
super();
|
|
361
|
+
this.annotationMap = new Map();
|
|
362
|
+
this.id = id;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
366
|
+
* and value.
|
|
367
|
+
*
|
|
368
|
+
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
369
|
+
* the type of annotation entity to create.
|
|
370
|
+
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
371
|
+
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
372
|
+
* annotation being created.
|
|
373
|
+
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
374
|
+
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
375
|
+
*/
|
|
376
|
+
static createAnnotationEntity(type, value) {
|
|
377
|
+
switch (type) {
|
|
378
|
+
case 'textAlign':
|
|
379
|
+
return HorizontalAlignmentAnnotation.from(value);
|
|
380
|
+
case 'indent':
|
|
381
|
+
return IndentAnnotation.from(value);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Create annotations for block element.
|
|
386
|
+
*
|
|
387
|
+
* @param {string} type - Annotations type.
|
|
388
|
+
* @param {HTMLElement} node - current node.
|
|
389
|
+
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} - result.
|
|
390
|
+
*/
|
|
391
|
+
static createAnnotationEntityFromHTML(type, node) {
|
|
392
|
+
switch (type) {
|
|
393
|
+
case 'ALIGNMENT':
|
|
394
|
+
return HorizontalAlignmentAnnotation.fromHTML(node);
|
|
395
|
+
case 'TEXT_STYLE':
|
|
396
|
+
return TextStyleAnnotation.fromHTML(node);
|
|
397
|
+
case 'INDENT':
|
|
398
|
+
return IndentAnnotation.fromHTML(node);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Class to JSON object
|
|
403
|
+
*
|
|
404
|
+
* @returns {VegaRTEBlockBase} - JSON object
|
|
405
|
+
*/
|
|
406
|
+
toJSON() {
|
|
407
|
+
const annotations = Array.from(this.annotationMap.values())
|
|
408
|
+
.filter((annotation) => annotation instanceof blockAnnotation_abstract.BlockAnnotation)
|
|
409
|
+
.reduce((record, annotation) => {
|
|
410
|
+
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
411
|
+
}, {});
|
|
412
|
+
return Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {}));
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Get annotation by type
|
|
416
|
+
*
|
|
417
|
+
* @param {keyof typeof BlockAnnotationTypeEnum} type - Annotation type
|
|
418
|
+
* @returns {Nullable<BlockAnnotation> | Nullable<LinkGroupAnnotation>} - Annotation
|
|
419
|
+
*/
|
|
420
|
+
getAnnotationByType(type) {
|
|
421
|
+
return this.annotationMap.get(type);
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Apply action to block
|
|
425
|
+
*
|
|
426
|
+
* @param {AnnotationAction} action - Annotation action
|
|
427
|
+
*/
|
|
428
|
+
apply(action) {
|
|
429
|
+
this.doApply(action);
|
|
430
|
+
if (action.isFlushable) {
|
|
431
|
+
const domNode = node_abstract.stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
432
|
+
if (domNode) {
|
|
433
|
+
const nodeSubject = domNodeSubjectObserverFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
434
|
+
if (nodeSubject) {
|
|
435
|
+
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Apply action to block
|
|
442
|
+
*
|
|
443
|
+
* @param {AnnotationAction|ModifyContentAction} action - Annotation action
|
|
444
|
+
*/
|
|
445
|
+
doApply(action) {
|
|
446
|
+
if (action instanceof node_abstract.ModifyContentAction) {
|
|
447
|
+
this.doModifyActionApply(action);
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
this.applyAnnotationAction(action);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Apply annotation action to block
|
|
455
|
+
*
|
|
456
|
+
* @param {AnnotationAction} action - Annotation action
|
|
457
|
+
*/
|
|
458
|
+
applyAnnotationAction(action) {
|
|
459
|
+
const annotation = action.toAnnotation();
|
|
460
|
+
this.annotationMap.set(annotation.type, annotation);
|
|
461
|
+
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Get styles from annotations
|
|
465
|
+
*
|
|
466
|
+
* @returns {AnnotationStyle} - Annotation style
|
|
467
|
+
*/
|
|
468
|
+
getStyles() {
|
|
469
|
+
return Array.from(this.annotationMap.values())
|
|
470
|
+
.filter((annotation) => annotation instanceof blockAnnotation_abstract.BlockAnnotation)
|
|
471
|
+
.map((annotation) => annotation.render())
|
|
472
|
+
.filter(typeGuard.isNonNullable)
|
|
473
|
+
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Get classes from annotations
|
|
477
|
+
*
|
|
478
|
+
* @returns {AnnotationStyle} - Annotation style
|
|
479
|
+
*/
|
|
480
|
+
getClasses() {
|
|
481
|
+
return Array.from(this.annotationMap.values())
|
|
482
|
+
.map((annotation) => { var _a; return (_a = annotation.renderClass) === null || _a === void 0 ? void 0 : _a.call(annotation); })
|
|
483
|
+
.filter(typeGuard.isNonNullable)
|
|
484
|
+
.reduce((pre, cur) => [pre, cur].join(' '), '');
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* 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.
|
|
488
|
+
*
|
|
489
|
+
* @param {RTENode[]} nodesToBeAppended - An array of `RTENode` objects that you want to append to the current block.
|
|
490
|
+
*/
|
|
491
|
+
appendChildNodes(nodesToBeAppended) {
|
|
492
|
+
nodesToBeAppended.forEach((node) => {
|
|
493
|
+
node.parentBlock = this;
|
|
494
|
+
});
|
|
495
|
+
this['nodes'] = this['nodes'].concat(nodesToBeAppended);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
|
|
499
|
+
*
|
|
500
|
+
* @param {RTEBlock} secondBlock - A block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
501
|
+
*/
|
|
502
|
+
mergeTwoBlocksNodes(secondBlock) {
|
|
503
|
+
if (this.type === secondBlock.type || (this.type !== 'image' && secondBlock.type !== 'image')) {
|
|
504
|
+
let shouldMergeNodes = secondBlock['nodes'];
|
|
505
|
+
if (this.type !== 'image') {
|
|
506
|
+
shouldMergeNodes = secondBlock['nodes'].filter((node) => node['text'] && node['text'] !== textNode.ZERO_WIDTH_SPACE);
|
|
507
|
+
}
|
|
508
|
+
this.apply(new AppendChildNodesAction(shouldMergeNodes));
|
|
509
|
+
secondBlock.parent.apply(new RemoveChildAction(secondBlock));
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Concat the child nodes of multiple RTEBlocks if both are not images.
|
|
514
|
+
*
|
|
515
|
+
* @param {RTEBlock[]} blocks - multiple block of content in a rich text editor, such as a paragraph, heading, image, etc.
|
|
516
|
+
* @returns {RTENode[]} Array of connected block nodes
|
|
517
|
+
*/
|
|
518
|
+
concatBlocksNodes(blocks) {
|
|
519
|
+
const nodes = [];
|
|
520
|
+
blocks.map((block) => {
|
|
521
|
+
if (block.type !== 'image') {
|
|
522
|
+
nodes.push(...block['nodes']);
|
|
523
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
return nodes;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Returns the previous node relative to the current node in a rich text editor structure.
|
|
530
|
+
*
|
|
531
|
+
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
532
|
+
* @returns {Nullable<RTENode>} the previous block last node
|
|
533
|
+
*/
|
|
534
|
+
getPreviousNode(currentNode) {
|
|
535
|
+
const currentBlock = currentNode.parentBlock;
|
|
536
|
+
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
537
|
+
if (currentIndex > 0) {
|
|
538
|
+
return currentBlock['nodes'][currentIndex - 1];
|
|
539
|
+
}
|
|
540
|
+
else if (currentBlock.parent) {
|
|
541
|
+
const previousBlock = this.getPreviousBlock(currentBlock);
|
|
542
|
+
if (previousBlock) {
|
|
543
|
+
return this.getBlockLastNode(previousBlock);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Returns the next node relative to the current node in a rich text editor structure.
|
|
549
|
+
*
|
|
550
|
+
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
551
|
+
* @returns {Nullable<RTENode>} the next block first node
|
|
552
|
+
*/
|
|
553
|
+
getNextNode(currentNode) {
|
|
554
|
+
const currentBlock = currentNode.parentBlock;
|
|
555
|
+
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
556
|
+
if (currentBlock['nodes'][currentIndex + 1]) {
|
|
557
|
+
return currentBlock['nodes'][currentIndex + 1];
|
|
558
|
+
}
|
|
559
|
+
else if (currentBlock.parent) {
|
|
560
|
+
const nextBlock = this.getNextBlock(currentBlock);
|
|
561
|
+
if (nextBlock) {
|
|
562
|
+
return this.getBlockFirstNode(nextBlock);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Determines if a given node is the first node within the current state.
|
|
568
|
+
*
|
|
569
|
+
* @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
|
|
570
|
+
* @returns {boolean} True or false;
|
|
571
|
+
*/
|
|
572
|
+
isContentFirstNode(currentNode) {
|
|
573
|
+
const currentBlock = currentNode.parentBlock;
|
|
574
|
+
const currentIndex = currentBlock['nodes'].indexOf(currentNode);
|
|
575
|
+
const parent = currentBlock.parent;
|
|
576
|
+
if (currentBlock.type === 'list-item') {
|
|
577
|
+
const listParent = parent.parent;
|
|
578
|
+
return (currentIndex === 0 &&
|
|
579
|
+
Array.isArray(parent.blocks) &&
|
|
580
|
+
parent.blocks[0] === currentBlock &&
|
|
581
|
+
listParent['type'] !== 'list-item' &&
|
|
582
|
+
Array.isArray(listParent.blocks) &&
|
|
583
|
+
listParent.blocks[0] === parent);
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
return currentIndex === 0 && Array.isArray(parent.blocks) && parent.blocks[0] === currentBlock;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Returns the last node within a given RTE block, handling different block types accordingly.
|
|
591
|
+
*
|
|
592
|
+
* @param {RTEBlock} currentBlock - Returns the last node within that block.
|
|
593
|
+
* @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
|
|
594
|
+
*/
|
|
595
|
+
getBlockLastNode(currentBlock) {
|
|
596
|
+
if (currentBlock.type === 'list-item') {
|
|
597
|
+
if (currentBlock['children'] && currentBlock['children'].length > 0) {
|
|
598
|
+
return this.getBlockLastNode(currentBlock['children'][currentBlock['children'].length - 1]);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
return currentBlock['nodes'][currentBlock['nodes'].length - 1];
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
else if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
605
|
+
if (currentBlock.blocks) {
|
|
606
|
+
const lastListItem = currentBlock.blocks[currentBlock.blocks.length - 1];
|
|
607
|
+
return this.getBlockLastNode(lastListItem);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
if (currentBlock['nodes']) {
|
|
612
|
+
return currentBlock['nodes'][currentBlock['nodes'].length - 1];
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Returns the first node within a given RTE block, handling different block types accordingly.
|
|
618
|
+
*
|
|
619
|
+
* @param {RTEBlock} currentBlock - Returns the first node within that block.
|
|
620
|
+
* @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
|
|
621
|
+
*/
|
|
622
|
+
getBlockFirstNode(currentBlock) {
|
|
623
|
+
if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
624
|
+
if (currentBlock.blocks) {
|
|
625
|
+
const firstListItem = currentBlock.blocks[0];
|
|
626
|
+
return this.getBlockFirstNode(firstListItem);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
if (currentBlock['nodes']) {
|
|
631
|
+
return currentBlock['nodes'][0];
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* TODO: The getPreviousBlock add nest list support
|
|
637
|
+
* This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
638
|
+
*
|
|
639
|
+
* @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
|
|
640
|
+
* @returns {Nullable<RTEBlock>} The previous block if existing
|
|
641
|
+
*/
|
|
642
|
+
getPreviousBlock(currentBlock) {
|
|
643
|
+
if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
|
|
644
|
+
const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
|
|
645
|
+
if (currentBlockIndex > 0) {
|
|
646
|
+
return currentBlock.parent.blocks[currentBlockIndex - 1];
|
|
647
|
+
}
|
|
648
|
+
else if ((currentBlock.parent['type'] === 'number-list' ||
|
|
649
|
+
currentBlock.parent['type'] === 'bullet-list') &&
|
|
650
|
+
currentBlockIndex === 0) {
|
|
651
|
+
return this.getPreviousBlock(currentBlock.parent);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
657
|
+
*
|
|
658
|
+
* @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
|
|
659
|
+
* @returns {Nullable<RTEBlock>} The next block if existing
|
|
660
|
+
*/
|
|
661
|
+
getNextBlock(currentBlock) {
|
|
662
|
+
if (currentBlock && currentBlock.parent && currentBlock.parent.blocks) {
|
|
663
|
+
const currentBlockIndex = currentBlock.parent.blocks.indexOf(currentBlock);
|
|
664
|
+
if (currentBlock.parent.blocks[currentBlockIndex + 1]) {
|
|
665
|
+
return currentBlock.parent.blocks[currentBlockIndex + 1];
|
|
666
|
+
}
|
|
667
|
+
else if (currentBlock.type === 'list-item' &&
|
|
668
|
+
currentBlock.parent.blocks.length === currentBlockIndex + 1) {
|
|
669
|
+
return this.getNextBlock(currentBlock.parent);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Replaces a specific node with an array of nodes within a RTENode array.
|
|
675
|
+
*
|
|
676
|
+
* @param {RTENode} referNode - Used as a reference node to identify the node that needs to be replaced in the `nodes` array.
|
|
677
|
+
* @param {RTENode[]} nodes - An array of RTENode objects that you want to replace the `referNode` with in the `nodes` array.
|
|
678
|
+
*/
|
|
679
|
+
replaceNodeWithNodes(referNode, nodes) {
|
|
680
|
+
if (this['nodes']) {
|
|
681
|
+
nodes.forEach((node) => {
|
|
682
|
+
node.parentBlock = this;
|
|
683
|
+
});
|
|
684
|
+
this['nodes'] = this['nodes'].flatMap((node) => {
|
|
685
|
+
if (node === referNode) {
|
|
686
|
+
return nodes;
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
return node;
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Annotation for image
|
|
698
|
+
*/
|
|
699
|
+
class ImageAnnotation extends node_abstract.NodeAnnotation {
|
|
700
|
+
constructor(size = 'md', alt) {
|
|
701
|
+
super();
|
|
702
|
+
this.type = node_abstract.NodeAnnotationTypeEnum.IMAGE;
|
|
703
|
+
this.size = size;
|
|
704
|
+
this.alt = alt;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Generate the map item for the annotation
|
|
708
|
+
*
|
|
709
|
+
* @param {string} size - Image size
|
|
710
|
+
* @param {string} alt - Image alt
|
|
711
|
+
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
712
|
+
*/
|
|
713
|
+
static from(size, alt) {
|
|
714
|
+
return [node_abstract.NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Generate the map item for the annotation
|
|
718
|
+
*
|
|
719
|
+
* @param {VegaRichTextImageEditorSizeType} size - size.
|
|
720
|
+
* @param {string} alt - alt.
|
|
721
|
+
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
722
|
+
*/
|
|
723
|
+
static fromHTML(size, alt) {
|
|
724
|
+
return this.from(size || 'md', alt);
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Generate the JSON representation of the annotation
|
|
728
|
+
*
|
|
729
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
730
|
+
*/
|
|
731
|
+
toJSON() {
|
|
732
|
+
return typeGuard.isNonNullable(this.alt)
|
|
733
|
+
? {
|
|
734
|
+
size: this.size,
|
|
735
|
+
alt: this.alt,
|
|
736
|
+
}
|
|
737
|
+
: {
|
|
738
|
+
size: this.size,
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Generate the style for the image
|
|
743
|
+
*
|
|
744
|
+
* @returns {Nullable<AnnotationStyle>} image style
|
|
745
|
+
*/
|
|
746
|
+
render() {
|
|
747
|
+
switch (this.size) {
|
|
748
|
+
case 'sm': {
|
|
749
|
+
return { width: '25%' };
|
|
750
|
+
}
|
|
751
|
+
case 'md': {
|
|
752
|
+
return { width: '50%' };
|
|
753
|
+
}
|
|
754
|
+
case 'lg': {
|
|
755
|
+
return { width: '100%' };
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Action to add an image annotation to the editor
|
|
763
|
+
*/
|
|
764
|
+
class ImageAnnotationAction extends textNode.AnnotationAction {
|
|
765
|
+
constructor(size, alt) {
|
|
766
|
+
super();
|
|
767
|
+
this.isFlushable = true;
|
|
768
|
+
this.size = size;
|
|
769
|
+
this.alt = alt;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Converts the action to an annotation
|
|
773
|
+
*
|
|
774
|
+
* @returns {ImageAnnotation} The annotation
|
|
775
|
+
*/
|
|
776
|
+
toAnnotation() {
|
|
777
|
+
return new ImageAnnotation(this.size, this.alt);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
class RTEImageNode extends node_abstract.RTENode {
|
|
782
|
+
constructor(id, url, parentBlock, annotationMap) {
|
|
783
|
+
super(id, annotationMap);
|
|
784
|
+
this.type = node_abstract.NodeTypeEnum.IMAGE;
|
|
785
|
+
this.url = url;
|
|
786
|
+
this.parentBlock = parentBlock;
|
|
787
|
+
}
|
|
788
|
+
static from(image, parentBlock) {
|
|
789
|
+
const imageNode = new RTEImageNode(image.id, image.url, parentBlock);
|
|
790
|
+
let annotations;
|
|
791
|
+
if (!image.annotations || Object.keys(image.annotations).length === 0) {
|
|
792
|
+
annotations = { size: 'md' };
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
annotations = image.annotations;
|
|
796
|
+
}
|
|
797
|
+
imageNode.annotationMap = new Map(Object.keys(annotations)
|
|
798
|
+
.map(() => ImageAnnotation.from(annotations.size, annotations.alt))
|
|
799
|
+
.filter(typeGuard.isNonNullable));
|
|
800
|
+
return imageNode;
|
|
801
|
+
}
|
|
802
|
+
static fromHTML(node, parentBlock) {
|
|
803
|
+
const src = node.nodeName === 'IMG'
|
|
804
|
+
? node.src
|
|
805
|
+
: node.querySelector('img').src;
|
|
806
|
+
const size = node.size;
|
|
807
|
+
const imageNode = new RTEImageNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), src, parentBlock);
|
|
808
|
+
imageNode.annotationMap = new Map([ImageAnnotation.fromHTML(size, node.alt)]);
|
|
809
|
+
return imageNode;
|
|
810
|
+
}
|
|
811
|
+
toJSON() {
|
|
812
|
+
const imageAnnotation = this.annotationMap.get(node_abstract.NodeAnnotationTypeEnum.IMAGE);
|
|
813
|
+
const annotations = {};
|
|
814
|
+
if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size) {
|
|
815
|
+
annotations.size = imageAnnotation.size;
|
|
816
|
+
}
|
|
817
|
+
if (imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt) {
|
|
818
|
+
annotations.alt = imageAnnotation.alt;
|
|
819
|
+
}
|
|
820
|
+
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'image', url: this.url });
|
|
821
|
+
}
|
|
822
|
+
render({ editable } = {}) {
|
|
823
|
+
const imageAnnotation = this.annotationMap.get(node_abstract.NodeAnnotationTypeEnum.IMAGE);
|
|
824
|
+
const size = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.size;
|
|
825
|
+
const alt = imageAnnotation === null || imageAnnotation === void 0 ? void 0 : imageAnnotation.alt;
|
|
826
|
+
const handleChange = ({ detail, }) => {
|
|
827
|
+
switch (detail.action) {
|
|
828
|
+
case 'edit': {
|
|
829
|
+
const size = detail.payload.size;
|
|
830
|
+
const alt = detail.payload.alt;
|
|
831
|
+
this.apply(new ImageAnnotationAction(size, alt));
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
/*
|
|
835
|
+
* The below method is e2e-test covered in
|
|
836
|
+
* @see{module:vega-rich-text-editor-image-click-delete-button}
|
|
837
|
+
*/
|
|
838
|
+
/* istanbul ignore next */
|
|
839
|
+
case 'delete': {
|
|
840
|
+
const event = new InputEvent('beforeinput', {
|
|
841
|
+
inputType: 'deleteContentBackward',
|
|
842
|
+
bubbles: true,
|
|
843
|
+
});
|
|
844
|
+
setTimeout(() => {
|
|
845
|
+
node_abstract.stateEntityRenderingRegistry.getDOMByEntity(this).dispatchEvent(event);
|
|
846
|
+
}, 50);
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
return editable ? (globalSlimmerRegistry.h("vega-rich-text-image-editor", { style: this.getStyles(), size: size, alt: alt, ref: (ref) => {
|
|
852
|
+
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, domNodeSubjectObserverFactory.VegaChange, handleChange);
|
|
853
|
+
} }, this.renderImage(editable, alt))) : (this.renderImage(editable, alt));
|
|
854
|
+
}
|
|
855
|
+
doAnnotationActionApply(action) {
|
|
856
|
+
const annotation = action.toAnnotation();
|
|
857
|
+
this.annotationMap.set(annotation.type, annotation);
|
|
858
|
+
}
|
|
859
|
+
// placeholder method
|
|
860
|
+
/* istanbul ignore next */
|
|
861
|
+
doModifyActionApply(action) {
|
|
862
|
+
}
|
|
863
|
+
registerRef(ref) {
|
|
864
|
+
if (ref) {
|
|
865
|
+
node_abstract.stateEntityRenderingRegistry.register(ref, this);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
renderImage(editable, alt) {
|
|
869
|
+
return (globalSlimmerRegistry.h("img", { style: editable ? { width: '100%' } : this.getStyles(), alt: alt, src: this.url, ref: this.registerRef.bind(this) }));
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Clear the current block nodes and append new nodes
|
|
875
|
+
*
|
|
876
|
+
* @example block.apply(new ReplaceChildNodesAction(newNodes))
|
|
877
|
+
*/
|
|
878
|
+
class ReplaceChildNodesAction extends node_abstract.ModifyContentAction {
|
|
879
|
+
constructor(newChildNodes) {
|
|
880
|
+
super();
|
|
881
|
+
this.type = node_abstract.ModifyContentActionType.REPLACE_CHILD_NODES;
|
|
882
|
+
this.newChildNodes = newChildNodes;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Insert a new block after a existing block
|
|
888
|
+
*
|
|
889
|
+
* @example currentBlock.parent.apply(new InsertBlocksAfterAction(currentBlock, newBlock, ...))
|
|
890
|
+
*/
|
|
891
|
+
class InsertBlocksAfterAction extends node_abstract.ModifyContentAction {
|
|
892
|
+
constructor(referBlock, ...blocksToBeInserted) {
|
|
893
|
+
super();
|
|
894
|
+
this.type = node_abstract.ModifyContentActionType.INSERT_BLOCKS_AFTER;
|
|
895
|
+
this.referBlock = referBlock;
|
|
896
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Split the block with a split point node.
|
|
902
|
+
* The property `newBlock` use to store the new create block if need.
|
|
903
|
+
*
|
|
904
|
+
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
905
|
+
*/
|
|
906
|
+
class SplitBlockWithNodeAction extends node_abstract.ModifyContentAction {
|
|
907
|
+
constructor(splitPointNode, startOffsetOfNode) {
|
|
908
|
+
super();
|
|
909
|
+
this.type = node_abstract.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
|
|
910
|
+
this.splitPointNode = splitPointNode;
|
|
911
|
+
this.startOffsetOfNode = startOffsetOfNode;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Action to change the text style of a block
|
|
917
|
+
*/
|
|
918
|
+
class TextStyleAnnotationAction extends textNode.AnnotationAction {
|
|
919
|
+
constructor(textStyle, bold) {
|
|
920
|
+
super();
|
|
921
|
+
this.isFlushable = true;
|
|
922
|
+
this.textStyle = textStyle;
|
|
923
|
+
this.bold = bold;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Converts the action to a block annotation
|
|
927
|
+
*
|
|
928
|
+
* @returns {BlockAnnotation} the block annotation
|
|
929
|
+
*/
|
|
930
|
+
toAnnotation() {
|
|
931
|
+
return new TextStyleAnnotation(this.textStyle);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Action to toggle bold annotation
|
|
937
|
+
*/
|
|
938
|
+
class BoldAnnotationAction extends textNode.TextSplittableAction {
|
|
939
|
+
constructor(bold) {
|
|
940
|
+
super();
|
|
941
|
+
this.isFlushable = true;
|
|
942
|
+
this.bold = bold;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Converts the action to an annotation
|
|
946
|
+
*
|
|
947
|
+
* @returns {BoldAnnotation} the annotation
|
|
948
|
+
*/
|
|
949
|
+
toAnnotation() {
|
|
950
|
+
return new textNode.BoldAnnotation(this.bold);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
|
|
956
|
+
*
|
|
957
|
+
* @example firstBlock.apply(new MergeTwoBlocksNodesAction(secondBlock))
|
|
958
|
+
*/
|
|
959
|
+
class MergeTwoBlocksNodesAction extends node_abstract.ModifyContentAction {
|
|
960
|
+
constructor(blockNeedToBeMerged) {
|
|
961
|
+
super();
|
|
962
|
+
this.type = node_abstract.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES;
|
|
963
|
+
this.blockNeedToBeMerged = blockNeedToBeMerged;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Insert a new block before a existing block
|
|
969
|
+
*
|
|
970
|
+
* @example currentBlock.parent.apply(new InsertBlocksBeforeAction(currentBlock, newBlock, ...))
|
|
971
|
+
*/
|
|
972
|
+
class InsertBlocksBeforeAction extends node_abstract.ModifyContentAction {
|
|
973
|
+
constructor(referBlock, ...blocksToBeInserted) {
|
|
974
|
+
super();
|
|
975
|
+
this.type = node_abstract.ModifyContentActionType.INSERT_BLOCKS_BEFORE;
|
|
976
|
+
this.referBlock = referBlock;
|
|
977
|
+
this.blocksToBeInserted = blocksToBeInserted;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Text block
|
|
983
|
+
*/
|
|
984
|
+
class RTETextBlock extends RTEBlock {
|
|
985
|
+
constructor(id, type) {
|
|
986
|
+
super(id);
|
|
987
|
+
this.nodes = [];
|
|
988
|
+
this.type = type;
|
|
989
|
+
if (RTETextBlock.isAcceptableTextStyle(type)) {
|
|
990
|
+
super.annotationMap = new Map([TextStyleAnnotation.from(type)]);
|
|
991
|
+
}
|
|
992
|
+
else {
|
|
993
|
+
super.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
static from(block) {
|
|
997
|
+
const textBlock = new RTETextBlock(block.id, block.type);
|
|
998
|
+
const { annotations } = block;
|
|
999
|
+
textBlock.nodes = block.nodes.map((richText) => textNode.RTETextNode.from(richText, textBlock));
|
|
1000
|
+
if (annotations) {
|
|
1001
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
1002
|
+
const item = this.createAnnotationEntity(type, value);
|
|
1003
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1004
|
+
textBlock.annotationMap.set(...item);
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
return textBlock;
|
|
1009
|
+
}
|
|
1010
|
+
static fromHTML(node, blockType) {
|
|
1011
|
+
const textBlock = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), blockType);
|
|
1012
|
+
textBlock.nodes = Array.from(node.childNodes).map((item) => textNode.RTETextNode.fromHTML(item, textBlock));
|
|
1013
|
+
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1014
|
+
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1015
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1016
|
+
textBlock.annotationMap.set(...item);
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
return textBlock;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
1023
|
+
* and value.
|
|
1024
|
+
*
|
|
1025
|
+
* @param {keyof VegaRTEBlockAnnotations} type - The `type` parameter is a key of the `VegaRTEBlockAnnotations` enum, which specifies
|
|
1026
|
+
* the type of annotation entity to create.
|
|
1027
|
+
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
1028
|
+
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
1029
|
+
* annotation being created.
|
|
1030
|
+
* @returns {Nullable<[BlockAnnotationTypeEnum, BlockAnnotation]>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
1031
|
+
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
1032
|
+
*/
|
|
1033
|
+
static createAnnotationEntity(type, value) {
|
|
1034
|
+
if (type === 'textStyle') {
|
|
1035
|
+
return TextStyleAnnotation.from(value);
|
|
1036
|
+
}
|
|
1037
|
+
else {
|
|
1038
|
+
return super.createAnnotationEntity(type, value);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
static isAcceptableTextStyle(type) {
|
|
1042
|
+
return ['title', 'subtitle', 'paragraph', 'heading-1', 'heading-2', 'heading-3'].includes(type);
|
|
1043
|
+
}
|
|
1044
|
+
mergeNodes(action) {
|
|
1045
|
+
this.nodes = this.nodes.reduce((prev, cur) => {
|
|
1046
|
+
const lastNode = prev.at(-1);
|
|
1047
|
+
if (action instanceof textNode.LinkAnnotationAction && action.needMergeNode) {
|
|
1048
|
+
const lastNodeLinkAnnotation = lastNode === null || lastNode === void 0 ? void 0 : lastNode.getAnnotationByType(node_abstract.NodeAnnotationTypeEnum.LINK);
|
|
1049
|
+
const curNodeLinkAnnotation = cur.getAnnotationByType(node_abstract.NodeAnnotationTypeEnum.LINK);
|
|
1050
|
+
if (lastNodeLinkAnnotation &&
|
|
1051
|
+
curNodeLinkAnnotation &&
|
|
1052
|
+
lastNodeLinkAnnotation.toEqual(curNodeLinkAnnotation)) {
|
|
1053
|
+
return prev;
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
// TODO: handle other cases like merge bold nodes
|
|
1057
|
+
return [...prev, cur];
|
|
1058
|
+
}, []);
|
|
1059
|
+
}
|
|
1060
|
+
toJSON() {
|
|
1061
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1062
|
+
}
|
|
1063
|
+
cloneWithNodes(nodes) {
|
|
1064
|
+
const block = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), this.type);
|
|
1065
|
+
block.nodes = [];
|
|
1066
|
+
block.apply(new AppendChildNodesAction(nodes));
|
|
1067
|
+
return block;
|
|
1068
|
+
}
|
|
1069
|
+
isNotEmpty() {
|
|
1070
|
+
return this.nodes.length > 0 && this.nodes.some((node) => !node.isEmpty());
|
|
1071
|
+
}
|
|
1072
|
+
getLastNode() {
|
|
1073
|
+
return this.nodes[this.nodes.length - 1];
|
|
1074
|
+
}
|
|
1075
|
+
render(renderContext, children) {
|
|
1076
|
+
const BlockTag = this.getBlockTagByType(this.type);
|
|
1077
|
+
return (globalSlimmerRegistry.h(BlockTag, { ref: this.registerRef.bind(this), style: this.getStyles(), class: super.getClasses() },
|
|
1078
|
+
this.renderNodes(renderContext),
|
|
1079
|
+
children));
|
|
1080
|
+
}
|
|
1081
|
+
registerRef(ref) {
|
|
1082
|
+
if (ref) {
|
|
1083
|
+
node_abstract.stateEntityRenderingRegistry.register(ref, this);
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
renderNodes(renderConfig = {}) {
|
|
1087
|
+
const linkGroupAnnotation = this.getAnnotationByType(node_abstract.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
1088
|
+
return linkGroupAnnotation
|
|
1089
|
+
? linkGroupAnnotation.renderNodes(this.nodes, renderConfig)
|
|
1090
|
+
: this.nodes.map((node) => node.render());
|
|
1091
|
+
}
|
|
1092
|
+
doAnnotationActionApply(action) {
|
|
1093
|
+
if (action instanceof TextStyleAnnotationAction) {
|
|
1094
|
+
if (this.type !== 'list-item') {
|
|
1095
|
+
this.type = action.textStyle;
|
|
1096
|
+
}
|
|
1097
|
+
if (action.bold) {
|
|
1098
|
+
this.nodes.forEach((node) => {
|
|
1099
|
+
const boldAnnotationAction = new BoldAnnotationAction(true);
|
|
1100
|
+
boldAnnotationAction.doSplit = false;
|
|
1101
|
+
node.apply(boldAnnotationAction);
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
this.nodes.forEach((node) => {
|
|
1106
|
+
node.apply(new textNode.DeleteNodeAnnotationAction(node_abstract.NodeAnnotationTypeEnum.BOLD));
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
if (action instanceof textNode.LinkGroupAnnotationAction) {
|
|
1112
|
+
const linkGroupAnnotation = this.getAnnotationByType(node_abstract.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
1113
|
+
if (linkGroupAnnotation) {
|
|
1114
|
+
const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
|
|
1115
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
|
|
1116
|
+
this.annotationMap.set(node_abstract.InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
|
|
1117
|
+
}
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Apply a modify action to block
|
|
1123
|
+
*
|
|
1124
|
+
* @param {ModifyContentAction} action - Modify action
|
|
1125
|
+
*/
|
|
1126
|
+
doModifyActionApply(action) {
|
|
1127
|
+
switch (action.type) {
|
|
1128
|
+
case node_abstract.ModifyContentActionType.DELETE_CHILD:
|
|
1129
|
+
this.removeChildNode(action);
|
|
1130
|
+
break;
|
|
1131
|
+
case node_abstract.ModifyContentActionType.APPEND_CHILD_NODES:
|
|
1132
|
+
this.appendChildNodes(action.entityToBeAppended);
|
|
1133
|
+
break;
|
|
1134
|
+
case node_abstract.ModifyContentActionType.CLEAR_CHILD_NODES:
|
|
1135
|
+
this.nodes = [];
|
|
1136
|
+
break;
|
|
1137
|
+
case node_abstract.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
|
|
1138
|
+
action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode);
|
|
1139
|
+
break;
|
|
1140
|
+
case node_abstract.ModifyContentActionType.REPLACE_CHILD_NODES:
|
|
1141
|
+
this.nodes = [];
|
|
1142
|
+
this.appendChildNodes(action.newChildNodes);
|
|
1143
|
+
break;
|
|
1144
|
+
case node_abstract.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
|
|
1145
|
+
this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
|
|
1146
|
+
break;
|
|
1147
|
+
case node_abstract.ModifyContentActionType.BREAK_SINGLE_BLOCK:
|
|
1148
|
+
action.newBlock = this.breakSingleTextBlock(action.startContainerNode, action.startOffset);
|
|
1149
|
+
break;
|
|
1150
|
+
case node_abstract.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
|
|
1151
|
+
action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
|
|
1152
|
+
break;
|
|
1153
|
+
case node_abstract.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
|
|
1154
|
+
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
|
|
1155
|
+
break;
|
|
1156
|
+
case node_abstract.ModifyContentActionType.TRANSFORM_LIST_BLOCK:
|
|
1157
|
+
this.convertParagraphToList(action);
|
|
1158
|
+
break;
|
|
1159
|
+
case node_abstract.ModifyContentActionType.DELETE_BLOCK_CONTENT:
|
|
1160
|
+
this.deleteNodeContent(action);
|
|
1161
|
+
break;
|
|
1162
|
+
case node_abstract.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
|
|
1163
|
+
this.insertImage(action);
|
|
1164
|
+
break;
|
|
1165
|
+
case node_abstract.ModifyContentActionType.INSERT_NODES_BEFORE:
|
|
1166
|
+
this.replaceNodeWithNodes(action.referNode, [
|
|
1167
|
+
...action.nodesToBeInserted,
|
|
1168
|
+
action.referNode,
|
|
1169
|
+
]);
|
|
1170
|
+
break;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
splitTextNodeBlock(splitNode, startOffsetOfNode) {
|
|
1174
|
+
if (splitNode) {
|
|
1175
|
+
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
1176
|
+
const afterText = splitNode.text.slice(startOffsetOfNode);
|
|
1177
|
+
const nodesSplitIndex = this.nodes.indexOf(splitNode);
|
|
1178
|
+
if (nodesSplitIndex > -1) {
|
|
1179
|
+
const beforeNodes = this.nodes.slice(0, nodesSplitIndex);
|
|
1180
|
+
const afterNodes = this.nodes.slice(nodesSplitIndex + 1);
|
|
1181
|
+
if (beforeText) {
|
|
1182
|
+
beforeNodes.push(splitNode.cloneWithText(beforeText));
|
|
1183
|
+
}
|
|
1184
|
+
if (afterText) {
|
|
1185
|
+
afterNodes.unshift(splitNode.cloneWithText(afterText));
|
|
1186
|
+
}
|
|
1187
|
+
this.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
1188
|
+
const newBlock = this.cloneWithNodes(afterNodes);
|
|
1189
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newBlock));
|
|
1190
|
+
return newBlock;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
isCaretPositionAtStart(node, startOffset) {
|
|
1195
|
+
return node === this.nodes[0] && startOffset === 0;
|
|
1196
|
+
}
|
|
1197
|
+
isCaretPositionAtEnd(node, startOffset) {
|
|
1198
|
+
const lastNode = this.nodes[this.nodes.length - 1];
|
|
1199
|
+
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
1200
|
+
}
|
|
1201
|
+
lineBreakSingleBlock(splitNode, startOffsetOfNode) {
|
|
1202
|
+
if (splitNode) {
|
|
1203
|
+
const lineBreakNode = new textNode.RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', this);
|
|
1204
|
+
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
1205
|
+
const afterText = splitNode.text.slice(startOffsetOfNode);
|
|
1206
|
+
const nodesSplitIndex = this.nodes.indexOf(splitNode);
|
|
1207
|
+
if (nodesSplitIndex > -1) {
|
|
1208
|
+
const beforeNodes = this.nodes.slice(0, nodesSplitIndex);
|
|
1209
|
+
const afterNodes = this.nodes.slice(nodesSplitIndex + 1);
|
|
1210
|
+
if (beforeText) {
|
|
1211
|
+
beforeNodes.push(splitNode.cloneWithText(beforeText));
|
|
1212
|
+
}
|
|
1213
|
+
if (afterText) {
|
|
1214
|
+
afterNodes.unshift(splitNode.cloneWithText(afterText));
|
|
1215
|
+
}
|
|
1216
|
+
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
|
|
1217
|
+
}
|
|
1218
|
+
return lineBreakNode;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
lineBreakMultipleBlocks(selectedBlocks) {
|
|
1222
|
+
const beforeNodes = this['nodes'];
|
|
1223
|
+
const lineBreakNode = new textNode.RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', this);
|
|
1224
|
+
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
1225
|
+
this.mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes);
|
|
1226
|
+
return lineBreakNode;
|
|
1227
|
+
}
|
|
1228
|
+
deleteNodeContent(action) {
|
|
1229
|
+
const startContainerNode = action.startContainerNode;
|
|
1230
|
+
const startOffset = action.startOffset;
|
|
1231
|
+
if (startOffset !== 0 && !startContainerNode.isEmpty()) {
|
|
1232
|
+
const newText = startContainerNode.text.slice(0, startOffset - 1) +
|
|
1233
|
+
startContainerNode.text.slice(startOffset);
|
|
1234
|
+
startContainerNode.apply(new textNode.UpdateTextAction(newText));
|
|
1235
|
+
if (newText) {
|
|
1236
|
+
action.previousNode = startContainerNode;
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
else {
|
|
1240
|
+
const previousNode = this.getPreviousNode(startContainerNode);
|
|
1241
|
+
// Remove the last character will not delete paragraph, the paragraph will removed after press delete again
|
|
1242
|
+
if ((previousNode && previousNode.parentBlock === this && previousNode['text'] === '\n') ||
|
|
1243
|
+
this.nodes.length === 1) {
|
|
1244
|
+
action.previousNode = startContainerNode;
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
this.apply(new RemoveChildAction(startContainerNode));
|
|
1249
|
+
action.previousNode = previousNode;
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
else {
|
|
1255
|
+
let previousNode = this.getPreviousNode(startContainerNode);
|
|
1256
|
+
let nextNode = null;
|
|
1257
|
+
if (this.nodes.length && previousNode && previousNode.parentBlock !== this) {
|
|
1258
|
+
if (startContainerNode.isEmpty()) {
|
|
1259
|
+
this.apply(new RemoveChildAction(startContainerNode));
|
|
1260
|
+
}
|
|
1261
|
+
previousNode.parentBlock.apply(new MergeTwoBlocksNodesAction(this));
|
|
1262
|
+
}
|
|
1263
|
+
else {
|
|
1264
|
+
if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
|
|
1265
|
+
nextNode = this.getNextNode(startContainerNode);
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Remove line break
|
|
1269
|
+
* @example caret at the first line
|
|
1270
|
+
* \n
|
|
1271
|
+
* test
|
|
1272
|
+
*/
|
|
1273
|
+
if (startContainerNode.isEmpty()) {
|
|
1274
|
+
this.apply(new RemoveChildAction(startContainerNode));
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* Remove line break
|
|
1278
|
+
* @example caret at the begin of second line
|
|
1279
|
+
* \n
|
|
1280
|
+
* test
|
|
1281
|
+
*/
|
|
1282
|
+
if (previousNode instanceof textNode.RTETextNode && previousNode.isEmpty()) {
|
|
1283
|
+
const shouldRemoveNode = previousNode;
|
|
1284
|
+
previousNode = this.getPreviousNode(previousNode);
|
|
1285
|
+
shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
|
|
1286
|
+
if (!previousNode) {
|
|
1287
|
+
nextNode = startContainerNode;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
//Remove the paragraph block if the content is empty
|
|
1292
|
+
if (this.nodes.length === 0) {
|
|
1293
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1294
|
+
}
|
|
1295
|
+
if (previousNode) {
|
|
1296
|
+
action.previousNode = previousNode;
|
|
1297
|
+
}
|
|
1298
|
+
else if (nextNode) {
|
|
1299
|
+
action.nextNode = nextNode;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
removeChildNode(action) {
|
|
1304
|
+
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1305
|
+
if (this.nodes.length === 0) {
|
|
1306
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
mergeLineBreakNodes(beforeNodes, lineBreakNode, afterNodes) {
|
|
1310
|
+
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
1311
|
+
afterNodes.push(new textNode.RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', this, beforeNodes[beforeNodes.length - 1] && beforeNodes[beforeNodes.length - 1].annotationMap));
|
|
1312
|
+
}
|
|
1313
|
+
this.apply(new ReplaceChildNodesAction([...beforeNodes, lineBreakNode, ...afterNodes]));
|
|
1314
|
+
}
|
|
1315
|
+
getBlockTagByType(type) {
|
|
1316
|
+
switch (type) {
|
|
1317
|
+
case 'title':
|
|
1318
|
+
case 'subtitle':
|
|
1319
|
+
return `div`;
|
|
1320
|
+
case 'heading-1':
|
|
1321
|
+
return `h1`;
|
|
1322
|
+
case 'heading-2':
|
|
1323
|
+
return `h2`;
|
|
1324
|
+
case 'heading-3':
|
|
1325
|
+
return `h3`;
|
|
1326
|
+
case 'paragraph':
|
|
1327
|
+
return 'p';
|
|
1328
|
+
case 'list-item':
|
|
1329
|
+
return 'li';
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
breakSingleTextBlock(splitNode, startOffsetOfNode) {
|
|
1333
|
+
const newParagraph = this.copyInlineStyleToNewParagraph(splitNode);
|
|
1334
|
+
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
1335
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
|
|
1336
|
+
}
|
|
1337
|
+
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
1338
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, newParagraph));
|
|
1339
|
+
}
|
|
1340
|
+
else {
|
|
1341
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
1342
|
+
this.apply(splitBlockAction);
|
|
1343
|
+
return splitBlockAction.newBlock;
|
|
1344
|
+
}
|
|
1345
|
+
return newParagraph;
|
|
1346
|
+
}
|
|
1347
|
+
convertParagraphToList(action) {
|
|
1348
|
+
const bulletList = this.parent.createList(action.listType);
|
|
1349
|
+
const listItems = action.selectedBlocks.map((node) => this.parent.toListItem(node));
|
|
1350
|
+
bulletList.apply(new AppendChildNodesAction(listItems));
|
|
1351
|
+
this.parent.apply(new InsertBlocksAfterAction(action.selectedBlocks[0], bulletList));
|
|
1352
|
+
action.selectedBlocks.forEach((node) => {
|
|
1353
|
+
node.parent.apply(new RemoveChildAction(node));
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
insertImage(action) {
|
|
1357
|
+
const splitNode = action.splitPointNode;
|
|
1358
|
+
const startOffsetOfNode = action.startOffsetOfNode;
|
|
1359
|
+
const newImageBlock = action.imageBlockToBeInserted;
|
|
1360
|
+
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
1361
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
1362
|
+
}
|
|
1363
|
+
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
1364
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, newImageBlock));
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
1368
|
+
this.apply(splitBlockAction);
|
|
1369
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
copyInlineStyleToNewParagraph(needCopedNode) {
|
|
1373
|
+
const textNode = needCopedNode.cloneWithText('');
|
|
1374
|
+
// The link annotation don't need inherited
|
|
1375
|
+
textNode.annotationMap.delete(node_abstract.NodeAnnotationTypeEnum.LINK);
|
|
1376
|
+
const newParagraph = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), 'paragraph');
|
|
1377
|
+
newParagraph.apply(new AppendChildNodesAction([textNode]));
|
|
1378
|
+
return newParagraph;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
/**
|
|
1383
|
+
* Image block
|
|
1384
|
+
*/
|
|
1385
|
+
class RTEImageBlock extends RTEBlock {
|
|
1386
|
+
constructor(id) {
|
|
1387
|
+
super(id);
|
|
1388
|
+
this.type = 'image';
|
|
1389
|
+
this.nodes = [];
|
|
1390
|
+
}
|
|
1391
|
+
static from(block) {
|
|
1392
|
+
const imageBlock = new RTEImageBlock(block.id);
|
|
1393
|
+
const { annotations } = block;
|
|
1394
|
+
imageBlock.nodes = block.nodes.map((image) => RTEImageNode.from(image, imageBlock));
|
|
1395
|
+
if (annotations) {
|
|
1396
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
1397
|
+
const item = this.createAnnotationEntity(type, value);
|
|
1398
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1399
|
+
imageBlock.annotationMap.set(...item);
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
return imageBlock;
|
|
1404
|
+
}
|
|
1405
|
+
static fromHTML(node) {
|
|
1406
|
+
const nodes = node.nodeName === 'IMG' ? [node] : Array.from(node.children);
|
|
1407
|
+
const imageBlock = new RTEImageBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1408
|
+
imageBlock.nodes = nodes.map((item) => RTEImageNode.fromHTML(item, imageBlock));
|
|
1409
|
+
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1410
|
+
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1411
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1412
|
+
imageBlock.annotationMap.set(...item);
|
|
1413
|
+
}
|
|
1414
|
+
});
|
|
1415
|
+
return imageBlock;
|
|
1416
|
+
}
|
|
1417
|
+
toJSON() {
|
|
1418
|
+
return Object.assign(Object.assign({}, super.toJSON()), { type: 'image', nodes: this.nodes.map((node) => node.toJSON()) });
|
|
1419
|
+
}
|
|
1420
|
+
isNotEmpty() {
|
|
1421
|
+
return this.nodes.length > 0 && this.nodes.some((node) => node.url.length > 0);
|
|
1422
|
+
}
|
|
1423
|
+
getLastNode() {
|
|
1424
|
+
return this.nodes[this.nodes.length - 1];
|
|
1425
|
+
}
|
|
1426
|
+
render(renderContext) {
|
|
1427
|
+
return (globalSlimmerRegistry.h("div", { style: Object.assign({}, this.getStyles()), ref: this.registerRef.bind(this), class: super.getClasses() }, this.nodes.map((node) => {
|
|
1428
|
+
return node.render(renderContext);
|
|
1429
|
+
})));
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Apply modify action to block
|
|
1433
|
+
*
|
|
1434
|
+
* @param {ModifyContentAction} action - Modify action
|
|
1435
|
+
*/
|
|
1436
|
+
doModifyActionApply(action) {
|
|
1437
|
+
switch (action.type) {
|
|
1438
|
+
case node_abstract.ModifyContentActionType.DELETE_CHILD:
|
|
1439
|
+
this.removeChildNode(action);
|
|
1440
|
+
break;
|
|
1441
|
+
case node_abstract.ModifyContentActionType.CLEAR_CHILD_NODES:
|
|
1442
|
+
this.nodes = [];
|
|
1443
|
+
break;
|
|
1444
|
+
case node_abstract.ModifyContentActionType.APPEND_CHILD_NODES:
|
|
1445
|
+
this.appendChildNodes(action.entityToBeAppended);
|
|
1446
|
+
break;
|
|
1447
|
+
case node_abstract.ModifyContentActionType.REPLACE_CHILD_NODES:
|
|
1448
|
+
this.nodes = [];
|
|
1449
|
+
this.appendChildNodes(action.newChildNodes);
|
|
1450
|
+
break;
|
|
1451
|
+
case node_abstract.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
|
|
1452
|
+
action.newBlock = this.splitImageNodes(action.splitPointNode, action.startOffsetOfNode);
|
|
1453
|
+
break;
|
|
1454
|
+
case node_abstract.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
|
|
1455
|
+
this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
|
|
1456
|
+
break;
|
|
1457
|
+
case node_abstract.ModifyContentActionType.BREAK_SINGLE_BLOCK:
|
|
1458
|
+
action.newBlock = this.breakSingleBlock(action.startContainerNode, action.startOffset);
|
|
1459
|
+
break;
|
|
1460
|
+
case node_abstract.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
|
|
1461
|
+
action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
|
|
1462
|
+
break;
|
|
1463
|
+
case node_abstract.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
|
|
1464
|
+
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
|
|
1465
|
+
break;
|
|
1466
|
+
case node_abstract.ModifyContentActionType.DELETE_BLOCK_CONTENT:
|
|
1467
|
+
this.deleteNodeContent(action);
|
|
1468
|
+
break;
|
|
1469
|
+
case node_abstract.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
|
|
1470
|
+
this.insertImage(action);
|
|
1471
|
+
break;
|
|
1472
|
+
case node_abstract.ModifyContentActionType.INSERT_NODES_AFTER:
|
|
1473
|
+
this.replaceNodeWithNodes(action.referNode, [
|
|
1474
|
+
action.referNode,
|
|
1475
|
+
...action.nodesToBeInserted,
|
|
1476
|
+
]);
|
|
1477
|
+
break;
|
|
1478
|
+
case node_abstract.ModifyContentActionType.INSERT_NODES_BEFORE:
|
|
1479
|
+
this.replaceNodeWithNodes(action.referNode, [
|
|
1480
|
+
...action.nodesToBeInserted,
|
|
1481
|
+
action.referNode,
|
|
1482
|
+
]);
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
registerRef(ref) {
|
|
1487
|
+
if (ref) {
|
|
1488
|
+
node_abstract.stateEntityRenderingRegistry.register(ref, this);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
removeChildNode(action) {
|
|
1492
|
+
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1493
|
+
if (this.nodes.length === 0) {
|
|
1494
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* The image offset should be 0 or 1
|
|
1499
|
+
* <vega-rich-text-image-editor><img /></vega-rich-text-image-editor>
|
|
1500
|
+
*
|
|
1501
|
+
* @param {RTEImageNode} imageNode The split point image node
|
|
1502
|
+
* @param {number} imageOffset The cursor point 0 | 1
|
|
1503
|
+
*/
|
|
1504
|
+
splitImageNodes(imageNode, imageOffset) {
|
|
1505
|
+
const nodesSplitIndex = this.nodes.indexOf(imageNode);
|
|
1506
|
+
if (nodesSplitIndex > -1) {
|
|
1507
|
+
const beforeNodes = this.nodes.slice(0, nodesSplitIndex + imageOffset);
|
|
1508
|
+
const afterNodes = this.nodes.slice(nodesSplitIndex + imageOffset);
|
|
1509
|
+
this.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
1510
|
+
const newBlock = this.cloneWithNodes(afterNodes);
|
|
1511
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newBlock));
|
|
1512
|
+
return newBlock;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
cloneWithNodes(nodes) {
|
|
1516
|
+
const block = new RTEImageBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1517
|
+
block.nodes = [];
|
|
1518
|
+
block.apply(new AppendChildNodesAction(nodes));
|
|
1519
|
+
return block;
|
|
1520
|
+
}
|
|
1521
|
+
breakSingleBlock(splitNode, startOffsetOfNode) {
|
|
1522
|
+
const newParagraph = RTETextBlock.from({
|
|
1523
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
1524
|
+
type: 'paragraph',
|
|
1525
|
+
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '' }],
|
|
1526
|
+
});
|
|
1527
|
+
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
1528
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
|
|
1529
|
+
}
|
|
1530
|
+
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
1531
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, newParagraph));
|
|
1532
|
+
}
|
|
1533
|
+
else {
|
|
1534
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
1535
|
+
this.apply(splitBlockAction);
|
|
1536
|
+
return splitBlockAction.newBlock;
|
|
1537
|
+
}
|
|
1538
|
+
return newParagraph;
|
|
1539
|
+
}
|
|
1540
|
+
lineBreakSingleBlock(splitNode, startOffset) {
|
|
1541
|
+
const newParagraph = this.breakSingleBlock(splitNode, startOffset);
|
|
1542
|
+
if (newParagraph) {
|
|
1543
|
+
return newParagraph['nodes'][0];
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
isCaretPositionAtStart(node, startOffset) {
|
|
1547
|
+
return node === this.nodes[0] && startOffset === 0;
|
|
1548
|
+
}
|
|
1549
|
+
isCaretPositionAtEnd(node, startOffset) {
|
|
1550
|
+
const lastNode = this.nodes[this.nodes.length - 1];
|
|
1551
|
+
return node === lastNode && startOffset === 1;
|
|
1552
|
+
}
|
|
1553
|
+
lineBreakMultipleBlocks(selectedBlocks) {
|
|
1554
|
+
const newParagraph = RTETextBlock.from({
|
|
1555
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
1556
|
+
type: 'paragraph',
|
|
1557
|
+
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '\n' }],
|
|
1558
|
+
});
|
|
1559
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newParagraph));
|
|
1560
|
+
const afterNodes = this.concatBlocksNodes(selectedBlocks.slice(1));
|
|
1561
|
+
if (afterNodes.length === 0 || (afterNodes[0] && afterNodes[0].text === '')) {
|
|
1562
|
+
afterNodes.push(new textNode.RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), '\n', newParagraph));
|
|
1563
|
+
}
|
|
1564
|
+
newParagraph.apply(new AppendChildNodesAction(afterNodes));
|
|
1565
|
+
return newParagraph['nodes'][0];
|
|
1566
|
+
}
|
|
1567
|
+
deleteNodeContent(action) {
|
|
1568
|
+
const startContainerNode = action
|
|
1569
|
+
.startContainerNode, startOffset = action.startOffset;
|
|
1570
|
+
let previousNode = this.getPreviousNode(startContainerNode);
|
|
1571
|
+
let nextNode = null;
|
|
1572
|
+
if (startOffset === 1) {
|
|
1573
|
+
const parentBlock = startContainerNode.parentBlock;
|
|
1574
|
+
if (this.isContentFirstNode(startContainerNode)) {
|
|
1575
|
+
nextNode = this.getNextNode(startContainerNode);
|
|
1576
|
+
}
|
|
1577
|
+
if (parentBlock.nodes.length === 1) {
|
|
1578
|
+
parentBlock.parent.apply(new RemoveChildAction(parentBlock));
|
|
1579
|
+
}
|
|
1580
|
+
else {
|
|
1581
|
+
startContainerNode.parentBlock.apply(new RemoveChildAction(startContainerNode));
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
else {
|
|
1585
|
+
const shouldRemoveNode = previousNode;
|
|
1586
|
+
if (shouldRemoveNode && shouldRemoveNode instanceof RTEImageNode) {
|
|
1587
|
+
previousNode = this.getPreviousNode(shouldRemoveNode);
|
|
1588
|
+
shouldRemoveNode.parentBlock.apply(new RemoveChildAction(shouldRemoveNode));
|
|
1589
|
+
if (!previousNode) {
|
|
1590
|
+
action.nextNode = startContainerNode;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
if (previousNode) {
|
|
1595
|
+
action.previousNode = previousNode;
|
|
1596
|
+
}
|
|
1597
|
+
else if (nextNode) {
|
|
1598
|
+
action.nextNode = nextNode;
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Image will always create new image block
|
|
1603
|
+
*
|
|
1604
|
+
* @param {InsertImageToBlockAction} action insert image to current block
|
|
1605
|
+
*/
|
|
1606
|
+
insertImage(action) {
|
|
1607
|
+
const splitNode = action.splitPointNode;
|
|
1608
|
+
const startOffsetOfNode = action.startOffsetOfNode;
|
|
1609
|
+
const newImageNodes = action.imageBlockToBeInserted.nodes;
|
|
1610
|
+
const newImageBlock = action.imageBlockToBeInserted;
|
|
1611
|
+
if (this.nodes.length < 1) {
|
|
1612
|
+
this.apply(new AppendChildNodesAction(newImageNodes));
|
|
1613
|
+
}
|
|
1614
|
+
else if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
1615
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
1616
|
+
}
|
|
1617
|
+
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
1618
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, newImageBlock));
|
|
1619
|
+
}
|
|
1620
|
+
else {
|
|
1621
|
+
this.apply(new SplitBlockWithNodeAction(splitNode, startOffsetOfNode));
|
|
1622
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newImageBlock));
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
class RTEListItemBlock extends RTETextBlock {
|
|
1628
|
+
constructor(id, children) {
|
|
1629
|
+
super(id, 'list-item');
|
|
1630
|
+
this.children = [];
|
|
1631
|
+
this.children = children;
|
|
1632
|
+
}
|
|
1633
|
+
static from(block) {
|
|
1634
|
+
const listItemBlock = new RTEListItemBlock(block.id);
|
|
1635
|
+
listItemBlock.nodes = block.nodes.map((richText) => textNode.RTETextNode.from(richText, listItemBlock));
|
|
1636
|
+
if (block.children) {
|
|
1637
|
+
listItemBlock.children = block.children.map((child) => {
|
|
1638
|
+
const listBlock = RTEListBlock.from(child);
|
|
1639
|
+
listBlock.parent = listItemBlock;
|
|
1640
|
+
return listBlock;
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
const { annotations } = block;
|
|
1644
|
+
if (annotations) {
|
|
1645
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
1646
|
+
const item = this.createAnnotationEntity(type, value);
|
|
1647
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1648
|
+
listItemBlock.annotationMap.set(...item);
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
return listItemBlock;
|
|
1653
|
+
}
|
|
1654
|
+
static fromHTML(node) {
|
|
1655
|
+
const listItem = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1656
|
+
listItem.nodes = Array.from(node.childNodes)
|
|
1657
|
+
.map((item) => {
|
|
1658
|
+
if (!['UL', 'OL'].includes(item.nodeName)) {
|
|
1659
|
+
return textNode.RTETextNode.fromHTML(item, listItem);
|
|
1660
|
+
}
|
|
1661
|
+
})
|
|
1662
|
+
.filter(Boolean);
|
|
1663
|
+
listItem.children = Array.from(node.childNodes)
|
|
1664
|
+
.map((item) => {
|
|
1665
|
+
if (['UL', 'OL'].includes(item.nodeName)) {
|
|
1666
|
+
const listBlock = RTEListBlock.fromHTML(item);
|
|
1667
|
+
listBlock && (listBlock.parent = listItem);
|
|
1668
|
+
return listBlock;
|
|
1669
|
+
}
|
|
1670
|
+
})
|
|
1671
|
+
.filter(Boolean);
|
|
1672
|
+
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1673
|
+
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1674
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1675
|
+
listItem.annotationMap.set(...item);
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
return listItem;
|
|
1679
|
+
}
|
|
1680
|
+
toJSON() {
|
|
1681
|
+
var _a;
|
|
1682
|
+
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()) });
|
|
1683
|
+
}
|
|
1684
|
+
cloneWithNodes(nodes) {
|
|
1685
|
+
const block = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1686
|
+
block.nodes = [];
|
|
1687
|
+
block.apply(new AppendChildNodesAction(nodes));
|
|
1688
|
+
return block;
|
|
1689
|
+
}
|
|
1690
|
+
isNotEmpty() {
|
|
1691
|
+
if (this.children) {
|
|
1692
|
+
return super.isNotEmpty() || this.children.some((block) => block.isNotEmpty());
|
|
1693
|
+
}
|
|
1694
|
+
else {
|
|
1695
|
+
return super.isNotEmpty();
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
getLastNode() {
|
|
1699
|
+
if (this.children && this.children.length > 0) {
|
|
1700
|
+
const childListBlock = this.children[this.children.length - 1];
|
|
1701
|
+
return childListBlock.getLastNode();
|
|
1702
|
+
}
|
|
1703
|
+
return super.getLastNode();
|
|
1704
|
+
}
|
|
1705
|
+
render(renderContext) {
|
|
1706
|
+
return super.render(renderContext, this.renderChildren(renderContext));
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Apply a modify action to block
|
|
1710
|
+
*
|
|
1711
|
+
* @param {ModifyContentAction} action - Modify action
|
|
1712
|
+
*/
|
|
1713
|
+
doModifyActionApply(action) {
|
|
1714
|
+
switch (action.type) {
|
|
1715
|
+
case node_abstract.ModifyContentActionType.DELETE_CHILD:
|
|
1716
|
+
this.removeListChildNode(action);
|
|
1717
|
+
break;
|
|
1718
|
+
case node_abstract.ModifyContentActionType.DELETE_NEST_LIST:
|
|
1719
|
+
this.removeNestList(action);
|
|
1720
|
+
break;
|
|
1721
|
+
case node_abstract.ModifyContentActionType.APPEND_CHILD_NODES:
|
|
1722
|
+
this.appendChildNodes(action.entityToBeAppended);
|
|
1723
|
+
break;
|
|
1724
|
+
case node_abstract.ModifyContentActionType.CLEAR_CHILD_NODES:
|
|
1725
|
+
this.nodes = [];
|
|
1726
|
+
break;
|
|
1727
|
+
case node_abstract.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE:
|
|
1728
|
+
this.splitListItemBlock(action);
|
|
1729
|
+
break;
|
|
1730
|
+
case node_abstract.ModifyContentActionType.REPLACE_CHILD_NODES:
|
|
1731
|
+
this.nodes = [];
|
|
1732
|
+
this.appendChildNodes(action.newChildNodes);
|
|
1733
|
+
break;
|
|
1734
|
+
case node_abstract.ModifyContentActionType.REPLACE_NEST_LIST:
|
|
1735
|
+
this.replaceNestList(action.newList);
|
|
1736
|
+
break;
|
|
1737
|
+
case node_abstract.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES:
|
|
1738
|
+
this.mergeTwoBlocksNodes(action.blockNeedToBeMerged);
|
|
1739
|
+
break;
|
|
1740
|
+
case node_abstract.ModifyContentActionType.BREAK_SINGLE_BLOCK:
|
|
1741
|
+
action.newBlock = this.breakSingleListItemBlock(action.startContainerNode, action.startOffset);
|
|
1742
|
+
break;
|
|
1743
|
+
case node_abstract.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK:
|
|
1744
|
+
action.lineBreakNode = this.lineBreakSingleBlock(action.startContainerNode, action.startOffset);
|
|
1745
|
+
break;
|
|
1746
|
+
case node_abstract.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS:
|
|
1747
|
+
action.lineBreakNode = this.lineBreakMultipleBlocks(action.selectedBlocks);
|
|
1748
|
+
break;
|
|
1749
|
+
case node_abstract.ModifyContentActionType.DELETE_BLOCK_CONTENT:
|
|
1750
|
+
this.deleteListNodeContent(action);
|
|
1751
|
+
break;
|
|
1752
|
+
case node_abstract.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
|
|
1753
|
+
this.parent.apply(action);
|
|
1754
|
+
break;
|
|
1755
|
+
case node_abstract.ModifyContentActionType.INSERT_NODES_BEFORE:
|
|
1756
|
+
this.replaceNodeWithNodes(action.referNode, [
|
|
1757
|
+
...action.nodesToBeInserted,
|
|
1758
|
+
action.referNode,
|
|
1759
|
+
]);
|
|
1760
|
+
break;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
renderChildren(renderContext) {
|
|
1764
|
+
var _a;
|
|
1765
|
+
return (_a = this.children) === null || _a === void 0 ? void 0 : _a.map((block) => block.render(renderContext));
|
|
1766
|
+
}
|
|
1767
|
+
removeListChildNode(action) {
|
|
1768
|
+
this.nodes = this.nodes.filter((node) => node !== action.entityToBeRemoved);
|
|
1769
|
+
if (this.nodes.length === 0 && (!this.children || !this.children.length)) {
|
|
1770
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
removeNestList(action) {
|
|
1774
|
+
if (this.children) {
|
|
1775
|
+
if (this.children.length > 1) {
|
|
1776
|
+
this.children = this.children.filter((child) => child !== action.nestListBlockToBeRemoved);
|
|
1777
|
+
}
|
|
1778
|
+
else {
|
|
1779
|
+
this.children = undefined;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
replaceNestList(newList) {
|
|
1784
|
+
newList.forEach((listBlock) => {
|
|
1785
|
+
listBlock.parent = this;
|
|
1786
|
+
});
|
|
1787
|
+
this.children = newList;
|
|
1788
|
+
}
|
|
1789
|
+
splitListItemBlock(action) {
|
|
1790
|
+
action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode);
|
|
1791
|
+
}
|
|
1792
|
+
breakSingleListItemBlock(splitNode, startOffsetOfNode) {
|
|
1793
|
+
const newListItem = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
1794
|
+
const newBreakNode = this.copyInlineStyleToNewNode(splitNode);
|
|
1795
|
+
newListItem.apply(new AppendChildNodesAction([newBreakNode]));
|
|
1796
|
+
if (this.isCaretPositionAtEnd(splitNode, startOffsetOfNode)) {
|
|
1797
|
+
return this.breakListItemAtEnd(newListItem);
|
|
1798
|
+
}
|
|
1799
|
+
else if (this.isCaretPositionAtStart(splitNode, startOffsetOfNode)) {
|
|
1800
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, newListItem));
|
|
1801
|
+
}
|
|
1802
|
+
else {
|
|
1803
|
+
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
1804
|
+
this.apply(splitBlockAction);
|
|
1805
|
+
return splitBlockAction.newBlock;
|
|
1806
|
+
}
|
|
1807
|
+
return newListItem;
|
|
1808
|
+
}
|
|
1809
|
+
breakListItemAtEnd(newListItem) {
|
|
1810
|
+
const lastItem = this.parent.blocks[this.parent.blocks.length - 1];
|
|
1811
|
+
const currentItemIsEmpty = this.nodes.length === 1 && this.nodes[0].isEmpty();
|
|
1812
|
+
if (this === lastItem && currentItemIsEmpty) {
|
|
1813
|
+
const parentParent = this.parent.parent;
|
|
1814
|
+
if (parentParent['type'] !== 'list-item') {
|
|
1815
|
+
const newParagraph = RTETextBlock.from({
|
|
1816
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
1817
|
+
type: 'paragraph',
|
|
1818
|
+
nodes: [],
|
|
1819
|
+
});
|
|
1820
|
+
newParagraph.apply(new AppendChildNodesAction(newListItem.nodes));
|
|
1821
|
+
parentParent.apply(new InsertBlocksAfterAction(this.parent, newParagraph));
|
|
1822
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1823
|
+
return newParagraph;
|
|
1824
|
+
}
|
|
1825
|
+
else {
|
|
1826
|
+
parentParent.parent.apply(new InsertBlocksAfterAction(parentParent, newListItem));
|
|
1827
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
else {
|
|
1831
|
+
this.parent.apply(new InsertBlocksAfterAction(this, newListItem));
|
|
1832
|
+
}
|
|
1833
|
+
return newListItem;
|
|
1834
|
+
}
|
|
1835
|
+
deleteListNodeContent(action) {
|
|
1836
|
+
const startContainerNode = action.startContainerNode;
|
|
1837
|
+
const listBlock = startContainerNode.parentBlock.parent;
|
|
1838
|
+
this.deleteNodeContent(action);
|
|
1839
|
+
if (listBlock.blocks.length === 0) {
|
|
1840
|
+
listBlock.parent.apply(new RemoveChildAction(listBlock));
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
copyInlineStyleToNewNode(needCopedNode) {
|
|
1844
|
+
const textNode = needCopedNode.cloneWithText('');
|
|
1845
|
+
// The link annotation don't need inherited
|
|
1846
|
+
textNode.annotationMap.delete(node_abstract.NodeAnnotationTypeEnum.LINK);
|
|
1847
|
+
return textNode;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Delete the nest list block action
|
|
1853
|
+
*
|
|
1854
|
+
* @example needRemovedNestList.parent.apply(new RemoveNestListAction(needRemovedNestList))
|
|
1855
|
+
*/
|
|
1856
|
+
class RemoveNestListAction extends node_abstract.ModifyContentAction {
|
|
1857
|
+
constructor(childList) {
|
|
1858
|
+
super();
|
|
1859
|
+
this.type = node_abstract.ModifyContentActionType.DELETE_NEST_LIST;
|
|
1860
|
+
this.nestListBlockToBeRemoved = childList;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
class RTEListBlock extends RTEBlock {
|
|
1865
|
+
constructor(id, type) {
|
|
1866
|
+
super(id);
|
|
1867
|
+
this.type = 'bullet-list';
|
|
1868
|
+
this.blocks = [];
|
|
1869
|
+
this.type = type;
|
|
1870
|
+
}
|
|
1871
|
+
static from(block) {
|
|
1872
|
+
const listBlock = new RTEListBlock(block.id, block.type);
|
|
1873
|
+
listBlock.blocks = block.blocks.map((item) => {
|
|
1874
|
+
const listItemBlock = RTEListItemBlock.from(item);
|
|
1875
|
+
listItemBlock.parent = listBlock;
|
|
1876
|
+
return listItemBlock;
|
|
1877
|
+
});
|
|
1878
|
+
return listBlock;
|
|
1879
|
+
}
|
|
1880
|
+
static fromHTML(node) {
|
|
1881
|
+
const listBlock = new RTEListBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), node.nodeName === 'UL' ? 'bullet-list' : 'number-list');
|
|
1882
|
+
listBlock.blocks = Array.from(node.children)
|
|
1883
|
+
.map((item) => {
|
|
1884
|
+
const listItemBlock = RTEListItemBlock.fromHTML(item);
|
|
1885
|
+
listItemBlock && (listItemBlock.parent = listBlock);
|
|
1886
|
+
return listItemBlock;
|
|
1887
|
+
})
|
|
1888
|
+
.filter(Boolean);
|
|
1889
|
+
Object.keys(blockAnnotation_abstract.BlockAnnotationTypeEnum).forEach((type) => {
|
|
1890
|
+
const item = this.createAnnotationEntityFromHTML(type, node);
|
|
1891
|
+
if (typeGuard.isNonNullable(item)) {
|
|
1892
|
+
listBlock.annotationMap.set(...item);
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
return listBlock;
|
|
1896
|
+
}
|
|
1897
|
+
toJSON() {
|
|
1898
|
+
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, blocks: this.blocks.map((block) => block.toJSON()) });
|
|
1899
|
+
}
|
|
1900
|
+
isNotEmpty() {
|
|
1901
|
+
return (this.blocks.length > 0 &&
|
|
1902
|
+
this.blocks.some((listItemBlock) => listItemBlock.isNotEmpty()));
|
|
1903
|
+
}
|
|
1904
|
+
getLastNode() {
|
|
1905
|
+
return this.blocks[this.blocks.length - 1].getLastNode();
|
|
1906
|
+
}
|
|
1907
|
+
render(renderContext) {
|
|
1908
|
+
const BlockTag = this.type === 'number-list' ? 'ol' : 'ul';
|
|
1909
|
+
return (globalSlimmerRegistry.h(BlockTag, { ref: this.registerRef.bind(this) }, this.blocks.map((block) => block.render(renderContext))));
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Apply a modify action to block
|
|
1913
|
+
*
|
|
1914
|
+
* @param {ModifyContentAction} action - Modify action
|
|
1915
|
+
*/
|
|
1916
|
+
doModifyActionApply(action) {
|
|
1917
|
+
switch (action.type) {
|
|
1918
|
+
case node_abstract.ModifyContentActionType.DELETE_CHILD:
|
|
1919
|
+
this.removeListItemBlock(action.entityToBeRemoved);
|
|
1920
|
+
break;
|
|
1921
|
+
case node_abstract.ModifyContentActionType.INSERT_BLOCKS_AFTER:
|
|
1922
|
+
this.replaceBlockWithBlocks(action.referBlock, [
|
|
1923
|
+
action.referBlock,
|
|
1924
|
+
...action.blocksToBeInserted,
|
|
1925
|
+
]);
|
|
1926
|
+
break;
|
|
1927
|
+
case node_abstract.ModifyContentActionType.INSERT_BLOCKS_BEFORE:
|
|
1928
|
+
this.replaceBlockWithBlocks(action.referBlock, [
|
|
1929
|
+
...action.blocksToBeInserted,
|
|
1930
|
+
action.referBlock,
|
|
1931
|
+
]);
|
|
1932
|
+
break;
|
|
1933
|
+
case node_abstract.ModifyContentActionType.APPEND_CHILD_NODES:
|
|
1934
|
+
this.appendChildBlocks(action.entityToBeAppended);
|
|
1935
|
+
break;
|
|
1936
|
+
case node_abstract.ModifyContentActionType.TRANSFORM_LIST_BLOCK:
|
|
1937
|
+
this.convertToList(action);
|
|
1938
|
+
break;
|
|
1939
|
+
case node_abstract.ModifyContentActionType.TRANSFORM_PARAGRAPH_BLOCK:
|
|
1940
|
+
this.convertToParagraph(action);
|
|
1941
|
+
break;
|
|
1942
|
+
case node_abstract.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK:
|
|
1943
|
+
this.insertImage(action);
|
|
1944
|
+
break;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
toParagraph(block) {
|
|
1948
|
+
const textBlock = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), 'paragraph');
|
|
1949
|
+
textBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
1950
|
+
textBlock['annotationMap'] = block['annotationMap'];
|
|
1951
|
+
return textBlock;
|
|
1952
|
+
}
|
|
1953
|
+
registerRef(ref) {
|
|
1954
|
+
if (ref) {
|
|
1955
|
+
node_abstract.stateEntityRenderingRegistry.register(ref, this);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
convertToList(action) {
|
|
1959
|
+
const selectedBlocks = action.selectedBlocks;
|
|
1960
|
+
const bulletList = this.parent.createList(action.listType);
|
|
1961
|
+
const isSameList = selectedBlocks.every((block) => block.parent === this);
|
|
1962
|
+
if (isSameList) {
|
|
1963
|
+
// Select one or more list items belonging to the same list, and all items in this list should be updated
|
|
1964
|
+
bulletList.apply(new AppendChildNodesAction(this.blocks));
|
|
1965
|
+
this.parent.apply(new InsertBlocksAfterAction(this, bulletList));
|
|
1966
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1967
|
+
selectedBlocks.forEach((block) => block.nodes.map((node) => node.apply(new textNode.SyncUpSelectionAction())));
|
|
1968
|
+
}
|
|
1969
|
+
else {
|
|
1970
|
+
const listItems = action.selectedBlocks.map((block) => this.parent.toListItem(block));
|
|
1971
|
+
bulletList.apply(new AppendChildNodesAction(listItems));
|
|
1972
|
+
this.parent.apply(new InsertBlocksAfterAction(this, bulletList));
|
|
1973
|
+
action.selectedBlocks.forEach((block) => {
|
|
1974
|
+
block.parent.apply(new RemoveChildAction(block));
|
|
1975
|
+
});
|
|
1976
|
+
if (this.blocks.length === 0) {
|
|
1977
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
convertToParagraph(action) {
|
|
1982
|
+
let isSelectedFirstBlock = false;
|
|
1983
|
+
let isSelectedLastBlock = false;
|
|
1984
|
+
const selectedBlocks = action.selectedBlocks;
|
|
1985
|
+
const currentParagraph = selectedBlocks.map((block) => {
|
|
1986
|
+
block.nodes.map((node) => node.apply(new textNode.SyncUpSelectionAction()));
|
|
1987
|
+
if (block === this.blocks[0])
|
|
1988
|
+
isSelectedFirstBlock = true;
|
|
1989
|
+
if (block === this.blocks[this.blocks.length - 1])
|
|
1990
|
+
isSelectedLastBlock = true;
|
|
1991
|
+
return this.toParagraph(block);
|
|
1992
|
+
});
|
|
1993
|
+
if (isSelectedFirstBlock) {
|
|
1994
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, ...currentParagraph));
|
|
1995
|
+
}
|
|
1996
|
+
else if (isSelectedLastBlock) {
|
|
1997
|
+
this.parent.apply(new InsertBlocksAfterAction(this, ...currentParagraph));
|
|
1998
|
+
}
|
|
1999
|
+
else {
|
|
2000
|
+
const startIndex = this.blocks.indexOf(selectedBlocks[0]);
|
|
2001
|
+
const lastIndex = this.blocks.indexOf(selectedBlocks[selectedBlocks.length - 1]);
|
|
2002
|
+
const firstBulletList = this.parent.createList(this.type);
|
|
2003
|
+
firstBulletList.apply(new AppendChildNodesAction(this.blocks.slice(0, startIndex)));
|
|
2004
|
+
const lastBulletList = this.parent.createList(this.type);
|
|
2005
|
+
lastBulletList.apply(new AppendChildNodesAction(this.blocks.slice(lastIndex + 1)));
|
|
2006
|
+
this.parent.apply(new InsertBlocksBeforeAction(this, firstBulletList, ...currentParagraph, lastBulletList));
|
|
2007
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
2008
|
+
}
|
|
2009
|
+
selectedBlocks.map((block) => {
|
|
2010
|
+
this.apply(new RemoveChildAction(block));
|
|
2011
|
+
});
|
|
2012
|
+
if (this.blocks.length === 0) {
|
|
2013
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
insertImage(action) {
|
|
2017
|
+
const imageBlock = action.imageBlockToBeInserted;
|
|
2018
|
+
if (this.parent['type'] !== 'list-item') {
|
|
2019
|
+
this.parent.apply(new InsertBlocksAfterAction(this, imageBlock));
|
|
2020
|
+
}
|
|
2021
|
+
else {
|
|
2022
|
+
this.parent.apply(action);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
removeListItemBlock(blockToBeRemoved) {
|
|
2026
|
+
super.removeChildBlock(blockToBeRemoved);
|
|
2027
|
+
if (this.blocks.length === 0 && this.parent) {
|
|
2028
|
+
// The parent is a list item mean the current block is a nest list, so we need use RemoveNestListAction to remove the item
|
|
2029
|
+
if (this.parent instanceof RTEListItemBlock) {
|
|
2030
|
+
this.parent.apply(new RemoveNestListAction(this));
|
|
2031
|
+
}
|
|
2032
|
+
else {
|
|
2033
|
+
this.parent.apply(new RemoveChildAction(this));
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
/**
|
|
2040
|
+
* Class representing the content state of the rich text editor.
|
|
2041
|
+
*/
|
|
2042
|
+
class VegaRTEContent extends BlockBaseOperator {
|
|
2043
|
+
constructor(blocks) {
|
|
2044
|
+
super();
|
|
2045
|
+
blocks.forEach((block) => {
|
|
2046
|
+
block.parent = this;
|
|
2047
|
+
});
|
|
2048
|
+
this.blocks = blocks;
|
|
2049
|
+
}
|
|
2050
|
+
/**
|
|
2051
|
+
* Converts a JSON array of blocks to a class array of RTEContentBlock.
|
|
2052
|
+
*
|
|
2053
|
+
* @param {VegaRTEContentBlock[]} value The JSON array of blocks to convert.
|
|
2054
|
+
* @returns {RTEContentBlock[]} The converted array of RTEContentBlock.
|
|
2055
|
+
*/
|
|
2056
|
+
static fromJSON(value) {
|
|
2057
|
+
const blocks = value.map((block) => {
|
|
2058
|
+
switch (block.type) {
|
|
2059
|
+
case 'paragraph':
|
|
2060
|
+
case 'title':
|
|
2061
|
+
case 'subtitle':
|
|
2062
|
+
case 'heading-1':
|
|
2063
|
+
case 'heading-2':
|
|
2064
|
+
case 'heading-3': {
|
|
2065
|
+
return RTETextBlock.from(block);
|
|
2066
|
+
}
|
|
2067
|
+
case 'image':
|
|
2068
|
+
return RTEImageBlock.from(block);
|
|
2069
|
+
case 'bullet-list':
|
|
2070
|
+
case 'number-list':
|
|
2071
|
+
return RTEListBlock.from(block);
|
|
2072
|
+
default: {
|
|
2073
|
+
throw new Error(`[Vega] Unknown block type: ${block.type}`);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
});
|
|
2077
|
+
return new VegaRTEContent(blocks);
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
2080
|
+
* Create an empty content state
|
|
2081
|
+
*
|
|
2082
|
+
* @returns {VegaRTEContent} An empty content state
|
|
2083
|
+
*/
|
|
2084
|
+
static createEmptyContent() {
|
|
2085
|
+
return VegaRTEContent.fromJSON([
|
|
2086
|
+
{
|
|
2087
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
2088
|
+
type: 'paragraph',
|
|
2089
|
+
nodes: [
|
|
2090
|
+
{
|
|
2091
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
2092
|
+
type: 'text',
|
|
2093
|
+
text: '',
|
|
2094
|
+
},
|
|
2095
|
+
],
|
|
2096
|
+
},
|
|
2097
|
+
]);
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Clones the content state.
|
|
2101
|
+
*
|
|
2102
|
+
* @returns {VegaRTEContent} The cloned content state.
|
|
2103
|
+
*/
|
|
2104
|
+
clone() {
|
|
2105
|
+
return new VegaRTEContent([...this.blocks]);
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* Converts the content state to a JSON array of blocks.
|
|
2109
|
+
*
|
|
2110
|
+
* @returns {VegaRTEContentBlock[]} The JSON array of blocks.
|
|
2111
|
+
*/
|
|
2112
|
+
toJSON() {
|
|
2113
|
+
return this.blocks.map((block) => block.toJSON());
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Internal method to add the block item, remove the block item
|
|
2117
|
+
*
|
|
2118
|
+
* @param {ModifyContentAction} action - Modify content action
|
|
2119
|
+
*/
|
|
2120
|
+
apply(action) {
|
|
2121
|
+
switch (action.type) {
|
|
2122
|
+
case node_abstract.ModifyContentActionType.DELETE_CHILD:
|
|
2123
|
+
this.removeChildBlock(action.entityToBeRemoved);
|
|
2124
|
+
break;
|
|
2125
|
+
case node_abstract.ModifyContentActionType.APPEND_CHILD_NODES:
|
|
2126
|
+
this.appendChildBlocks(action.entityToBeAppended);
|
|
2127
|
+
break;
|
|
2128
|
+
case node_abstract.ModifyContentActionType.INSERT_BLOCKS_AFTER:
|
|
2129
|
+
this.replaceBlockWithBlocks(action.referBlock, [
|
|
2130
|
+
action.referBlock,
|
|
2131
|
+
...action.blocksToBeInserted,
|
|
2132
|
+
]);
|
|
2133
|
+
break;
|
|
2134
|
+
case node_abstract.ModifyContentActionType.INSERT_BLOCKS_BEFORE:
|
|
2135
|
+
this.replaceBlockWithBlocks(action.referBlock, [
|
|
2136
|
+
...action.blocksToBeInserted,
|
|
2137
|
+
action.referBlock,
|
|
2138
|
+
]);
|
|
2139
|
+
break;
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Convert text to list.
|
|
2144
|
+
*
|
|
2145
|
+
* @param {RTETextBlock} block - block
|
|
2146
|
+
* @returns {RTEListItemBlock} list item block dto.
|
|
2147
|
+
*/
|
|
2148
|
+
toListItem(block) {
|
|
2149
|
+
block.nodes.map((node) => node.apply(new textNode.SyncUpSelectionAction()));
|
|
2150
|
+
const listItemBlock = new RTEListItemBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID());
|
|
2151
|
+
listItemBlock.apply(new AppendChildNodesAction(block['nodes']));
|
|
2152
|
+
listItemBlock['annotationMap'] = block['annotationMap'];
|
|
2153
|
+
return listItemBlock;
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2156
|
+
* create list.
|
|
2157
|
+
*
|
|
2158
|
+
* @param {ListType} type - type
|
|
2159
|
+
* @returns {RTEListBlock} list block dto.
|
|
2160
|
+
*/
|
|
2161
|
+
createList(type) {
|
|
2162
|
+
return new RTEListBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), type);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
exports.AppendChildNodesAction = AppendChildNodesAction;
|
|
2167
|
+
exports.BoldAnnotationAction = BoldAnnotationAction;
|
|
2168
|
+
exports.HorizontalAlignmentAnnotation = HorizontalAlignmentAnnotation;
|
|
2169
|
+
exports.ImageAnnotationAction = ImageAnnotationAction;
|
|
2170
|
+
exports.IndentAnnotation = IndentAnnotation;
|
|
2171
|
+
exports.InsertBlocksAfterAction = InsertBlocksAfterAction;
|
|
2172
|
+
exports.InsertBlocksBeforeAction = InsertBlocksBeforeAction;
|
|
2173
|
+
exports.MergeTwoBlocksNodesAction = MergeTwoBlocksNodesAction;
|
|
2174
|
+
exports.RTEImageBlock = RTEImageBlock;
|
|
2175
|
+
exports.RTEImageNode = RTEImageNode;
|
|
2176
|
+
exports.RTEListBlock = RTEListBlock;
|
|
2177
|
+
exports.RTEListItemBlock = RTEListItemBlock;
|
|
2178
|
+
exports.RTETextBlock = RTETextBlock;
|
|
2179
|
+
exports.RemoveChildAction = RemoveChildAction;
|
|
2180
|
+
exports.ReplaceChildNodesAction = ReplaceChildNodesAction;
|
|
2181
|
+
exports.SplitBlockWithNodeAction = SplitBlockWithNodeAction;
|
|
2182
|
+
exports.TextStyleAnnotation = TextStyleAnnotation;
|
|
2183
|
+
exports.TextStyleAnnotationAction = TextStyleAnnotationAction;
|
|
2184
|
+
exports.VegaRTEContent = VegaRTEContent;
|