@globalpayments/vega 2.58.0 → 2.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-26e2fe1e.js → app-globals-64aff1a9.js} +25 -12
- package/dist/cjs/{brand-switch-state-controller-slimmer-5efa1b24.js → brand-switch-state-controller-slimmer-b83a4596.js} +1 -1
- package/dist/cjs/{child-nodes-event-prevent-slimmer-96240a0e.js → child-nodes-event-prevent-slimmer-5df43771.js} +1 -1
- package/dist/cjs/{child-nodes-notify-observer-slimmer-30ba81ac.js → child-nodes-notify-observer-slimmer-34ac3bfc.js} +1 -1
- package/dist/cjs/{code-block-7650c868.js → code-block-4bfae76d.js} +2128 -990
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-a6e4e5bc.js → component-value-history-controller-slimmer.abstract-34f4577a.js} +112 -54
- package/dist/cjs/content-state-b82b74de.js +3692 -0
- package/dist/cjs/{dark-mode-state-controller-slimmer-add5d8a8.js → dark-mode-state-controller-slimmer-17022f93.js} +1 -1
- package/dist/cjs/{dark-mode-style-controller-f9a32d68.js → dark-mode-style-controller-ab0703e1.js} +1 -1
- package/dist/cjs/{deprecated-property-slimmer-4f15005f.js → deprecated-property-slimmer-1eb8f031.js} +1 -1
- package/dist/cjs/{design-token-e771bb16.js → design-token-0b1315f2.js} +1 -1
- package/dist/cjs/{dom-node-subject-factory-769dd00f.js → dom-node-subject-factory-bad99695.js} +1 -1
- package/dist/cjs/{dom-node-subject-observer-factory-5aa4cc83.js → dom-node-subject-observer-factory-df6e6df0.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-7f98d16b.js → element-appender-slimmer-f14737af.js} +7 -7
- package/dist/cjs/{event-emit-slimmer-6154c759.js → event-emit-slimmer-efc70b94.js} +3 -3
- package/dist/cjs/{form-field-controller-slimmer-7bb7df10.js → form-field-controller-slimmer-772d1892.js} +24 -24
- package/dist/cjs/{image-annotation-action-6715d6f3.js → image-annotation-action-a3146135.js} +130 -29
- package/dist/cjs/{index-7700600c.js → index-00ba6623.js} +23 -4
- package/dist/cjs/{index-ee4bc191.js → index-10199ee8.js} +2 -2
- package/dist/cjs/index.cjs.js +23 -23
- package/dist/cjs/{inject-keyboard-manager-f1f781b7.js → inject-keyboard-manager-70382bae.js} +1 -1
- package/dist/cjs/{internal-vega-event-manager-e98944ac.js → internal-vega-event-manager-83065493.js} +1 -1
- package/dist/cjs/{keyboard-manager-0be55fb9.js → keyboard-manager-6858915b.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-92c7227b.js → keyboard-manager-slimmer-faca2038.js} +1 -1
- package/dist/cjs/loader.cjs.js +16 -14
- package/dist/cjs/{object-bbd4ed7f.js → object-e2e28e3d.js} +13 -0
- package/dist/cjs/{public-rules-036795a4.js → public-rules-26467413.js} +11 -9
- package/dist/cjs/{responsive-format-facade-d164ced7.js → responsive-format-facade-d2e03695.js} +4 -4
- package/dist/cjs/{rich-text-editor-required-rule-91eb0e22.js → rich-text-editor-required-rule-026c8c3f.js} +1 -1
- package/dist/cjs/{static-subject-title-7e7d791a.js → static-subject-title-85732e0f.js} +2 -0
- package/dist/cjs/string-39438062.js +24 -0
- package/dist/cjs/{string-input-formatter-slimmer-dc1747ad.js → string-input-formatter-slimmer-1b757bad.js} +3 -3
- package/dist/cjs/{style-formatter-3e7af35b.js → style-formatter-effb0730.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-409bbd1a.js → sub-state-notify-slimmer-943eb7cc.js} +2 -2
- package/dist/cjs/{sub-state-observer-slimmer-93d0a609.js → sub-state-observer-slimmer-0788232a.js} +3 -3
- package/dist/cjs/{translation-de7e351e.js → translation-cde4dce3.js} +31 -1
- package/dist/cjs/{translation-slimmer-83bdb9fe.js → translation-slimmer-af399096.js} +1 -1
- package/dist/cjs/{ui-6c069604.js → ui-4ce1fa08.js} +10 -0
- package/dist/cjs/vega-accordion.cjs.entry.js +17 -15
- package/dist/cjs/vega-app-footer.cjs.entry.js +4 -4
- package/dist/cjs/vega-app-header-button.cjs.entry.js +18 -16
- package/dist/cjs/vega-backdrop.cjs.entry.js +2 -2
- package/dist/cjs/vega-banner.cjs.entry.js +6 -6
- package/dist/cjs/vega-bar-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-box.cjs.entry.js +16 -14
- package/dist/cjs/vega-brand-logo.cjs.entry.js +4 -4
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +7 -7
- package/dist/cjs/vega-button-circle.cjs.entry.js +18 -16
- package/dist/cjs/vega-button-group_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-button-link.cjs.entry.js +7 -7
- package/dist/cjs/vega-button.cjs.entry.js +17 -15
- package/dist/cjs/{vega-calendar_3.cjs.entry.js → vega-calendar_4.cjs.entry.js} +1615 -1096
- package/dist/cjs/vega-card.cjs.entry.js +15 -13
- package/dist/cjs/vega-carousel.cjs.entry.js +17 -16
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +14 -14
- package/dist/cjs/vega-chip.cjs.entry.js +18 -16
- package/dist/cjs/vega-code-block.cjs.entry.js +22 -22
- package/dist/cjs/vega-color-picker.cjs.entry.js +12 -12
- package/dist/cjs/vega-combo-box.cjs.entry.js +15 -15
- package/dist/cjs/vega-counter-badge.cjs.entry.js +1 -1
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +25 -24
- package/dist/cjs/vega-dialog_2.cjs.entry.js +19 -18
- package/dist/cjs/vega-divider.cjs.entry.js +15 -13
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +37 -26
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +3 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +6 -6
- package/dist/cjs/vega-file-uploader.cjs.entry.js +13 -13
- package/dist/cjs/vega-flag-icon.cjs.entry.js +15 -13
- package/dist/cjs/vega-flex.cjs.entry.js +16 -14
- package/dist/cjs/vega-font.cjs.entry.js +15 -13
- package/dist/cjs/vega-form.cjs.entry.js +108 -18
- package/dist/cjs/vega-grid.cjs.entry.js +15 -13
- package/dist/cjs/vega-hint.cjs.entry.js +1 -1
- package/dist/cjs/vega-icon.cjs.entry.js +15 -13
- package/dist/cjs/vega-image-uploader.cjs.entry.js +21 -20
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +13 -13
- package/dist/cjs/vega-input-numeric.cjs.entry.js +16 -16
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +18 -17
- package/dist/cjs/vega-input-range.cjs.entry.js +14 -14
- package/dist/cjs/vega-input-select.cjs.entry.js +20 -19
- package/dist/cjs/vega-input.cjs.entry.js +15 -15
- package/dist/cjs/{vega-internal-event-id-bda08efa.js → vega-internal-event-id-ae6e2c13.js} +7 -1
- package/dist/cjs/vega-item-toggle.cjs.entry.js +8 -8
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +21 -20
- package/dist/cjs/vega-line-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +14 -12
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +7 -7
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +8 -8
- package/dist/cjs/vega-pagination.cjs.entry.js +18 -16
- package/dist/cjs/vega-pie-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-popover_2.cjs.entry.js +43 -20
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +8 -8
- package/dist/cjs/vega-radio_2.cjs.entry.js +16 -16
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +273 -175
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +709 -1496
- package/dist/cjs/vega-section-title.cjs.entry.js +1 -1
- package/dist/cjs/vega-segment-control.cjs.entry.js +6 -6
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +20 -19
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +15 -15
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +18 -16
- package/dist/cjs/vega-signature-capture.cjs.entry.js +20 -20
- package/dist/cjs/{vega-skeleton-loader-controller-d534f5a1.js → vega-skeleton-loader-controller-b1971f43.js} +3 -3
- package/dist/cjs/vega-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
- package/dist/cjs/vega-stepper.cjs.entry.js +13 -13
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-table_8.cjs.entry.js +20 -19
- package/dist/cjs/vega-text.cjs.entry.js +2 -2
- package/dist/cjs/vega-textarea.cjs.entry.js +13 -13
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +23 -22
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +12 -12
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +19 -18
- package/dist/cjs/vega.cjs.js +16 -14
- package/dist/collection/collection-manifest.json +8 -6
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-controller.js +3 -0
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-preivew-popover-controller.js +83 -0
- package/dist/collection/components/vega-calendar/slimmers/common/controllers/vega-calendar-post-operation-date-controller.js +15 -2
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/base-repeat-pattern.js +16 -0
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-daily-repeat-pattern.js +12 -0
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-monthly-repeat-pattern.js +12 -0
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-weekly-repeat-pattern.js +14 -0
- package/dist/collection/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-yearly-repeat-pattern.js +13 -0
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +53 -2
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.js +68 -0
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-full-day-event-layout-renderer.js +5 -2
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-renderer.js +10 -1
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-switch-panel.js +3 -4
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/full-day-event/vega-calendar-full-day-event-renderer.js +3 -3
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-day-event-layout-renderer.js +5 -2
- package/dist/collection/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-timed-event-renderer.js +1 -1
- package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.js +61 -23
- package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-view-renderer.js +1 -2
- package/dist/collection/components/vega-calendar/utils/index.js +16 -10
- package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.js +5 -32
- package/dist/collection/components/vega-calendar/vega-calendar-event/vega-calendar-event.js +0 -5
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/assets/clock.js +3 -0
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/assets/close.js +3 -0
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/slimmers/controllers/vega-calendar-event-preview-state-controller.js +46 -0
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.js +81 -0
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/vega-calendar-event-preview.css +86 -0
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/vega-calendar-event-preview.js +56 -0
- package/dist/collection/components/vega-calendar/vega-calendar.css +10 -0
- package/dist/collection/components/vega-calendar/vega-calendar.js +37 -0
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.js +12 -3
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/vega-dropdown-item.css +0 -1
- package/dist/collection/components/vega-field-error/slimmers/controllers/vega-field-error-message-controller.js +1 -0
- package/dist/collection/components/vega-form/slimmers/controllers/vega-form-field-validation-state-controller.js +80 -0
- package/dist/collection/components/vega-form/vega-form.js +47 -0
- package/dist/collection/components/vega-popover/slimmers/renderers/vega-popover-appender-renderer.js +4 -1
- package/dist/collection/components/vega-popover/vega-popover-content-box/vega-popover-content-box.css +2521 -1
- package/dist/collection/components/vega-popover/vega-popover-content-box/vega-popover-content-box.js +42 -1
- package/dist/collection/components/vega-popover/vega-popover.js +36 -0
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +3 -15
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +81 -16
- package/dist/collection/components/vega-rich-text-editor/assets/display-code.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +6 -5
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +90 -26
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.js +18 -4
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.js +6 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +15 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/{block-append-blocks-strategy.js → append-children-strategy.js} +3 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/{block-delete-text-content-strategy.js → block-delete-text-or-decorator-node-strategy.js} +60 -12
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.js +7 -7
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.js +38 -30
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +4 -4
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.js +4 -4
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +4 -4
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +6 -6
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-unlink-link-group-strategy.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +4 -4
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-link-group-strategy.js +34 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.js +6 -6
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-after-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-before-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-text-to-decorator-node-strategy.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/link-group-node-split-strategy.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.js +15 -15
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +5 -5
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +10 -10
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +13 -13
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/remove-children-strategy.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-cursor-position-strategy.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.js +7 -3
- package/dist/collection/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/delete-link-group-action.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-children-after-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-children-before-block.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/{break-single-block-action.js → insert-new-paragraph-action.js} +3 -3
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-text-to-decorator-node-action.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/link-annotation-action.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/actions/link-group-node-split-action.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +10 -7
- package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-child-action.js +4 -5
- package/dist/collection/components/vega-rich-text-editor/dto/actions/unlink-link-group-action.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +21 -14
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.js +80 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.js +67 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +26 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +17 -8
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.js +68 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/internal-wrapper-annotation.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +16 -11
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +92 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/plain-text-annotation.js +42 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +3 -7
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +74 -12
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +116 -4
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +10 -2
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +78 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +17 -21
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +66 -12
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +20 -18
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +116 -37
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +70 -33
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +9 -2
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/decorator-node.js +58 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +45 -19
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +145 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +163 -21
- package/dist/collection/components/vega-rich-text-editor/dto/range.js +22 -33
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/base-renderer.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.js +7 -23
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +15 -93
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +0 -9
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/html-block-renderer.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +1 -5
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +125 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +2 -6
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +2 -27
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +70 -7
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.js +2 -28
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +19 -5
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/renderer-factory.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/dto/setup.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +83 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +53 -29
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/focus-controller.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/annotation-generator-strategy.abstract.js +5 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/bold-annotaion-handler.js +33 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/code-annotation-handler.js +33 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/color-annotation-handler.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-attribute-annotation-handler.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-class-annotation-handler.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.js +66 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-alt-annotation-handler.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-size-annotation-handler.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/indent-annotation-handler.js +53 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/italic-annotation-handler.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/link-annotation-handler.js +53 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/strike-through-annotation-handler.js +34 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-align-annotation-handler.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.js +120 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/underline-annotation-handler.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +38 -232
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +34 -19
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +19 -33
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.js +4 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.js +33 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-text-node-strategy.js +33 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +5 -21
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +8 -48
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-element-to-text-node-strategy.js +46 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +59 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +8 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/plain-text-to-text-node-strategy.js +35 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +5 -21
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-not-li-child-to-rte-list-item-block.js +11 -6
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +8 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +8 -22
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +13 -15
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +36 -28
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-composition-text-controller.js +6 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-image-controller.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +75 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.js +39 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +41 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +64 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +5 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +10 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +41 -3
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +2 -3
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +8 -9
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +15 -13
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +8 -8
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +12 -12
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +34 -12
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotation-actions.test.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +258 -28
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/html-block.test.js +124 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/image-block.test.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/text-block.test.js +59 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +2613 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +103 -4
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/custom-attribute-annotation-handler.test.js +49 -0
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/element-to-text-node-strategy.test.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/html-element-to-annotation-generator.test.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/test/spec-utils.js +32 -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 +6 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.css +3 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +7 -32
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +67 -2
- package/dist/collection/constants/ui.js +1 -0
- package/dist/collection/helpers/calendar/calendar-date.js +12 -0
- package/dist/collection/helpers/calendar/calendar-event.js +24 -0
- package/dist/collection/helpers/calendar/test/calendar-date.test.js +4 -0
- package/dist/collection/helpers/calendar/test/calendar-event.test.js +57 -0
- package/dist/collection/helpers/calendar/utils.js +38 -0
- package/dist/collection/helpers/change-manager/subject/static-subject/static-subject-title.js +1 -0
- package/dist/collection/helpers/code-format/code-formatter.js +116 -0
- package/dist/collection/helpers/code-format/test/code-formatter.test.js +362 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +4 -1
- package/dist/collection/helpers/rte-manager/dto-action-strategy-manager.js +37 -0
- package/dist/collection/helpers/rte-manager/dto-class-manager.js +51 -0
- package/dist/collection/helpers/rte-manager/dto-renderer-manager.js +54 -0
- package/dist/collection/helpers/rte-manager/element-dto-class-strategy-manager.js +56 -0
- package/dist/collection/helpers/rte-manager/rte.manager.test.js +94 -0
- package/dist/collection/helpers/slimmers/field-error-controller-silmmer.js +4 -6
- package/dist/collection/helpers/slimmers/field-error-ui-controller-slimmer.js +12 -10
- package/dist/collection/helpers/slimmers/global/vega-translate-observer-slimmer.js +17 -4
- package/dist/collection/helpers/slimmers/test/field-error-controller-slimmer.test.js +1 -0
- package/dist/collection/helpers/slimmers/test/global/vega-translate-observer-slimmer.test.js +89 -0
- package/dist/collection/helpers/translation/locales/en.js +30 -0
- package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +30 -0
- package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +16 -14
- package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +1 -0
- package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
- package/dist/collection/utils/object.js +12 -0
- package/dist/collection/utils/string.js +10 -0
- package/dist/collection/utils/test/object.test.js +27 -1
- package/dist/collection/utils/ui.js +9 -0
- package/dist/esm/{app-globals-ee6a1250.js → app-globals-05dbca3e.js} +25 -12
- package/dist/esm/{brand-switch-state-controller-slimmer-05c85e6d.js → brand-switch-state-controller-slimmer-d6e4d217.js} +1 -1
- package/dist/esm/{child-nodes-event-prevent-slimmer-b59a578e.js → child-nodes-event-prevent-slimmer-6b5b31f5.js} +1 -1
- package/dist/esm/{child-nodes-notify-observer-slimmer-eeed5986.js → child-nodes-notify-observer-slimmer-78f77c2c.js} +1 -1
- package/dist/esm/{code-block-7bd4cb87.js → code-block-3d519665.js} +2107 -970
- package/dist/esm/{component-value-history-controller-slimmer.abstract-41c58caf.js → component-value-history-controller-slimmer.abstract-8b5be007.js} +112 -54
- package/dist/esm/content-state-73900a67.js +3682 -0
- package/dist/esm/{dark-mode-state-controller-slimmer-f1c2c299.js → dark-mode-state-controller-slimmer-0c7d1c77.js} +1 -1
- package/dist/esm/{dark-mode-style-controller-ea798fc8.js → dark-mode-style-controller-3bbb32dc.js} +1 -1
- package/dist/esm/{deprecated-property-slimmer-32575f02.js → deprecated-property-slimmer-2c14df89.js} +1 -1
- package/dist/esm/{design-token-23522f5c.js → design-token-dbc8c235.js} +1 -1
- package/dist/esm/{dom-node-subject-factory-6374611f.js → dom-node-subject-factory-202655e7.js} +1 -1
- package/dist/esm/{dom-node-subject-observer-factory-c345ca2e.js → dom-node-subject-observer-factory-999e21e3.js} +1 -1
- package/dist/esm/{element-appender-slimmer-042df95a.js → element-appender-slimmer-6ad38a9b.js} +7 -7
- package/dist/esm/{event-emit-slimmer-b5cb9b81.js → event-emit-slimmer-40973ec2.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-f0982f11.js → form-field-controller-slimmer-47820eaa.js} +24 -24
- package/dist/esm/{image-annotation-action-1e88f5a0.js → image-annotation-action-4ebed11f.js} +128 -29
- package/dist/esm/{index-d0a47531.js → index-057d0f70.js} +23 -4
- package/dist/esm/{index-fb3b74bd.js → index-18a340fb.js} +2 -2
- package/dist/esm/index.js +16 -16
- package/dist/esm/{inject-keyboard-manager-5141d09a.js → inject-keyboard-manager-a28dfee4.js} +1 -1
- package/dist/esm/{internal-vega-event-manager-d80c53c5.js → internal-vega-event-manager-526f8ed1.js} +1 -1
- package/dist/esm/{keyboard-manager-3ffe81b0.js → keyboard-manager-fa6355cb.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-751e98f5.js → keyboard-manager-slimmer-818050ee.js} +1 -1
- package/dist/esm/loader.js +16 -14
- package/dist/esm/{object-261e7344.js → object-66c37948.js} +13 -1
- package/dist/esm/{public-rules-287d4d77.js → public-rules-f28aca10.js} +11 -9
- package/dist/esm/{responsive-format-facade-d2632288.js → responsive-format-facade-81b72f39.js} +4 -4
- package/dist/esm/{rich-text-editor-required-rule-69d5f035.js → rich-text-editor-required-rule-c4ba68b8.js} +1 -1
- package/dist/esm/{static-subject-title-ca83d6b6.js → static-subject-title-633b3474.js} +2 -1
- package/dist/esm/string-a953eafc.js +21 -0
- package/dist/esm/{string-input-formatter-slimmer-09478e0d.js → string-input-formatter-slimmer-b144e8d7.js} +3 -3
- package/dist/esm/{style-formatter-f7951677.js → style-formatter-7d817448.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-0a6c3cbb.js → sub-state-notify-slimmer-b3524c09.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-53eec5fb.js → sub-state-observer-slimmer-c823d69c.js} +3 -3
- package/dist/esm/{translation-a6eacb5f.js → translation-833d9ef4.js} +31 -1
- package/dist/esm/{translation-slimmer-f28e4708.js → translation-slimmer-c83b52c1.js} +1 -1
- package/dist/esm/{ui-7d177fb0.js → ui-c20be16d.js} +10 -1
- package/dist/esm/vega-accordion.entry.js +17 -15
- package/dist/esm/vega-app-footer.entry.js +4 -4
- package/dist/esm/vega-app-header-button.entry.js +18 -16
- package/dist/esm/vega-backdrop.entry.js +2 -2
- package/dist/esm/vega-banner.entry.js +6 -6
- package/dist/esm/vega-bar-chart.entry.js +1 -1
- package/dist/esm/vega-box.entry.js +16 -14
- package/dist/esm/vega-brand-logo.entry.js +4 -4
- package/dist/esm/vega-breadcrumb.entry.js +7 -7
- package/dist/esm/vega-button-circle.entry.js +18 -16
- package/dist/esm/vega-button-group_2.entry.js +10 -10
- package/dist/esm/vega-button-link.entry.js +7 -7
- package/dist/esm/vega-button.entry.js +17 -15
- package/dist/esm/{vega-calendar_3.entry.js → vega-calendar_4.entry.js} +1615 -1097
- package/dist/esm/vega-card.entry.js +15 -13
- package/dist/esm/vega-carousel.entry.js +17 -16
- package/dist/esm/vega-checkbox_2.entry.js +14 -14
- package/dist/esm/vega-chip.entry.js +18 -16
- package/dist/esm/vega-code-block.entry.js +19 -19
- package/dist/esm/vega-color-picker.entry.js +12 -12
- package/dist/esm/vega-combo-box.entry.js +15 -15
- package/dist/esm/vega-counter-badge.entry.js +1 -1
- package/dist/esm/vega-date-picker_2.entry.js +25 -24
- package/dist/esm/vega-dialog_2.entry.js +19 -18
- package/dist/esm/vega-divider.entry.js +15 -13
- package/dist/esm/vega-dropdown_5.entry.js +37 -26
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +3 -2
- package/dist/esm/vega-field-label.entry.js +6 -6
- package/dist/esm/vega-file-uploader.entry.js +13 -13
- package/dist/esm/vega-flag-icon.entry.js +15 -13
- package/dist/esm/vega-flex.entry.js +16 -14
- package/dist/esm/vega-font.entry.js +15 -13
- package/dist/esm/vega-form.entry.js +109 -19
- package/dist/esm/vega-grid.entry.js +15 -13
- package/dist/esm/vega-hint.entry.js +1 -1
- package/dist/esm/vega-icon.entry.js +15 -13
- package/dist/esm/vega-image-uploader.entry.js +21 -20
- package/dist/esm/vega-input-credit-card.entry.js +13 -13
- package/dist/esm/vega-input-numeric.entry.js +16 -16
- package/dist/esm/vega-input-phone-number.entry.js +18 -17
- package/dist/esm/vega-input-range.entry.js +14 -14
- package/dist/esm/vega-input-select.entry.js +20 -19
- package/dist/esm/vega-input.entry.js +15 -15
- package/dist/esm/{vega-internal-event-id-4072659b.js → vega-internal-event-id-b7c865de.js} +5 -2
- package/dist/esm/vega-item-toggle.entry.js +8 -8
- package/dist/esm/vega-left-nav_5.entry.js +21 -20
- package/dist/esm/vega-line-chart.entry.js +1 -1
- package/dist/esm/vega-loader-wrapper_2.entry.js +14 -12
- package/dist/esm/vega-page-notification_2.entry.js +4 -4
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +7 -7
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +8 -8
- package/dist/esm/vega-pagination.entry.js +18 -16
- package/dist/esm/vega-pie-chart.entry.js +1 -1
- package/dist/esm/vega-popover_2.entry.js +43 -20
- package/dist/esm/vega-progress-tracker.entry.js +8 -8
- package/dist/esm/vega-radio_2.entry.js +16 -16
- package/dist/esm/vega-rich-text-content.entry.js +273 -175
- package/dist/esm/vega-rich-text-editor_4.entry.js +693 -1480
- package/dist/esm/vega-section-title.entry.js +1 -1
- package/dist/esm/vega-segment-control.entry.js +6 -6
- package/dist/esm/vega-selection-chip_2.entry.js +20 -19
- package/dist/esm/vega-selection-tile_2.entry.js +15 -15
- package/dist/esm/vega-sidenav_3.entry.js +18 -16
- package/dist/esm/vega-signature-capture.entry.js +20 -20
- package/dist/esm/{vega-skeleton-loader-controller-3f6faa17.js → vega-skeleton-loader-controller-38864fcd.js} +3 -3
- package/dist/esm/vega-skeleton.entry.js +1 -1
- package/dist/esm/vega-slot-container.entry.js +1 -1
- package/dist/esm/vega-stepper.entry.js +13 -13
- package/dist/esm/vega-tab-group_2.entry.js +8 -8
- package/dist/esm/vega-table_8.entry.js +20 -19
- package/dist/esm/vega-text.entry.js +2 -2
- package/dist/esm/vega-textarea.entry.js +13 -13
- package/dist/esm/vega-time-picker_2.entry.js +23 -22
- package/dist/esm/vega-toggle-switch.entry.js +12 -12
- package/dist/esm/vega-tooltip_2.entry.js +19 -18
- package/dist/esm/vega.js +16 -14
- package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-controller.d.ts +1 -0
- package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-event-preivew-popover-controller.d.ts +48 -0
- package/dist/types/components/vega-calendar/slimmers/common/controllers/vega-calendar-post-operation-date-controller.d.ts +10 -0
- package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/base-repeat-pattern.d.ts +8 -0
- package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-daily-repeat-pattern.d.ts +6 -0
- package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-monthly-repeat-pattern.d.ts +6 -0
- package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-weekly-repeat-pattern.d.ts +6 -0
- package/dist/types/components/vega-calendar/slimmers/common/helpers/repeat-pattern/calendar-event-yearly-repeat-pattern.d.ts +6 -0
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.d.ts +8 -1
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.d.ts +18 -0
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-full-day-event-layout-renderer.d.ts +3 -1
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-renderer.d.ts +3 -0
- package/dist/types/components/vega-calendar/slimmers/day-view/renderers/timed-event/vega-calendar-day-event-layout-renderer.d.ts +3 -1
- package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.d.ts +6 -1
- package/dist/types/components/vega-calendar/utils/index.d.ts +9 -8
- package/dist/types/components/vega-calendar/vega-calendar-event/slimmers/renderers/vega-calendar-event-renderer.d.ts +0 -8
- package/dist/types/components/vega-calendar/vega-calendar-event/vega-calendar-event.d.ts +0 -2
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/assets/clock.d.ts +3 -0
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/assets/close.d.ts +3 -0
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/slimmers/controllers/vega-calendar-event-preview-state-controller.d.ts +16 -0
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.d.ts +13 -0
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/types.d.ts +5 -0
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/vega-calendar-event-preview.d.ts +22 -0
- package/dist/types/components/vega-calendar/vega-calendar.d.ts +10 -0
- package/dist/types/components/vega-field-error/types.d.ts +2 -1
- package/dist/types/components/vega-form/slimmers/controllers/vega-form-field-validation-state-controller.d.ts +29 -0
- package/dist/types/components/vega-form/types.d.ts +18 -0
- package/dist/types/components/vega-form/vega-form.d.ts +11 -1
- package/dist/types/components/vega-popover/slimmers/renderers/vega-popover-appender-renderer.d.ts +1 -0
- package/dist/types/components/vega-popover/vega-popover-content-box/vega-popover-content-box.d.ts +7 -0
- package/dist/types/components/vega-popover/vega-popover.d.ts +7 -1
- package/dist/types/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.d.ts +0 -2
- package/dist/types/components/vega-rich-text-editor/assets/display-code.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +4 -4
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +55 -27
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/append-children-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +4 -4
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-or-decorator-node-strategy.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.d.ts +11 -12
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-unlink-link-group-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/delete-link-group-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-after-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-children-before-strategy.d.ts +23 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/insert-text-to-decorator-node-strategy.d.ts +18 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/link-group-node-split-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +5 -5
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/remove-children-strategy.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-cursor-position-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/append-child-nodes-action.d.ts +6 -2
- package/dist/types/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/delete-link-group-action.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-children-after-block.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-children-before-block.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/{break-single-block-action.d.ts → insert-new-paragraph-action.d.ts} +2 -2
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-text-to-decorator-node-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/link-annotation-action.d.ts +3 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/link-group-annotation-action.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/link-group-node-split-action.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +12 -9
- package/dist/types/components/vega-rich-text-editor/dto/actions/remove-child-action.d.ts +3 -4
- package/dist/types/components/vega-rich-text-editor/dto/actions/unlink-link-group-action.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-cursor-position-action.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +18 -4
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +9 -11
- package/dist/types/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.d.ts +44 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.d.ts +40 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.d.ts +48 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +10 -8
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/internal-wrapper-annotation.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +10 -6
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +49 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +18 -4
- package/dist/types/components/vega-rich-text-editor/dto/annotations/plain-text-annotation.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +3 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +9 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +70 -9
- package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +7 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +10 -4
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +33 -6
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +9 -5
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +29 -14
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +20 -3
- package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +7 -2
- package/dist/types/components/vega-rich-text-editor/dto/nodes/decorator-node.d.ts +41 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +10 -4
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +116 -5
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +59 -4
- package/dist/types/components/vega-rich-text-editor/dto/range.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/dto/renderers/base-renderer.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.d.ts +7 -20
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +9 -6
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +0 -8
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/html-block-renderer.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.d.ts +0 -2
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.d.ts +0 -2
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +0 -3
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.d.ts +3 -16
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/renderer-factory.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/setup.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/extensions/base-extension-renderer.d.ts +61 -0
- package/dist/types/components/vega-rich-text-editor/extensions/base-toolbar-button-renderer.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +172 -42
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/focus-controller.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/annotation-generator-strategy.abstract.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/bold-annotaion-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/code-annotation-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/color-annotation-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-attribute-annotation-handler.d.ts +35 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-class-annotation-handler.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.d.ts +26 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-alt-annotation-handler.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/image-size-annotation-handler.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/indent-annotation-handler.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/italic-annotation-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/link-annotation-handler.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/strike-through-annotation-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-align-annotation-handler.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.d.ts +57 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/underline-annotation-handler.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +12 -85
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +10 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +12 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract.d.ts +6 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-text-node-strategy.d.ts +23 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.d.ts +34 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +5 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +3 -9
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-element-to-text-node-strategy.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.d.ts +20 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +5 -5
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/plain-text-to-text-node-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +5 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-not-li-child-to-rte-list-item-block.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +5 -5
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +5 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/state-entity-rendering-registry.d.ts +20 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/value-controller.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +7 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +10 -2
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/html-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/text-block.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/dto/nodes/text-node.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/custom-attribute-annotation-handler.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/element-to-text-node-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/html-element-to-annotation-generator.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/spec-utils.d.ts +15 -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 +1 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor-toolbar-button/vega-rich-text-editor-toolbar-button.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +17 -1
- package/dist/types/components.d.ts +81 -2
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/helpers/calendar/calendar-date.d.ts +7 -0
- package/dist/types/helpers/calendar/calendar-event.d.ts +15 -1
- package/dist/types/helpers/calendar/utils.d.ts +18 -0
- package/dist/types/helpers/change-manager/subject/static-subject/static-subject-title.d.ts +2 -1
- package/dist/types/helpers/code-format/code-formatter.d.ts +34 -0
- package/dist/types/helpers/code-format/test/code-formatter.test.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +3 -0
- package/dist/types/helpers/rte-manager/dto-action-strategy-manager.d.ts +13 -0
- package/dist/types/helpers/rte-manager/dto-class-manager.d.ts +38 -0
- package/dist/types/helpers/rte-manager/dto-renderer-manager.d.ts +44 -0
- package/dist/types/helpers/rte-manager/element-dto-class-strategy-manager.d.ts +42 -0
- package/dist/types/helpers/rte-manager/rte.manager.test.d.ts +1 -0
- package/dist/types/helpers/slimmers/field-error-ui-controller-slimmer.d.ts +1 -1
- package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +1 -1
- package/dist/types/helpers/slimmers/global/vega-translate-observer-slimmer.d.ts +6 -0
- package/dist/types/helpers/slimmers/test/global/vega-translate-observer-slimmer.test.d.ts +1 -0
- package/dist/types/helpers/translation/interface.d.ts +31 -1
- package/dist/types/types/class.type.d.ts +3 -0
- package/dist/types/types/components.type.d.ts +10 -2
- package/dist/types/utils/object.d.ts +8 -0
- package/dist/types/utils/string.d.ts +7 -0
- package/dist/types/utils/ui.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-02841589.js +1 -0
- package/dist/vega/{p-81ed90d5.js → p-02b29c18.js} +1 -1
- package/dist/vega/{p-4c4ac1a5.entry.js → p-09ddae74.entry.js} +1 -1
- package/dist/vega/{p-1db2ba98.entry.js → p-0c247128.entry.js} +1 -1
- package/dist/vega/p-0cd89fb6.js +1 -0
- package/dist/vega/{p-e940bc37.js → p-0f0baac3.js} +1 -1
- package/dist/vega/{p-fcb5b40f.entry.js → p-12ed3141.entry.js} +1 -1
- package/dist/vega/p-13eca7f3.entry.js +1 -0
- package/dist/vega/p-17d517c8.entry.js +1 -0
- package/dist/vega/{p-f25570f5.js → p-1a195e28.js} +1 -1
- package/dist/vega/{p-8782abeb.js → p-1bd516c5.js} +1 -1
- package/dist/vega/p-1ff1deaf.entry.js +1 -0
- package/dist/vega/p-2004317b.entry.js +1 -0
- package/dist/vega/{p-7c348ac7.entry.js → p-26ef2066.entry.js} +1 -1
- package/dist/vega/{p-c69a6547.entry.js → p-27b5f69c.entry.js} +1 -1
- package/dist/vega/p-29e0d4c8.entry.js +1 -0
- package/dist/vega/{p-41465ad0.entry.js → p-2a66e2f7.entry.js} +1 -1
- package/dist/vega/p-351405f2.entry.js +1 -0
- package/dist/vega/p-369f38ed.entry.js +1 -0
- package/dist/vega/{p-82b18195.entry.js → p-36ae2dd3.entry.js} +1 -1
- package/dist/vega/p-36ed226a.js +1 -0
- package/dist/vega/p-42033e59.js +1 -0
- package/dist/vega/{p-832b59af.js → p-436f7e27.js} +1 -1
- package/dist/vega/{p-5bd3487e.js → p-4452e085.js} +1 -1
- package/dist/vega/{p-710da484.entry.js → p-446d0317.entry.js} +1 -1
- package/dist/vega/{p-012cbd8f.js → p-4474bc63.js} +1 -1
- package/dist/vega/{p-6dad2e5c.entry.js → p-476cc642.entry.js} +1 -1
- package/dist/vega/p-48a58baf.js +2 -0
- package/dist/vega/p-490f5e3f.entry.js +1 -0
- package/dist/vega/p-4996b853.entry.js +1 -0
- package/dist/vega/{p-bcdb235d.js → p-4a368e1e.js} +1 -1
- package/dist/vega/p-4b7edf72.entry.js +1 -0
- package/dist/vega/{p-4674c318.entry.js → p-4fc18f2f.entry.js} +1 -1
- package/dist/vega/p-51cce3f9.entry.js +1 -0
- package/dist/vega/p-521ace2d.js +1 -0
- package/dist/vega/{p-1f9a735a.entry.js → p-53d67971.entry.js} +1 -1
- package/dist/vega/p-555804a0.entry.js +1 -0
- package/dist/vega/{p-d5776087.js → p-575235c8.js} +1 -1
- package/dist/vega/p-59e990c7.entry.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-7d5ebd26.entry.js → p-606d1f7c.entry.js} +1 -1
- package/dist/vega/{p-4ab67150.entry.js → p-61d1f3cb.entry.js} +1 -1
- package/dist/vega/{p-fda6f8bc.js → p-63c9eb58.js} +1 -1
- package/dist/vega/p-675b9501.entry.js +1 -0
- package/dist/vega/{p-5f6b942c.entry.js → p-6b292628.entry.js} +1 -1
- package/dist/vega/p-707bb905.entry.js +1 -0
- package/dist/vega/{p-c9740710.entry.js → p-70939752.entry.js} +1 -1
- package/dist/vega/p-7183bd72.entry.js +1 -0
- package/dist/vega/p-73b487b0.entry.js +1 -0
- package/dist/vega/p-76de6b00.entry.js +1 -0
- package/dist/vega/p-7a3b142b.js +1 -0
- package/dist/vega/{p-9b08ed46.entry.js → p-7b1bb372.entry.js} +1 -1
- package/dist/vega/{p-4c871d0f.entry.js → p-7cd2fac8.entry.js} +1 -1
- package/dist/vega/{p-0c8bd757.js → p-7e8f055d.js} +1 -1
- package/dist/vega/p-7f087c8b.js +1 -0
- package/dist/vega/{p-904d1b43.js → p-846ae5fb.js} +1 -1
- package/dist/vega/{p-66e9d31a.entry.js → p-847dbae4.entry.js} +1 -1
- package/dist/vega/{p-397b5d91.entry.js → p-850a6305.entry.js} +1 -1
- package/dist/vega/p-86f17433.js +1 -0
- package/dist/vega/{p-acd9bfa4.js → p-8852361b.js} +1 -1
- package/dist/vega/{p-fe1512f9.entry.js → p-8a317208.entry.js} +1 -1
- package/dist/vega/p-8a877e12.js +1 -0
- package/dist/vega/{p-4a237308.js → p-8baacfc5.js} +1 -1
- package/dist/vega/p-9479866e.entry.js +1 -0
- package/dist/vega/{p-8c4f893b.js → p-9773c913.js} +1 -1
- package/dist/vega/{p-bd84b7b9.entry.js → p-9a74eb86.entry.js} +1 -1
- package/dist/vega/p-9f453b90.entry.js +1 -0
- package/dist/vega/{p-9afdcf65.js → p-a204a2b2.js} +1 -1
- package/dist/vega/p-a328d448.entry.js +1 -0
- package/dist/vega/{p-59282fc8.entry.js → p-a7baad6d.entry.js} +1 -1
- package/dist/vega/p-ad1b22b4.entry.js +1 -0
- package/dist/vega/{p-8e581755.entry.js → p-ae21e5f5.entry.js} +1 -1
- package/dist/vega/p-ae415e7e.entry.js +1 -0
- package/dist/vega/{p-613ee009.js → p-af464251.js} +1 -1
- package/dist/vega/p-b40adb9e.js +1 -0
- package/dist/vega/p-b4be8573.entry.js +1 -0
- package/dist/vega/{p-6e01f0a2.js → p-b5822a21.js} +1 -1
- package/dist/vega/p-b5bef48a.js +1 -0
- package/dist/vega/{p-f3bd26a1.entry.js → p-b73532c0.entry.js} +1 -1
- package/dist/vega/{p-d789b291.js → p-bbb96a13.js} +1 -1
- package/dist/vega/p-bca1f8f9.js +1 -0
- package/dist/vega/p-bdce4143.js +1 -0
- package/dist/vega/p-be8bbaa5.entry.js +1 -0
- package/dist/vega/p-bf0ced3c.js +1 -0
- package/dist/vega/p-bf19682d.js +1 -0
- package/dist/vega/p-bf6187f7.entry.js +1 -0
- package/dist/vega/{p-a4a0fcfd.entry.js → p-c5c5509c.entry.js} +2 -2
- package/dist/vega/{p-9540e3ed.entry.js → p-c81cb852.entry.js} +1 -1
- package/dist/vega/p-c9c2c8c6.entry.js +1 -0
- package/dist/vega/p-ca30b996.js +1 -0
- package/dist/vega/{p-091ab617.entry.js → p-cc20f01f.entry.js} +1 -1
- package/dist/vega/{p-500684e1.entry.js → p-cc5a3a1b.entry.js} +1 -1
- package/dist/vega/{p-f940b7f7.entry.js → p-d0fbbb7f.entry.js} +1 -1
- package/dist/vega/p-d3bcaa82.entry.js +1 -0
- package/dist/vega/{p-864de9a1.js → p-d4564bfd.js} +1 -1
- package/dist/vega/{p-c42ec0ac.entry.js → p-d45f79ce.entry.js} +1 -1
- package/dist/vega/{p-34dc3f71.entry.js → p-d72abacd.entry.js} +1 -1
- package/dist/vega/p-dbb06804.entry.js +1 -0
- package/dist/vega/{p-a1e50e6c.entry.js → p-dc5026e7.entry.js} +1 -1
- package/dist/vega/p-df647e48.entry.js +1 -0
- package/dist/vega/p-e989ce94.entry.js +1 -0
- package/dist/vega/{p-311f338d.entry.js → p-e9ad8223.entry.js} +1 -1
- package/dist/vega/p-e9d2e0dc.entry.js +1 -0
- package/dist/vega/{p-86a300e8.entry.js → p-ebbaa112.entry.js} +1 -1
- package/dist/vega/{p-24042f0c.entry.js → p-f47de801.entry.js} +1 -1
- package/dist/vega/p-f6b11a21.entry.js +1 -0
- package/dist/vega/p-f6d25220.js +1 -0
- package/dist/vega/p-f8e62e5e.entry.js +1 -0
- package/dist/vega/{p-9ce0bd82.entry.js → p-fc8badd3.entry.js} +2 -2
- package/dist/vega/p-fd6f90fd.entry.js +1 -0
- package/dist/vega/{p-42ec43ef.entry.js → p-fe6ea6cf.entry.js} +1 -1
- package/dist/vega/{p-92355996.entry.js → p-ffaee583.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +5 -3
- package/dist/cjs/content-state-fd5ad4a8.js +0 -1152
- package/dist/cjs/string-21427167.js +0 -13
- package/dist/cjs/types-a4295b11.js +0 -12
- package/dist/collection/components/vega-calendar/vega-calendar-event/slimmers/controllers/vega-calendar-event-bg-color-controller.js +0 -29
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.js +0 -21
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.js +0 -54
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.js +0 -38
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.js +0 -15
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +0 -21
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.js +0 -28
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.js +0 -44
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.js +0 -20
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.js +0 -19
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.js +0 -14
- package/dist/collection/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.js +0 -14
- package/dist/esm/content-state-a43e703e.js +0 -1146
- package/dist/esm/string-be824360.js +0 -11
- package/dist/esm/types-0cadfd73.js +0 -12
- package/dist/types/components/vega-calendar/vega-calendar-event/slimmers/controllers/vega-calendar-event-bg-color-controller.d.ts +0 -12
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.d.ts +0 -16
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.d.ts +0 -19
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.d.ts +0 -19
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.d.ts +0 -23
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +0 -16
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.d.ts +0 -20
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.d.ts +0 -21
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.d.ts +0 -15
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.d.ts +0 -15
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-after-block.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-blocks-before-block.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-after-node-action.d.ts +0 -13
- package/dist/types/components/vega-rich-text-editor/dto/actions/insert-nodes-before-node-action.d.ts +0 -13
- package/dist/vega/p-083af15f.entry.js +0 -1
- package/dist/vega/p-0b5330e1.entry.js +0 -1
- package/dist/vega/p-0bb29d98.js +0 -1
- package/dist/vega/p-1792a352.entry.js +0 -1
- package/dist/vega/p-1a4f77de.entry.js +0 -1
- package/dist/vega/p-1a6dacc7.entry.js +0 -1
- package/dist/vega/p-21d26bb4.js +0 -2
- package/dist/vega/p-27a9ad35.entry.js +0 -1
- package/dist/vega/p-27ec0c07.entry.js +0 -1
- package/dist/vega/p-317920e6.entry.js +0 -1
- package/dist/vega/p-376b3ec7.entry.js +0 -1
- package/dist/vega/p-394594e9.entry.js +0 -1
- package/dist/vega/p-43263510.js +0 -1
- package/dist/vega/p-435451be.entry.js +0 -1
- package/dist/vega/p-472108bd.entry.js +0 -1
- package/dist/vega/p-47a4c625.js +0 -1
- package/dist/vega/p-48ae6f02.entry.js +0 -1
- package/dist/vega/p-48b24fd3.entry.js +0 -1
- package/dist/vega/p-5773a9a3.js +0 -1
- package/dist/vega/p-5fe47fe8.entry.js +0 -1
- package/dist/vega/p-61ea2d75.entry.js +0 -1
- package/dist/vega/p-63adca7b.entry.js +0 -1
- package/dist/vega/p-699032fc.entry.js +0 -1
- package/dist/vega/p-6be16084.js +0 -1
- package/dist/vega/p-71c65f7e.js +0 -1
- package/dist/vega/p-81279fea.entry.js +0 -1
- package/dist/vega/p-88e08a33.js +0 -1
- package/dist/vega/p-8e2b1dae.entry.js +0 -1
- package/dist/vega/p-8e662f26.js +0 -1
- package/dist/vega/p-8f8de5ab.entry.js +0 -1
- package/dist/vega/p-997a2064.entry.js +0 -1
- package/dist/vega/p-9a956a00.js +0 -1
- package/dist/vega/p-9d6003ef.js +0 -1
- package/dist/vega/p-a04491cc.entry.js +0 -1
- package/dist/vega/p-a1056063.entry.js +0 -1
- package/dist/vega/p-a7042a5a.entry.js +0 -1
- package/dist/vega/p-acf7667e.entry.js +0 -1
- package/dist/vega/p-b21b128c.entry.js +0 -1
- package/dist/vega/p-b75a8edb.entry.js +0 -1
- package/dist/vega/p-c21295cf.entry.js +0 -1
- package/dist/vega/p-ce5a3589.entry.js +0 -1
- package/dist/vega/p-d1355307.js +0 -1
- package/dist/vega/p-d1cb7f28.js +0 -1
- package/dist/vega/p-d661a5aa.entry.js +0 -1
- package/dist/vega/p-d7e0c57a.js +0 -1
- package/dist/vega/p-e1ed78db.js +0 -1
- package/dist/vega/p-e7b00bf0.js +0 -1
- package/dist/vega/p-ef84dc90.entry.js +0 -1
- package/dist/vega/p-f229d6d1.js +0 -1
- package/dist/vega/p-f27fcc7c.entry.js +0 -1
- package/dist/vega/p-f543e911.entry.js +0 -1
- package/dist/vega/p-f5ac60f5.js +0 -1
- package/dist/vega/p-f7b5833d.entry.js +0 -1
- package/dist/vega/p-fc02a67a.js +0 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const typeGuard = require('./type-guard-aa8fdeaf.js');
|
|
4
3
|
const changeManager = require('./change-manager-a297e4d2.js');
|
|
5
|
-
const domNodeSubjectFactory = require('./dom-node-subject-factory-
|
|
6
|
-
const vegaInternalEventId = require('./vega-internal-event-id-
|
|
4
|
+
const domNodeSubjectFactory = require('./dom-node-subject-factory-bad99695.js');
|
|
5
|
+
const vegaInternalEventId = require('./vega-internal-event-id-ae6e2c13.js');
|
|
6
|
+
const string = require('./string-39438062.js');
|
|
7
7
|
const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
|
|
8
|
+
const typeGuard = require('./type-guard-aa8fdeaf.js');
|
|
8
9
|
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-e2e274e1.js');
|
|
9
|
-
const darkModeStyleController = require('./dark-mode-style-controller-
|
|
10
|
+
const darkModeStyleController = require('./dark-mode-style-controller-ab0703e1.js');
|
|
11
|
+
const object = require('./object-e2e28e3d.js');
|
|
12
|
+
const ui = require('./ui-4ce1fa08.js');
|
|
10
13
|
|
|
11
14
|
exports.InternalAnnotationTypeEnum = void 0;
|
|
12
15
|
(function (InternalAnnotationTypeEnum) {
|
|
@@ -25,6 +28,8 @@ exports.BlockAnnotationTypeEnum = void 0;
|
|
|
25
28
|
BlockAnnotationTypeEnum["ALIGNMENT"] = "ALIGNMENT";
|
|
26
29
|
BlockAnnotationTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
|
|
27
30
|
BlockAnnotationTypeEnum["INDENT"] = "INDENT";
|
|
31
|
+
BlockAnnotationTypeEnum["LIST"] = "LIST";
|
|
32
|
+
BlockAnnotationTypeEnum["INTERNAL_WRAPPER"] = "INTERNAL_WRAPPER";
|
|
28
33
|
})(exports.BlockAnnotationTypeEnum || (exports.BlockAnnotationTypeEnum = {}));
|
|
29
34
|
/**
|
|
30
35
|
* BlockAnnotation is an abstract class that represents a block annotation.
|
|
@@ -39,16 +44,23 @@ class StateEntityRenderingRegistry {
|
|
|
39
44
|
constructor() {
|
|
40
45
|
this.domToEntity = new WeakMap();
|
|
41
46
|
this.entityToDOM = new WeakMap();
|
|
47
|
+
this.contentEntityToRootDom = new Map();
|
|
48
|
+
this.rootDomToContentEntity = new WeakMap();
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
51
|
* Registers a DOM element and its corresponding entity.
|
|
45
52
|
*
|
|
46
53
|
* @param {HTMLElement} dom The DOM element to register.
|
|
47
|
-
* @param {RTEBlock | RTENode} entity The entity to register.
|
|
54
|
+
* @param {RTEBlock | RTENode | VegaRTEContent} entity The entity to register.
|
|
48
55
|
*/
|
|
49
56
|
register(dom, entity) {
|
|
50
|
-
this.
|
|
51
|
-
|
|
57
|
+
if (!this.isVegaRTEContent(entity)) {
|
|
58
|
+
this.domToEntity.set(dom, entity);
|
|
59
|
+
this.entityToDOM.set(entity, dom);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.registerRootDomAndContentEntity(dom, entity);
|
|
63
|
+
}
|
|
52
64
|
}
|
|
53
65
|
/**
|
|
54
66
|
* Retrieves the entity corresponding to a DOM element.
|
|
@@ -66,7 +78,12 @@ class StateEntityRenderingRegistry {
|
|
|
66
78
|
* @returns {Nullable<HTMLElement>} The DOM element corresponding to the entity, or null if not found.
|
|
67
79
|
*/
|
|
68
80
|
getDOMByEntity(entity) {
|
|
69
|
-
|
|
81
|
+
if (!this.isVegaRTEContent(entity)) {
|
|
82
|
+
return this.entityToDOM.get(entity);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
return this.contentEntityToRootDom.get(entity);
|
|
86
|
+
}
|
|
70
87
|
}
|
|
71
88
|
/**
|
|
72
89
|
* Delete the dirty element to entity ref.
|
|
@@ -77,25 +94,46 @@ class StateEntityRenderingRegistry {
|
|
|
77
94
|
removeDirtyDomRef(dom) {
|
|
78
95
|
this.domToEntity.delete(dom);
|
|
79
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Bind the root dom ref and content entity.
|
|
99
|
+
*
|
|
100
|
+
* @param {HTMLElement} dom - The vega rich text editor ref.
|
|
101
|
+
* @param {VegaRTEContent} contentEntity - The rich text editor value content.
|
|
102
|
+
*/
|
|
103
|
+
registerRootDomAndContentEntity(dom, contentEntity) {
|
|
104
|
+
const oldContent = this.rootDomToContentEntity.get(dom);
|
|
105
|
+
if (oldContent && oldContent !== contentEntity) {
|
|
106
|
+
this.contentEntityToRootDom.delete(oldContent);
|
|
107
|
+
}
|
|
108
|
+
this.rootDomToContentEntity.set(dom, contentEntity);
|
|
109
|
+
this.contentEntityToRootDom.set(contentEntity, dom);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check the entity is VegaRTEContent instance.
|
|
113
|
+
*
|
|
114
|
+
* @param {VegaRTEContent | RTEBlock | RTENode} entity - The entity to check.
|
|
115
|
+
* @returns {entity is VegaRTEContent} - True if the entity is a VegaRTEContent instance, false otherwise.
|
|
116
|
+
*/
|
|
117
|
+
isVegaRTEContent(entity) {
|
|
118
|
+
return entity && entity.constructor.name === 'VegaRTEContent';
|
|
119
|
+
}
|
|
80
120
|
}
|
|
81
121
|
const stateEntityRenderingRegistry = new StateEntityRenderingRegistry();
|
|
82
122
|
|
|
83
123
|
exports.ModifyContentActionType = void 0;
|
|
84
124
|
(function (ModifyContentActionType) {
|
|
85
|
-
ModifyContentActionType["
|
|
125
|
+
ModifyContentActionType["DELETE_CHILDREN"] = "DELETE_CHILDREN";
|
|
86
126
|
ModifyContentActionType["DELETE_NEST_LIST"] = "DELETE_NEST_LIST";
|
|
87
127
|
ModifyContentActionType["UPDATE_TEXT"] = "UPDATE_TEXT";
|
|
88
128
|
ModifyContentActionType["REPLACE_SELECTED_TEXT"] = "REPLACE_SELECTED_TEXT";
|
|
89
|
-
ModifyContentActionType["
|
|
90
|
-
ModifyContentActionType["
|
|
91
|
-
ModifyContentActionType["
|
|
92
|
-
ModifyContentActionType["INSERT_NODES_AFTER"] = "INSERT_NODES_AFTER";
|
|
93
|
-
ModifyContentActionType["INSERT_NODES_BEFORE"] = "INSERT_NODES_BEFORE";
|
|
129
|
+
ModifyContentActionType["APPEND_CHILDREN"] = "APPEND_CHILDREN";
|
|
130
|
+
ModifyContentActionType["INSERT_CHILDREN_AFTER"] = "INSERT_CHILDREN_AFTER";
|
|
131
|
+
ModifyContentActionType["INSERT_CHILDREN_BEFORE"] = "INSERT_CHILDREN_BEFORE";
|
|
94
132
|
ModifyContentActionType["SPLIT_BLOCK_WITH_NODE"] = "SPLIT_BLOCK_WITH_NODE";
|
|
95
133
|
ModifyContentActionType["REPLACE_CHILD_NODES"] = "REPLACE_CHILD_NODES";
|
|
96
134
|
ModifyContentActionType["REPLACE_NEST_LIST"] = "REPLACE_NEST_LIST";
|
|
97
135
|
ModifyContentActionType["MERGE_TWO_BLOCKS_NODES"] = "MERGE_TWO_BLOCKS_NODES";
|
|
98
|
-
ModifyContentActionType["
|
|
136
|
+
ModifyContentActionType["INSERT_NEW_PARAGRAPH"] = "INSERT_NEW_PARAGRAPH";
|
|
99
137
|
ModifyContentActionType["LINE_BREAK_SINGLE_BLOCK"] = "LINE_BREAK_SINGLE_BLOCK";
|
|
100
138
|
ModifyContentActionType["LINE_BREAK_MULTIPLE_BLOCKS"] = "LINE_BREAK_MULTIPLE_BLOCKS";
|
|
101
139
|
ModifyContentActionType["TRANSFORM_LIST_BLOCK"] = "TRANSFORM_LIST_BLOCK";
|
|
@@ -107,6 +145,11 @@ exports.ModifyContentActionType = void 0;
|
|
|
107
145
|
ModifyContentActionType["UPDATE_CODE_BLOCK"] = "UPDATE_CODE_BLOCK";
|
|
108
146
|
ModifyContentActionType["SWITCH_OUT_FROM_CODE_BLOCK"] = "SWITCH_OUT_FROM_CODE_BLOCK";
|
|
109
147
|
ModifyContentActionType["DELETE_CODE_BLOCK"] = "DELETE_CODE_BLOCK";
|
|
148
|
+
ModifyContentActionType["UNLINK_LINK_GROUP"] = "UNLINK_LINK_GROUP";
|
|
149
|
+
ModifyContentActionType["LINK_GROUP_NODE_SPLIT"] = "LINK_GROUP_NODE_SPLIT";
|
|
150
|
+
ModifyContentActionType["DELETE_LINK_GROUP"] = "DELETE_LINK_GROUP";
|
|
151
|
+
ModifyContentActionType["UPDATE_CURSOR_POSITION"] = "UPDATE_CURSOR_POSITION";
|
|
152
|
+
ModifyContentActionType["INSERT_TEXT_TO_DECORATOR_NODE"] = "INSERT_TEXT_TO_DECORATOR_NODE";
|
|
110
153
|
})(exports.ModifyContentActionType || (exports.ModifyContentActionType = {}));
|
|
111
154
|
/**
|
|
112
155
|
* Abstract class for update node content, delete node, insert node
|
|
@@ -117,6 +160,116 @@ class ModifyContentAction {
|
|
|
117
160
|
}
|
|
118
161
|
}
|
|
119
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Annotation to represent a link of grouped nodes
|
|
165
|
+
*/
|
|
166
|
+
class LinkGroupAnnotation extends Annotation {
|
|
167
|
+
constructor(groupKey) {
|
|
168
|
+
super();
|
|
169
|
+
this.type = exports.InternalAnnotationTypeEnum.LINK_GROUP;
|
|
170
|
+
this.linkGroups = new Map();
|
|
171
|
+
this.linkGroups = new Map([[groupKey, []]]);
|
|
172
|
+
}
|
|
173
|
+
clone() {
|
|
174
|
+
const clonedAnnotation = new LinkGroupAnnotation('');
|
|
175
|
+
this.linkGroups.forEach((nodes, key) => {
|
|
176
|
+
clonedAnnotation.linkGroups.set(key, nodes.map((node) => node.clone()));
|
|
177
|
+
});
|
|
178
|
+
return clonedAnnotation;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Convert the custom style, class and attribute to string which html can used
|
|
182
|
+
*
|
|
183
|
+
* @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
|
|
184
|
+
* @param {RTERenderContext} options - options.
|
|
185
|
+
* @returns {string} - string.
|
|
186
|
+
*/
|
|
187
|
+
toString(linkAnnotation, options) {
|
|
188
|
+
const attributes = this.toJsx(linkAnnotation, options);
|
|
189
|
+
return Object.entries(attributes)
|
|
190
|
+
.map(([key, value]) => {
|
|
191
|
+
const valueString = typeof value === 'string' ? value : this.formatStyleToString(value);
|
|
192
|
+
return `${string.camelToDashCase(key)}="${valueString}"`;
|
|
193
|
+
})
|
|
194
|
+
.join(' ');
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Convert the custom style, class and attribute to JSX attributes
|
|
198
|
+
*
|
|
199
|
+
* @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
|
|
200
|
+
* @param {RTERenderContext} options - options.
|
|
201
|
+
* @returns {Record<string, string | AnnotationStyle>} JSX used attributes.
|
|
202
|
+
*/
|
|
203
|
+
toJsx(linkAnnotation, options) {
|
|
204
|
+
const linkStyle = this.getStyle(linkAnnotation, options);
|
|
205
|
+
const linkClass = this.getClass(linkAnnotation, options);
|
|
206
|
+
const attributes = this.getAttribute(linkAnnotation, options);
|
|
207
|
+
if (linkClass.length > 0) {
|
|
208
|
+
attributes.class = linkClass.join(' ');
|
|
209
|
+
}
|
|
210
|
+
if (linkStyle && Object.keys(linkStyle).length > 0) {
|
|
211
|
+
attributes.style = linkStyle;
|
|
212
|
+
}
|
|
213
|
+
return attributes;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get the custom class for the annotation
|
|
217
|
+
*
|
|
218
|
+
* @param {linkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
|
|
219
|
+
* @param {RTERenderContext} options - options.
|
|
220
|
+
* @returns {string[]} Link class
|
|
221
|
+
*/
|
|
222
|
+
getClass(linkAnnotation, options) {
|
|
223
|
+
const linkClass = [];
|
|
224
|
+
if (linkAnnotation.link.customClass)
|
|
225
|
+
linkClass.push(...linkAnnotation.link.customClass);
|
|
226
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone) && linkAnnotation.useInternalStyle)
|
|
227
|
+
linkClass.push('v-rte--link');
|
|
228
|
+
return linkClass;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get the custom style for the annotation
|
|
232
|
+
*
|
|
233
|
+
* @param {LinkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
|
|
234
|
+
* @param {RTERenderContext} options - options.
|
|
235
|
+
* @returns {AnnotationStyle} Link style
|
|
236
|
+
*/
|
|
237
|
+
getStyle(linkAnnotation, options) {
|
|
238
|
+
const linkStyle = {};
|
|
239
|
+
if (linkAnnotation.link.customStyle)
|
|
240
|
+
Object.assign(linkStyle, linkAnnotation.link.customStyle);
|
|
241
|
+
if ((options === null || options === void 0 ? void 0 : options.standalone) && linkAnnotation.useInternalStyle) {
|
|
242
|
+
linkStyle.color = 'rgba(var(--v-text-link, 19, 98, 226, 1))';
|
|
243
|
+
}
|
|
244
|
+
return linkStyle;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get the custom attribute for the annotation
|
|
248
|
+
*
|
|
249
|
+
* @param {LinkAnnotation} linkAnnotation current link annotation which saved custom style, class and attribute.
|
|
250
|
+
* @param {RTERenderContext} options - Render context options.
|
|
251
|
+
* @returns {Record<string, string>} Link attributes
|
|
252
|
+
*/
|
|
253
|
+
getAttribute(linkAnnotation, options) {
|
|
254
|
+
var _a;
|
|
255
|
+
const { href, customAttribute = {} } = linkAnnotation.link;
|
|
256
|
+
const autoMatchFormat = (_a = options === null || options === void 0 ? void 0 : options.autoMatchFormat) !== null && _a !== void 0 ? _a : true;
|
|
257
|
+
const target = customAttribute.target || (autoMatchFormat ? '_blank' : '');
|
|
258
|
+
return Object.assign(Object.assign(Object.assign({}, customAttribute), (href ? { href } : autoMatchFormat ? { href } : {})), (target ? { target } : {}));
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Convert style to string which can be used to html string.
|
|
262
|
+
*
|
|
263
|
+
* @param {AnnotationStyle} style Style object.
|
|
264
|
+
* @returns {string} Style string
|
|
265
|
+
*/
|
|
266
|
+
formatStyleToString(style) {
|
|
267
|
+
return Object.entries(style)
|
|
268
|
+
.map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
|
|
269
|
+
.join(' ');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
120
273
|
/**
|
|
121
274
|
* Annotation to make block with horizontal alignment
|
|
122
275
|
*/
|
|
@@ -146,12 +299,20 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
|
|
|
146
299
|
};
|
|
147
300
|
}
|
|
148
301
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* @returns {string} - Annotation class
|
|
302
|
+
* @inheritDoc
|
|
152
303
|
*/
|
|
153
|
-
renderClass() {
|
|
154
|
-
|
|
304
|
+
renderClass(options) {
|
|
305
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
306
|
+
return null;
|
|
307
|
+
switch (this.textAlign) {
|
|
308
|
+
case 'right':
|
|
309
|
+
case 'center':
|
|
310
|
+
case 'justify':
|
|
311
|
+
return `v-rte--horizontal-alignment-${this.textAlign}`;
|
|
312
|
+
case 'left':
|
|
313
|
+
default:
|
|
314
|
+
return `v-rte--horizontal-alignment-left`;
|
|
315
|
+
}
|
|
155
316
|
}
|
|
156
317
|
/**
|
|
157
318
|
* @inheritDoc
|
|
@@ -160,12 +321,20 @@ class HorizontalAlignmentAnnotation extends BlockAnnotation {
|
|
|
160
321
|
return new HorizontalAlignmentAnnotation(this.textAlign);
|
|
161
322
|
}
|
|
162
323
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
324
|
+
* @inheritDoc
|
|
166
325
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
326
|
+
renderStyle(options) {
|
|
327
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
328
|
+
return null;
|
|
329
|
+
switch (this.textAlign) {
|
|
330
|
+
case 'right':
|
|
331
|
+
case 'center':
|
|
332
|
+
case 'justify':
|
|
333
|
+
return { textAlign: this.textAlign };
|
|
334
|
+
case 'left':
|
|
335
|
+
default:
|
|
336
|
+
return { textAlign: 'left' };
|
|
337
|
+
}
|
|
169
338
|
}
|
|
170
339
|
}
|
|
171
340
|
|
|
@@ -201,13 +370,19 @@ class IndentAnnotation extends BlockAnnotation {
|
|
|
201
370
|
clone() {
|
|
202
371
|
return new IndentAnnotation(this.indent);
|
|
203
372
|
}
|
|
373
|
+
/**
|
|
374
|
+
* @inheritDoc
|
|
375
|
+
*/
|
|
376
|
+
renderClass() {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
204
379
|
/**
|
|
205
380
|
* Generate the style for the annotation
|
|
206
381
|
*
|
|
207
382
|
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
208
383
|
*/
|
|
209
|
-
|
|
210
|
-
return this.indent > 0 ? {
|
|
384
|
+
renderStyle() {
|
|
385
|
+
return this.indent > 0 ? { marginLeft: `${this.indent * 16}px` } : null;
|
|
211
386
|
}
|
|
212
387
|
}
|
|
213
388
|
|
|
@@ -266,6 +441,259 @@ class ActionHandleStrategyRegistry {
|
|
|
266
441
|
}
|
|
267
442
|
ActionHandleStrategyRegistry.registry = new Map();
|
|
268
443
|
|
|
444
|
+
exports.CommonAnnotationTypeEnum = void 0;
|
|
445
|
+
(function (CommonAnnotationTypeEnum) {
|
|
446
|
+
CommonAnnotationTypeEnum["CUSTOM_ATTRIBUTE"] = "CUSTOM_ATTRIBUTE";
|
|
447
|
+
CommonAnnotationTypeEnum["CUSTOM_CLASS"] = "CUSTOM_CLASS";
|
|
448
|
+
CommonAnnotationTypeEnum["CUSTOM_STYLE"] = "CUSTOM_STYLE";
|
|
449
|
+
})(exports.CommonAnnotationTypeEnum || (exports.CommonAnnotationTypeEnum = {}));
|
|
450
|
+
/**
|
|
451
|
+
* CommonAnnotation is an abstract class that represents common annotation for block and node.
|
|
452
|
+
*/
|
|
453
|
+
class CommonAnnotation extends Annotation {
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Annotation to add custom attributes of element
|
|
458
|
+
*/
|
|
459
|
+
class CustomAttributeAnnotation extends CommonAnnotation {
|
|
460
|
+
constructor(customAttribute) {
|
|
461
|
+
super();
|
|
462
|
+
this.type = exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE;
|
|
463
|
+
this.BOOLEAN_ATTRS = new Set([
|
|
464
|
+
'controls',
|
|
465
|
+
'disabled',
|
|
466
|
+
'checked',
|
|
467
|
+
'readonly',
|
|
468
|
+
'multiple',
|
|
469
|
+
'required',
|
|
470
|
+
'autoplay',
|
|
471
|
+
'muted',
|
|
472
|
+
]);
|
|
473
|
+
this.customAttribute = customAttribute;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Generate the map item for the annotation
|
|
477
|
+
*
|
|
478
|
+
* @param {Record<string, string>} customizeAttribute - custom attribute annotation
|
|
479
|
+
* @returns {[CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE, CustomAttributeAnnotation]} Map item for the annotation
|
|
480
|
+
*/
|
|
481
|
+
static from(customizeAttribute) {
|
|
482
|
+
return [exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE, new CustomAttributeAnnotation(customizeAttribute)];
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Generate the JSON representation of the annotation
|
|
486
|
+
*
|
|
487
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
488
|
+
*/
|
|
489
|
+
toJSON() {
|
|
490
|
+
return {
|
|
491
|
+
customAttribute: this.customAttribute,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Create a new custom attribute annotation
|
|
496
|
+
*
|
|
497
|
+
* @returns {CustomAttributeAnnotation} - Custom attribute annotation
|
|
498
|
+
*/
|
|
499
|
+
clone() {
|
|
500
|
+
return new CustomAttributeAnnotation(this.customAttribute);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Generate the custom attribute of current element, excluding 'style' and 'class'
|
|
504
|
+
*
|
|
505
|
+
* @param {string[]} filterAttr - should filter these existed attrs
|
|
506
|
+
* @returns {string[]} - Custom attributes
|
|
507
|
+
*/
|
|
508
|
+
toString(filterAttr = []) {
|
|
509
|
+
const filterAttrKeys = filterAttr.map((attr) => attr.split('=')[0]);
|
|
510
|
+
return Object.keys(this.customAttribute)
|
|
511
|
+
.map((key) => {
|
|
512
|
+
return !filterAttrKeys.includes(key) ? `${key}="${this.customAttribute[key]}"` : null;
|
|
513
|
+
})
|
|
514
|
+
.filter(typeGuard.isNonNullable);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Generate the custom attribute for the annotation
|
|
518
|
+
*
|
|
519
|
+
* @param {RTERenderCustomAttributes} options - should filter these certain attrs
|
|
520
|
+
* @returns {Record<string, string>} custom attribute
|
|
521
|
+
*/
|
|
522
|
+
render(options = {}) {
|
|
523
|
+
var _a;
|
|
524
|
+
const customAttribute = Object.assign({}, this.customAttribute);
|
|
525
|
+
(_a = options.filterAttributes) === null || _a === void 0 ? void 0 : _a.forEach((attr) => delete customAttribute[attr]);
|
|
526
|
+
Object.keys(customAttribute).forEach((key) => {
|
|
527
|
+
if (this.BOOLEAN_ATTRS.has(key) && customAttribute[key] === '') {
|
|
528
|
+
customAttribute[key] = 'true';
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
return customAttribute;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Annotation to add custom class of element
|
|
537
|
+
*/
|
|
538
|
+
class CustomClassAnnotation extends CommonAnnotation {
|
|
539
|
+
constructor(customClass) {
|
|
540
|
+
super();
|
|
541
|
+
this.type = exports.CommonAnnotationTypeEnum.CUSTOM_CLASS;
|
|
542
|
+
this.customClass = customClass;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Generate the map item for the annotation
|
|
546
|
+
*
|
|
547
|
+
* @param {string[]} customClass - custom class annotation
|
|
548
|
+
* @returns {[CommonAnnotationTypeEnum.CUSTOM_CLASS, CustomClassAnnotation]} Map item for the annotation
|
|
549
|
+
*/
|
|
550
|
+
static from(customClass) {
|
|
551
|
+
return [exports.CommonAnnotationTypeEnum.CUSTOM_CLASS, new CustomClassAnnotation(customClass)];
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Generate the JSON representation of the annotation
|
|
555
|
+
*
|
|
556
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
557
|
+
*/
|
|
558
|
+
toJSON() {
|
|
559
|
+
return {
|
|
560
|
+
customClass: this.customClass,
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Create a new custom class annotation
|
|
565
|
+
*
|
|
566
|
+
* @returns {CustomClassAnnotation} - Custom class annotation
|
|
567
|
+
*/
|
|
568
|
+
clone() {
|
|
569
|
+
return new CustomClassAnnotation(this.customClass);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Generate the custom class of current element
|
|
573
|
+
*
|
|
574
|
+
* @returns {string} - Custom class
|
|
575
|
+
*/
|
|
576
|
+
toString() {
|
|
577
|
+
return `class="${this.customClass.join(' ')}"`;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Generate the custom attribute for the annotation
|
|
581
|
+
*
|
|
582
|
+
* @returns {string[]} custom classes
|
|
583
|
+
*/
|
|
584
|
+
renderClass() {
|
|
585
|
+
return this.customClass;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Annotation to add custom attributes of element
|
|
591
|
+
*/
|
|
592
|
+
class CustomStyleAnnotation extends CommonAnnotation {
|
|
593
|
+
constructor(customStyle) {
|
|
594
|
+
super();
|
|
595
|
+
this.type = exports.CommonAnnotationTypeEnum.CUSTOM_STYLE;
|
|
596
|
+
this.customStyle = customStyle;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Generate the map item for the annotation
|
|
600
|
+
*
|
|
601
|
+
* @param {AnnotationStyle} customStyle - custom attribute annotation
|
|
602
|
+
* @returns {[CommonAnnotationTypeEnum.CUSTOM_STYLE, CustomStyleAnnotation]} Map item for the annotation
|
|
603
|
+
*/
|
|
604
|
+
static from(customStyle) {
|
|
605
|
+
return [exports.CommonAnnotationTypeEnum.CUSTOM_STYLE, new CustomStyleAnnotation(customStyle)];
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Generate the JSON representation of the annotation
|
|
609
|
+
*
|
|
610
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
611
|
+
*/
|
|
612
|
+
toJSON() {
|
|
613
|
+
return {
|
|
614
|
+
customStyle: this.customStyle,
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Create a new custom attribute annotation
|
|
619
|
+
*
|
|
620
|
+
* @returns {CustomStyleAnnotation} - Custom attribute annotation
|
|
621
|
+
*/
|
|
622
|
+
clone() {
|
|
623
|
+
return new CustomStyleAnnotation(this.customStyle);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Generate the custom attribute for the annotation
|
|
627
|
+
*
|
|
628
|
+
* @returns {AnnotationStyle} custom attribute
|
|
629
|
+
*/
|
|
630
|
+
renderStyle() {
|
|
631
|
+
return this.customStyle;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Remove the style
|
|
635
|
+
*
|
|
636
|
+
* @param {string[]} styleKeys - custom attribute annotation
|
|
637
|
+
* @returns {AnnotationStyle} Map item for the annotation
|
|
638
|
+
*/
|
|
639
|
+
removeStyles(styleKeys) {
|
|
640
|
+
const customStyle = Object.assign({}, this.customStyle);
|
|
641
|
+
styleKeys.forEach((item) => delete customStyle[item]);
|
|
642
|
+
return customStyle;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Generate the custom style string for the annotation
|
|
646
|
+
*
|
|
647
|
+
* @returns {string} custom style string
|
|
648
|
+
*/
|
|
649
|
+
toString() {
|
|
650
|
+
return `style="${Object.entries(this.customStyle)
|
|
651
|
+
.map(([key, value]) => `${key}: ${value};`)
|
|
652
|
+
.join(' ')}"`;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Internal wrapper annotation for block node.
|
|
658
|
+
*/
|
|
659
|
+
class InternalWrapperAnnotation extends BlockAnnotation {
|
|
660
|
+
constructor(internalWrapper) {
|
|
661
|
+
super();
|
|
662
|
+
this.type = exports.BlockAnnotationTypeEnum.INTERNAL_WRAPPER;
|
|
663
|
+
this.internalWrapper = internalWrapper;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* @inheritDoc
|
|
667
|
+
*/
|
|
668
|
+
static from(internalWrapper) {
|
|
669
|
+
return [exports.BlockAnnotationTypeEnum.INTERNAL_WRAPPER, new InternalWrapperAnnotation(internalWrapper)];
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* @inheritDoc
|
|
673
|
+
*/
|
|
674
|
+
clone() {
|
|
675
|
+
return new InternalWrapperAnnotation(this.internalWrapper);
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* @inheritDoc
|
|
679
|
+
*/
|
|
680
|
+
renderClass() {
|
|
681
|
+
return undefined;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* @inheritDoc
|
|
685
|
+
*/
|
|
686
|
+
renderStyle() {
|
|
687
|
+
return undefined;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* @inheritDoc
|
|
691
|
+
*/
|
|
692
|
+
toJSON() {
|
|
693
|
+
return this.internalWrapper ? { internalWrapper: this.internalWrapper } : undefined;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
269
697
|
/**
|
|
270
698
|
* Abstract class for block
|
|
271
699
|
*/
|
|
@@ -274,6 +702,15 @@ class RTEBlock {
|
|
|
274
702
|
this.annotationMap = new Map();
|
|
275
703
|
this.id = id;
|
|
276
704
|
}
|
|
705
|
+
/**
|
|
706
|
+
* Creates a new instance of the block from the given JSON object.
|
|
707
|
+
*
|
|
708
|
+
* @param {unknown} json - The JSON object to create the block from.
|
|
709
|
+
* @param {VegaRTETransformOptions} options - Options for transforming the block.
|
|
710
|
+
*/
|
|
711
|
+
static from(json, options) {
|
|
712
|
+
throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${options}) is not implemented. Please implement this method in the subclass.`);
|
|
713
|
+
}
|
|
277
714
|
/**
|
|
278
715
|
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
279
716
|
* and value.
|
|
@@ -283,7 +720,7 @@ class RTEBlock {
|
|
|
283
720
|
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
284
721
|
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
285
722
|
* annotation being created.
|
|
286
|
-
* @returns {Nullable<
|
|
723
|
+
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
287
724
|
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
288
725
|
*/
|
|
289
726
|
static createAnnotationEntity(type, value) {
|
|
@@ -292,6 +729,44 @@ class RTEBlock {
|
|
|
292
729
|
return HorizontalAlignmentAnnotation.from(value);
|
|
293
730
|
case 'indent':
|
|
294
731
|
return IndentAnnotation.from(value);
|
|
732
|
+
case 'customAttribute':
|
|
733
|
+
return CustomAttributeAnnotation.from(value);
|
|
734
|
+
case 'customClass':
|
|
735
|
+
return CustomClassAnnotation.from(value);
|
|
736
|
+
case 'customStyle':
|
|
737
|
+
return CustomStyleAnnotation.from(value);
|
|
738
|
+
case 'internalWrapper':
|
|
739
|
+
return InternalWrapperAnnotation.from(value);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Converts annotations to an array of block annotation entities.
|
|
744
|
+
*
|
|
745
|
+
* @param {BlockAnnotations} annotationMap - The map to store the converted annotations.
|
|
746
|
+
* @param {VegaRTEBlockAnnotations} annotations - The annotations to convert.
|
|
747
|
+
*/
|
|
748
|
+
static convertAnnotationsToMap(annotationMap, annotations) {
|
|
749
|
+
Object.entries(annotations).forEach(([type, value]) => {
|
|
750
|
+
const item = this.createAnnotationEntity(type, value);
|
|
751
|
+
if (typeGuard.isNonNullable(item)) {
|
|
752
|
+
annotationMap.set(...item);
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Check if the block should be rendered as a wrapper.
|
|
758
|
+
*
|
|
759
|
+
* @returns {boolean} - Returns true if the block is an internal wrapper.
|
|
760
|
+
*/
|
|
761
|
+
shouldRenderAsInternalWrapper() {
|
|
762
|
+
const internalWrapperAnnotation = this.getAnnotationByType(exports.BlockAnnotationTypeEnum.INTERNAL_WRAPPER);
|
|
763
|
+
if (internalWrapperAnnotation) {
|
|
764
|
+
return (internalWrapperAnnotation.internalWrapper &&
|
|
765
|
+
Array.from(this.annotationMap.values()).filter((annotation) => !(annotation instanceof LinkGroupAnnotation) &&
|
|
766
|
+
!(annotation instanceof InternalWrapperAnnotation)).length === 0);
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
return false;
|
|
295
770
|
}
|
|
296
771
|
}
|
|
297
772
|
/**
|
|
@@ -301,7 +776,7 @@ class RTEBlock {
|
|
|
301
776
|
*/
|
|
302
777
|
toJSON() {
|
|
303
778
|
const annotations = Array.from(this.annotationMap.values())
|
|
304
|
-
.filter((annotation) => annotation instanceof BlockAnnotation)
|
|
779
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CommonAnnotation)
|
|
305
780
|
.reduce((record, annotation) => {
|
|
306
781
|
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
307
782
|
}, {});
|
|
@@ -342,6 +817,61 @@ class RTEBlock {
|
|
|
342
817
|
isListItemBlock() {
|
|
343
818
|
return this.type === 'list-item';
|
|
344
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* Get styles from annotations
|
|
822
|
+
*
|
|
823
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
|
|
824
|
+
* @returns {AnnotationStyle} - Annotation styles
|
|
825
|
+
*/
|
|
826
|
+
getStyles(options = { standalone: false }) {
|
|
827
|
+
return Object.assign(Object.assign({}, Array.from(this.annotationMap.values())
|
|
828
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomStyleAnnotation)
|
|
829
|
+
.map((annotation) => annotation.renderStyle(options))
|
|
830
|
+
.filter(typeGuard.isNonNullable)
|
|
831
|
+
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {})), (this.shouldRenderAsInternalWrapper() ? { display: 'contents' } : {}));
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Get classes from annotations
|
|
835
|
+
*
|
|
836
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control standalone mode
|
|
837
|
+
* @returns {string} - Annotation style
|
|
838
|
+
*/
|
|
839
|
+
getClasses(options = { standalone: false }) {
|
|
840
|
+
return Array.from(this.annotationMap.values())
|
|
841
|
+
.filter((annotation) => annotation instanceof BlockAnnotation || annotation instanceof CustomClassAnnotation)
|
|
842
|
+
.map((annotation) => annotation.renderClass(options))
|
|
843
|
+
.filter(typeGuard.isNonNullable)
|
|
844
|
+
.reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Get custom attribute annotation, excluding "class" and "style"
|
|
848
|
+
*
|
|
849
|
+
* @returns {Nullable<CustomAttributeAnnotation>} - custom attribute annotation
|
|
850
|
+
*/
|
|
851
|
+
getCustomAttributesAnnotation() {
|
|
852
|
+
return this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Generate attributes as string
|
|
856
|
+
*
|
|
857
|
+
* @param {...string} attrs - Additional attributes to include
|
|
858
|
+
* @returns {string} - Attributes as string
|
|
859
|
+
*/
|
|
860
|
+
generateAttributeString(...attrs) {
|
|
861
|
+
var _a;
|
|
862
|
+
const styles = Object.entries(Object.assign({}, this.getStyles({ standalone: true })))
|
|
863
|
+
.map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
|
|
864
|
+
.join('');
|
|
865
|
+
const customClassAnnotation = this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_CLASS);
|
|
866
|
+
const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
|
|
867
|
+
const attributes = [
|
|
868
|
+
...customAttributeString,
|
|
869
|
+
customClassAnnotation === null || customClassAnnotation === void 0 ? void 0 : customClassAnnotation.toString(),
|
|
870
|
+
styles ? `style="${styles}"` : null,
|
|
871
|
+
...attrs,
|
|
872
|
+
].filter(typeGuard.isNonNullable);
|
|
873
|
+
return attributes.length ? ` ${attributes.join(' ')}` : '';
|
|
874
|
+
}
|
|
345
875
|
/**
|
|
346
876
|
* Apply action to block
|
|
347
877
|
*
|
|
@@ -362,7 +892,9 @@ class RTEBlock {
|
|
|
362
892
|
*/
|
|
363
893
|
applyAnnotationAction(action) {
|
|
364
894
|
const annotation = action.toAnnotation();
|
|
365
|
-
|
|
895
|
+
if (!(annotation instanceof LinkGroupAnnotation)) {
|
|
896
|
+
this.annotationMap.set(annotation.type, annotation);
|
|
897
|
+
}
|
|
366
898
|
typeof this.doAnnotationActionApply === 'function' && this.doAnnotationActionApply(action);
|
|
367
899
|
}
|
|
368
900
|
/**
|
|
@@ -375,12 +907,32 @@ class RTEBlock {
|
|
|
375
907
|
}
|
|
376
908
|
}
|
|
377
909
|
|
|
378
|
-
|
|
379
|
-
(function (
|
|
380
|
-
|
|
910
|
+
exports.NodeAnnotationTypeEnum = void 0;
|
|
911
|
+
(function (NodeAnnotationTypeEnum) {
|
|
912
|
+
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
913
|
+
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
914
|
+
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
915
|
+
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
916
|
+
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
917
|
+
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
918
|
+
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
919
|
+
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
920
|
+
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
921
|
+
NodeAnnotationTypeEnum["INLINE_HTML"] = "INLINE_HTML";
|
|
922
|
+
NodeAnnotationTypeEnum["PLAIN_TEXT"] = "PLAIN_TEXT";
|
|
923
|
+
})(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
|
|
924
|
+
/**
|
|
925
|
+
* Abstract class for all annotations
|
|
926
|
+
*/
|
|
927
|
+
class NodeAnnotation extends Annotation {
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
exports.NodeTypeEnum = void 0;
|
|
931
|
+
(function (NodeTypeEnum) {
|
|
932
|
+
NodeTypeEnum["TEXT"] = "TEXT";
|
|
381
933
|
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
382
934
|
NodeTypeEnum["CODE_BLOCK_NODE"] = "CODE_BLOCK_NODE";
|
|
383
|
-
})(NodeTypeEnum || (NodeTypeEnum = {}));
|
|
935
|
+
})(exports.NodeTypeEnum || (exports.NodeTypeEnum = {}));
|
|
384
936
|
/**
|
|
385
937
|
* Abstract class for all nodes
|
|
386
938
|
*/
|
|
@@ -392,6 +944,34 @@ class RTENode {
|
|
|
392
944
|
this.annotationMap = annotationMap;
|
|
393
945
|
}
|
|
394
946
|
}
|
|
947
|
+
/**
|
|
948
|
+
* Creates a new instance of the RTENode from the given JSON data.
|
|
949
|
+
*
|
|
950
|
+
* @param {unknown} json - The JSON data to create the node from.
|
|
951
|
+
* @param {RTEBlock} parentBlock - The parent block of the node.
|
|
952
|
+
* @param {VegaRTETransformOptions} options - Options for transforming the node.
|
|
953
|
+
*/
|
|
954
|
+
static from(json, parentBlock, options) {
|
|
955
|
+
throw new Error(`[Vega] ${this.constructor.name}.from(${JSON.stringify(json)}, ${parentBlock}, ${options}) is not implemented. Please implement this method in the subclass.`);
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Creates different types of text annotations based on the provided type and value.
|
|
959
|
+
*
|
|
960
|
+
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
961
|
+
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
962
|
+
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
963
|
+
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
964
|
+
*/
|
|
965
|
+
static createAnnotationEntity(type, value) {
|
|
966
|
+
switch (type) {
|
|
967
|
+
case 'customAttribute':
|
|
968
|
+
return CustomAttributeAnnotation.from(value);
|
|
969
|
+
case 'customClass':
|
|
970
|
+
return CustomClassAnnotation.from(value);
|
|
971
|
+
case 'customStyle':
|
|
972
|
+
return CustomStyleAnnotation.from(value);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
395
975
|
/**
|
|
396
976
|
* Get annotation by type
|
|
397
977
|
*
|
|
@@ -425,576 +1005,151 @@ class RTENode {
|
|
|
425
1005
|
return this;
|
|
426
1006
|
}
|
|
427
1007
|
/**
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
|
|
431
|
-
*/
|
|
432
|
-
doApply(action) {
|
|
433
|
-
if (action instanceof ModifyContentAction) {
|
|
434
|
-
this.doModifyActionApply(action);
|
|
435
|
-
}
|
|
436
|
-
else {
|
|
437
|
-
this.doAnnotationActionApply(action);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Flush the value change
|
|
442
|
-
*/
|
|
443
|
-
flushChange() {
|
|
444
|
-
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
445
|
-
if (domNode) {
|
|
446
|
-
const nodeSubject = domNodeSubjectFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
447
|
-
if (nodeSubject) {
|
|
448
|
-
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Clones the annotations of the current RTETextNode.
|
|
454
|
-
*
|
|
455
|
-
* @returns {NodeAnnotations} A new Map containing cloned annotations.
|
|
456
|
-
*/
|
|
457
|
-
cloneAnnotations() {
|
|
458
|
-
return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
exports.NodeAnnotationTypeEnum = void 0;
|
|
463
|
-
(function (NodeAnnotationTypeEnum) {
|
|
464
|
-
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
465
|
-
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
466
|
-
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
467
|
-
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
468
|
-
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
469
|
-
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
470
|
-
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
471
|
-
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
472
|
-
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
473
|
-
})(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
|
|
474
|
-
/**
|
|
475
|
-
* Abstract class for all annotations
|
|
476
|
-
*/
|
|
477
|
-
class NodeAnnotation extends Annotation {
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Annotation for image
|
|
482
|
-
*/
|
|
483
|
-
class ImageAnnotation extends NodeAnnotation {
|
|
484
|
-
constructor(size = 'md', alt) {
|
|
485
|
-
super();
|
|
486
|
-
this.type = exports.NodeAnnotationTypeEnum.IMAGE;
|
|
487
|
-
this.size = size;
|
|
488
|
-
this.alt = alt;
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Generate the map item for the annotation
|
|
492
|
-
*
|
|
493
|
-
* @param {string} size - Image size
|
|
494
|
-
* @param {string} alt - Image alt
|
|
495
|
-
* @returns {[NodeAnnotationTypeEnum.IMAGE, ImageAnnotation]} Map item for the annotation
|
|
496
|
-
*/
|
|
497
|
-
static from(size, alt) {
|
|
498
|
-
return [exports.NodeAnnotationTypeEnum.IMAGE, new ImageAnnotation(size, alt)];
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Generate the JSON representation of the annotation
|
|
1008
|
+
* Get styles from annotations
|
|
502
1009
|
*
|
|
503
|
-
* @
|
|
1010
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
|
|
1011
|
+
* @returns {AnnotationStyle} - Annotation styles
|
|
504
1012
|
*/
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
: {
|
|
512
|
-
size: this.size,
|
|
513
|
-
};
|
|
1013
|
+
getStyles(options = { standalone: false }) {
|
|
1014
|
+
const styles = Array.from(this.annotationMap.values())
|
|
1015
|
+
.filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomStyleAnnotation)
|
|
1016
|
+
.map((annotation) => annotation.renderStyle(options))
|
|
1017
|
+
.filter(Boolean);
|
|
1018
|
+
return this.mergeAnnotationStyles(styles, ['textDecoration']);
|
|
514
1019
|
}
|
|
515
1020
|
/**
|
|
516
|
-
*
|
|
517
|
-
*/
|
|
518
|
-
clone() {
|
|
519
|
-
return new ImageAnnotation(this.size, this.alt);
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Generate the style for the image
|
|
523
|
-
*
|
|
524
|
-
* @returns {Nullable<AnnotationStyle>} image style
|
|
525
|
-
*/
|
|
526
|
-
render() {
|
|
527
|
-
switch (this.size) {
|
|
528
|
-
case 'sm': {
|
|
529
|
-
return { width: '25%' };
|
|
530
|
-
}
|
|
531
|
-
case 'md': {
|
|
532
|
-
return { width: '50%' };
|
|
533
|
-
}
|
|
534
|
-
case 'lg': {
|
|
535
|
-
return { width: '100%' };
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
543
|
-
*/
|
|
544
|
-
class ActionHandleStrategy {
|
|
545
|
-
/**
|
|
546
|
-
* Public method to invoke the handle logic.
|
|
1021
|
+
* Get classes from annotations
|
|
547
1022
|
*
|
|
548
|
-
* @
|
|
549
|
-
* @
|
|
550
|
-
* @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
|
|
551
|
-
* @returns {R} - The invoke result in special strategy.
|
|
552
|
-
*/
|
|
553
|
-
execute(action, target) {
|
|
554
|
-
globalSlimmerRegistry.LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
|
|
555
|
-
return this.handleAction(action, target);
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
559
|
-
*
|
|
560
|
-
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
561
|
-
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
562
|
-
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
563
|
-
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
564
|
-
*/
|
|
565
|
-
isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
|
|
566
|
-
const lastNode = textBlock.children[textBlock.children.length - 1];
|
|
567
|
-
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Checks if the caret position is at the start of a specified RTETextNode.
|
|
571
|
-
*
|
|
572
|
-
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
573
|
-
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
574
|
-
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
575
|
-
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
1023
|
+
* @param {RTERenderContext} [options={ standalone: false }] - Options to control style mode
|
|
1024
|
+
* @returns {string} - Annotation style
|
|
576
1025
|
*/
|
|
577
|
-
|
|
578
|
-
return
|
|
1026
|
+
getClasses(options = { standalone: false }) {
|
|
1027
|
+
return Array.from(this.annotationMap.values())
|
|
1028
|
+
.filter((annotation) => annotation instanceof NodeAnnotation || annotation instanceof CustomClassAnnotation)
|
|
1029
|
+
.map((annotation) => annotation.renderClass(options))
|
|
1030
|
+
.filter(typeGuard.isNonNullable)
|
|
1031
|
+
.reduce((pre, cur) => [pre, cur].join(' ').trim(), '');
|
|
579
1032
|
}
|
|
580
1033
|
/**
|
|
581
|
-
*
|
|
1034
|
+
* Get custom attribute annotation, excluding "class" and "style"
|
|
582
1035
|
*
|
|
583
|
-
* @
|
|
584
|
-
* @param {RTEImageNode} node - `RTEImageNode` - a node representing an image in a rich text editor.
|
|
585
|
-
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
586
|
-
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTEImageNode.
|
|
1036
|
+
* @returns {CustomAttributeAnnotation} - custom attribute annotation
|
|
587
1037
|
*/
|
|
588
|
-
|
|
589
|
-
return
|
|
1038
|
+
getCustomAttributesAnnotation() {
|
|
1039
|
+
return this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_ATTRIBUTE);
|
|
590
1040
|
}
|
|
591
1041
|
/**
|
|
592
|
-
*
|
|
1042
|
+
* Check if the node is a text node.
|
|
593
1043
|
*
|
|
594
|
-
* @
|
|
595
|
-
* @param {RTEImageNode} node - `node` is a RTEImageNode
|
|
596
|
-
* @param {number} startOffset - The position within the `RTEImageNode` where the caret is located.
|
|
597
|
-
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEImageNode`.
|
|
1044
|
+
* @returns {boolean} - True if the node is a text node, false otherwise.
|
|
598
1045
|
*/
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
return node === lastNode && startOffset === 1;
|
|
1046
|
+
isTextNode() {
|
|
1047
|
+
return false;
|
|
602
1048
|
}
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Update the image node annotation map strategy.
|
|
607
|
-
*/
|
|
608
|
-
class ImageSetAnnotationMapStrategy extends ActionHandleStrategy {
|
|
609
1049
|
/**
|
|
610
|
-
*
|
|
611
|
-
*/
|
|
612
|
-
handleAction(action, target) {
|
|
613
|
-
const annotation = action.toAnnotation();
|
|
614
|
-
target.annotationMap.set(annotation.type, annotation);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* The image node update property url strategy.
|
|
620
|
-
*/
|
|
621
|
-
class ImageUpdateUrlStrategy extends ActionHandleStrategy {
|
|
622
|
-
/**
|
|
623
|
-
* @inheritDoc
|
|
624
|
-
*/
|
|
625
|
-
handleAction(action, target) {
|
|
626
|
-
target.url = action.url;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Abstract class for annotation actions
|
|
632
|
-
*/
|
|
633
|
-
class AnnotationAction {
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* Image node
|
|
638
|
-
*/
|
|
639
|
-
class RTEImageNode extends RTENode {
|
|
640
|
-
constructor(id, url, parentBlock, annotationMap) {
|
|
641
|
-
super(id, annotationMap);
|
|
642
|
-
this.type = NodeTypeEnum.IMAGE;
|
|
643
|
-
this.url = url;
|
|
644
|
-
this.parent = parentBlock;
|
|
645
|
-
}
|
|
646
|
-
/**
|
|
647
|
-
* Converts a VegaRTEImageNode into an RTEImageNode by mapping nodes and creating annotations.
|
|
1050
|
+
* Generate attributes as string
|
|
648
1051
|
*
|
|
649
|
-
* @param {
|
|
650
|
-
* @
|
|
651
|
-
* @returns {RTEImageNode} An instance of `RTEImageBlock`
|
|
652
|
-
*/
|
|
653
|
-
static from(node, parentBlock) {
|
|
654
|
-
const imageNode = new RTEImageNode(node.id, node.url, parentBlock);
|
|
655
|
-
let annotations;
|
|
656
|
-
if (!node.annotations || Object.keys(node.annotations).length === 0) {
|
|
657
|
-
annotations = { size: 'md' };
|
|
658
|
-
}
|
|
659
|
-
else {
|
|
660
|
-
annotations = node.annotations;
|
|
661
|
-
}
|
|
662
|
-
imageNode.annotationMap = new Map(Object.keys(annotations)
|
|
663
|
-
.map(() => ImageAnnotation.from(annotations.size, annotations.alt))
|
|
664
|
-
.filter(typeGuard.isNonNullable));
|
|
665
|
-
return imageNode;
|
|
666
|
-
}
|
|
667
|
-
/**
|
|
668
|
-
* @inheritDoc
|
|
1052
|
+
* @param {...string} attrs - Additional attributes to include
|
|
1053
|
+
* @returns {string} - Attributes as string
|
|
669
1054
|
*/
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
1055
|
+
generateAttributeString(...attrs) {
|
|
1056
|
+
var _a;
|
|
1057
|
+
const styles = Object.entries(Object.assign({}, this.getStyles({ standalone: true })))
|
|
1058
|
+
.map(([key, value]) => `${string.camelToDashCase(key)}: ${value};`)
|
|
1059
|
+
.join('');
|
|
1060
|
+
const customClassAnnotation = this.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_CLASS);
|
|
1061
|
+
const customAttributeString = ((_a = this.getCustomAttributesAnnotation()) === null || _a === void 0 ? void 0 : _a.toString(attrs)) || [];
|
|
1062
|
+
const attributes = [
|
|
1063
|
+
...customAttributeString,
|
|
1064
|
+
customClassAnnotation === null || customClassAnnotation === void 0 ? void 0 : customClassAnnotation.toString(),
|
|
1065
|
+
styles ? `style="${styles}"` : null,
|
|
1066
|
+
...attrs,
|
|
1067
|
+
].filter(typeGuard.isNonNullable);
|
|
1068
|
+
return attributes.length ? ` ${attributes.join(' ')}` : '';
|
|
680
1069
|
}
|
|
681
1070
|
/**
|
|
682
|
-
*
|
|
683
|
-
*/
|
|
684
|
-
clone() {
|
|
685
|
-
return new RTEImageNode(this.id, this.url, this.parent, super.cloneAnnotations());
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* @inheritDoc
|
|
689
|
-
*/
|
|
690
|
-
doAnnotationActionApply(action) {
|
|
691
|
-
const strategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTEImageNode.name);
|
|
692
|
-
if (strategy) {
|
|
693
|
-
strategy.execute(action, this);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* @inheritDoc
|
|
698
|
-
*/
|
|
699
|
-
doModifyActionApply(action) {
|
|
700
|
-
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
(() => {
|
|
704
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.UPDATE_IMAGE_NODE_URL, RTEImageNode.name, new ImageUpdateUrlStrategy());
|
|
705
|
-
ActionHandleStrategyRegistry.register(AnnotationAction.name, RTEImageNode.name, new ImageSetAnnotationMapStrategy());
|
|
706
|
-
})();
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Delete child node or child block from the current list action
|
|
710
|
-
*
|
|
711
|
-
* @example needRemovedNode.parentBlock.apply(new RemoveChildAction(needRemovedNode))
|
|
712
|
-
* @example needRemovedBlock.parent.apply(new RemoveChildAction(needRemovedBlock))
|
|
713
|
-
*/
|
|
714
|
-
class RemoveChildAction extends ModifyContentAction {
|
|
715
|
-
constructor(childNode) {
|
|
716
|
-
super();
|
|
717
|
-
this.type = exports.ModifyContentActionType.DELETE_CHILD;
|
|
718
|
-
this.entityToBeRemoved = childNode;
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
|
|
724
|
-
*/
|
|
725
|
-
class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
726
|
-
/**
|
|
727
|
-
* Returns the previous node relative to the current node in a rich text editor structure.
|
|
728
|
-
*
|
|
729
|
-
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
730
|
-
* @returns {Nullable<RTENode>} the previous block last node
|
|
731
|
-
*/
|
|
732
|
-
getPreviousNode(currentNode) {
|
|
733
|
-
const currentBlock = currentNode.parent;
|
|
734
|
-
const currentIndex = currentBlock.children.indexOf(currentNode);
|
|
735
|
-
if (currentIndex > 0) {
|
|
736
|
-
return currentBlock.children[currentIndex - 1];
|
|
737
|
-
}
|
|
738
|
-
else if (currentBlock.parent) {
|
|
739
|
-
const previousBlock = this.getPreviousBlock(currentBlock);
|
|
740
|
-
if (previousBlock) {
|
|
741
|
-
return this.getBlockLastNode(previousBlock);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Returns the next node relative to the current node in a rich text editor structure.
|
|
747
|
-
*
|
|
748
|
-
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
749
|
-
* @returns {Nullable<RTENode>} the next block first node
|
|
750
|
-
*/
|
|
751
|
-
getNextNode(currentNode) {
|
|
752
|
-
const currentBlock = currentNode.parent;
|
|
753
|
-
const currentIndex = currentBlock.children.indexOf(currentNode);
|
|
754
|
-
if (currentBlock.children[currentIndex + 1]) {
|
|
755
|
-
return currentBlock.children[currentIndex + 1];
|
|
756
|
-
}
|
|
757
|
-
else if (currentBlock.parent) {
|
|
758
|
-
const nextBlock = this.getNextBlock(currentBlock);
|
|
759
|
-
if (nextBlock) {
|
|
760
|
-
return this.getBlockFirstNode(nextBlock);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* Determines if a given node is the first node within the current state.
|
|
766
|
-
*
|
|
767
|
-
* @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
|
|
768
|
-
* @returns {boolean} True or false;
|
|
769
|
-
*/
|
|
770
|
-
isContentFirstNode(currentNode) {
|
|
771
|
-
const currentBlock = currentNode.parent;
|
|
772
|
-
const currentIndex = currentBlock.children.indexOf(currentNode);
|
|
773
|
-
const parent = currentBlock.parent;
|
|
774
|
-
if (currentBlock.isListItemBlock()) {
|
|
775
|
-
const listParent = parent.parent;
|
|
776
|
-
return (currentIndex === 0 &&
|
|
777
|
-
Array.isArray(parent.children) &&
|
|
778
|
-
parent.children[0] === currentBlock &&
|
|
779
|
-
listParent['type'] !== 'list-item' &&
|
|
780
|
-
Array.isArray(listParent.children) &&
|
|
781
|
-
listParent.children[0] === parent);
|
|
782
|
-
}
|
|
783
|
-
else {
|
|
784
|
-
return (currentIndex === 0 && Array.isArray(parent.children) && parent.children[0] === currentBlock);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* TODO: The getPreviousBlock add nest list support
|
|
789
|
-
* This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
790
|
-
*
|
|
791
|
-
* @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
|
|
792
|
-
* @returns {Nullable<RTEBlock>} The previous block if existing
|
|
793
|
-
*/
|
|
794
|
-
getPreviousBlock(currentBlock) {
|
|
795
|
-
if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
|
|
796
|
-
const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
|
|
797
|
-
if (currentBlockIndex > 0) {
|
|
798
|
-
return currentBlock.parent.children[currentBlockIndex - 1];
|
|
799
|
-
}
|
|
800
|
-
else if ((currentBlock.parent['type'] === 'number-list' ||
|
|
801
|
-
currentBlock.parent['type'] === 'bullet-list') &&
|
|
802
|
-
currentBlockIndex === 0) {
|
|
803
|
-
return this.getPreviousBlock(currentBlock.parent);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* Returns the last node within a given RTE block, handling different block types accordingly.
|
|
809
|
-
*
|
|
810
|
-
* @param {RTEBlock} currentBlock - Returns the last node within that block.
|
|
811
|
-
* @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
|
|
812
|
-
*/
|
|
813
|
-
getBlockLastNode(currentBlock) {
|
|
814
|
-
return currentBlock.getLastNode();
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Returns the first node within a given RTE block, handling different block types accordingly.
|
|
1071
|
+
* apply annotation action or modify content action
|
|
818
1072
|
*
|
|
819
|
-
* @param {
|
|
820
|
-
* @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
|
|
1073
|
+
* @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
|
|
821
1074
|
*/
|
|
822
|
-
|
|
823
|
-
if (
|
|
824
|
-
|
|
825
|
-
const firstListItem = currentBlock.children[0];
|
|
826
|
-
return this.getBlockFirstNode(firstListItem);
|
|
827
|
-
}
|
|
1075
|
+
doApply(action) {
|
|
1076
|
+
if (action instanceof ModifyContentAction) {
|
|
1077
|
+
this.doModifyActionApply(action);
|
|
828
1078
|
}
|
|
829
1079
|
else {
|
|
830
|
-
|
|
831
|
-
return currentBlock.children[0];
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
|
-
* This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
837
|
-
*
|
|
838
|
-
* @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
|
|
839
|
-
* @returns {Nullable<RTEBlock>} The next block if existing
|
|
840
|
-
*/
|
|
841
|
-
getNextBlock(currentBlock) {
|
|
842
|
-
if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
|
|
843
|
-
const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
|
|
844
|
-
if (currentBlock.parent.children[currentBlockIndex + 1]) {
|
|
845
|
-
return currentBlock.parent.children[currentBlockIndex + 1];
|
|
846
|
-
}
|
|
847
|
-
else if (currentBlock.type === 'list-item' &&
|
|
848
|
-
currentBlock.parent.children.length === currentBlockIndex + 1) {
|
|
849
|
-
return this.getNextBlock(currentBlock.parent);
|
|
850
|
-
}
|
|
1080
|
+
this.doAnnotationActionApply(action);
|
|
851
1081
|
}
|
|
852
1082
|
}
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
/** Append blocks or nodes to a block */
|
|
856
|
-
class AppendChildNodesAction extends ModifyContentAction {
|
|
857
|
-
constructor(childNodes) {
|
|
858
|
-
super();
|
|
859
|
-
this.type = exports.ModifyContentActionType.APPEND_CHILD_NODES;
|
|
860
|
-
this.entityToBeAppended = childNodes;
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* Append the second block child nodes to the first block child nodes and remove the second block strategy.
|
|
866
|
-
*/
|
|
867
|
-
class BlockMergeNodesStrategy extends ActionHandleStrategy {
|
|
868
1083
|
/**
|
|
869
|
-
*
|
|
870
|
-
*
|
|
871
|
-
* @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
|
|
872
|
-
* @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
|
|
1084
|
+
* Flush the value change
|
|
873
1085
|
*/
|
|
874
|
-
|
|
875
|
-
const
|
|
876
|
-
if (
|
|
877
|
-
|
|
878
|
-
if (
|
|
879
|
-
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* Remove the node from the text block or image block strategy.
|
|
889
|
-
*/
|
|
890
|
-
class BlockRemoveNodeStrategy extends ActionHandleStrategy {
|
|
1086
|
+
flushChange() {
|
|
1087
|
+
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
1088
|
+
if (domNode) {
|
|
1089
|
+
const nodeSubject = domNodeSubjectFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
1090
|
+
if (nodeSubject) {
|
|
1091
|
+
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
891
1095
|
/**
|
|
892
|
-
*
|
|
893
|
-
* Remove the block if the block nodes is empty after delete the current node.
|
|
1096
|
+
* Clones the annotations of the current RTETextNode.
|
|
894
1097
|
*
|
|
895
|
-
* @
|
|
896
|
-
* @param {RTEBlockWithNodes} target - The parent block of the node that will be removed.
|
|
1098
|
+
* @returns {NodeAnnotations} A new Map containing cloned annotations.
|
|
897
1099
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
target.children = arrayFixed.filter((node) => node !== action.entityToBeRemoved);
|
|
901
|
-
if (target.children.length === 0 && target.parent) {
|
|
902
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
903
|
-
}
|
|
1100
|
+
cloneAnnotations() {
|
|
1101
|
+
return new Map(Array.from(this.annotationMap.entries()).map(([key, value]) => [key, value.clone()]));
|
|
904
1102
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Append the nodes to the text block or image block strategy.
|
|
909
|
-
*/
|
|
910
|
-
class BlockAppendNodesStrategy extends ActionHandleStrategy {
|
|
1103
|
+
/* istanbul ignore next */
|
|
911
1104
|
/**
|
|
912
|
-
*
|
|
1105
|
+
* Placeholder for the method to be implemented in sub classes.
|
|
913
1106
|
*
|
|
914
|
-
* @param {
|
|
915
|
-
* @param {RTETextBlock | RTEImageBlock} target - The parent block of the node that will be removed.
|
|
1107
|
+
* @param {AnnotationAction} action Annotation action
|
|
916
1108
|
*/
|
|
917
|
-
|
|
918
|
-
const nodesToBeAppended = action.entityToBeAppended;
|
|
919
|
-
nodesToBeAppended.forEach((node) => {
|
|
920
|
-
node.parent = target;
|
|
921
|
-
});
|
|
922
|
-
// This line is used to fix the typescript error `This expression is not callable`. https://github.com/microsoft/TypeScript/issues/44373
|
|
923
|
-
const arrayFixed = target.children;
|
|
924
|
-
target.children = arrayFixed.concat(nodesToBeAppended);
|
|
1109
|
+
doAnnotationActionApply(action) {
|
|
925
1110
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
* Remove all nodes and append new nodes strategy.
|
|
930
|
-
*/
|
|
931
|
-
class BlockReplaceNodesStrategy extends ActionHandleStrategy {
|
|
1111
|
+
/* istanbul ignore next */
|
|
932
1112
|
/**
|
|
933
|
-
*
|
|
1113
|
+
* Placeholder for the method to be implemented in sub classes.
|
|
934
1114
|
*
|
|
935
|
-
* @param {
|
|
936
|
-
* @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
|
|
1115
|
+
* @param {ModifyContentAction} action ModifyContentAction
|
|
937
1116
|
*/
|
|
938
|
-
|
|
939
|
-
target.children = [];
|
|
940
|
-
target.apply(new AppendChildNodesAction(action.newChildNodes));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* Insert a new block after a existing block
|
|
946
|
-
*
|
|
947
|
-
* @example currentBlock.parent.apply(new InsertBlocksAfterAction(currentBlock, newBlock, ...))
|
|
948
|
-
*/
|
|
949
|
-
class InsertBlocksAfterAction extends ModifyContentAction {
|
|
950
|
-
constructor(referBlock, ...blocksToBeInserted) {
|
|
951
|
-
super();
|
|
952
|
-
this.type = exports.ModifyContentActionType.INSERT_BLOCKS_AFTER;
|
|
953
|
-
this.referBlock = referBlock;
|
|
954
|
-
this.blocksToBeInserted = blocksToBeInserted;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* Clear the current block nodes and append new nodes
|
|
960
|
-
*
|
|
961
|
-
* @example block.apply(new ReplaceChildNodesAction(newNodes))
|
|
962
|
-
*/
|
|
963
|
-
class ReplaceChildNodesAction extends ModifyContentAction {
|
|
964
|
-
constructor(newChildNodes) {
|
|
965
|
-
super();
|
|
966
|
-
this.type = exports.ModifyContentActionType.REPLACE_CHILD_NODES;
|
|
967
|
-
this.newChildNodes = newChildNodes;
|
|
1117
|
+
doModifyActionApply(action) {
|
|
968
1118
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1119
|
+
/**
|
|
1120
|
+
* Merge an array of annotation styles into a single style object.
|
|
1121
|
+
* e.g.,
|
|
1122
|
+
* { textDecoration: 'underline', textDecoration: 'line-through' }
|
|
1123
|
+
* -> { textDecoration: 'underline line-through' }
|
|
1124
|
+
*
|
|
1125
|
+
* @param {AnnotationStyle[]} styles - Array of annotation style objects to merge.
|
|
1126
|
+
* @param {string[]} canMergeKeyList - List of style keys that can be merged by concatenation.
|
|
1127
|
+
* @returns {AnnotationStyle} - The merged annotation style object.
|
|
1128
|
+
*/
|
|
1129
|
+
mergeAnnotationStyles(styles, canMergeKeyList) {
|
|
1130
|
+
const merged = {};
|
|
1131
|
+
for (const style of styles) {
|
|
1132
|
+
for (const key in style) {
|
|
1133
|
+
const value = style[key];
|
|
1134
|
+
const existing = merged[key];
|
|
1135
|
+
if (typeof existing === 'string' &&
|
|
1136
|
+
typeof value === 'string' &&
|
|
1137
|
+
canMergeKeyList.includes(key)) {
|
|
1138
|
+
merged[key] = Array.from(new Set(`${existing} ${value}`.split(/\s+/).filter(Boolean))).join(' ');
|
|
1139
|
+
}
|
|
1140
|
+
else {
|
|
1141
|
+
merged[key] = value;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
return merged;
|
|
982
1146
|
}
|
|
983
1147
|
}
|
|
984
1148
|
|
|
985
1149
|
/**
|
|
986
|
-
*
|
|
987
|
-
* The property `newBlock` use to store the new create block if need.
|
|
988
|
-
*
|
|
989
|
-
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
1150
|
+
* Abstract class for annotation actions
|
|
990
1151
|
*/
|
|
991
|
-
class
|
|
992
|
-
constructor(splitPointNode, startOffsetOfNode) {
|
|
993
|
-
super();
|
|
994
|
-
this.type = exports.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
|
|
995
|
-
this.splitPointNode = splitPointNode;
|
|
996
|
-
this.startOffsetOfNode = startOffsetOfNode;
|
|
997
|
-
}
|
|
1152
|
+
class AnnotationAction {
|
|
998
1153
|
}
|
|
999
1154
|
|
|
1000
1155
|
/**
|
|
@@ -1064,20 +1219,20 @@ class StrikethroughAnnotation extends NodeAnnotation {
|
|
|
1064
1219
|
return new StrikethroughAnnotation(this.strikethrough);
|
|
1065
1220
|
}
|
|
1066
1221
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
* @returns {Nullable<string>} - Annotation class
|
|
1222
|
+
* @inheritDoc
|
|
1070
1223
|
*/
|
|
1071
|
-
renderClass() {
|
|
1224
|
+
renderClass(options) {
|
|
1225
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
1226
|
+
return null;
|
|
1072
1227
|
return this.strikethrough ? 'v-rte--strikethrough' : null;
|
|
1073
1228
|
}
|
|
1074
1229
|
/**
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
1077
|
-
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
1230
|
+
* @inheritDoc
|
|
1078
1231
|
*/
|
|
1079
|
-
|
|
1080
|
-
|
|
1232
|
+
renderStyle(options) {
|
|
1233
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
1234
|
+
return null;
|
|
1235
|
+
return this.strikethrough ? { textDecoration: 'line-through' } : null;
|
|
1081
1236
|
}
|
|
1082
1237
|
}
|
|
1083
1238
|
|
|
@@ -1116,20 +1271,20 @@ class UnderlineAnnotation extends NodeAnnotation {
|
|
|
1116
1271
|
return new UnderlineAnnotation(this.underline);
|
|
1117
1272
|
}
|
|
1118
1273
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
* @returns {Nullable<string>} - Annotation class
|
|
1274
|
+
* @inheritDoc
|
|
1122
1275
|
*/
|
|
1123
|
-
renderClass() {
|
|
1276
|
+
renderClass(options) {
|
|
1277
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
1278
|
+
return null;
|
|
1124
1279
|
return this.underline ? 'v-rte--underline' : null;
|
|
1125
1280
|
}
|
|
1126
1281
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
1282
|
+
* @inheritDoc
|
|
1130
1283
|
*/
|
|
1131
|
-
|
|
1132
|
-
|
|
1284
|
+
renderStyle(options) {
|
|
1285
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
1286
|
+
return null;
|
|
1287
|
+
return this.underline ? { textDecoration: 'underline' } : null;
|
|
1133
1288
|
}
|
|
1134
1289
|
}
|
|
1135
1290
|
|
|
@@ -1168,12 +1323,20 @@ class ItalicAnnotation extends NodeAnnotation {
|
|
|
1168
1323
|
return new ItalicAnnotation(this.italic);
|
|
1169
1324
|
}
|
|
1170
1325
|
/**
|
|
1171
|
-
*
|
|
1172
|
-
|
|
1173
|
-
|
|
1326
|
+
* @inheritDoc
|
|
1327
|
+
*/
|
|
1328
|
+
renderClass(options) {
|
|
1329
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
1330
|
+
return null;
|
|
1331
|
+
return this.italic ? 'v-rte--italic' : null;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* @inheritDoc
|
|
1174
1335
|
*/
|
|
1175
|
-
|
|
1176
|
-
|
|
1336
|
+
renderStyle(options) {
|
|
1337
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
1338
|
+
return null;
|
|
1339
|
+
return this.italic ? { fontStyle: 'italic' } : null;
|
|
1177
1340
|
}
|
|
1178
1341
|
}
|
|
1179
1342
|
|
|
@@ -1212,12 +1375,20 @@ class BoldAnnotation extends NodeAnnotation {
|
|
|
1212
1375
|
return new BoldAnnotation(this.bold);
|
|
1213
1376
|
}
|
|
1214
1377
|
/**
|
|
1215
|
-
*
|
|
1216
|
-
|
|
1217
|
-
|
|
1378
|
+
* @inheritDoc
|
|
1379
|
+
*/
|
|
1380
|
+
renderClass(options) {
|
|
1381
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
1382
|
+
return null;
|
|
1383
|
+
return this.bold ? 'v-rte--bold' : null;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* @inheritDoc
|
|
1218
1387
|
*/
|
|
1219
|
-
|
|
1220
|
-
|
|
1388
|
+
renderStyle(options) {
|
|
1389
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
1390
|
+
return null;
|
|
1391
|
+
return this.bold ? { fontWeight: '700' } : null;
|
|
1221
1392
|
}
|
|
1222
1393
|
}
|
|
1223
1394
|
|
|
@@ -1225,19 +1396,21 @@ class BoldAnnotation extends NodeAnnotation {
|
|
|
1225
1396
|
* Annotation to make text code
|
|
1226
1397
|
*/
|
|
1227
1398
|
class CodeAnnotation extends NodeAnnotation {
|
|
1228
|
-
constructor(code) {
|
|
1399
|
+
constructor(code, useInternalStyle = true) {
|
|
1229
1400
|
super();
|
|
1230
1401
|
this.type = exports.NodeAnnotationTypeEnum.CODE;
|
|
1231
1402
|
this.code = code;
|
|
1403
|
+
this.useInternalStyle = useInternalStyle;
|
|
1232
1404
|
}
|
|
1233
1405
|
/**
|
|
1234
1406
|
* Generate the map item for the annotation
|
|
1235
1407
|
*
|
|
1236
1408
|
* @param {boolean} code - Bold annotation
|
|
1409
|
+
* @param {boolean} useInternalStyle - Whether to use default style for the link
|
|
1237
1410
|
* @returns {[NodeAnnotationTypeEnum.CODE, CodeAnnotation]} Map item for the annotation
|
|
1238
1411
|
*/
|
|
1239
|
-
static from(code) {
|
|
1240
|
-
return [exports.NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code)];
|
|
1412
|
+
static from(code, useInternalStyle) {
|
|
1413
|
+
return [exports.NodeAnnotationTypeEnum.CODE, new CodeAnnotation(code, useInternalStyle)];
|
|
1241
1414
|
}
|
|
1242
1415
|
/**
|
|
1243
1416
|
* Generate the JSON representation of the annotation
|
|
@@ -1253,32 +1426,38 @@ class CodeAnnotation extends NodeAnnotation {
|
|
|
1253
1426
|
* @inheritDoc
|
|
1254
1427
|
*/
|
|
1255
1428
|
clone() {
|
|
1256
|
-
return new CodeAnnotation(this.code);
|
|
1429
|
+
return new CodeAnnotation(this.code, this.useInternalStyle);
|
|
1257
1430
|
}
|
|
1258
1431
|
/**
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
* @returns {Nullable<string>} - Annotation class
|
|
1432
|
+
* @inheritDoc
|
|
1262
1433
|
*/
|
|
1263
|
-
renderClass() {
|
|
1264
|
-
|
|
1434
|
+
renderClass(options) {
|
|
1435
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
1436
|
+
return null;
|
|
1437
|
+
return this.code && this.useInternalStyle ? 'v-rte--code' : null;
|
|
1265
1438
|
}
|
|
1266
1439
|
/**
|
|
1267
|
-
*
|
|
1268
|
-
*
|
|
1269
|
-
* @returns {Nullable<AnnotationStyle>} Bold style
|
|
1440
|
+
* @inheritDoc
|
|
1270
1441
|
*/
|
|
1271
|
-
|
|
1272
|
-
|
|
1442
|
+
renderStyle(options) {
|
|
1443
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
1444
|
+
return null;
|
|
1445
|
+
return this.code && this.useInternalStyle
|
|
1446
|
+
? {
|
|
1447
|
+
fontFamily: 'Roboto Mono',
|
|
1448
|
+
whiteSpace: 'pre-wrap',
|
|
1449
|
+
}
|
|
1450
|
+
: null;
|
|
1273
1451
|
}
|
|
1274
1452
|
}
|
|
1275
1453
|
|
|
1454
|
+
const RTE_DEFAULT_TEXT_COLOR = {
|
|
1455
|
+
key: 'black',
|
|
1456
|
+
light: '#111128',
|
|
1457
|
+
dark: '#E3E3E8',
|
|
1458
|
+
};
|
|
1276
1459
|
const RTE_TEXT_COLORS = [
|
|
1277
|
-
|
|
1278
|
-
key: 'black',
|
|
1279
|
-
light: '#111128',
|
|
1280
|
-
dark: '#E3E3E8',
|
|
1281
|
-
},
|
|
1460
|
+
RTE_DEFAULT_TEXT_COLOR,
|
|
1282
1461
|
{
|
|
1283
1462
|
key: 'gray',
|
|
1284
1463
|
light: '#5E5E6D',
|
|
@@ -1342,19 +1521,15 @@ class TextColorAnnotation extends NodeAnnotation {
|
|
|
1342
1521
|
return new TextColorAnnotation(this.textColor.key);
|
|
1343
1522
|
}
|
|
1344
1523
|
/**
|
|
1345
|
-
*
|
|
1346
|
-
*
|
|
1347
|
-
* @returns {Nullable<string>} - Annotation class
|
|
1524
|
+
* @inheritDoc
|
|
1348
1525
|
*/
|
|
1349
1526
|
renderClass() {
|
|
1350
1527
|
return null;
|
|
1351
1528
|
}
|
|
1352
1529
|
/**
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1355
|
-
* @returns {Nullable<AnnotationStyle>} - Annotation style
|
|
1530
|
+
* @inheritDoc
|
|
1356
1531
|
*/
|
|
1357
|
-
|
|
1532
|
+
renderStyle() {
|
|
1358
1533
|
return {
|
|
1359
1534
|
color: darkModeStyleController.VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
|
|
1360
1535
|
};
|
|
@@ -1374,22 +1549,21 @@ class TextColorAnnotation extends NodeAnnotation {
|
|
|
1374
1549
|
* Annotation to make text a link
|
|
1375
1550
|
*/
|
|
1376
1551
|
class LinkAnnotation extends NodeAnnotation {
|
|
1377
|
-
constructor(link) {
|
|
1552
|
+
constructor(link, useInternalStyle = true) {
|
|
1378
1553
|
super();
|
|
1379
1554
|
this.type = exports.NodeAnnotationTypeEnum.LINK;
|
|
1380
1555
|
this.link = link;
|
|
1556
|
+
this.useInternalStyle = useInternalStyle;
|
|
1381
1557
|
}
|
|
1382
1558
|
/**
|
|
1383
1559
|
* Generate the map item for the annotation
|
|
1384
1560
|
*
|
|
1385
1561
|
* @param {VegaRTELink} link - Bold annotation
|
|
1562
|
+
* @param {boolean} useInternalStyle - Whether to use default style for the link
|
|
1386
1563
|
* @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
|
|
1387
1564
|
*/
|
|
1388
|
-
static from(link) {
|
|
1389
|
-
return [
|
|
1390
|
-
exports.NodeAnnotationTypeEnum.LINK,
|
|
1391
|
-
new LinkAnnotation({ href: link.href, groupKey: link.groupKey }),
|
|
1392
|
-
];
|
|
1565
|
+
static from(link, useInternalStyle = true) {
|
|
1566
|
+
return [exports.NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link, useInternalStyle)];
|
|
1393
1567
|
}
|
|
1394
1568
|
/**
|
|
1395
1569
|
* Generate the JSON representation of the annotation
|
|
@@ -1397,7 +1571,9 @@ class LinkAnnotation extends NodeAnnotation {
|
|
|
1397
1571
|
* @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
|
|
1398
1572
|
*/
|
|
1399
1573
|
toJSON() {
|
|
1400
|
-
return {
|
|
1574
|
+
return {
|
|
1575
|
+
link: this.link,
|
|
1576
|
+
};
|
|
1401
1577
|
}
|
|
1402
1578
|
/**
|
|
1403
1579
|
* @inheritDoc
|
|
@@ -1415,31 +1591,16 @@ class LinkAnnotation extends NodeAnnotation {
|
|
|
1415
1591
|
return this.link.groupKey === annotation.link.groupKey;
|
|
1416
1592
|
}
|
|
1417
1593
|
/**
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1420
|
-
* @returns {Nullable<AnnotationStyle>} Link style
|
|
1594
|
+
* @inheritDoc
|
|
1421
1595
|
*/
|
|
1422
|
-
|
|
1596
|
+
renderClass() {
|
|
1423
1597
|
return null;
|
|
1424
1598
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
class LinkGroupAnnotation extends Annotation {
|
|
1431
|
-
constructor(groupKey) {
|
|
1432
|
-
super();
|
|
1433
|
-
this.type = exports.InternalAnnotationTypeEnum.LINK_GROUP;
|
|
1434
|
-
this.linkGroups = new Map();
|
|
1435
|
-
this.linkGroups = new Map([[groupKey, []]]);
|
|
1436
|
-
}
|
|
1437
|
-
clone() {
|
|
1438
|
-
const clonedAnnotation = new LinkGroupAnnotation('');
|
|
1439
|
-
this.linkGroups.forEach((nodes, key) => {
|
|
1440
|
-
clonedAnnotation.linkGroups.set(key, nodes.map((node) => node.clone()));
|
|
1441
|
-
});
|
|
1442
|
-
return clonedAnnotation;
|
|
1599
|
+
/**
|
|
1600
|
+
* @inheritDoc
|
|
1601
|
+
*/
|
|
1602
|
+
renderStyle() {
|
|
1603
|
+
return null;
|
|
1443
1604
|
}
|
|
1444
1605
|
}
|
|
1445
1606
|
|
|
@@ -1447,11 +1608,12 @@ class LinkGroupAnnotation extends Annotation {
|
|
|
1447
1608
|
* Action to link a group of nodes
|
|
1448
1609
|
*/
|
|
1449
1610
|
class LinkGroupAnnotationAction extends AnnotationAction {
|
|
1450
|
-
constructor(groupKey, nodes) {
|
|
1611
|
+
constructor(groupKey, nodes, type) {
|
|
1451
1612
|
super();
|
|
1452
1613
|
this.isFlushable = false;
|
|
1453
1614
|
this.groupKey = groupKey;
|
|
1454
1615
|
this.nodes = nodes;
|
|
1616
|
+
this.type = type;
|
|
1455
1617
|
}
|
|
1456
1618
|
/**
|
|
1457
1619
|
* Converts the action to an annotation
|
|
@@ -1482,80 +1644,188 @@ class SyncUpSelectionAction extends AnnotationAction {
|
|
|
1482
1644
|
}
|
|
1483
1645
|
|
|
1484
1646
|
/**
|
|
1485
|
-
*
|
|
1647
|
+
* RTEDTOClassManager is a singleton class that manages the registration and retrieval of RTE DTO classes.
|
|
1648
|
+
* It allows for the dynamic handling of different RTE blocks and nodes by their types.
|
|
1486
1649
|
*/
|
|
1487
|
-
class
|
|
1650
|
+
class RTEDTOClassManager {
|
|
1651
|
+
constructor() {
|
|
1652
|
+
// Register RTE Block DTO classes.
|
|
1653
|
+
this.RTE_BLOCK_DTO_CLASS_MAP = new Map();
|
|
1654
|
+
// Register RTE Block DTO classes.
|
|
1655
|
+
this.RTE_NODE_DTO_CLASS_MAP = new Map();
|
|
1656
|
+
}
|
|
1488
1657
|
/**
|
|
1489
|
-
*
|
|
1658
|
+
* Registers a new RTE DTO class.
|
|
1490
1659
|
*
|
|
1491
|
-
* @
|
|
1492
|
-
* @param {
|
|
1660
|
+
* @typedef T - The type of the RTE DTO class to register.
|
|
1661
|
+
* @param {string} type - The type identifier for the RTE DTO class.
|
|
1662
|
+
* @param {ClassType<T>} RTEDTOClass - The class constructor for the RTE DTO.
|
|
1493
1663
|
*/
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1664
|
+
registerRTEDTOClass(type, RTEDTOClass) {
|
|
1665
|
+
if (RTEDTOClass.prototype instanceof RTEBlock) {
|
|
1666
|
+
this.RTE_BLOCK_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1667
|
+
}
|
|
1668
|
+
else if (RTEDTOClass.prototype instanceof RTENode) {
|
|
1669
|
+
this.RTE_NODE_DTO_CLASS_MAP.set(type, RTEDTOClass);
|
|
1670
|
+
}
|
|
1671
|
+
else {
|
|
1672
|
+
throw new Error(`Invalid RTE DTO class type: ${type}`);
|
|
1499
1673
|
}
|
|
1500
1674
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1675
|
+
/**
|
|
1676
|
+
* Retrieves the RTE block class for a given type.
|
|
1677
|
+
*
|
|
1678
|
+
* @param {string} type - The type identifier for the RTE block.
|
|
1679
|
+
* @returns {Nullable<RTEBlockDTOClass>} - The class constructor for the RTE block, or null if not found.
|
|
1680
|
+
*/
|
|
1681
|
+
getRTEBlockClass(type) {
|
|
1682
|
+
return this.RTE_BLOCK_DTO_CLASS_MAP.get(type);
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Retrieves the RTE node class for a given type.
|
|
1686
|
+
*
|
|
1687
|
+
* @param {string} type - The type identifier for the RTE node.
|
|
1688
|
+
* @returns {Nullable<RTENodeDTOClass>} - The class constructor for the RTE node, or null if not found.
|
|
1689
|
+
*/
|
|
1690
|
+
getRTENodeClass(type) {
|
|
1691
|
+
return this.RTE_NODE_DTO_CLASS_MAP.get(type);
|
|
1514
1692
|
}
|
|
1515
1693
|
}
|
|
1694
|
+
const RTEDTOClassManager$1 = new RTEDTOClassManager();
|
|
1516
1695
|
|
|
1517
1696
|
/**
|
|
1518
|
-
*
|
|
1697
|
+
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
1519
1698
|
*/
|
|
1520
|
-
class
|
|
1699
|
+
class ActionHandleStrategy {
|
|
1521
1700
|
/**
|
|
1522
|
-
*
|
|
1701
|
+
* Public method to invoke the handle logic.
|
|
1702
|
+
*
|
|
1703
|
+
* @typedef R generic type
|
|
1704
|
+
* @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
|
|
1705
|
+
* @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
|
|
1706
|
+
* @returns {R} - The invoke result in special strategy.
|
|
1523
1707
|
*/
|
|
1524
|
-
|
|
1525
|
-
|
|
1708
|
+
execute(action, target) {
|
|
1709
|
+
globalSlimmerRegistry.LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
|
|
1710
|
+
return this.handleAction(action, target);
|
|
1526
1711
|
}
|
|
1527
1712
|
/**
|
|
1528
|
-
*
|
|
1713
|
+
* Update the custom style annotation of a block or node
|
|
1529
1714
|
*
|
|
1530
|
-
* @param {
|
|
1531
|
-
* @param {
|
|
1532
|
-
* @param {RTETextNode} target - The RTE text node instance.
|
|
1715
|
+
* @param {RTEBlock | RTETextNode} item - block or node
|
|
1716
|
+
* @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
|
|
1533
1717
|
*/
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1718
|
+
updateCustomStyleAnnotation(item, styleKeys) {
|
|
1719
|
+
const customStyleAnnotation = item.annotationMap.get(exports.CommonAnnotationTypeEnum.CUSTOM_STYLE);
|
|
1720
|
+
if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
|
|
1721
|
+
item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Create a new paragraph block with the given text.
|
|
1726
|
+
*
|
|
1727
|
+
* @param {string} text - The text content for the new paragraph.
|
|
1728
|
+
* @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
|
|
1729
|
+
*/
|
|
1730
|
+
createNewParagraph(text) {
|
|
1731
|
+
const dtoClass = RTEDTOClassManager$1.getRTEBlockClass('paragraph');
|
|
1732
|
+
if (dtoClass) {
|
|
1733
|
+
const newParagraph = dtoClass.from({
|
|
1734
|
+
id: createPublicApiRuntimeMetricsSlimmer.generateUUID(),
|
|
1735
|
+
type: 'paragraph',
|
|
1736
|
+
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text }],
|
|
1737
|
+
});
|
|
1738
|
+
return newParagraph;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Get the root content from a child block or node.
|
|
1743
|
+
*
|
|
1744
|
+
* @param {RTEBlock | RTENode} child - The child block or node.
|
|
1745
|
+
* @returns {Nullable<VegaRTEContent>} The root content, if found.
|
|
1746
|
+
*/
|
|
1747
|
+
getRootContent(child) {
|
|
1748
|
+
const parent = child.parent;
|
|
1749
|
+
if (parent) {
|
|
1750
|
+
if (parent.constructor.name === 'VegaRTEContent') {
|
|
1751
|
+
return parent;
|
|
1540
1752
|
}
|
|
1541
1753
|
else {
|
|
1542
|
-
|
|
1543
|
-
const endNode = endContainer.parentElement;
|
|
1544
|
-
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
1545
|
-
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
1546
|
-
let startIndex = 0, endIndex = target.text.length;
|
|
1547
|
-
if (startItemDto && startItemDto === target) {
|
|
1548
|
-
startIndex = startOffset;
|
|
1549
|
-
endIndex = startContainer === endContainer ? endOffset : endIndex;
|
|
1550
|
-
}
|
|
1551
|
-
else if (endItemDto && endItemDto === target) {
|
|
1552
|
-
endIndex = endOffset;
|
|
1553
|
-
}
|
|
1554
|
-
newText = target.text.slice(0, startIndex) + text + target.text.slice(endIndex);
|
|
1754
|
+
return this.getRootContent(parent);
|
|
1555
1755
|
}
|
|
1556
|
-
target.apply(new UpdateTextAction(newText));
|
|
1557
1756
|
}
|
|
1558
1757
|
}
|
|
1758
|
+
/**
|
|
1759
|
+
* Check the caret position at the start of a block.
|
|
1760
|
+
*
|
|
1761
|
+
* @param {RTEBlock} block - The RTE Block.
|
|
1762
|
+
* @param {RTENode} node - The RTE Node.
|
|
1763
|
+
* @param {number} offset - The offset position.
|
|
1764
|
+
* @returns {boolean} - Whether the caret is at the start of the block.
|
|
1765
|
+
*/
|
|
1766
|
+
isCaretPositionAtBlockStart(block, node, offset) {
|
|
1767
|
+
return node === block.children[0] && offset === 0;
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Check the caret position at the end of a block.
|
|
1771
|
+
*
|
|
1772
|
+
* @param {RTEBlock} block - The RTE Block.
|
|
1773
|
+
* @param {RTENode} node - The RTE Node.
|
|
1774
|
+
* @param {number} offset - The offset position.
|
|
1775
|
+
* @returns {boolean} - Whether the caret is at the end of the block.
|
|
1776
|
+
*/
|
|
1777
|
+
isCaretPositionAtBlockEnd(block, node, offset) {
|
|
1778
|
+
if (!node.isContentEditable()) {
|
|
1779
|
+
return this.isCaretPositionAtDecoratorBlockEnd(block, node, offset);
|
|
1780
|
+
}
|
|
1781
|
+
else {
|
|
1782
|
+
return this.isCaretPositionAtTextBlockEnd(block, node, offset);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
1787
|
+
*
|
|
1788
|
+
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
1789
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
1790
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
1791
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
1792
|
+
*/
|
|
1793
|
+
isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
|
|
1794
|
+
const lastNode = textBlock.children[textBlock.children.length - 1];
|
|
1795
|
+
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Checks if the caret position is at the end of a given decorator node.
|
|
1799
|
+
*
|
|
1800
|
+
* @param {RTEBlock} target - The image block.
|
|
1801
|
+
* @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
|
|
1802
|
+
* @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
|
|
1803
|
+
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
|
|
1804
|
+
*/
|
|
1805
|
+
isCaretPositionAtDecoratorBlockEnd(target, node, startOffset) {
|
|
1806
|
+
return node === target.children[target.children.length - 1] && startOffset !== 0;
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Determines if the custom style annotation includes any the custom style.
|
|
1810
|
+
*
|
|
1811
|
+
* @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
|
|
1812
|
+
* @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
|
|
1813
|
+
* @returns {boolean} - True if the custom key includes the custom style, false otherwise.
|
|
1814
|
+
*/
|
|
1815
|
+
isCustomStyle(customStyleAnnotation, styleKeys) {
|
|
1816
|
+
return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
/**
|
|
1821
|
+
* Split the corresponding link group nodes *
|
|
1822
|
+
*/
|
|
1823
|
+
class LinkGroupNodeSplitAction extends ModifyContentAction {
|
|
1824
|
+
constructor(splittedTextNodes) {
|
|
1825
|
+
super();
|
|
1826
|
+
this.type = exports.ModifyContentActionType.LINK_GROUP_NODE_SPLIT;
|
|
1827
|
+
this.splittedTextNodes = splittedTextNodes;
|
|
1828
|
+
}
|
|
1559
1829
|
}
|
|
1560
1830
|
|
|
1561
1831
|
/**
|
|
@@ -1586,7 +1856,11 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
|
|
|
1586
1856
|
return this.insertNewNode(startOffset, target);
|
|
1587
1857
|
}
|
|
1588
1858
|
if (this.shouldSplitSelection(selectionRangeAnnotation.range)) {
|
|
1589
|
-
|
|
1859
|
+
const splittedTextNodes = this.splitTextNode(selectionRangeAnnotation.range, target);
|
|
1860
|
+
if (item.annotationMap.has('LINK')) {
|
|
1861
|
+
item.apply(new LinkGroupNodeSplitAction(splittedTextNodes));
|
|
1862
|
+
}
|
|
1863
|
+
return splittedTextNodes;
|
|
1590
1864
|
}
|
|
1591
1865
|
else {
|
|
1592
1866
|
this.setApplyTargetNode(target);
|
|
@@ -1689,6 +1963,25 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
|
|
|
1689
1963
|
}
|
|
1690
1964
|
}
|
|
1691
1965
|
|
|
1966
|
+
/**
|
|
1967
|
+
* Action to toggle bold annotation
|
|
1968
|
+
*/
|
|
1969
|
+
class BoldAnnotationAction extends TextSplittableAction {
|
|
1970
|
+
constructor(bold) {
|
|
1971
|
+
super();
|
|
1972
|
+
this.isFlushable = true;
|
|
1973
|
+
this.bold = bold;
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* Converts the action to an annotation
|
|
1977
|
+
*
|
|
1978
|
+
* @returns {BoldAnnotation} the annotation
|
|
1979
|
+
*/
|
|
1980
|
+
toAnnotation() {
|
|
1981
|
+
return new BoldAnnotation(this.bold);
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1692
1985
|
/**
|
|
1693
1986
|
* Annotation to host which annotations will be clear formatting
|
|
1694
1987
|
*/
|
|
@@ -1703,6 +1996,7 @@ class ClearFormattingAnnotation extends Annotation {
|
|
|
1703
1996
|
exports.NodeAnnotationTypeEnum.STRIKETHROUGH,
|
|
1704
1997
|
exports.NodeAnnotationTypeEnum.TEXT_COLOR,
|
|
1705
1998
|
exports.NodeAnnotationTypeEnum.CODE,
|
|
1999
|
+
exports.CommonAnnotationTypeEnum.CUSTOM_STYLE,
|
|
1706
2000
|
];
|
|
1707
2001
|
}
|
|
1708
2002
|
}
|
|
@@ -1763,16 +2057,36 @@ class DeleteNodeAnnotationAction extends AnnotationAction {
|
|
|
1763
2057
|
}
|
|
1764
2058
|
}
|
|
1765
2059
|
|
|
2060
|
+
/**
|
|
2061
|
+
* Action to toggle the italic annotation
|
|
2062
|
+
*/
|
|
2063
|
+
class ItalicAnnotationAction extends TextSplittableAction {
|
|
2064
|
+
constructor(italic) {
|
|
2065
|
+
super();
|
|
2066
|
+
this.isFlushable = true;
|
|
2067
|
+
this.italic = italic;
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Converts the action to an annotation
|
|
2071
|
+
*
|
|
2072
|
+
* @returns {ItalicAnnotation} The annotation
|
|
2073
|
+
*/
|
|
2074
|
+
toAnnotation() {
|
|
2075
|
+
return new ItalicAnnotation(this.italic);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
|
|
1766
2079
|
/**
|
|
1767
2080
|
* Action to toggle link annotation
|
|
1768
2081
|
*/
|
|
1769
2082
|
class LinkAnnotationAction extends TextSplittableAction {
|
|
1770
|
-
constructor({ link, newText, needMergeNode, doSplit, }) {
|
|
2083
|
+
constructor({ link, newText, needMergeNode, doSplit, type, }) {
|
|
1771
2084
|
super();
|
|
1772
2085
|
this.isFlushable = true;
|
|
1773
2086
|
this.link = link;
|
|
1774
2087
|
this.needMergeNode = needMergeNode;
|
|
1775
2088
|
this.newText = newText;
|
|
2089
|
+
this.type = type;
|
|
1776
2090
|
if (typeGuard.isNonNullable(doSplit)) {
|
|
1777
2091
|
this.doSplit = doSplit;
|
|
1778
2092
|
}
|
|
@@ -1787,6 +2101,44 @@ class LinkAnnotationAction extends TextSplittableAction {
|
|
|
1787
2101
|
}
|
|
1788
2102
|
}
|
|
1789
2103
|
|
|
2104
|
+
/**
|
|
2105
|
+
* Action to toggle the strikethrough annotation
|
|
2106
|
+
*/
|
|
2107
|
+
class StrikethroughAnnotationAction extends TextSplittableAction {
|
|
2108
|
+
constructor(underline) {
|
|
2109
|
+
super();
|
|
2110
|
+
this.isFlushable = true;
|
|
2111
|
+
this.strikethrough = underline;
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Converts the action to an annotation
|
|
2115
|
+
*
|
|
2116
|
+
* @returns {Annotation} the annotation
|
|
2117
|
+
*/
|
|
2118
|
+
toAnnotation() {
|
|
2119
|
+
return new StrikethroughAnnotation(this.strikethrough);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
/**
|
|
2124
|
+
* Action to toggle the underline annotation
|
|
2125
|
+
*/
|
|
2126
|
+
class UnderlineAnnotationAction extends TextSplittableAction {
|
|
2127
|
+
constructor(underline) {
|
|
2128
|
+
super();
|
|
2129
|
+
this.isFlushable = true;
|
|
2130
|
+
this.underline = underline;
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* Converts the action to an annotation
|
|
2134
|
+
*
|
|
2135
|
+
* @returns {Annotation} the annotation
|
|
2136
|
+
*/
|
|
2137
|
+
toAnnotation() {
|
|
2138
|
+
return new UnderlineAnnotation(this.underline);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
|
|
1790
2142
|
/**
|
|
1791
2143
|
* The current strategy used to modify the text node annotation map.
|
|
1792
2144
|
*/
|
|
@@ -1814,44 +2166,319 @@ class NodeUpdateAnnotationMapStrategy extends ActionHandleStrategy {
|
|
|
1814
2166
|
if (typeGuard.isNonNullable(action.newText)) {
|
|
1815
2167
|
target.text = action.newText;
|
|
1816
2168
|
}
|
|
1817
|
-
target.parent.apply(new LinkGroupAnnotationAction(action.link.groupKey, [target]));
|
|
2169
|
+
target.parent.apply(new LinkGroupAnnotationAction(action.link.groupKey, [target], action.type));
|
|
1818
2170
|
}
|
|
1819
2171
|
if (action instanceof CodeAnnotationAction) {
|
|
1820
2172
|
this.handleAction(new ClearFormattingAnnotationAction(), target);
|
|
1821
2173
|
}
|
|
2174
|
+
if (action instanceof BoldAnnotationAction) {
|
|
2175
|
+
this.updateCustomStyleAnnotation(target, ['fontWeight']);
|
|
2176
|
+
}
|
|
2177
|
+
if (action instanceof ItalicAnnotationAction) {
|
|
2178
|
+
this.updateCustomStyleAnnotation(target, ['fontStyle']);
|
|
2179
|
+
}
|
|
2180
|
+
if (action instanceof UnderlineAnnotationAction ||
|
|
2181
|
+
action instanceof StrikethroughAnnotationAction) {
|
|
2182
|
+
this.updateCustomStyleAnnotation(target, ['textDecoration']);
|
|
2183
|
+
}
|
|
1822
2184
|
target.annotationMap.set(annotation.type, annotation);
|
|
1823
2185
|
return;
|
|
1824
2186
|
}
|
|
1825
2187
|
}
|
|
1826
2188
|
}
|
|
1827
2189
|
|
|
2190
|
+
/**
|
|
2191
|
+
* Delete the corresponding link group according to the text node *
|
|
2192
|
+
*/
|
|
2193
|
+
class DeleteLinkGroupAction extends ModifyContentAction {
|
|
2194
|
+
constructor() {
|
|
2195
|
+
super(...arguments);
|
|
2196
|
+
this.type = exports.ModifyContentActionType.DELETE_LINK_GROUP;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Update the editor text node text content strategy.
|
|
2202
|
+
*/
|
|
2203
|
+
class NodeUpdateTextStrategy extends ActionHandleStrategy {
|
|
2204
|
+
/**
|
|
2205
|
+
* Updates the text content of a node and unlink the node if it is a link node and the text is deleted.
|
|
2206
|
+
*
|
|
2207
|
+
* @param {UpdateTextAction} action - The update text action instance.
|
|
2208
|
+
* @param {RTETextNode} target - The text node instance which need update the text.
|
|
2209
|
+
*/
|
|
2210
|
+
handleAction(action, target) {
|
|
2211
|
+
target.text = action.newTextContent;
|
|
2212
|
+
// The link node should unlink when delete all text
|
|
2213
|
+
if (!target.text && target.annotationMap.has('LINK')) {
|
|
2214
|
+
target.apply(new DeleteLinkGroupAction());
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
/**
|
|
2220
|
+
* Update the text node property text action
|
|
2221
|
+
*
|
|
2222
|
+
* @example textNode.apply(new UpdateTextAction(newText))
|
|
2223
|
+
*/
|
|
2224
|
+
class UpdateTextAction extends ModifyContentAction {
|
|
2225
|
+
constructor(text) {
|
|
2226
|
+
super();
|
|
2227
|
+
this.type = exports.ModifyContentActionType.UPDATE_TEXT;
|
|
2228
|
+
this.newTextContent = '';
|
|
2229
|
+
this.newTextContent = text;
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/**
|
|
2234
|
+
* Replaces the rich text node selected text strategy.
|
|
2235
|
+
*/
|
|
2236
|
+
class NodeReplaceSelectedTextStrategy extends ActionHandleStrategy {
|
|
2237
|
+
/**
|
|
2238
|
+
* @inheritDoc
|
|
2239
|
+
*/
|
|
2240
|
+
handleAction(action, target) {
|
|
2241
|
+
this.replaceSelectedText(action.textToBeInsert, action.currentRange, target);
|
|
2242
|
+
}
|
|
2243
|
+
/**
|
|
2244
|
+
* Replaces the selected text within a given range with a new text in a TypeScript class.
|
|
2245
|
+
*
|
|
2246
|
+
* @param {string} text - The new text that will replace the currently selected text within the specified range.
|
|
2247
|
+
* @param {RTERange} currentRange - A range of text within a Rich Text Editor (RTE).
|
|
2248
|
+
* @param {RTETextNode} target - The RTE text node instance.
|
|
2249
|
+
*/
|
|
2250
|
+
replaceSelectedText(text, currentRange, target) {
|
|
2251
|
+
if (currentRange && currentRange.startContainer && currentRange.endContainer) {
|
|
2252
|
+
const { startContainer, endContainer, startOffset, endOffset } = currentRange;
|
|
2253
|
+
let newText = target.text;
|
|
2254
|
+
if (startContainer === endContainer && startOffset === endOffset && text) {
|
|
2255
|
+
newText = target.text.slice(0, startOffset) + text + target.text.slice(startOffset);
|
|
2256
|
+
}
|
|
2257
|
+
else {
|
|
2258
|
+
const startNode = startContainer.parentElement;
|
|
2259
|
+
const endNode = endContainer.parentElement;
|
|
2260
|
+
const startItemDto = startNode && stateEntityRenderingRegistry.getEntityByDOM(startNode);
|
|
2261
|
+
const endItemDto = endNode && stateEntityRenderingRegistry.getEntityByDOM(endNode);
|
|
2262
|
+
let startIndex = 0, endIndex = target.text.length;
|
|
2263
|
+
if (startItemDto && startItemDto === target) {
|
|
2264
|
+
startIndex = startOffset;
|
|
2265
|
+
endIndex = startContainer === endContainer ? endOffset : endIndex;
|
|
2266
|
+
}
|
|
2267
|
+
else if (endItemDto && endItemDto === target) {
|
|
2268
|
+
endIndex = endOffset;
|
|
2269
|
+
}
|
|
2270
|
+
newText = target.text.slice(0, startIndex) + text + target.text.slice(endIndex);
|
|
2271
|
+
}
|
|
2272
|
+
target.apply(new UpdateTextAction(newText));
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
/**
|
|
2278
|
+
* Inline HTML annotation
|
|
2279
|
+
*/
|
|
2280
|
+
class InlineHtmlAnnotation extends Annotation {
|
|
2281
|
+
constructor(htmlTag) {
|
|
2282
|
+
super();
|
|
2283
|
+
this.type = exports.NodeAnnotationTypeEnum.INLINE_HTML;
|
|
2284
|
+
this.htmlTag = htmlTag;
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Generate the map item for the annotation
|
|
2288
|
+
*
|
|
2289
|
+
* @param {VegaInlineHtmlSchema} inlineHtml - Inline HTML node
|
|
2290
|
+
* @returns {[NodeAnnotationTypeEnum.INLINE_HTML, InlineHtmlAnnotation]} Map item for the annotation
|
|
2291
|
+
*/
|
|
2292
|
+
static from(inlineHtml) {
|
|
2293
|
+
const { htmlTag, child, customStyle, customClass, customAttribute } = inlineHtml;
|
|
2294
|
+
const inlineHtmlAnnotation = new InlineHtmlAnnotation(htmlTag);
|
|
2295
|
+
inlineHtmlAnnotation.child = child ? InlineHtmlAnnotation.from(child)[1] : undefined;
|
|
2296
|
+
inlineHtmlAnnotation.customAttribute = customAttribute
|
|
2297
|
+
? CustomAttributeAnnotation.from(customAttribute)[1]
|
|
2298
|
+
: undefined;
|
|
2299
|
+
inlineHtmlAnnotation.customClass = customClass
|
|
2300
|
+
? CustomClassAnnotation.from(customClass)[1]
|
|
2301
|
+
: undefined;
|
|
2302
|
+
inlineHtmlAnnotation.customStyle = customStyle
|
|
2303
|
+
? CustomStyleAnnotation.from(customStyle)[1]
|
|
2304
|
+
: undefined;
|
|
2305
|
+
return [exports.NodeAnnotationTypeEnum.INLINE_HTML, inlineHtmlAnnotation];
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Create a new inline HTML annotation
|
|
2309
|
+
*
|
|
2310
|
+
* @returns {InlineHtmlAnnotation} - Inline HTML annotation
|
|
2311
|
+
*/
|
|
2312
|
+
clone() {
|
|
2313
|
+
var _a, _b, _c, _d;
|
|
2314
|
+
const inlineHtmlAnnotation = new InlineHtmlAnnotation(this.htmlTag);
|
|
2315
|
+
inlineHtmlAnnotation.child = (_a = this.child) === null || _a === void 0 ? void 0 : _a.clone();
|
|
2316
|
+
inlineHtmlAnnotation.customAttribute = (_b = this.customAttribute) === null || _b === void 0 ? void 0 : _b.clone();
|
|
2317
|
+
inlineHtmlAnnotation.customClass = (_c = this.customClass) === null || _c === void 0 ? void 0 : _c.clone();
|
|
2318
|
+
inlineHtmlAnnotation.customStyle = (_d = this.customStyle) === null || _d === void 0 ? void 0 : _d.clone();
|
|
2319
|
+
return inlineHtmlAnnotation;
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Generate the JSON representation of the annotation
|
|
2323
|
+
*
|
|
2324
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
2325
|
+
*/
|
|
2326
|
+
toJSON() {
|
|
2327
|
+
var _a, _b, _c, _d;
|
|
2328
|
+
return {
|
|
2329
|
+
inlineHtml: object.cleanObject({
|
|
2330
|
+
htmlTag: this.htmlTag,
|
|
2331
|
+
child: (_a = this.child) === null || _a === void 0 ? void 0 : _a.toJSON().inlineHtml,
|
|
2332
|
+
customAttribute: (_b = this.customAttribute) === null || _b === void 0 ? void 0 : _b.toJSON().customAttribute,
|
|
2333
|
+
customClass: (_c = this.customClass) === null || _c === void 0 ? void 0 : _c.toJSON().customClass,
|
|
2334
|
+
customStyle: (_d = this.customStyle) === null || _d === void 0 ? void 0 : _d.toJSON().customStyle,
|
|
2335
|
+
}),
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Split the link nodes in the corresponding link group
|
|
2342
|
+
*/
|
|
2343
|
+
class LinkGroupNodeSplitStrategy extends ActionHandleStrategy {
|
|
2344
|
+
/**
|
|
2345
|
+
* Split the text node.
|
|
2346
|
+
*
|
|
2347
|
+
* @param {LinkGroupNodeSplitAction} action - The split action.
|
|
2348
|
+
* @param {RTETextNode} target - The text node that need to be splitted.
|
|
2349
|
+
*/
|
|
2350
|
+
handleAction(action, target) {
|
|
2351
|
+
const linkGroupAnnotation = target.parent.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2352
|
+
if (linkGroupAnnotation) {
|
|
2353
|
+
const currentGroupKey = target.annotationMap.get('LINK').link
|
|
2354
|
+
.groupKey;
|
|
2355
|
+
const currentLinkGroup = linkGroupAnnotation.linkGroups.get(currentGroupKey);
|
|
2356
|
+
if (currentLinkGroup) {
|
|
2357
|
+
const index = currentLinkGroup.indexOf(target);
|
|
2358
|
+
if (index !== -1) {
|
|
2359
|
+
/* istanbul ignore next */
|
|
2360
|
+
currentLinkGroup.splice(index, 1, ...(Array.isArray(action.splittedTextNodes)
|
|
2361
|
+
? action.splittedTextNodes
|
|
2362
|
+
: [action.splittedTextNodes]));
|
|
2363
|
+
linkGroupAnnotation.linkGroups.set(currentGroupKey, currentLinkGroup);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
/**
|
|
2371
|
+
* Delete the corresponding link group
|
|
2372
|
+
*/
|
|
2373
|
+
class DeleteLinkGroupStrategy extends ActionHandleStrategy {
|
|
2374
|
+
/**
|
|
2375
|
+
* Delete the corresponding link group
|
|
2376
|
+
*
|
|
2377
|
+
* @param {DeleteLinkGroupAction} _action - The delete link group action.
|
|
2378
|
+
* @param {RTETextNode} target - The text node that need to remove link annotation.
|
|
2379
|
+
*/
|
|
2380
|
+
handleAction(_action, target) {
|
|
2381
|
+
const linkGroupAnnotation = target.parent.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2382
|
+
if (linkGroupAnnotation) {
|
|
2383
|
+
const currentGroupKey = target.annotationMap.get(exports.NodeAnnotationTypeEnum.LINK).link.groupKey;
|
|
2384
|
+
const currentLinkGroup = linkGroupAnnotation.linkGroups.get(currentGroupKey);
|
|
2385
|
+
if (currentLinkGroup) {
|
|
2386
|
+
const index = currentLinkGroup.indexOf(target);
|
|
2387
|
+
if (index !== -1) {
|
|
2388
|
+
currentLinkGroup.splice(index, 1);
|
|
2389
|
+
}
|
|
2390
|
+
if (currentLinkGroup.length === 0) {
|
|
2391
|
+
linkGroupAnnotation.linkGroups.delete(currentGroupKey);
|
|
2392
|
+
}
|
|
2393
|
+
if (linkGroupAnnotation.linkGroups.size === 0) {
|
|
2394
|
+
target.parent.annotationMap.delete(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
target.annotationMap.delete(exports.NodeAnnotationTypeEnum.LINK);
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
/**
|
|
2403
|
+
* Annotation to make text as plain text
|
|
2404
|
+
*/
|
|
2405
|
+
class PlainTextAnnotation extends NodeAnnotation {
|
|
2406
|
+
constructor(plainText) {
|
|
2407
|
+
super();
|
|
2408
|
+
this.type = exports.NodeAnnotationTypeEnum.PLAIN_TEXT;
|
|
2409
|
+
this.plainText = true;
|
|
2410
|
+
this.plainText = plainText;
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* @inheritDoc
|
|
2414
|
+
*/
|
|
2415
|
+
static from(plainText) {
|
|
2416
|
+
return [exports.NodeAnnotationTypeEnum.PLAIN_TEXT, new PlainTextAnnotation(plainText)];
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* @inheritDoc
|
|
2420
|
+
*/
|
|
2421
|
+
clone() {
|
|
2422
|
+
return new PlainTextAnnotation(this.plainText);
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* @inheritDoc
|
|
2426
|
+
*/
|
|
2427
|
+
renderClass() {
|
|
2428
|
+
return undefined;
|
|
2429
|
+
}
|
|
2430
|
+
/**
|
|
2431
|
+
* @inheritDoc
|
|
2432
|
+
*/
|
|
2433
|
+
renderStyle() {
|
|
2434
|
+
return undefined;
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* @inheritDoc
|
|
2438
|
+
*/
|
|
2439
|
+
toJSON() {
|
|
2440
|
+
return { plainText: this.plainText };
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
|
|
1828
2444
|
/**
|
|
1829
2445
|
* Text node
|
|
1830
2446
|
*/
|
|
1831
2447
|
class RTETextNode extends RTENode {
|
|
1832
2448
|
constructor(id, text, parentBlock, annotationMap) {
|
|
1833
2449
|
super(id, annotationMap);
|
|
1834
|
-
this.type = NodeTypeEnum.TEXT;
|
|
2450
|
+
this.type = exports.NodeTypeEnum.TEXT;
|
|
1835
2451
|
this.parent = parentBlock;
|
|
1836
2452
|
this.text = text;
|
|
2453
|
+
this.registerModifyStrategy();
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Determines if the given HTML tag is supported by the RTETextNode.
|
|
2457
|
+
*
|
|
2458
|
+
* @param {string} tag - The HTML tag to check.
|
|
2459
|
+
* @returns {boolean} `true` if the tag is supported, otherwise `false`.
|
|
2460
|
+
*/
|
|
2461
|
+
static supportsHtmlTag(tag) {
|
|
2462
|
+
return ['span', 'code'].includes(tag);
|
|
1837
2463
|
}
|
|
1838
2464
|
/**
|
|
1839
2465
|
* Creates an RTETextNode from a VegaRTETextNode with annotations and a parent RTETextBlock.
|
|
1840
2466
|
*
|
|
1841
2467
|
* @param {VegaRTETextNode} richText - A rich text node
|
|
1842
2468
|
* @param {RTETextBlock} parentBlock - Parent block
|
|
2469
|
+
* @param {VegaRTETransformOptions} options - Optional transformation options.
|
|
1843
2470
|
* @returns {RTETextNode} an RTETextNode
|
|
1844
2471
|
*/
|
|
1845
|
-
static from(richText, parentBlock) {
|
|
2472
|
+
static from(richText, parentBlock, options = { autoMatchFormat: true }) {
|
|
1846
2473
|
const textNode = new RTETextNode(richText.id, richText.text, parentBlock);
|
|
1847
2474
|
const { annotations } = richText;
|
|
1848
2475
|
if (annotations) {
|
|
1849
2476
|
textNode.annotationMap = new Map(Object.keys(annotations)
|
|
1850
2477
|
.map((type) => {
|
|
1851
|
-
if (annotations.link) {
|
|
1852
|
-
parentBlock.apply(new LinkGroupAnnotationAction(annotations.link.groupKey, [textNode]));
|
|
2478
|
+
if (type === 'link' && annotations.link && parentBlock) {
|
|
2479
|
+
parentBlock.apply(new LinkGroupAnnotationAction(annotations.link.groupKey, [textNode], 'link'));
|
|
1853
2480
|
}
|
|
1854
|
-
return this.createAnnotationEntity(type, annotations[type]);
|
|
2481
|
+
return this.createAnnotationEntity(type, annotations[type], options);
|
|
1855
2482
|
})
|
|
1856
2483
|
.filter(typeGuard.isNonNullable));
|
|
1857
2484
|
}
|
|
@@ -1862,10 +2489,12 @@ class RTETextNode extends RTENode {
|
|
|
1862
2489
|
*
|
|
1863
2490
|
* @param {keyof VegaRTETextAnnotations} type - The key of the type.
|
|
1864
2491
|
* @param {unknown} value - The value that will be used to create the specific type of annotation entity based on the `type` provided.
|
|
2492
|
+
* @param {VegaRTETransformOptions} [options] - Optional transformation options that may be used for creating the annotation entity.
|
|
1865
2493
|
* @returns {Nullable<[RTENodeAnnotationMapKey, RTENodeAnnotationMapValue]>} Returning a nullable tuple containing a key and a
|
|
1866
2494
|
* value from the `RTENodeAnnotationMapKey` and `RTENodeAnnotationMapValue` types.
|
|
1867
2495
|
*/
|
|
1868
|
-
static createAnnotationEntity(type, value) {
|
|
2496
|
+
static createAnnotationEntity(type, value, options) {
|
|
2497
|
+
const autoMatchFormat = !!(options && options.autoMatchFormat);
|
|
1869
2498
|
switch (type) {
|
|
1870
2499
|
case 'bold':
|
|
1871
2500
|
return BoldAnnotation.from(value);
|
|
@@ -1876,24 +2505,40 @@ class RTETextNode extends RTENode {
|
|
|
1876
2505
|
case 'strikethrough':
|
|
1877
2506
|
return StrikethroughAnnotation.from(value);
|
|
1878
2507
|
case 'code':
|
|
1879
|
-
return CodeAnnotation.from(value);
|
|
2508
|
+
return CodeAnnotation.from(value, autoMatchFormat);
|
|
1880
2509
|
case 'textColor':
|
|
1881
2510
|
return TextColorAnnotation.from(value);
|
|
1882
2511
|
case 'link':
|
|
1883
|
-
return LinkAnnotation.from(value);
|
|
2512
|
+
return LinkAnnotation.from(value, autoMatchFormat);
|
|
2513
|
+
case 'inlineHtml': {
|
|
2514
|
+
return InlineHtmlAnnotation.from(value);
|
|
2515
|
+
}
|
|
2516
|
+
case 'plainText': {
|
|
2517
|
+
return PlainTextAnnotation.from(value);
|
|
2518
|
+
}
|
|
1884
2519
|
}
|
|
2520
|
+
return RTENode.createAnnotationEntity(type, value);
|
|
1885
2521
|
}
|
|
1886
2522
|
/**
|
|
1887
2523
|
* @inheritDoc
|
|
1888
2524
|
*/
|
|
1889
2525
|
toJSON() {
|
|
1890
2526
|
const annotations = Array.from(this.annotationMap.values())
|
|
1891
|
-
.filter((annotation) => annotation instanceof NodeAnnotation
|
|
2527
|
+
.filter((annotation) => annotation instanceof NodeAnnotation ||
|
|
2528
|
+
annotation instanceof CommonAnnotation ||
|
|
2529
|
+
annotation instanceof InlineHtmlAnnotation)
|
|
1892
2530
|
.reduce((record, annotation) => {
|
|
1893
2531
|
return Object.assign(Object.assign({}, record), annotation.toJSON());
|
|
1894
2532
|
}, {});
|
|
1895
2533
|
return Object.assign(Object.assign({ id: this.id }, (Object.keys(annotations).length > 0 ? { annotations } : {})), { type: 'text', text: this.text });
|
|
1896
2534
|
}
|
|
2535
|
+
/**
|
|
2536
|
+
* @inheritDoc
|
|
2537
|
+
*/
|
|
2538
|
+
toHtml() {
|
|
2539
|
+
const inlineHtmlAnnotation = this.getAnnotationByType(exports.NodeAnnotationTypeEnum.INLINE_HTML);
|
|
2540
|
+
return inlineHtmlAnnotation ? this.renderWithWrapperStr(inlineHtmlAnnotation) : this.renderTextStr();
|
|
2541
|
+
}
|
|
1897
2542
|
/**
|
|
1898
2543
|
* Creates a new RTETextNode with the specified text and copies the parent block and annotation map from the original node.
|
|
1899
2544
|
*
|
|
@@ -1901,13 +2546,15 @@ class RTETextNode extends RTENode {
|
|
|
1901
2546
|
* @returns {RTETextNode} An new RTETextNode
|
|
1902
2547
|
*/
|
|
1903
2548
|
cloneWithText(text) {
|
|
1904
|
-
|
|
2549
|
+
const cloned = new RTETextNode(createPublicApiRuntimeMetricsSlimmer.generateUUID(), text, this.parent, super.cloneAnnotations());
|
|
2550
|
+
return cloned;
|
|
1905
2551
|
}
|
|
1906
2552
|
/**
|
|
1907
2553
|
* @inheritDoc
|
|
1908
2554
|
*/
|
|
1909
2555
|
clone() {
|
|
1910
|
-
|
|
2556
|
+
const cloned = new RTETextNode(this.id, this.text, this.parent, super.cloneAnnotations());
|
|
2557
|
+
return cloned;
|
|
1911
2558
|
}
|
|
1912
2559
|
/**
|
|
1913
2560
|
* Checks if a node is empty
|
|
@@ -1917,13 +2564,67 @@ class RTETextNode extends RTENode {
|
|
|
1917
2564
|
isEmpty() {
|
|
1918
2565
|
return !this.text || this.text === ZERO_WIDTH_SPACE || this.text === '\n';
|
|
1919
2566
|
}
|
|
2567
|
+
/**
|
|
2568
|
+
* @inheritDoc
|
|
2569
|
+
*/
|
|
2570
|
+
isTextNode() {
|
|
2571
|
+
return true;
|
|
2572
|
+
}
|
|
2573
|
+
/**
|
|
2574
|
+
* @inheritDoc
|
|
2575
|
+
*/
|
|
2576
|
+
getRangeEndOffset() {
|
|
2577
|
+
if (!this.isContentEditable() && this.parent) {
|
|
2578
|
+
const parent = this.parent;
|
|
2579
|
+
const nodeIndex = parent.children.indexOf(this);
|
|
2580
|
+
return nodeIndex + 1; // place the cursor after the non-editable text node;
|
|
2581
|
+
}
|
|
2582
|
+
return this.text === '\n' ? 0 : this.text.length;
|
|
2583
|
+
}
|
|
2584
|
+
/**
|
|
2585
|
+
* @inheritDoc
|
|
2586
|
+
*/
|
|
2587
|
+
getRangeContainer() {
|
|
2588
|
+
const element = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
2589
|
+
if (element) {
|
|
2590
|
+
if (this.isContentEditable()) {
|
|
2591
|
+
return element.firstChild;
|
|
2592
|
+
}
|
|
2593
|
+
else {
|
|
2594
|
+
return element.parentElement;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
/**
|
|
2599
|
+
* @inheritDoc
|
|
2600
|
+
*/
|
|
2601
|
+
isContentEditable() {
|
|
2602
|
+
return true;
|
|
2603
|
+
}
|
|
2604
|
+
/**
|
|
2605
|
+
* Registers the action strategies for the RTETextNode.
|
|
2606
|
+
*/
|
|
2607
|
+
registerModifyStrategy() {
|
|
2608
|
+
const dtoClassName = this.constructor.name;
|
|
2609
|
+
if (!RTETextNode.registerActionStrategyStatus[dtoClassName]) {
|
|
2610
|
+
if (this.isContentEditable()) {
|
|
2611
|
+
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.UPDATE_TEXT, dtoClassName, new NodeUpdateTextStrategy());
|
|
2612
|
+
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.REPLACE_SELECTED_TEXT, dtoClassName, new NodeReplaceSelectedTextStrategy());
|
|
2613
|
+
ActionHandleStrategyRegistry.register(TextSplittableAction.name, dtoClassName, new NodeSplitTextStrategy());
|
|
2614
|
+
}
|
|
2615
|
+
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINK_GROUP_NODE_SPLIT, dtoClassName, new LinkGroupNodeSplitStrategy());
|
|
2616
|
+
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_LINK_GROUP, dtoClassName, new DeleteLinkGroupStrategy());
|
|
2617
|
+
ActionHandleStrategyRegistry.register(AnnotationAction.name, dtoClassName, new NodeUpdateAnnotationMapStrategy());
|
|
2618
|
+
RTETextNode.registerActionStrategyStatus[dtoClassName] = true;
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
1920
2621
|
/**
|
|
1921
2622
|
* @inheritDoc
|
|
1922
2623
|
*/
|
|
1923
2624
|
doAnnotationActionApply(action) {
|
|
1924
2625
|
const selectionRangeAnnotation = this.getAnnotationByType(exports.InternalAnnotationTypeEnum.SELECTION_RANGE);
|
|
1925
2626
|
if (action instanceof TextSplittableAction && action.doSplit && selectionRangeAnnotation) {
|
|
1926
|
-
const splitStrategy = ActionHandleStrategyRegistry.get(TextSplittableAction.name,
|
|
2627
|
+
const splitStrategy = ActionHandleStrategyRegistry.get(TextSplittableAction.name, this.constructor.name);
|
|
1927
2628
|
if (splitStrategy) {
|
|
1928
2629
|
const newNode = splitStrategy.execute(action, this);
|
|
1929
2630
|
if (newNode) {
|
|
@@ -1934,7 +2635,9 @@ class RTETextNode extends RTENode {
|
|
|
1934
2635
|
else {
|
|
1935
2636
|
this.applyActionToNode(this, action);
|
|
1936
2637
|
}
|
|
1937
|
-
this.parent.mergeNodes
|
|
2638
|
+
if (typeof this.parent.mergeNodes === 'function') {
|
|
2639
|
+
this.parent.mergeNodes(action);
|
|
2640
|
+
}
|
|
1938
2641
|
}
|
|
1939
2642
|
/**
|
|
1940
2643
|
* @inheritDoc
|
|
@@ -1978,13 +2681,76 @@ class RTETextNode extends RTENode {
|
|
|
1978
2681
|
}
|
|
1979
2682
|
}
|
|
1980
2683
|
}
|
|
2684
|
+
/**
|
|
2685
|
+
* Render the text node with the inline HTML wrapper.
|
|
2686
|
+
*
|
|
2687
|
+
* @param {VegaInlineHtmlSchema} inlineHtmlNode - The inline HTML schema to wrap the text node.
|
|
2688
|
+
* @returns {string} The HTML string representation of the text node wrapped with the inline HTML.
|
|
2689
|
+
*/
|
|
2690
|
+
renderWithWrapperStr(inlineHtmlNode) {
|
|
2691
|
+
const { htmlTag, customAttribute, customClass, customStyle, child } = inlineHtmlNode;
|
|
2692
|
+
const attrs = [
|
|
2693
|
+
...((customAttribute === null || customAttribute === void 0 ? void 0 : customAttribute.toString()) || []),
|
|
2694
|
+
customClass === null || customClass === void 0 ? void 0 : customClass.toString(),
|
|
2695
|
+
customStyle === null || customStyle === void 0 ? void 0 : customStyle.toString(),
|
|
2696
|
+
].filter(typeGuard.isNonNullable);
|
|
2697
|
+
const attrStr = attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
|
|
2698
|
+
if (!child) {
|
|
2699
|
+
return `<${htmlTag}${attrStr}>${this.renderTextStr()}</${htmlTag}>`;
|
|
2700
|
+
}
|
|
2701
|
+
return `<${htmlTag}${attrStr}>${this.renderWithWrapperStr(child)}</${htmlTag}>`;
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Generates the HTML representation of the text node.
|
|
2705
|
+
*
|
|
2706
|
+
* @returns {string} The HTML string representation of the text node.
|
|
2707
|
+
*/
|
|
2708
|
+
renderTextStr() {
|
|
2709
|
+
var _a;
|
|
2710
|
+
const NodeTag = ((_a = this.getAnnotationByType(exports.NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
|
|
2711
|
+
? 'code'
|
|
2712
|
+
: 'span';
|
|
2713
|
+
const attrStr = super.generateAttributeString();
|
|
2714
|
+
// If the text contains a newline character, we need to replace it with a <br> tag.
|
|
2715
|
+
if (this.text === '\n') {
|
|
2716
|
+
return `<br>`;
|
|
2717
|
+
}
|
|
2718
|
+
return this.shouldRenderAsPlainText() ? this.text : `<${NodeTag}${attrStr}>${this.text}</${NodeTag}>`;
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* Determines if the text node should be rendered as plain text.
|
|
2722
|
+
*
|
|
2723
|
+
* @returns {boolean} `true` if the text node should be rendered as plain text, otherwise `false`.
|
|
2724
|
+
*/
|
|
2725
|
+
shouldRenderAsPlainText() {
|
|
2726
|
+
const plainTextAnnotation = super.getAnnotationByType(exports.NodeAnnotationTypeEnum.PLAIN_TEXT);
|
|
2727
|
+
if (plainTextAnnotation) {
|
|
2728
|
+
return (plainTextAnnotation.plainText &&
|
|
2729
|
+
Array.from(this.annotationMap.values()).filter((annotation) => (annotation instanceof NodeAnnotation &&
|
|
2730
|
+
!(annotation instanceof LinkAnnotation) &&
|
|
2731
|
+
!(annotation instanceof PlainTextAnnotation)) ||
|
|
2732
|
+
annotation instanceof CommonAnnotation).length === 0);
|
|
2733
|
+
}
|
|
2734
|
+
else {
|
|
2735
|
+
return false;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
RTETextNode.registerActionStrategyStatus = {};
|
|
2740
|
+
RTETextNode.htmlTag = 'span';
|
|
2741
|
+
|
|
2742
|
+
/**
|
|
2743
|
+
* Append children to a block or rte content
|
|
2744
|
+
*
|
|
2745
|
+
* @example parent.apply(new AppendChildrenAction([newChildren]))
|
|
2746
|
+
*/
|
|
2747
|
+
class AppendChildrenAction extends ModifyContentAction {
|
|
2748
|
+
constructor(childNodes) {
|
|
2749
|
+
super();
|
|
2750
|
+
this.type = exports.ModifyContentActionType.APPEND_CHILDREN;
|
|
2751
|
+
this.entityToBeAppended = childNodes;
|
|
2752
|
+
}
|
|
1981
2753
|
}
|
|
1982
|
-
(() => {
|
|
1983
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.UPDATE_TEXT, RTETextNode.name, new NodeUpdateTextStrategy());
|
|
1984
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.REPLACE_SELECTED_TEXT, RTETextNode.name, new NodeReplaceSelectedTextStrategy());
|
|
1985
|
-
ActionHandleStrategyRegistry.register(TextSplittableAction.name, RTETextNode.name, new NodeSplitTextStrategy());
|
|
1986
|
-
ActionHandleStrategyRegistry.register(AnnotationAction.name, RTETextNode.name, new NodeUpdateAnnotationMapStrategy());
|
|
1987
|
-
})();
|
|
1988
2754
|
|
|
1989
2755
|
/**
|
|
1990
2756
|
* Text style annotation
|
|
@@ -2019,44 +2785,106 @@ class TextStyleAnnotation extends BlockAnnotation {
|
|
|
2019
2785
|
return new TextStyleAnnotation(this.textStyle);
|
|
2020
2786
|
}
|
|
2021
2787
|
/**
|
|
2022
|
-
*
|
|
2023
|
-
|
|
2024
|
-
|
|
2788
|
+
* @inheritDoc
|
|
2789
|
+
*/
|
|
2790
|
+
renderClass(options) {
|
|
2791
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
2792
|
+
return null;
|
|
2793
|
+
return this.textStyle ? `v-rte--text-style-${this.textStyle}` : null;
|
|
2794
|
+
}
|
|
2795
|
+
/**
|
|
2796
|
+
* @inheritDoc
|
|
2025
2797
|
*/
|
|
2026
|
-
|
|
2798
|
+
renderStyle(options) {
|
|
2799
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
2800
|
+
return null;
|
|
2027
2801
|
const paragraphStyle = {
|
|
2028
2802
|
fontFamily: 'Inter',
|
|
2029
2803
|
fontSize: '16px',
|
|
2030
2804
|
lineHeight: '22px',
|
|
2031
2805
|
fontWeight: '500',
|
|
2806
|
+
marginTop: '0px',
|
|
2807
|
+
marginBottom: '0px',
|
|
2032
2808
|
};
|
|
2033
2809
|
switch (this.textStyle) {
|
|
2034
2810
|
case 'paragraph': {
|
|
2035
2811
|
return paragraphStyle;
|
|
2036
2812
|
}
|
|
2037
2813
|
case 'title': {
|
|
2038
|
-
return {
|
|
2814
|
+
return {
|
|
2815
|
+
fontFamily: 'Inter',
|
|
2816
|
+
fontSize: '36px',
|
|
2817
|
+
lineHeight: '40px',
|
|
2818
|
+
fontWeight: '500',
|
|
2819
|
+
};
|
|
2039
2820
|
}
|
|
2040
2821
|
case 'subtitle': {
|
|
2041
|
-
return {
|
|
2822
|
+
return {
|
|
2823
|
+
fontFamily: 'Inter',
|
|
2824
|
+
fontSize: '28px',
|
|
2825
|
+
lineHeight: '32px',
|
|
2826
|
+
fontWeight: '500',
|
|
2827
|
+
};
|
|
2042
2828
|
}
|
|
2043
2829
|
case 'heading-1': {
|
|
2044
|
-
return {
|
|
2830
|
+
return {
|
|
2831
|
+
fontFamily: 'Inter',
|
|
2832
|
+
fontSize: '22px',
|
|
2833
|
+
lineHeight: '24px',
|
|
2834
|
+
fontWeight: '500',
|
|
2835
|
+
marginTop: '0px',
|
|
2836
|
+
marginBottom: '0px',
|
|
2837
|
+
};
|
|
2045
2838
|
}
|
|
2046
2839
|
case 'heading-2': {
|
|
2047
|
-
return {
|
|
2840
|
+
return {
|
|
2841
|
+
fontFamily: 'Inter',
|
|
2842
|
+
fontSize: '20px',
|
|
2843
|
+
lineHeight: '24px',
|
|
2844
|
+
fontWeight: '500',
|
|
2845
|
+
marginTop: '0px',
|
|
2846
|
+
marginBottom: '0px',
|
|
2847
|
+
};
|
|
2048
2848
|
}
|
|
2049
2849
|
case 'heading-3': {
|
|
2050
|
-
return {
|
|
2850
|
+
return {
|
|
2851
|
+
fontFamily: 'Inter',
|
|
2852
|
+
fontSize: '18px',
|
|
2853
|
+
lineHeight: '22px',
|
|
2854
|
+
fontWeight: '500',
|
|
2855
|
+
marginTop: '0px',
|
|
2856
|
+
marginBottom: '0px',
|
|
2857
|
+
};
|
|
2051
2858
|
}
|
|
2052
2859
|
case 'heading-4': {
|
|
2053
|
-
return {
|
|
2860
|
+
return {
|
|
2861
|
+
fontFamily: 'Inter',
|
|
2862
|
+
fontSize: '16px',
|
|
2863
|
+
lineHeight: '22px',
|
|
2864
|
+
fontWeight: '500',
|
|
2865
|
+
marginTop: '0px',
|
|
2866
|
+
marginBottom: '0px',
|
|
2867
|
+
};
|
|
2054
2868
|
}
|
|
2055
2869
|
case 'heading-5': {
|
|
2056
|
-
return {
|
|
2870
|
+
return {
|
|
2871
|
+
fontFamily: 'Inter',
|
|
2872
|
+
fontSize: '14px',
|
|
2873
|
+
lineHeight: '22px',
|
|
2874
|
+
fontWeight: '500',
|
|
2875
|
+
marginTop: '0px',
|
|
2876
|
+
marginBottom: '0px',
|
|
2877
|
+
};
|
|
2057
2878
|
}
|
|
2058
2879
|
case 'heading-6': {
|
|
2059
|
-
return {
|
|
2880
|
+
return {
|
|
2881
|
+
fontFamily: 'Inter',
|
|
2882
|
+
fontSize: '12px',
|
|
2883
|
+
lineHeight: '22px',
|
|
2884
|
+
fontWeight: '500',
|
|
2885
|
+
marginTop: '0px',
|
|
2886
|
+
marginBottom: '0px',
|
|
2887
|
+
};
|
|
2060
2888
|
}
|
|
2061
2889
|
}
|
|
2062
2890
|
}
|
|
@@ -2082,25 +2910,6 @@ class TextStyleAnnotationAction extends AnnotationAction {
|
|
|
2082
2910
|
}
|
|
2083
2911
|
}
|
|
2084
2912
|
|
|
2085
|
-
/**
|
|
2086
|
-
* Action to toggle bold annotation
|
|
2087
|
-
*/
|
|
2088
|
-
class BoldAnnotationAction extends TextSplittableAction {
|
|
2089
|
-
constructor(bold) {
|
|
2090
|
-
super();
|
|
2091
|
-
this.isFlushable = true;
|
|
2092
|
-
this.bold = bold;
|
|
2093
|
-
}
|
|
2094
|
-
/**
|
|
2095
|
-
* Converts the action to an annotation
|
|
2096
|
-
*
|
|
2097
|
-
* @returns {BoldAnnotation} the annotation
|
|
2098
|
-
*/
|
|
2099
|
-
toAnnotation() {
|
|
2100
|
-
return new BoldAnnotation(this.bold);
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
|
|
2104
2913
|
/**
|
|
2105
2914
|
* Update the text block text style strategy.
|
|
2106
2915
|
*/
|
|
@@ -2127,6 +2936,7 @@ class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
|
|
|
2127
2936
|
node.apply(new DeleteNodeAnnotationAction(exports.NodeAnnotationTypeEnum.BOLD));
|
|
2128
2937
|
});
|
|
2129
2938
|
}
|
|
2939
|
+
this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
|
|
2130
2940
|
}
|
|
2131
2941
|
}
|
|
2132
2942
|
|
|
@@ -2141,15 +2951,56 @@ class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
|
|
|
2141
2951
|
* @param {RTETextBlock} target - The current text block.
|
|
2142
2952
|
*/
|
|
2143
2953
|
handleAction(action, target) {
|
|
2144
|
-
|
|
2145
|
-
if (
|
|
2146
|
-
|
|
2147
|
-
|
|
2954
|
+
let linkGroupAnnotation = target.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2955
|
+
if (action.type === 'update_link') {
|
|
2956
|
+
if (linkGroupAnnotation) {
|
|
2957
|
+
const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
|
|
2958
|
+
if (linkGroup) {
|
|
2959
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [linkGroup[0]]);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
else {
|
|
2964
|
+
if (linkGroupAnnotation) {
|
|
2965
|
+
const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey) || [];
|
|
2966
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
|
|
2967
|
+
}
|
|
2968
|
+
else {
|
|
2969
|
+
linkGroupAnnotation = action.toAnnotation();
|
|
2970
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [...action.nodes]);
|
|
2971
|
+
}
|
|
2148
2972
|
target.annotationMap.set(exports.InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
|
|
2149
2973
|
}
|
|
2150
2974
|
}
|
|
2151
2975
|
}
|
|
2152
2976
|
|
|
2977
|
+
/**
|
|
2978
|
+
* Insert a new children after a existing children
|
|
2979
|
+
*
|
|
2980
|
+
* @example parent.apply(new InsertChildrenAfterAction(existingChildren, newChildren, ...))
|
|
2981
|
+
*/
|
|
2982
|
+
class InsertChildrenAfterAction extends ModifyContentAction {
|
|
2983
|
+
constructor(referBlock, ...blocksToBeInserted) {
|
|
2984
|
+
super();
|
|
2985
|
+
this.type = exports.ModifyContentActionType.INSERT_CHILDREN_AFTER;
|
|
2986
|
+
this.referChildren = referBlock;
|
|
2987
|
+
this.childrenToBeInserted = blocksToBeInserted;
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
/**
|
|
2992
|
+
* Clear the current block nodes and append new nodes
|
|
2993
|
+
*
|
|
2994
|
+
* @example block.apply(new ReplaceChildNodesAction(newNodes))
|
|
2995
|
+
*/
|
|
2996
|
+
class ReplaceChildNodesAction extends ModifyContentAction {
|
|
2997
|
+
constructor(newChildNodes) {
|
|
2998
|
+
super();
|
|
2999
|
+
this.type = exports.ModifyContentActionType.REPLACE_CHILD_NODES;
|
|
3000
|
+
this.newChildNodes = newChildNodes;
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
|
|
2153
3004
|
/**
|
|
2154
3005
|
* Split the current node with a special position strategy.
|
|
2155
3006
|
*/
|
|
@@ -2184,7 +3035,7 @@ class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
|
|
|
2184
3035
|
}
|
|
2185
3036
|
textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
2186
3037
|
const newBlock = textBlock.cloneWithNodes(afterNodes);
|
|
2187
|
-
textBlock.parent.apply(new
|
|
3038
|
+
textBlock.parent.apply(new InsertChildrenAfterAction(textBlock, newBlock));
|
|
2188
3039
|
return newBlock;
|
|
2189
3040
|
}
|
|
2190
3041
|
}
|
|
@@ -2192,52 +3043,54 @@ class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
|
|
|
2192
3043
|
}
|
|
2193
3044
|
|
|
2194
3045
|
/**
|
|
2195
|
-
*
|
|
3046
|
+
* Remove all nodes and append new nodes strategy.
|
|
2196
3047
|
*/
|
|
2197
|
-
class
|
|
3048
|
+
class BlockReplaceNodesStrategy extends ActionHandleStrategy {
|
|
2198
3049
|
/**
|
|
2199
|
-
*
|
|
3050
|
+
* Empty the text block or image block nodes and add new nodes.
|
|
3051
|
+
*
|
|
3052
|
+
* @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
|
|
3053
|
+
* @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
|
|
2200
3054
|
*/
|
|
2201
3055
|
handleAction(action, target) {
|
|
2202
|
-
|
|
3056
|
+
target.children = [];
|
|
3057
|
+
target.apply(new AppendChildrenAction(action.newChildNodes));
|
|
2203
3058
|
}
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
}
|
|
2217
|
-
else if (this.isCaretPositionAtTextBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
2218
|
-
target.parent.apply(new InsertBlocksBeforeAction(target, newParagraph));
|
|
2219
|
-
}
|
|
2220
|
-
else {
|
|
2221
|
-
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
2222
|
-
target.apply(splitBlockAction);
|
|
2223
|
-
return splitBlockAction.newBlock;
|
|
2224
|
-
}
|
|
2225
|
-
return newParagraph;
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
/**
|
|
3062
|
+
* Remove a children from the current block
|
|
3063
|
+
*
|
|
3064
|
+
* @example needRemovedChildren.parent.apply(new RemoveChildrenAction(needRemovedChildren))
|
|
3065
|
+
*/
|
|
3066
|
+
class RemoveChildrenAction extends ModifyContentAction {
|
|
3067
|
+
constructor(childNode) {
|
|
3068
|
+
super();
|
|
3069
|
+
this.type = exports.ModifyContentActionType.DELETE_CHILDREN;
|
|
3070
|
+
this.entityToBeRemoved = childNode;
|
|
2226
3071
|
}
|
|
3072
|
+
}
|
|
3073
|
+
|
|
3074
|
+
/**
|
|
3075
|
+
* Append the second block child nodes to the first block child nodes and remove the second block strategy.
|
|
3076
|
+
*/
|
|
3077
|
+
class BlockMergeNodesStrategy extends ActionHandleStrategy {
|
|
2227
3078
|
/**
|
|
2228
|
-
*
|
|
3079
|
+
* Merges the child nodes of two RTEBlocks if they have the same type or both are not images.
|
|
2229
3080
|
*
|
|
2230
|
-
* @param {
|
|
2231
|
-
* @param {RTETextBlock} target - The text block.
|
|
2232
|
-
* @returns {RTETextBlock} - The new paragraph.
|
|
3081
|
+
* @param {MergeTwoBlocksNodesAction} action - The merge block nodes action instance.
|
|
3082
|
+
* @param {RTETextBlock | RTEImageBlock} target - The first text block or image block.
|
|
2233
3083
|
*/
|
|
2234
|
-
|
|
2235
|
-
const
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
3084
|
+
handleAction(action, target) {
|
|
3085
|
+
const anotherBlock = action.blockNeedToBeMerged;
|
|
3086
|
+
if (target.type === anotherBlock.type || (target.type !== 'image' && anotherBlock.type !== 'image')) {
|
|
3087
|
+
let shouldMergeNodes = anotherBlock.children;
|
|
3088
|
+
if (anotherBlock.type !== 'image') {
|
|
3089
|
+
shouldMergeNodes = anotherBlock.children.filter((node) => node.text);
|
|
3090
|
+
}
|
|
3091
|
+
target.apply(new AppendChildrenAction(shouldMergeNodes));
|
|
3092
|
+
anotherBlock.parent.apply(new RemoveChildrenAction(anotherBlock));
|
|
3093
|
+
}
|
|
2241
3094
|
}
|
|
2242
3095
|
}
|
|
2243
3096
|
|
|
@@ -2330,7 +3183,7 @@ class BlockInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
|
|
|
2330
3183
|
blocks.map((block) => {
|
|
2331
3184
|
if (block.type !== 'image') {
|
|
2332
3185
|
nodes.push(...block.children);
|
|
2333
|
-
block.parent.apply(new
|
|
3186
|
+
block.parent.apply(new RemoveChildrenAction(block));
|
|
2334
3187
|
}
|
|
2335
3188
|
});
|
|
2336
3189
|
return nodes;
|
|
@@ -2352,112 +3205,31 @@ class BlockInsertLineBreakWithBlocksStrategy extends ActionHandleStrategy {
|
|
|
2352
3205
|
}
|
|
2353
3206
|
|
|
2354
3207
|
/**
|
|
2355
|
-
*
|
|
3208
|
+
* Insert a children before a existing children
|
|
2356
3209
|
*
|
|
2357
|
-
* @example
|
|
3210
|
+
* @example parent.apply(new InsertChildrenBeforeAction(existingChildren, newChildren, ...))
|
|
2358
3211
|
*/
|
|
2359
|
-
class
|
|
2360
|
-
constructor(
|
|
3212
|
+
class InsertChildrenBeforeAction extends ModifyContentAction {
|
|
3213
|
+
constructor(referChildren, ...childrenToBeInserted) {
|
|
2361
3214
|
super();
|
|
2362
|
-
this.type = exports.ModifyContentActionType.
|
|
2363
|
-
this.
|
|
3215
|
+
this.type = exports.ModifyContentActionType.INSERT_CHILDREN_BEFORE;
|
|
3216
|
+
this.referChildren = referChildren;
|
|
3217
|
+
this.childrenToBeInserted = childrenToBeInserted;
|
|
2364
3218
|
}
|
|
2365
3219
|
}
|
|
2366
3220
|
|
|
2367
3221
|
/**
|
|
2368
|
-
*
|
|
3222
|
+
* Split the block with a split point node.
|
|
3223
|
+
* The property `newBlock` use to store the new create block if need.
|
|
3224
|
+
*
|
|
3225
|
+
* @example block.apply(new SplitBlockWithNodeAction(node, offset))
|
|
2369
3226
|
*/
|
|
2370
|
-
class
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
this.
|
|
2376
|
-
}
|
|
2377
|
-
/**
|
|
2378
|
-
* Handle the delete text logic when press delete key.
|
|
2379
|
-
*
|
|
2380
|
-
* @param {DeleteBlockContentAction} action - ModifyContentAction
|
|
2381
|
-
* @param {RTETextBlock} target - Current text block
|
|
2382
|
-
*/
|
|
2383
|
-
deleteNodeContent(action, target) {
|
|
2384
|
-
const startContainerNode = action.startContainerNode;
|
|
2385
|
-
const startOffset = action.startOffset;
|
|
2386
|
-
if (startOffset !== 0 && !startContainerNode.isEmpty()) {
|
|
2387
|
-
const newText = startContainerNode.text.slice(0, startOffset - 1) +
|
|
2388
|
-
startContainerNode.text.slice(startOffset);
|
|
2389
|
-
startContainerNode.apply(new UpdateTextAction(newText));
|
|
2390
|
-
if (newText) {
|
|
2391
|
-
action.previousNode = startContainerNode;
|
|
2392
|
-
return;
|
|
2393
|
-
}
|
|
2394
|
-
else {
|
|
2395
|
-
const previousNode = this.getPreviousNode(startContainerNode);
|
|
2396
|
-
// Remove the last character will not delete paragraph, the paragraph will removed after press delete again
|
|
2397
|
-
if ((previousNode && previousNode.parent === target && previousNode['text'] === '\n') ||
|
|
2398
|
-
target.children.length === 1) {
|
|
2399
|
-
action.previousNode = startContainerNode;
|
|
2400
|
-
return;
|
|
2401
|
-
}
|
|
2402
|
-
else {
|
|
2403
|
-
target.apply(new RemoveChildAction(startContainerNode));
|
|
2404
|
-
action.previousNode = previousNode;
|
|
2405
|
-
return;
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
else {
|
|
2410
|
-
let previousNode = this.getPreviousNode(startContainerNode);
|
|
2411
|
-
let nextNode = null;
|
|
2412
|
-
if (target.children.length && previousNode && previousNode.parent !== target) {
|
|
2413
|
-
if (startContainerNode.isEmpty()) {
|
|
2414
|
-
target.apply(new RemoveChildAction(startContainerNode));
|
|
2415
|
-
}
|
|
2416
|
-
if (target.type === previousNode.parent.type) {
|
|
2417
|
-
previousNode.parent.apply(new MergeTwoBlocksNodesAction(target));
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
else {
|
|
2421
|
-
if (this.isContentFirstNode(startContainerNode) && startContainerNode.isEmpty()) {
|
|
2422
|
-
nextNode = this.getNextNode(startContainerNode);
|
|
2423
|
-
}
|
|
2424
|
-
/**
|
|
2425
|
-
* Remove line break
|
|
2426
|
-
*
|
|
2427
|
-
* @example caret at the first line
|
|
2428
|
-
* \n
|
|
2429
|
-
* test
|
|
2430
|
-
*/
|
|
2431
|
-
if (startContainerNode.isEmpty()) {
|
|
2432
|
-
target.apply(new RemoveChildAction(startContainerNode));
|
|
2433
|
-
}
|
|
2434
|
-
/**
|
|
2435
|
-
* Remove line break
|
|
2436
|
-
*
|
|
2437
|
-
* @example caret at the begin of second line
|
|
2438
|
-
* \n
|
|
2439
|
-
* test
|
|
2440
|
-
*/
|
|
2441
|
-
if (previousNode instanceof RTETextNode && previousNode.isEmpty()) {
|
|
2442
|
-
const shouldRemoveNode = previousNode;
|
|
2443
|
-
previousNode = this.getPreviousNode(previousNode);
|
|
2444
|
-
shouldRemoveNode.parent.apply(new RemoveChildAction(shouldRemoveNode));
|
|
2445
|
-
if (!previousNode) {
|
|
2446
|
-
nextNode = startContainerNode;
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
//Remove the paragraph block if the content is empty
|
|
2451
|
-
if (target.children.length === 0) {
|
|
2452
|
-
target.parent.apply(new RemoveChildAction(target));
|
|
2453
|
-
}
|
|
2454
|
-
if (previousNode) {
|
|
2455
|
-
action.previousNode = previousNode;
|
|
2456
|
-
}
|
|
2457
|
-
else if (nextNode) {
|
|
2458
|
-
action.nextNode = nextNode;
|
|
2459
|
-
}
|
|
2460
|
-
}
|
|
3227
|
+
class SplitBlockWithNodeAction extends ModifyContentAction {
|
|
3228
|
+
constructor(splitPointNode, startOffsetOfNode) {
|
|
3229
|
+
super();
|
|
3230
|
+
this.type = exports.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE;
|
|
3231
|
+
this.splitPointNode = splitPointNode;
|
|
3232
|
+
this.startOffsetOfNode = startOffsetOfNode;
|
|
2461
3233
|
}
|
|
2462
3234
|
}
|
|
2463
3235
|
|
|
@@ -2475,82 +3247,131 @@ class BlockInsertImageIntoTextStrategy extends ActionHandleStrategy {
|
|
|
2475
3247
|
const splitNode = action.splitPointNode;
|
|
2476
3248
|
const startOffsetOfNode = action.startOffsetOfNode;
|
|
2477
3249
|
const newImageBlock = action.imageBlockToBeInserted;
|
|
2478
|
-
if (this.
|
|
2479
|
-
target.parent.apply(new
|
|
3250
|
+
if (this.isCaretPositionAtBlockEnd(target, splitNode, startOffsetOfNode)) {
|
|
3251
|
+
target.parent.apply(new InsertChildrenAfterAction(target, newImageBlock));
|
|
2480
3252
|
}
|
|
2481
|
-
else if (this.
|
|
2482
|
-
target.parent.apply(new
|
|
3253
|
+
else if (this.isCaretPositionAtBlockStart(target, splitNode, startOffsetOfNode)) {
|
|
3254
|
+
target.parent.apply(new InsertChildrenBeforeAction(target, newImageBlock));
|
|
2483
3255
|
}
|
|
2484
3256
|
else {
|
|
2485
3257
|
const splitBlockAction = new SplitBlockWithNodeAction(splitNode, startOffsetOfNode);
|
|
2486
3258
|
target.apply(splitBlockAction);
|
|
2487
|
-
target.parent.apply(new
|
|
3259
|
+
target.parent.apply(new InsertChildrenAfterAction(target, newImageBlock));
|
|
2488
3260
|
}
|
|
2489
3261
|
}
|
|
2490
3262
|
}
|
|
2491
3263
|
|
|
2492
3264
|
/**
|
|
2493
|
-
*
|
|
3265
|
+
* Convert the selected blocks to list strategy.
|
|
3266
|
+
*/
|
|
3267
|
+
class BlockTransformToListStrategy extends ActionHandleStrategy {
|
|
3268
|
+
/**
|
|
3269
|
+
* This method will create a empty list block and append all selected blocks as list item block.
|
|
3270
|
+
*
|
|
3271
|
+
* @param {TransformListAction} action - The transform list action instance.
|
|
3272
|
+
* @param {RTETextBlock} target - The first item of the selected block.
|
|
3273
|
+
*/
|
|
3274
|
+
handleAction(action, target) {
|
|
3275
|
+
const contentState = target.parent;
|
|
3276
|
+
const bulletList = contentState.createList(action.listType);
|
|
3277
|
+
const selectedBlocks = action.selectedBlocks;
|
|
3278
|
+
const listItems = selectedBlocks.map((block) => contentState.toListItem(block));
|
|
3279
|
+
bulletList.apply(new AppendChildrenAction(listItems));
|
|
3280
|
+
contentState.apply(new InsertChildrenAfterAction(action.selectedBlocks[0], bulletList));
|
|
3281
|
+
selectedBlocks.forEach((block) => {
|
|
3282
|
+
block.parent.apply(new RemoveChildrenAction(block));
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
/**
|
|
3288
|
+
* Action to toggle block horizontal alignment annotation
|
|
3289
|
+
*/
|
|
3290
|
+
class HorizontalAlignmentAnnotationAction extends AnnotationAction {
|
|
3291
|
+
constructor(textAlign) {
|
|
3292
|
+
super();
|
|
3293
|
+
this.isFlushable = true;
|
|
3294
|
+
this.textAlign = textAlign;
|
|
3295
|
+
}
|
|
3296
|
+
/**
|
|
3297
|
+
* Converts the action to an annotation
|
|
3298
|
+
*
|
|
3299
|
+
* @returns {HorizontalAlignmentAnnotation} The annotation
|
|
3300
|
+
*/
|
|
3301
|
+
toAnnotation() {
|
|
3302
|
+
return new HorizontalAlignmentAnnotation(this.textAlign);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
/**
|
|
3307
|
+
* Update the text block and image block horizontal alignment strategy.
|
|
3308
|
+
*/
|
|
3309
|
+
class BlockUpdateHorizontalAlignmentStrategy extends ActionHandleStrategy {
|
|
3310
|
+
/**
|
|
3311
|
+
* Updating the horizontal alignment of a block requires cascading updates to the custom style.
|
|
3312
|
+
*
|
|
3313
|
+
* @param {HorizontalAlignmentAnnotationAction} _action - The horizontal alignment annotation action.
|
|
3314
|
+
* @param {RTETextBlock} target - The current text block.
|
|
3315
|
+
*/
|
|
3316
|
+
handleAction(_action, target) {
|
|
3317
|
+
this.updateCustomStyleAnnotation(target, ['textAlign']);
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
/**
|
|
3322
|
+
* Update the text block and image block horizontal alignment strategy.
|
|
2494
3323
|
*/
|
|
2495
|
-
class
|
|
3324
|
+
class BlockUpdateIndentStrategy extends ActionHandleStrategy {
|
|
2496
3325
|
/**
|
|
2497
|
-
*
|
|
3326
|
+
* Updating the indent of a block requires cascading updates to the custom style.
|
|
2498
3327
|
*
|
|
2499
|
-
* @param {
|
|
2500
|
-
* @param {
|
|
2501
|
-
* @param {RTENode[]} newNodes - The array of the text node or the image node.
|
|
3328
|
+
* @param {IndentAnnotationAction} _action - The indent annotation action.
|
|
3329
|
+
* @param {RTETextBlock} target - The current text block.
|
|
2502
3330
|
*/
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
newNodes.forEach((node) => {
|
|
2506
|
-
node.parent = target;
|
|
2507
|
-
});
|
|
2508
|
-
target.children = target.children.flatMap((node) => {
|
|
2509
|
-
if (node === referNode) {
|
|
2510
|
-
return newNodes;
|
|
2511
|
-
}
|
|
2512
|
-
else {
|
|
2513
|
-
return node;
|
|
2514
|
-
}
|
|
2515
|
-
});
|
|
2516
|
-
}
|
|
3331
|
+
handleAction(_action, target) {
|
|
3332
|
+
this.updateCustomStyleAnnotation(target, ['marginLeft']);
|
|
2517
3333
|
}
|
|
2518
3334
|
}
|
|
2519
3335
|
|
|
2520
3336
|
/**
|
|
2521
|
-
*
|
|
3337
|
+
* Action to toggle block indent annotation
|
|
2522
3338
|
*/
|
|
2523
|
-
class
|
|
3339
|
+
class IndentAnnotationAction extends AnnotationAction {
|
|
3340
|
+
constructor(indent) {
|
|
3341
|
+
super();
|
|
3342
|
+
this.isFlushable = true;
|
|
3343
|
+
this.indent = indent;
|
|
3344
|
+
}
|
|
2524
3345
|
/**
|
|
2525
|
-
*
|
|
3346
|
+
* Converts the action to an annotation
|
|
3347
|
+
*
|
|
3348
|
+
* @returns {Annotation} The annotation
|
|
2526
3349
|
*/
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
const nodes = [...action.nodesToBeInserted, referNode];
|
|
2530
|
-
this.replaceNodeWithNodes(target, referNode, nodes);
|
|
3350
|
+
toAnnotation() {
|
|
3351
|
+
return new IndentAnnotation(this.indent);
|
|
2531
3352
|
}
|
|
2532
3353
|
}
|
|
2533
3354
|
|
|
2534
3355
|
/**
|
|
2535
|
-
*
|
|
3356
|
+
* Unlink the text block link group annotation strategy.
|
|
2536
3357
|
*/
|
|
2537
|
-
class
|
|
3358
|
+
class BlockUnlinkLinkGroupStrategy extends ActionHandleStrategy {
|
|
2538
3359
|
/**
|
|
2539
|
-
*
|
|
3360
|
+
* Unlink the link group based on group key
|
|
2540
3361
|
*
|
|
2541
|
-
* @param {
|
|
2542
|
-
* @param {RTETextBlock} target - The
|
|
3362
|
+
* @param {UnlinkLinkGroupAction} action - The unlink link group action instance.
|
|
3363
|
+
* @param {RTETextBlock} target - The current text block.
|
|
2543
3364
|
*/
|
|
2544
3365
|
handleAction(action, target) {
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
}
|
|
3366
|
+
const linkGroupAnnotation = target.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
3367
|
+
if (linkGroupAnnotation) {
|
|
3368
|
+
if (linkGroupAnnotation.linkGroups.size > 1) {
|
|
3369
|
+
linkGroupAnnotation.linkGroups.delete(action.groupKey);
|
|
3370
|
+
}
|
|
3371
|
+
else {
|
|
3372
|
+
target.annotationMap.delete(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
2554
3375
|
}
|
|
2555
3376
|
}
|
|
2556
3377
|
|
|
@@ -2558,34 +3379,42 @@ class BlockTransformToListStrategy extends ActionHandleStrategy {
|
|
|
2558
3379
|
* Text block
|
|
2559
3380
|
*/
|
|
2560
3381
|
class RTETextBlock extends RTEBlock {
|
|
2561
|
-
constructor(id, type) {
|
|
3382
|
+
constructor(id, type, options) {
|
|
2562
3383
|
super(id);
|
|
2563
3384
|
this.children = [];
|
|
2564
3385
|
this.type = type;
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
3386
|
+
const { autoMatchFormat } = options || { autoMatchFormat: true };
|
|
3387
|
+
if (autoMatchFormat) {
|
|
3388
|
+
if (RTETextBlock.isAcceptableTextStyle(type)) {
|
|
3389
|
+
this.annotationMap = new Map([TextStyleAnnotation.from(type)]);
|
|
3390
|
+
}
|
|
3391
|
+
else {
|
|
3392
|
+
this.annotationMap = new Map([TextStyleAnnotation.from('paragraph')]);
|
|
3393
|
+
}
|
|
2570
3394
|
}
|
|
2571
3395
|
}
|
|
2572
3396
|
/**
|
|
2573
3397
|
* Converts a VegaRTETextBlock into an RTETextBlock.
|
|
2574
3398
|
*
|
|
2575
3399
|
* @param {VegaRTETextBlock} block - The block object
|
|
3400
|
+
* @param {VegaRTETransformOptions} options - Optional transformation options.
|
|
2576
3401
|
* @returns {RTETextBlock} A RTETextBlock class
|
|
2577
3402
|
*/
|
|
2578
|
-
static from(block) {
|
|
2579
|
-
|
|
2580
|
-
const
|
|
2581
|
-
|
|
3403
|
+
static from(block, options = { autoMatchFormat: true }) {
|
|
3404
|
+
var _a, _b;
|
|
3405
|
+
const textBlock = new RTETextBlock(block.id, block.type, options);
|
|
3406
|
+
const annotations = options.autoMatchFormat
|
|
3407
|
+
? Object.assign(Object.assign({}, block.annotations), { textStyle: (_b = (_a = block.annotations) === null || _a === void 0 ? void 0 : _a.textStyle) !== null && _b !== void 0 ? _b : textBlock.type }) : block.annotations;
|
|
3408
|
+
textBlock.children = block.nodes
|
|
3409
|
+
.map((richText) => {
|
|
3410
|
+
const NodeClass = RTEDTOClassManager$1.getRTENodeClass(richText.type);
|
|
3411
|
+
if (NodeClass) {
|
|
3412
|
+
return NodeClass.from(richText, textBlock, options);
|
|
3413
|
+
}
|
|
3414
|
+
})
|
|
3415
|
+
.filter(typeGuard.isNonNullable);
|
|
2582
3416
|
if (annotations) {
|
|
2583
|
-
|
|
2584
|
-
const item = this.createAnnotationEntity(type, value);
|
|
2585
|
-
if (typeGuard.isNonNullable(item)) {
|
|
2586
|
-
textBlock.annotationMap.set(...item);
|
|
2587
|
-
}
|
|
2588
|
-
});
|
|
3417
|
+
super.convertAnnotationsToMap(textBlock.annotationMap, annotations);
|
|
2589
3418
|
}
|
|
2590
3419
|
return textBlock;
|
|
2591
3420
|
}
|
|
@@ -2598,7 +3427,7 @@ class RTETextBlock extends RTEBlock {
|
|
|
2598
3427
|
* @param {unknown} value - The `value` parameter in the `createAnnotationEntity` function is the value
|
|
2599
3428
|
* that will be used to create the annotation entity. It can be of any type depending on the specific
|
|
2600
3429
|
* annotation being created.
|
|
2601
|
-
* @returns {Nullable<
|
|
3430
|
+
* @returns {Nullable<BlockAnnotationsEntity>} The `createAnnotationEntity` function returns a nullable tuple containing a
|
|
2602
3431
|
* `BlockAnnotationTypeEnum` and a `BlockAnnotation` object.
|
|
2603
3432
|
*/
|
|
2604
3433
|
static createAnnotationEntity(type, value) {
|
|
@@ -2655,16 +3484,31 @@ class RTETextBlock extends RTEBlock {
|
|
|
2655
3484
|
toJSON() {
|
|
2656
3485
|
return Object.assign(Object.assign({}, super.toJSON()), { type: this.type, nodes: this.children.map((node) => node.toJSON()) });
|
|
2657
3486
|
}
|
|
3487
|
+
/**
|
|
3488
|
+
* @inheritDoc
|
|
3489
|
+
*/
|
|
3490
|
+
toHtml(options) {
|
|
3491
|
+
const BlockTag = this.getBlockTag();
|
|
3492
|
+
const attrStr = super.generateAttributeString();
|
|
3493
|
+
const linkGroupAnnotation = this.getAnnotationByType(exports.InternalAnnotationTypeEnum.LINK_GROUP);
|
|
3494
|
+
let nodesHtml = this.children.map((node) => node.toHtml()).join('');
|
|
3495
|
+
if (linkGroupAnnotation && this.children.length > 0) {
|
|
3496
|
+
nodesHtml = this.generateLinkHtml(linkGroupAnnotation, nodesHtml, options);
|
|
3497
|
+
}
|
|
3498
|
+
return super.shouldRenderAsInternalWrapper()
|
|
3499
|
+
? nodesHtml
|
|
3500
|
+
: [`<${BlockTag}${attrStr}>`, nodesHtml, `</${BlockTag}>`].join('');
|
|
3501
|
+
}
|
|
2658
3502
|
/**
|
|
2659
3503
|
* Clone the nodes to a new block
|
|
2660
3504
|
*
|
|
2661
3505
|
* @param {RTEBlock} nodes - The nodes will be copied
|
|
2662
|
-
* @returns {
|
|
3506
|
+
* @returns {RTETextBlock} New block
|
|
2663
3507
|
*/
|
|
2664
3508
|
cloneWithNodes(nodes) {
|
|
2665
3509
|
const block = new RTETextBlock(createPublicApiRuntimeMetricsSlimmer.generateUUID(), this.type);
|
|
2666
|
-
block.
|
|
2667
|
-
block.apply(new
|
|
3510
|
+
block.annotationMap = super.cloneAnnotations();
|
|
3511
|
+
block.apply(new AppendChildrenAction(nodes));
|
|
2668
3512
|
return block;
|
|
2669
3513
|
}
|
|
2670
3514
|
/**
|
|
@@ -2694,12 +3538,31 @@ class RTETextBlock extends RTEBlock {
|
|
|
2694
3538
|
return this.children[this.children.length - 1];
|
|
2695
3539
|
}
|
|
2696
3540
|
/**
|
|
2697
|
-
*
|
|
2698
|
-
*
|
|
2699
|
-
* @returns {
|
|
2700
|
-
*/
|
|
2701
|
-
|
|
2702
|
-
|
|
3541
|
+
* Get the HTML tag for the block based on its type.
|
|
3542
|
+
*
|
|
3543
|
+
* @returns {RTETextBlockTagType} The HTML tag for the block.
|
|
3544
|
+
*/
|
|
3545
|
+
getBlockTag() {
|
|
3546
|
+
switch (this.type) {
|
|
3547
|
+
case 'title':
|
|
3548
|
+
case 'subtitle':
|
|
3549
|
+
return `div`;
|
|
3550
|
+
case 'heading-1':
|
|
3551
|
+
return `h1`;
|
|
3552
|
+
case 'heading-2':
|
|
3553
|
+
return `h2`;
|
|
3554
|
+
case 'heading-3':
|
|
3555
|
+
return `h3`;
|
|
3556
|
+
case 'heading-4':
|
|
3557
|
+
return `h4`;
|
|
3558
|
+
case 'heading-5':
|
|
3559
|
+
return `h5`;
|
|
3560
|
+
case 'heading-6':
|
|
3561
|
+
return `h6`;
|
|
3562
|
+
case 'paragraph':
|
|
3563
|
+
default:
|
|
3564
|
+
return 'p';
|
|
3565
|
+
}
|
|
2703
3566
|
}
|
|
2704
3567
|
/**
|
|
2705
3568
|
* @inheritDoc
|
|
@@ -2710,24 +3573,193 @@ class RTETextBlock extends RTEBlock {
|
|
|
2710
3573
|
strategy.execute(action, this);
|
|
2711
3574
|
}
|
|
2712
3575
|
}
|
|
3576
|
+
/**
|
|
3577
|
+
* Generate Link Html
|
|
3578
|
+
*
|
|
3579
|
+
* @param {LinkGroupAnnotation} linkGroupAnnotation - linkGroupAnnotation
|
|
3580
|
+
* @param {string} nodesHtml - The nodes html
|
|
3581
|
+
* @param {VegaRTETransformOptions} options - options
|
|
3582
|
+
* @returns {string} link html
|
|
3583
|
+
*/
|
|
3584
|
+
generateLinkHtml(linkGroupAnnotation, nodesHtml, options) {
|
|
3585
|
+
nodesHtml = '';
|
|
3586
|
+
let linkGroupNodes = [];
|
|
3587
|
+
for (let i = 0; i < this.children.length; i++) {
|
|
3588
|
+
const currentLinkAnnotation = this.children[i].getAnnotationByType(exports.NodeAnnotationTypeEnum.LINK);
|
|
3589
|
+
const nextLinkAnnotation = this.children[i + 1]
|
|
3590
|
+
? this.children[i + 1].getAnnotationByType(exports.NodeAnnotationTypeEnum.LINK)
|
|
3591
|
+
: null;
|
|
3592
|
+
if (currentLinkAnnotation) {
|
|
3593
|
+
linkGroupNodes.push(this.children[i]);
|
|
3594
|
+
if (!nextLinkAnnotation ||
|
|
3595
|
+
currentLinkAnnotation.link.groupKey !== nextLinkAnnotation.link.groupKey) {
|
|
3596
|
+
const linkAttributes = linkGroupAnnotation.toString(currentLinkAnnotation, {
|
|
3597
|
+
standalone: true,
|
|
3598
|
+
autoMatchFormat: options === null || options === void 0 ? void 0 : options.autoMatchFormat,
|
|
3599
|
+
});
|
|
3600
|
+
nodesHtml += [
|
|
3601
|
+
`<a${linkAttributes ? ` ${linkAttributes}` : ''}>`,
|
|
3602
|
+
linkGroupNodes.map((linkNode) => linkNode.toHtml()).join(''),
|
|
3603
|
+
`</a>`,
|
|
3604
|
+
].join('');
|
|
3605
|
+
linkGroupNodes = [];
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
else {
|
|
3609
|
+
nodesHtml += this.children[i].toHtml();
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
return nodesHtml;
|
|
3613
|
+
}
|
|
2713
3614
|
}
|
|
2714
3615
|
(() => {
|
|
2715
3616
|
ActionHandleStrategyRegistry.register(TextStyleAnnotationAction.name, RTETextBlock.name, new BlockUpdateTextStyleStrategy());
|
|
3617
|
+
ActionHandleStrategyRegistry.register(HorizontalAlignmentAnnotationAction.name, RTETextBlock.name, new BlockUpdateHorizontalAlignmentStrategy());
|
|
3618
|
+
ActionHandleStrategyRegistry.register(IndentAnnotationAction.name, RTETextBlock.name, new BlockUpdateIndentStrategy());
|
|
2716
3619
|
ActionHandleStrategyRegistry.register(LinkGroupAnnotationAction.name, RTETextBlock.name, new BlockUpdateLinkGroupStrategy());
|
|
2717
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.
|
|
2718
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.APPEND_CHILD_NODES, RTETextBlock.name, new BlockAppendNodesStrategy());
|
|
3620
|
+
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.UNLINK_LINK_GROUP, RTETextBlock.name, new BlockUnlinkLinkGroupStrategy());
|
|
2719
3621
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.SPLIT_BLOCK_WITH_NODE, RTETextBlock.name, new BlockSplitWithTextNodeStrategy());
|
|
2720
3622
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.REPLACE_CHILD_NODES, RTETextBlock.name, new BlockReplaceNodesStrategy());
|
|
2721
3623
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.MERGE_TWO_BLOCKS_NODES, RTETextBlock.name, new BlockMergeNodesStrategy());
|
|
2722
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.BREAK_SINGLE_BLOCK, RTETextBlock.name, new BlockInsertNewParagraphStrategy());
|
|
2723
3624
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINE_BREAK_SINGLE_BLOCK, RTETextBlock.name, new BlockInsertLineBreakStrategy());
|
|
2724
3625
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.LINE_BREAK_MULTIPLE_BLOCKS, RTETextBlock.name, new BlockInsertLineBreakWithBlocksStrategy());
|
|
2725
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_BLOCK_CONTENT, RTETextBlock.name, new BlockDeleteTextContentStrategy());
|
|
2726
3626
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTETextBlock.name, new BlockInsertImageIntoTextStrategy());
|
|
2727
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_NODES_BEFORE, RTETextBlock.name, new BlockInsertNodesBeforeNodeStrategy());
|
|
2728
3627
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.TRANSFORM_LIST_BLOCK, RTETextBlock.name, new BlockTransformToListStrategy());
|
|
2729
3628
|
})();
|
|
2730
3629
|
|
|
3630
|
+
/**
|
|
3631
|
+
* The delete node content contains some common functions that used for image block delete the image node or text block delete text node.
|
|
3632
|
+
*/
|
|
3633
|
+
class BlockDeleteNodeContentStrategy extends ActionHandleStrategy {
|
|
3634
|
+
/**
|
|
3635
|
+
* Returns the previous node relative to the current node in a rich text editor structure.
|
|
3636
|
+
*
|
|
3637
|
+
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
3638
|
+
* @returns {Nullable<RTENode>} the previous block last node
|
|
3639
|
+
*/
|
|
3640
|
+
getPreviousNode(currentNode) {
|
|
3641
|
+
const currentBlock = currentNode.parent;
|
|
3642
|
+
const currentIndex = currentBlock.children.indexOf(currentNode);
|
|
3643
|
+
if (currentIndex > 0) {
|
|
3644
|
+
return currentBlock.children[currentIndex - 1];
|
|
3645
|
+
}
|
|
3646
|
+
else if (currentBlock.parent) {
|
|
3647
|
+
const previousBlock = this.getPreviousBlock(currentBlock);
|
|
3648
|
+
if (previousBlock) {
|
|
3649
|
+
return this.getBlockLastNode(previousBlock);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
/**
|
|
3654
|
+
* Returns the next node relative to the current node in a rich text editor structure.
|
|
3655
|
+
*
|
|
3656
|
+
* @param {RTENode} currentNode - An object of type `RTENode`.
|
|
3657
|
+
* @returns {Nullable<RTENode>} the next block first node
|
|
3658
|
+
*/
|
|
3659
|
+
getNextNode(currentNode) {
|
|
3660
|
+
const currentBlock = currentNode.parent;
|
|
3661
|
+
const currentIndex = currentBlock.children.indexOf(currentNode);
|
|
3662
|
+
if (currentBlock.children[currentIndex + 1]) {
|
|
3663
|
+
return currentBlock.children[currentIndex + 1];
|
|
3664
|
+
}
|
|
3665
|
+
else if (currentBlock.parent) {
|
|
3666
|
+
const nextBlock = this.getNextBlock(currentBlock);
|
|
3667
|
+
if (nextBlock) {
|
|
3668
|
+
return this.getBlockFirstNode(nextBlock);
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
/**
|
|
3673
|
+
* Determines if a given node is the first node within the current state.
|
|
3674
|
+
*
|
|
3675
|
+
* @param {RTENode} currentNode - An object representing a node in a rich text editor (RTE).
|
|
3676
|
+
* @returns {boolean} True or false;
|
|
3677
|
+
*/
|
|
3678
|
+
isContentFirstNode(currentNode) {
|
|
3679
|
+
const currentBlock = currentNode.parent;
|
|
3680
|
+
const currentIndex = currentBlock.children.indexOf(currentNode);
|
|
3681
|
+
const parent = currentBlock.parent;
|
|
3682
|
+
if (currentBlock.isListItemBlock()) {
|
|
3683
|
+
const listParent = parent.parent;
|
|
3684
|
+
return (currentIndex === 0 &&
|
|
3685
|
+
Array.isArray(parent.children) &&
|
|
3686
|
+
parent.children[0] === currentBlock &&
|
|
3687
|
+
listParent['type'] !== 'list-item' &&
|
|
3688
|
+
Array.isArray(listParent.children) &&
|
|
3689
|
+
listParent.children[0] === parent);
|
|
3690
|
+
}
|
|
3691
|
+
else {
|
|
3692
|
+
return (currentIndex === 0 && Array.isArray(parent.children) && parent.children[0] === currentBlock);
|
|
3693
|
+
}
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3696
|
+
* TODO: The getPreviousBlock add nest list support
|
|
3697
|
+
* This function retrieves the previous block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
3698
|
+
*
|
|
3699
|
+
* @param {RTEBlock} currentBlock - Used to retrieve the previous block relative to the given `currentBlock` within a rich text editor context.
|
|
3700
|
+
* @returns {Nullable<RTEBlock>} The previous block if existing
|
|
3701
|
+
*/
|
|
3702
|
+
getPreviousBlock(currentBlock) {
|
|
3703
|
+
if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
|
|
3704
|
+
const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
|
|
3705
|
+
if (currentBlockIndex > 0) {
|
|
3706
|
+
return currentBlock.parent.children[currentBlockIndex - 1];
|
|
3707
|
+
}
|
|
3708
|
+
else if ((currentBlock.parent['type'] === 'number-list' ||
|
|
3709
|
+
currentBlock.parent['type'] === 'bullet-list') &&
|
|
3710
|
+
currentBlockIndex === 0) {
|
|
3711
|
+
return this.getPreviousBlock(currentBlock.parent);
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
/**
|
|
3716
|
+
* Returns the last node within a given RTE block, handling different block types accordingly.
|
|
3717
|
+
*
|
|
3718
|
+
* @param {RTEBlock} currentBlock - Returns the last node within that block.
|
|
3719
|
+
* @returns {Nullable<RTENode>} Returns the last node of the given `currentBlock` object.
|
|
3720
|
+
*/
|
|
3721
|
+
getBlockLastNode(currentBlock) {
|
|
3722
|
+
return currentBlock.getLastNode();
|
|
3723
|
+
}
|
|
3724
|
+
/**
|
|
3725
|
+
* Returns the first node within a given RTE block, handling different block types accordingly.
|
|
3726
|
+
*
|
|
3727
|
+
* @param {RTEBlock} currentBlock - Returns the first node within that block.
|
|
3728
|
+
* @returns {Nullable<RTENode>} Returns the first node of the given `currentBlock` object.
|
|
3729
|
+
*/
|
|
3730
|
+
getBlockFirstNode(currentBlock) {
|
|
3731
|
+
if (currentBlock.type === 'number-list' || currentBlock.type === 'bullet-list') {
|
|
3732
|
+
if (currentBlock.children) {
|
|
3733
|
+
const firstListItem = currentBlock.children[0];
|
|
3734
|
+
return this.getBlockFirstNode(firstListItem);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
else {
|
|
3738
|
+
if (currentBlock.children) {
|
|
3739
|
+
return currentBlock.children[0];
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
/**
|
|
3744
|
+
* This function retrieves the next block in a rich text editor, considering different scenarios such as being in a bullet list.
|
|
3745
|
+
*
|
|
3746
|
+
* @param {RTEBlock} currentBlock - Used to retrieve the next block relative to the given `currentBlock` within a rich text editor context.
|
|
3747
|
+
* @returns {Nullable<RTEBlock>} The next block if existing
|
|
3748
|
+
*/
|
|
3749
|
+
getNextBlock(currentBlock) {
|
|
3750
|
+
if (currentBlock && currentBlock.parent && currentBlock.parent.children) {
|
|
3751
|
+
const currentBlockIndex = currentBlock.parent.children.indexOf(currentBlock);
|
|
3752
|
+
if (currentBlock.parent.children[currentBlockIndex + 1]) {
|
|
3753
|
+
return currentBlock.parent.children[currentBlockIndex + 1];
|
|
3754
|
+
}
|
|
3755
|
+
else if (currentBlock.type === 'list-item' &&
|
|
3756
|
+
currentBlock.parent.children.length === currentBlockIndex + 1) {
|
|
3757
|
+
return this.getNextBlock(currentBlock.parent);
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
|
|
2731
3763
|
/**
|
|
2732
3764
|
* Remove the code block from the value, call this action if want to flush value after action.
|
|
2733
3765
|
*/
|
|
@@ -2745,7 +3777,7 @@ class CodeBlockRemoveSelfStrategy extends BlockDeleteNodeContentStrategy {
|
|
|
2745
3777
|
focusNode = this.getNextNode(node);
|
|
2746
3778
|
offset = 0;
|
|
2747
3779
|
}
|
|
2748
|
-
parent.apply(new
|
|
3780
|
+
parent.apply(new RemoveChildrenAction(target));
|
|
2749
3781
|
const focusElement = focusNode
|
|
2750
3782
|
? stateEntityRenderingRegistry.getDOMByEntity(focusNode)
|
|
2751
3783
|
: null;
|
|
@@ -2755,7 +3787,7 @@ class CodeBlockRemoveSelfStrategy extends BlockDeleteNodeContentStrategy {
|
|
|
2755
3787
|
type: 'paragraph',
|
|
2756
3788
|
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), type: 'text', text: '' }],
|
|
2757
3789
|
});
|
|
2758
|
-
target.parent.apply(new
|
|
3790
|
+
target.parent.apply(new AppendChildrenAction([defaultParagraph]));
|
|
2759
3791
|
focusNode = defaultParagraph.children[0];
|
|
2760
3792
|
offset = 0;
|
|
2761
3793
|
}
|
|
@@ -2830,7 +3862,7 @@ class SwitchOutFromCodeBlockStrategy extends ActionHandleStrategy {
|
|
|
2830
3862
|
type: 'paragraph',
|
|
2831
3863
|
nodes: [{ id: createPublicApiRuntimeMetricsSlimmer.generateUUID(), text: '', type: 'text' }],
|
|
2832
3864
|
});
|
|
2833
|
-
target.parent.apply(new
|
|
3865
|
+
target.parent.apply(new InsertChildrenAfterAction(target, textBlock));
|
|
2834
3866
|
// Focus the next text node after value update.
|
|
2835
3867
|
const currentNodeDom = stateEntityRenderingRegistry.getDOMByEntity(target);
|
|
2836
3868
|
if (currentNodeDom) {
|
|
@@ -2887,13 +3919,69 @@ class CodeNodeSetSelectionRangeAnnotationStrategy extends ActionHandleStrategy {
|
|
|
2887
3919
|
}
|
|
2888
3920
|
}
|
|
2889
3921
|
|
|
3922
|
+
/**
|
|
3923
|
+
* Abstract class for decorator nodes. A decorator node modifies content like an image node that will delete the whole node when the delete button is pressed.
|
|
3924
|
+
*/
|
|
3925
|
+
class RTEDecoratorNode extends RTENode {
|
|
3926
|
+
constructor() {
|
|
3927
|
+
super(...arguments);
|
|
3928
|
+
this.type = 'decorator-node';
|
|
3929
|
+
this.isSelected = false;
|
|
3930
|
+
}
|
|
3931
|
+
/**
|
|
3932
|
+
* Check the element is a decorator node container.
|
|
3933
|
+
*
|
|
3934
|
+
* @param {HTMLElement} element - The checked element.
|
|
3935
|
+
* @returns {boolean} - The result of the check.
|
|
3936
|
+
*/
|
|
3937
|
+
static isDecoratorNodeContainerElement(element) {
|
|
3938
|
+
return element && element.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS);
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
* Get the decorator node element within the container.
|
|
3942
|
+
*
|
|
3943
|
+
* @param {HTMLElement} container - The container element.
|
|
3944
|
+
* @returns {Nullable<HTMLElement>} - The decorator node element, if found.
|
|
3945
|
+
*/
|
|
3946
|
+
static getDecoratorNodeElement(container) {
|
|
3947
|
+
return container.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`);
|
|
3948
|
+
}
|
|
3949
|
+
/**
|
|
3950
|
+
* @inheritDoc
|
|
3951
|
+
*/
|
|
3952
|
+
getRangeEndOffset() {
|
|
3953
|
+
return 1;
|
|
3954
|
+
}
|
|
3955
|
+
/**
|
|
3956
|
+
* @inheritDoc
|
|
3957
|
+
*/
|
|
3958
|
+
getRangeContainer() {
|
|
3959
|
+
const element = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
3960
|
+
if (element) {
|
|
3961
|
+
return ui.findParent(element, `.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`);
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
/**
|
|
3965
|
+
* The decorator node is not content editable from the outside.
|
|
3966
|
+
*
|
|
3967
|
+
* @returns {boolean} - Always returns false for decorator nodes.
|
|
3968
|
+
*/
|
|
3969
|
+
isContentEditable() {
|
|
3970
|
+
return false;
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
// CSS class names for the decorator node parent element
|
|
3974
|
+
RTEDecoratorNode.DECORATOR_CONTAINER_CLASS = 'v-internal-decorator-container';
|
|
3975
|
+
// CSS class names for the decorator node element
|
|
3976
|
+
RTEDecoratorNode.DECORATOR_NODE_CLASS = 'v-internal-decorator-node';
|
|
3977
|
+
|
|
2890
3978
|
/**
|
|
2891
3979
|
* RTE code node DTO class.
|
|
2892
3980
|
*/
|
|
2893
|
-
class RTECodeBlockNode extends
|
|
3981
|
+
class RTECodeBlockNode extends RTEDecoratorNode {
|
|
2894
3982
|
constructor(id, content, language, parentBlock) {
|
|
2895
3983
|
super(id);
|
|
2896
|
-
this.type = NodeTypeEnum.CODE_BLOCK_NODE;
|
|
3984
|
+
this.type = exports.NodeTypeEnum.CODE_BLOCK_NODE;
|
|
2897
3985
|
this.text = '';
|
|
2898
3986
|
this.annotationMap = new Map();
|
|
2899
3987
|
this.text = content;
|
|
@@ -2908,6 +3996,12 @@ class RTECodeBlockNode extends RTENode {
|
|
|
2908
3996
|
toJSON() {
|
|
2909
3997
|
return { id: this.id, type: 'text', text: this.text, language: this.language };
|
|
2910
3998
|
}
|
|
3999
|
+
/**
|
|
4000
|
+
* @inheritDoc
|
|
4001
|
+
*/
|
|
4002
|
+
toHtml() {
|
|
4003
|
+
return `<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`;
|
|
4004
|
+
}
|
|
2911
4005
|
/**
|
|
2912
4006
|
* @inheritDoc
|
|
2913
4007
|
*/
|
|
@@ -2944,7 +4038,43 @@ class CodeBlockInsertImageStrategy extends ActionHandleStrategy {
|
|
|
2944
4038
|
*/
|
|
2945
4039
|
handleAction(action, target) {
|
|
2946
4040
|
const imageBlock = action.imageBlockToBeInserted;
|
|
2947
|
-
target.parent.apply(new
|
|
4041
|
+
target.parent.apply(new InsertChildrenAfterAction(target, imageBlock));
|
|
4042
|
+
}
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
exports.CodeLanguage = void 0;
|
|
4046
|
+
(function (CodeLanguage) {
|
|
4047
|
+
CodeLanguage["CSS"] = "css";
|
|
4048
|
+
CodeLanguage["HTML"] = "html";
|
|
4049
|
+
CodeLanguage["JavaScript"] = "js";
|
|
4050
|
+
CodeLanguage["JSX"] = "jsx";
|
|
4051
|
+
CodeLanguage["Plain Text"] = "plainText";
|
|
4052
|
+
CodeLanguage["TypeScript"] = "ts";
|
|
4053
|
+
CodeLanguage["TSX"] = "tsx";
|
|
4054
|
+
})(exports.CodeLanguage || (exports.CodeLanguage = {}));
|
|
4055
|
+
|
|
4056
|
+
/**
|
|
4057
|
+
* Remove the node from the text block or image block strategy.
|
|
4058
|
+
*/
|
|
4059
|
+
class RemoveChildrenStrategy extends ActionHandleStrategy {
|
|
4060
|
+
/**
|
|
4061
|
+
* Remove the node or block from the parent.
|
|
4062
|
+
* Remove the block if the block children is empty after delete the current element.
|
|
4063
|
+
*
|
|
4064
|
+
* @param {RemoveChildrenAction} action - The remove child action instance.
|
|
4065
|
+
* @param {RTEBlock | VegaRTEContent} target - The parent block of the node that will be removed.
|
|
4066
|
+
*/
|
|
4067
|
+
handleAction(action, target) {
|
|
4068
|
+
const arrayFixed = target.children;
|
|
4069
|
+
target.children = arrayFixed.filter((node) => node !== action.entityToBeRemoved);
|
|
4070
|
+
if (target.children.length === 0 && 'parent' in target && target.parent) {
|
|
4071
|
+
if (!target.isListItemBlock()) {
|
|
4072
|
+
target.parent.apply(new RemoveChildrenAction(target));
|
|
4073
|
+
}
|
|
4074
|
+
else if (!target.nestList || !target.nestList.length) {
|
|
4075
|
+
target.parent.apply(new RemoveChildrenAction(target));
|
|
4076
|
+
}
|
|
4077
|
+
}
|
|
2948
4078
|
}
|
|
2949
4079
|
}
|
|
2950
4080
|
|
|
@@ -2978,6 +4108,13 @@ class RTECodeBlock extends RTEBlock {
|
|
|
2978
4108
|
language,
|
|
2979
4109
|
};
|
|
2980
4110
|
}
|
|
4111
|
+
/**
|
|
4112
|
+
* @inheritDoc
|
|
4113
|
+
*/
|
|
4114
|
+
toHtml() {
|
|
4115
|
+
const { language = exports.CodeLanguage['Plain Text'] } = this.children[0];
|
|
4116
|
+
return `<pre data-language="${language}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((node) => node.toHtml())}</pre>`;
|
|
4117
|
+
}
|
|
2981
4118
|
/**
|
|
2982
4119
|
* @inheritDoc
|
|
2983
4120
|
*/
|
|
@@ -3028,7 +4165,7 @@ class RTECodeBlock extends RTEBlock {
|
|
|
3028
4165
|
}
|
|
3029
4166
|
(() => {
|
|
3030
4167
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CODE_BLOCK, RTECodeBlock.name, new CodeBlockRemoveSelfStrategy());
|
|
3031
|
-
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.
|
|
4168
|
+
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.DELETE_CHILDREN, RTECodeBlock.name, new RemoveChildrenStrategy());
|
|
3032
4169
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.SWITCH_OUT_FROM_CODE_BLOCK, RTECodeBlock.name, new SwitchOutFromCodeBlockStrategy());
|
|
3033
4170
|
ActionHandleStrategyRegistry.register(exports.ModifyContentActionType.INSERT_IMAGE_TO_BLOCK, RTECodeBlock.name, new CodeBlockInsertImageStrategy());
|
|
3034
4171
|
})();
|
|
@@ -3037,52 +4174,53 @@ RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME = 'code-block-placeholder-element
|
|
|
3037
4174
|
exports.ActionHandleStrategy = ActionHandleStrategy;
|
|
3038
4175
|
exports.ActionHandleStrategyRegistry = ActionHandleStrategyRegistry;
|
|
3039
4176
|
exports.AnnotationAction = AnnotationAction;
|
|
3040
|
-
exports.
|
|
4177
|
+
exports.AppendChildrenAction = AppendChildrenAction;
|
|
3041
4178
|
exports.BlockAnnotation = BlockAnnotation;
|
|
3042
|
-
exports.BlockAppendNodesStrategy = BlockAppendNodesStrategy;
|
|
3043
4179
|
exports.BlockDeleteNodeContentStrategy = BlockDeleteNodeContentStrategy;
|
|
3044
|
-
exports.BlockDeleteTextContentStrategy = BlockDeleteTextContentStrategy;
|
|
3045
4180
|
exports.BlockInsertLineBreakStrategy = BlockInsertLineBreakStrategy;
|
|
3046
4181
|
exports.BlockInsertLineBreakWithBlocksStrategy = BlockInsertLineBreakWithBlocksStrategy;
|
|
3047
|
-
exports.BlockInsertNodesBeforeNodeStrategy = BlockInsertNodesBeforeNodeStrategy;
|
|
3048
4182
|
exports.BlockMergeNodesStrategy = BlockMergeNodesStrategy;
|
|
3049
|
-
exports.BlockRemoveNodeStrategy = BlockRemoveNodeStrategy;
|
|
3050
|
-
exports.BlockReplaceNodeWithNodesStrategy = BlockReplaceNodeWithNodesStrategy;
|
|
3051
4183
|
exports.BlockReplaceNodesStrategy = BlockReplaceNodesStrategy;
|
|
3052
4184
|
exports.BlockSplitWithTextNodeStrategy = BlockSplitWithTextNodeStrategy;
|
|
4185
|
+
exports.BlockUpdateHorizontalAlignmentStrategy = BlockUpdateHorizontalAlignmentStrategy;
|
|
3053
4186
|
exports.BoldAnnotation = BoldAnnotation;
|
|
3054
4187
|
exports.BoldAnnotationAction = BoldAnnotationAction;
|
|
3055
4188
|
exports.ClearFormattingAnnotationAction = ClearFormattingAnnotationAction;
|
|
3056
4189
|
exports.CodeAnnotationAction = CodeAnnotationAction;
|
|
3057
|
-
exports.
|
|
3058
|
-
exports.
|
|
3059
|
-
exports.
|
|
3060
|
-
exports.
|
|
3061
|
-
exports.
|
|
3062
|
-
exports.
|
|
4190
|
+
exports.CommonAnnotation = CommonAnnotation;
|
|
4191
|
+
exports.CustomAttributeAnnotation = CustomAttributeAnnotation;
|
|
4192
|
+
exports.CustomClassAnnotation = CustomClassAnnotation;
|
|
4193
|
+
exports.CustomStyleAnnotation = CustomStyleAnnotation;
|
|
4194
|
+
exports.HorizontalAlignmentAnnotationAction = HorizontalAlignmentAnnotationAction;
|
|
4195
|
+
exports.IndentAnnotationAction = IndentAnnotationAction;
|
|
4196
|
+
exports.InsertChildrenAfterAction = InsertChildrenAfterAction;
|
|
4197
|
+
exports.InsertChildrenBeforeAction = InsertChildrenBeforeAction;
|
|
4198
|
+
exports.ItalicAnnotationAction = ItalicAnnotationAction;
|
|
3063
4199
|
exports.LinkAnnotationAction = LinkAnnotationAction;
|
|
3064
|
-
exports.MergeTwoBlocksNodesAction = MergeTwoBlocksNodesAction;
|
|
3065
4200
|
exports.ModifyContentAction = ModifyContentAction;
|
|
3066
4201
|
exports.NodeAnnotation = NodeAnnotation;
|
|
3067
4202
|
exports.RTEBlock = RTEBlock;
|
|
3068
4203
|
exports.RTECodeBlock = RTECodeBlock;
|
|
3069
4204
|
exports.RTECodeBlockNode = RTECodeBlockNode;
|
|
3070
|
-
exports.
|
|
4205
|
+
exports.RTEDTOClassManager = RTEDTOClassManager$1;
|
|
4206
|
+
exports.RTEDecoratorNode = RTEDecoratorNode;
|
|
3071
4207
|
exports.RTENode = RTENode;
|
|
3072
4208
|
exports.RTETextBlock = RTETextBlock;
|
|
3073
4209
|
exports.RTETextNode = RTETextNode;
|
|
4210
|
+
exports.RTE_DEFAULT_TEXT_COLOR = RTE_DEFAULT_TEXT_COLOR;
|
|
3074
4211
|
exports.RTE_TEXT_COLORS = RTE_TEXT_COLORS;
|
|
3075
|
-
exports.
|
|
4212
|
+
exports.RemoveChildrenAction = RemoveChildrenAction;
|
|
4213
|
+
exports.RemoveChildrenStrategy = RemoveChildrenStrategy;
|
|
3076
4214
|
exports.ReplaceChildNodesAction = ReplaceChildNodesAction;
|
|
3077
4215
|
exports.SelectionChangeAction = SelectionChangeAction;
|
|
3078
4216
|
exports.SplitBlockWithNodeAction = SplitBlockWithNodeAction;
|
|
3079
|
-
exports.
|
|
4217
|
+
exports.StrikethroughAnnotationAction = StrikethroughAnnotationAction;
|
|
3080
4218
|
exports.SyncUpSelectionAction = SyncUpSelectionAction;
|
|
3081
4219
|
exports.TextColorAnnotation = TextColorAnnotation;
|
|
3082
4220
|
exports.TextSplittableAction = TextSplittableAction;
|
|
3083
4221
|
exports.TextStyleAnnotation = TextStyleAnnotation;
|
|
3084
4222
|
exports.TextStyleAnnotationAction = TextStyleAnnotationAction;
|
|
3085
|
-
exports.
|
|
4223
|
+
exports.UnderlineAnnotationAction = UnderlineAnnotationAction;
|
|
3086
4224
|
exports.UpdateCodeBlockAction = UpdateCodeBlockAction;
|
|
3087
4225
|
exports.UpdateTextAction = UpdateTextAction;
|
|
3088
4226
|
exports.ZERO_WIDTH_SPACE = ZERO_WIDTH_SPACE;
|