@globalpayments/vega 2.100.0 → 2.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{action-color-accessibility-validator-b8a9ef0f.js → action-color-accessibility-validator-61af71ae.js} +1 -1
- package/dist/cjs/{app-globals-48d067a7.js → app-globals-275ea7c7.js} +15 -7
- package/dist/cjs/{aria-dialog-focusable-trap-slimmer-62147489.js → aria-dialog-focusable-trap-slimmer-c79cc3f8.js} +1 -1
- package/dist/cjs/{child-nodes-event-prevent-slimmer-e0ac8467.js → child-nodes-event-prevent-slimmer-d720d7e9.js} +1 -1
- package/dist/cjs/{code-block-3b42c364.js → code-block-c598832d.js} +793 -781
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-bbe3bcaf.js → component-value-history-controller-slimmer.abstract-4bd47aa1.js} +3 -3
- package/dist/cjs/{content-state-87a06c1a.js → content-state-da23e822.js} +2 -2
- package/dist/cjs/countries-a8e3812a.js +251 -0
- package/dist/cjs/{dark-mode-style-controller-f3da3342.js → dark-mode-style-controller-ec04ece9.js} +45 -45
- package/dist/cjs/{element-appender-slimmer-f7ba5d9a.js → element-appender-slimmer-2aaf8e24.js} +20 -1
- package/dist/cjs/{event-emit-slimmer-34aa195e.js → event-emit-slimmer-67b5c186.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-fbaddc91.js → form-field-controller-slimmer-ac9337f4.js} +2 -2
- package/dist/cjs/{image-annotation-action-03d3e01a.js → image-annotation-action-378838c2.js} +4 -4
- package/dist/cjs/{image-extension-ccda26d3.js → image-extension-673ebe7f.js} +2 -2
- package/dist/cjs/index.cjs.js +14 -12
- package/dist/cjs/{internal-vega-event-manager-7003c84a.js → internal-vega-event-manager-976b9526.js} +10 -2
- package/dist/cjs/{link-extension-71eeaa9f.js → link-extension-f493e432.js} +2 -2
- package/dist/cjs/loader.cjs.js +13 -12
- package/dist/cjs/{public-rules-3dc5d02d.js → public-rules-bae12c47.js} +5 -5
- package/dist/cjs/{range-d29751e3.js → range-9f42fb40.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-05de7f0c.js → rich-text-editor-required-rule-bb232741.js} +1 -1
- package/dist/cjs/{split-cell-operation-ef783850.js → split-cell-operation-0d33123e.js} +3 -3
- package/dist/cjs/{string-input-formatter-slimmer-9747039f.js → string-input-formatter-slimmer-2e0a838e.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-e264a120.js → sub-state-notify-slimmer-3b33e31c.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-6033b824.js → sub-state-observer-slimmer-5b68ba3f.js} +1 -1
- package/dist/cjs/{token-extension-8d7bd451.js → token-extension-4badb962.js} +9 -9
- package/dist/cjs/vega-accordion.cjs.entry.js +3 -3
- package/dist/cjs/vega-app-footer.cjs.entry.js +4 -4
- package/dist/cjs/vega-app-header-button.cjs.entry.js +4 -4
- package/dist/cjs/vega-banner.cjs.entry.js +3 -3
- package/dist/cjs/vega-brand-logo.cjs.entry.js +1 -1
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/vega-button-circle.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-group_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-button-link.cjs.entry.js +5 -5
- package/dist/cjs/vega-button.cjs.entry.js +6 -6
- package/dist/cjs/vega-calendar_5.cjs.entry.js +122 -16
- package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-chip.cjs.entry.js +4 -4
- package/dist/cjs/vega-code-block.cjs.entry.js +9 -9
- package/dist/cjs/vega-color-picker.cjs.entry.js +6 -6
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +7 -7
- package/dist/cjs/vega-color-swatch.cjs.entry.js +3 -3
- package/dist/cjs/vega-combo-box.cjs.entry.js +7 -7
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-dialog_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +9 -9
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/{vega-event-id-58afed7a.js → vega-event-id-987a170c.js} +2 -0
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +6 -6
- package/dist/cjs/vega-flag-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-form.cjs.entry.js +7 -7
- package/dist/cjs/vega-image-uploader.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-numeric.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-passcode.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +16 -269
- package/dist/cjs/vega-input-range.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-select.cjs.entry.js +16 -33
- package/dist/cjs/vega-input.cjs.entry.js +8 -8
- package/dist/cjs/{vega-internal-event-id-f4d33037.js → vega-internal-event-id-98d499d7.js} +6 -2
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +5 -5
- package/dist/cjs/vega-popover_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-radio_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +9 -9
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +18 -18
- package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +3 -3
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-segment-control.cjs.entry.js +11 -4
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +6 -6
- package/dist/cjs/vega-signature-capture.cjs.entry.js +6 -6
- package/dist/cjs/vega-stepper.cjs.entry.js +7 -7
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-table_11.cjs.entry.js +620 -661
- package/dist/cjs/vega-textarea.cjs.entry.js +7 -7
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +6 -6
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +2 -2
- package/dist/cjs/vega.cjs.js +13 -12
- package/dist/cjs/{wait-for-component-did-render-44d006ee.js → wait-for-component-did-render-90edbc1a.js} +1 -1
- package/dist/collection/components/vega-button/vega-button.css +3 -3
- package/dist/collection/components/vega-button-circle/vega-button-circle.css +3 -3
- package/dist/collection/components/vega-button-link/vega-button-link.css +4 -4
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +45 -5
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.js +43 -1
- package/dist/collection/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.js +23 -4
- package/dist/collection/components/vega-calendar/vega-calendar.js +77 -1
- package/dist/collection/components/vega-flag-icon/slimmers/controllers/vega-flag-icon-controller.js +6 -6
- package/dist/collection/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.js +4 -8
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-prefix-icon-renderer.js +8 -28
- package/dist/collection/components/vega-input-select/vega-input-select.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +1 -2
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +18 -6
- package/dist/collection/components/vega-segment-control/slimmers/renderers/vega-segment-renderer.js +8 -1
- package/dist/collection/components/vega-segment-control/vega-segment-control.js +23 -0
- package/dist/collection/components/vega-table/slimmers/controllers/dto/column-render-input-model.js +25 -8
- package/dist/collection/components/vega-table/slimmers/controllers/dto/row-render-input-model.js +41 -0
- package/dist/collection/components/vega-table/slimmers/controllers/vega-table-head-template-structure-controller.js +1 -0
- package/dist/collection/components/vega-table/slimmers/controllers/vega-table-render-input-controller.js +316 -18
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-body-renderer.js +6 -1
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-header-renderer.js +1 -0
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-pinned-renderer.js +33 -530
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-row-renderer.js +1 -0
- package/dist/collection/components/vega-table/vega-table-cell/vega-table-cell.css +10 -0
- package/dist/collection/components/vega-table/vega-table-cell/vega-table-cell.js +25 -8
- package/dist/collection/components/vega-table/vega-table-expand-row/slimmers/renderers/vega-table-expand-row-renderer.js +14 -6
- package/dist/collection/components/vega-table/vega-table-expand-row/vega-table-expand-row.css +20 -0
- package/dist/collection/components/vega-table/vega-table-expand-row/vega-table-expand-row.js +7 -0
- package/dist/collection/components/vega-table/vega-table-foot-cell/slimmers/renderers/vega-table-foot-cell-renderer.js +21 -2
- package/dist/collection/components/vega-table/vega-table-foot-cell/vega-table-foot-cell.css +10 -0
- package/dist/collection/components/vega-table/vega-table-foot-cell/vega-table-foot-cell.js +12 -1
- package/dist/collection/components/vega-table/vega-table-foot-row/slimmers/renderers/vega-table-foot-row-renderer.js +20 -13
- package/dist/collection/components/vega-table/vega-table-foot-row/vega-table-foot-row.css +26 -0
- package/dist/collection/components/vega-table/vega-table-foot-row/vega-table-foot-row.js +12 -0
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.css +10 -0
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.js +19 -6
- package/dist/collection/components/vega-table/vega-table-head-row/slimmers/renderers/vega-table-head-row-renderer.js +21 -46
- package/dist/collection/components/vega-table/vega-table-head-row/vega-table-head-row.css +16 -7
- package/dist/collection/components/vega-table/vega-table-head-row/vega-table-head-row.js +9 -2
- package/dist/collection/components/vega-table/vega-table-row/slimmers/renderers/vega-table-row-renderer.js +28 -13
- package/dist/collection/components/vega-table/vega-table-row/vega-table-row.css +26 -0
- package/dist/collection/components/vega-table/vega-table-row/vega-table-row.js +11 -0
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-border-tokens.js +1 -1
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-color-tokens.js +20 -20
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-ring-tokens.js +1 -1
- package/dist/collection/constants/tokens/themes/v2-new-brand/dark-mode-shadow-tokens.js +1 -1
- package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-border-tokens.js +1 -1
- package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-color-tokens.js +19 -19
- package/dist/collection/constants/tokens/themes/v2-new-brand/light-mode-shadow-tokens.js +1 -1
- package/dist/collection/constants/ui.js +1 -0
- package/dist/collection/global/scripts/before-vega-load.js +8 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +10 -2
- package/dist/collection/helpers/event-manager/event-id/vega-event-id.js +1 -0
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +3 -1
- package/dist/collection/helpers/public-api.js +1 -0
- package/dist/collection/helpers/slimmers/position-calculation/position-calculation-controller.js +8 -0
- package/dist/collection/helpers/slimmers/position-calculation/screen-position-calculation-strategy.js +10 -0
- package/dist/collection/helpers/slimmers/vega-table-child-render-input-consumer-slimmer.js +2 -0
- package/dist/collection/helpers/ui/element-appender.js +1 -0
- package/dist/esm/{action-color-accessibility-validator-08877515.js → action-color-accessibility-validator-3e824a59.js} +1 -1
- package/dist/esm/{app-globals-1e1371d5.js → app-globals-ad3c7cea.js} +15 -7
- package/dist/esm/{aria-dialog-focusable-trap-slimmer-b2a24a45.js → aria-dialog-focusable-trap-slimmer-27a6aa19.js} +1 -1
- package/dist/esm/{child-nodes-event-prevent-slimmer-82626871.js → child-nodes-event-prevent-slimmer-0ebcbf47.js} +1 -1
- package/dist/esm/{code-block-741d6b8e.js → code-block-1cdf7a51.js} +793 -781
- package/dist/esm/{component-value-history-controller-slimmer.abstract-2bcd749e.js → component-value-history-controller-slimmer.abstract-bdeeb43f.js} +3 -3
- package/dist/esm/{content-state-2f6f4204.js → content-state-6eb610b8.js} +2 -2
- package/dist/esm/countries-50d3339b.js +249 -0
- package/dist/esm/{dark-mode-style-controller-352f15ff.js → dark-mode-style-controller-4e04a2d3.js} +45 -45
- package/dist/esm/{element-appender-slimmer-c820c0bf.js → element-appender-slimmer-dd4e2908.js} +20 -1
- package/dist/esm/{event-emit-slimmer-e8bb2292.js → event-emit-slimmer-12ee1593.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-02165dbe.js → form-field-controller-slimmer-5c794b4d.js} +2 -2
- package/dist/esm/{image-annotation-action-972c1074.js → image-annotation-action-cdd50dcc.js} +4 -4
- package/dist/esm/{image-extension-59484e9a.js → image-extension-f6dbd70c.js} +2 -2
- package/dist/esm/index.js +13 -12
- package/dist/esm/{internal-vega-event-manager-2ecc9186.js → internal-vega-event-manager-0c381f3b.js} +10 -2
- package/dist/esm/{link-extension-e89acb5c.js → link-extension-bc234cf7.js} +2 -2
- package/dist/esm/loader.js +13 -12
- package/dist/esm/{public-rules-c154201b.js → public-rules-8dc3fb00.js} +5 -5
- package/dist/esm/{range-c818a1eb.js → range-d2439ba7.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-878e91c6.js → rich-text-editor-required-rule-a0663a84.js} +1 -1
- package/dist/esm/{split-cell-operation-cc0cdf90.js → split-cell-operation-1a889fa0.js} +3 -3
- package/dist/esm/{string-input-formatter-slimmer-76fe52d3.js → string-input-formatter-slimmer-69887c40.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-e306c849.js → sub-state-notify-slimmer-ba72f30b.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-bd85f381.js → sub-state-observer-slimmer-bee1c7fa.js} +1 -1
- package/dist/esm/{token-extension-35c66684.js → token-extension-530d9bde.js} +9 -9
- package/dist/esm/vega-accordion.entry.js +3 -3
- package/dist/esm/vega-app-footer.entry.js +4 -4
- package/dist/esm/vega-app-header-button.entry.js +4 -4
- package/dist/esm/vega-banner.entry.js +3 -3
- package/dist/esm/vega-brand-logo.entry.js +1 -1
- package/dist/esm/vega-breadcrumb.entry.js +4 -4
- package/dist/esm/vega-button-circle.entry.js +6 -6
- package/dist/esm/vega-button-group_2.entry.js +7 -7
- package/dist/esm/vega-button-link.entry.js +5 -5
- package/dist/esm/vega-button.entry.js +6 -6
- package/dist/esm/vega-calendar_5.entry.js +122 -16
- package/dist/esm/vega-carousel.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +7 -7
- package/dist/esm/vega-chip.entry.js +4 -4
- package/dist/esm/vega-code-block.entry.js +9 -9
- package/dist/esm/vega-color-picker.entry.js +6 -6
- package/dist/esm/vega-color-swatch-picker.entry.js +7 -7
- package/dist/esm/vega-color-swatch.entry.js +3 -3
- package/dist/esm/vega-combo-box.entry.js +7 -7
- package/dist/esm/vega-date-picker_2.entry.js +11 -11
- package/dist/esm/vega-dialog_2.entry.js +6 -6
- package/dist/esm/vega-dropdown_5.entry.js +9 -9
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/{vega-event-id-f55f6977.js → vega-event-id-59cd9297.js} +2 -1
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +6 -6
- package/dist/esm/vega-flag-icon.entry.js +6 -6
- package/dist/esm/vega-form.entry.js +7 -7
- package/dist/esm/vega-image-uploader.entry.js +8 -8
- package/dist/esm/vega-input-credit-card.entry.js +7 -7
- package/dist/esm/vega-input-numeric.entry.js +8 -8
- package/dist/esm/vega-input-passcode.entry.js +7 -7
- package/dist/esm/vega-input-phone-number.entry.js +13 -266
- package/dist/esm/vega-input-range.entry.js +7 -7
- package/dist/esm/vega-input-select.entry.js +17 -34
- package/dist/esm/vega-input.entry.js +8 -8
- package/dist/esm/{vega-internal-event-id-86fce049.js → vega-internal-event-id-02093067.js} +4 -2
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-page-notification_2.entry.js +1 -1
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +4 -4
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +5 -5
- package/dist/esm/vega-popover_2.entry.js +6 -6
- package/dist/esm/vega-progress-tracker_2.entry.js +6 -6
- package/dist/esm/vega-radio_2.entry.js +7 -7
- package/dist/esm/vega-rich-text-content.entry.js +9 -9
- package/dist/esm/vega-rich-text-editor_4.entry.js +18 -18
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +3 -3
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +3 -3
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
- package/dist/esm/vega-segment-control.entry.js +11 -4
- package/dist/esm/vega-selection-chip_2.entry.js +8 -8
- package/dist/esm/vega-selection-tile_2.entry.js +8 -8
- package/dist/esm/vega-sidenav_3.entry.js +6 -6
- package/dist/esm/vega-signature-capture.entry.js +6 -6
- package/dist/esm/vega-stepper.entry.js +7 -7
- package/dist/esm/vega-tab-group_2.entry.js +4 -4
- package/dist/esm/vega-table_11.entry.js +620 -661
- package/dist/esm/vega-textarea.entry.js +7 -7
- package/dist/esm/vega-time-picker_2.entry.js +8 -8
- package/dist/esm/vega-toggle-switch.entry.js +6 -6
- package/dist/esm/vega-tooltip_2.entry.js +2 -2
- package/dist/esm/vega.js +13 -12
- package/dist/esm/{wait-for-component-did-render-9b91a826.js → wait-for-component-did-render-9e84d92d.js} +1 -1
- package/dist/sri/vega-sri-manifest.json +308 -304
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.d.ts +18 -0
- package/dist/types/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-preview-popover-renderer.d.ts +9 -0
- package/dist/types/components/vega-calendar/slimmers/month-view/renderers/vega-calendar-month-event-renderer.d.ts +9 -1
- package/dist/types/components/vega-calendar/types.d.ts +22 -0
- package/dist/types/components/vega-calendar/vega-calendar.d.ts +23 -1
- package/dist/types/components/vega-flag-icon/slimmers/controllers/vega-flag-icon-controller.d.ts +2 -2
- package/dist/types/components/vega-input-phone-number/slimmers/renderers/country-select-renderer.d.ts +0 -1
- package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-prefix-icon-renderer.d.ts +2 -14
- package/dist/types/components/vega-input-select/vega-input-select.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +11 -1
- package/dist/types/components/vega-segment-control/slimmers/renderers/vega-segment-renderer.d.ts +1 -0
- package/dist/types/components/vega-segment-control/types.d.ts +2 -0
- package/dist/types/components/vega-segment-control/vega-segment-control.d.ts +7 -1
- package/dist/types/components/vega-table/slimmers/controllers/dto/column-render-input-model.d.ts +17 -0
- package/dist/types/components/vega-table/slimmers/controllers/dto/row-render-input-model.d.ts +39 -0
- package/dist/types/components/vega-table/slimmers/controllers/vega-table-render-input-controller.d.ts +71 -7
- package/dist/types/components/vega-table/slimmers/renderers/vega-table-body-renderer.d.ts +1 -0
- package/dist/types/components/vega-table/slimmers/renderers/vega-table-pinned-renderer.d.ts +3 -88
- package/dist/types/components/vega-table/vega-table-expand-row/slimmers/renderers/vega-table-expand-row-renderer.d.ts +1 -1
- package/dist/types/components/vega-table/vega-table-expand-row/vega-table-expand-row.d.ts +5 -0
- package/dist/types/components/vega-table/vega-table-foot-cell/slimmers/renderers/vega-table-foot-cell-renderer.d.ts +1 -0
- package/dist/types/components/vega-table/vega-table-foot-cell/vega-table-foot-cell.d.ts +5 -0
- package/dist/types/components/vega-table/vega-table-foot-row/slimmers/renderers/vega-table-foot-row-renderer.d.ts +1 -3
- package/dist/types/components/vega-table/vega-table-foot-row/vega-table-foot-row.d.ts +5 -0
- package/dist/types/components/vega-table/vega-table-head-row/slimmers/renderers/vega-table-head-row-renderer.d.ts +0 -4
- package/dist/types/components/vega-table/vega-table-head-row/vega-table-head-row.d.ts +2 -2
- package/dist/types/components/vega-table/vega-table-row/slimmers/renderers/vega-table-row-renderer.d.ts +2 -3
- package/dist/types/components/vega-table/vega-table-row/vega-table-row.d.ts +4 -0
- package/dist/types/components.d.ts +33 -2
- package/dist/types/constants/ui.d.ts +1 -1
- package/dist/types/helpers/event-manager/event-id/vega-event-id.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +3 -1
- package/dist/types/helpers/public-api.d.ts +1 -0
- package/dist/types/helpers/slimmers/position-calculation/position-calculation-controller.d.ts +6 -0
- package/dist/types/helpers/slimmers/position-calculation/screen-position-calculation-strategy.d.ts +6 -0
- package/dist/types/helpers/slimmers/position-calculation/screen-scroll-position-update.d.ts +2 -1
- package/dist/types/helpers/slimmers/vega-table-child-render-input-consumer-slimmer.d.ts +2 -1
- package/dist/types/types/components.type.d.ts +7 -1
- package/dist/types/types/public-api.d.ts +1 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-85de755f.js → p-022cbf8a.js} +1 -1
- package/dist/vega/{p-284a8828.entry.js → p-02c1284e.entry.js} +1 -1
- package/dist/vega/{p-a488447f.js → p-069bbb4a.js} +1 -1
- package/dist/vega/{p-9efa5d76.js → p-08fd229c.js} +1 -1
- package/dist/vega/{p-e11c6ec4.entry.js → p-131ce9df.entry.js} +1 -1
- package/dist/vega/{p-bedb575c.entry.js → p-143ee395.entry.js} +1 -1
- package/dist/vega/p-178634f3.js +1 -0
- package/dist/vega/{p-9e9f49f4.js → p-1836a6a5.js} +1 -1
- package/dist/vega/p-1dbf8d1f.js +1 -0
- package/dist/vega/p-2dda5c65.entry.js +1 -0
- package/dist/vega/{p-3abb793c.entry.js → p-30010c41.entry.js} +1 -1
- package/dist/vega/p-32f5a6dd.entry.js +1 -0
- package/dist/vega/{p-7ddc0bec.entry.js → p-3460a1c5.entry.js} +1 -1
- package/dist/vega/{p-b07f587a.entry.js → p-34b523da.entry.js} +1 -1
- package/dist/vega/{p-5b9b1631.entry.js → p-357c0226.entry.js} +1 -1
- package/dist/vega/p-361f8996.js +1 -0
- package/dist/vega/p-36ee9d54.js +1 -0
- package/dist/vega/{p-2c8dc0d2.entry.js → p-37d5c37e.entry.js} +1 -1
- package/dist/vega/{p-3f2a4b34.entry.js → p-45ad2d90.entry.js} +1 -1
- package/dist/vega/{p-5d9be870.entry.js → p-4b117bfd.entry.js} +1 -1
- package/dist/vega/p-4e70836a.entry.js +1 -0
- package/dist/vega/{p-8fc0a820.js → p-4ea477d5.js} +1 -1
- package/dist/vega/{p-cd0a108b.entry.js → p-50e8e24f.entry.js} +1 -1
- package/dist/vega/{p-7e22610b.entry.js → p-522a6eec.entry.js} +1 -1
- package/dist/vega/p-53e3f259.js +1 -0
- package/dist/vega/{p-2c737fc8.js → p-5536146c.js} +1 -1
- package/dist/vega/{p-5789690b.entry.js → p-55c2c0df.entry.js} +1 -1
- package/dist/vega/p-587130f6.entry.js +1 -0
- package/dist/vega/{p-379736e2.js → p-58c8a4ac.js} +1 -1
- package/dist/vega/{p-c422ee02.entry.js → p-5c17ddda.entry.js} +1 -1
- package/dist/vega/{p-ea1a0046.entry.js → p-5c9c0c0d.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-60010f14.entry.js +1 -0
- package/dist/vega/p-6098c4bb.js +1 -0
- package/dist/vega/{p-debf9e06.entry.js → p-61e63c0e.entry.js} +1 -1
- package/dist/vega/{p-7469d0d1.entry.js → p-62254dc7.entry.js} +1 -1
- package/dist/vega/{p-7a03ef96.entry.js → p-62ae9327.entry.js} +1 -1
- package/dist/vega/p-66245bc0.entry.js +1 -0
- package/dist/vega/{p-46f22f6c.entry.js → p-68ca8d3c.entry.js} +1 -1
- package/dist/vega/p-6a6c1279.js +1 -0
- package/dist/vega/{p-61ed7268.entry.js → p-6ae93679.entry.js} +1 -1
- package/dist/vega/{p-c7d46740.entry.js → p-6d90d28d.entry.js} +1 -1
- package/dist/vega/{p-6fd8f14b.js → p-6fae6768.js} +1 -1
- package/dist/vega/{p-8cfdd0e8.entry.js → p-71813a9e.entry.js} +1 -1
- package/dist/vega/{p-816b5fd2.entry.js → p-729529d6.entry.js} +1 -1
- package/dist/vega/{p-7ae4cf82.entry.js → p-75bfbffe.entry.js} +1 -1
- package/dist/vega/{p-bfe5dff7.entry.js → p-764b4e51.entry.js} +1 -1
- package/dist/vega/{p-5c3649f9.js → p-7d3419c7.js} +1 -1
- package/dist/vega/{p-a48468b5.entry.js → p-8e8b5790.entry.js} +1 -1
- package/dist/vega/{p-bc0e5598.entry.js → p-9236b8d9.entry.js} +1 -1
- package/dist/vega/p-9402f32f.js +1 -0
- package/dist/vega/{p-02b5d4ac.entry.js → p-942f9ea6.entry.js} +1 -1
- package/dist/vega/{p-c032f626.entry.js → p-9fdf66a8.entry.js} +1 -1
- package/dist/vega/{p-edd7aa92.entry.js → p-a2c45173.entry.js} +1 -1
- package/dist/vega/{p-ab253867.entry.js → p-a54ed341.entry.js} +1 -1
- package/dist/vega/{p-0f344e02.entry.js → p-a8a246e8.entry.js} +1 -1
- package/dist/vega/{p-bc119e75.entry.js → p-af0e9bd5.entry.js} +1 -1
- package/dist/vega/p-b1557bbe.js +1 -0
- package/dist/vega/p-b94f164a.entry.js +1 -0
- package/dist/vega/{p-01ca92e6.entry.js → p-bbfffe6b.entry.js} +1 -1
- package/dist/vega/{p-5006404e.entry.js → p-beccc38c.entry.js} +1 -1
- package/dist/vega/{p-b52d7724.js → p-c51de680.js} +1 -1
- package/dist/vega/{p-fe985b52.js → p-c601eea6.js} +1 -1
- package/dist/vega/{p-d340ee3d.entry.js → p-c6d2513c.entry.js} +1 -1
- package/dist/vega/{p-4d1896e0.entry.js → p-ca6bd3a0.entry.js} +1 -1
- package/dist/vega/{p-411cadbc.entry.js → p-cab890be.entry.js} +1 -1
- package/dist/vega/p-cb1cd15f.entry.js +1 -0
- package/dist/vega/p-d1f47512.js +1 -0
- package/dist/vega/{p-23db0a92.entry.js → p-d37d2ea4.entry.js} +1 -1
- package/dist/vega/{p-76999ea1.entry.js → p-d3e99d4a.entry.js} +1 -1
- package/dist/vega/{p-7cc8855d.entry.js → p-d6bd3ce4.entry.js} +1 -1
- package/dist/vega/{p-cd04b149.entry.js → p-d7838f6e.entry.js} +1 -1
- package/dist/vega/{p-79b49e8d.entry.js → p-d8c9ea46.entry.js} +1 -1
- package/dist/vega/p-d9588b3f.entry.js +1 -0
- package/dist/vega/{p-74b20563.entry.js → p-db69a5c9.entry.js} +1 -1
- package/dist/vega/{p-9ba2fdff.js → p-de1d0284.js} +1 -1
- package/dist/vega/{p-e0a51e49.js → p-de6fc52c.js} +1 -1
- package/dist/vega/{p-efc08027.entry.js → p-e48b7a8a.entry.js} +1 -1
- package/dist/vega/{p-d897acd5.js → p-e6f67a44.js} +1 -1
- package/dist/vega/{p-844ad6aa.entry.js → p-e8e3bf74.entry.js} +1 -1
- package/dist/vega/p-eadc10bc.entry.js +1 -0
- package/dist/vega/p-ee329596.entry.js +1 -0
- package/dist/vega/p-f01bc6a2.js +1 -0
- package/dist/vega/p-f324e90e.js +1 -0
- package/dist/vega/{p-493108d5.js → p-f48519d2.js} +1 -1
- package/dist/vega/{p-35d37477.entry.js → p-f8d13d01.entry.js} +1 -1
- package/dist/vega/{p-aaaf21eb.entry.js → p-f99f054c.entry.js} +1 -1
- package/dist/vega/{p-49de5559.entry.js → p-fe41e3b6.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-06a42a9f.entry.js +0 -1
- package/dist/vega/p-0cd362f3.entry.js +0 -1
- package/dist/vega/p-0e10798b.entry.js +0 -1
- package/dist/vega/p-401c6764.js +0 -1
- package/dist/vega/p-4a2fe3a4.js +0 -1
- package/dist/vega/p-5447a8e8.js +0 -1
- package/dist/vega/p-5a086e93.js +0 -1
- package/dist/vega/p-5b3c8a56.js +0 -1
- package/dist/vega/p-6336d446.entry.js +0 -1
- package/dist/vega/p-7f395622.entry.js +0 -1
- package/dist/vega/p-8663314e.js +0 -1
- package/dist/vega/p-86fb46d2.entry.js +0 -1
- package/dist/vega/p-8c30a60d.js +0 -1
- package/dist/vega/p-9034f709.js +0 -1
- package/dist/vega/p-a306bb39.js +0 -1
- package/dist/vega/p-a647c856.entry.js +0 -1
- package/dist/vega/p-a92cd703.js +0 -1
- package/dist/vega/p-ad367b48.entry.js +0 -1
- package/dist/vega/p-d1bb6e7a.entry.js +0 -1
- package/dist/vega/p-e5abc288.entry.js +0 -1
- package/dist/vega/p-ef1bbf14.js +0 -1
- package/dist/vega/p-f8bf379c.entry.js +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
2
2
|
import { d as domNodeSubjectFactory } from './dom-node-subject-observer-factory-bb7e68a0.js';
|
|
3
|
-
import { e as VegaInternalRichTextEditorFlushChanges, f as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-
|
|
3
|
+
import { e as VegaInternalRichTextEditorFlushChanges, f as VegaInternalRichTextEditorSelectionRangeChange } from './vega-internal-event-id-02093067.js';
|
|
4
4
|
import { d as dashCaseToCamel, c as camelToDashCase } from './string-a953eafc.js';
|
|
5
5
|
import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
|
|
6
6
|
import { i as isNonNullable } from './type-guard-26d83e7e.js';
|
|
7
7
|
import { T as TypographyUrls } from './typography-19c3b9be.js';
|
|
8
8
|
import { g as generateUUID } from './misc-9fdbcfbb.js';
|
|
9
|
-
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-
|
|
9
|
+
import { V as VegaInternalThemeManager } from './dark-mode-style-controller-4e04a2d3.js';
|
|
10
10
|
import { c as cleanObject } from './object-0c277f57.js';
|
|
11
11
|
import { f as findParent } from './ui-80e610f4.js';
|
|
12
12
|
|
|
@@ -2033,22 +2033,654 @@ class RTEBlock {
|
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
2035
2035
|
|
|
2036
|
+
/**
|
|
2037
|
+
* Append children to a block or rte content
|
|
2038
|
+
*
|
|
2039
|
+
* @example parent.apply(new AppendChildrenAction([newChildren]))
|
|
2040
|
+
*/
|
|
2041
|
+
class AppendChildrenAction extends ModifyContentAction {
|
|
2042
|
+
constructor(childNodes) {
|
|
2043
|
+
super();
|
|
2044
|
+
this.type = ModifyContentActionType.APPEND_CHILDREN;
|
|
2045
|
+
this.entityToBeAppended = childNodes;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
const TEXT_STYLE_DEFAULT_FONT_WEIGHT = '500';
|
|
2050
|
+
const TEXT_STYLE_BASE = {
|
|
2051
|
+
fontFamily: 'Inter',
|
|
2052
|
+
fontSize: '16px',
|
|
2053
|
+
lineHeight: '22px',
|
|
2054
|
+
minHeight: '22px',
|
|
2055
|
+
fontWeight: TEXT_STYLE_DEFAULT_FONT_WEIGHT,
|
|
2056
|
+
};
|
|
2057
|
+
const PARAGRAPH_TEXT_STYLE = Object.assign(Object.assign({}, TEXT_STYLE_BASE), { marginTop: '0px', marginBottom: '0px' });
|
|
2058
|
+
const TEXT_STYLE_DEFAULTS = {
|
|
2059
|
+
'paragraph': PARAGRAPH_TEXT_STYLE,
|
|
2060
|
+
'title': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '36px', lineHeight: '40px', minHeight: '40px' }),
|
|
2061
|
+
'subtitle': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '28px', lineHeight: '32px', minHeight: '32px' }),
|
|
2062
|
+
'heading-1': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '22px', lineHeight: '24px', minHeight: '24px' }),
|
|
2063
|
+
'heading-2': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '20px', lineHeight: '24px', minHeight: '24px' }),
|
|
2064
|
+
'heading-3': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '18px' }),
|
|
2065
|
+
'heading-4': Object.assign({}, PARAGRAPH_TEXT_STYLE),
|
|
2066
|
+
'heading-5': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '14px' }),
|
|
2067
|
+
'heading-6': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '12px' }),
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
/**
|
|
2071
|
+
* Text style annotation
|
|
2072
|
+
*/
|
|
2073
|
+
class TextStyleAnnotation extends BlockAnnotation {
|
|
2074
|
+
constructor(textStyle) {
|
|
2075
|
+
super();
|
|
2076
|
+
this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
2077
|
+
this.textStyle = textStyle;
|
|
2078
|
+
}
|
|
2079
|
+
/**
|
|
2080
|
+
* Generate the map item for the annotations
|
|
2081
|
+
*
|
|
2082
|
+
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
2083
|
+
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
2084
|
+
*/
|
|
2085
|
+
static from(textStyle) {
|
|
2086
|
+
return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* Get the default styles for a given text style type.
|
|
2090
|
+
*
|
|
2091
|
+
* @param {VegaRTETextStyleType} textStyle - The text style type.
|
|
2092
|
+
* @returns {Nullable<AnnotationStyle>} The default styles for the given text style type.
|
|
2093
|
+
*/
|
|
2094
|
+
static getDefaultStyles(textStyle) {
|
|
2095
|
+
if (!textStyle)
|
|
2096
|
+
return null;
|
|
2097
|
+
return TEXT_STYLE_DEFAULTS[textStyle];
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Generate the JSON representation of the annotation
|
|
2101
|
+
*
|
|
2102
|
+
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
2103
|
+
*/
|
|
2104
|
+
toJSON() {
|
|
2105
|
+
return { textStyle: this.textStyle };
|
|
2106
|
+
}
|
|
2107
|
+
/**
|
|
2108
|
+
* @inheritDoc
|
|
2109
|
+
*/
|
|
2110
|
+
clone() {
|
|
2111
|
+
return new TextStyleAnnotation(this.textStyle);
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* @inheritDoc
|
|
2115
|
+
*/
|
|
2116
|
+
renderClass(options) {
|
|
2117
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
2118
|
+
return null;
|
|
2119
|
+
return this.textStyle ? `v-rte--text-style-${this.textStyle}` : null;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
* @inheritDoc
|
|
2123
|
+
*/
|
|
2124
|
+
renderStyle(options) {
|
|
2125
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
2126
|
+
return null;
|
|
2127
|
+
return this.textStyle ? TextStyleAnnotation.getDefaultStyles(this.textStyle) : null;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2036
2131
|
/**
|
|
2037
2132
|
* Abstract class for annotation actions
|
|
2038
2133
|
*/
|
|
2039
|
-
class AnnotationAction {
|
|
2134
|
+
class AnnotationAction {
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Action to change the text style of a block
|
|
2139
|
+
*/
|
|
2140
|
+
class TextStyleAnnotationAction extends AnnotationAction {
|
|
2141
|
+
constructor(textStyle, bold) {
|
|
2142
|
+
super();
|
|
2143
|
+
this.isFlushable = true;
|
|
2144
|
+
this.textStyle = textStyle;
|
|
2145
|
+
this.bold = bold;
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Converts the action to a block annotation
|
|
2149
|
+
*
|
|
2150
|
+
* @returns {BlockAnnotation} the block annotation
|
|
2151
|
+
*/
|
|
2152
|
+
toAnnotation() {
|
|
2153
|
+
return new TextStyleAnnotation(this.textStyle);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* Annotation to make text a link
|
|
2159
|
+
*/
|
|
2160
|
+
class LinkAnnotation extends NodeAnnotation {
|
|
2161
|
+
constructor(link, useInternalStyle = true) {
|
|
2162
|
+
super();
|
|
2163
|
+
this.type = NodeAnnotationTypeEnum.LINK;
|
|
2164
|
+
this.link = link;
|
|
2165
|
+
this.useInternalStyle = useInternalStyle;
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* Generate the map item for the annotation
|
|
2169
|
+
*
|
|
2170
|
+
* @param {VegaRTELink} link - Bold annotation
|
|
2171
|
+
* @param {boolean} useInternalStyle - Whether to use default style for the link
|
|
2172
|
+
* @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
|
|
2173
|
+
*/
|
|
2174
|
+
static from(link, useInternalStyle = true) {
|
|
2175
|
+
return [NodeAnnotationTypeEnum.LINK, new LinkAnnotation(link, useInternalStyle)];
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Generate the JSON representation of the annotation
|
|
2179
|
+
*
|
|
2180
|
+
* @returns {Record<'link', VegaRTELink>} JSON representation of the annotation
|
|
2181
|
+
*/
|
|
2182
|
+
toJSON() {
|
|
2183
|
+
return {
|
|
2184
|
+
link: this.link,
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* @inheritDoc
|
|
2189
|
+
*/
|
|
2190
|
+
clone() {
|
|
2191
|
+
return new LinkAnnotation(this.link, this.useInternalStyle);
|
|
2192
|
+
}
|
|
2193
|
+
/**
|
|
2194
|
+
* Verify whether two link annotation is same or not
|
|
2195
|
+
*
|
|
2196
|
+
* @param {LinkAnnotation} annotation - Compared annotation
|
|
2197
|
+
* @returns {boolean} Whether two link annotation is same or not
|
|
2198
|
+
*/
|
|
2199
|
+
toEqual(annotation) {
|
|
2200
|
+
return this.link.groupKey === annotation.link.groupKey;
|
|
2201
|
+
}
|
|
2202
|
+
/**
|
|
2203
|
+
* @inheritDoc
|
|
2204
|
+
*/
|
|
2205
|
+
renderClass() {
|
|
2206
|
+
return null;
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* @inheritDoc
|
|
2210
|
+
*/
|
|
2211
|
+
renderStyle() {
|
|
2212
|
+
return null;
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* Abstract class for which can be splittable
|
|
2218
|
+
*/
|
|
2219
|
+
class TextSplittableAction extends AnnotationAction {
|
|
2220
|
+
constructor() {
|
|
2221
|
+
super(...arguments);
|
|
2222
|
+
/**
|
|
2223
|
+
* Whether the action should split the node
|
|
2224
|
+
*/
|
|
2225
|
+
this.doSplit = true;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Action to toggle link annotation
|
|
2231
|
+
*/
|
|
2232
|
+
class LinkAnnotationAction extends TextSplittableAction {
|
|
2233
|
+
constructor({ link, newText, needMergeNode, doSplit, type, }) {
|
|
2234
|
+
super();
|
|
2235
|
+
this.isFlushable = true;
|
|
2236
|
+
this.link = link;
|
|
2237
|
+
this.needMergeNode = needMergeNode;
|
|
2238
|
+
this.newText = newText;
|
|
2239
|
+
this.type = type;
|
|
2240
|
+
if (isNonNullable(doSplit)) {
|
|
2241
|
+
this.doSplit = doSplit;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
/**
|
|
2245
|
+
* Converts the action to an annotation
|
|
2246
|
+
*
|
|
2247
|
+
* @returns {LinkAnnotation} the annotation
|
|
2248
|
+
*/
|
|
2249
|
+
toAnnotation() {
|
|
2250
|
+
return new LinkAnnotation(this.link);
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* Action to link a group of nodes
|
|
2256
|
+
*/
|
|
2257
|
+
class LinkGroupAnnotationAction extends AnnotationAction {
|
|
2258
|
+
constructor(groupKey, nodes, type) {
|
|
2259
|
+
super();
|
|
2260
|
+
this.isFlushable = false;
|
|
2261
|
+
this.groupKey = groupKey;
|
|
2262
|
+
this.nodes = nodes;
|
|
2263
|
+
this.type = type;
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Converts the action to an annotation
|
|
2267
|
+
*
|
|
2268
|
+
* @returns {Annotation} The annotation
|
|
2269
|
+
*/
|
|
2270
|
+
toAnnotation() {
|
|
2271
|
+
return new LinkGroupAnnotation(this.groupKey);
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* Default CSS style values produced by inline text-formatting annotations.
|
|
2277
|
+
*
|
|
2278
|
+
* These constants are the single source of truth for the CSS values that
|
|
2279
|
+
* bold, italic, underline and strikethrough semantic annotations render as
|
|
2280
|
+
* (in standalone mode) and that annotation handlers / filter strategies use
|
|
2281
|
+
* to detect or remove redundant inline styles.
|
|
2282
|
+
*/
|
|
2283
|
+
/** CSS `font-weight` value rendered by the bold annotation. */
|
|
2284
|
+
const BOLD_FONT_WEIGHT = '700';
|
|
2285
|
+
/** Alternative `font-weight` keyword that browsers report for bold elements. */
|
|
2286
|
+
const BOLD_FONT_WEIGHT_KEYWORD = 'bold';
|
|
2287
|
+
/** CSS `font-style` value rendered by the italic annotation. */
|
|
2288
|
+
const ITALIC_FONT_STYLE = 'italic';
|
|
2289
|
+
/** CSS `text-decoration` token rendered by the underline annotation. */
|
|
2290
|
+
const UNDERLINE_TEXT_DECORATION = 'underline';
|
|
2291
|
+
/** CSS `text-decoration` token rendered by the strikethrough annotation. */
|
|
2292
|
+
const STRIKETHROUGH_TEXT_DECORATION = 'line-through';
|
|
2293
|
+
/** CSS `font-family` value rendered by the code annotation. */
|
|
2294
|
+
const CODE_FONT_FAMILY = 'Roboto Mono';
|
|
2295
|
+
/** CSS `white-space` value rendered by the code annotation. */
|
|
2296
|
+
const CODE_WHITE_SPACE = 'pre-wrap';
|
|
2297
|
+
|
|
2298
|
+
/**
|
|
2299
|
+
* Annotation to make text bold
|
|
2300
|
+
*/
|
|
2301
|
+
class BoldAnnotation extends NodeAnnotation {
|
|
2302
|
+
constructor(bold) {
|
|
2303
|
+
super();
|
|
2304
|
+
this.type = NodeAnnotationTypeEnum.BOLD;
|
|
2305
|
+
this.bold = bold;
|
|
2306
|
+
}
|
|
2307
|
+
/**
|
|
2308
|
+
* Generate the map item for the annotation
|
|
2309
|
+
*
|
|
2310
|
+
* @param {boolean} bold - Bold annotation
|
|
2311
|
+
* @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
|
|
2312
|
+
*/
|
|
2313
|
+
static from(bold) {
|
|
2314
|
+
return [NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
|
|
2315
|
+
}
|
|
2316
|
+
/**
|
|
2317
|
+
* Generate the JSON representation of the annotation
|
|
2318
|
+
*
|
|
2319
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
2320
|
+
*/
|
|
2321
|
+
toJSON() {
|
|
2322
|
+
return {
|
|
2323
|
+
bold: this.bold,
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* @inheritDoc
|
|
2328
|
+
*/
|
|
2329
|
+
clone() {
|
|
2330
|
+
return new BoldAnnotation(this.bold);
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* @inheritDoc
|
|
2334
|
+
*/
|
|
2335
|
+
renderClass(options) {
|
|
2336
|
+
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
2337
|
+
return null;
|
|
2338
|
+
return this.bold ? 'v-rte--bold' : null;
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* @inheritDoc
|
|
2342
|
+
*/
|
|
2343
|
+
renderStyle(options) {
|
|
2344
|
+
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
2345
|
+
return null;
|
|
2346
|
+
return this.bold ? { fontWeight: BOLD_FONT_WEIGHT } : null;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
* Action to toggle bold annotation
|
|
2352
|
+
*/
|
|
2353
|
+
class BoldAnnotationAction extends TextSplittableAction {
|
|
2354
|
+
constructor(bold) {
|
|
2355
|
+
super();
|
|
2356
|
+
this.isFlushable = true;
|
|
2357
|
+
this.bold = bold;
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* Converts the action to an annotation
|
|
2361
|
+
*
|
|
2362
|
+
* @returns {BoldAnnotation} the annotation
|
|
2363
|
+
*/
|
|
2364
|
+
toAnnotation() {
|
|
2365
|
+
return new BoldAnnotation(this.bold);
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2369
|
+
/**
|
|
2370
|
+
* Delete the node annotation by type
|
|
2371
|
+
*/
|
|
2372
|
+
class DeleteNodeAnnotationAction extends AnnotationAction {
|
|
2373
|
+
constructor(annotationType) {
|
|
2374
|
+
super();
|
|
2375
|
+
this.isFlushable = true;
|
|
2376
|
+
this.annotationType = annotationType;
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Don't need this for this action
|
|
2380
|
+
*
|
|
2381
|
+
* @returns {Nullable<Annotation>} undefined
|
|
2382
|
+
*/
|
|
2383
|
+
toAnnotation() {
|
|
2384
|
+
return undefined;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
2390
|
+
*/
|
|
2391
|
+
class ActionHandleStrategy {
|
|
2392
|
+
/**
|
|
2393
|
+
* Public method to invoke the handle logic.
|
|
2394
|
+
*
|
|
2395
|
+
* @typedef R generic type
|
|
2396
|
+
* @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
|
|
2397
|
+
* @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
|
|
2398
|
+
* @returns {R} - The invoke result in special strategy.
|
|
2399
|
+
*/
|
|
2400
|
+
execute(action, target) {
|
|
2401
|
+
LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
|
|
2402
|
+
return this.handleAction(action, target);
|
|
2403
|
+
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Update the custom style annotation of a block or node
|
|
2406
|
+
*
|
|
2407
|
+
* @param {RTEBlock | RTETextNode} item - block or node
|
|
2408
|
+
* @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
|
|
2409
|
+
*/
|
|
2410
|
+
updateCustomStyleAnnotation(item, styleKeys) {
|
|
2411
|
+
const customStyleAnnotation = item.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_STYLE);
|
|
2412
|
+
if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
|
|
2413
|
+
item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
/**
|
|
2417
|
+
* Create a new paragraph block with the given text.
|
|
2418
|
+
*
|
|
2419
|
+
* @param {string} text - The text content for the new paragraph.
|
|
2420
|
+
* @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
|
|
2421
|
+
*/
|
|
2422
|
+
createNewParagraph(text) {
|
|
2423
|
+
const dtoClass = RTEDTOClassManager$1.getRTEBlockClass('paragraph');
|
|
2424
|
+
if (dtoClass) {
|
|
2425
|
+
const newParagraph = dtoClass.from({
|
|
2426
|
+
id: generateUUID(),
|
|
2427
|
+
type: 'paragraph',
|
|
2428
|
+
nodes: [{ id: generateUUID(), type: 'text', text }],
|
|
2429
|
+
});
|
|
2430
|
+
return newParagraph;
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
/**
|
|
2434
|
+
* Get the root content from a child block or node.
|
|
2435
|
+
*
|
|
2436
|
+
* @param {RTEBlock | RTENode} child - The child block or node.
|
|
2437
|
+
* @returns {Nullable<VegaRTEContent>} The root content, if found.
|
|
2438
|
+
*/
|
|
2439
|
+
getRootContent(child) {
|
|
2440
|
+
const parent = child.parent;
|
|
2441
|
+
if (parent) {
|
|
2442
|
+
if (parent.dtoName === 'VegaRTEContent') {
|
|
2443
|
+
return parent;
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
return this.getRootContent(parent);
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Check the caret position at the start of a block.
|
|
2452
|
+
*
|
|
2453
|
+
* @param {RTEBlock} block - The RTE Block.
|
|
2454
|
+
* @param {RTENode} node - The RTE Node.
|
|
2455
|
+
* @param {number} offset - The offset position.
|
|
2456
|
+
* @returns {boolean} - Whether the caret is at the start of the block.
|
|
2457
|
+
*/
|
|
2458
|
+
isCaretPositionAtBlockStart(block, node, offset) {
|
|
2459
|
+
return node === block.children[0] && offset === 0;
|
|
2460
|
+
}
|
|
2461
|
+
/**
|
|
2462
|
+
* Check the caret position at the end of a block.
|
|
2463
|
+
*
|
|
2464
|
+
* @param {RTEBlock} block - The RTE Block.
|
|
2465
|
+
* @param {RTENode} node - The RTE Node.
|
|
2466
|
+
* @param {number} offset - The offset position.
|
|
2467
|
+
* @returns {boolean} - Whether the caret is at the end of the block.
|
|
2468
|
+
*/
|
|
2469
|
+
isCaretPositionAtBlockEnd(block, node, offset) {
|
|
2470
|
+
if (!node.isContentEditable()) {
|
|
2471
|
+
return this.isCaretPositionAtDecoratorBlockEnd(block, node, offset);
|
|
2472
|
+
}
|
|
2473
|
+
else {
|
|
2474
|
+
return this.isCaretPositionAtTextBlockEnd(block, node, offset);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Get the registered DOM element by the RTE entity.
|
|
2479
|
+
*
|
|
2480
|
+
* @param {RTEBlock | RTENode} instance - The RTE block or node instance.
|
|
2481
|
+
* @returns {Nullable<HTMLElement>} The registered DOM element.
|
|
2482
|
+
*/
|
|
2483
|
+
getDOMByEntity(instance) {
|
|
2484
|
+
return stateEntityRenderingRegistry.getDOMByEntity(instance);
|
|
2485
|
+
}
|
|
2486
|
+
/**
|
|
2487
|
+
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
2488
|
+
*
|
|
2489
|
+
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
2490
|
+
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
2491
|
+
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
2492
|
+
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
2493
|
+
*/
|
|
2494
|
+
isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
|
|
2495
|
+
const lastNode = textBlock.children[textBlock.children.length - 1];
|
|
2496
|
+
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
2497
|
+
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Checks if the caret position is at the end of a given decorator node.
|
|
2500
|
+
*
|
|
2501
|
+
* @param {RTEBlock} target - The image block.
|
|
2502
|
+
* @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
|
|
2503
|
+
* @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
|
|
2504
|
+
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
|
|
2505
|
+
*/
|
|
2506
|
+
isCaretPositionAtDecoratorBlockEnd(target, node, startOffset) {
|
|
2507
|
+
return node === target.children[target.children.length - 1] && startOffset !== 0;
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Determines if the custom style annotation includes any the custom style.
|
|
2511
|
+
*
|
|
2512
|
+
* @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
|
|
2513
|
+
* @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
|
|
2514
|
+
* @returns {boolean} - True if the custom key includes the custom style, false otherwise.
|
|
2515
|
+
*/
|
|
2516
|
+
isCustomStyle(customStyleAnnotation, styleKeys) {
|
|
2517
|
+
return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* Update the text block text style strategy.
|
|
2523
|
+
*/
|
|
2524
|
+
class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
|
|
2525
|
+
/**
|
|
2526
|
+
* Update the text block type and add or remove the bold style from child nodes.
|
|
2527
|
+
*
|
|
2528
|
+
* @param {TextStyleAnnotationAction} action - The text style annotation action.
|
|
2529
|
+
* @param {RTETextBlock} target - The current text block.
|
|
2530
|
+
*/
|
|
2531
|
+
handleAction(action, target) {
|
|
2532
|
+
if (target.type !== 'list-item') {
|
|
2533
|
+
target.type = action.textStyle;
|
|
2534
|
+
}
|
|
2535
|
+
if (action.bold) {
|
|
2536
|
+
target.children.forEach((node) => {
|
|
2537
|
+
const boldAnnotationAction = new BoldAnnotationAction(true);
|
|
2538
|
+
boldAnnotationAction.doSplit = false;
|
|
2539
|
+
node.apply(boldAnnotationAction);
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
else {
|
|
2543
|
+
target.children.forEach((node) => {
|
|
2544
|
+
node.apply(new DeleteNodeAnnotationAction(NodeAnnotationTypeEnum.BOLD));
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
/**
|
|
2552
|
+
* Update the text block link group annotation strategy.
|
|
2553
|
+
*/
|
|
2554
|
+
class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
|
|
2555
|
+
/**
|
|
2556
|
+
* Update link group after the child link node update.
|
|
2557
|
+
*
|
|
2558
|
+
* @param {LinkGroupAnnotationAction} action - The link group annotation action instance.
|
|
2559
|
+
* @param {RTETextBlock} target - The current text block.
|
|
2560
|
+
*/
|
|
2561
|
+
handleAction(action, target) {
|
|
2562
|
+
let linkGroupAnnotation = target.getAnnotationByType(InternalAnnotationTypeEnum.LINK_GROUP);
|
|
2563
|
+
if (action.type === 'update_link') {
|
|
2564
|
+
if (linkGroupAnnotation) {
|
|
2565
|
+
const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey);
|
|
2566
|
+
if (linkGroup) {
|
|
2567
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [linkGroup[0]]);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
else {
|
|
2572
|
+
if (linkGroupAnnotation) {
|
|
2573
|
+
const linkGroup = linkGroupAnnotation.linkGroups.get(action.groupKey) || [];
|
|
2574
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [...linkGroup, ...action.nodes]);
|
|
2575
|
+
}
|
|
2576
|
+
else {
|
|
2577
|
+
linkGroupAnnotation = action.toAnnotation();
|
|
2578
|
+
linkGroupAnnotation.linkGroups.set(action.groupKey, [...action.nodes]);
|
|
2579
|
+
}
|
|
2580
|
+
target.annotationMap.set(InternalAnnotationTypeEnum.LINK_GROUP, linkGroupAnnotation);
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
/**
|
|
2586
|
+
* Insert a new children after a existing children
|
|
2587
|
+
*
|
|
2588
|
+
* @example parent.apply(new InsertChildrenAfterAction(existingChildren, newChildren, ...))
|
|
2589
|
+
*/
|
|
2590
|
+
class InsertChildrenAfterAction extends ModifyContentAction {
|
|
2591
|
+
constructor(referBlock, ...blocksToBeInserted) {
|
|
2592
|
+
super();
|
|
2593
|
+
this.type = ModifyContentActionType.INSERT_CHILDREN_AFTER;
|
|
2594
|
+
this.referChildren = referBlock;
|
|
2595
|
+
this.childrenToBeInserted = blocksToBeInserted;
|
|
2596
|
+
}
|
|
2040
2597
|
}
|
|
2041
2598
|
|
|
2042
2599
|
/**
|
|
2043
|
-
*
|
|
2600
|
+
* Clear the current block nodes and append new nodes
|
|
2601
|
+
*
|
|
2602
|
+
* @example block.apply(new ReplaceChildNodesAction(newNodes))
|
|
2044
2603
|
*/
|
|
2045
|
-
class
|
|
2046
|
-
constructor() {
|
|
2047
|
-
super(
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2604
|
+
class ReplaceChildNodesAction extends ModifyContentAction {
|
|
2605
|
+
constructor(newChildNodes) {
|
|
2606
|
+
super();
|
|
2607
|
+
this.type = ModifyContentActionType.REPLACE_CHILD_NODES;
|
|
2608
|
+
this.newChildNodes = newChildNodes;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
/**
|
|
2613
|
+
* Split the current node with a special position strategy.
|
|
2614
|
+
*/
|
|
2615
|
+
class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
|
|
2616
|
+
/**
|
|
2617
|
+
* @inheritDoc
|
|
2618
|
+
*/
|
|
2619
|
+
handleAction(action, target) {
|
|
2620
|
+
action.newBlock = this.splitTextNodeBlock(action.splitPointNode, action.startOffsetOfNode, target);
|
|
2621
|
+
}
|
|
2622
|
+
/**
|
|
2623
|
+
* Splits a text node at a specified offset within a block of nodes and returns a new block with the split nodes.
|
|
2624
|
+
*
|
|
2625
|
+
* @param {RTETextNode} splitNode - The text node that will be split
|
|
2626
|
+
* @param {number} startOffsetOfNode - The index at which will split the text content of the `splitNode`.
|
|
2627
|
+
* @param {RTETextBlock} textBlock - The text block need to be splited.
|
|
2628
|
+
* @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
|
|
2629
|
+
*/
|
|
2630
|
+
splitTextNodeBlock(splitNode, startOffsetOfNode, textBlock) {
|
|
2631
|
+
if (splitNode) {
|
|
2632
|
+
const beforeText = splitNode.text.slice(0, startOffsetOfNode);
|
|
2633
|
+
const afterText = splitNode.text.slice(startOffsetOfNode);
|
|
2634
|
+
const nodesSplitIndex = textBlock.children.indexOf(splitNode);
|
|
2635
|
+
if (nodesSplitIndex > -1) {
|
|
2636
|
+
const beforeNodes = textBlock.children.slice(0, nodesSplitIndex);
|
|
2637
|
+
const afterNodes = textBlock.children.slice(nodesSplitIndex + 1);
|
|
2638
|
+
if (splitNode.isContentEditable()) {
|
|
2639
|
+
if (beforeText) {
|
|
2640
|
+
beforeNodes.push(splitNode.cloneWithText(beforeText));
|
|
2641
|
+
}
|
|
2642
|
+
if (afterText) {
|
|
2643
|
+
afterNodes.unshift(splitNode.cloneWithText(afterText));
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
else {
|
|
2647
|
+
startOffsetOfNode > 0 ? beforeNodes.push(splitNode) : afterNodes.unshift(splitNode);
|
|
2648
|
+
}
|
|
2649
|
+
textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
2650
|
+
const newBlock = textBlock.cloneWithNodes(afterNodes);
|
|
2651
|
+
textBlock.parent.apply(new InsertChildrenAfterAction(textBlock, newBlock));
|
|
2652
|
+
return newBlock;
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* Remove all nodes and append new nodes strategy.
|
|
2660
|
+
*/
|
|
2661
|
+
class BlockReplaceNodesStrategy extends ActionHandleStrategy {
|
|
2662
|
+
/**
|
|
2663
|
+
* Empty the text block or image block nodes and add new nodes.
|
|
2664
|
+
*
|
|
2665
|
+
* @param {ReplaceChildNodesAction} action - The replace child nodes action instance.
|
|
2666
|
+
* @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
|
|
2667
|
+
*/
|
|
2668
|
+
handleAction(action, target) {
|
|
2669
|
+
target.children = [];
|
|
2670
|
+
target.apply(new AppendChildrenAction(action.newChildNodes));
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
/**
|
|
2675
|
+
* Remove a children from the current block
|
|
2676
|
+
*
|
|
2677
|
+
* @example needRemovedChildren.parent.apply(new RemoveChildrenAction(needRemovedChildren))
|
|
2678
|
+
*/
|
|
2679
|
+
class RemoveChildrenAction extends ModifyContentAction {
|
|
2680
|
+
constructor(childNode) {
|
|
2681
|
+
super();
|
|
2682
|
+
this.type = ModifyContentActionType.DELETE_CHILDREN;
|
|
2683
|
+
this.entityToBeRemoved = childNode;
|
|
2052
2684
|
}
|
|
2053
2685
|
}
|
|
2054
2686
|
|
|
@@ -2071,29 +2703,6 @@ class SelectionRangeAnnotation extends Annotation {
|
|
|
2071
2703
|
}
|
|
2072
2704
|
}
|
|
2073
2705
|
|
|
2074
|
-
/**
|
|
2075
|
-
* Default CSS style values produced by inline text-formatting annotations.
|
|
2076
|
-
*
|
|
2077
|
-
* These constants are the single source of truth for the CSS values that
|
|
2078
|
-
* bold, italic, underline and strikethrough semantic annotations render as
|
|
2079
|
-
* (in standalone mode) and that annotation handlers / filter strategies use
|
|
2080
|
-
* to detect or remove redundant inline styles.
|
|
2081
|
-
*/
|
|
2082
|
-
/** CSS `font-weight` value rendered by the bold annotation. */
|
|
2083
|
-
const BOLD_FONT_WEIGHT = '700';
|
|
2084
|
-
/** Alternative `font-weight` keyword that browsers report for bold elements. */
|
|
2085
|
-
const BOLD_FONT_WEIGHT_KEYWORD = 'bold';
|
|
2086
|
-
/** CSS `font-style` value rendered by the italic annotation. */
|
|
2087
|
-
const ITALIC_FONT_STYLE = 'italic';
|
|
2088
|
-
/** CSS `text-decoration` token rendered by the underline annotation. */
|
|
2089
|
-
const UNDERLINE_TEXT_DECORATION = 'underline';
|
|
2090
|
-
/** CSS `text-decoration` token rendered by the strikethrough annotation. */
|
|
2091
|
-
const STRIKETHROUGH_TEXT_DECORATION = 'line-through';
|
|
2092
|
-
/** CSS `font-family` value rendered by the code annotation. */
|
|
2093
|
-
const CODE_FONT_FAMILY = 'Roboto Mono';
|
|
2094
|
-
/** CSS `white-space` value rendered by the code annotation. */
|
|
2095
|
-
const CODE_WHITE_SPACE = 'pre-wrap';
|
|
2096
|
-
|
|
2097
2706
|
/**
|
|
2098
2707
|
* Annotation to make text with strikethrough
|
|
2099
2708
|
*/
|
|
@@ -2250,58 +2859,6 @@ class ItalicAnnotation extends NodeAnnotation {
|
|
|
2250
2859
|
}
|
|
2251
2860
|
}
|
|
2252
2861
|
|
|
2253
|
-
/**
|
|
2254
|
-
* Annotation to make text bold
|
|
2255
|
-
*/
|
|
2256
|
-
class BoldAnnotation extends NodeAnnotation {
|
|
2257
|
-
constructor(bold) {
|
|
2258
|
-
super();
|
|
2259
|
-
this.type = NodeAnnotationTypeEnum.BOLD;
|
|
2260
|
-
this.bold = bold;
|
|
2261
|
-
}
|
|
2262
|
-
/**
|
|
2263
|
-
* Generate the map item for the annotation
|
|
2264
|
-
*
|
|
2265
|
-
* @param {boolean} bold - Bold annotation
|
|
2266
|
-
* @returns {[NodeAnnotationTypeEnum.BOLD, BoldAnnotation]} Map item for the annotation
|
|
2267
|
-
*/
|
|
2268
|
-
static from(bold) {
|
|
2269
|
-
return [NodeAnnotationTypeEnum.BOLD, new BoldAnnotation(bold)];
|
|
2270
|
-
}
|
|
2271
|
-
/**
|
|
2272
|
-
* Generate the JSON representation of the annotation
|
|
2273
|
-
*
|
|
2274
|
-
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
2275
|
-
*/
|
|
2276
|
-
toJSON() {
|
|
2277
|
-
return {
|
|
2278
|
-
bold: this.bold,
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
/**
|
|
2282
|
-
* @inheritDoc
|
|
2283
|
-
*/
|
|
2284
|
-
clone() {
|
|
2285
|
-
return new BoldAnnotation(this.bold);
|
|
2286
|
-
}
|
|
2287
|
-
/**
|
|
2288
|
-
* @inheritDoc
|
|
2289
|
-
*/
|
|
2290
|
-
renderClass(options) {
|
|
2291
|
-
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
2292
|
-
return null;
|
|
2293
|
-
return this.bold ? 'v-rte--bold' : null;
|
|
2294
|
-
}
|
|
2295
|
-
/**
|
|
2296
|
-
* @inheritDoc
|
|
2297
|
-
*/
|
|
2298
|
-
renderStyle(options) {
|
|
2299
|
-
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
2300
|
-
return null;
|
|
2301
|
-
return this.bold ? { fontWeight: BOLD_FONT_WEIGHT } : null;
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
2862
|
/**
|
|
2306
2863
|
* Annotation to make text code
|
|
2307
2864
|
*/
|
|
@@ -2468,114 +3025,44 @@ const RTE_BLOCK_BOUNDARY_ATTRIBUTE = 'data-vega-rte-block-boundary';
|
|
|
2468
3025
|
const RTE_PASTE_MODE_DATA_TYPE = 'application/x-vega-rte-paste-mode';
|
|
2469
3026
|
/**
|
|
2470
3027
|
* Custom DataTransfer MIME type value used to indicate that the paste content
|
|
2471
|
-
* originated from Microsoft Word.
|
|
2472
|
-
*/
|
|
2473
|
-
const RTE_PASTE_MODE_WORD = 'word';
|
|
2474
|
-
const RTE_WORD_COUNT_KEY = 'rte-word-count';
|
|
2475
|
-
|
|
2476
|
-
/**
|
|
2477
|
-
* Annotation to make text with text color
|
|
2478
|
-
*/
|
|
2479
|
-
class TextColorAnnotation extends NodeAnnotation {
|
|
2480
|
-
constructor(textColor) {
|
|
2481
|
-
super();
|
|
2482
|
-
this.type = NodeAnnotationTypeEnum.TEXT_COLOR;
|
|
2483
|
-
this.textColor = this.formatTextColor(textColor);
|
|
2484
|
-
}
|
|
2485
|
-
/**
|
|
2486
|
-
* Generate the map item for the annotation
|
|
2487
|
-
*
|
|
2488
|
-
* @param {string} textColor - text color annotation
|
|
2489
|
-
* @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
|
|
2490
|
-
*/
|
|
2491
|
-
static from(textColor) {
|
|
2492
|
-
return [NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
|
|
2493
|
-
}
|
|
2494
|
-
/**
|
|
2495
|
-
* Generate the JSON representation of the annotation
|
|
2496
|
-
*
|
|
2497
|
-
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
2498
|
-
*/
|
|
2499
|
-
toJSON() {
|
|
2500
|
-
return {
|
|
2501
|
-
textColor: this.textColor.key,
|
|
2502
|
-
};
|
|
2503
|
-
}
|
|
2504
|
-
/**
|
|
2505
|
-
* @inheritDoc
|
|
2506
|
-
*/
|
|
2507
|
-
clone() {
|
|
2508
|
-
return new TextColorAnnotation(this.textColor.key);
|
|
2509
|
-
}
|
|
2510
|
-
/**
|
|
2511
|
-
* @inheritDoc
|
|
2512
|
-
*/
|
|
2513
|
-
renderClass() {
|
|
2514
|
-
return null;
|
|
2515
|
-
}
|
|
2516
|
-
/**
|
|
2517
|
-
* @inheritDoc
|
|
2518
|
-
*/
|
|
2519
|
-
renderStyle() {
|
|
2520
|
-
return {
|
|
2521
|
-
color: VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
|
|
2522
|
-
};
|
|
2523
|
-
}
|
|
2524
|
-
/**
|
|
2525
|
-
* format text color
|
|
2526
|
-
*
|
|
2527
|
-
* @param {string} textColor - text color
|
|
2528
|
-
* @returns {VegaRTEColorSchema} - VegaRTEColorSchema
|
|
2529
|
-
*/
|
|
2530
|
-
formatTextColor(textColor) {
|
|
2531
|
-
return (RTE_TEXT_COLORS.find((item) => item.key === textColor) || RTE_TEXT_COLORS[0]);
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
3028
|
+
* originated from Microsoft Word.
|
|
3029
|
+
*/
|
|
3030
|
+
const RTE_PASTE_MODE_WORD = 'word';
|
|
3031
|
+
const RTE_WORD_COUNT_KEY = 'rte-word-count';
|
|
2534
3032
|
|
|
2535
3033
|
/**
|
|
2536
|
-
* Annotation to make text
|
|
3034
|
+
* Annotation to make text with text color
|
|
2537
3035
|
*/
|
|
2538
|
-
class
|
|
2539
|
-
constructor(
|
|
3036
|
+
class TextColorAnnotation extends NodeAnnotation {
|
|
3037
|
+
constructor(textColor) {
|
|
2540
3038
|
super();
|
|
2541
|
-
this.type = NodeAnnotationTypeEnum.
|
|
2542
|
-
this.
|
|
2543
|
-
this.useInternalStyle = useInternalStyle;
|
|
3039
|
+
this.type = NodeAnnotationTypeEnum.TEXT_COLOR;
|
|
3040
|
+
this.textColor = this.formatTextColor(textColor);
|
|
2544
3041
|
}
|
|
2545
3042
|
/**
|
|
2546
3043
|
* Generate the map item for the annotation
|
|
2547
3044
|
*
|
|
2548
|
-
* @param {
|
|
2549
|
-
* @
|
|
2550
|
-
* @returns {[NodeAnnotationTypeEnum.LINK, LinkAnnotation]} Map item for the annotation
|
|
3045
|
+
* @param {string} textColor - text color annotation
|
|
3046
|
+
* @returns {[NodeAnnotationTypeEnum.TEXT_COLOR, TextColorAnnotation]} Map item for the annotation
|
|
2551
3047
|
*/
|
|
2552
|
-
static from(
|
|
2553
|
-
return [NodeAnnotationTypeEnum.
|
|
3048
|
+
static from(textColor) {
|
|
3049
|
+
return [NodeAnnotationTypeEnum.TEXT_COLOR, new TextColorAnnotation(textColor)];
|
|
2554
3050
|
}
|
|
2555
3051
|
/**
|
|
2556
3052
|
* Generate the JSON representation of the annotation
|
|
2557
3053
|
*
|
|
2558
|
-
* @returns {Record<
|
|
3054
|
+
* @returns {Record<string, unknown>} JSON representation of the annotation
|
|
2559
3055
|
*/
|
|
2560
3056
|
toJSON() {
|
|
2561
3057
|
return {
|
|
2562
|
-
|
|
3058
|
+
textColor: this.textColor.key,
|
|
2563
3059
|
};
|
|
2564
3060
|
}
|
|
2565
3061
|
/**
|
|
2566
3062
|
* @inheritDoc
|
|
2567
3063
|
*/
|
|
2568
3064
|
clone() {
|
|
2569
|
-
return new
|
|
2570
|
-
}
|
|
2571
|
-
/**
|
|
2572
|
-
* Verify whether two link annotation is same or not
|
|
2573
|
-
*
|
|
2574
|
-
* @param {LinkAnnotation} annotation - Compared annotation
|
|
2575
|
-
* @returns {boolean} Whether two link annotation is same or not
|
|
2576
|
-
*/
|
|
2577
|
-
toEqual(annotation) {
|
|
2578
|
-
return this.link.groupKey === annotation.link.groupKey;
|
|
3065
|
+
return new TextColorAnnotation(this.textColor.key);
|
|
2579
3066
|
}
|
|
2580
3067
|
/**
|
|
2581
3068
|
* @inheritDoc
|
|
@@ -2587,28 +3074,18 @@ class LinkAnnotation extends NodeAnnotation {
|
|
|
2587
3074
|
* @inheritDoc
|
|
2588
3075
|
*/
|
|
2589
3076
|
renderStyle() {
|
|
2590
|
-
return
|
|
2591
|
-
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
/**
|
|
2595
|
-
* Action to link a group of nodes
|
|
2596
|
-
*/
|
|
2597
|
-
class LinkGroupAnnotationAction extends AnnotationAction {
|
|
2598
|
-
constructor(groupKey, nodes, type) {
|
|
2599
|
-
super();
|
|
2600
|
-
this.isFlushable = false;
|
|
2601
|
-
this.groupKey = groupKey;
|
|
2602
|
-
this.nodes = nodes;
|
|
2603
|
-
this.type = type;
|
|
3077
|
+
return {
|
|
3078
|
+
color: VegaInternalThemeManager.isDarkMode() ? this.textColor.dark : this.textColor.light,
|
|
3079
|
+
};
|
|
2604
3080
|
}
|
|
2605
3081
|
/**
|
|
2606
|
-
*
|
|
3082
|
+
* format text color
|
|
2607
3083
|
*
|
|
2608
|
-
* @
|
|
3084
|
+
* @param {string} textColor - text color
|
|
3085
|
+
* @returns {VegaRTEColorSchema} - VegaRTEColorSchema
|
|
2609
3086
|
*/
|
|
2610
|
-
|
|
2611
|
-
return
|
|
3087
|
+
formatTextColor(textColor) {
|
|
3088
|
+
return (RTE_TEXT_COLORS.find((item) => item.key === textColor) || RTE_TEXT_COLORS[0]);
|
|
2612
3089
|
}
|
|
2613
3090
|
}
|
|
2614
3091
|
|
|
@@ -2630,139 +3107,6 @@ class SyncUpSelectionAction extends AnnotationAction {
|
|
|
2630
3107
|
}
|
|
2631
3108
|
}
|
|
2632
3109
|
|
|
2633
|
-
/**
|
|
2634
|
-
* The base action handle strategy class, use to modify the rich text node content or modify the annotation.
|
|
2635
|
-
*/
|
|
2636
|
-
class ActionHandleStrategy {
|
|
2637
|
-
/**
|
|
2638
|
-
* Public method to invoke the handle logic.
|
|
2639
|
-
*
|
|
2640
|
-
* @typedef R generic type
|
|
2641
|
-
* @param {ModifyContentAction | AnnotationAction} action - The action instance. Contains the action type and necessary params.
|
|
2642
|
-
* @param {RTENode | RTEBlock | VegaRTEContent} target - The rich text node instance that will be modified.
|
|
2643
|
-
* @returns {R} - The invoke result in special strategy.
|
|
2644
|
-
*/
|
|
2645
|
-
execute(action, target) {
|
|
2646
|
-
LogUtility.log(`Executing action ${action.constructor.name} on ${target.constructor.name} ${target['id']}`);
|
|
2647
|
-
return this.handleAction(action, target);
|
|
2648
|
-
}
|
|
2649
|
-
/**
|
|
2650
|
-
* Update the custom style annotation of a block or node
|
|
2651
|
-
*
|
|
2652
|
-
* @param {RTEBlock | RTETextNode} item - block or node
|
|
2653
|
-
* @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
|
|
2654
|
-
*/
|
|
2655
|
-
updateCustomStyleAnnotation(item, styleKeys) {
|
|
2656
|
-
const customStyleAnnotation = item.annotationMap.get(CommonAnnotationTypeEnum.CUSTOM_STYLE);
|
|
2657
|
-
if (customStyleAnnotation && this.isCustomStyle(customStyleAnnotation, styleKeys)) {
|
|
2658
|
-
item.annotationMap.set(customStyleAnnotation.type, new CustomStyleAnnotation(customStyleAnnotation.removeStyles(styleKeys)));
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
|
-
/**
|
|
2662
|
-
* Create a new paragraph block with the given text.
|
|
2663
|
-
*
|
|
2664
|
-
* @param {string} text - The text content for the new paragraph.
|
|
2665
|
-
* @returns {Nullable<RTETextBlock>} - The newly created paragraph block, or null if creation failed.
|
|
2666
|
-
*/
|
|
2667
|
-
createNewParagraph(text) {
|
|
2668
|
-
const dtoClass = RTEDTOClassManager$1.getRTEBlockClass('paragraph');
|
|
2669
|
-
if (dtoClass) {
|
|
2670
|
-
const newParagraph = dtoClass.from({
|
|
2671
|
-
id: generateUUID(),
|
|
2672
|
-
type: 'paragraph',
|
|
2673
|
-
nodes: [{ id: generateUUID(), type: 'text', text }],
|
|
2674
|
-
});
|
|
2675
|
-
return newParagraph;
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
/**
|
|
2679
|
-
* Get the root content from a child block or node.
|
|
2680
|
-
*
|
|
2681
|
-
* @param {RTEBlock | RTENode} child - The child block or node.
|
|
2682
|
-
* @returns {Nullable<VegaRTEContent>} The root content, if found.
|
|
2683
|
-
*/
|
|
2684
|
-
getRootContent(child) {
|
|
2685
|
-
const parent = child.parent;
|
|
2686
|
-
if (parent) {
|
|
2687
|
-
if (parent.dtoName === 'VegaRTEContent') {
|
|
2688
|
-
return parent;
|
|
2689
|
-
}
|
|
2690
|
-
else {
|
|
2691
|
-
return this.getRootContent(parent);
|
|
2692
|
-
}
|
|
2693
|
-
}
|
|
2694
|
-
}
|
|
2695
|
-
/**
|
|
2696
|
-
* Check the caret position at the start of a block.
|
|
2697
|
-
*
|
|
2698
|
-
* @param {RTEBlock} block - The RTE Block.
|
|
2699
|
-
* @param {RTENode} node - The RTE Node.
|
|
2700
|
-
* @param {number} offset - The offset position.
|
|
2701
|
-
* @returns {boolean} - Whether the caret is at the start of the block.
|
|
2702
|
-
*/
|
|
2703
|
-
isCaretPositionAtBlockStart(block, node, offset) {
|
|
2704
|
-
return node === block.children[0] && offset === 0;
|
|
2705
|
-
}
|
|
2706
|
-
/**
|
|
2707
|
-
* Check the caret position at the end of a block.
|
|
2708
|
-
*
|
|
2709
|
-
* @param {RTEBlock} block - The RTE Block.
|
|
2710
|
-
* @param {RTENode} node - The RTE Node.
|
|
2711
|
-
* @param {number} offset - The offset position.
|
|
2712
|
-
* @returns {boolean} - Whether the caret is at the end of the block.
|
|
2713
|
-
*/
|
|
2714
|
-
isCaretPositionAtBlockEnd(block, node, offset) {
|
|
2715
|
-
if (!node.isContentEditable()) {
|
|
2716
|
-
return this.isCaretPositionAtDecoratorBlockEnd(block, node, offset);
|
|
2717
|
-
}
|
|
2718
|
-
else {
|
|
2719
|
-
return this.isCaretPositionAtTextBlockEnd(block, node, offset);
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
/**
|
|
2723
|
-
* Get the registered DOM element by the RTE entity.
|
|
2724
|
-
*
|
|
2725
|
-
* @param {RTEBlock | RTENode} instance - The RTE block or node instance.
|
|
2726
|
-
* @returns {Nullable<HTMLElement>} The registered DOM element.
|
|
2727
|
-
*/
|
|
2728
|
-
getDOMByEntity(instance) {
|
|
2729
|
-
return stateEntityRenderingRegistry.getDOMByEntity(instance);
|
|
2730
|
-
}
|
|
2731
|
-
/**
|
|
2732
|
-
* Checks if the caret position is at the end of a specified RTETextNode.
|
|
2733
|
-
*
|
|
2734
|
-
* @param {RTETextBlock} textBlock - `RTETextBlock` - a text block.
|
|
2735
|
-
* @param {RTETextNode} node - `RTETextNode` - a node representing an image in a rich text editor.
|
|
2736
|
-
* @param {number} startOffset - The position within the text node where the caret is located.
|
|
2737
|
-
* @returns {boolean} a boolean value, which indicates whether the caret position is at the start of the RTETextNode.
|
|
2738
|
-
*/
|
|
2739
|
-
isCaretPositionAtTextBlockEnd(textBlock, node, startOffset) {
|
|
2740
|
-
const lastNode = textBlock.children[textBlock.children.length - 1];
|
|
2741
|
-
return node === lastNode && (node.isEmpty() || startOffset === lastNode.text.length);
|
|
2742
|
-
}
|
|
2743
|
-
/**
|
|
2744
|
-
* Checks if the caret position is at the end of a given decorator node.
|
|
2745
|
-
*
|
|
2746
|
-
* @param {RTEBlock} target - The image block.
|
|
2747
|
-
* @param {RTENode} node - `node` is a RTEDecoratorNode or non-editable text node.
|
|
2748
|
-
* @param {number} startOffset - The position within the `RTEDecoratorNode` where the caret is located.
|
|
2749
|
-
* @returns {boolean}Returns a boolean value indicating whether the caret position is at the end of the `RTEDecoratorNode`.
|
|
2750
|
-
*/
|
|
2751
|
-
isCaretPositionAtDecoratorBlockEnd(target, node, startOffset) {
|
|
2752
|
-
return node === target.children[target.children.length - 1] && startOffset !== 0;
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* Determines if the custom style annotation includes any the custom style.
|
|
2756
|
-
*
|
|
2757
|
-
* @param {CustomStyleAnnotation} customStyleAnnotation - custom style annotation
|
|
2758
|
-
* @param {string[]} styleKeys - custom style keys, for examples ['fontSize', 'fontWeight'].
|
|
2759
|
-
* @returns {boolean} - True if the custom key includes the custom style, false otherwise.
|
|
2760
|
-
*/
|
|
2761
|
-
isCustomStyle(customStyleAnnotation, styleKeys) {
|
|
2762
|
-
return styleKeys.some((item) => Object.keys(customStyleAnnotation.customStyle).includes(item));
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
3110
|
/**
|
|
2767
3111
|
* Split the corresponding link group nodes *
|
|
2768
3112
|
*/
|
|
@@ -2912,25 +3256,6 @@ class NodeSplitTextStrategy extends ActionHandleStrategy {
|
|
|
2912
3256
|
}
|
|
2913
3257
|
}
|
|
2914
3258
|
|
|
2915
|
-
/**
|
|
2916
|
-
* Action to toggle bold annotation
|
|
2917
|
-
*/
|
|
2918
|
-
class BoldAnnotationAction extends TextSplittableAction {
|
|
2919
|
-
constructor(bold) {
|
|
2920
|
-
super();
|
|
2921
|
-
this.isFlushable = true;
|
|
2922
|
-
this.bold = bold;
|
|
2923
|
-
}
|
|
2924
|
-
/**
|
|
2925
|
-
* Converts the action to an annotation
|
|
2926
|
-
*
|
|
2927
|
-
* @returns {BoldAnnotation} the annotation
|
|
2928
|
-
*/
|
|
2929
|
-
toAnnotation() {
|
|
2930
|
-
return new BoldAnnotation(this.bold);
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
3259
|
/**
|
|
2935
3260
|
* Annotation to host which annotations will be clear formatting
|
|
2936
3261
|
*/
|
|
@@ -2988,65 +3313,21 @@ class CodeAnnotationAction extends TextSplittableAction {
|
|
|
2988
3313
|
}
|
|
2989
3314
|
|
|
2990
3315
|
/**
|
|
2991
|
-
*
|
|
2992
|
-
*/
|
|
2993
|
-
class DeleteNodeAnnotationAction extends AnnotationAction {
|
|
2994
|
-
constructor(annotationType) {
|
|
2995
|
-
super();
|
|
2996
|
-
this.isFlushable = true;
|
|
2997
|
-
this.annotationType = annotationType;
|
|
2998
|
-
}
|
|
2999
|
-
/**
|
|
3000
|
-
* Don't need this for this action
|
|
3001
|
-
*
|
|
3002
|
-
* @returns {Nullable<Annotation>} undefined
|
|
3003
|
-
*/
|
|
3004
|
-
toAnnotation() {
|
|
3005
|
-
return undefined;
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
|
|
3009
|
-
/**
|
|
3010
|
-
* Action to toggle the italic annotation
|
|
3011
|
-
*/
|
|
3012
|
-
class ItalicAnnotationAction extends TextSplittableAction {
|
|
3013
|
-
constructor(italic) {
|
|
3014
|
-
super();
|
|
3015
|
-
this.isFlushable = true;
|
|
3016
|
-
this.italic = italic;
|
|
3017
|
-
}
|
|
3018
|
-
/**
|
|
3019
|
-
* Converts the action to an annotation
|
|
3020
|
-
*
|
|
3021
|
-
* @returns {ItalicAnnotation} The annotation
|
|
3022
|
-
*/
|
|
3023
|
-
toAnnotation() {
|
|
3024
|
-
return new ItalicAnnotation(this.italic);
|
|
3025
|
-
}
|
|
3026
|
-
}
|
|
3027
|
-
|
|
3028
|
-
/**
|
|
3029
|
-
* Action to toggle link annotation
|
|
3316
|
+
* Action to toggle the italic annotation
|
|
3030
3317
|
*/
|
|
3031
|
-
class
|
|
3032
|
-
constructor(
|
|
3318
|
+
class ItalicAnnotationAction extends TextSplittableAction {
|
|
3319
|
+
constructor(italic) {
|
|
3033
3320
|
super();
|
|
3034
3321
|
this.isFlushable = true;
|
|
3035
|
-
this.
|
|
3036
|
-
this.needMergeNode = needMergeNode;
|
|
3037
|
-
this.newText = newText;
|
|
3038
|
-
this.type = type;
|
|
3039
|
-
if (isNonNullable(doSplit)) {
|
|
3040
|
-
this.doSplit = doSplit;
|
|
3041
|
-
}
|
|
3322
|
+
this.italic = italic;
|
|
3042
3323
|
}
|
|
3043
3324
|
/**
|
|
3044
3325
|
* Converts the action to an annotation
|
|
3045
3326
|
*
|
|
3046
|
-
* @returns {
|
|
3327
|
+
* @returns {ItalicAnnotation} The annotation
|
|
3047
3328
|
*/
|
|
3048
3329
|
toAnnotation() {
|
|
3049
|
-
return new
|
|
3330
|
+
return new ItalicAnnotation(this.italic);
|
|
3050
3331
|
}
|
|
3051
3332
|
}
|
|
3052
3333
|
|
|
@@ -3700,421 +3981,140 @@ class RTETextNode extends RTENode {
|
|
|
3700
3981
|
}
|
|
3701
3982
|
else {
|
|
3702
3983
|
this.applyActionToNode(this, action);
|
|
3703
|
-
}
|
|
3704
|
-
if (typeof this.parent.mergeNodes === 'function') {
|
|
3705
|
-
this.parent.mergeNodes(action);
|
|
3706
|
-
}
|
|
3707
|
-
}
|
|
3708
|
-
/**
|
|
3709
|
-
* @inheritDoc
|
|
3710
|
-
*/
|
|
3711
|
-
doModifyActionApply(action) {
|
|
3712
|
-
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3713
|
-
}
|
|
3714
|
-
/**
|
|
3715
|
-
* Apply action to node
|
|
3716
|
-
*
|
|
3717
|
-
* @param {RTETextNode} node - Text node
|
|
3718
|
-
* @param {AnnotationAction} action - AnnotationAction
|
|
3719
|
-
*/
|
|
3720
|
-
applyActionToNode(node, action) {
|
|
3721
|
-
const annotation = action.toAnnotation();
|
|
3722
|
-
if (action instanceof SyncUpSelectionAction) {
|
|
3723
|
-
this.syncUpSelectedNodes(node);
|
|
3724
|
-
return;
|
|
3725
|
-
}
|
|
3726
|
-
// Sync up RTETextNode selected state to selection controller for any action apply, except selection range change.
|
|
3727
|
-
if (!(annotation instanceof SelectionRangeAnnotation)) {
|
|
3728
|
-
this.syncUpSelectedNodes(node);
|
|
3729
|
-
}
|
|
3730
|
-
/**
|
|
3731
|
-
* 1. Try to get the specific strategy for the action and node type first (e.g., LinkAnnotationAction on RTETextNode).
|
|
3732
|
-
* 2. If no specific strategy found, try to get the generic NodeUpdateAnnotationMapStrategy for AnnotationAction on RTETextNode.
|
|
3733
|
-
*/
|
|
3734
|
-
const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, node.constructor.name);
|
|
3735
|
-
if (strategy) {
|
|
3736
|
-
strategy.execute(action, node);
|
|
3737
|
-
return;
|
|
3738
|
-
}
|
|
3739
|
-
const updateAnnotationMapStrategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTETextNode.name);
|
|
3740
|
-
if (updateAnnotationMapStrategy) {
|
|
3741
|
-
updateAnnotationMapStrategy.execute(action, node);
|
|
3742
|
-
return;
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
/**
|
|
3746
|
-
* Sync up the selected node by change manager
|
|
3747
|
-
*
|
|
3748
|
-
* @param {RTETextNode} selectedNode - The selected node
|
|
3749
|
-
*/
|
|
3750
|
-
syncUpSelectedNodes(selectedNode) {
|
|
3751
|
-
const currentNodeDom = this.getElementRef();
|
|
3752
|
-
if (currentNodeDom) {
|
|
3753
|
-
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, VegaInternalRichTextEditorSelectionRangeChange);
|
|
3754
|
-
if (nodeSubject) {
|
|
3755
|
-
ChangeManager.notify(nodeSubject, { node: selectedNode });
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
}
|
|
3759
|
-
/**
|
|
3760
|
-
* @param {InlineHtmlAnnotation} inlineHtmlNode - The inline HTML annotation to wrap the text node.
|
|
3761
|
-
* @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
|
|
3762
|
-
* @returns {string} The HTML string representation of the text node wrapped with the inline HTML.
|
|
3763
|
-
*/
|
|
3764
|
-
renderWithWrapperStr(inlineHtmlNode, options) {
|
|
3765
|
-
const { htmlTag, child } = inlineHtmlNode;
|
|
3766
|
-
const attrStr = this.annotationAttrStr(inlineHtmlNode);
|
|
3767
|
-
if (!child) {
|
|
3768
|
-
if (HTML_VOID_TAGS.has(htmlTag)) {
|
|
3769
|
-
return `<${htmlTag}${attrStr}>`;
|
|
3770
|
-
}
|
|
3771
|
-
if (!this.text) {
|
|
3772
|
-
return `<${htmlTag}${attrStr}></${htmlTag}>`;
|
|
3773
|
-
}
|
|
3774
|
-
return `<${htmlTag}${attrStr}>${this.renderTextStr(options)}</${htmlTag}>`;
|
|
3775
|
-
}
|
|
3776
|
-
return `<${htmlTag}${attrStr}>${this.renderWithWrapperStr(child, options)}</${htmlTag}>`;
|
|
3777
|
-
}
|
|
3778
|
-
/**
|
|
3779
|
-
* Generate the attribute string for the inline HTML annotation
|
|
3780
|
-
*
|
|
3781
|
-
* @param {InlineHtmlAnnotation} annotation - The inline HTML annotation
|
|
3782
|
-
* @returns {string} The attribute string for the inline HTML annotation
|
|
3783
|
-
*/
|
|
3784
|
-
annotationAttrStr(annotation) {
|
|
3785
|
-
const { customAttribute, customClass, customStyle } = annotation;
|
|
3786
|
-
const attrs = [
|
|
3787
|
-
...((customAttribute === null || customAttribute === void 0 ? void 0 : customAttribute.toString()) || []),
|
|
3788
|
-
customClass === null || customClass === void 0 ? void 0 : customClass.toString(),
|
|
3789
|
-
customStyle === null || customStyle === void 0 ? void 0 : customStyle.toString(),
|
|
3790
|
-
].filter(isNonNullable);
|
|
3791
|
-
return attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
|
|
3792
|
-
}
|
|
3793
|
-
/**
|
|
3794
|
-
* Generates the HTML representation of the text node.
|
|
3795
|
-
*
|
|
3796
|
-
* @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
|
|
3797
|
-
* @returns {string} The HTML string representation of the text node.
|
|
3798
|
-
*/
|
|
3799
|
-
renderTextStr(options) {
|
|
3800
|
-
var _a;
|
|
3801
|
-
const NodeTag = ((_a = this.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
|
|
3802
|
-
? 'code'
|
|
3803
|
-
: 'span';
|
|
3804
|
-
const attrStr = super.generateAttributeString(options);
|
|
3805
|
-
// If the text contains a newline character, we need to replace it with a <br> tag.
|
|
3806
|
-
if (this.text === '\n') {
|
|
3807
|
-
return `<br>`;
|
|
3808
|
-
}
|
|
3809
|
-
if (this.shouldRenderAsPlainText()) {
|
|
3810
|
-
return this.text;
|
|
3811
|
-
}
|
|
3812
|
-
const content = NodeTag === 'code' ? escapeHtml(this.text) : this.text;
|
|
3813
|
-
return `<${NodeTag}${attrStr}>${content}</${NodeTag}>`;
|
|
3814
|
-
}
|
|
3815
|
-
/**
|
|
3816
|
-
* Determines if the text node should be rendered as plain text.
|
|
3817
|
-
*
|
|
3818
|
-
* @returns {boolean} `true` if the text node should be rendered as plain text, otherwise `false`.
|
|
3819
|
-
*/
|
|
3820
|
-
shouldRenderAsPlainText() {
|
|
3821
|
-
const plainTextAnnotation = super.getAnnotationByType(NodeAnnotationTypeEnum.PLAIN_TEXT);
|
|
3822
|
-
if (plainTextAnnotation) {
|
|
3823
|
-
return (plainTextAnnotation.plainText &&
|
|
3824
|
-
Array.from(this.annotationMap.values()).filter((annotation) => (annotation instanceof NodeAnnotation &&
|
|
3825
|
-
!(annotation instanceof LinkAnnotation) &&
|
|
3826
|
-
!(annotation instanceof PlainTextAnnotation)) ||
|
|
3827
|
-
annotation instanceof CommonAnnotation).length === 0);
|
|
3828
|
-
}
|
|
3829
|
-
else {
|
|
3830
|
-
return false;
|
|
3831
|
-
}
|
|
3832
|
-
}
|
|
3833
|
-
}
|
|
3834
|
-
RTETextNode.registerActionStrategyStatus = {};
|
|
3835
|
-
RTETextNode.htmlTag = 'span';
|
|
3836
|
-
RTETextNode.dtoName = 'RTETextNode';
|
|
3837
|
-
|
|
3838
|
-
/**
|
|
3839
|
-
* Append children to a block or rte content
|
|
3840
|
-
*
|
|
3841
|
-
* @example parent.apply(new AppendChildrenAction([newChildren]))
|
|
3842
|
-
*/
|
|
3843
|
-
class AppendChildrenAction extends ModifyContentAction {
|
|
3844
|
-
constructor(childNodes) {
|
|
3845
|
-
super();
|
|
3846
|
-
this.type = ModifyContentActionType.APPEND_CHILDREN;
|
|
3847
|
-
this.entityToBeAppended = childNodes;
|
|
3848
|
-
}
|
|
3849
|
-
}
|
|
3850
|
-
|
|
3851
|
-
const TEXT_STYLE_DEFAULT_FONT_WEIGHT = '500';
|
|
3852
|
-
const TEXT_STYLE_BASE = {
|
|
3853
|
-
fontFamily: 'Inter',
|
|
3854
|
-
fontSize: '16px',
|
|
3855
|
-
lineHeight: '22px',
|
|
3856
|
-
minHeight: '22px',
|
|
3857
|
-
fontWeight: TEXT_STYLE_DEFAULT_FONT_WEIGHT,
|
|
3858
|
-
};
|
|
3859
|
-
const PARAGRAPH_TEXT_STYLE = Object.assign(Object.assign({}, TEXT_STYLE_BASE), { marginTop: '0px', marginBottom: '0px' });
|
|
3860
|
-
const TEXT_STYLE_DEFAULTS = {
|
|
3861
|
-
'paragraph': PARAGRAPH_TEXT_STYLE,
|
|
3862
|
-
'title': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '36px', lineHeight: '40px', minHeight: '40px' }),
|
|
3863
|
-
'subtitle': Object.assign(Object.assign({}, TEXT_STYLE_BASE), { fontSize: '28px', lineHeight: '32px', minHeight: '32px' }),
|
|
3864
|
-
'heading-1': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '22px', lineHeight: '24px', minHeight: '24px' }),
|
|
3865
|
-
'heading-2': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '20px', lineHeight: '24px', minHeight: '24px' }),
|
|
3866
|
-
'heading-3': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '18px' }),
|
|
3867
|
-
'heading-4': Object.assign({}, PARAGRAPH_TEXT_STYLE),
|
|
3868
|
-
'heading-5': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '14px' }),
|
|
3869
|
-
'heading-6': Object.assign(Object.assign({}, PARAGRAPH_TEXT_STYLE), { fontSize: '12px' }),
|
|
3870
|
-
};
|
|
3871
|
-
|
|
3872
|
-
/**
|
|
3873
|
-
* Text style annotation
|
|
3874
|
-
*/
|
|
3875
|
-
class TextStyleAnnotation extends BlockAnnotation {
|
|
3876
|
-
constructor(textStyle) {
|
|
3877
|
-
super();
|
|
3878
|
-
this.type = BlockAnnotationTypeEnum.TEXT_STYLE;
|
|
3879
|
-
this.textStyle = textStyle;
|
|
3880
|
-
}
|
|
3881
|
-
/**
|
|
3882
|
-
* Generate the map item for the annotations
|
|
3883
|
-
*
|
|
3884
|
-
* @param {VegaRTETextStyleType} textStyle - the text style type
|
|
3885
|
-
* @returns {[BlockAnnotationTypeEnum.TEXT_STYLE, TextStyleAnnotation]} Map item for the annotation
|
|
3886
|
-
*/
|
|
3887
|
-
static from(textStyle) {
|
|
3888
|
-
return [BlockAnnotationTypeEnum.TEXT_STYLE, new TextStyleAnnotation(textStyle)];
|
|
3889
|
-
}
|
|
3890
|
-
/**
|
|
3891
|
-
* Get the default styles for a given text style type.
|
|
3892
|
-
*
|
|
3893
|
-
* @param {VegaRTETextStyleType} textStyle - The text style type.
|
|
3894
|
-
* @returns {Nullable<AnnotationStyle>} The default styles for the given text style type.
|
|
3895
|
-
*/
|
|
3896
|
-
static getDefaultStyles(textStyle) {
|
|
3897
|
-
if (!textStyle)
|
|
3898
|
-
return null;
|
|
3899
|
-
return TEXT_STYLE_DEFAULTS[textStyle];
|
|
3900
|
-
}
|
|
3901
|
-
/**
|
|
3902
|
-
* Generate the JSON representation of the annotation
|
|
3903
|
-
*
|
|
3904
|
-
* @returns {Nullable<Record<string, unknown>>} JSON representation of the annotation
|
|
3905
|
-
*/
|
|
3906
|
-
toJSON() {
|
|
3907
|
-
return { textStyle: this.textStyle };
|
|
3908
|
-
}
|
|
3909
|
-
/**
|
|
3910
|
-
* @inheritDoc
|
|
3911
|
-
*/
|
|
3912
|
-
clone() {
|
|
3913
|
-
return new TextStyleAnnotation(this.textStyle);
|
|
3914
|
-
}
|
|
3915
|
-
/**
|
|
3916
|
-
* @inheritDoc
|
|
3917
|
-
*/
|
|
3918
|
-
renderClass(options) {
|
|
3919
|
-
if (options === null || options === void 0 ? void 0 : options.standalone)
|
|
3920
|
-
return null;
|
|
3921
|
-
return this.textStyle ? `v-rte--text-style-${this.textStyle}` : null;
|
|
3922
|
-
}
|
|
3923
|
-
/**
|
|
3924
|
-
* @inheritDoc
|
|
3925
|
-
*/
|
|
3926
|
-
renderStyle(options) {
|
|
3927
|
-
if (!(options === null || options === void 0 ? void 0 : options.standalone))
|
|
3928
|
-
return null;
|
|
3929
|
-
return this.textStyle ? TextStyleAnnotation.getDefaultStyles(this.textStyle) : null;
|
|
3930
|
-
}
|
|
3931
|
-
}
|
|
3932
|
-
|
|
3933
|
-
/**
|
|
3934
|
-
* Action to change the text style of a block
|
|
3935
|
-
*/
|
|
3936
|
-
class TextStyleAnnotationAction extends AnnotationAction {
|
|
3937
|
-
constructor(textStyle, bold) {
|
|
3938
|
-
super();
|
|
3939
|
-
this.isFlushable = true;
|
|
3940
|
-
this.textStyle = textStyle;
|
|
3941
|
-
this.bold = bold;
|
|
3984
|
+
}
|
|
3985
|
+
if (typeof this.parent.mergeNodes === 'function') {
|
|
3986
|
+
this.parent.mergeNodes(action);
|
|
3987
|
+
}
|
|
3942
3988
|
}
|
|
3943
3989
|
/**
|
|
3944
|
-
*
|
|
3945
|
-
*
|
|
3946
|
-
* @returns {BlockAnnotation} the block annotation
|
|
3990
|
+
* @inheritDoc
|
|
3947
3991
|
*/
|
|
3948
|
-
|
|
3949
|
-
|
|
3992
|
+
doModifyActionApply(action) {
|
|
3993
|
+
ActionHandleStrategyRegistry.executeTheStrategy(action, this);
|
|
3950
3994
|
}
|
|
3951
|
-
}
|
|
3952
|
-
|
|
3953
|
-
/**
|
|
3954
|
-
* Update the text block text style strategy.
|
|
3955
|
-
*/
|
|
3956
|
-
class BlockUpdateTextStyleStrategy extends ActionHandleStrategy {
|
|
3957
3995
|
/**
|
|
3958
|
-
*
|
|
3996
|
+
* Apply action to node
|
|
3959
3997
|
*
|
|
3960
|
-
* @param {
|
|
3961
|
-
* @param {
|
|
3998
|
+
* @param {RTETextNode} node - Text node
|
|
3999
|
+
* @param {AnnotationAction} action - AnnotationAction
|
|
3962
4000
|
*/
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4001
|
+
applyActionToNode(node, action) {
|
|
4002
|
+
const annotation = action.toAnnotation();
|
|
4003
|
+
if (action instanceof SyncUpSelectionAction) {
|
|
4004
|
+
this.syncUpSelectedNodes(node);
|
|
4005
|
+
return;
|
|
3966
4006
|
}
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
boldAnnotationAction.doSplit = false;
|
|
3971
|
-
node.apply(boldAnnotationAction);
|
|
3972
|
-
});
|
|
4007
|
+
// Sync up RTETextNode selected state to selection controller for any action apply, except selection range change.
|
|
4008
|
+
if (!(annotation instanceof SelectionRangeAnnotation)) {
|
|
4009
|
+
this.syncUpSelectedNodes(node);
|
|
3973
4010
|
}
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
4011
|
+
/**
|
|
4012
|
+
* 1. Try to get the specific strategy for the action and node type first (e.g., LinkAnnotationAction on RTETextNode).
|
|
4013
|
+
* 2. If no specific strategy found, try to get the generic NodeUpdateAnnotationMapStrategy for AnnotationAction on RTETextNode.
|
|
4014
|
+
*/
|
|
4015
|
+
const strategy = ActionHandleStrategyRegistry.get(action.constructor.name, node.constructor.name);
|
|
4016
|
+
if (strategy) {
|
|
4017
|
+
strategy.execute(action, node);
|
|
4018
|
+
return;
|
|
4019
|
+
}
|
|
4020
|
+
const updateAnnotationMapStrategy = ActionHandleStrategyRegistry.get(AnnotationAction.name, RTETextNode.name);
|
|
4021
|
+
if (updateAnnotationMapStrategy) {
|
|
4022
|
+
updateAnnotationMapStrategy.execute(action, node);
|
|
4023
|
+
return;
|
|
3978
4024
|
}
|
|
3979
|
-
this.updateCustomStyleAnnotation(target, ['fontFamily', 'lineHeight', 'fontWeight', 'fontSize']);
|
|
3980
4025
|
}
|
|
3981
|
-
}
|
|
3982
|
-
|
|
3983
|
-
/**
|
|
3984
|
-
* Update the text block link group annotation strategy.
|
|
3985
|
-
*/
|
|
3986
|
-
class BlockUpdateLinkGroupStrategy extends ActionHandleStrategy {
|
|
3987
4026
|
/**
|
|
3988
|
-
*
|
|
4027
|
+
* Sync up the selected node by change manager
|
|
3989
4028
|
*
|
|
3990
|
-
* @param {
|
|
3991
|
-
* @param {RTETextBlock} target - The current text block.
|
|
4029
|
+
* @param {RTETextNode} selectedNode - The selected node
|
|
3992
4030
|
*/
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
if (
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
linkGroupAnnotation.linkGroups.set(action.groupKey, [linkGroup[0]]);
|
|
4000
|
-
}
|
|
4031
|
+
syncUpSelectedNodes(selectedNode) {
|
|
4032
|
+
const currentNodeDom = this.getElementRef();
|
|
4033
|
+
if (currentNodeDom) {
|
|
4034
|
+
const nodeSubject = domNodeSubjectFactory.getSubjectFromParentNodeByEventId(currentNodeDom, VegaInternalRichTextEditorSelectionRangeChange);
|
|
4035
|
+
if (nodeSubject) {
|
|
4036
|
+
ChangeManager.notify(nodeSubject, { node: selectedNode });
|
|
4001
4037
|
}
|
|
4002
4038
|
}
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4039
|
+
}
|
|
4040
|
+
/**
|
|
4041
|
+
* @param {InlineHtmlAnnotation} inlineHtmlNode - The inline HTML annotation to wrap the text node.
|
|
4042
|
+
* @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
|
|
4043
|
+
* @returns {string} The HTML string representation of the text node wrapped with the inline HTML.
|
|
4044
|
+
*/
|
|
4045
|
+
renderWithWrapperStr(inlineHtmlNode, options) {
|
|
4046
|
+
const { htmlTag, child } = inlineHtmlNode;
|
|
4047
|
+
const attrStr = this.annotationAttrStr(inlineHtmlNode);
|
|
4048
|
+
if (!child) {
|
|
4049
|
+
if (HTML_VOID_TAGS.has(htmlTag)) {
|
|
4050
|
+
return `<${htmlTag}${attrStr}>`;
|
|
4007
4051
|
}
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
linkGroupAnnotation.linkGroups.set(action.groupKey, [...action.nodes]);
|
|
4052
|
+
if (!this.text) {
|
|
4053
|
+
return `<${htmlTag}${attrStr}></${htmlTag}>`;
|
|
4011
4054
|
}
|
|
4012
|
-
|
|
4055
|
+
return `<${htmlTag}${attrStr}>${this.renderTextStr(options)}</${htmlTag}>`;
|
|
4013
4056
|
}
|
|
4057
|
+
return `<${htmlTag}${attrStr}>${this.renderWithWrapperStr(child, options)}</${htmlTag}>`;
|
|
4014
4058
|
}
|
|
4015
|
-
}
|
|
4016
|
-
|
|
4017
|
-
/**
|
|
4018
|
-
* Insert a new children after a existing children
|
|
4019
|
-
*
|
|
4020
|
-
* @example parent.apply(new InsertChildrenAfterAction(existingChildren, newChildren, ...))
|
|
4021
|
-
*/
|
|
4022
|
-
class InsertChildrenAfterAction extends ModifyContentAction {
|
|
4023
|
-
constructor(referBlock, ...blocksToBeInserted) {
|
|
4024
|
-
super();
|
|
4025
|
-
this.type = ModifyContentActionType.INSERT_CHILDREN_AFTER;
|
|
4026
|
-
this.referChildren = referBlock;
|
|
4027
|
-
this.childrenToBeInserted = blocksToBeInserted;
|
|
4028
|
-
}
|
|
4029
|
-
}
|
|
4030
|
-
|
|
4031
|
-
/**
|
|
4032
|
-
* Clear the current block nodes and append new nodes
|
|
4033
|
-
*
|
|
4034
|
-
* @example block.apply(new ReplaceChildNodesAction(newNodes))
|
|
4035
|
-
*/
|
|
4036
|
-
class ReplaceChildNodesAction extends ModifyContentAction {
|
|
4037
|
-
constructor(newChildNodes) {
|
|
4038
|
-
super();
|
|
4039
|
-
this.type = ModifyContentActionType.REPLACE_CHILD_NODES;
|
|
4040
|
-
this.newChildNodes = newChildNodes;
|
|
4041
|
-
}
|
|
4042
|
-
}
|
|
4043
|
-
|
|
4044
|
-
/**
|
|
4045
|
-
* Split the current node with a special position strategy.
|
|
4046
|
-
*/
|
|
4047
|
-
class BlockSplitWithTextNodeStrategy extends ActionHandleStrategy {
|
|
4048
4059
|
/**
|
|
4049
|
-
*
|
|
4060
|
+
* Generate the attribute string for the inline HTML annotation
|
|
4061
|
+
*
|
|
4062
|
+
* @param {InlineHtmlAnnotation} annotation - The inline HTML annotation
|
|
4063
|
+
* @returns {string} The attribute string for the inline HTML annotation
|
|
4050
4064
|
*/
|
|
4051
|
-
|
|
4052
|
-
|
|
4065
|
+
annotationAttrStr(annotation) {
|
|
4066
|
+
const { customAttribute, customClass, customStyle } = annotation;
|
|
4067
|
+
const attrs = [
|
|
4068
|
+
...((customAttribute === null || customAttribute === void 0 ? void 0 : customAttribute.toString()) || []),
|
|
4069
|
+
customClass === null || customClass === void 0 ? void 0 : customClass.toString(),
|
|
4070
|
+
customStyle === null || customStyle === void 0 ? void 0 : customStyle.toString(),
|
|
4071
|
+
].filter(isNonNullable);
|
|
4072
|
+
return attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
|
|
4053
4073
|
}
|
|
4054
4074
|
/**
|
|
4055
|
-
*
|
|
4075
|
+
* Generates the HTML representation of the text node.
|
|
4056
4076
|
*
|
|
4057
|
-
* @param {
|
|
4058
|
-
* @
|
|
4059
|
-
* @param {RTETextBlock} textBlock - The text block need to be splited.
|
|
4060
|
-
* @returns {Nullable<RTEBlock>} return either an RTEBlock object or null.
|
|
4077
|
+
* @param {VegaRTETransformOptions} [options] - Optional conversion options that may affect how the text node is rendered as HTML.
|
|
4078
|
+
* @returns {string} The HTML string representation of the text node.
|
|
4061
4079
|
*/
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
if (afterText) {
|
|
4075
|
-
afterNodes.unshift(splitNode.cloneWithText(afterText));
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
|
-
else {
|
|
4079
|
-
startOffsetOfNode > 0 ? beforeNodes.push(splitNode) : afterNodes.unshift(splitNode);
|
|
4080
|
-
}
|
|
4081
|
-
textBlock.apply(new ReplaceChildNodesAction(beforeNodes));
|
|
4082
|
-
const newBlock = textBlock.cloneWithNodes(afterNodes);
|
|
4083
|
-
textBlock.parent.apply(new InsertChildrenAfterAction(textBlock, newBlock));
|
|
4084
|
-
return newBlock;
|
|
4085
|
-
}
|
|
4080
|
+
renderTextStr(options) {
|
|
4081
|
+
var _a;
|
|
4082
|
+
const NodeTag = ((_a = this.getAnnotationByType(NodeAnnotationTypeEnum.CODE)) === null || _a === void 0 ? void 0 : _a.code)
|
|
4083
|
+
? 'code'
|
|
4084
|
+
: 'span';
|
|
4085
|
+
const attrStr = super.generateAttributeString(options);
|
|
4086
|
+
// If the text contains a newline character, we need to replace it with a <br> tag.
|
|
4087
|
+
if (this.text === '\n') {
|
|
4088
|
+
return `<br>`;
|
|
4089
|
+
}
|
|
4090
|
+
if (this.shouldRenderAsPlainText()) {
|
|
4091
|
+
return this.text;
|
|
4086
4092
|
}
|
|
4093
|
+
const content = NodeTag === 'code' ? escapeHtml(this.text) : this.text;
|
|
4094
|
+
return `<${NodeTag}${attrStr}>${content}</${NodeTag}>`;
|
|
4087
4095
|
}
|
|
4088
|
-
}
|
|
4089
|
-
|
|
4090
|
-
/**
|
|
4091
|
-
* Remove all nodes and append new nodes strategy.
|
|
4092
|
-
*/
|
|
4093
|
-
class BlockReplaceNodesStrategy extends ActionHandleStrategy {
|
|
4094
4096
|
/**
|
|
4095
|
-
*
|
|
4097
|
+
* Determines if the text node should be rendered as plain text.
|
|
4096
4098
|
*
|
|
4097
|
-
* @
|
|
4098
|
-
* @param {RTETextBlock | RTEImageBlock} target - The text block or the image block.
|
|
4099
|
+
* @returns {boolean} `true` if the text node should be rendered as plain text, otherwise `false`.
|
|
4099
4100
|
*/
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
constructor(childNode) {
|
|
4113
|
-
super();
|
|
4114
|
-
this.type = ModifyContentActionType.DELETE_CHILDREN;
|
|
4115
|
-
this.entityToBeRemoved = childNode;
|
|
4101
|
+
shouldRenderAsPlainText() {
|
|
4102
|
+
const plainTextAnnotation = super.getAnnotationByType(NodeAnnotationTypeEnum.PLAIN_TEXT);
|
|
4103
|
+
if (plainTextAnnotation) {
|
|
4104
|
+
return (plainTextAnnotation.plainText &&
|
|
4105
|
+
Array.from(this.annotationMap.values()).filter((annotation) => (annotation instanceof NodeAnnotation &&
|
|
4106
|
+
!(annotation instanceof LinkAnnotation) &&
|
|
4107
|
+
!(annotation instanceof PlainTextAnnotation)) ||
|
|
4108
|
+
annotation instanceof CommonAnnotation).length === 0);
|
|
4109
|
+
}
|
|
4110
|
+
else {
|
|
4111
|
+
return false;
|
|
4112
|
+
}
|
|
4116
4113
|
}
|
|
4117
4114
|
}
|
|
4115
|
+
RTETextNode.registerActionStrategyStatus = {};
|
|
4116
|
+
RTETextNode.htmlTag = 'span';
|
|
4117
|
+
RTETextNode.dtoName = 'RTETextNode';
|
|
4118
4118
|
|
|
4119
4119
|
/**
|
|
4120
4120
|
* Append the second block child nodes to the first block child nodes and remove the second block strategy.
|
|
@@ -4514,18 +4514,30 @@ class RTETextBlock extends RTEBlock {
|
|
|
4514
4514
|
const textBlock = new RTETextBlock(block.id, block.type, options);
|
|
4515
4515
|
const annotations = options.autoMatchFormat
|
|
4516
4516
|
? 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;
|
|
4517
|
-
textBlock.children = block.nodes
|
|
4517
|
+
textBlock.children = RTETextBlock.convertNodes(block.nodes, textBlock, options);
|
|
4518
|
+
if (annotations) {
|
|
4519
|
+
super.convertAnnotationsToMap(textBlock.annotationMap, annotations);
|
|
4520
|
+
}
|
|
4521
|
+
return textBlock;
|
|
4522
|
+
}
|
|
4523
|
+
/**
|
|
4524
|
+
* Convert raw node payloads to their registered `RTENode` subclasses via
|
|
4525
|
+
* `RTEDTOClassManager`, preserving custom types (e.g. `RTETokenNode`).
|
|
4526
|
+
*
|
|
4527
|
+
* @param {VegaRTETextNode[]} nodes - Raw node payloads.
|
|
4528
|
+
* @param {RTETextBlock} parent - Parent block for the converted nodes.
|
|
4529
|
+
* @param {VegaRTETransformOptions} [options] - Optional transform options.
|
|
4530
|
+
* @returns {RTETextNode[]} Converted nodes; unregistered types are dropped.
|
|
4531
|
+
*/
|
|
4532
|
+
static convertNodes(nodes, parent, options) {
|
|
4533
|
+
return nodes
|
|
4518
4534
|
.map((richText) => {
|
|
4519
4535
|
const NodeClass = RTEDTOClassManager$1.getRTENodeClass(richText.type);
|
|
4520
4536
|
if (NodeClass) {
|
|
4521
|
-
return NodeClass.from(richText,
|
|
4537
|
+
return NodeClass.from(richText, parent, options);
|
|
4522
4538
|
}
|
|
4523
4539
|
})
|
|
4524
4540
|
.filter(isNonNullable);
|
|
4525
|
-
if (annotations) {
|
|
4526
|
-
super.convertAnnotationsToMap(textBlock.annotationMap, annotations);
|
|
4527
|
-
}
|
|
4528
|
-
return textBlock;
|
|
4529
4541
|
}
|
|
4530
4542
|
/**
|
|
4531
4543
|
* The function `createAnnotationEntity` creates a block annotation entity based on the provided type
|
|
@@ -4957,7 +4969,7 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
4957
4969
|
*/
|
|
4958
4970
|
static from(block, options = { autoMatchFormat: true }) {
|
|
4959
4971
|
const listItemBlock = new RTEListItemBlock(block.id, undefined, options);
|
|
4960
|
-
listItemBlock.children = block.nodes
|
|
4972
|
+
listItemBlock.children = RTEListItemBlock.convertNodes(block.nodes, listItemBlock, options);
|
|
4961
4973
|
if (block.children) {
|
|
4962
4974
|
listItemBlock.nestList = block.children.map((child) => {
|
|
4963
4975
|
const listBlock = RTEListBlock.from(child, options);
|