@heartlandone/vega 2.80.0 → 2.81.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/{app-globals-7a48292d.js → app-globals-25e1bfac.js} +6 -6
- package/dist/cjs/{aria-dialog-focusable-trap-slimmer-5a0a78fe.js → aria-dialog-focusable-trap-slimmer-ced9566d.js} +14 -69
- package/dist/cjs/{child-nodes-notify-observer-slimmer-a8d13f4c.js → child-nodes-notify-observer-slimmer-2631c381.js} +1 -1
- package/dist/cjs/{code-block-71a330a1.js → code-block-24b3d0e7.js} +802 -61
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-fd077a6c.js → component-value-history-controller-slimmer.abstract-bd662b32.js} +5 -5
- package/dist/cjs/{content-state-afa26456.js → content-state-0f26036c.js} +969 -466
- package/dist/cjs/{date-required-rule-9f0e3e99.js → date-required-rule-4377217a.js} +1 -1
- package/dist/cjs/{design-token-3f9589eb.js → design-token-40276b11.js} +2 -2
- package/dist/cjs/{dom-node-subject-observer-factory-a3a60da4.js → dom-node-subject-observer-factory-9110cb94.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-7a66229b.js → element-appender-slimmer-be1b4d57.js} +4 -4
- package/dist/cjs/{event-emit-slimmer-024e26bb.js → event-emit-slimmer-bee6b676.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-c487cf2b.js → form-field-controller-slimmer-982dbfe4.js} +3 -3
- package/dist/cjs/{image-annotation-action-4e72af4b.js → image-annotation-action-e0df5a20.js} +3 -3
- package/dist/cjs/index.cjs.js +15 -14
- package/dist/cjs/{inject-keyboard-manager-d1a82089.js → inject-keyboard-manager-12b65e98.js} +1 -1
- package/dist/cjs/{keyboard-manager-9dbbb0d4.js → keyboard-manager-c89a66d3.js} +2 -2
- package/dist/cjs/{keyboard-manager-slimmer-68cff676.js → keyboard-manager-slimmer-93fcbf46.js} +1 -1
- package/dist/cjs/loader.cjs.js +10 -10
- package/dist/cjs/{month-view-generator-65a2f883.js → month-view-generator-0d25e950.js} +1 -1
- package/dist/cjs/page-size-option-utils-d038dd3a.js +68 -0
- package/dist/cjs/{public-rules-36f202b3.js → public-rules-652ec269.js} +8 -8
- package/dist/cjs/{range-fa15d524.js → range-cdd61881.js} +2 -2
- package/dist/cjs/{responsive-format-facade-4419b4ae.js → responsive-format-facade-9cae7f27.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-7d4c2973.js → rich-text-editor-required-rule-4b919054.js} +1 -1
- package/dist/cjs/{split-cell-operation-19f98afb.js → split-cell-operation-3596f738.js} +58 -23
- package/dist/cjs/{string-format-strategy.abstract-c65d9861.js → string-format-strategy.abstract-ebdb2573.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-c2e04acc.js → string-input-formatter-slimmer-9b6a8399.js} +3 -3
- package/dist/cjs/{string-mask-strategy-418fc0b8.js → string-mask-strategy-6cc9f391.js} +2 -2
- package/dist/cjs/{style-formatter-3c9ce0e5.js → style-formatter-18289c4d.js} +2 -2
- package/dist/cjs/{sub-state-notify-slimmer-7a4c6061.js → sub-state-notify-slimmer-39bfcfe3.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-f728e068.js → sub-state-observer-slimmer-e5b50cbf.js} +2 -2
- package/dist/cjs/{time-required-rule-ad091302.js → time-required-rule-3517beff.js} +1 -1
- package/dist/cjs/{token-extension-90396de7.js → token-extension-addc97c1.js} +208 -34
- package/dist/cjs/{type-guard-d760850a.js → type-guard-362d7da3.js} +23 -0
- package/dist/cjs/{ui-9e8c9732.js → ui-ae4ee13d.js} +69 -0
- package/dist/cjs/{valid-credit-card-number-rule-5ce8e973.js → valid-credit-card-number-rule-1d8bf49c.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
- package/dist/cjs/vega-app-header-button.cjs.entry.js +6 -6
- package/dist/cjs/vega-backdrop.cjs.entry.js +1 -1
- package/dist/cjs/vega-banner.cjs.entry.js +5 -4
- package/dist/cjs/vega-box.cjs.entry.js +5 -5
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +27 -10
- package/dist/cjs/vega-button-circle.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-group_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-button-link.cjs.entry.js +3 -3
- package/dist/cjs/vega-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-calendar_4.cjs.entry.js +7 -7
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +5 -5
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-chip.cjs.entry.js +7 -7
- package/dist/cjs/vega-code-block.cjs.entry.js +9 -9
- package/dist/cjs/vega-color-picker.cjs.entry.js +5 -5
- package/dist/cjs/vega-combo-box.cjs.entry.js +8 -8
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +337 -279
- package/dist/cjs/vega-dialog_2.cjs.entry.js +73 -10
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +51 -13
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +5 -5
- package/dist/cjs/vega-flag-icon.cjs.entry.js +3 -3
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +4 -4
- package/dist/cjs/vega-form.cjs.entry.js +8 -8
- package/dist/cjs/vega-grid.cjs.entry.js +4 -4
- package/dist/cjs/vega-icon.cjs.entry.js +4 -4
- package/dist/cjs/vega-image-uploader.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +9 -9
- package/dist/cjs/vega-input-numeric.cjs.entry.js +9 -9
- package/dist/cjs/vega-input-passcode.cjs.entry.js +8 -8
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-range.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-select.cjs.entry.js +7 -7
- package/dist/cjs/vega-input.cjs.entry.js +14 -11
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +117 -12
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +23 -7
- package/dist/cjs/vega-pagination.cjs.entry.js +43 -19
- package/dist/cjs/vega-popover_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +42 -11
- package/dist/cjs/vega-radio_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +100 -19
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +29 -18
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
- package/dist/cjs/vega-section-title.cjs.entry.js +21 -3
- package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +7 -7
- package/dist/cjs/vega-signature-capture.cjs.entry.js +8 -8
- package/dist/cjs/vega-stepper.cjs.entry.js +6 -6
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-table_11.cjs.entry.js +7 -7
- package/dist/cjs/vega-text.cjs.entry.js +1 -1
- package/dist/cjs/vega-textarea.cjs.entry.js +5 -5
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -11
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +5 -5
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +7 -7
- package/dist/cjs/vega.cjs.js +10 -10
- package/dist/cjs/{wait-for-component-did-render-b6aba2de.js → wait-for-component-did-render-b6d12d51.js} +1 -1
- package/dist/collection/components/vega-banner/slimmers/renderers/vega-banner-renderer.js +1 -0
- package/dist/collection/components/vega-banner/vega-banner.css +36 -0
- package/dist/collection/components/vega-box/vega-box.js +1 -1
- package/dist/collection/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-item-renderer.js +9 -6
- package/dist/collection/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-renderer.js +4 -0
- package/dist/collection/components/vega-breadcrumb/vega-breadcrumb.css +6 -0
- package/dist/collection/components/vega-breadcrumb/vega-breadcrumb.js +31 -0
- package/dist/collection/components/vega-card/vega-card.css +157 -0
- package/dist/collection/components/vega-card/vega-card.js +1 -1
- package/dist/collection/components/vega-chip/vega-chip.js +26 -1
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-current-period-controller.js +5 -10
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-is-dual-months-controller.js +64 -0
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-header-render.js +3 -6
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.js +3 -11
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.js +2 -2
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.js +4 -5
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.css +13 -15
- package/dist/collection/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.js +41 -2
- package/dist/collection/components/vega-dialog/vega-dialog.js +1 -1
- package/dist/collection/components/vega-divider/slimmers/controllers/vega-divider-size-controller.js +1 -1
- package/dist/collection/components/vega-divider/vega-divider.css +157 -0
- package/dist/collection/components/vega-divider/vega-divider.js +1 -1
- package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.js +37 -1
- package/dist/collection/components/vega-dropdown/slimmers/renderers/vega-dropdown-renderer.js +4 -1
- package/dist/collection/components/vega-flex/vega-flex.css +157 -0
- package/dist/collection/components/vega-flex/vega-flex.js +1 -1
- package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-renderer.js +4 -1
- package/dist/collection/components/vega-input/vega-input.js +25 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.js +37 -1
- package/dist/collection/components/vega-modal/slimmers/renderers/vega-modal-renderer.js +11 -1
- package/dist/collection/components/vega-modal/vega-modal.css +2683 -7
- package/dist/collection/components/vega-modal/vega-modal.js +75 -0
- package/dist/collection/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.js +85 -2
- package/dist/collection/components/vega-nav/vega-left-nav/vega-left-nav.js +23 -0
- package/dist/collection/components/vega-pagination/constants/page-size.js +2 -0
- package/dist/collection/components/vega-pagination/internal/vega-pagination-page-size-selector.js +11 -7
- package/dist/collection/components/vega-pagination/slimmers/controllers/vega-pagination-page-size-observer-controller.js +11 -1
- package/dist/collection/components/vega-pagination/utils/page-size-option-utils.js +57 -0
- package/dist/collection/components/vega-pagination/vega-pagination-page-size-selector-mobile/slimmers/renderers/page-size-selector-mobile-dropdown-renderer.js +15 -5
- package/dist/collection/components/vega-pagination/vega-pagination-page-size-selector-mobile/vega-pagination-page-size-selector-mobile.js +39 -3
- package/dist/collection/components/vega-pagination/vega-pagination.js +32 -11
- package/dist/collection/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-direction-controller.js +34 -3
- package/dist/collection/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +15 -4
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +6 -2
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/html-block.js +9 -15
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +3 -7
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +50 -9
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +25 -6
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-block-filter-styles-strategy.js +39 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-node-filter-styles-strategy.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy-registry.js +64 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy.abstract.js +147 -14
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/image-node/image-filter-styles-strategy.js +26 -3
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-block-filter-styles-strategy.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-heading-item-block-filter-styles-strategy.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-item-block-filter-styles-strategy.js +39 -1
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-title-item-block-filter-styles-strategy.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/predicate.js +94 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/heading-filter-styles-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/paragraph-filter-styles-strategy.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/title-filter-styles-strategy.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/code-filter-styles-strategy.js +32 -3
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/link-filter-styles-strategy.js +42 -3
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/title-heading-node-filter-styles-strategy.js +108 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +7 -2
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +15 -4
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +84 -14
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +61 -6
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +14 -3
- package/dist/collection/components/vega-rich-text-editor/dto/setup.js +36 -6
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js +9 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.js +17 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.js +17 -18
- package/dist/collection/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-body-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.js +21 -4
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-row-block.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/caption-to-caption-block-strategy.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/table/element-to-dto-strategies/td-to-table-cell-block-strategy.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-block/table-block-filter-styles-strategy.js +39 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-caption/table-caption-filter-styles-strategy.js +39 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-cell/table-cell-filter-styles-strategy.js +63 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/table-extension.js +7 -0
- package/dist/collection/components/vega-rich-text-editor/helpers/utils.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/public-api.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.js +2 -25
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.js +30 -53
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/link-annotation-handler.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +85 -17
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +12 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.js +95 -43
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-element-to-text-node-strategy.js +1 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/predicate.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/strategy-tags.js +142 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.js +12 -2
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +1 -1
- package/dist/collection/components/vega-section-title/slimmers/renderers/vega-section-title-renderer.js +8 -2
- package/dist/collection/components/vega-section-title/vega-section-title.css +35 -0
- package/dist/collection/components/vega-section-title/vega-section-title.js +64 -0
- package/dist/collection/components/vega-stepper/vega-stepper.css +3 -0
- package/dist/collection/helpers/formatter/responsive-map-formatter/responsive-margin-formatter.js +3 -3
- package/dist/collection/helpers/slimmers/aria-dialog-focusable-trap-slimmer.js +13 -68
- package/dist/collection/types/type-guard.js +21 -0
- package/dist/collection/utils/ui.js +68 -0
- package/dist/esm/{app-globals-e77015e3.js → app-globals-80a7d395.js} +6 -6
- package/dist/esm/{aria-dialog-focusable-trap-slimmer-5a2f92be.js → aria-dialog-focusable-trap-slimmer-cc6a8c3e.js} +14 -69
- package/dist/esm/{child-nodes-notify-observer-slimmer-b7f0e419.js → child-nodes-notify-observer-slimmer-a8cb19cf.js} +1 -1
- package/dist/esm/{code-block-7d6f231b.js → code-block-cd913077.js} +796 -62
- package/dist/esm/{component-value-history-controller-slimmer.abstract-acf65b17.js → component-value-history-controller-slimmer.abstract-e595761d.js} +5 -5
- package/dist/esm/{content-state-084cd705.js → content-state-89f8eecb.js} +958 -455
- package/dist/esm/{date-required-rule-29608215.js → date-required-rule-2b08f32c.js} +1 -1
- package/dist/esm/{design-token-edcd787b.js → design-token-7566d54c.js} +2 -2
- package/dist/esm/{dom-node-subject-observer-factory-cea9248d.js → dom-node-subject-observer-factory-aca0116e.js} +1 -1
- package/dist/esm/{element-appender-slimmer-08ec429b.js → element-appender-slimmer-df2a2da2.js} +4 -4
- package/dist/esm/{event-emit-slimmer-4fba1b35.js → event-emit-slimmer-9abc9241.js} +1 -1
- package/dist/esm/{form-field-controller-slimmer-8dd39707.js → form-field-controller-slimmer-40fcb5c2.js} +3 -3
- package/dist/esm/{image-annotation-action-a6b33a81.js → image-annotation-action-6048d32e.js} +3 -3
- package/dist/esm/index.js +14 -14
- package/dist/esm/{inject-keyboard-manager-7557816f.js → inject-keyboard-manager-c6557f50.js} +1 -1
- package/dist/esm/{keyboard-manager-1846c6a5.js → keyboard-manager-c7b125d7.js} +2 -2
- package/dist/esm/{keyboard-manager-slimmer-1ae0aa4d.js → keyboard-manager-slimmer-6109039b.js} +1 -1
- package/dist/esm/loader.js +10 -10
- package/dist/esm/{month-view-generator-b700ed08.js → month-view-generator-139ace5a.js} +1 -1
- package/dist/esm/page-size-option-utils-50afc81a.js +61 -0
- package/dist/esm/{public-rules-fe2c7934.js → public-rules-e42bce9d.js} +8 -8
- package/dist/esm/{range-00afe462.js → range-b76edec7.js} +2 -2
- package/dist/esm/{responsive-format-facade-37d4d850.js → responsive-format-facade-151dbd10.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-6487ec94.js → rich-text-editor-required-rule-1fc7c040.js} +1 -1
- package/dist/esm/{split-cell-operation-9445e642.js → split-cell-operation-548ea374.js} +58 -23
- package/dist/esm/{string-format-strategy.abstract-ec6d627b.js → string-format-strategy.abstract-6488031a.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-959dff7a.js → string-input-formatter-slimmer-625e17a2.js} +3 -3
- package/dist/esm/{string-mask-strategy-49be41f0.js → string-mask-strategy-a165d316.js} +2 -2
- package/dist/esm/{style-formatter-ad0b2bac.js → style-formatter-280757ae.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-ee8c417b.js → sub-state-notify-slimmer-6c972bb4.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-4d30fa5c.js → sub-state-observer-slimmer-53643b5c.js} +2 -2
- package/dist/esm/{time-required-rule-414b1590.js → time-required-rule-3f5a8822.js} +1 -1
- package/dist/esm/{token-extension-600b1c88.js → token-extension-5ee7a3f1.js} +208 -34
- package/dist/esm/{type-guard-23a08026.js → type-guard-f6c9c89d.js} +22 -1
- package/dist/esm/{ui-ba5a4758.js → ui-b7600a48.js} +69 -1
- package/dist/esm/{valid-credit-card-number-rule-60abddac.js → valid-credit-card-number-rule-3bf19ad6.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -6
- package/dist/esm/vega-app-header-button.entry.js +6 -6
- package/dist/esm/vega-backdrop.entry.js +1 -1
- package/dist/esm/vega-banner.entry.js +5 -4
- package/dist/esm/vega-box.entry.js +5 -5
- package/dist/esm/vega-breadcrumb.entry.js +27 -10
- package/dist/esm/vega-button-circle.entry.js +6 -6
- package/dist/esm/vega-button-group_2.entry.js +5 -5
- package/dist/esm/vega-button-link.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +5 -5
- package/dist/esm/vega-calendar_4.entry.js +7 -7
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +5 -5
- package/dist/esm/vega-checkbox_2.entry.js +6 -6
- package/dist/esm/vega-chip.entry.js +7 -7
- package/dist/esm/vega-code-block.entry.js +9 -9
- package/dist/esm/vega-color-picker.entry.js +5 -5
- package/dist/esm/vega-combo-box.entry.js +8 -8
- package/dist/esm/vega-date-picker_2.entry.js +337 -279
- package/dist/esm/vega-dialog_2.entry.js +73 -10
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +52 -14
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +5 -5
- package/dist/esm/vega-flag-icon.entry.js +3 -3
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +4 -4
- package/dist/esm/vega-form.entry.js +8 -8
- package/dist/esm/vega-grid.entry.js +4 -4
- package/dist/esm/vega-icon.entry.js +4 -4
- package/dist/esm/vega-image-uploader.entry.js +7 -7
- package/dist/esm/vega-input-credit-card.entry.js +9 -9
- package/dist/esm/vega-input-numeric.entry.js +9 -9
- package/dist/esm/vega-input-passcode.entry.js +8 -8
- package/dist/esm/vega-input-phone-number.entry.js +7 -7
- package/dist/esm/vega-input-range.entry.js +5 -5
- package/dist/esm/vega-input-select.entry.js +7 -7
- package/dist/esm/vega-input.entry.js +14 -11
- package/dist/esm/vega-item-toggle.entry.js +3 -3
- package/dist/esm/vega-left-nav_5.entry.js +117 -12
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-page-notification_2.entry.js +2 -2
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +23 -7
- package/dist/esm/vega-pagination.entry.js +43 -19
- package/dist/esm/vega-popover_2.entry.js +10 -10
- package/dist/esm/vega-progress-tracker_2.entry.js +42 -11
- package/dist/esm/vega-radio_2.entry.js +9 -9
- package/dist/esm/vega-rich-text-content.entry.js +100 -19
- package/dist/esm/vega-rich-text-editor_4.entry.js +29 -18
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
- package/dist/esm/vega-section-title.entry.js +21 -3
- package/dist/esm/vega-segment-control.entry.js +3 -3
- package/dist/esm/vega-selection-chip_2.entry.js +8 -8
- package/dist/esm/vega-selection-tile_2.entry.js +7 -7
- package/dist/esm/vega-sidenav_3.entry.js +7 -7
- package/dist/esm/vega-signature-capture.entry.js +8 -8
- package/dist/esm/vega-stepper.entry.js +6 -6
- package/dist/esm/vega-tab-group_2.entry.js +3 -3
- package/dist/esm/vega-table_11.entry.js +7 -7
- package/dist/esm/vega-text.entry.js +1 -1
- package/dist/esm/vega-textarea.entry.js +5 -5
- package/dist/esm/vega-time-picker_2.entry.js +11 -11
- package/dist/esm/vega-toggle-switch.entry.js +5 -5
- package/dist/esm/vega-tooltip_2.entry.js +7 -7
- package/dist/esm/vega.js +10 -10
- package/dist/esm/{wait-for-component-did-render-03e7ccb2.js → wait-for-component-did-render-6980a1a6.js} +1 -1
- package/dist/sri/vega-sri-manifest.json +345 -341
- package/dist/types/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-item-renderer.d.ts +1 -0
- package/dist/types/components/vega-breadcrumb/slimmers/renderers/vega-breadcrumb-renderer.d.ts +1 -0
- package/dist/types/components/vega-breadcrumb/vega-breadcrumb.d.ts +10 -0
- package/dist/types/components/vega-chip/vega-chip.d.ts +9 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-current-period-controller.d.ts +1 -6
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/controllers/vega-date-picker-calendar-is-dual-months-controller.d.ts +28 -0
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-header-render.d.ts +1 -2
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-renderer.d.ts +1 -2
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-calendar-year-month-switcher-renderer.d.ts +1 -1
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/slimmers/renderers/vega-date-picker-month-item-renderer.d.ts +1 -1
- package/dist/types/components/vega-date-picker/vega-date-picker-calendar/vega-date-picker-calendar.d.ts +12 -0
- package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-appender-controller.d.ts +12 -0
- package/dist/types/components/vega-dropdown/slimmers/renderers/vega-dropdown-renderer.d.ts +1 -0
- package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-renderer.d.ts +1 -0
- package/dist/types/components/vega-input/types.d.ts +5 -0
- package/dist/types/components/vega-input/vega-input.d.ts +17 -1
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.d.ts +9 -0
- package/dist/types/components/vega-modal/slimmers/renderers/vega-modal-renderer.d.ts +3 -0
- package/dist/types/components/vega-modal/vega-modal.d.ts +24 -1
- package/dist/types/components/vega-nav/vega-left-nav/slimmers/controllers/vega-left-nav-open-state-controller.d.ts +17 -0
- package/dist/types/components/vega-pagination/constants/page-size.d.ts +2 -0
- package/dist/types/components/vega-pagination/internal/vega-pagination-page-size-selector.d.ts +3 -2
- package/dist/types/components/vega-pagination/slimmers/controllers/vega-pagination-page-size-observer-controller.d.ts +2 -0
- package/dist/types/components/vega-pagination/types.d.ts +9 -0
- package/dist/types/components/vega-pagination/utils/page-size-option-utils.d.ts +42 -0
- package/dist/types/components/vega-pagination/vega-pagination-page-size-selector-mobile/slimmers/renderers/page-size-selector-mobile-dropdown-renderer.d.ts +2 -0
- package/dist/types/components/vega-pagination/vega-pagination-page-size-selector-mobile/vega-pagination-page-size-selector-mobile.d.ts +9 -2
- package/dist/types/components/vega-pagination/vega-pagination.d.ts +8 -3
- package/dist/types/components/vega-progress-tracker/slimmers/controllers/vega-progress-tracker-current-direction-controller.d.ts +14 -2
- package/dist/types/components/vega-progress-tracker/slimmers/renderers/vega-progress-tracker-renderer.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +5 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/inline-html-annotation.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +8 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +4 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/html-block.d.ts +1 -11
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +15 -2
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +9 -3
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-block-filter-styles-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/code-block/code-node-filter-styles-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy-registry.d.ts +27 -1
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy.abstract.d.ts +92 -8
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/image-node/image-filter-styles-strategy.d.ts +21 -3
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-block-filter-styles-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-heading-item-block-filter-styles-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-item-block-filter-styles-strategy.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/list-block/list-title-item-block-filter-styles-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/predicate.d.ts +72 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/heading-filter-styles-strategy.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/paragraph-filter-styles-strategy.d.ts +34 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-block/title-filter-styles-strategy.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/code-filter-styles-strategy.d.ts +25 -2
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/link-filter-styles-strategy.d.ts +24 -4
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/title-heading-node-filter-styles-strategy.d.ts +62 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +7 -3
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +5 -3
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +43 -4
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +5 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-annotation.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-caption-annotation.d.ts +7 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/annotations/table-cell-annotation.d.ts +9 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-body-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-caption-block.d.ts +5 -2
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-cell-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-head-cell-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-row-block.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-block/table-block-filter-styles-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-caption/table-caption-filter-styles-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/filter-styles-strategies/table-cell/table-cell-filter-styles-strategy.d.ts +46 -0
- package/dist/types/components/vega-rich-text-editor/helpers/utils.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +27 -5
- package/dist/types/components/vega-rich-text-editor/public-api.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/custom-style-annotation-handler.d.ts +0 -7
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/inline-html-annotation-handler.d.ts +11 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +43 -7
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +8 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/html-block-strategy.d.ts +34 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/predicate.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/strategy-tags.d.ts +83 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.d.ts +6 -0
- package/dist/types/components/vega-section-title/slimmers/renderers/vega-section-title-renderer.d.ts +2 -0
- package/dist/types/components/vega-section-title/types.d.ts +1 -0
- package/dist/types/components/vega-section-title/vega-section-title.d.ts +14 -0
- package/dist/types/components.d.ts +93 -8
- package/dist/types/helpers/slimmers/aria-dialog-focusable-trap-slimmer.d.ts +4 -12
- package/dist/types/types/components.type.d.ts +3 -0
- package/dist/types/types/type-guard.d.ts +15 -1
- package/dist/types/types/ui.type.d.ts +11 -1
- package/dist/types/utils/ui.d.ts +14 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-1c45565d.js → p-001d36af.js} +1 -1
- package/dist/vega/{p-7c2fecfd.entry.js → p-01541820.entry.js} +1 -1
- package/dist/vega/p-0304c3a7.js +1 -0
- package/dist/vega/{p-2d917e2d.entry.js → p-08f03a52.entry.js} +1 -1
- package/dist/vega/{p-9390a94b.entry.js → p-0a145766.entry.js} +1 -1
- package/dist/vega/p-0d205fbf.js +1 -0
- package/dist/vega/p-0fc2ccc4.entry.js +1 -0
- package/dist/vega/p-118aeed1.entry.js +1 -0
- package/dist/vega/{p-ea21462f.js → p-1a4e8d8a.js} +1 -1
- package/dist/vega/{p-5ae4ea20.entry.js → p-23dc4064.entry.js} +1 -1
- package/dist/vega/{p-2c2df248.js → p-24b45c85.js} +1 -1
- package/dist/vega/{p-010b5e74.js → p-262a27d0.js} +1 -1
- package/dist/vega/{p-9dc23325.entry.js → p-27dc6562.entry.js} +1 -1
- package/dist/vega/p-295326ca.entry.js +1 -0
- package/dist/vega/{p-6af55f1c.entry.js → p-2beace1c.entry.js} +1 -1
- package/dist/vega/p-2ce2972f.js +1 -0
- package/dist/vega/p-2e7d5e28.entry.js +1 -0
- package/dist/vega/{p-7618dde4.js → p-2f99c511.js} +1 -1
- package/dist/vega/p-32592497.entry.js +1 -0
- package/dist/vega/{p-65900dbf.entry.js → p-37a9f4b4.entry.js} +1 -1
- package/dist/vega/{p-a99e75a1.entry.js → p-4013d954.entry.js} +1 -1
- package/dist/vega/{p-19ad4f15.entry.js → p-42da45e3.entry.js} +1 -1
- package/dist/vega/p-42e246e4.entry.js +1 -0
- package/dist/vega/p-479a169c.entry.js +1 -0
- package/dist/vega/{p-35386999.entry.js → p-47a2eec1.entry.js} +1 -1
- package/dist/vega/{p-b696a861.js → p-49ae8c79.js} +1 -1
- package/dist/vega/p-4ed416e7.js +1 -0
- package/dist/vega/{p-dc9b5063.entry.js → p-53ba1adb.entry.js} +1 -1
- package/dist/vega/{p-d1494c7c.entry.js → p-55019e55.entry.js} +1 -1
- package/dist/vega/{p-434fc427.entry.js → p-565aac6e.entry.js} +1 -1
- package/dist/vega/{p-cc055723.entry.js → p-574586c9.entry.js} +1 -1
- package/dist/vega/{p-cca5042b.entry.js → p-5781b9f4.entry.js} +1 -1
- package/dist/vega/{p-1feb4f2a.entry.js → p-57827342.entry.js} +1 -1
- package/dist/vega/p-59c6f795.js +1 -0
- package/dist/vega/{p-f48c43f4.entry.js → p-5a8be21c.entry.js} +1 -1
- package/dist/vega/p-5baff397.js +1 -0
- package/dist/vega/{p-ffa2e3a6.entry.js → p-5e9f6fb6.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-44c5cbb7.js → p-5f95a2fa.js} +1 -1
- package/dist/vega/{p-576fe408.js → p-6216c30e.js} +1 -1
- package/dist/vega/{p-367d44d9.entry.js → p-62e80151.entry.js} +1 -1
- package/dist/vega/{p-ec1d76c6.entry.js → p-63d73fa0.entry.js} +1 -1
- package/dist/vega/{p-612e3ded.js → p-64e22fe5.js} +1 -1
- package/dist/vega/{p-0313393d.entry.js → p-679b1f00.entry.js} +1 -1
- package/dist/vega/p-6e70d3cc.js +1 -0
- package/dist/vega/{p-70f1cf4e.entry.js → p-757bfca2.entry.js} +1 -1
- package/dist/vega/{p-c9201bf4.js → p-76063dcb.js} +1 -1
- package/dist/vega/{p-8adf9732.entry.js → p-76daa632.entry.js} +1 -1
- package/dist/vega/{p-1a2f92a3.entry.js → p-77c6f14a.entry.js} +1 -1
- package/dist/vega/{p-382b71a3.entry.js → p-7ac9e8ff.entry.js} +1 -1
- package/dist/vega/p-83863463.js +1 -0
- package/dist/vega/{p-e84b95d4.js → p-88e6618d.js} +1 -1
- package/dist/vega/p-90a0b9f3.entry.js +1 -0
- package/dist/vega/{p-1557ed92.entry.js → p-9324dd2c.entry.js} +1 -1
- package/dist/vega/{p-cf70c57d.js → p-98c44c03.js} +1 -1
- package/dist/vega/p-9aa1c66a.entry.js +1 -0
- package/dist/vega/p-9b01a28a.entry.js +1 -0
- package/dist/vega/{p-4eb282ef.entry.js → p-9b14ac66.entry.js} +1 -1
- package/dist/vega/p-9dcecdd3.js +1 -0
- package/dist/vega/p-a1d51bc2.js +1 -0
- package/dist/vega/{p-04e56b0c.entry.js → p-ab4b06c9.entry.js} +1 -1
- package/dist/vega/{p-b5c2fff3.entry.js → p-ac43be09.entry.js} +1 -1
- package/dist/vega/{p-7ceab8c7.entry.js → p-add63fe0.entry.js} +1 -1
- package/dist/vega/{p-89e56502.js → p-ae0f03c1.js} +1 -1
- package/dist/vega/{p-21c9e1ca.entry.js → p-b525c800.entry.js} +1 -1
- package/dist/vega/p-be651266.entry.js +1 -0
- package/dist/vega/{p-c045e4c1.entry.js → p-c0d45f77.entry.js} +1 -1
- package/dist/vega/{p-204c7d41.js → p-c2e7992b.js} +1 -1
- package/dist/vega/{p-b5a6bd0f.entry.js → p-c56aa01c.entry.js} +1 -1
- package/dist/vega/{p-2e73582d.entry.js → p-cc3c661c.entry.js} +1 -1
- package/dist/vega/{p-cda45d2a.entry.js → p-cda09e99.entry.js} +1 -1
- package/dist/vega/{p-d1ca70a1.js → p-d0ac7af8.js} +1 -1
- package/dist/vega/p-d289a6af.js +3 -0
- package/dist/vega/p-d29e8972.entry.js +1 -0
- package/dist/vega/{p-76b80a0c.js → p-d47aa28f.js} +1 -1
- package/dist/vega/p-d90eee9a.entry.js +1 -0
- package/dist/vega/{p-be3517be.entry.js → p-da742a7f.entry.js} +1 -1
- package/dist/vega/p-dc6e7a77.js +1 -0
- package/dist/vega/{p-c61279a7.entry.js → p-dcf8f58f.entry.js} +1 -1
- package/dist/vega/{p-ab21fdf6.entry.js → p-dff66a67.entry.js} +1 -1
- package/dist/vega/{p-90137c68.entry.js → p-e1117034.entry.js} +1 -1
- package/dist/vega/p-e223e0dc.entry.js +1 -0
- package/dist/vega/p-e22e5aa1.js +1 -0
- package/dist/vega/{p-df5bfbc4.entry.js → p-e753fac2.entry.js} +1 -1
- package/dist/vega/{p-7912741f.entry.js → p-e7a4b760.entry.js} +1 -1
- package/dist/vega/{p-ba415db6.entry.js → p-e8fc8495.entry.js} +1 -1
- package/dist/vega/{p-18619467.js → p-ea2b5dbb.js} +1 -1
- package/dist/vega/{p-f3456993.entry.js → p-eccabba7.entry.js} +1 -1
- package/dist/vega/{p-517434d4.entry.js → p-f0d605e9.entry.js} +1 -1
- package/dist/vega/{p-878851f6.js → p-f28a6074.js} +1 -1
- package/dist/vega/{p-840ad046.entry.js → p-f2c65579.entry.js} +1 -1
- package/dist/vega/{p-07a2b42a.js → p-f2cef51a.js} +1 -1
- package/dist/vega/{p-47ca1f69.entry.js → p-f40d479d.entry.js} +1 -1
- package/dist/vega/p-f5013494.entry.js +1 -0
- package/dist/vega/{p-60cf2a68.js → p-f509b439.js} +1 -1
- package/dist/vega/p-f5d3ce94.js +1 -0
- package/dist/vega/{p-9551da9c.entry.js → p-f69e2801.entry.js} +1 -1
- package/dist/vega/p-fa654762.entry.js +1 -0
- package/dist/vega/{p-365d21ac.entry.js → p-fbc5a7f6.entry.js} +1 -1
- package/dist/vega/{p-b3e40faf.js → p-fd5ddc55.js} +1 -1
- package/dist/vega/p-ff47aeee.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-01883ffc.entry.js +0 -1
- package/dist/vega/p-02578a59.js +0 -1
- package/dist/vega/p-043e685a.entry.js +0 -1
- package/dist/vega/p-08780df0.entry.js +0 -1
- package/dist/vega/p-10fa4eac.js +0 -1
- package/dist/vega/p-203bc4db.entry.js +0 -1
- package/dist/vega/p-22336063.js +0 -1
- package/dist/vega/p-224b67ff.entry.js +0 -1
- package/dist/vega/p-334e3b02.entry.js +0 -1
- package/dist/vega/p-559197f8.js +0 -1
- package/dist/vega/p-68124bc5.js +0 -1
- package/dist/vega/p-6c5250b3.js +0 -1
- package/dist/vega/p-6f2e5bc6.js +0 -1
- package/dist/vega/p-716c71e6.js +0 -1
- package/dist/vega/p-7362723e.entry.js +0 -1
- package/dist/vega/p-7942c042.entry.js +0 -1
- package/dist/vega/p-8327635d.js +0 -1
- package/dist/vega/p-8b891f36.entry.js +0 -1
- package/dist/vega/p-9341c1a9.js +0 -1
- package/dist/vega/p-9862d1a8.entry.js +0 -1
- package/dist/vega/p-a4dbf2cc.js +0 -1
- package/dist/vega/p-c4e32125.entry.js +0 -1
- package/dist/vega/p-c5b698f6.entry.js +0 -1
- package/dist/vega/p-c6d62f0d.js +0 -1
- package/dist/vega/p-cdf5b2f0.entry.js +0 -1
- package/dist/vega/p-d202e69d.entry.js +0 -1
- package/dist/vega/p-dcd18ab1.js +0 -1
- package/dist/vega/p-e4726dcd.entry.js +0 -1
- package/dist/vega/p-f4190826.entry.js +0 -1
- package/dist/vega/p-fdac91c4.entry.js +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as ActionHandleStrategy, e as RTETextBlock, c as RTETextNode, h as AppendChildrenAction, A as ActionHandleStrategyRegistry, T as TextStyleAnnotationAction, q as BlockUpdateTextStyleStrategy, H as HorizontalAlignmentAnnotationAction, r as BlockUpdateHorizontalAlignmentStrategy, l as ModifyContentActionType, t as BlockInsertLineBreakStrategy, u as BlockInsertLineBreakWithBlocksStrategy, v as BlockSplitWithTextNodeStrategy, w as BlockReplaceNodesStrategy, x as BlockMergeNodesStrategy, I as InsertChildrenAfterAction, n as RemoveChildrenAction, S as SyncUpSelectionAction, j as InsertChildrenBeforeAction, B as BlockAnnotation, y as BlockAnnotationTypeEnum, d as RTEBlock, z as CustomStyleAnnotation, D as CustomClassAnnotation, o as CustomAttributeAnnotation, E as RTECodeBlock, s as stateEntityRenderingRegistry, N as NodeAnnotation, F as NodeAnnotationTypeEnum, G as RTEDecoratorNode, J as NodeTypeEnum, K as CommonAnnotation, m as AnnotationAction, L as ReplaceChildNodesAction, M as ModifyContentAction, O as SplitBlockWithNodeAction, P as HTML_VOID_TAGS, Q as BlockDeleteNodeContentStrategy, U as UpdateTextAction, W as RemoveChildrenStrategy, X as BOLD_FONT_WEIGHT_KEYWORD, Y as BOLD_FONT_WEIGHT, Z as createStyleMapFromElement, _ as RTE_TEXT_COLORS, $ as RTE_DEFAULT_TEXT_COLOR, a0 as ITALIC_FONT_STYLE, a1 as STRIKETHROUGH_TEXT_DECORATION, a2 as UNDERLINE_TEXT_DECORATION, R as RTEFilterStylesStrategyRegistry, a3 as TextStyleAnnotation, p as RTEFilterStylesStrategy, a4 as Predicate$1, a5 as HorizontalAlignmentAnnotation, a6 as CodeAnnotation, b as RTEDTOClassManager, a7 as LinkFilterStylesStrategy, a8 as CodeBlockFilterStylesStrategy, a9 as RTECodeBlockNode, aa as CodeBlockNodeFilterStylesStrategy } from './code-block-cd913077.js';
|
|
2
2
|
import { g as generateUUID } from './misc-9fdbcfbb.js';
|
|
3
|
-
import { i as isNonNullable } from './type-guard-
|
|
3
|
+
import { i as isNonNullable } from './type-guard-f6c9c89d.js';
|
|
4
4
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
5
|
-
import { d as domNodeSubjectFactory } from './dom-node-subject-observer-factory-
|
|
5
|
+
import { d as domNodeSubjectFactory } from './dom-node-subject-observer-factory-aca0116e.js';
|
|
6
6
|
import { c as VegaInternalUpdateRTECursorPosition, d as VegaInternalRichTextEditorFlushChanges } from './vega-internal-event-id-70bd893d.js';
|
|
7
|
-
import {
|
|
8
|
-
import { r as rgbToHex, i as isHTMLElement } from './ui-ba5a4758.js';
|
|
7
|
+
import { r as rgbToHex, i as isHTMLElement } from './ui-b7600a48.js';
|
|
9
8
|
import { c as cleanObject } from './object-0c277f57.js';
|
|
10
9
|
import { L as LogUtility } from './global-slimmer-registry-17c4efd4.js';
|
|
11
10
|
|
|
@@ -114,13 +113,9 @@ class RTEListItemBlock extends RTETextBlock {
|
|
|
114
113
|
/**
|
|
115
114
|
* @inheritDoc
|
|
116
115
|
*/
|
|
117
|
-
toHtml() {
|
|
118
|
-
const attrStr = super.generateAttributeString();
|
|
119
|
-
return [
|
|
120
|
-
`<li${attrStr}>`,
|
|
121
|
-
this.children.map((node) => node.toHtml()).join(''),
|
|
122
|
-
`</li>`,
|
|
123
|
-
].join('');
|
|
116
|
+
toHtml(options) {
|
|
117
|
+
const attrStr = super.generateAttributeString(options);
|
|
118
|
+
return [`<li${attrStr}>`, this.getChildrenHtml(options), `</li>`].join('');
|
|
124
119
|
}
|
|
125
120
|
/**
|
|
126
121
|
* @inheritDoc
|
|
@@ -403,12 +398,12 @@ class RTEListBlock extends RTEBlock {
|
|
|
403
398
|
/**
|
|
404
399
|
* @inheritDoc
|
|
405
400
|
*/
|
|
406
|
-
toHtml() {
|
|
401
|
+
toHtml(options) {
|
|
407
402
|
const BlockTag = this.getBlockTag();
|
|
408
|
-
const attrStr = super.generateAttributeString();
|
|
403
|
+
const attrStr = super.generateAttributeString(options);
|
|
409
404
|
return [
|
|
410
405
|
`<${BlockTag}${attrStr}>`,
|
|
411
|
-
this.children.map((block) => block.toHtml()).join(''),
|
|
406
|
+
this.children.map((block) => block.toHtml(options)).join(''),
|
|
412
407
|
`</${BlockTag}>`,
|
|
413
408
|
].join('');
|
|
414
409
|
}
|
|
@@ -602,7 +597,7 @@ class ElementToDtoStrategyProcessor {
|
|
|
602
597
|
const strategies = this.getElementToBlockStrategies();
|
|
603
598
|
const outputs = [];
|
|
604
599
|
for (let i = 0; i < elements.length; i++) {
|
|
605
|
-
if (this.isInvalidElement(elements[i]))
|
|
600
|
+
if (this.isInvalidElement(elements[i], options))
|
|
606
601
|
continue;
|
|
607
602
|
let canHandledCount = 0;
|
|
608
603
|
for (const strategy of strategies) {
|
|
@@ -629,14 +624,21 @@ class ElementToDtoStrategyProcessor {
|
|
|
629
624
|
return outputs;
|
|
630
625
|
}
|
|
631
626
|
/**
|
|
632
|
-
* Checks if the given element
|
|
627
|
+
* Checks if the given element should be skipped during processing.
|
|
633
628
|
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
629
|
+
* Comment nodes are always skipped. META and STYLE elements are skipped only
|
|
630
|
+
* in auto-match mode; in raw-HTML mode (autoMatchFormat: false) they are passed
|
|
631
|
+
* through so downstream strategies can decide how to handle them.
|
|
632
|
+
*
|
|
633
|
+
* @param {HTMLElement} element - The element to check.
|
|
634
|
+
* @param {VegaRTETransformOptions} options - Transform options.
|
|
635
|
+
* @returns {boolean} True when the element should be skipped.
|
|
636
636
|
*/
|
|
637
|
-
isInvalidElement(element) {
|
|
637
|
+
isInvalidElement(element, options) {
|
|
638
638
|
if (element.nodeType === Node.COMMENT_NODE)
|
|
639
639
|
return true;
|
|
640
|
+
if (options.autoMatchFormat === false)
|
|
641
|
+
return false;
|
|
640
642
|
return ['META', 'STYLE'].includes(element.nodeName);
|
|
641
643
|
}
|
|
642
644
|
/**
|
|
@@ -822,6 +824,7 @@ class ImageAnnotation extends NodeAnnotation {
|
|
|
822
824
|
}
|
|
823
825
|
}
|
|
824
826
|
}
|
|
827
|
+
ImageAnnotation.BASE_STYLES = { verticalAlign: 'bottom' };
|
|
825
828
|
|
|
826
829
|
/**
|
|
827
830
|
* Update the image node annotation map strategy.
|
|
@@ -914,9 +917,9 @@ class RTEImageNode extends RTEDecoratorNode {
|
|
|
914
917
|
/**
|
|
915
918
|
* @inheritDoc
|
|
916
919
|
*/
|
|
917
|
-
toHtml() {
|
|
920
|
+
toHtml(options) {
|
|
918
921
|
const imageAnnotation = this.getAnnotationByType(NodeAnnotationTypeEnum.IMAGE);
|
|
919
|
-
const attrStr = super.generateAttributeString(...[
|
|
922
|
+
const attrStr = super.generateAttributeString(options, ...[
|
|
920
923
|
imageAnnotation && imageAnnotation.alt ? `alt="${imageAnnotation.alt}"` : null,
|
|
921
924
|
`src="${this.url}"`,
|
|
922
925
|
imageAnnotation && imageAnnotation.size ? `data-size="${imageAnnotation.size}"` : null,
|
|
@@ -1136,9 +1139,9 @@ class RTEImageBlock extends RTEBlock {
|
|
|
1136
1139
|
/**
|
|
1137
1140
|
* @inheritDoc
|
|
1138
1141
|
*/
|
|
1139
|
-
toHtml() {
|
|
1140
|
-
const attrStr = super.generateAttributeString();
|
|
1141
|
-
const children = this.children.map((node) => node.toHtml()).join('');
|
|
1142
|
+
toHtml(options) {
|
|
1143
|
+
const attrStr = super.generateAttributeString(options);
|
|
1144
|
+
const children = this.children.map((node) => node.toHtml(options)).join('');
|
|
1142
1145
|
return super.shouldRenderAsInternalWrapper()
|
|
1143
1146
|
? children
|
|
1144
1147
|
: [`<div${attrStr}>`, children, `</div>`].join('');
|
|
@@ -1230,23 +1233,26 @@ class RTEHtmlBlock extends RTEBlock {
|
|
|
1230
1233
|
* @inheritDoc
|
|
1231
1234
|
*/
|
|
1232
1235
|
isNotEmpty() {
|
|
1233
|
-
|
|
1236
|
+
// Any RTEHtmlBlock — whether void (hr, br), childless (canvas, iframe),
|
|
1237
|
+
// or with children — represents real user content. Only the default empty
|
|
1238
|
+
// text paragraph should make the editor report as empty.
|
|
1239
|
+
return true;
|
|
1234
1240
|
}
|
|
1235
1241
|
/**
|
|
1236
1242
|
* @inheritDoc
|
|
1237
1243
|
*/
|
|
1238
|
-
toHtml() {
|
|
1244
|
+
toHtml(options) {
|
|
1239
1245
|
const BlockTag = this.htmlTag;
|
|
1240
|
-
const attrStr = super.generateAttributeString();
|
|
1246
|
+
const attrStr = super.generateAttributeString(options);
|
|
1241
1247
|
// Handle void/self-closing tags (hr, input, col, etc.)
|
|
1242
1248
|
// Uses HTML5 syntax without self-closing slash for consistency with img and br tags
|
|
1243
|
-
if (
|
|
1249
|
+
if (HTML_VOID_TAGS.has(this.htmlTag)) {
|
|
1244
1250
|
return `<${BlockTag}${attrStr}>`;
|
|
1245
1251
|
}
|
|
1246
1252
|
// Handle normal tags with children
|
|
1247
1253
|
return [
|
|
1248
1254
|
`<${BlockTag}${attrStr}>`,
|
|
1249
|
-
this.children.map((block) => block.toHtml()).join(''),
|
|
1255
|
+
this.children.map((block) => block.toHtml(options)).join(''),
|
|
1250
1256
|
`</${BlockTag}>`,
|
|
1251
1257
|
].join('');
|
|
1252
1258
|
}
|
|
@@ -1257,16 +1263,6 @@ class RTEHtmlBlock extends RTEBlock {
|
|
|
1257
1263
|
return Object.assign(Object.assign({}, super.toJSON()), { id: this.id, type: this.type, htmlTag: this.htmlTag, children: this.children.map((child) => child.toJSON()) });
|
|
1258
1264
|
}
|
|
1259
1265
|
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Void/self-closing tags that don't have closing tags and don't contain children.
|
|
1262
|
-
* These tags should be rendered as <tag> or <tag/> instead of <tag></tag>.
|
|
1263
|
-
*
|
|
1264
|
-
* Based on canHandleTags from html-block-strategy.ts, the following are void tags:
|
|
1265
|
-
* - HR: horizontal rule
|
|
1266
|
-
* - INPUT: form input
|
|
1267
|
-
* - COL: table column
|
|
1268
|
-
*/
|
|
1269
|
-
RTEHtmlBlock.VOID_TAGS = new Set(['hr', 'input', 'col']);
|
|
1270
1266
|
|
|
1271
1267
|
/**
|
|
1272
1268
|
* Merge the two blocks node into first block if the two blocks nodes type is same(text node or image node)
|
|
@@ -1923,32 +1919,9 @@ class CustomStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
|
1923
1919
|
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
1924
1920
|
*/
|
|
1925
1921
|
handle(element) {
|
|
1926
|
-
const styles =
|
|
1922
|
+
const styles = createStyleMapFromElement(element);
|
|
1927
1923
|
return Object.keys(styles).length > 0 ? { customStyle: styles } : {};
|
|
1928
1924
|
}
|
|
1929
|
-
/**
|
|
1930
|
-
* Obtain and format the style of element.
|
|
1931
|
-
*
|
|
1932
|
-
* @param {HTMLElement} element - current element.
|
|
1933
|
-
* @returns {AnnotationStyle} - Record<string, string>.
|
|
1934
|
-
*/
|
|
1935
|
-
generateCustomStyleAnnotations(element) {
|
|
1936
|
-
const customStyle = element.getAttribute('style');
|
|
1937
|
-
if (!customStyle)
|
|
1938
|
-
return {};
|
|
1939
|
-
const styleValue = customStyle.split(';').filter(Boolean);
|
|
1940
|
-
return styleValue
|
|
1941
|
-
.filter((key) => key !== ' ')
|
|
1942
|
-
.map((key) => {
|
|
1943
|
-
// to remove redundant quote pairs if needed, for example: ['fontFamily: "Roboto Mono"'] will be updated to ['fontFamily: Roboto Mono']
|
|
1944
|
-
const styleObject = key.replace(/(['"])(.*?)\1/g, '$2').split(':');
|
|
1945
|
-
const styleKey = dashCaseToCamel(styleObject[0].trim());
|
|
1946
|
-
return {
|
|
1947
|
-
[styleKey]: styleObject[1].trim().replace(';', ''),
|
|
1948
|
-
};
|
|
1949
|
-
})
|
|
1950
|
-
.reduce((current, obj) => (Object.assign(Object.assign({}, current), obj)), {});
|
|
1951
|
-
}
|
|
1952
1925
|
}
|
|
1953
1926
|
|
|
1954
1927
|
/** Handle indent annotation */
|
|
@@ -2173,157 +2146,6 @@ class ItalicAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
|
2173
2146
|
}
|
|
2174
2147
|
}
|
|
2175
2148
|
|
|
2176
|
-
/** Handle link annotation */
|
|
2177
|
-
class LinkAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2178
|
-
constructor() {
|
|
2179
|
-
super(...arguments);
|
|
2180
|
-
this.handlers = [
|
|
2181
|
-
new CustomAttributeAnnotationHandler(),
|
|
2182
|
-
new CustomClassAnnotationHandler(),
|
|
2183
|
-
new CustomStyleAnnotationHandler(),
|
|
2184
|
-
];
|
|
2185
|
-
}
|
|
2186
|
-
/**
|
|
2187
|
-
* Can be handle.
|
|
2188
|
-
*
|
|
2189
|
-
* @param {RTEDtoClassPrototype} targetDto - Target DTO.
|
|
2190
|
-
* @returns {boolean} - .
|
|
2191
|
-
*/
|
|
2192
|
-
canHandle(targetDto) {
|
|
2193
|
-
return targetDto.name === 'RTETextNode';
|
|
2194
|
-
}
|
|
2195
|
-
/**
|
|
2196
|
-
* Handle annotation.
|
|
2197
|
-
*
|
|
2198
|
-
* @param {HTMLElement} element - Current elements.
|
|
2199
|
-
* @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
|
|
2200
|
-
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
2201
|
-
*/
|
|
2202
|
-
handle(element, parentAnnotations = {}) {
|
|
2203
|
-
if (parentAnnotations.link)
|
|
2204
|
-
return { link: parentAnnotations.link };
|
|
2205
|
-
return element.tagName === 'A' ? { link: this.generateLinkAnnotations(element) } : {};
|
|
2206
|
-
}
|
|
2207
|
-
/**
|
|
2208
|
-
* Generate link annotations.
|
|
2209
|
-
*
|
|
2210
|
-
* @param {HTMLElement} element - Current elements.
|
|
2211
|
-
* @returns {VegaRTELink} - link annotations.
|
|
2212
|
-
*/
|
|
2213
|
-
generateLinkAnnotations(element) {
|
|
2214
|
-
const annotations = {
|
|
2215
|
-
href: element.getAttribute('href') || '',
|
|
2216
|
-
groupKey: generateUUID(),
|
|
2217
|
-
};
|
|
2218
|
-
this.handlers.forEach((handler) => {
|
|
2219
|
-
Object.assign(annotations, handler.handle(element));
|
|
2220
|
-
});
|
|
2221
|
-
return annotations;
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
/** Handle strike through annotation */
|
|
2226
|
-
class StrikeThroughAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2227
|
-
/**
|
|
2228
|
-
* @inheritDoc
|
|
2229
|
-
*/
|
|
2230
|
-
canHandle(targetDto) {
|
|
2231
|
-
return targetDto.name === 'RTETextNode';
|
|
2232
|
-
}
|
|
2233
|
-
/**
|
|
2234
|
-
* Handle annotation.
|
|
2235
|
-
*
|
|
2236
|
-
* @param {HTMLElement} element - Current elements.
|
|
2237
|
-
* @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
|
|
2238
|
-
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
2239
|
-
*/
|
|
2240
|
-
handle(element, parentAnnotations = {}) {
|
|
2241
|
-
return this.isStrikethrough(element) || parentAnnotations.strikethrough
|
|
2242
|
-
? { strikethrough: true }
|
|
2243
|
-
: {};
|
|
2244
|
-
}
|
|
2245
|
-
/**
|
|
2246
|
-
* Is strikethrough element.
|
|
2247
|
-
*
|
|
2248
|
-
* @param {HTMLElement} element - current element.
|
|
2249
|
-
* @returns {boolean} - boolean.
|
|
2250
|
-
*/
|
|
2251
|
-
isStrikethrough(element) {
|
|
2252
|
-
return (element.style.textDecoration.includes(STRIKETHROUGH_TEXT_DECORATION) ||
|
|
2253
|
-
element.nodeName === 'S' ||
|
|
2254
|
-
element.nodeName === 'DEL' ||
|
|
2255
|
-
element.classList.contains('v-rte--strikethrough'));
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
|
|
2259
|
-
/** Handle underline annotation */
|
|
2260
|
-
class UnderlineAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2261
|
-
/**
|
|
2262
|
-
* @inheritDoc
|
|
2263
|
-
*/
|
|
2264
|
-
canHandle(targetDto) {
|
|
2265
|
-
return targetDto.name === 'RTETextNode';
|
|
2266
|
-
}
|
|
2267
|
-
/**
|
|
2268
|
-
* Handle annotation.
|
|
2269
|
-
*
|
|
2270
|
-
* @param {HTMLElement} element - Current elements.
|
|
2271
|
-
* @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
|
|
2272
|
-
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
2273
|
-
*/
|
|
2274
|
-
handle(element, parentAnnotations = {}) {
|
|
2275
|
-
return this.isUnderline(element) || parentAnnotations.underline ? { underline: true } : {};
|
|
2276
|
-
}
|
|
2277
|
-
/**
|
|
2278
|
-
* Is underline element.
|
|
2279
|
-
*
|
|
2280
|
-
* @param {HTMLElement} element - current element.
|
|
2281
|
-
* @returns {boolean} - boolean.
|
|
2282
|
-
*/
|
|
2283
|
-
isUnderline(element) {
|
|
2284
|
-
return (element.style.textDecoration.includes(UNDERLINE_TEXT_DECORATION) ||
|
|
2285
|
-
element.nodeName === 'U' ||
|
|
2286
|
-
element.nodeName === 'INS' ||
|
|
2287
|
-
element.classList.contains('v-rte--underline'));
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
/**
|
|
2292
|
-
* Registry for managing filter styles strategies keyed by DTO class name.
|
|
2293
|
-
*
|
|
2294
|
-
* Provides common `register` / `getStrategies` primitives that both output-
|
|
2295
|
-
* filtering strategies (DTO → HTML) and annotation-parsing strategies
|
|
2296
|
-
* (HTML → DTO) build upon.
|
|
2297
|
-
*
|
|
2298
|
-
* TODO: Currently, the filter styles strategies are applied for all rich text editors. We need to apply the strategies with a specific rich text editor instance when we have multiple rich text editors in the future.
|
|
2299
|
-
*/
|
|
2300
|
-
class RTEFilterStylesStrategyRegistry {
|
|
2301
|
-
/**
|
|
2302
|
-
* Registers a filter styles strategy for a specific DTO class name.
|
|
2303
|
-
* Duplicate strategy instances are ignored.
|
|
2304
|
-
*
|
|
2305
|
-
* @param {string} dtoClassName - The DTO class name (e.g. `RTEListBlock.name`).
|
|
2306
|
-
* @param {RTEFilterStylesStrategy} strategy - The strategy instance to register.
|
|
2307
|
-
*/
|
|
2308
|
-
static register(dtoClassName, strategy) {
|
|
2309
|
-
var _a;
|
|
2310
|
-
const set = (_a = this.registry.get(dtoClassName)) !== null && _a !== void 0 ? _a : new Set();
|
|
2311
|
-
set.add(strategy);
|
|
2312
|
-
this.registry.set(dtoClassName, set);
|
|
2313
|
-
}
|
|
2314
|
-
/**
|
|
2315
|
-
* Retrieves all strategies registered for a given DTO class name.
|
|
2316
|
-
*
|
|
2317
|
-
* @param {string} dtoClassName - The DTO class name to look up.
|
|
2318
|
-
* @returns {RTEFilterStylesStrategy[]} Registered strategies (empty array if none).
|
|
2319
|
-
*/
|
|
2320
|
-
static getStrategies(dtoClassName) {
|
|
2321
|
-
var _a;
|
|
2322
|
-
return Array.from((_a = this.registry.get(dtoClassName)) !== null && _a !== void 0 ? _a : []);
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
RTEFilterStylesStrategyRegistry.registry = new Map();
|
|
2326
|
-
|
|
2327
2149
|
/** Handle text style annotation */
|
|
2328
2150
|
class TextStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2329
2151
|
/**
|
|
@@ -2437,7 +2259,8 @@ class TextStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
|
2437
2259
|
*/
|
|
2438
2260
|
getElementTypeByClassName(element) {
|
|
2439
2261
|
if (element.className) {
|
|
2440
|
-
|
|
2262
|
+
// Match class name with pattern "v-rte--text-style-{textStyle}" or "v-rte-{textStyle}".
|
|
2263
|
+
const match = /\bv-rte-(?:-text-style-)?(title|subtitle|heading-1|heading-2|heading-3|heading-4|heading-5|heading-6|paragraph)\b/.exec(element.className);
|
|
2441
2264
|
if (match) {
|
|
2442
2265
|
return match[1];
|
|
2443
2266
|
}
|
|
@@ -2446,131 +2269,311 @@ class TextStyleAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
|
2446
2269
|
}
|
|
2447
2270
|
}
|
|
2448
2271
|
|
|
2449
|
-
/**
|
|
2450
|
-
class
|
|
2272
|
+
/**
|
|
2273
|
+
* Predicate class provides static methods to check specific conditions on HTML elements.
|
|
2274
|
+
*/
|
|
2275
|
+
class Predicate {
|
|
2451
2276
|
/**
|
|
2452
|
-
*
|
|
2277
|
+
* Checks if the given element is a title or subtitle.
|
|
2278
|
+
*
|
|
2279
|
+
* @param {HTMLElement} element The element to check.
|
|
2280
|
+
* @returns {boolean} True if the element is a title or subtitle, false otherwise.
|
|
2281
|
+
*/
|
|
2282
|
+
static isTitleOrSubtitle(element) {
|
|
2283
|
+
if (element.nodeName === 'DIV') {
|
|
2284
|
+
const textBlockType = Predicate.textStyleHandler['getTextStyle'](element);
|
|
2285
|
+
return textBlockType === 'title' || textBlockType === 'subtitle';
|
|
2286
|
+
}
|
|
2287
|
+
return false;
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Check if the given element is a link element (anchor tag).
|
|
2291
|
+
*
|
|
2292
|
+
* @param {HTMLElement} element The element to check.
|
|
2293
|
+
* @returns {boolean} True if the element is a link element, false otherwise.
|
|
2294
|
+
*/
|
|
2295
|
+
static isLinkElement(element) {
|
|
2296
|
+
return element.nodeName === 'A';
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
Predicate.textStyleHandler = new TextStyleAnnotationHandler();
|
|
2300
|
+
|
|
2301
|
+
/** Handle link annotation */
|
|
2302
|
+
class LinkAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2303
|
+
constructor() {
|
|
2304
|
+
super(...arguments);
|
|
2305
|
+
this.handlers = [
|
|
2306
|
+
new CustomAttributeAnnotationHandler(),
|
|
2307
|
+
new CustomClassAnnotationHandler(),
|
|
2308
|
+
new CustomStyleAnnotationHandler(),
|
|
2309
|
+
];
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Can be handle.
|
|
2313
|
+
*
|
|
2314
|
+
* @param {RTEDtoClassPrototype} targetDto - Target DTO.
|
|
2315
|
+
* @returns {boolean} - .
|
|
2453
2316
|
*/
|
|
2454
2317
|
canHandle(targetDto) {
|
|
2455
|
-
return targetDto.name === '
|
|
2318
|
+
return targetDto.name === 'RTETextNode';
|
|
2456
2319
|
}
|
|
2457
2320
|
/**
|
|
2458
2321
|
* Handle annotation.
|
|
2459
2322
|
*
|
|
2460
2323
|
* @param {HTMLElement} element - Current elements.
|
|
2461
|
-
* @
|
|
2324
|
+
* @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
|
|
2325
|
+
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
2462
2326
|
*/
|
|
2463
|
-
handle(element) {
|
|
2464
|
-
|
|
2465
|
-
|
|
2327
|
+
handle(element, parentAnnotations = {}) {
|
|
2328
|
+
if (parentAnnotations.link)
|
|
2329
|
+
return { link: parentAnnotations.link };
|
|
2330
|
+
return Predicate.isLinkElement(element) ? { link: this.generateLinkAnnotations(element) } : {};
|
|
2466
2331
|
}
|
|
2467
2332
|
/**
|
|
2468
|
-
*
|
|
2333
|
+
* Generate link annotations.
|
|
2469
2334
|
*
|
|
2470
|
-
* @param {HTMLElement} element -
|
|
2471
|
-
* @returns {
|
|
2335
|
+
* @param {HTMLElement} element - Current elements.
|
|
2336
|
+
* @returns {VegaRTELink} - link annotations.
|
|
2472
2337
|
*/
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2338
|
+
generateLinkAnnotations(element) {
|
|
2339
|
+
const annotations = {
|
|
2340
|
+
href: element.getAttribute('href') || '',
|
|
2341
|
+
groupKey: generateUUID(),
|
|
2342
|
+
};
|
|
2343
|
+
this.handlers.forEach((handler) => {
|
|
2344
|
+
Object.assign(annotations, handler.handle(element));
|
|
2345
|
+
});
|
|
2346
|
+
return annotations;
|
|
2478
2347
|
}
|
|
2479
2348
|
}
|
|
2480
2349
|
|
|
2481
|
-
/** Handle
|
|
2482
|
-
class
|
|
2350
|
+
/** Handle strike through annotation */
|
|
2351
|
+
class StrikeThroughAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2483
2352
|
/**
|
|
2484
2353
|
* @inheritDoc
|
|
2485
2354
|
*/
|
|
2486
2355
|
canHandle(targetDto) {
|
|
2487
|
-
return targetDto.name === '
|
|
2356
|
+
return targetDto.name === 'RTETextNode';
|
|
2488
2357
|
}
|
|
2489
2358
|
/**
|
|
2490
2359
|
* Handle annotation.
|
|
2491
2360
|
*
|
|
2492
2361
|
* @param {HTMLElement} element - Current elements.
|
|
2493
|
-
* @
|
|
2362
|
+
* @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
|
|
2363
|
+
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
2494
2364
|
*/
|
|
2495
|
-
handle(element) {
|
|
2496
|
-
return
|
|
2365
|
+
handle(element, parentAnnotations = {}) {
|
|
2366
|
+
return this.isStrikethrough(element) || parentAnnotations.strikethrough
|
|
2367
|
+
? { strikethrough: true }
|
|
2368
|
+
: {};
|
|
2369
|
+
}
|
|
2370
|
+
/**
|
|
2371
|
+
* Is strikethrough element.
|
|
2372
|
+
*
|
|
2373
|
+
* @param {HTMLElement} element - current element.
|
|
2374
|
+
* @returns {boolean} - boolean.
|
|
2375
|
+
*/
|
|
2376
|
+
isStrikethrough(element) {
|
|
2377
|
+
return (element.style.textDecoration.includes(STRIKETHROUGH_TEXT_DECORATION) ||
|
|
2378
|
+
element.nodeName === 'S' ||
|
|
2379
|
+
element.nodeName === 'DEL' ||
|
|
2380
|
+
element.classList.contains('v-rte--strikethrough'));
|
|
2497
2381
|
}
|
|
2498
2382
|
}
|
|
2499
2383
|
|
|
2500
|
-
/**
|
|
2501
|
-
|
|
2502
|
-
*/
|
|
2503
|
-
class InlineHtmlAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2504
|
-
constructor() {
|
|
2505
|
-
super(...arguments);
|
|
2506
|
-
this.customAttributeHandler = new CustomAttributeAnnotationHandler();
|
|
2507
|
-
this.customStyleAnnotationHandler = new CustomStyleAnnotationHandler();
|
|
2508
|
-
this.customClassAnnotationHandler = new CustomClassAnnotationHandler();
|
|
2509
|
-
}
|
|
2384
|
+
/** Handle underline annotation */
|
|
2385
|
+
class UnderlineAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2510
2386
|
/**
|
|
2511
2387
|
* @inheritDoc
|
|
2512
2388
|
*/
|
|
2513
|
-
canHandle(targetDto
|
|
2514
|
-
return targetDto.name === 'RTETextNode'
|
|
2389
|
+
canHandle(targetDto) {
|
|
2390
|
+
return targetDto.name === 'RTETextNode';
|
|
2391
|
+
}
|
|
2392
|
+
/**
|
|
2393
|
+
* Handle annotation.
|
|
2394
|
+
*
|
|
2395
|
+
* @param {HTMLElement} element - Current elements.
|
|
2396
|
+
* @param {VegaRTETextAnnotations} parentAnnotations - Parent annotations.
|
|
2397
|
+
* @returns {VegaRTETextAnnotations} - Annotation.
|
|
2398
|
+
*/
|
|
2399
|
+
handle(element, parentAnnotations = {}) {
|
|
2400
|
+
return this.isUnderline(element) || parentAnnotations.underline ? { underline: true } : {};
|
|
2401
|
+
}
|
|
2402
|
+
/**
|
|
2403
|
+
* Is underline element.
|
|
2404
|
+
*
|
|
2405
|
+
* @param {HTMLElement} element - current element.
|
|
2406
|
+
* @returns {boolean} - boolean.
|
|
2407
|
+
*/
|
|
2408
|
+
isUnderline(element) {
|
|
2409
|
+
return (element.style.textDecoration.includes(UNDERLINE_TEXT_DECORATION) ||
|
|
2410
|
+
element.nodeName === 'U' ||
|
|
2411
|
+
element.nodeName === 'INS' ||
|
|
2412
|
+
element.classList.contains('v-rte--underline'));
|
|
2515
2413
|
}
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/** Handle image size annotation */
|
|
2417
|
+
class ImageSizeAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2516
2418
|
/**
|
|
2517
2419
|
* @inheritDoc
|
|
2518
2420
|
*/
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
if (canHandle) {
|
|
2522
|
-
const inlineHtml = this.generateInlineHtmlAnnotation(element, Object.assign({}, parentAnnotations));
|
|
2523
|
-
if (inlineHtml) {
|
|
2524
|
-
return { inlineHtml: inlineHtml };
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
return {};
|
|
2421
|
+
canHandle(targetDto) {
|
|
2422
|
+
return targetDto.name === 'RTEImageNode';
|
|
2528
2423
|
}
|
|
2529
2424
|
/**
|
|
2530
|
-
*
|
|
2425
|
+
* Handle annotation.
|
|
2531
2426
|
*
|
|
2532
|
-
* @param {HTMLElement}
|
|
2533
|
-
* @
|
|
2534
|
-
* @returns {Nullable<VegaInlineHtmlSchema>} - Inline html annotation.
|
|
2427
|
+
* @param {HTMLElement} element - Current elements.
|
|
2428
|
+
* @returns {VegaRTEImageAnnotations} - Annotation.
|
|
2535
2429
|
*/
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
else {
|
|
2550
|
-
let lastChild = inlineHtml;
|
|
2551
|
-
while (lastChild.child &&
|
|
2552
|
-
child.parentNode &&
|
|
2553
|
-
lastChild.child.htmlTag === child.parentNode.nodeName.toLowerCase()) {
|
|
2554
|
-
lastChild = lastChild.child;
|
|
2555
|
-
}
|
|
2556
|
-
lastChild.child = childInlineHtmlNode;
|
|
2557
|
-
}
|
|
2430
|
+
handle(element) {
|
|
2431
|
+
const size = this.getImageSize(element);
|
|
2432
|
+
return size ? { size: size } : {};
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Determine the image display size based on the width of the current element.
|
|
2436
|
+
*
|
|
2437
|
+
* @param {HTMLElement} element - current element.
|
|
2438
|
+
* @returns {Nullable<VegaRichTextImageEditorSizeType>} -Image size, default 'md'.
|
|
2439
|
+
*/
|
|
2440
|
+
getImageSize(element) {
|
|
2441
|
+
if (element.getAttribute('data-size')) {
|
|
2442
|
+
return element.getAttribute('data-size');
|
|
2558
2443
|
}
|
|
2559
|
-
return
|
|
2444
|
+
return null;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
/** Handle image alt annotation */
|
|
2449
|
+
class ImageAltAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2450
|
+
/**
|
|
2451
|
+
* @inheritDoc
|
|
2452
|
+
*/
|
|
2453
|
+
canHandle(targetDto) {
|
|
2454
|
+
return targetDto.name === 'RTEImageNode';
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Handle annotation.
|
|
2458
|
+
*
|
|
2459
|
+
* @param {HTMLElement} element - Current elements.
|
|
2460
|
+
* @returns {VegaRTEImageAnnotations} - Annotation.
|
|
2461
|
+
*/
|
|
2462
|
+
handle(element) {
|
|
2463
|
+
return element.hasAttribute('alt') ? { alt: element.getAttribute('alt') } : {};
|
|
2560
2464
|
}
|
|
2561
2465
|
}
|
|
2562
|
-
|
|
2563
|
-
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* Tags whose direct children are always phrasing (inline) content (P, H1-H6, LI).
|
|
2469
|
+
*
|
|
2470
|
+
* This is spec knowledge from the HTML Living Standard — these grouping-content
|
|
2471
|
+
* elements have a phrasing-content content model and cannot contain block-level
|
|
2472
|
+
* descendants. It cannot be derived from the strategy registry and must be
|
|
2473
|
+
* maintained alongside the HTML spec.
|
|
2474
|
+
*
|
|
2475
|
+
* @see https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
|
2476
|
+
*/
|
|
2477
|
+
const BLOCK_TEXT_CONTAINER_TAGS = new Set([
|
|
2478
|
+
'P',
|
|
2479
|
+
'H1',
|
|
2480
|
+
'H2',
|
|
2481
|
+
'H3',
|
|
2482
|
+
'H4',
|
|
2483
|
+
'H5',
|
|
2484
|
+
'H6',
|
|
2485
|
+
'LI',
|
|
2486
|
+
]);
|
|
2487
|
+
/**
|
|
2488
|
+
* Tags with dedicated element-to-DTO block strategies
|
|
2489
|
+
* (P, H1-H6, LI, UL, OL, IMG, CODE).
|
|
2490
|
+
*
|
|
2491
|
+
* HtmlBlockStrategy skips these to avoid double-processing or overriding their
|
|
2492
|
+
* specialized block semantics.
|
|
2493
|
+
*
|
|
2494
|
+
* Why hard-coded: strategies use heterogeneous matching (`tagName ===`,
|
|
2495
|
+
* `matchTextBlockType` via font-size/class, etc.) so there is no single
|
|
2496
|
+
* declarative contract to derive this set from. It must be kept in sync with
|
|
2497
|
+
* the strategies registered in `dto/setup.ts`.
|
|
2498
|
+
*
|
|
2499
|
+
* Intentionally independent of {@link BLOCK_TEXT_CONTAINER_TAGS} — the two
|
|
2500
|
+
* sets encode different concepts (app architecture vs. HTML spec) and must
|
|
2501
|
+
* be maintained separately.
|
|
2502
|
+
*/
|
|
2503
|
+
const DEDICATED_STRATEGY_TAGS = new Set([
|
|
2504
|
+
'P',
|
|
2505
|
+
'H1',
|
|
2506
|
+
'H2',
|
|
2507
|
+
'H3',
|
|
2508
|
+
'H4',
|
|
2509
|
+
'H5',
|
|
2510
|
+
'H6',
|
|
2511
|
+
'LI',
|
|
2512
|
+
'UL',
|
|
2513
|
+
'OL',
|
|
2514
|
+
'IMG',
|
|
2515
|
+
'CODE',
|
|
2516
|
+
]);
|
|
2517
|
+
/**
|
|
2518
|
+
* Tags that are always treated as phrasing (inline) content, even when they
|
|
2519
|
+
* also appear in {@link DEDICATED_STRATEGY_TAGS} (CODE).
|
|
2520
|
+
* A tag in this set overrides the dedicated-strategy skip in HtmlBlockStrategy.
|
|
2521
|
+
*
|
|
2522
|
+
* Mix of HTML5 spec phrasing-content elements (BR, CODE, A) and
|
|
2523
|
+
* RTE-internal custom elements (VEGA-RICH-TEXT-LINK-EDITOR).
|
|
2524
|
+
*/
|
|
2525
|
+
const ALWAYS_INLINE_TAGS = new Set(['BR', 'VEGA-RICH-TEXT-LINK-EDITOR', 'CODE', 'A']);
|
|
2526
|
+
/**
|
|
2527
|
+
* Tags whose content model requires each child to be a distinct block-level
|
|
2528
|
+
* element (table model and definition list).
|
|
2529
|
+
*
|
|
2530
|
+
* TABLE expects CAPTION/THEAD/TBODY/TFOOT/TR; TR expects TH/TD;
|
|
2531
|
+
* THEAD/TBODY/TFOOT expect TR; DL expects DT/DD.
|
|
2532
|
+
*
|
|
2533
|
+
* Used by HtmlBlockStrategy to prevent text-only children (e.g. CAPTION,
|
|
2534
|
+
* TH, TD) from being treated as inline — they must become html-blocks so
|
|
2535
|
+
* the table structure round-trips correctly.
|
|
2536
|
+
*
|
|
2537
|
+
* Note: COLGROUP is intentionally excluded. Its only permitted child is the
|
|
2538
|
+
* void element COL, which can never produce text-node children, so the
|
|
2539
|
+
* text-only heuristic in HtmlBlockStrategy can never fire for a COLGROUP
|
|
2540
|
+
* parent.
|
|
2541
|
+
*
|
|
2542
|
+
* @see https://html.spec.whatwg.org/multipage/tables.html#the-table-element
|
|
2543
|
+
* @see https://html.spec.whatwg.org/multipage/grouping-content.html#the-dl-element
|
|
2544
|
+
*/
|
|
2545
|
+
const STRUCTURED_CONTAINER_TAGS = new Set([
|
|
2546
|
+
'TABLE',
|
|
2547
|
+
'THEAD',
|
|
2548
|
+
'TBODY',
|
|
2549
|
+
'TFOOT',
|
|
2550
|
+
'TR',
|
|
2551
|
+
'DL',
|
|
2552
|
+
]);
|
|
2553
|
+
/**
|
|
2554
|
+
* Formatting phrasing-content elements that CAN remain inline even when empty.
|
|
2555
|
+
*
|
|
2556
|
+
* Any element NOT in this set (DIV, SECTION, ARTICLE, custom elements, etc.)
|
|
2557
|
+
* is treated as a block separator. Phrasing content is a closed, finite set
|
|
2558
|
+
* per the HTML Living Standard, making an allowlist safer than blocklisting
|
|
2559
|
+
* block containers (which is open-ended — custom elements default to block).
|
|
2560
|
+
*
|
|
2561
|
+
* Intentionally excludes:
|
|
2562
|
+
* - BR, CODE, A, VEGA-RICH-TEXT-LINK-EDITOR → handled by {@link ALWAYS_INLINE_TAGS}
|
|
2563
|
+
* - P, H1-H6, LI, UL, OL, IMG → handled by {@link DEDICATED_STRATEGY_TAGS}
|
|
2564
|
+
* - VIDEO, AUDIO, EMBED → embedded content that carries media even when empty;
|
|
2565
|
+
* must be treated as block-level, not as inline formatting artifacts
|
|
2566
|
+
*
|
|
2567
|
+
* @see https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
|
2568
|
+
*/
|
|
2569
|
+
const PHRASING_CONTENT_TAGS = new Set([
|
|
2564
2570
|
'ABBR',
|
|
2565
|
-
'AUDIO',
|
|
2566
2571
|
'B',
|
|
2567
2572
|
'BDI',
|
|
2568
2573
|
'BDO',
|
|
2569
2574
|
'CITE',
|
|
2570
|
-
'CODE',
|
|
2571
2575
|
'DEL',
|
|
2572
2576
|
'DFN',
|
|
2573
|
-
'EMBED',
|
|
2574
2577
|
'EM',
|
|
2575
2578
|
'I',
|
|
2576
2579
|
'INS',
|
|
@@ -2581,6 +2584,7 @@ InlineHtmlAnnotationHandler.canHandleTags = [
|
|
|
2581
2584
|
'PROGRESS',
|
|
2582
2585
|
'Q',
|
|
2583
2586
|
'S',
|
|
2587
|
+
'SAMP',
|
|
2584
2588
|
'SMALL',
|
|
2585
2589
|
'SPAN',
|
|
2586
2590
|
'STRONG',
|
|
@@ -2589,8 +2593,89 @@ InlineHtmlAnnotationHandler.canHandleTags = [
|
|
|
2589
2593
|
'TIME',
|
|
2590
2594
|
'U',
|
|
2591
2595
|
'VAR',
|
|
2592
|
-
|
|
2593
|
-
|
|
2596
|
+
]);
|
|
2597
|
+
/**
|
|
2598
|
+
* Returns true when the element is a direct child of a block text container
|
|
2599
|
+
* (P, H1-H6, LI), meaning it must be treated as phrasing content regardless
|
|
2600
|
+
* of its own DOM structure.
|
|
2601
|
+
*
|
|
2602
|
+
* @param {HTMLElement} element - Element to test.
|
|
2603
|
+
* @returns {boolean} True if the element is inside a block text container.
|
|
2604
|
+
*/
|
|
2605
|
+
function isInBlockTextContext(element) {
|
|
2606
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2607
|
+
return BLOCK_TEXT_CONTAINER_TAGS.has(element.parentElement.nodeName);
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
/**
|
|
2611
|
+
* Handle inline html annotation
|
|
2612
|
+
*/
|
|
2613
|
+
class InlineHtmlAnnotationHandler extends AnnotationGeneratorStrategyAbstract {
|
|
2614
|
+
constructor() {
|
|
2615
|
+
super(...arguments);
|
|
2616
|
+
this.customAttributeHandler = new CustomAttributeAnnotationHandler();
|
|
2617
|
+
this.customStyleAnnotationHandler = new CustomStyleAnnotationHandler();
|
|
2618
|
+
this.customClassAnnotationHandler = new CustomClassAnnotationHandler();
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* @inheritDoc
|
|
2622
|
+
*/
|
|
2623
|
+
canHandle(targetDto, options) {
|
|
2624
|
+
return targetDto.name === 'RTETextNode' && options.autoMatchFormat === false;
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* @inheritDoc
|
|
2628
|
+
*/
|
|
2629
|
+
handle(element, parentAnnotations) {
|
|
2630
|
+
// Skip block-level dedicated tags (P, H1-H6, LI, UL, OL, IMG).
|
|
2631
|
+
// Tags in ALWAYS_INLINE_TAGS (CODE, A) are exempt and still produce inlineHtml annotations.
|
|
2632
|
+
if (DEDICATED_STRATEGY_TAGS.has(element.nodeName) && !ALWAYS_INLINE_TAGS.has(element.nodeName)) {
|
|
2633
|
+
return {};
|
|
2634
|
+
}
|
|
2635
|
+
const inlineHtml = this.generateInlineHtmlAnnotation(element, Object.assign({}, parentAnnotations));
|
|
2636
|
+
if (inlineHtml) {
|
|
2637
|
+
return { inlineHtml: inlineHtml };
|
|
2638
|
+
}
|
|
2639
|
+
return {};
|
|
2640
|
+
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Generate inline html annotation.
|
|
2643
|
+
*
|
|
2644
|
+
* @param {HTMLElement} child - Current element.
|
|
2645
|
+
* @param {VegaRTETextAnnotations} annotations - Current annotations.
|
|
2646
|
+
* @returns {Nullable<VegaInlineHtmlSchema>} - Inline html annotation.
|
|
2647
|
+
*/
|
|
2648
|
+
generateInlineHtmlAnnotation(child, annotations) {
|
|
2649
|
+
let { inlineHtml } = annotations;
|
|
2650
|
+
const hasElementChildren = Array.from(child.childNodes).some((c) => c.nodeType === Node.ELEMENT_NODE);
|
|
2651
|
+
if (!RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) || hasElementChildren) {
|
|
2652
|
+
const childInlineHtmlNode = Object.assign(Object.assign({ htmlTag: child.nodeName.toLowerCase() }, (hasElementChildren ? { groupId: generateUUID() } : {})), { customAttribute: this.customAttributeHandler.handle(child).customAttribute, customStyle: this.customStyleAnnotationHandler.handle(child).customStyle, customClass: this.customClassAnnotationHandler.handle(child).customClass });
|
|
2653
|
+
if (!inlineHtml) {
|
|
2654
|
+
inlineHtml = childInlineHtmlNode;
|
|
2655
|
+
}
|
|
2656
|
+
else {
|
|
2657
|
+
inlineHtml = this.appendToInlineHtmlChain(inlineHtml, childInlineHtmlNode, child.parentNode);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
return inlineHtml ? Object.assign({}, inlineHtml) : null;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* Immutably appends `toAppend` at the correct position in the chain — the
|
|
2664
|
+
* deepest node whose `child.htmlTag` still matches `parentNode.nodeName`.
|
|
2665
|
+
* Each level is reconstructed via spread so the original chain is never mutated.
|
|
2666
|
+
*
|
|
2667
|
+
* @param {VegaInlineHtmlSchema} node - Current chain node.
|
|
2668
|
+
* @param {VegaInlineHtmlSchema} toAppend - Node to append at the tail.
|
|
2669
|
+
* @param {ParentNode | null} parentNode - DOM parent of the element being processed.
|
|
2670
|
+
* @returns {VegaInlineHtmlSchema} A new chain with `toAppend` inserted.
|
|
2671
|
+
*/
|
|
2672
|
+
appendToInlineHtmlChain(node, toAppend, parentNode) {
|
|
2673
|
+
if (node.child && parentNode && node.child.htmlTag === parentNode.nodeName.toLowerCase()) {
|
|
2674
|
+
return Object.assign(Object.assign({}, node), { child: this.appendToInlineHtmlChain(node.child, toAppend, parentNode) });
|
|
2675
|
+
}
|
|
2676
|
+
return Object.assign(Object.assign({}, node), { child: toAppend });
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2594
2679
|
|
|
2595
2680
|
/** Html element to annotations generator */
|
|
2596
2681
|
class HtmlElementToAnnotationGenerator {
|
|
@@ -2636,7 +2721,12 @@ class HtmlElementToAnnotationGenerator {
|
|
|
2636
2721
|
* @returns {V} Generated annotations.
|
|
2637
2722
|
*/
|
|
2638
2723
|
generate(targetDto, element, options = { autoMatchFormat: true }) {
|
|
2639
|
-
|
|
2724
|
+
if (options && options.filterInlineStyles) {
|
|
2725
|
+
RTEFilterStylesStrategyRegistry.executeTheStrategyRefillAction(targetDto.name, element);
|
|
2726
|
+
}
|
|
2727
|
+
// Guard against <a> wrapping block content (e.g. <a><video></a>), which is processed as an
|
|
2728
|
+
// html-block (targetDto !== RTETextNode) — link-only mode should not apply in that case.
|
|
2729
|
+
const isLinkElement = Predicate.isLinkElement(element) && targetDto.name === 'RTETextNode';
|
|
2640
2730
|
const annotations = this.handlers
|
|
2641
2731
|
.filter((handler) => !options.autoMatchFormat && isLinkElement ? handler instanceof LinkAnnotationHandler : true)
|
|
2642
2732
|
.filter((handler) => element.nodeType !== Node.TEXT_NODE &&
|
|
@@ -2767,13 +2857,17 @@ class HtmlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
|
2767
2857
|
*/
|
|
2768
2858
|
canHandle(elementsArray, currentIndex, options) {
|
|
2769
2859
|
const element = elementsArray[currentIndex];
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2860
|
+
if (element.nodeType === Node.TEXT_NODE || this.isInlineTagWithoutBlockChildren(element, options)) {
|
|
2861
|
+
return 0;
|
|
2862
|
+
}
|
|
2863
|
+
// Skip dedicated-strategy tags unless all children are block-level embedded
|
|
2864
|
+
// elements (e.g. <p><video></p>), in which case fall back to html-block.
|
|
2865
|
+
if (DEDICATED_STRATEGY_TAGS.has(element.nodeName) && !this.shouldFallBackToHtmlBlock(element)) {
|
|
2866
|
+
return 0;
|
|
2867
|
+
}
|
|
2774
2868
|
return !options.autoMatchFormat &&
|
|
2775
|
-
|
|
2776
|
-
|
|
2869
|
+
this.isCustomHtmlContainer(element) &&
|
|
2870
|
+
!Predicate.isTitleOrSubtitle(element)
|
|
2777
2871
|
? 1
|
|
2778
2872
|
: 0;
|
|
2779
2873
|
}
|
|
@@ -2799,6 +2893,89 @@ class HtmlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
|
2799
2893
|
shouldProceedToElementChildren() {
|
|
2800
2894
|
return true;
|
|
2801
2895
|
}
|
|
2896
|
+
/**
|
|
2897
|
+
* Returns true for elements that should be treated as inline content even if they have no element children (e.g. <span>text</span>).
|
|
2898
|
+
* This includes any element in a block text context (P, H1-H6, LI) and any element with text-node children but no element-node children.
|
|
2899
|
+
*
|
|
2900
|
+
* In raw-HTML mode (autoMatchFormat: false), the text-only heuristic only
|
|
2901
|
+
* applies to elements whose parent is itself a text-only wrapper (e.g.
|
|
2902
|
+
* {@code <div><span>Title</span></div>}). Structural children of non-text
|
|
2903
|
+
* containers (TABLE → CAPTION, TR → TH/TD, etc.) skip this heuristic so
|
|
2904
|
+
* they reach {@link isCustomHtmlContainer} and become html-blocks.
|
|
2905
|
+
*
|
|
2906
|
+
* @param {HTMLElement} element - Element to check.
|
|
2907
|
+
* @param {VegaRTETransformOptions} options - Transform options.
|
|
2908
|
+
* @returns {boolean} True if the element should be treated as inline content.
|
|
2909
|
+
*/
|
|
2910
|
+
isInlineTagWithoutBlockChildren(element, options) {
|
|
2911
|
+
if (isInBlockTextContext(element)) {
|
|
2912
|
+
// Empty elements that are not recognized inline elements should not
|
|
2913
|
+
// be forced inline — they may represent block-level embedded content
|
|
2914
|
+
// (e.g. <video src="...">, <audio>, <iframe src="...">).
|
|
2915
|
+
if (element.childNodes.length === 0 &&
|
|
2916
|
+
element.textContent === '' &&
|
|
2917
|
+
!ALWAYS_INLINE_TAGS.has(element.nodeName) &&
|
|
2918
|
+
!PHRASING_CONTENT_TAGS.has(element.nodeName)) {
|
|
2919
|
+
return false;
|
|
2920
|
+
}
|
|
2921
|
+
return true;
|
|
2922
|
+
}
|
|
2923
|
+
const childNodes = Array.from(element.childNodes);
|
|
2924
|
+
const isTextOnly = !childNodes.some((child) => child.nodeType === Node.ELEMENT_NODE) &&
|
|
2925
|
+
childNodes.some((child) => child.nodeType === Node.TEXT_NODE);
|
|
2926
|
+
if (!isTextOnly) {
|
|
2927
|
+
return false;
|
|
2928
|
+
}
|
|
2929
|
+
// In raw-HTML mode, a text-only element is inline only if:
|
|
2930
|
+
// 1. Its parent is not a structured container (TABLE, TR, …)
|
|
2931
|
+
// 2. The element itself is phrasing content (SPAN, EM, …)
|
|
2932
|
+
// Non-phrasing text-only elements (SUMMARY, FIGCAPTION, OPTION, SVG TEXT,
|
|
2933
|
+
// etc.) must fall through to become html-blocks.
|
|
2934
|
+
if (options.autoMatchFormat === false) {
|
|
2935
|
+
if (STRUCTURED_CONTAINER_TAGS.has(element.parentElement.nodeName))
|
|
2936
|
+
return false; // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
2937
|
+
return PHRASING_CONTENT_TAGS.has(element.nodeName) || ALWAYS_INLINE_TAGS.has(element.nodeName);
|
|
2938
|
+
}
|
|
2939
|
+
return true;
|
|
2940
|
+
}
|
|
2941
|
+
/**
|
|
2942
|
+
* Returns true when a dedicated-strategy element should fall back to html-block
|
|
2943
|
+
* because all its children are non-text, non-inline, non-dedicated elements
|
|
2944
|
+
* — indicating purely block-level embedded content that the dedicated text-block
|
|
2945
|
+
* strategy cannot represent.
|
|
2946
|
+
*
|
|
2947
|
+
* @param {HTMLElement} element - The dedicated-strategy element to check.
|
|
2948
|
+
* @returns {boolean} True when the element should be treated as html-block.
|
|
2949
|
+
*/
|
|
2950
|
+
shouldFallBackToHtmlBlock(element) {
|
|
2951
|
+
const childNodes = Array.from(element.childNodes);
|
|
2952
|
+
if (childNodes.length === 0)
|
|
2953
|
+
return false;
|
|
2954
|
+
// List items are structural children whose dedicated strategies manage
|
|
2955
|
+
// both block and inline children independently — never override them.
|
|
2956
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2957
|
+
const parentTag = element.parentElement.nodeName;
|
|
2958
|
+
if (parentTag === 'UL' || parentTag === 'OL')
|
|
2959
|
+
return false;
|
|
2960
|
+
return childNodes.every((child) => child.nodeType === Node.ELEMENT_NODE &&
|
|
2961
|
+
child.textContent === '' &&
|
|
2962
|
+
!ALWAYS_INLINE_TAGS.has(child.nodeName) &&
|
|
2963
|
+
!PHRASING_CONTENT_TAGS.has(child.nodeName));
|
|
2964
|
+
}
|
|
2965
|
+
/**
|
|
2966
|
+
* Returns true for elements that should be treated as html containers.
|
|
2967
|
+
* A DIV is only a valid container when its first child is not an IMG
|
|
2968
|
+
* (IMG children are handled by the image strategy instead).
|
|
2969
|
+
*
|
|
2970
|
+
* @param {HTMLElement} element - Element to check.
|
|
2971
|
+
* @returns {boolean} True if the element qualifies as a html container.
|
|
2972
|
+
*/
|
|
2973
|
+
isCustomHtmlContainer(element) {
|
|
2974
|
+
if (element.nodeName !== 'DIV') {
|
|
2975
|
+
return true;
|
|
2976
|
+
}
|
|
2977
|
+
return element.childNodes.length > 0 && element.childNodes[0].nodeName !== 'IMG';
|
|
2978
|
+
}
|
|
2802
2979
|
/**
|
|
2803
2980
|
* Generate HTML block DTO from an HTML element.
|
|
2804
2981
|
*
|
|
@@ -2816,43 +2993,6 @@ class HtmlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
|
2816
2993
|
};
|
|
2817
2994
|
}
|
|
2818
2995
|
}
|
|
2819
|
-
HtmlBlockStrategy.canHandleTags = [
|
|
2820
|
-
'ADDRESS',
|
|
2821
|
-
'ARTICLE',
|
|
2822
|
-
'ASIDE',
|
|
2823
|
-
'BLOCKQUOTE',
|
|
2824
|
-
'BUTTON',
|
|
2825
|
-
'CAPTION',
|
|
2826
|
-
'COL',
|
|
2827
|
-
'COLGROUP',
|
|
2828
|
-
'DIV',
|
|
2829
|
-
'DD',
|
|
2830
|
-
'DETAILS',
|
|
2831
|
-
'DL',
|
|
2832
|
-
'DT',
|
|
2833
|
-
'FIELDSET',
|
|
2834
|
-
'FIGCAPTION',
|
|
2835
|
-
'FIGURE',
|
|
2836
|
-
'FOOTER',
|
|
2837
|
-
'FORM',
|
|
2838
|
-
'HEADER',
|
|
2839
|
-
'HR',
|
|
2840
|
-
'HX',
|
|
2841
|
-
'INPUT',
|
|
2842
|
-
'LEGEND',
|
|
2843
|
-
'MAIN',
|
|
2844
|
-
'NAV',
|
|
2845
|
-
'PRE',
|
|
2846
|
-
'SECTION',
|
|
2847
|
-
'SUMMARY',
|
|
2848
|
-
'TABLE',
|
|
2849
|
-
'TBODY',
|
|
2850
|
-
'TD',
|
|
2851
|
-
'TFOOT',
|
|
2852
|
-
'TH',
|
|
2853
|
-
'THEAD',
|
|
2854
|
-
'TR',
|
|
2855
|
-
];
|
|
2856
2996
|
|
|
2857
2997
|
/** Transform ul element to list block DTO */
|
|
2858
2998
|
class UlToRTEListBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
@@ -3444,19 +3584,13 @@ class SpanImageToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbs
|
|
|
3444
3584
|
/** Transform continue inline block elements to text block DTO */
|
|
3445
3585
|
class ContinueInlineToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
3446
3586
|
/**
|
|
3447
|
-
*
|
|
3448
|
-
*
|
|
3449
|
-
* @param {HTMLElement[]} elementsArray - Current elements.
|
|
3450
|
-
* @param {number} currentIndex - Current element index.
|
|
3451
|
-
* @returns {number} - can be handled element count.
|
|
3587
|
+
* @inheritDoc
|
|
3452
3588
|
*/
|
|
3453
|
-
canHandle(elementsArray, currentIndex) {
|
|
3589
|
+
canHandle(elementsArray, currentIndex, options) {
|
|
3454
3590
|
let count = 0;
|
|
3455
3591
|
for (let i = currentIndex; i < elementsArray.length; i++) {
|
|
3456
3592
|
const element = elementsArray[i];
|
|
3457
|
-
if (element
|
|
3458
|
-
(ContinueInlineToRTETextBlockStrategy.canHandleTags.includes(element.nodeName) &&
|
|
3459
|
-
!(element.textContent === '' && element.querySelector('IMG')))) {
|
|
3593
|
+
if (this.isInlineCandidate(element, options)) {
|
|
3460
3594
|
count++;
|
|
3461
3595
|
}
|
|
3462
3596
|
else {
|
|
@@ -3516,14 +3650,88 @@ class ContinueInlineToRTETextBlockStrategy extends BlockToRTEBlockStrategyAbstra
|
|
|
3516
3650
|
return null;
|
|
3517
3651
|
}
|
|
3518
3652
|
}
|
|
3653
|
+
/**
|
|
3654
|
+
* Check if the element is an inline candidate to be included in the text block.
|
|
3655
|
+
*
|
|
3656
|
+
* @param {HTMLElement} element - The element to check.
|
|
3657
|
+
* @param {VegaRTETransformOptions} [options] - Options for transformation.
|
|
3658
|
+
* @returns {boolean} - Whether the element is an inline candidate.
|
|
3659
|
+
*/
|
|
3660
|
+
isInlineCandidate(element, options) {
|
|
3661
|
+
if (element.nodeType === Node.TEXT_NODE)
|
|
3662
|
+
return true;
|
|
3663
|
+
if (ALWAYS_INLINE_TAGS.has(element.nodeName))
|
|
3664
|
+
return true;
|
|
3665
|
+
if (this.isDedicatedBlockTag(element.nodeName))
|
|
3666
|
+
return false;
|
|
3667
|
+
if (options.autoMatchFormat === false && isInBlockTextContext(element))
|
|
3668
|
+
return true;
|
|
3669
|
+
return this.isInlineLeafOrWrapper(element);
|
|
3670
|
+
}
|
|
3671
|
+
/**
|
|
3672
|
+
* Returns true when the tag has a dedicated block strategy (excludes inline annotation tags CODE and A).
|
|
3673
|
+
*
|
|
3674
|
+
* @param {string} nodeName - The node name to check.
|
|
3675
|
+
* @returns {boolean} - Whether the tag is a dedicated block tag.
|
|
3676
|
+
*/
|
|
3677
|
+
isDedicatedBlockTag(nodeName) {
|
|
3678
|
+
return DEDICATED_STRATEGY_TAGS.has(nodeName) && !ALWAYS_INLINE_TAGS.has(nodeName);
|
|
3679
|
+
}
|
|
3680
|
+
/**
|
|
3681
|
+
* Returns true for empty elements, text-only elements, or elements whose entire
|
|
3682
|
+
* descendant tree contains no block-level elements (e.g. {@code <u><i><b>text</b></i></u>}).
|
|
3683
|
+
*
|
|
3684
|
+
* @param {HTMLElement} element - The element to check.
|
|
3685
|
+
* @returns {boolean} - Whether the element is an inline leaf or wrapper.
|
|
3686
|
+
*/
|
|
3687
|
+
isInlineLeafOrWrapper(element) {
|
|
3688
|
+
if (element.childNodes.length === 0) {
|
|
3689
|
+
// An empty element is inline only if it is a known HTML phrasing-content
|
|
3690
|
+
// element (SPAN, EM, STRONG, …). Block containers (DIV, SECTION, …)
|
|
3691
|
+
// and unknown/custom elements default to block separators.
|
|
3692
|
+
return PHRASING_CONTENT_TAGS.has(element.nodeName);
|
|
3693
|
+
}
|
|
3694
|
+
if (this.isTextOnlyElement(element)) {
|
|
3695
|
+
return PHRASING_CONTENT_TAGS.has(element.nodeName) || ALWAYS_INLINE_TAGS.has(element.nodeName);
|
|
3696
|
+
}
|
|
3697
|
+
return this.hasOnlyInlineDescendants(element);
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* Returns true when the element has text-node children but no element children.
|
|
3701
|
+
*
|
|
3702
|
+
* @param {HTMLElement} element - The element to check.
|
|
3703
|
+
* @returns {boolean} - Whether the element contains only text nodes.
|
|
3704
|
+
*/
|
|
3705
|
+
isTextOnlyElement(element) {
|
|
3706
|
+
const childNodes = Array.from(element.childNodes);
|
|
3707
|
+
return (!childNodes.some((child) => child.nodeType === Node.ELEMENT_NODE) &&
|
|
3708
|
+
childNodes.some((child) => child.nodeType === Node.TEXT_NODE));
|
|
3709
|
+
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Returns true if the element's subtree contains only inline formatting wrappers.
|
|
3712
|
+
* Instead of maintaining a hard coded tag allowlist, the check derives from:
|
|
3713
|
+
* 1. {@link DEDICATED_STRATEGY_TAGS} — rejects known block/media tags
|
|
3714
|
+
* 2. Void-element check — elements with no child nodes (INPUT, COL, HR, …)
|
|
3715
|
+
* are replaced/embedded content, not formatting wrappers
|
|
3716
|
+
*
|
|
3717
|
+
* @param {HTMLElement} element - Element to inspect.
|
|
3718
|
+
* @returns {boolean} True if the element has no block-level descendants.
|
|
3719
|
+
*/
|
|
3720
|
+
hasOnlyInlineDescendants(element) {
|
|
3721
|
+
for (let i = 0; i < element.children.length; i++) {
|
|
3722
|
+
const child = element.children[i];
|
|
3723
|
+
if (this.isDedicatedBlockTag(child.nodeName))
|
|
3724
|
+
return false;
|
|
3725
|
+
// An empty element is not a formatting wrapper — it is likely a void/embedded
|
|
3726
|
+
// element (INPUT, HR, COL, empty SPAN) that acts as a block separator.
|
|
3727
|
+
if (!child.hasChildNodes())
|
|
3728
|
+
return false;
|
|
3729
|
+
if (!this.hasOnlyInlineDescendants(child))
|
|
3730
|
+
return false;
|
|
3731
|
+
}
|
|
3732
|
+
return true;
|
|
3733
|
+
}
|
|
3519
3734
|
}
|
|
3520
|
-
ContinueInlineToRTETextBlockStrategy.canHandleTags = [
|
|
3521
|
-
...InlineHtmlAnnotationHandler.canHandleTags,
|
|
3522
|
-
'CODE',
|
|
3523
|
-
'A',
|
|
3524
|
-
'VEGA-RICH-TEXT-LINK-EDITOR',
|
|
3525
|
-
'BR',
|
|
3526
|
-
];
|
|
3527
3735
|
|
|
3528
3736
|
/**
|
|
3529
3737
|
* Class to handle text node elements and convert them to text node DTOs
|
|
@@ -3624,7 +3832,7 @@ class InlineElementToTextNodeStrategy extends ElementToTextNodeStrategy {
|
|
|
3624
3832
|
// For empty dom, there will be no internal iteration, we need to handle it directly here.
|
|
3625
3833
|
// Example: <span></span>, <video src='...'></video>
|
|
3626
3834
|
const emptyNodeAnnotations = disableAutoMatchFormat
|
|
3627
|
-
? cleanObject(Object.assign(Object.assign({}, (RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) ? curAnnotations : {})), { inlineHtml: curAnnotations.inlineHtml
|
|
3835
|
+
? cleanObject(Object.assign(Object.assign({}, (RTETextNode.supportsHtmlTag(child.nodeName.toLowerCase()) ? curAnnotations : {})), { inlineHtml: curAnnotations.inlineHtml }))
|
|
3628
3836
|
: curAnnotations;
|
|
3629
3837
|
return Object.assign({}, this.generateTextNode('', emptyNodeAnnotations));
|
|
3630
3838
|
}
|
|
@@ -3632,80 +3840,39 @@ class InlineElementToTextNodeStrategy extends ElementToTextNodeStrategy {
|
|
|
3632
3840
|
}
|
|
3633
3841
|
|
|
3634
3842
|
/**
|
|
3635
|
-
*
|
|
3636
|
-
* Concrete strategies define which styles to strip via `stylesToBeFiltered`.
|
|
3637
|
-
*
|
|
3638
|
-
* This base is shared by two kinds of concrete strategies:
|
|
3639
|
-
* 1. Block/node output strategies – filter inline styles when converting DTO → HTML.
|
|
3640
|
-
* 2. Annotation parsing strategies – strip redundant defaults when converting HTML → DTO.
|
|
3843
|
+
* Filter styles strategy for image node, which defines the styles to be filtered and the conditions for filtering and refilling styles for image nodes.
|
|
3641
3844
|
*/
|
|
3642
|
-
class RTEFilterStylesStrategy {
|
|
3845
|
+
class ImageFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
3846
|
+
constructor() {
|
|
3847
|
+
super(...arguments);
|
|
3848
|
+
this.stylesToBeFiltered = ImageAnnotation.getDefaultStyles();
|
|
3849
|
+
this.elementTagName = 'img';
|
|
3850
|
+
}
|
|
3643
3851
|
/**
|
|
3644
|
-
*
|
|
3645
|
-
* Override to `true` when the filtered styles are always emitted as inline
|
|
3646
|
-
* styles by the DTO (e.g. image `vertical-align`), so stripping them from
|
|
3647
|
-
* `customStyle` is always safe.
|
|
3852
|
+
* Used for the filterAnnotations method.
|
|
3648
3853
|
*
|
|
3649
|
-
*
|
|
3650
|
-
*
|
|
3651
|
-
* @returns {boolean} Whether filtering should always apply.
|
|
3854
|
+
* @returns {boolean} Always `true` — image defaults are emitted as inline styles.
|
|
3652
3855
|
*/
|
|
3653
3856
|
get alwaysFilter() {
|
|
3654
|
-
return
|
|
3857
|
+
return true;
|
|
3655
3858
|
}
|
|
3656
3859
|
/**
|
|
3657
|
-
*
|
|
3658
|
-
* If all custom styles are defaults, the `customStyle` key is deleted entirely.
|
|
3659
|
-
*
|
|
3660
|
-
* @param {VegaRTEAnnotations} annotations - The annotations object (mutated in place).
|
|
3661
|
-
* @returns {VegaRTEAnnotations} The same annotations reference.
|
|
3860
|
+
* @inheritDoc
|
|
3662
3861
|
*/
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
if (!customStyle) {
|
|
3666
|
-
return annotations;
|
|
3667
|
-
}
|
|
3668
|
-
this.extractAndDeleteMatchedStyles(customStyle);
|
|
3669
|
-
if (Object.keys(customStyle).length === 0) {
|
|
3670
|
-
delete annotations.customStyle;
|
|
3671
|
-
}
|
|
3672
|
-
return annotations;
|
|
3862
|
+
canFilter(blockOrNodeInstance) {
|
|
3863
|
+
return Predicate$1.isImageNode(blockOrNodeInstance);
|
|
3673
3864
|
}
|
|
3674
3865
|
/**
|
|
3675
|
-
*
|
|
3676
|
-
* Only properties whose value matches the configured default exactly are deleted.
|
|
3677
|
-
*
|
|
3678
|
-
* @param {Nullable<RTEFilterStyles>} styles - The styles object to mutate.
|
|
3679
|
-
* @returns {boolean} `true` if at least one style was extracted.
|
|
3866
|
+
* @inheritDoc
|
|
3680
3867
|
*/
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
if (styles) {
|
|
3684
|
-
const defaults = this.stylesToBeFiltered;
|
|
3685
|
-
const styleKeys = Object.keys(defaults);
|
|
3686
|
-
for (const key of styleKeys) {
|
|
3687
|
-
if (styles[key] === defaults[key]) {
|
|
3688
|
-
delete styles[key];
|
|
3689
|
-
wasExtracted = true;
|
|
3690
|
-
}
|
|
3691
|
-
}
|
|
3692
|
-
}
|
|
3693
|
-
return wasExtracted;
|
|
3868
|
+
canRefill(_blockOrNodeClassName, element) {
|
|
3869
|
+
return element.tagName.toLowerCase() === this.elementTagName;
|
|
3694
3870
|
}
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
*/
|
|
3701
|
-
class ImageFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
3702
|
-
constructor() {
|
|
3703
|
-
super(...arguments);
|
|
3704
|
-
this.stylesToBeFiltered = ImageAnnotation.getDefaultStyles();
|
|
3705
|
-
}
|
|
3706
|
-
/** @returns {boolean} Always `true` — image defaults are emitted as inline styles. */
|
|
3707
|
-
get alwaysFilter() {
|
|
3708
|
-
return true;
|
|
3871
|
+
/**
|
|
3872
|
+
* @inheritDoc
|
|
3873
|
+
*/
|
|
3874
|
+
toCssText() {
|
|
3875
|
+
return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
|
|
3709
3876
|
}
|
|
3710
3877
|
}
|
|
3711
3878
|
|
|
@@ -3717,6 +3884,29 @@ class ListBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
|
3717
3884
|
constructor() {
|
|
3718
3885
|
super(...arguments);
|
|
3719
3886
|
this.stylesToBeFiltered = ListAnnotation.getDefaultStyles();
|
|
3887
|
+
this.elementTagName = 'ol,ul';
|
|
3888
|
+
}
|
|
3889
|
+
/**
|
|
3890
|
+
* @inheritDoc
|
|
3891
|
+
*/
|
|
3892
|
+
canFilter(blockOrNodeInstance) {
|
|
3893
|
+
return Predicate$1.isListBlock(blockOrNodeInstance.constructor.name);
|
|
3894
|
+
}
|
|
3895
|
+
/**
|
|
3896
|
+
* @inheritDoc
|
|
3897
|
+
*/
|
|
3898
|
+
canRefill(blockOrNodeClassName, element) {
|
|
3899
|
+
return Predicate$1.isListBlock(blockOrNodeClassName) && element.matches(this.elementTagName);
|
|
3900
|
+
}
|
|
3901
|
+
/**
|
|
3902
|
+
* @inheritDoc
|
|
3903
|
+
*/
|
|
3904
|
+
toCssText() {
|
|
3905
|
+
const selector = this.elementTagName
|
|
3906
|
+
.split(',')
|
|
3907
|
+
.map((tag) => `.${RTEFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME} ${tag.trim()}`)
|
|
3908
|
+
.join(', ');
|
|
3909
|
+
return `${selector} { ${this.convertStylesMapToCssText(this.stylesToBeFiltered)} }`;
|
|
3720
3910
|
}
|
|
3721
3911
|
}
|
|
3722
3912
|
|
|
@@ -3728,7 +3918,44 @@ class ListBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
|
3728
3918
|
class ListItemBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
3729
3919
|
constructor() {
|
|
3730
3920
|
super(...arguments);
|
|
3731
|
-
this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles('paragraph')
|
|
3921
|
+
this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles('paragraph');
|
|
3922
|
+
this.elementTagName = 'li';
|
|
3923
|
+
this.headingOrTitleClassNamePattern = /^v-rte-(h[1-6]|title|subtitle)$/;
|
|
3924
|
+
}
|
|
3925
|
+
/**
|
|
3926
|
+
* Check the important font-size for list item block are default styles, and the block is a list item block.
|
|
3927
|
+
*
|
|
3928
|
+
* @inheritDoc
|
|
3929
|
+
*/
|
|
3930
|
+
canFilter(blockOrNodeInstance) {
|
|
3931
|
+
const styles = blockOrNodeInstance.getStyles();
|
|
3932
|
+
const isDefaultStyles = !styles.fontSize ||
|
|
3933
|
+
this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']);
|
|
3934
|
+
return Predicate$1.isListItemBlock(blockOrNodeInstance.constructor.name) && isDefaultStyles;
|
|
3935
|
+
}
|
|
3936
|
+
/**
|
|
3937
|
+
* @inheritDoc
|
|
3938
|
+
*/
|
|
3939
|
+
canRefill(blockOrNodeClassName, element) {
|
|
3940
|
+
return (Predicate$1.isListItemBlock(blockOrNodeClassName) &&
|
|
3941
|
+
element.matches(this.elementTagName) &&
|
|
3942
|
+
this.isElementNotHeadingOrTitle(element));
|
|
3943
|
+
}
|
|
3944
|
+
/**
|
|
3945
|
+
* @inheritDoc
|
|
3946
|
+
*/
|
|
3947
|
+
toCssText() {
|
|
3948
|
+
return this.buildCssTextForStyles(this.elementTagName);
|
|
3949
|
+
}
|
|
3950
|
+
/**
|
|
3951
|
+
* Check the list item element does not have heading or title class names.
|
|
3952
|
+
*
|
|
3953
|
+
* @param {HTMLElement} element - The list item element to check.
|
|
3954
|
+
* @returns {boolean} - True if the element does not have heading or title class names, false otherwise.
|
|
3955
|
+
*/
|
|
3956
|
+
isElementNotHeadingOrTitle(element) {
|
|
3957
|
+
const classNames = element.className.split(' ');
|
|
3958
|
+
return !classNames.some((className) => this.headingOrTitleClassNamePattern.test(className.trim()));
|
|
3732
3959
|
}
|
|
3733
3960
|
}
|
|
3734
3961
|
|
|
@@ -3771,13 +3998,13 @@ class AlignmentFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
|
3771
3998
|
}
|
|
3772
3999
|
|
|
3773
4000
|
/**
|
|
3774
|
-
*
|
|
3775
|
-
* customStyle when parsing an RTETextNode that has a `code` annotation.
|
|
4001
|
+
* The CodeFilterStylesStrategy is responsible for filtering code styles from text nodes that are annotated as code.
|
|
3776
4002
|
*/
|
|
3777
4003
|
class CodeFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
3778
4004
|
constructor() {
|
|
3779
4005
|
super(...arguments);
|
|
3780
4006
|
this.stylesToBeFiltered = CodeAnnotation.getDefaultStyles();
|
|
4007
|
+
this.elementTagName = 'code';
|
|
3781
4008
|
}
|
|
3782
4009
|
/**
|
|
3783
4010
|
* Only strips code-default styles when the `code` annotation is present,
|
|
@@ -3793,34 +4020,33 @@ class CodeFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
|
3793
4020
|
}
|
|
3794
4021
|
return super.filterAnnotations(annotations);
|
|
3795
4022
|
}
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
constructor() {
|
|
3805
|
-
super(...arguments);
|
|
3806
|
-
this.stylesToBeFiltered = LinkGroupAnnotation.getDefaultStyles();
|
|
4023
|
+
/**
|
|
4024
|
+
* Determines whether the dto instance is a code text node.
|
|
4025
|
+
*
|
|
4026
|
+
* @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
|
|
4027
|
+
* @returns {boolean} - True if the instance is a code text node, false otherwise.
|
|
4028
|
+
*/
|
|
4029
|
+
canFilter(blockOrNodeInstance) {
|
|
4030
|
+
return Predicate$1.isCodeNode(blockOrNodeInstance);
|
|
3807
4031
|
}
|
|
3808
4032
|
/**
|
|
3809
|
-
*
|
|
4033
|
+
* Check if the node is a text node and it is a code node.
|
|
3810
4034
|
*
|
|
3811
|
-
* @param {
|
|
3812
|
-
* @
|
|
4035
|
+
* @param {string} blockOrNodeClassName - The class name of the block or node instance to check.
|
|
4036
|
+
* @param {HTMLElement} element - The HTML element of the node instance.
|
|
4037
|
+
* @returns {boolean} True if the node is a text node it a code element.
|
|
3813
4038
|
*/
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
4039
|
+
canRefill(blockOrNodeClassName, element) {
|
|
4040
|
+
return Predicate$1.isTextNode(blockOrNodeClassName) && element.matches(this.elementTagName);
|
|
4041
|
+
}
|
|
4042
|
+
/**
|
|
4043
|
+
* The code style in title and heading no need to be bold in default.
|
|
4044
|
+
*
|
|
4045
|
+
* @returns {string} The CSS text string for code styles.
|
|
4046
|
+
*/
|
|
4047
|
+
toCssText() {
|
|
4048
|
+
const selector = `.${RTEFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME} ${this.elementTagName}`;
|
|
4049
|
+
return `${selector} { ${this.convertStylesMapToCssText(Object.assign(Object.assign({}, this.stylesToBeFiltered), { fontWeight: '500' }))} }`;
|
|
3824
4050
|
}
|
|
3825
4051
|
}
|
|
3826
4052
|
|
|
@@ -3912,6 +4138,244 @@ class TextFormatFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
|
3912
4138
|
}
|
|
3913
4139
|
}
|
|
3914
4140
|
|
|
4141
|
+
/**
|
|
4142
|
+
*
|
|
4143
|
+
*/
|
|
4144
|
+
class ParagraphFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
4145
|
+
constructor() {
|
|
4146
|
+
super(...arguments);
|
|
4147
|
+
this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles('paragraph');
|
|
4148
|
+
this.type = 'paragraph';
|
|
4149
|
+
this.elementTagName = 'p';
|
|
4150
|
+
}
|
|
4151
|
+
/**
|
|
4152
|
+
* Don't run the filterAnnotations for paragraph heading, title, subtitle, list heading item, list title item, list subtitle item.
|
|
4153
|
+
* Already handle it in html-element-to-annotation-generator.ts#removeTextStyleDefaultsFromCustomStyle
|
|
4154
|
+
*
|
|
4155
|
+
* @inheritDoc
|
|
4156
|
+
*/
|
|
4157
|
+
filterAnnotations(annotations) {
|
|
4158
|
+
return annotations;
|
|
4159
|
+
}
|
|
4160
|
+
/**
|
|
4161
|
+
* Determines whether the dto instance is text block and has the same type as the strategy's configured type.
|
|
4162
|
+
*
|
|
4163
|
+
* @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
|
|
4164
|
+
* @returns {boolean} - True if the instance is a text block with the same type as the strategy, false otherwise.
|
|
4165
|
+
*/
|
|
4166
|
+
canFilter(blockOrNodeInstance) {
|
|
4167
|
+
return (Predicate$1.isTextBlock(blockOrNodeInstance.constructor.name) &&
|
|
4168
|
+
blockOrNodeInstance.type === this.type);
|
|
4169
|
+
}
|
|
4170
|
+
/**
|
|
4171
|
+
* @inheritDoc
|
|
4172
|
+
*/
|
|
4173
|
+
canRefill(blockOrNodeClassName, element) {
|
|
4174
|
+
const selector = this.classNameToBeAdded
|
|
4175
|
+
? `.${this.classNameToBeAdded}`
|
|
4176
|
+
: this.elementTagName;
|
|
4177
|
+
return Predicate$1.isTextBlock(blockOrNodeClassName) && element.matches(selector);
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* @inheritDoc
|
|
4181
|
+
*/
|
|
4182
|
+
toCssText() {
|
|
4183
|
+
return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
/**
|
|
4188
|
+
* The HeadingFilterStylesStrategy class is responsible for filtering and refilling styles for heading text blocks (h1 to h6) in the rich text editor.
|
|
4189
|
+
*/
|
|
4190
|
+
class HeadingFilterStylesStrategy extends ParagraphFilterStylesStrategy {
|
|
4191
|
+
constructor(level) {
|
|
4192
|
+
super();
|
|
4193
|
+
this.type = 'heading-1';
|
|
4194
|
+
this.elementTagName = 'h1';
|
|
4195
|
+
this.type = `heading-${level}`;
|
|
4196
|
+
this.elementTagName = `h${level}`;
|
|
4197
|
+
this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles(this.type);
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4201
|
+
/**
|
|
4202
|
+
* The TitleFilterStylesStrategy class is responsible for filtering and refilling styles for title and subtitle text blocks in the rich text editor.
|
|
4203
|
+
*/
|
|
4204
|
+
class TitleFilterStylesStrategy extends ParagraphFilterStylesStrategy {
|
|
4205
|
+
constructor(titleType) {
|
|
4206
|
+
super();
|
|
4207
|
+
this.type = 'title';
|
|
4208
|
+
this.elementTagName = 'div';
|
|
4209
|
+
this.classNameToBeAdded = 'v-rte-title';
|
|
4210
|
+
this.type = titleType;
|
|
4211
|
+
this.classNameToBeAdded = `v-rte-${titleType}`;
|
|
4212
|
+
this.stylesToBeFiltered = TextStyleAnnotation.getDefaultStyles(this.type);
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
|
|
4216
|
+
/**
|
|
4217
|
+
* The TitleHeadingNodeFilterStylesStrategy is responsible for filtering styles from text nodes that are children of title and heading blocks.
|
|
4218
|
+
* In title and heading blocks, the text nodes will have a default bold style.
|
|
4219
|
+
*/
|
|
4220
|
+
class TitleHeadingNodeFilterStylesStrategy extends RTEFilterStylesStrategy {
|
|
4221
|
+
constructor() {
|
|
4222
|
+
super(...arguments);
|
|
4223
|
+
this.stylesToBeFiltered = TitleHeadingNodeFilterStylesStrategy.BOLD_STYLES;
|
|
4224
|
+
this.elementTagName = 'span';
|
|
4225
|
+
this.parentBlockTypes = [
|
|
4226
|
+
'heading-1',
|
|
4227
|
+
'heading-2',
|
|
4228
|
+
'heading-3',
|
|
4229
|
+
'heading-4',
|
|
4230
|
+
'heading-5',
|
|
4231
|
+
'heading-6',
|
|
4232
|
+
'title',
|
|
4233
|
+
];
|
|
4234
|
+
this.parentElementSelectors = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.v-rte-title'];
|
|
4235
|
+
this.toBeCheckedSelector = this.parentElementSelectors.join(',');
|
|
4236
|
+
}
|
|
4237
|
+
/**
|
|
4238
|
+
* Don't run filterAnnotations method, because already handle it in text format filter strategy.
|
|
4239
|
+
*
|
|
4240
|
+
* @inheritDoc
|
|
4241
|
+
*/
|
|
4242
|
+
filterAnnotations(annotations) {
|
|
4243
|
+
return annotations;
|
|
4244
|
+
}
|
|
4245
|
+
/**
|
|
4246
|
+
* Determines whether the dto instance is text node and its parent block is a heading or title.
|
|
4247
|
+
*
|
|
4248
|
+
* @param {RTEBlock | RTENode} blockOrNodeInstance - The block or node instance to check.
|
|
4249
|
+
* @returns {boolean} - True if the instance is a text node and its parent block is a heading or title, false otherwise.
|
|
4250
|
+
*/
|
|
4251
|
+
canFilter(blockOrNodeInstance) {
|
|
4252
|
+
return (Predicate$1.isTextNode(blockOrNodeInstance.constructor.name) &&
|
|
4253
|
+
this.parentBlockIsHeadingOrTitle(blockOrNodeInstance));
|
|
4254
|
+
}
|
|
4255
|
+
/**
|
|
4256
|
+
* Check if the node is a text node and its parent block is a heading or title.
|
|
4257
|
+
*
|
|
4258
|
+
* @param {string} blockOrNodeClassName - The class name of the block or node instance to check.
|
|
4259
|
+
* @param {HTMLElement} element - The HTML element of the node instance.
|
|
4260
|
+
* @returns {boolean} True if the node is a text node and its parent block is a heading or title, false otherwise.
|
|
4261
|
+
*/
|
|
4262
|
+
canRefill(blockOrNodeClassName, element) {
|
|
4263
|
+
return (Predicate$1.isTextNode(blockOrNodeClassName) &&
|
|
4264
|
+
element.nodeName === 'SPAN' &&
|
|
4265
|
+
this.isHeadingOrTitleChild(element));
|
|
4266
|
+
}
|
|
4267
|
+
/**
|
|
4268
|
+
* @inheritDoc
|
|
4269
|
+
*/
|
|
4270
|
+
toCssText() {
|
|
4271
|
+
const selectors = this.parentElementSelectors.map((key) => `.${TitleHeadingNodeFilterStylesStrategy.RTE_CONTENT_CONTAINER_CLASS_NAME} ${key}`);
|
|
4272
|
+
return `${selectors.join(',')} { ${this.convertStylesMapToCssText()} }`;
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Checks if the parent block of the given node instance is a heading or title.
|
|
4276
|
+
*
|
|
4277
|
+
* @param {RTENode | RTEBlock} blockOrNodeInstance - The node instance to check.
|
|
4278
|
+
* @returns {boolean} True if the parent block is a heading or title, false otherwise.
|
|
4279
|
+
*/
|
|
4280
|
+
parentBlockIsHeadingOrTitle(blockOrNodeInstance) {
|
|
4281
|
+
const parentBlock = blockOrNodeInstance.parent;
|
|
4282
|
+
return parentBlock ? this.parentBlockTypes.includes(parentBlock.type) : false;
|
|
4283
|
+
}
|
|
4284
|
+
/**
|
|
4285
|
+
* Check if the element is a descendant of a heading or title element.
|
|
4286
|
+
* Traverses upward through the DOM, stopping at the block element or body element
|
|
4287
|
+
* to avoid unbounded traversal to the document root.
|
|
4288
|
+
*
|
|
4289
|
+
* <h1><span>bold text</span></h1>
|
|
4290
|
+
* <h1><a><span>link text</span></a></h1>
|
|
4291
|
+
* <h1><a><b><span>nested text</span></b></a></h1>
|
|
4292
|
+
*
|
|
4293
|
+
* @param {HTMLElement} element - The element to check.
|
|
4294
|
+
* @returns {boolean} True if the element is a descendant of a heading or title, false otherwise.
|
|
4295
|
+
*/
|
|
4296
|
+
isHeadingOrTitleChild(element) {
|
|
4297
|
+
let current = element.parentElement;
|
|
4298
|
+
while (current) {
|
|
4299
|
+
if (current.matches(this.toBeCheckedSelector))
|
|
4300
|
+
return true;
|
|
4301
|
+
// Stop traversing upward if we reach a block element to prevent unbounded traversal to the document root. The title children will always be wrapped in a div, so we can safely stop at div as well.
|
|
4302
|
+
if (TitleHeadingNodeFilterStylesStrategy.NON_HEADING_TITLE_ELEMENT_TAGS.includes(current.tagName))
|
|
4303
|
+
return false;
|
|
4304
|
+
current = current.parentElement;
|
|
4305
|
+
}
|
|
4306
|
+
return false;
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
TitleHeadingNodeFilterStylesStrategy.BOLD_STYLES = {
|
|
4310
|
+
fontWeight: '700',
|
|
4311
|
+
};
|
|
4312
|
+
TitleHeadingNodeFilterStylesStrategy.NON_HEADING_TITLE_ELEMENT_TAGS = [
|
|
4313
|
+
'TD',
|
|
4314
|
+
'TH',
|
|
4315
|
+
'TR',
|
|
4316
|
+
'TABLE',
|
|
4317
|
+
'THEAD',
|
|
4318
|
+
'TBODY',
|
|
4319
|
+
'DIV',
|
|
4320
|
+
'BODY',
|
|
4321
|
+
];
|
|
4322
|
+
|
|
4323
|
+
/**
|
|
4324
|
+
* Filters the default heading styles from customStyle when parsing an RTEListItemBlock that is supposed to be a heading.
|
|
4325
|
+
*/
|
|
4326
|
+
class ListHeadingItemBlockFilterStylesStrategy extends HeadingFilterStylesStrategy {
|
|
4327
|
+
constructor(level) {
|
|
4328
|
+
super(level);
|
|
4329
|
+
this.classNameToBeAdded = `v-rte-h${level}`;
|
|
4330
|
+
this.elementTagName = 'li';
|
|
4331
|
+
}
|
|
4332
|
+
/**
|
|
4333
|
+
* Check the important font-size and line-height for list item block are default styles, and the block is a list item block.
|
|
4334
|
+
*
|
|
4335
|
+
* @inheritDoc
|
|
4336
|
+
*/
|
|
4337
|
+
canFilter(blockOrNodeInstance) {
|
|
4338
|
+
return (Predicate$1.isListItemBlock(blockOrNodeInstance.constructor.name) &&
|
|
4339
|
+
this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']));
|
|
4340
|
+
}
|
|
4341
|
+
/**
|
|
4342
|
+
* @inheritDoc
|
|
4343
|
+
*/
|
|
4344
|
+
canRefill(blockOrNodeClassName, element) {
|
|
4345
|
+
return (Predicate$1.isListItemBlock(blockOrNodeClassName) &&
|
|
4346
|
+
element.matches(this.elementTagName) &&
|
|
4347
|
+
element.classList.contains(this.classNameToBeAdded));
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
/**
|
|
4352
|
+
* Filters the default title/subtitle styles from customStyle when parsing an RTEListItemBlock that is supposed to be a title/subtitle.
|
|
4353
|
+
*/
|
|
4354
|
+
class ListTitleItemBlockFilterStylesStrategy extends TitleFilterStylesStrategy {
|
|
4355
|
+
constructor(type) {
|
|
4356
|
+
super(type);
|
|
4357
|
+
this.classNameToBeAdded = `v-rte-${type}`;
|
|
4358
|
+
this.elementTagName = 'li';
|
|
4359
|
+
}
|
|
4360
|
+
/**
|
|
4361
|
+
* Check the important font-size and line-height for list item block are default styles, and the block is a list item block.
|
|
4362
|
+
*
|
|
4363
|
+
* @inheritDoc
|
|
4364
|
+
*/
|
|
4365
|
+
canFilter(blockOrNodeInstance) {
|
|
4366
|
+
return (Predicate$1.isListItemBlock(blockOrNodeInstance.constructor.name) &&
|
|
4367
|
+
this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']));
|
|
4368
|
+
}
|
|
4369
|
+
/**
|
|
4370
|
+
* @inheritDoc
|
|
4371
|
+
*/
|
|
4372
|
+
canRefill(blockOrNodeClassName, element) {
|
|
4373
|
+
return (Predicate$1.isListItemBlock(blockOrNodeClassName) &&
|
|
4374
|
+
element.matches(this.elementTagName) &&
|
|
4375
|
+
element.classList.contains(this.classNameToBeAdded));
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
|
|
3915
4379
|
/**
|
|
3916
4380
|
* Register and setup the default DTO classes and their basic action strategies.
|
|
3917
4381
|
*/
|
|
@@ -3947,25 +4411,46 @@ ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new SpanImageToR
|
|
|
3947
4411
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaImageToRTEImageBlockStrategy());
|
|
3948
4412
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ImgToRTEImageBlockStrategy());
|
|
3949
4413
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new InlineBlockToRTETextBlockStrategy());
|
|
3950
|
-
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new JiraCodeToRTECodeBlockStrategy());
|
|
3951
|
-
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaCodeBlockToRTECodeBlockStrategy());
|
|
3952
4414
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new LiToRTEListItemBlockStrategy());
|
|
3953
4415
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new ULNotLiChildToRTEListItemBlockStrategy());
|
|
3954
4416
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new OlToRTEListBlockStrategy());
|
|
3955
4417
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new UlToRTEListBlockStrategy());
|
|
3956
4418
|
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new HtmlBlockStrategy());
|
|
4419
|
+
//!important: Code block strategies must be registered after HtmlBlockStrategy because registerElementToBlockStrategy uses unshift, giving later registrations higher priority.
|
|
4420
|
+
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new JiraCodeToRTECodeBlockStrategy());
|
|
4421
|
+
ElementToDTOClassStrategyManager.registerElementToBlockStrategy(new VegaCodeBlockToRTECodeBlockStrategy());
|
|
3957
4422
|
ElementToDTOClassStrategyManager.registerElementToNodeStrategy(new InlineElementToTextNodeStrategy());
|
|
3958
4423
|
ElementToDTOClassStrategyManager.registerElementToNodeStrategy(new PlainTextToTextNodeStrategy());
|
|
3959
4424
|
// Register filter styles strategies (remove redundant default styles during HTML → DTO conversion)
|
|
3960
|
-
RTEFilterStylesStrategyRegistry.register(RTEListBlock.name, new ListBlockFilterStylesStrategy());
|
|
3961
|
-
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListItemBlockFilterStylesStrategy());
|
|
3962
4425
|
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new AlignmentFilterStylesStrategy());
|
|
3963
4426
|
RTEFilterStylesStrategyRegistry.register(RTEListBlock.name, new AlignmentFilterStylesStrategy());
|
|
3964
4427
|
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new AlignmentFilterStylesStrategy());
|
|
3965
|
-
RTEFilterStylesStrategyRegistry.register(RTEImageNode.name, new ImageFilterStylesStrategy());
|
|
3966
|
-
RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new LinkFilterStylesStrategy());
|
|
3967
4428
|
RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new TextFormatFilterStylesStrategy());
|
|
4429
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new ParagraphFilterStylesStrategy());
|
|
4430
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(1));
|
|
4431
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(2));
|
|
4432
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(3));
|
|
4433
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(4));
|
|
4434
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(5));
|
|
4435
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new HeadingFilterStylesStrategy(6));
|
|
4436
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new TitleFilterStylesStrategy('title'));
|
|
4437
|
+
RTEFilterStylesStrategyRegistry.register(RTETextBlock.name, new TitleFilterStylesStrategy('subtitle'));
|
|
4438
|
+
RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new TitleHeadingNodeFilterStylesStrategy());
|
|
3968
4439
|
RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new CodeFilterStylesStrategy());
|
|
4440
|
+
RTEFilterStylesStrategyRegistry.register(RTETextNode.name, new LinkFilterStylesStrategy());
|
|
4441
|
+
RTEFilterStylesStrategyRegistry.register(RTEImageNode.name, new ImageFilterStylesStrategy());
|
|
4442
|
+
RTEFilterStylesStrategyRegistry.register(RTECodeBlock.name, new CodeBlockFilterStylesStrategy());
|
|
4443
|
+
RTEFilterStylesStrategyRegistry.register(RTECodeBlockNode.name, new CodeBlockNodeFilterStylesStrategy());
|
|
4444
|
+
RTEFilterStylesStrategyRegistry.register(RTEListBlock.name, new ListBlockFilterStylesStrategy());
|
|
4445
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListItemBlockFilterStylesStrategy());
|
|
4446
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(1));
|
|
4447
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(2));
|
|
4448
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(3));
|
|
4449
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(4));
|
|
4450
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(5));
|
|
4451
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListHeadingItemBlockFilterStylesStrategy(6));
|
|
4452
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListTitleItemBlockFilterStylesStrategy('title'));
|
|
4453
|
+
RTEFilterStylesStrategyRegistry.register(RTEListItemBlock.name, new ListTitleItemBlockFilterStylesStrategy('subtitle'));
|
|
3969
4454
|
|
|
3970
4455
|
/**
|
|
3971
4456
|
* StylePreservator handles CSP-compliant style management by temporarily converting
|
|
@@ -4292,6 +4777,15 @@ class VegaRTEContent {
|
|
|
4292
4777
|
.filter(isNonNullable);
|
|
4293
4778
|
return new VegaRTEContent(blocks);
|
|
4294
4779
|
}
|
|
4780
|
+
/**
|
|
4781
|
+
* Generates the content style file for the rich text editor based on the registered filter styles strategies.
|
|
4782
|
+
*
|
|
4783
|
+
* @param {VegaRTEGenerateStyleOptions} options - Options for generating the content style file.
|
|
4784
|
+
* @returns {string} The html template style text.
|
|
4785
|
+
*/
|
|
4786
|
+
static generateContentStyles(options) {
|
|
4787
|
+
return RTEFilterStylesStrategyRegistry.generateAllStylesContent(options === null || options === void 0 ? void 0 : options.enableFontImports);
|
|
4788
|
+
}
|
|
4295
4789
|
/**
|
|
4296
4790
|
* Clones the content state.
|
|
4297
4791
|
*
|
|
@@ -4314,18 +4808,20 @@ class VegaRTEContent {
|
|
|
4314
4808
|
/**
|
|
4315
4809
|
* Converts the content state to HTML.
|
|
4316
4810
|
*
|
|
4317
|
-
* @
|
|
4318
|
-
* @param {VegaRTETransformOptions} [options] - Deprecated. Optional rendering context (currently unused).
|
|
4811
|
+
* @param {VegaRTETransformOptions} [options] - The conversion options.
|
|
4319
4812
|
* @returns {string} The HTML representation of the content state.
|
|
4320
4813
|
*/
|
|
4321
4814
|
toHtml(options) {
|
|
4322
|
-
if (options
|
|
4323
|
-
|
|
4815
|
+
if (options &&
|
|
4816
|
+
(isNonNullable(options.autoMatchFormat) || isNonNullable(options.skipCustomAnnotations))) {
|
|
4817
|
+
LogUtility.warn(`The 'options' parameter's properties 'autoMatchFormat' and 'skipCustomAnnotations' in toHtml method are deprecated and will be removed in the future.`);
|
|
4324
4818
|
}
|
|
4325
4819
|
if (this.isEmpty()) {
|
|
4326
4820
|
return '';
|
|
4327
4821
|
}
|
|
4328
|
-
return this.children
|
|
4822
|
+
return this.children
|
|
4823
|
+
.map((block) => block.toHtml({ filterInlineStyles: options === null || options === void 0 ? void 0 : options.filterInlineStyles }))
|
|
4824
|
+
.join('');
|
|
4329
4825
|
}
|
|
4330
4826
|
/**
|
|
4331
4827
|
* Checks if the content state is empty.
|
|
@@ -4333,7 +4829,14 @@ class VegaRTEContent {
|
|
|
4333
4829
|
* @returns {boolean} True if the content state is empty, false otherwise.
|
|
4334
4830
|
*/
|
|
4335
4831
|
isEmpty() {
|
|
4336
|
-
|
|
4832
|
+
if (this.children.length === 0) {
|
|
4833
|
+
return true;
|
|
4834
|
+
}
|
|
4835
|
+
if (this.children.length === 1) {
|
|
4836
|
+
const block = this.children[0];
|
|
4837
|
+
return !block.isNotEmpty();
|
|
4838
|
+
}
|
|
4839
|
+
return false;
|
|
4337
4840
|
}
|
|
4338
4841
|
/**
|
|
4339
4842
|
* Internal method to add the block item, remove the block item
|