@heartlandone/vega 2.49.1 → 2.50.0-RTE-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-65622aeb.js → app-globals-8e811cac.js} +6 -6
- package/dist/cjs/{child-nodes-event-prevent-slimmer-cc193ee1.js → child-nodes-event-prevent-slimmer-26ecfb15.js} +1 -1
- package/dist/cjs/{content-state-6a48bcb5.js → code-block-4cd8bccd.js} +1166 -1131
- package/dist/cjs/content-state-6cb98931.js +2496 -0
- package/dist/cjs/{design-token-cba4222e.js → design-token-8b48cb59.js} +1 -1
- package/dist/cjs/{element-appender-slimmer-4a26ecb2.js → element-appender-slimmer-d6b975e6.js} +3 -3
- package/dist/cjs/{event-emit-slimmer-8247249c.js → event-emit-slimmer-ee7a8c06.js} +1 -1
- package/dist/cjs/{form-field-controller-slimmer-4b0af5bc.js → form-field-controller-slimmer-88cbb139.js} +4 -4
- package/dist/cjs/{image-annotation-action-9c2b9c8e.js → image-annotation-action-f36b1a72.js} +65 -35
- package/dist/cjs/{index-c4dec3aa.js → index-4dd54e6b.js} +1 -1
- package/dist/cjs/{index-09acd3c9.js → index-7700600c.js} +9 -0
- package/dist/cjs/index.cjs.js +17 -16
- package/dist/cjs/{internal-vega-event-manager-c9948b59.js → internal-vega-event-manager-58afcde7.js} +1 -0
- package/dist/cjs/loader.cjs.js +11 -9
- package/dist/cjs/{public-rules-10ec636d.js → public-rules-555271e0.js} +8 -6
- package/dist/cjs/{responsive-format-facade-263d49f6.js → responsive-format-facade-8ce41c8a.js} +3 -3
- package/dist/cjs/{rich-text-editor-required-rule-5faded94.js → rich-text-editor-required-rule-d1b38bf7.js} +1 -1
- package/dist/cjs/selection-controller-828990cc.js +765 -0
- package/dist/cjs/string-39438062.js +24 -0
- package/dist/cjs/{string-input-formatter-slimmer-50322824.js → string-input-formatter-slimmer-9e7d7ce2.js} +2 -2
- package/dist/cjs/{style-formatter-ae0ef7fc.js → style-formatter-2294d77f.js} +1 -1
- package/dist/cjs/{sub-state-notify-slimmer-7f437b19.js → sub-state-notify-slimmer-f3ee01b7.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-e90362cd.js → sub-state-observer-slimmer-e1a00b74.js} +1 -1
- package/dist/cjs/{translation-212b1875.js → translation-e5003a00.js} +5 -0
- package/dist/cjs/{translation-slimmer-d1512c6d.js → translation-slimmer-127a0f83.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +11 -9
- package/dist/cjs/vega-app-footer.cjs.entry.js +1 -1
- package/dist/cjs/vega-app-header-button.cjs.entry.js +12 -10
- package/dist/cjs/vega-backdrop.cjs.entry.js +1 -1
- package/dist/cjs/vega-banner.cjs.entry.js +3 -3
- package/dist/cjs/vega-bar-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-box.cjs.entry.js +11 -9
- package/dist/cjs/vega-brand-logo.cjs.entry.js +1 -1
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +4 -4
- package/dist/cjs/vega-button-circle.cjs.entry.js +12 -10
- package/dist/cjs/vega-button-group_2.cjs.entry.js +7 -7
- package/dist/cjs/vega-button-link.cjs.entry.js +4 -4
- package/dist/cjs/vega-button.cjs.entry.js +11 -9
- package/dist/cjs/vega-calendar_3.cjs.entry.js +9 -9
- package/dist/cjs/vega-card.cjs.entry.js +10 -8
- package/dist/cjs/vega-carousel.cjs.entry.js +10 -8
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-chip.cjs.entry.js +12 -10
- package/dist/cjs/vega-code-block.cjs.entry.js +4073 -0
- package/dist/cjs/vega-color-picker.cjs.entry.js +8 -8
- package/dist/cjs/vega-combo-box.cjs.entry.js +9 -9
- package/dist/cjs/vega-counter-badge.cjs.entry.js +1 -1
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +17 -16
- package/dist/cjs/vega-dialog_2.cjs.entry.js +12 -10
- package/dist/cjs/vega-divider.cjs.entry.js +10 -8
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +15 -13
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-error.cjs.entry.js +1 -1
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +9 -9
- package/dist/cjs/vega-flag-icon.cjs.entry.js +10 -8
- package/dist/cjs/vega-flex.cjs.entry.js +11 -9
- package/dist/cjs/vega-font.cjs.entry.js +10 -8
- package/dist/cjs/vega-form.cjs.entry.js +10 -10
- package/dist/cjs/vega-grid.cjs.entry.js +10 -8
- package/dist/cjs/vega-hint.cjs.entry.js +1 -1
- package/dist/cjs/vega-icon.cjs.entry.js +10 -8
- package/dist/cjs/vega-image-uploader.cjs.entry.js +14 -13
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +9 -9
- package/dist/cjs/vega-input-numeric.cjs.entry.js +10 -10
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +12 -11
- package/dist/cjs/vega-input-range.cjs.entry.js +10 -10
- package/dist/cjs/vega-input-select.cjs.entry.js +19 -18
- package/dist/cjs/vega-input.cjs.entry.js +10 -10
- package/dist/cjs/{vega-internal-event-id-bfea9b93.js → vega-internal-event-id-62371952.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +3 -3
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +13 -11
- package/dist/cjs/vega-line-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +9 -7
- package/dist/cjs/vega-page-notification_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-pagination-page-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +4 -4
- package/dist/cjs/vega-pagination.cjs.entry.js +12 -10
- package/dist/cjs/vega-pie-chart.cjs.entry.js +1 -1
- package/dist/cjs/vega-popover_2.cjs.entry.js +11 -9
- package/dist/cjs/vega-progress-tracker.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +9 -9
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +311 -137
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +1225 -2502
- package/dist/cjs/vega-section-title.cjs.entry.js +1 -1
- package/dist/cjs/vega-segment-control.cjs.entry.js +3 -3
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +14 -13
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +12 -10
- package/dist/cjs/vega-signature-capture.cjs.entry.js +14 -13
- package/dist/cjs/{vega-skeleton-loader-controller-db868c98.js → vega-skeleton-loader-controller-83e05b6c.js} +1 -1
- package/dist/cjs/vega-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/vega-slot-container.cjs.entry.js +1 -1
- package/dist/cjs/vega-stepper.cjs.entry.js +9 -9
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-table_8.cjs.entry.js +14 -12
- package/dist/cjs/vega-text.cjs.entry.js +1 -1
- package/dist/cjs/vega-textarea.cjs.entry.js +9 -9
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +15 -14
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +8 -8
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +10 -8
- package/dist/cjs/vega.cjs.js +11 -9
- package/dist/collection/collection-manifest.json +7 -1
- package/dist/collection/components/vega-code-block/assets/copy.js +3 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.js +62 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.js +48 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.js +99 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.js +50 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.js +57 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.js +255 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.js +266 -0
- package/dist/collection/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.js +44 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.js +123 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.js +67 -0
- package/dist/collection/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.js +122 -0
- package/dist/collection/components/vega-code-block/types.js +10 -0
- package/dist/collection/components/vega-code-block/vega-code-block.css +158 -0
- package/dist/collection/components/vega-code-block/vega-code-block.js +399 -0
- package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +5 -5
- package/dist/collection/components/vega-rich-text-content/slimmers/renderers/vega-rich-text-content-renderer.js +2 -0
- package/dist/collection/components/vega-rich-text-content/vega-rich-text-content.css +60 -5
- package/dist/collection/components/vega-rich-text-editor/assets/file-code.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/assets/rectangle-code.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +3 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.js +77 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +4 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/remove-code-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/update-code-block-action.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/bold-annotation.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/code-annotation.js +14 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.js +65 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.js +26 -10
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/image-annotation.js +16 -7
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/indent-annotation.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/italic-annotation.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-annotation.js +12 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/link-group-annotation.js +89 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/list-annotation.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-color-annotation.js +3 -7
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-annotation.js +74 -12
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/underline-annotation.js +9 -9
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +69 -2
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/code-block.js +106 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +15 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +50 -0
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +12 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +66 -2
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +29 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/code-block-node.js +56 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +26 -9
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/node.abstract.js +81 -0
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +15 -2
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.js +5 -22
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +9 -93
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.js +62 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/image-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.js +121 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/list-item-block-renderer.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.js +2 -23
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.js +81 -0
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.js +47 -7
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.js +0 -27
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +19 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.js +155 -15
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.js +6 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.js +3 -20
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.js +59 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/li-to-rte-list-item-block-strategy.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.js +3 -20
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-not-li-child-to-rte-list-item-block.js +7 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.js +69 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.js +4 -7
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +7 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +7 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +25 -10
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.js +64 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +59 -53
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +21 -8
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.js +65 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.js +8 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.js +6 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.js +5 -3
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.js +31 -3
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +3 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +23 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/annotations.test.js +247 -27
- package/dist/collection/components/vega-rich-text-editor/test/dto/blocks/code-block.test.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/content-state.test.js +1793 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/image-node.test.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/nodes/text-node.test.js +41 -4
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.js +61 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.css +7 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +18 -1
- package/dist/collection/helpers/code-format/code-formatter.js +108 -0
- package/dist/collection/helpers/code-format/test/code-formatter.test.js +362 -0
- package/dist/collection/helpers/event-manager/event-id/component-event-id-map.js +2 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.js +47 -0
- package/dist/collection/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.js +46 -0
- package/dist/collection/helpers/translation/locales/en.js +5 -0
- package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +5 -0
- package/dist/collection/polyfill/shadow-selection/shadow-selection-polyfill.js +17 -15
- package/dist/collection/polyfill/shadow-selection/test/shadow-selection-polyfill.test.js +1 -0
- package/dist/collection/polyfill/test-polyfill/unit/methods.js +9 -0
- package/dist/collection/utils/string.js +10 -0
- package/dist/esm/{app-globals-1f8c30e9.js → app-globals-9058ac3b.js} +6 -6
- package/dist/esm/{child-nodes-event-prevent-slimmer-5d45361e.js → child-nodes-event-prevent-slimmer-1142fb79.js} +1 -1
- package/dist/esm/{content-state-dbc9f635.js → code-block-8b5bd928.js} +1141 -1122
- package/dist/esm/content-state-8c3f862b.js +2489 -0
- package/dist/esm/{design-token-0699f0ca.js → design-token-bd436e0d.js} +1 -1
- package/dist/esm/{dom-node-subject-factory-f77cf9cc.js → dom-node-subject-factory-eb6bba5d.js} +1 -1
- package/dist/esm/{dom-node-subject-observer-factory-715dccf9.js → dom-node-subject-observer-factory-6083d518.js} +1 -1
- package/dist/esm/{element-appender-slimmer-96cb54e2.js → element-appender-slimmer-baf5e249.js} +5 -5
- package/dist/esm/{event-emit-slimmer-b7d511f6.js → event-emit-slimmer-480d3b54.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-89a72ee7.js → form-field-controller-slimmer-bfb4034d.js} +6 -6
- package/dist/esm/{image-annotation-action-1aa938ab.js → image-annotation-action-a8b860ad.js} +57 -28
- package/dist/esm/{index-187f71d1.js → index-d0a47531.js} +9 -0
- package/dist/esm/{index-4aa167d6.js → index-db0ec3ee.js} +2 -2
- package/dist/esm/index.js +12 -11
- package/dist/esm/{internal-vega-event-manager-87dc436c.js → internal-vega-event-manager-56c6469a.js} +2 -1
- package/dist/esm/loader.js +12 -10
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/{public-rules-5cf6aa95.js → public-rules-90fbd41a.js} +8 -6
- package/dist/esm/{responsive-format-facade-42f3fcfa.js → responsive-format-facade-827de03a.js} +3 -3
- package/dist/esm/{rich-text-editor-required-rule-6a7cd3ee.js → rich-text-editor-required-rule-0d470d82.js} +1 -1
- package/dist/esm/selection-controller-dd4f4407.js +759 -0
- package/dist/esm/string-a953eafc.js +21 -0
- package/dist/esm/{string-input-formatter-slimmer-c61f82d6.js → string-input-formatter-slimmer-0d30b976.js} +3 -3
- package/dist/esm/{style-formatter-cb00c709.js → style-formatter-232842f5.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-4e3cf09d.js → sub-state-notify-slimmer-04e06501.js} +2 -2
- package/dist/esm/{sub-state-observer-slimmer-be7a6ce3.js → sub-state-observer-slimmer-b4c2ddc3.js} +2 -2
- package/dist/esm/{translation-cf7f020a.js → translation-71e0711d.js} +5 -0
- package/dist/esm/{translation-slimmer-88966d5c.js → translation-slimmer-e6b130bf.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +13 -11
- package/dist/esm/vega-app-footer.entry.js +1 -1
- package/dist/esm/vega-app-header-button.entry.js +14 -12
- package/dist/esm/vega-backdrop.entry.js +1 -1
- package/dist/esm/vega-banner.entry.js +5 -5
- package/dist/esm/vega-bar-chart.entry.js +1 -1
- package/dist/esm/vega-box.entry.js +12 -10
- package/dist/esm/vega-brand-logo.entry.js +1 -1
- package/dist/esm/vega-breadcrumb.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +14 -12
- package/dist/esm/vega-button-group_2.entry.js +9 -9
- package/dist/esm/vega-button-link.entry.js +6 -6
- package/dist/esm/vega-button.entry.js +13 -11
- package/dist/esm/vega-calendar_3.entry.js +11 -11
- package/dist/esm/vega-card.entry.js +11 -9
- package/dist/esm/vega-carousel.entry.js +12 -10
- package/dist/esm/vega-checkbox_2.entry.js +11 -11
- package/dist/esm/vega-chip.entry.js +14 -12
- package/dist/esm/vega-code-block.entry.js +4069 -0
- package/dist/esm/vega-color-picker.entry.js +10 -10
- package/dist/esm/vega-combo-box.entry.js +11 -11
- package/dist/esm/vega-counter-badge.entry.js +1 -1
- package/dist/esm/vega-date-picker_2.entry.js +19 -18
- package/dist/esm/vega-dialog_2.entry.js +14 -12
- package/dist/esm/vega-divider.entry.js +11 -9
- package/dist/esm/vega-dropdown_5.entry.js +17 -15
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-error.entry.js +1 -1
- package/dist/esm/vega-field-label.entry.js +5 -5
- package/dist/esm/vega-file-uploader.entry.js +11 -11
- package/dist/esm/vega-flag-icon.entry.js +11 -9
- package/dist/esm/vega-flex.entry.js +12 -10
- package/dist/esm/vega-font.entry.js +11 -9
- package/dist/esm/vega-form.entry.js +12 -12
- package/dist/esm/vega-grid.entry.js +11 -9
- package/dist/esm/vega-hint.entry.js +1 -1
- package/dist/esm/vega-icon.entry.js +11 -9
- package/dist/esm/vega-image-uploader.entry.js +16 -15
- package/dist/esm/vega-input-credit-card.entry.js +11 -11
- package/dist/esm/vega-input-numeric.entry.js +12 -12
- package/dist/esm/vega-input-phone-number.entry.js +14 -13
- package/dist/esm/vega-input-range.entry.js +12 -12
- package/dist/esm/vega-input-select.entry.js +21 -20
- package/dist/esm/vega-input.entry.js +12 -12
- package/dist/esm/{vega-internal-event-id-85ad403f.js → vega-internal-event-id-820393ad.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +5 -5
- package/dist/esm/vega-left-nav_5.entry.js +15 -13
- package/dist/esm/vega-line-chart.entry.js +1 -1
- package/dist/esm/vega-loader-wrapper_2.entry.js +10 -8
- package/dist/esm/vega-page-notification_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +6 -6
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +6 -6
- package/dist/esm/vega-pagination.entry.js +14 -12
- package/dist/esm/vega-pie-chart.entry.js +1 -1
- package/dist/esm/vega-popover_2.entry.js +13 -11
- package/dist/esm/vega-progress-tracker.entry.js +5 -5
- package/dist/esm/vega-radio_2.entry.js +11 -11
- package/dist/esm/vega-rich-text-content.entry.js +305 -131
- package/dist/esm/vega-rich-text-editor_4.entry.js +1132 -2409
- package/dist/esm/vega-section-title.entry.js +1 -1
- package/dist/esm/vega-segment-control.entry.js +5 -5
- package/dist/esm/vega-selection-chip_2.entry.js +16 -15
- package/dist/esm/vega-selection-tile_2.entry.js +12 -12
- package/dist/esm/vega-sidenav_3.entry.js +14 -12
- package/dist/esm/vega-signature-capture.entry.js +16 -15
- package/dist/esm/{vega-skeleton-loader-controller-c2a8bd27.js → vega-skeleton-loader-controller-878e1b28.js} +1 -1
- package/dist/esm/vega-skeleton.entry.js +1 -1
- package/dist/esm/vega-slot-container.entry.js +1 -1
- package/dist/esm/vega-stepper.entry.js +11 -11
- package/dist/esm/vega-tab-group_2.entry.js +6 -6
- package/dist/esm/vega-table_8.entry.js +16 -14
- package/dist/esm/vega-text.entry.js +1 -1
- package/dist/esm/vega-textarea.entry.js +11 -11
- package/dist/esm/vega-time-picker_2.entry.js +17 -16
- package/dist/esm/vega-toggle-switch.entry.js +10 -10
- package/dist/esm/vega-tooltip_2.entry.js +12 -10
- package/dist/esm/vega.js +12 -10
- package/dist/types/components/vega-code-block/assets/copy.d.ts +3 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/code-highlight-parser.abstract.d.ts +40 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/default-code-highlight-parse-controller.d.ts +19 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/prism-code-highlight-parse-controller.d.ts +43 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-content-parse-controller.d.ts +23 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-focus-controller.d.ts +21 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-input-controller.d.ts +100 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-selection-controller.d.ts +93 -0
- package/dist/types/components/vega-code-block/slimmers/controllers/vega-code-block-value-controller.d.ts +21 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-content-renderer.d.ts +57 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-copy-button-renderer.d.ts +23 -0
- package/dist/types/components/vega-code-block/slimmers/renderers/vega-code-block-renderer.d.ts +50 -0
- package/dist/types/components/vega-code-block/types.d.ts +19 -0
- package/dist/types/components/vega-code-block/vega-code-block.d.ts +116 -0
- package/dist/types/components/vega-rich-text-editor/assets/file-code.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/assets/rectangle-code.d.ts +3 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-horizontal-alignment-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-indent-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/code-node-set-selection-range-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +3 -3
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +4 -5
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-code-block-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/code-block-remove-self-strategy.d.ts +28 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/switch-out-from-code-block-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/update-code-block-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/custom-style-annotation-action.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/actions/remove-code-block-action.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/switch-out-from-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/transform-to-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/update-code-block-action.d.ts +14 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/annotation.abstract.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/block-annotation.abstract.d.ts +17 -4
- package/dist/types/components/vega-rich-text-editor/dto/annotations/bold-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/clear-formatting-annotation.d.ts +2 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/code-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/common-annotation.abstract.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-attribute-annotation.d.ts +43 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-class-annotation.d.ts +40 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/custom-style-annotation.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/horizontal-alignment-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/image-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/indent-annotation.d.ts +5 -1
- package/dist/types/components/vega-rich-text-editor/dto/annotations/italic-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-annotation.d.ts +6 -4
- package/dist/types/components/vega-rich-text-editor/dto/annotations/link-group-annotation.d.ts +48 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/list-annotation.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/node-annotation.abstract.d.ts +15 -3
- package/dist/types/components/vega-rich-text-editor/dto/annotations/strikethrough-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-color-annotation.d.ts +3 -7
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-annotation.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/annotations/underline-annotation.d.ts +5 -9
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +39 -4
- package/dist/types/components/vega-rich-text-editor/dto/blocks/code-block.d.ts +56 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +20 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +14 -4
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/code-block-node.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/image-node.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/dto/nodes/node.abstract.d.ts +46 -2
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +7 -2
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-renderer.abstract.d.ts +4 -11
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +7 -5
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/code-block-renderer.d.ts +39 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/link-wrapper-renderer.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/text-block-renderer.d.ts +0 -1
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/code-block-node-renderer.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/image-node-renderer.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/node-renderer.abstract.d.ts +1 -15
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +65 -26
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract.d.ts +64 -6
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy-processor.d.ts +3 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/element-to-rte-image-block-strategy.abstract.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/img-to-rte-image-block-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/inline-block-to-rte-text-block-strategy.d.ts +30 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.d.ts +31 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ol-to-rte-list-block-strategy.d.ts +2 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/span-img-to-rte-image-block-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/ul-to-rte-list-block-strategy.d.ts +2 -3
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.d.ts +42 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/vega-image-to-rte-image-block-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +7 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/internal-code-block-selection-controller.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +17 -23
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +6 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/toolbar-renderer.d.ts +2 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bold-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-numbers-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/bullets-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/bullets-numbers/numbers-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/clear-style-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-block-toolbar-button-slimmer.d.ts +22 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/code-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/center-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/horizontal-alignment-toolbar-button-slimmer.d.ts +4 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/justify-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/left-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/horizontal-alignment/right-align-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/italic-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/less-indent-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/link-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/more-indent-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/strikethrough-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-color-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/text-styles-toolbar-button-slimmer.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/toolbar-button-slimmer.abstract.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/underline-toolbar-button-slimmer.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/visual-mode-toolbar-button-slimmer.abstract.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-renderer.d.ts +8 -2
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/code-block-strategy-registry.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/blocks/code-block.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/content-state.test.d.ts +1 -1
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/jira-code-to-rte-code-block-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/element-to-dto-strategy/vega-code-block-to-rte-code-block-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +7 -0
- package/dist/types/components.d.ts +95 -0
- package/dist/types/helpers/code-format/code-formatter.d.ts +34 -0
- package/dist/types/helpers/code-format/test/code-formatter.test.d.ts +1 -0
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/slimmers/auto-run-when-re-render-task-queue-slimmer.abstract.d.ts +20 -0
- package/dist/types/helpers/slimmers/test/auto-run-when-re-render-task-queue-slimmer.test.d.ts +1 -0
- package/dist/types/helpers/translation/interface.d.ts +6 -1
- package/dist/types/polyfill/shadow-selection/shadow-selection-polyfill.d.ts +26 -0
- package/dist/types/types/components.type.d.ts +1 -0
- package/dist/types/utils/string.d.ts +7 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-0104207d.entry.js +1 -0
- package/dist/vega/p-010f1715.entry.js +1 -0
- package/dist/vega/p-01593f9d.js +1 -0
- package/dist/vega/p-020b04ed.js +1 -0
- package/dist/vega/p-02841589.js +1 -0
- package/dist/vega/p-03cfb331.entry.js +9 -0
- package/dist/vega/{p-b649e86e.entry.js → p-0bff8716.entry.js} +1 -1
- package/dist/vega/p-1056a049.entry.js +1 -0
- package/dist/vega/p-10e41bbe.js +1 -0
- package/dist/vega/{p-83ef9e7d.entry.js → p-12e6173c.entry.js} +1 -1
- package/dist/vega/{p-54add0d2.js → p-1397ba3f.js} +1 -1
- package/dist/vega/p-13d9a1fd.entry.js +1 -0
- package/dist/vega/p-13eae47f.entry.js +1 -0
- package/dist/vega/p-1630864e.entry.js +1 -0
- package/dist/vega/p-1b335e30.entry.js +1 -0
- package/dist/vega/{p-8ade44bf.js → p-1e194737.js} +1 -1
- package/dist/vega/{p-252e42c7.entry.js → p-1f346008.entry.js} +1 -1
- package/dist/vega/p-1f86ab76.entry.js +1 -0
- package/dist/vega/p-1fe746ab.entry.js +1 -0
- package/dist/vega/{p-8c388b58.entry.js → p-211c028f.entry.js} +1 -1
- package/dist/vega/p-21d26bb4.js +2 -0
- package/dist/vega/{p-b351ace3.entry.js → p-23e6f2b2.entry.js} +1 -1
- package/dist/vega/p-268aea63.js +1 -0
- package/dist/vega/{p-a01f149d.entry.js → p-27ccf34d.entry.js} +1 -1
- package/dist/vega/{p-913eb7f9.entry.js → p-29f9be26.entry.js} +1 -1
- package/dist/vega/{p-27003a81.entry.js → p-30dcf606.entry.js} +1 -1
- package/dist/vega/{p-89ab72e3.js → p-3c20ae84.js} +1 -1
- package/dist/vega/p-4172fb81.js +1 -0
- package/dist/vega/{p-45f696b4.js → p-419697c6.js} +1 -1
- package/dist/vega/p-427e4cee.entry.js +1 -0
- package/dist/vega/p-4604ed0e.entry.js +1 -0
- package/dist/vega/{p-8d283666.js → p-4ab3df00.js} +1 -1
- package/dist/vega/{p-72ecfd40.js → p-4e8fb53a.js} +1 -1
- package/dist/vega/p-50a3ae3d.js +1 -0
- package/dist/vega/{p-b847a143.entry.js → p-50b80d76.entry.js} +1 -1
- package/dist/vega/p-531ffb18.entry.js +1 -0
- package/dist/vega/p-53daeb45.entry.js +1 -0
- package/dist/vega/p-54fdd401.entry.js +1 -0
- package/dist/vega/{p-47ff95ba.entry.js → p-5741ecf0.entry.js} +1 -1
- package/dist/vega/{p-6cabdb36.js → p-58f8928a.js} +1 -1
- package/dist/vega/{p-4a32a6c0.entry.js → p-5c4cb804.entry.js} +1 -1
- package/dist/vega/{p-a46bc9f1.entry.js → p-5ce386c8.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-0079088b.entry.js → p-5fd5a538.entry.js} +1 -1
- package/dist/vega/{p-0969877b.entry.js → p-64f452fe.entry.js} +1 -1
- package/dist/vega/p-66759f4e.js +1 -0
- package/dist/vega/{p-bc2dd43d.js → p-6ea42854.js} +1 -1
- package/dist/vega/p-70f25341.entry.js +1 -0
- package/dist/vega/{p-ec1f2d21.entry.js → p-737bccb9.entry.js} +1 -1
- package/dist/vega/{p-bcb10ae3.entry.js → p-7503fe08.entry.js} +1 -1
- package/dist/vega/{p-46714da3.entry.js → p-7b0a4688.entry.js} +1 -1
- package/dist/vega/p-7def7b74.entry.js +1 -0
- package/dist/vega/{p-48517a5d.entry.js → p-7f5a85c6.entry.js} +1 -1
- package/dist/vega/p-825ae7c4.js +1 -0
- package/dist/vega/p-831c4144.entry.js +1 -0
- package/dist/vega/p-85dc08b4.entry.js +1 -0
- package/dist/vega/{p-a821bcf3.js → p-86782109.js} +1 -1
- package/dist/vega/p-87459914.js +1 -0
- package/dist/vega/{p-1971d980.entry.js → p-87a1fc77.entry.js} +1 -1
- package/dist/vega/p-89565247.entry.js +1 -0
- package/dist/vega/{p-7088ead9.entry.js → p-89e915e9.entry.js} +1 -1
- package/dist/vega/{p-81fbfb6d.entry.js → p-8aa7e56e.entry.js} +1 -1
- package/dist/vega/p-94263ece.entry.js +1 -0
- package/dist/vega/{p-d0007822.entry.js → p-9524e48a.entry.js} +1 -1
- package/dist/vega/{p-147e3cbd.entry.js → p-991b4717.entry.js} +1 -1
- package/dist/vega/{p-647025dd.entry.js → p-99b9b320.entry.js} +1 -1
- package/dist/vega/{p-aea89be5.entry.js → p-9ba14b7c.entry.js} +1 -1
- package/dist/vega/p-9cb79f8d.entry.js +1 -0
- package/dist/vega/p-9e3f52f0.entry.js +1 -0
- package/dist/vega/{p-6586e2a2.entry.js → p-a0e122a6.entry.js} +1 -1
- package/dist/vega/{p-9803042f.entry.js → p-b0fe6c0f.entry.js} +1 -1
- package/dist/vega/{p-b2bca332.entry.js → p-b518e1a0.entry.js} +1 -1
- package/dist/vega/p-b538e81a.entry.js +1 -0
- package/dist/vega/p-b824baf7.entry.js +1 -0
- package/dist/vega/{p-2fadef27.entry.js → p-b959b4d4.entry.js} +1 -1
- package/dist/vega/{p-54f17c2e.entry.js → p-bb4f0fa1.entry.js} +1 -1
- package/dist/vega/{p-2da83c2a.js → p-bbb39d6f.js} +1 -1
- package/dist/vega/{p-cfda64fd.entry.js → p-bc8fd0ee.entry.js} +1 -1
- package/dist/vega/p-bcaf8375.entry.js +1 -0
- package/dist/vega/{p-02d7d948.entry.js → p-bec90ff3.entry.js} +1 -1
- package/dist/vega/p-c6b94dde.entry.js +1 -0
- package/dist/vega/{p-c754b32c.js → p-ce6b62c4.js} +1 -1
- package/dist/vega/{p-5e34ea25.entry.js → p-d00fbc11.entry.js} +1 -1
- package/dist/vega/{p-10a40dfb.entry.js → p-d2a2af2c.entry.js} +1 -1
- package/dist/vega/p-d64b20c2.js +1 -0
- package/dist/vega/p-da779940.entry.js +1 -0
- package/dist/vega/{p-a7dcb2a3.js → p-db910162.js} +1 -1
- package/dist/vega/{p-6f81fe1e.js → p-e1a2a701.js} +1 -1
- package/dist/vega/p-e3694aa5.entry.js +1 -0
- package/dist/vega/p-e7318c4c.entry.js +1 -0
- package/dist/vega/{p-a5c39ba2.entry.js → p-e8fc027e.entry.js} +1 -1
- package/dist/vega/{p-6a830bc5.entry.js → p-e92ecb78.entry.js} +1 -1
- package/dist/vega/p-e969c3f4.entry.js +1 -0
- package/dist/vega/{p-61eb7f32.entry.js → p-ec8b7f01.entry.js} +1 -1
- package/dist/vega/p-eed9bda2.entry.js +1 -0
- package/dist/vega/p-f4c54c98.entry.js +1 -0
- package/dist/vega/{p-5160a6b9.entry.js → p-f5fc80bc.entry.js} +1 -1
- package/dist/vega/p-f67be7ef.js +1 -0
- package/dist/vega/{p-5e3a15a1.js → p-f9fafc55.js} +1 -1
- package/dist/vega/{p-27e56c67.entry.js → p-fc21fb2d.entry.js} +1 -1
- package/dist/vega/p-fed9220b.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +2 -1
- package/dist/cjs/string-21427167.js +0 -13
- package/dist/esm/string-be824360.js +0 -11
- package/dist/vega/p-06adb37e.entry.js +0 -1
- package/dist/vega/p-06c5fe97.entry.js +0 -1
- package/dist/vega/p-0bb29d98.js +0 -1
- package/dist/vega/p-0ed7a098.entry.js +0 -1
- package/dist/vega/p-0f6b3a89.entry.js +0 -1
- package/dist/vega/p-136f665b.entry.js +0 -1
- package/dist/vega/p-1503f791.js +0 -1
- package/dist/vega/p-16fd7c32.js +0 -1
- package/dist/vega/p-1a263af1.entry.js +0 -1
- package/dist/vega/p-1af4771a.entry.js +0 -1
- package/dist/vega/p-1c298d5a.js +0 -2
- package/dist/vega/p-1c63afd2.entry.js +0 -1
- package/dist/vega/p-1e05b7b4.entry.js +0 -1
- package/dist/vega/p-1ea863a6.entry.js +0 -1
- package/dist/vega/p-271b30b9.entry.js +0 -1
- package/dist/vega/p-2d1d4f33.entry.js +0 -1
- package/dist/vega/p-353b3ded.entry.js +0 -1
- package/dist/vega/p-44b0a005.js +0 -1
- package/dist/vega/p-4e76904e.entry.js +0 -1
- package/dist/vega/p-4ec0d36f.entry.js +0 -1
- package/dist/vega/p-5c954088.entry.js +0 -1
- package/dist/vega/p-646a9198.entry.js +0 -1
- package/dist/vega/p-6d7d923b.js +0 -1
- package/dist/vega/p-6e898779.js +0 -1
- package/dist/vega/p-77492977.entry.js +0 -1
- package/dist/vega/p-804f71b3.js +0 -1
- package/dist/vega/p-8789d34d.entry.js +0 -1
- package/dist/vega/p-8813c0ac.entry.js +0 -1
- package/dist/vega/p-8a85c7af.entry.js +0 -1
- package/dist/vega/p-8ba43640.entry.js +0 -1
- package/dist/vega/p-98c64d77.entry.js +0 -1
- package/dist/vega/p-9f3539a4.entry.js +0 -1
- package/dist/vega/p-b42aea55.entry.js +0 -1
- package/dist/vega/p-b5d70ee0.entry.js +0 -1
- package/dist/vega/p-bf1894ec.js +0 -1
- package/dist/vega/p-bfb344e1.entry.js +0 -1
- package/dist/vega/p-c9a4e79a.entry.js +0 -1
- package/dist/vega/p-dbc82247.js +0 -1
- package/dist/vega/p-e2e36d2b.entry.js +0 -1
- package/dist/vega/p-ef8272b5.entry.js +0 -1
- package/dist/vega/p-f4c1d961.js +0 -1
- package/dist/vega/p-f5279deb.entry.js +0 -1
- package/dist/vega/p-f8033cd3.entry.js +0 -1
- package/dist/vega/p-fe63bd50.entry.js +0 -1
|
@@ -4,6 +4,7 @@ import { RTEImageBlock } from '../../dto/blocks/image-block';
|
|
|
4
4
|
import { RTEListBlock } from '../../dto/blocks/list-block';
|
|
5
5
|
import { BlockAnnotationTypeEnum } from '../../dto/annotations/block-annotation.abstract';
|
|
6
6
|
import { NodeAnnotationTypeEnum } from '../../dto/annotations/node-annotation.abstract';
|
|
7
|
+
import '../../../../polyfill/test-polyfill/unit/index';
|
|
7
8
|
describe('content state', () => {
|
|
8
9
|
it('fromJSON should work as expect', () => {
|
|
9
10
|
expect(() => VegaRTEContent.fromJSON([
|
|
@@ -285,4 +286,1796 @@ describe('content state', () => {
|
|
|
285
286
|
expect(content.findNodeById('not-exist')).toBeNull();
|
|
286
287
|
});
|
|
287
288
|
});
|
|
289
|
+
describe('toHtml', () => {
|
|
290
|
+
it('should convert paragraph to HTML correctly', () => {
|
|
291
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
292
|
+
{
|
|
293
|
+
id: '1',
|
|
294
|
+
type: 'paragraph',
|
|
295
|
+
annotations: { textStyle: 'paragraph' },
|
|
296
|
+
nodes: [{ id: '1-1', type: 'text', text: 'This is a paragraph' }],
|
|
297
|
+
},
|
|
298
|
+
]);
|
|
299
|
+
expect(contentState.toHtml()).toEqualHtml(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;margin-top: 0px; margin-bottom: 0px;"><span>This is a paragraph</span></p>`);
|
|
300
|
+
});
|
|
301
|
+
it('should convert text node with annotations to HTML correctly', () => {
|
|
302
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
303
|
+
{
|
|
304
|
+
id: '1',
|
|
305
|
+
type: 'paragraph',
|
|
306
|
+
annotations: { textStyle: 'paragraph' },
|
|
307
|
+
nodes: [
|
|
308
|
+
{
|
|
309
|
+
id: '1-1',
|
|
310
|
+
type: 'text',
|
|
311
|
+
text: 'This is a paragraph.',
|
|
312
|
+
annotations: { bold: true },
|
|
313
|
+
},
|
|
314
|
+
{ id: '1-2', type: 'text', text: ' code', annotations: { code: true } },
|
|
315
|
+
{ id: '1-3', type: 'text', text: ' text', annotations: { code: false } },
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
]);
|
|
319
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">This is a paragraph.</span><code style="font-family: Roboto Mono;white-space: pre-wrap;"> code</code><span> text</span></p>`);
|
|
320
|
+
});
|
|
321
|
+
it('should convert text block with annotations to HTML with inline styles correctly', () => {
|
|
322
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
323
|
+
{
|
|
324
|
+
id: '1',
|
|
325
|
+
type: 'paragraph',
|
|
326
|
+
annotations: { textStyle: 'paragraph', textAlign: 'right' },
|
|
327
|
+
nodes: [
|
|
328
|
+
{
|
|
329
|
+
id: '1-1',
|
|
330
|
+
type: 'text',
|
|
331
|
+
text: 'This is a paragraph',
|
|
332
|
+
annotations: { bold: true, underline: true },
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
},
|
|
336
|
+
]);
|
|
337
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span style="font-weight: 700;text-decoration: underline;">This is a paragraph</span></p>`);
|
|
338
|
+
});
|
|
339
|
+
it('should convert image block to HTML correctly', () => {
|
|
340
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
341
|
+
{
|
|
342
|
+
id: '1',
|
|
343
|
+
type: 'image',
|
|
344
|
+
nodes: [{ id: '1-1', type: 'image', url: 'https://example.com/image.jpg' }],
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
id: '2',
|
|
348
|
+
type: 'image',
|
|
349
|
+
nodes: [
|
|
350
|
+
{
|
|
351
|
+
id: '2-1',
|
|
352
|
+
type: 'image',
|
|
353
|
+
url: 'https://example.com/image.jpg',
|
|
354
|
+
annotations: {
|
|
355
|
+
alt: 'example',
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
]);
|
|
361
|
+
expect(contentState.toHtml()).toEqual(`<div><img style="vertical-align: bottom;width: 50%;" src="https://example.com/image.jpg" data-size="md"></div><div><img style="vertical-align: bottom;width: 50%;" alt="example" src="https://example.com/image.jpg" data-size="md"></div>`);
|
|
362
|
+
});
|
|
363
|
+
it('should convert bullet list block to HTML correctly', () => {
|
|
364
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
365
|
+
{
|
|
366
|
+
id: '1',
|
|
367
|
+
type: 'bullet-list',
|
|
368
|
+
blocks: [
|
|
369
|
+
{
|
|
370
|
+
id: '1-1',
|
|
371
|
+
type: 'list-item',
|
|
372
|
+
nodes: [{ id: '1-1-1', type: 'text', text: 'Item 1' }],
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
id: '1-2',
|
|
376
|
+
type: 'list-item',
|
|
377
|
+
nodes: [{ id: '1-2-1', type: 'text', text: 'Item 2' }],
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
},
|
|
381
|
+
]);
|
|
382
|
+
expect(contentState.toHtml()).toEqual(`<ul style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ul>`);
|
|
383
|
+
});
|
|
384
|
+
it('should convert number list block to HTML correctly', () => {
|
|
385
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
386
|
+
{
|
|
387
|
+
id: '1',
|
|
388
|
+
type: 'number-list',
|
|
389
|
+
blocks: [
|
|
390
|
+
{
|
|
391
|
+
id: '1-1',
|
|
392
|
+
type: 'list-item',
|
|
393
|
+
nodes: [{ id: '1-1-1', type: 'text', text: 'Item 1' }],
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
id: '1-2',
|
|
397
|
+
type: 'list-item',
|
|
398
|
+
nodes: [{ id: '1-2-1', type: 'text', text: 'Item 2' }],
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
},
|
|
402
|
+
]);
|
|
403
|
+
expect(contentState.toHtml()).toEqual(`<ol style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ol>`);
|
|
404
|
+
});
|
|
405
|
+
it('should convert code block to HTML correctly', () => {
|
|
406
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
407
|
+
{
|
|
408
|
+
id: '1750424321364',
|
|
409
|
+
type: 'code-block',
|
|
410
|
+
content: '<div>This is a Plain Text.</div>',
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: '1750424321364',
|
|
414
|
+
type: 'code-block',
|
|
415
|
+
content: '<div>This is an HTML.</div>',
|
|
416
|
+
language: 'html',
|
|
417
|
+
},
|
|
418
|
+
]);
|
|
419
|
+
expect(contentState.toHtml()).toEqual(`<pre data-language="plainText" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px"><code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'><div>This is a Plain Text.</div></code></pre><pre data-language="html" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px"><code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'><div>This is an HTML.</div></code></pre>`);
|
|
420
|
+
});
|
|
421
|
+
it('should convert text with the link annotations to HTML correctly', () => {
|
|
422
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
423
|
+
{
|
|
424
|
+
id: '1',
|
|
425
|
+
type: 'paragraph',
|
|
426
|
+
annotations: { textStyle: 'paragraph' },
|
|
427
|
+
nodes: [
|
|
428
|
+
{
|
|
429
|
+
id: '1-1',
|
|
430
|
+
type: 'text',
|
|
431
|
+
text: 'This is a link',
|
|
432
|
+
annotations: {
|
|
433
|
+
link: { href: 'https://example.com', groupKey: 'link-group-1' },
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
]);
|
|
439
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><a href="https://example.com" target="_blank" style="color: rgba(var(--v-text-link, 19, 98, 226, 1));"><span>This is a link</span></a></p>`);
|
|
440
|
+
});
|
|
441
|
+
it('should convert a complex value to HTML correctly', () => {
|
|
442
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
443
|
+
{
|
|
444
|
+
id: '1750041983988',
|
|
445
|
+
annotations: {
|
|
446
|
+
textStyle: 'title',
|
|
447
|
+
},
|
|
448
|
+
type: 'title',
|
|
449
|
+
nodes: [
|
|
450
|
+
{
|
|
451
|
+
id: '1750041978250',
|
|
452
|
+
annotations: {
|
|
453
|
+
bold: true,
|
|
454
|
+
},
|
|
455
|
+
type: 'text',
|
|
456
|
+
text: 'Title',
|
|
457
|
+
},
|
|
458
|
+
],
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: '1750041984711',
|
|
462
|
+
annotations: {
|
|
463
|
+
textStyle: 'subtitle',
|
|
464
|
+
},
|
|
465
|
+
type: 'subtitle',
|
|
466
|
+
nodes: [
|
|
467
|
+
{
|
|
468
|
+
id: '1750041980352',
|
|
469
|
+
type: 'text',
|
|
470
|
+
text: 'Subtitle',
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
id: '1750041981840',
|
|
476
|
+
annotations: {
|
|
477
|
+
textStyle: 'heading-1',
|
|
478
|
+
},
|
|
479
|
+
type: 'heading-1',
|
|
480
|
+
nodes: [
|
|
481
|
+
{
|
|
482
|
+
id: '1750041978195',
|
|
483
|
+
annotations: {
|
|
484
|
+
bold: true,
|
|
485
|
+
},
|
|
486
|
+
type: 'text',
|
|
487
|
+
text: 'Heading 1',
|
|
488
|
+
},
|
|
489
|
+
],
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
id: '1750041975899',
|
|
493
|
+
annotations: {
|
|
494
|
+
textStyle: 'heading-2',
|
|
495
|
+
},
|
|
496
|
+
type: 'heading-2',
|
|
497
|
+
nodes: [
|
|
498
|
+
{
|
|
499
|
+
id: '1750041981732',
|
|
500
|
+
annotations: {
|
|
501
|
+
bold: true,
|
|
502
|
+
},
|
|
503
|
+
type: 'text',
|
|
504
|
+
text: 'Heading 2',
|
|
505
|
+
},
|
|
506
|
+
],
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: '1750041983133',
|
|
510
|
+
annotations: {
|
|
511
|
+
textStyle: 'heading-3',
|
|
512
|
+
},
|
|
513
|
+
type: 'heading-3',
|
|
514
|
+
nodes: [
|
|
515
|
+
{
|
|
516
|
+
id: '1750041980106',
|
|
517
|
+
annotations: {
|
|
518
|
+
bold: true,
|
|
519
|
+
},
|
|
520
|
+
type: 'text',
|
|
521
|
+
text: 'Heading 3',
|
|
522
|
+
},
|
|
523
|
+
],
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: '1750041984506',
|
|
527
|
+
annotations: {
|
|
528
|
+
textStyle: 'paragraph',
|
|
529
|
+
},
|
|
530
|
+
type: 'paragraph',
|
|
531
|
+
nodes: [
|
|
532
|
+
{
|
|
533
|
+
id: '1750041974956',
|
|
534
|
+
annotations: {
|
|
535
|
+
bold: false,
|
|
536
|
+
},
|
|
537
|
+
type: 'text',
|
|
538
|
+
text: 'Paragraph',
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
id: '1750041983082',
|
|
544
|
+
annotations: {
|
|
545
|
+
textStyle: 'paragraph',
|
|
546
|
+
},
|
|
547
|
+
type: 'paragraph',
|
|
548
|
+
nodes: [
|
|
549
|
+
{
|
|
550
|
+
id: '1750041983587',
|
|
551
|
+
annotations: {
|
|
552
|
+
bold: true,
|
|
553
|
+
},
|
|
554
|
+
type: 'text',
|
|
555
|
+
text: 'Bold text',
|
|
556
|
+
},
|
|
557
|
+
],
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: '1750041980108',
|
|
561
|
+
annotations: {
|
|
562
|
+
textStyle: 'paragraph',
|
|
563
|
+
},
|
|
564
|
+
type: 'paragraph',
|
|
565
|
+
nodes: [
|
|
566
|
+
{
|
|
567
|
+
id: '1750041983935',
|
|
568
|
+
annotations: {
|
|
569
|
+
italic: true,
|
|
570
|
+
},
|
|
571
|
+
type: 'text',
|
|
572
|
+
text: 'Italic text',
|
|
573
|
+
},
|
|
574
|
+
],
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: '1750041978100',
|
|
578
|
+
annotations: {
|
|
579
|
+
textStyle: 'paragraph',
|
|
580
|
+
},
|
|
581
|
+
type: 'paragraph',
|
|
582
|
+
nodes: [
|
|
583
|
+
{
|
|
584
|
+
id: '1750041978568',
|
|
585
|
+
annotations: {
|
|
586
|
+
underline: true,
|
|
587
|
+
},
|
|
588
|
+
type: 'text',
|
|
589
|
+
text: 'Underline text',
|
|
590
|
+
},
|
|
591
|
+
],
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
id: '1750041984220',
|
|
595
|
+
annotations: {
|
|
596
|
+
textStyle: 'paragraph',
|
|
597
|
+
},
|
|
598
|
+
type: 'paragraph',
|
|
599
|
+
nodes: [
|
|
600
|
+
{
|
|
601
|
+
id: '1750041982817',
|
|
602
|
+
annotations: {
|
|
603
|
+
underline: true,
|
|
604
|
+
},
|
|
605
|
+
type: 'text',
|
|
606
|
+
text: 'Strikethrough text',
|
|
607
|
+
},
|
|
608
|
+
],
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
id: '1750041979619',
|
|
612
|
+
annotations: {
|
|
613
|
+
textStyle: 'paragraph',
|
|
614
|
+
},
|
|
615
|
+
type: 'paragraph',
|
|
616
|
+
nodes: [
|
|
617
|
+
{
|
|
618
|
+
id: '1750041982051',
|
|
619
|
+
annotations: {
|
|
620
|
+
code: true,
|
|
621
|
+
},
|
|
622
|
+
type: 'text',
|
|
623
|
+
text: 'Code text',
|
|
624
|
+
},
|
|
625
|
+
],
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
id: '1750041977487',
|
|
629
|
+
annotations: {
|
|
630
|
+
textStyle: 'paragraph',
|
|
631
|
+
},
|
|
632
|
+
type: 'paragraph',
|
|
633
|
+
nodes: [
|
|
634
|
+
{
|
|
635
|
+
id: '1750041983700',
|
|
636
|
+
annotations: {
|
|
637
|
+
textColor: 'red',
|
|
638
|
+
},
|
|
639
|
+
type: 'text',
|
|
640
|
+
text: 'Color text',
|
|
641
|
+
},
|
|
642
|
+
],
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
id: '1750041981507',
|
|
646
|
+
annotations: {
|
|
647
|
+
textStyle: 'paragraph',
|
|
648
|
+
textAlign: 'left',
|
|
649
|
+
},
|
|
650
|
+
type: 'paragraph',
|
|
651
|
+
nodes: [
|
|
652
|
+
{
|
|
653
|
+
id: '1750041979308',
|
|
654
|
+
type: 'text',
|
|
655
|
+
text: 'Left align',
|
|
656
|
+
},
|
|
657
|
+
],
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
id: '1750041977501',
|
|
661
|
+
annotations: {
|
|
662
|
+
textStyle: 'paragraph',
|
|
663
|
+
textAlign: 'right',
|
|
664
|
+
},
|
|
665
|
+
type: 'paragraph',
|
|
666
|
+
nodes: [
|
|
667
|
+
{
|
|
668
|
+
id: '1750041976836',
|
|
669
|
+
type: 'text',
|
|
670
|
+
text: 'Right align',
|
|
671
|
+
},
|
|
672
|
+
],
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
id: '1750041983771',
|
|
676
|
+
type: 'bullet-list',
|
|
677
|
+
blocks: [
|
|
678
|
+
{
|
|
679
|
+
id: '1750041977027',
|
|
680
|
+
annotations: {
|
|
681
|
+
textStyle: 'paragraph',
|
|
682
|
+
},
|
|
683
|
+
type: 'list-item',
|
|
684
|
+
nodes: [
|
|
685
|
+
{
|
|
686
|
+
id: '1750041982061',
|
|
687
|
+
type: 'text',
|
|
688
|
+
text: 'list item 1',
|
|
689
|
+
},
|
|
690
|
+
],
|
|
691
|
+
children: [],
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
id: '1750041975174',
|
|
695
|
+
annotations: {
|
|
696
|
+
textStyle: 'paragraph',
|
|
697
|
+
},
|
|
698
|
+
type: 'list-item',
|
|
699
|
+
nodes: [
|
|
700
|
+
{
|
|
701
|
+
id: '1750041978832',
|
|
702
|
+
type: 'text',
|
|
703
|
+
text: 'list item 2',
|
|
704
|
+
},
|
|
705
|
+
],
|
|
706
|
+
children: [],
|
|
707
|
+
},
|
|
708
|
+
],
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
id: '1750041992884',
|
|
712
|
+
annotations: {
|
|
713
|
+
textStyle: 'paragraph',
|
|
714
|
+
indent: 2,
|
|
715
|
+
},
|
|
716
|
+
type: 'paragraph',
|
|
717
|
+
nodes: [
|
|
718
|
+
{
|
|
719
|
+
id: '1750041987297',
|
|
720
|
+
type: 'text',
|
|
721
|
+
text: 'More indent',
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
id: '1750042019645',
|
|
727
|
+
annotations: {
|
|
728
|
+
textStyle: 'paragraph',
|
|
729
|
+
},
|
|
730
|
+
type: 'paragraph',
|
|
731
|
+
nodes: [
|
|
732
|
+
{
|
|
733
|
+
id: '1750042020364',
|
|
734
|
+
annotations: {
|
|
735
|
+
link: {
|
|
736
|
+
href: 'https://www.google.com',
|
|
737
|
+
groupKey: '1750042026536',
|
|
738
|
+
},
|
|
739
|
+
},
|
|
740
|
+
type: 'text',
|
|
741
|
+
text: 'Link text',
|
|
742
|
+
},
|
|
743
|
+
],
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
id: '1750042030016',
|
|
747
|
+
annotations: {
|
|
748
|
+
textStyle: 'paragraph',
|
|
749
|
+
},
|
|
750
|
+
type: 'paragraph',
|
|
751
|
+
nodes: [
|
|
752
|
+
{
|
|
753
|
+
id: '1750042032454',
|
|
754
|
+
type: 'text',
|
|
755
|
+
text: '',
|
|
756
|
+
},
|
|
757
|
+
],
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
id: '1750041979184',
|
|
761
|
+
annotations: {
|
|
762
|
+
textStyle: 'paragraph',
|
|
763
|
+
},
|
|
764
|
+
type: 'paragraph',
|
|
765
|
+
nodes: [
|
|
766
|
+
{
|
|
767
|
+
id: '1750041981796',
|
|
768
|
+
type: 'text',
|
|
769
|
+
text: '',
|
|
770
|
+
},
|
|
771
|
+
],
|
|
772
|
+
},
|
|
773
|
+
]);
|
|
774
|
+
expect(contentState.toHtml()).toEqual(`<div style="font-family: Inter;font-size: 36px;line-height: 40px;font-weight: 500;"><span style="font-weight: 700;">Title</span></div><div style="font-family: Inter;font-size: 28px;line-height: 32px;font-weight: 500;"><span>Subtitle</span></div><h1 style="font-family: Inter;font-size: 22px;line-height: 24px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 1</span></h1><h2 style="font-family: Inter;font-size: 20px;line-height: 24px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 2</span></h2><h3 style="font-family: Inter;font-size: 18px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Heading 3</span></h3><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Paragraph</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-weight: 700;">Bold text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="font-style: italic;">Italic text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="text-decoration: underline;">Underline text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="text-decoration: underline;">Strikethrough text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><code style="font-family: Roboto Mono;white-space: pre-wrap;">Code text</code></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span style="color: #BD2947;">Color text</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: left;"><span>Left align</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span>Right align</span></p><ul style="padding-left: 8px;margin-left: 16px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>list item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>list item 2</span></li></ul><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;margin-left: 32px;"><span>More indent</span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><a href="https://www.google.com" target="_blank" style="color: rgba(var(--v-text-link, 19, 98, 226, 1));"><span>Link text</span></a></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span></span></p><p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span></span></p>`);
|
|
775
|
+
});
|
|
776
|
+
it('should convert paragraph with custom attributes to HTML correctly', () => {
|
|
777
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
778
|
+
{
|
|
779
|
+
id: '1',
|
|
780
|
+
type: 'paragraph',
|
|
781
|
+
annotations: {
|
|
782
|
+
textStyle: 'paragraph',
|
|
783
|
+
customAttribute: {
|
|
784
|
+
id: 'p-element',
|
|
785
|
+
dir: 'dir-p',
|
|
786
|
+
},
|
|
787
|
+
},
|
|
788
|
+
nodes: [
|
|
789
|
+
{
|
|
790
|
+
id: '1-1',
|
|
791
|
+
type: 'text',
|
|
792
|
+
text: 'This is a paragraph',
|
|
793
|
+
annotations: {
|
|
794
|
+
customAttribute: {
|
|
795
|
+
id: 'span-element',
|
|
796
|
+
dir: 'dir-span',
|
|
797
|
+
},
|
|
798
|
+
},
|
|
799
|
+
},
|
|
800
|
+
],
|
|
801
|
+
},
|
|
802
|
+
]);
|
|
803
|
+
expect(contentState.toHtml()).toEqualHtml(`<p id="p-element" dir="dir-p" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500; margin-top: 0px; margin-bottom: 0px;"><span id="span-element" dir="dir-span">This is a paragraph</span></p>`);
|
|
804
|
+
});
|
|
805
|
+
it('should convert text node with custom attributes to HTML correctly', () => {
|
|
806
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
807
|
+
{
|
|
808
|
+
id: '1',
|
|
809
|
+
type: 'paragraph',
|
|
810
|
+
annotations: {
|
|
811
|
+
textStyle: 'paragraph',
|
|
812
|
+
customAttribute: {
|
|
813
|
+
id: 'p-element',
|
|
814
|
+
dir: 'dir-p',
|
|
815
|
+
},
|
|
816
|
+
},
|
|
817
|
+
nodes: [
|
|
818
|
+
{
|
|
819
|
+
id: '1-1',
|
|
820
|
+
type: 'text',
|
|
821
|
+
text: 'This is a paragraph.',
|
|
822
|
+
annotations: {
|
|
823
|
+
bold: true,
|
|
824
|
+
customAttribute: {
|
|
825
|
+
id: 'text1',
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
id: '1-2',
|
|
831
|
+
type: 'text',
|
|
832
|
+
text: ' code',
|
|
833
|
+
annotations: {
|
|
834
|
+
code: true,
|
|
835
|
+
customAttribute: {
|
|
836
|
+
id: 'text2',
|
|
837
|
+
},
|
|
838
|
+
},
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
id: '1-3',
|
|
842
|
+
type: 'text',
|
|
843
|
+
text: ' text',
|
|
844
|
+
annotations: {
|
|
845
|
+
code: false,
|
|
846
|
+
customAttribute: {
|
|
847
|
+
id: 'text3',
|
|
848
|
+
},
|
|
849
|
+
},
|
|
850
|
+
},
|
|
851
|
+
],
|
|
852
|
+
},
|
|
853
|
+
]);
|
|
854
|
+
expect(contentState.toHtml()).toEqual(`<p id="p-element" dir="dir-p" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span id="text1" style="font-weight: 700;">This is a paragraph.</span><code id="text2" style="font-family: Roboto Mono;white-space: pre-wrap;"> code</code><span id="text3"> text</span></p>`);
|
|
855
|
+
});
|
|
856
|
+
it('should convert bullet list block with custom attributes to HTML correctly', () => {
|
|
857
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
858
|
+
{
|
|
859
|
+
id: '1',
|
|
860
|
+
type: 'bullet-list',
|
|
861
|
+
blocks: [
|
|
862
|
+
{
|
|
863
|
+
id: '1-1',
|
|
864
|
+
type: 'list-item',
|
|
865
|
+
nodes: [{ id: '1-1-1', type: 'text', text: 'Item 1' }],
|
|
866
|
+
annotations: {
|
|
867
|
+
customAttribute: {
|
|
868
|
+
id: 'list1',
|
|
869
|
+
},
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
id: '1-2',
|
|
874
|
+
type: 'list-item',
|
|
875
|
+
nodes: [{ id: '1-2-1', type: 'text', text: 'Item 2' }],
|
|
876
|
+
annotations: {
|
|
877
|
+
customAttribute: {
|
|
878
|
+
id: 'list2',
|
|
879
|
+
},
|
|
880
|
+
},
|
|
881
|
+
},
|
|
882
|
+
],
|
|
883
|
+
annotations: {
|
|
884
|
+
customAttribute: {
|
|
885
|
+
id: 'ul',
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
]);
|
|
890
|
+
expect(contentState.toHtml()).toEqual(`<ul id="ul" style="padding-left: 8px;margin-left: 16px;"><li id="list1" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 1</span></li><li id="list2" style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;"><span>Item 2</span></li></ul>`);
|
|
891
|
+
});
|
|
892
|
+
it('should convert paragraph with custom class to HTML correctly', () => {
|
|
893
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
894
|
+
{
|
|
895
|
+
id: '1',
|
|
896
|
+
type: 'paragraph',
|
|
897
|
+
annotations: {
|
|
898
|
+
textStyle: 'paragraph',
|
|
899
|
+
customClass: ['p-class'],
|
|
900
|
+
},
|
|
901
|
+
nodes: [
|
|
902
|
+
{
|
|
903
|
+
id: '1-1',
|
|
904
|
+
type: 'text',
|
|
905
|
+
text: 'This is a paragraph',
|
|
906
|
+
annotations: {
|
|
907
|
+
customClass: ['span-class'],
|
|
908
|
+
},
|
|
909
|
+
},
|
|
910
|
+
],
|
|
911
|
+
},
|
|
912
|
+
]);
|
|
913
|
+
expect(contentState.toHtml()).toMatchSnapshot();
|
|
914
|
+
});
|
|
915
|
+
it('should convert text node with custom class to HTML correctly', () => {
|
|
916
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
917
|
+
{
|
|
918
|
+
id: '1',
|
|
919
|
+
type: 'paragraph',
|
|
920
|
+
annotations: {
|
|
921
|
+
textStyle: 'paragraph',
|
|
922
|
+
customClass: ['p-class'],
|
|
923
|
+
},
|
|
924
|
+
nodes: [
|
|
925
|
+
{
|
|
926
|
+
id: '1-1',
|
|
927
|
+
type: 'text',
|
|
928
|
+
text: 'This is a paragraph.',
|
|
929
|
+
annotations: {
|
|
930
|
+
bold: true,
|
|
931
|
+
customClass: ['span1-class'],
|
|
932
|
+
},
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
id: '1-2',
|
|
936
|
+
type: 'text',
|
|
937
|
+
text: ' code',
|
|
938
|
+
annotations: {
|
|
939
|
+
code: true,
|
|
940
|
+
customClass: ['span2-class'],
|
|
941
|
+
},
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
id: '1-3',
|
|
945
|
+
type: 'text',
|
|
946
|
+
text: ' text',
|
|
947
|
+
annotations: {
|
|
948
|
+
code: false,
|
|
949
|
+
customClass: ['span3-class'],
|
|
950
|
+
},
|
|
951
|
+
},
|
|
952
|
+
],
|
|
953
|
+
},
|
|
954
|
+
]);
|
|
955
|
+
expect(contentState.toHtml()).toMatchSnapshot();
|
|
956
|
+
});
|
|
957
|
+
it('should convert bullet list block with custom class to HTML correctly', () => {
|
|
958
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
959
|
+
{
|
|
960
|
+
id: '1',
|
|
961
|
+
type: 'bullet-list',
|
|
962
|
+
blocks: [
|
|
963
|
+
{
|
|
964
|
+
id: '1-1',
|
|
965
|
+
type: 'list-item',
|
|
966
|
+
nodes: [{ id: '1-1-1', type: 'text', text: 'Item 1' }],
|
|
967
|
+
annotations: {
|
|
968
|
+
customClass: ['li1-class'],
|
|
969
|
+
},
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
id: '1-2',
|
|
973
|
+
type: 'list-item',
|
|
974
|
+
nodes: [{ id: '1-2-1', type: 'text', text: 'Item 2' }],
|
|
975
|
+
annotations: {
|
|
976
|
+
customClass: ['li2-class'],
|
|
977
|
+
},
|
|
978
|
+
},
|
|
979
|
+
],
|
|
980
|
+
annotations: {
|
|
981
|
+
customClass: ['ul-class'],
|
|
982
|
+
},
|
|
983
|
+
},
|
|
984
|
+
]);
|
|
985
|
+
expect(contentState.toHtml()).toMatchSnapshot();
|
|
986
|
+
});
|
|
987
|
+
it('should convert paragraph with custom style to HTML correctly', () => {
|
|
988
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
989
|
+
{
|
|
990
|
+
id: '1',
|
|
991
|
+
type: 'paragraph',
|
|
992
|
+
annotations: {
|
|
993
|
+
textStyle: 'paragraph',
|
|
994
|
+
customStyle: {
|
|
995
|
+
fontWeight: '700',
|
|
996
|
+
},
|
|
997
|
+
},
|
|
998
|
+
nodes: [
|
|
999
|
+
{
|
|
1000
|
+
id: '1-1',
|
|
1001
|
+
type: 'text',
|
|
1002
|
+
text: 'This is a paragraph',
|
|
1003
|
+
annotations: {
|
|
1004
|
+
customStyle: {
|
|
1005
|
+
fontWeight: '700',
|
|
1006
|
+
},
|
|
1007
|
+
},
|
|
1008
|
+
},
|
|
1009
|
+
],
|
|
1010
|
+
},
|
|
1011
|
+
]);
|
|
1012
|
+
expect(contentState.toHtml()).toEqualHtml(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 700; margin-top: 0px; margin-bottom: 0px;"><span style="font-weight: 700">This is a paragraph</span></p>`);
|
|
1013
|
+
});
|
|
1014
|
+
it('should convert text node with custom style to HTML correctly', () => {
|
|
1015
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
1016
|
+
{
|
|
1017
|
+
id: '1',
|
|
1018
|
+
type: 'paragraph',
|
|
1019
|
+
annotations: {
|
|
1020
|
+
textStyle: 'paragraph',
|
|
1021
|
+
customStyle: {
|
|
1022
|
+
textAlign: 'right',
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
1025
|
+
nodes: [
|
|
1026
|
+
{
|
|
1027
|
+
id: '1-1',
|
|
1028
|
+
type: 'text',
|
|
1029
|
+
text: 'This is a paragraph.',
|
|
1030
|
+
annotations: {
|
|
1031
|
+
bold: true,
|
|
1032
|
+
customStyle: {
|
|
1033
|
+
padding: '20px',
|
|
1034
|
+
},
|
|
1035
|
+
},
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
id: '1-2',
|
|
1039
|
+
type: 'text',
|
|
1040
|
+
text: ' code',
|
|
1041
|
+
annotations: {
|
|
1042
|
+
code: true,
|
|
1043
|
+
customStyle: {
|
|
1044
|
+
padding: '30px',
|
|
1045
|
+
},
|
|
1046
|
+
},
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
id: '1-3',
|
|
1050
|
+
type: 'text',
|
|
1051
|
+
text: ' text',
|
|
1052
|
+
annotations: {
|
|
1053
|
+
code: false,
|
|
1054
|
+
customStyle: {
|
|
1055
|
+
padding: '40px',
|
|
1056
|
+
},
|
|
1057
|
+
},
|
|
1058
|
+
},
|
|
1059
|
+
],
|
|
1060
|
+
},
|
|
1061
|
+
]);
|
|
1062
|
+
expect(contentState.toHtml()).toEqual(`<p style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;text-align: right;"><span style="font-weight: 700;padding: 20px;">This is a paragraph.</span><code style="font-family: Roboto Mono;white-space: pre-wrap;padding: 30px;"> code</code><span style="padding: 40px;"> text</span></p>`);
|
|
1063
|
+
});
|
|
1064
|
+
it('should convert bullet list block with custom style to HTML correctly', () => {
|
|
1065
|
+
const contentState = VegaRTEContent.fromJSON([
|
|
1066
|
+
{
|
|
1067
|
+
id: '1',
|
|
1068
|
+
type: 'bullet-list',
|
|
1069
|
+
blocks: [
|
|
1070
|
+
{
|
|
1071
|
+
id: '1-1',
|
|
1072
|
+
type: 'list-item',
|
|
1073
|
+
nodes: [{ id: '1-1-1', type: 'text', text: 'Item 1' }],
|
|
1074
|
+
annotations: {
|
|
1075
|
+
customStyle: {
|
|
1076
|
+
padding: '40px',
|
|
1077
|
+
},
|
|
1078
|
+
},
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
id: '1-2',
|
|
1082
|
+
type: 'list-item',
|
|
1083
|
+
nodes: [{ id: '1-2-1', type: 'text', text: 'Item 2' }],
|
|
1084
|
+
annotations: {
|
|
1085
|
+
customStyle: {
|
|
1086
|
+
padding: '50px',
|
|
1087
|
+
},
|
|
1088
|
+
},
|
|
1089
|
+
},
|
|
1090
|
+
],
|
|
1091
|
+
annotations: {
|
|
1092
|
+
customStyle: {
|
|
1093
|
+
padding: '60px',
|
|
1094
|
+
},
|
|
1095
|
+
},
|
|
1096
|
+
},
|
|
1097
|
+
]);
|
|
1098
|
+
expect(contentState.toHtml()).toEqual(`<ul style="padding-left: 8px;margin-left: 16px;padding: 60px;"><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;padding: 40px;"><span>Item 1</span></li><li style="font-family: Inter;font-size: 16px;line-height: 22px;font-weight: 500;margin-top: 0px;margin-bottom: 0px;padding: 50px;"><span>Item 2</span></li></ul>`);
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1101
|
+
describe('fromHtml', () => {
|
|
1102
|
+
it('should convert a simple paragraph element to the expected RTEContentBlock', () => {
|
|
1103
|
+
const sourceCode = '<p>Hello</p>';
|
|
1104
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1105
|
+
expect(content.toJSON()).toEqual([
|
|
1106
|
+
{
|
|
1107
|
+
id: expect.anything(),
|
|
1108
|
+
type: 'paragraph',
|
|
1109
|
+
annotations: { textStyle: 'paragraph' },
|
|
1110
|
+
nodes: [
|
|
1111
|
+
{
|
|
1112
|
+
id: expect.anything(),
|
|
1113
|
+
text: 'Hello',
|
|
1114
|
+
type: 'text',
|
|
1115
|
+
annotations: {
|
|
1116
|
+
bold: false,
|
|
1117
|
+
code: false,
|
|
1118
|
+
italic: false,
|
|
1119
|
+
strikethrough: false,
|
|
1120
|
+
underline: false,
|
|
1121
|
+
},
|
|
1122
|
+
},
|
|
1123
|
+
],
|
|
1124
|
+
},
|
|
1125
|
+
]);
|
|
1126
|
+
});
|
|
1127
|
+
it('should convert a bold text element to the expected RTEContentBlock', () => {
|
|
1128
|
+
const sourceCode = '<span style="font-weight: 700;">Bold</span>';
|
|
1129
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1130
|
+
expect(content.toJSON()).toEqual([
|
|
1131
|
+
{
|
|
1132
|
+
id: expect.anything(),
|
|
1133
|
+
type: 'paragraph',
|
|
1134
|
+
annotations: { textStyle: 'paragraph' },
|
|
1135
|
+
nodes: [
|
|
1136
|
+
{
|
|
1137
|
+
id: expect.anything(),
|
|
1138
|
+
type: 'text',
|
|
1139
|
+
text: 'Bold',
|
|
1140
|
+
annotations: {
|
|
1141
|
+
bold: true,
|
|
1142
|
+
code: false,
|
|
1143
|
+
italic: false,
|
|
1144
|
+
strikethrough: false,
|
|
1145
|
+
underline: false,
|
|
1146
|
+
customStyle: {
|
|
1147
|
+
fontWeight: '700',
|
|
1148
|
+
},
|
|
1149
|
+
},
|
|
1150
|
+
},
|
|
1151
|
+
],
|
|
1152
|
+
},
|
|
1153
|
+
]);
|
|
1154
|
+
});
|
|
1155
|
+
it('should convert a list element to the expected RTEContentBlock', () => {
|
|
1156
|
+
const sourceCode = '<ul><li>Item 1</li><li>Item 2</li></ul>';
|
|
1157
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1158
|
+
expect(content.toJSON()).toEqual([
|
|
1159
|
+
{
|
|
1160
|
+
blocks: [
|
|
1161
|
+
{
|
|
1162
|
+
id: expect.anything(),
|
|
1163
|
+
type: 'list-item',
|
|
1164
|
+
annotations: { textStyle: 'paragraph' },
|
|
1165
|
+
nodes: [
|
|
1166
|
+
{
|
|
1167
|
+
id: expect.anything(),
|
|
1168
|
+
text: 'Item 1',
|
|
1169
|
+
type: 'text',
|
|
1170
|
+
annotations: {
|
|
1171
|
+
bold: false,
|
|
1172
|
+
code: false,
|
|
1173
|
+
italic: false,
|
|
1174
|
+
strikethrough: false,
|
|
1175
|
+
underline: false,
|
|
1176
|
+
},
|
|
1177
|
+
},
|
|
1178
|
+
],
|
|
1179
|
+
children: [],
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
id: expect.anything(),
|
|
1183
|
+
type: 'list-item',
|
|
1184
|
+
annotations: { textStyle: 'paragraph' },
|
|
1185
|
+
nodes: [
|
|
1186
|
+
{
|
|
1187
|
+
id: expect.anything(),
|
|
1188
|
+
text: 'Item 2',
|
|
1189
|
+
type: 'text',
|
|
1190
|
+
annotations: {
|
|
1191
|
+
bold: false,
|
|
1192
|
+
code: false,
|
|
1193
|
+
italic: false,
|
|
1194
|
+
strikethrough: false,
|
|
1195
|
+
underline: false,
|
|
1196
|
+
},
|
|
1197
|
+
},
|
|
1198
|
+
],
|
|
1199
|
+
children: [],
|
|
1200
|
+
},
|
|
1201
|
+
],
|
|
1202
|
+
id: expect.anything(),
|
|
1203
|
+
type: 'bullet-list',
|
|
1204
|
+
},
|
|
1205
|
+
]);
|
|
1206
|
+
});
|
|
1207
|
+
it('should convert a heading element to the expected RTEContentBlock', () => {
|
|
1208
|
+
const sourceCode = '<h1>Heading</h1>';
|
|
1209
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1210
|
+
expect(content.toJSON()).toEqual([
|
|
1211
|
+
{
|
|
1212
|
+
id: expect.anything(),
|
|
1213
|
+
type: 'heading-1',
|
|
1214
|
+
annotations: { textStyle: 'heading-1' },
|
|
1215
|
+
nodes: [
|
|
1216
|
+
{
|
|
1217
|
+
id: expect.anything(),
|
|
1218
|
+
text: 'Heading',
|
|
1219
|
+
type: 'text',
|
|
1220
|
+
},
|
|
1221
|
+
],
|
|
1222
|
+
},
|
|
1223
|
+
]);
|
|
1224
|
+
});
|
|
1225
|
+
it('should convert a complex html with RTE classes to DTO correctly', () => {
|
|
1226
|
+
const sourceCode = `<div class='v-rte--text-style-title'>Title</div>
|
|
1227
|
+
<div class='v-rte--text-style-subtitle'>Subtitle</div>
|
|
1228
|
+
<h1 class='v-rte--text-style-heading-1'>Heading 1</h1>
|
|
1229
|
+
<h2 class='v-rte--text-style-heading-2'>Heading 2</h2>
|
|
1230
|
+
<h3 class='v-rte--text-style-heading-3'>Heading 3</h3>
|
|
1231
|
+
<p class='v-rte--text-style-paragraph'>Paragraph</p>
|
|
1232
|
+
<p class='v-rte--text-style-paragraph'>
|
|
1233
|
+
<span class='v-rte--bold'>Bold text</span>
|
|
1234
|
+
<span class='v-rte--italic'>Italic text</span>
|
|
1235
|
+
<span class='v-rte--underline'>Underline text</span>
|
|
1236
|
+
<span class='v-rte--strikethrough'>Strikethrough text</span>
|
|
1237
|
+
<code class='v-rte--code'>Code text</code>
|
|
1238
|
+
<span style="color: rgb(1, 128, 31);">Color text</span>
|
|
1239
|
+
</p>
|
|
1240
|
+
<ul>
|
|
1241
|
+
<li class='v-rte--text-style-paragraph'>List item 1</li>
|
|
1242
|
+
<li class='v-rte--text-style-paragraph'>List item 2</li>
|
|
1243
|
+
</ul>
|
|
1244
|
+
<ol>
|
|
1245
|
+
<li class='v-rte--text-style-paragraph'>List item 1</li>
|
|
1246
|
+
<li class='v-rte--text-style-paragraph'>List item 2</li>
|
|
1247
|
+
</ol>
|
|
1248
|
+
<p class="v-rte--text-style-paragraph v-rte--horizontal-alignment-left"><span class="">Left align</span></p>
|
|
1249
|
+
<p class="v-rte--text-style-paragraph v-rte--horizontal-alignment-right"><span class="">Right align</span></p>
|
|
1250
|
+
<p class="v-rte--text-style-paragraph v-rte--horizontal-alignment-left" style="margin-left: 16px;"><span class="">More indent 1</span></p>
|
|
1251
|
+
<p class="v-rte--text-style-paragraph v-rte--horizontal-alignment-left" style="margin-left: 32px;"><span class="">More indent 2</span></p>
|
|
1252
|
+
<p class="v-rte--text-style-paragraph"><a href="https://www.google.com" target="_blank" class="v-rte--link classA classB" id="a" data-link="link" style="color: red; fontSize: 8px; display: block;"><span class="">Link text</span></a></p>
|
|
1253
|
+
<div><img src="mock-img-url" style="width: 100%;"></div>`;
|
|
1254
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1255
|
+
expect(content.toJSON()).toEqual([
|
|
1256
|
+
{
|
|
1257
|
+
id: expect.anything(),
|
|
1258
|
+
type: 'title',
|
|
1259
|
+
annotations: { textStyle: 'title' },
|
|
1260
|
+
nodes: [
|
|
1261
|
+
{
|
|
1262
|
+
id: expect.anything(),
|
|
1263
|
+
text: 'Title',
|
|
1264
|
+
type: 'text',
|
|
1265
|
+
},
|
|
1266
|
+
],
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
id: expect.anything(),
|
|
1270
|
+
type: 'subtitle',
|
|
1271
|
+
annotations: { textStyle: 'subtitle' },
|
|
1272
|
+
nodes: [
|
|
1273
|
+
{
|
|
1274
|
+
id: expect.anything(),
|
|
1275
|
+
text: 'Subtitle',
|
|
1276
|
+
type: 'text',
|
|
1277
|
+
},
|
|
1278
|
+
],
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
id: expect.anything(),
|
|
1282
|
+
type: 'heading-1',
|
|
1283
|
+
annotations: { textStyle: 'heading-1' },
|
|
1284
|
+
nodes: [
|
|
1285
|
+
{
|
|
1286
|
+
id: expect.anything(),
|
|
1287
|
+
type: 'text',
|
|
1288
|
+
text: 'Heading 1',
|
|
1289
|
+
},
|
|
1290
|
+
],
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
id: expect.anything(),
|
|
1294
|
+
type: 'heading-2',
|
|
1295
|
+
annotations: { textStyle: 'heading-2' },
|
|
1296
|
+
nodes: [
|
|
1297
|
+
{
|
|
1298
|
+
id: expect.anything(),
|
|
1299
|
+
type: 'text',
|
|
1300
|
+
text: 'Heading 2',
|
|
1301
|
+
},
|
|
1302
|
+
],
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
id: expect.anything(),
|
|
1306
|
+
type: 'heading-3',
|
|
1307
|
+
annotations: { textStyle: 'heading-3' },
|
|
1308
|
+
nodes: [
|
|
1309
|
+
{
|
|
1310
|
+
id: expect.anything(),
|
|
1311
|
+
text: 'Heading 3',
|
|
1312
|
+
type: 'text',
|
|
1313
|
+
},
|
|
1314
|
+
],
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
id: expect.anything(),
|
|
1318
|
+
type: 'paragraph',
|
|
1319
|
+
annotations: { textStyle: 'paragraph' },
|
|
1320
|
+
nodes: [
|
|
1321
|
+
{
|
|
1322
|
+
id: expect.anything(),
|
|
1323
|
+
text: 'Paragraph',
|
|
1324
|
+
type: 'text',
|
|
1325
|
+
annotations: {
|
|
1326
|
+
bold: false,
|
|
1327
|
+
code: false,
|
|
1328
|
+
italic: false,
|
|
1329
|
+
strikethrough: false,
|
|
1330
|
+
underline: false,
|
|
1331
|
+
},
|
|
1332
|
+
},
|
|
1333
|
+
],
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
id: expect.anything(),
|
|
1337
|
+
type: 'paragraph',
|
|
1338
|
+
annotations: { textStyle: 'paragraph' },
|
|
1339
|
+
nodes: [
|
|
1340
|
+
{
|
|
1341
|
+
annotations: {
|
|
1342
|
+
bold: true,
|
|
1343
|
+
code: false,
|
|
1344
|
+
italic: false,
|
|
1345
|
+
strikethrough: false,
|
|
1346
|
+
underline: false,
|
|
1347
|
+
},
|
|
1348
|
+
id: expect.anything(),
|
|
1349
|
+
text: 'Bold text',
|
|
1350
|
+
type: 'text',
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
id: expect.anything(),
|
|
1354
|
+
type: 'text',
|
|
1355
|
+
annotations: {
|
|
1356
|
+
bold: false,
|
|
1357
|
+
code: false,
|
|
1358
|
+
italic: true,
|
|
1359
|
+
strikethrough: false,
|
|
1360
|
+
underline: false,
|
|
1361
|
+
},
|
|
1362
|
+
text: 'Italic text',
|
|
1363
|
+
},
|
|
1364
|
+
{
|
|
1365
|
+
id: expect.anything(),
|
|
1366
|
+
annotations: {
|
|
1367
|
+
bold: false,
|
|
1368
|
+
code: false,
|
|
1369
|
+
italic: false,
|
|
1370
|
+
strikethrough: false,
|
|
1371
|
+
underline: true,
|
|
1372
|
+
},
|
|
1373
|
+
text: 'Underline text',
|
|
1374
|
+
type: 'text',
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
id: expect.anything(),
|
|
1378
|
+
type: 'text',
|
|
1379
|
+
annotations: {
|
|
1380
|
+
bold: false,
|
|
1381
|
+
code: false,
|
|
1382
|
+
italic: false,
|
|
1383
|
+
strikethrough: true,
|
|
1384
|
+
underline: false,
|
|
1385
|
+
},
|
|
1386
|
+
text: 'Strikethrough text',
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
id: expect.anything(),
|
|
1390
|
+
type: 'text',
|
|
1391
|
+
annotations: {
|
|
1392
|
+
bold: false,
|
|
1393
|
+
code: true,
|
|
1394
|
+
italic: false,
|
|
1395
|
+
strikethrough: false,
|
|
1396
|
+
underline: false,
|
|
1397
|
+
},
|
|
1398
|
+
text: 'Code text',
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
id: expect.anything(),
|
|
1402
|
+
type: 'text',
|
|
1403
|
+
annotations: {
|
|
1404
|
+
bold: false,
|
|
1405
|
+
code: false,
|
|
1406
|
+
italic: false,
|
|
1407
|
+
strikethrough: false,
|
|
1408
|
+
textColor: 'green',
|
|
1409
|
+
underline: false,
|
|
1410
|
+
customStyle: {
|
|
1411
|
+
color: 'rgb(1, 128, 31)',
|
|
1412
|
+
},
|
|
1413
|
+
},
|
|
1414
|
+
text: 'Color text',
|
|
1415
|
+
},
|
|
1416
|
+
],
|
|
1417
|
+
},
|
|
1418
|
+
{
|
|
1419
|
+
id: expect.anything(),
|
|
1420
|
+
type: 'bullet-list',
|
|
1421
|
+
blocks: [
|
|
1422
|
+
{
|
|
1423
|
+
id: expect.anything(),
|
|
1424
|
+
type: 'list-item',
|
|
1425
|
+
annotations: { textStyle: 'paragraph' },
|
|
1426
|
+
nodes: [
|
|
1427
|
+
{
|
|
1428
|
+
id: expect.anything(),
|
|
1429
|
+
text: 'List item 1',
|
|
1430
|
+
type: 'text',
|
|
1431
|
+
annotations: {
|
|
1432
|
+
bold: false,
|
|
1433
|
+
code: false,
|
|
1434
|
+
italic: false,
|
|
1435
|
+
strikethrough: false,
|
|
1436
|
+
underline: false,
|
|
1437
|
+
},
|
|
1438
|
+
},
|
|
1439
|
+
],
|
|
1440
|
+
children: [],
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
id: expect.anything(),
|
|
1444
|
+
type: 'list-item',
|
|
1445
|
+
annotations: { textStyle: 'paragraph' },
|
|
1446
|
+
nodes: [
|
|
1447
|
+
{
|
|
1448
|
+
id: expect.anything(),
|
|
1449
|
+
text: 'List item 2',
|
|
1450
|
+
type: 'text',
|
|
1451
|
+
annotations: {
|
|
1452
|
+
bold: false,
|
|
1453
|
+
code: false,
|
|
1454
|
+
italic: false,
|
|
1455
|
+
strikethrough: false,
|
|
1456
|
+
underline: false,
|
|
1457
|
+
},
|
|
1458
|
+
},
|
|
1459
|
+
],
|
|
1460
|
+
children: [],
|
|
1461
|
+
},
|
|
1462
|
+
],
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
id: expect.anything(),
|
|
1466
|
+
type: 'number-list',
|
|
1467
|
+
blocks: [
|
|
1468
|
+
{
|
|
1469
|
+
id: expect.anything(),
|
|
1470
|
+
type: 'list-item',
|
|
1471
|
+
annotations: { textStyle: 'paragraph' },
|
|
1472
|
+
nodes: [
|
|
1473
|
+
{
|
|
1474
|
+
id: expect.anything(),
|
|
1475
|
+
text: 'List item 1',
|
|
1476
|
+
type: 'text',
|
|
1477
|
+
annotations: {
|
|
1478
|
+
bold: false,
|
|
1479
|
+
code: false,
|
|
1480
|
+
italic: false,
|
|
1481
|
+
strikethrough: false,
|
|
1482
|
+
underline: false,
|
|
1483
|
+
},
|
|
1484
|
+
},
|
|
1485
|
+
],
|
|
1486
|
+
children: [],
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
id: expect.anything(),
|
|
1490
|
+
type: 'list-item',
|
|
1491
|
+
annotations: { textStyle: 'paragraph' },
|
|
1492
|
+
nodes: [
|
|
1493
|
+
{
|
|
1494
|
+
id: expect.anything(),
|
|
1495
|
+
text: 'List item 2',
|
|
1496
|
+
type: 'text',
|
|
1497
|
+
annotations: {
|
|
1498
|
+
bold: false,
|
|
1499
|
+
code: false,
|
|
1500
|
+
italic: false,
|
|
1501
|
+
strikethrough: false,
|
|
1502
|
+
underline: false,
|
|
1503
|
+
},
|
|
1504
|
+
},
|
|
1505
|
+
],
|
|
1506
|
+
children: [],
|
|
1507
|
+
},
|
|
1508
|
+
],
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
id: expect.anything(),
|
|
1512
|
+
type: 'paragraph',
|
|
1513
|
+
annotations: { textAlign: 'left', textStyle: 'paragraph' },
|
|
1514
|
+
nodes: [
|
|
1515
|
+
{
|
|
1516
|
+
id: expect.anything(),
|
|
1517
|
+
type: 'text',
|
|
1518
|
+
annotations: {
|
|
1519
|
+
bold: false,
|
|
1520
|
+
code: false,
|
|
1521
|
+
italic: false,
|
|
1522
|
+
strikethrough: false,
|
|
1523
|
+
underline: false,
|
|
1524
|
+
},
|
|
1525
|
+
text: 'Left align',
|
|
1526
|
+
},
|
|
1527
|
+
],
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
id: expect.anything(),
|
|
1531
|
+
type: 'paragraph',
|
|
1532
|
+
annotations: { textAlign: 'right', textStyle: 'paragraph' },
|
|
1533
|
+
nodes: [
|
|
1534
|
+
{
|
|
1535
|
+
id: expect.anything(),
|
|
1536
|
+
type: 'text',
|
|
1537
|
+
annotations: {
|
|
1538
|
+
bold: false,
|
|
1539
|
+
code: false,
|
|
1540
|
+
italic: false,
|
|
1541
|
+
strikethrough: false,
|
|
1542
|
+
underline: false,
|
|
1543
|
+
},
|
|
1544
|
+
text: 'Right align',
|
|
1545
|
+
},
|
|
1546
|
+
],
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
id: expect.anything(),
|
|
1550
|
+
type: 'paragraph',
|
|
1551
|
+
annotations: {
|
|
1552
|
+
indent: 1,
|
|
1553
|
+
textAlign: 'left',
|
|
1554
|
+
textStyle: 'paragraph',
|
|
1555
|
+
customStyle: {
|
|
1556
|
+
marginLeft: '16px',
|
|
1557
|
+
},
|
|
1558
|
+
},
|
|
1559
|
+
nodes: [
|
|
1560
|
+
{
|
|
1561
|
+
id: expect.anything(),
|
|
1562
|
+
type: 'text',
|
|
1563
|
+
annotations: {
|
|
1564
|
+
bold: false,
|
|
1565
|
+
code: false,
|
|
1566
|
+
italic: false,
|
|
1567
|
+
strikethrough: false,
|
|
1568
|
+
underline: false,
|
|
1569
|
+
},
|
|
1570
|
+
text: 'More indent 1',
|
|
1571
|
+
},
|
|
1572
|
+
],
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
id: expect.anything(),
|
|
1576
|
+
type: 'paragraph',
|
|
1577
|
+
annotations: {
|
|
1578
|
+
indent: 2,
|
|
1579
|
+
textAlign: 'left',
|
|
1580
|
+
textStyle: 'paragraph',
|
|
1581
|
+
customStyle: {
|
|
1582
|
+
marginLeft: '32px',
|
|
1583
|
+
},
|
|
1584
|
+
},
|
|
1585
|
+
nodes: [
|
|
1586
|
+
{
|
|
1587
|
+
id: expect.anything(),
|
|
1588
|
+
type: 'text',
|
|
1589
|
+
annotations: {
|
|
1590
|
+
bold: false,
|
|
1591
|
+
code: false,
|
|
1592
|
+
italic: false,
|
|
1593
|
+
strikethrough: false,
|
|
1594
|
+
underline: false,
|
|
1595
|
+
},
|
|
1596
|
+
text: 'More indent 2',
|
|
1597
|
+
},
|
|
1598
|
+
],
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
id: expect.anything(),
|
|
1602
|
+
type: 'paragraph',
|
|
1603
|
+
annotations: { textStyle: 'paragraph' },
|
|
1604
|
+
nodes: [
|
|
1605
|
+
{
|
|
1606
|
+
id: expect.anything(),
|
|
1607
|
+
type: 'text',
|
|
1608
|
+
annotations: {
|
|
1609
|
+
bold: false,
|
|
1610
|
+
code: false,
|
|
1611
|
+
italic: false,
|
|
1612
|
+
link: {
|
|
1613
|
+
groupKey: expect.anything(),
|
|
1614
|
+
href: 'https://www.google.com',
|
|
1615
|
+
customAttribute: {
|
|
1616
|
+
'href': 'https://www.google.com',
|
|
1617
|
+
'target': '_blank',
|
|
1618
|
+
'id': 'a',
|
|
1619
|
+
'data-link': 'link',
|
|
1620
|
+
},
|
|
1621
|
+
customStyle: { color: 'red', fontSize: '8px', display: 'block' },
|
|
1622
|
+
customClass: ['classA', 'classB'],
|
|
1623
|
+
},
|
|
1624
|
+
strikethrough: false,
|
|
1625
|
+
textColor: 'red',
|
|
1626
|
+
underline: false,
|
|
1627
|
+
},
|
|
1628
|
+
text: 'Link text',
|
|
1629
|
+
},
|
|
1630
|
+
],
|
|
1631
|
+
},
|
|
1632
|
+
{
|
|
1633
|
+
id: expect.anything(),
|
|
1634
|
+
type: 'image',
|
|
1635
|
+
nodes: [
|
|
1636
|
+
{
|
|
1637
|
+
id: expect.anything(),
|
|
1638
|
+
type: 'image',
|
|
1639
|
+
annotations: {
|
|
1640
|
+
size: 'md',
|
|
1641
|
+
customAttribute: {
|
|
1642
|
+
src: 'mock-img-url',
|
|
1643
|
+
},
|
|
1644
|
+
customStyle: {
|
|
1645
|
+
width: '100%',
|
|
1646
|
+
},
|
|
1647
|
+
},
|
|
1648
|
+
url: 'mock-img-url',
|
|
1649
|
+
},
|
|
1650
|
+
],
|
|
1651
|
+
},
|
|
1652
|
+
]);
|
|
1653
|
+
});
|
|
1654
|
+
it('should convert a paragraph element with custom attributes to the expected RTEContentBlock', () => {
|
|
1655
|
+
const sourceCode = '<p id="block-element" dir="block-dir">Hello</p>';
|
|
1656
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1657
|
+
expect(content.toJSON()).toEqual([
|
|
1658
|
+
{
|
|
1659
|
+
id: expect.anything(),
|
|
1660
|
+
type: 'paragraph',
|
|
1661
|
+
annotations: {
|
|
1662
|
+
textStyle: 'paragraph',
|
|
1663
|
+
customAttribute: {
|
|
1664
|
+
id: 'block-element',
|
|
1665
|
+
dir: 'block-dir',
|
|
1666
|
+
},
|
|
1667
|
+
},
|
|
1668
|
+
nodes: [
|
|
1669
|
+
{
|
|
1670
|
+
id: expect.anything(),
|
|
1671
|
+
text: 'Hello',
|
|
1672
|
+
type: 'text',
|
|
1673
|
+
annotations: {
|
|
1674
|
+
bold: false,
|
|
1675
|
+
code: false,
|
|
1676
|
+
italic: false,
|
|
1677
|
+
strikethrough: false,
|
|
1678
|
+
underline: false,
|
|
1679
|
+
},
|
|
1680
|
+
},
|
|
1681
|
+
],
|
|
1682
|
+
},
|
|
1683
|
+
]);
|
|
1684
|
+
});
|
|
1685
|
+
it('should convert a text code element with custom attributes to the expected RTEContentBlock', () => {
|
|
1686
|
+
const sourceCode = '<p id="p-element"><code id="code">Hello</code></p>';
|
|
1687
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1688
|
+
expect(content.toJSON()).toEqual([
|
|
1689
|
+
{
|
|
1690
|
+
id: expect.anything(),
|
|
1691
|
+
type: 'paragraph',
|
|
1692
|
+
annotations: {
|
|
1693
|
+
textStyle: 'paragraph',
|
|
1694
|
+
customAttribute: {
|
|
1695
|
+
id: 'p-element',
|
|
1696
|
+
},
|
|
1697
|
+
},
|
|
1698
|
+
nodes: [
|
|
1699
|
+
{
|
|
1700
|
+
id: expect.anything(),
|
|
1701
|
+
text: 'Hello',
|
|
1702
|
+
type: 'text',
|
|
1703
|
+
annotations: {
|
|
1704
|
+
bold: false,
|
|
1705
|
+
italic: false,
|
|
1706
|
+
strikethrough: false,
|
|
1707
|
+
underline: false,
|
|
1708
|
+
code: true,
|
|
1709
|
+
customAttribute: {
|
|
1710
|
+
id: 'code',
|
|
1711
|
+
},
|
|
1712
|
+
},
|
|
1713
|
+
},
|
|
1714
|
+
],
|
|
1715
|
+
},
|
|
1716
|
+
]);
|
|
1717
|
+
});
|
|
1718
|
+
it('should convert a list element with custom attributes to the expected RTEContentBlock', () => {
|
|
1719
|
+
const sourceCode = '<ul id="ul-element"><li id="li1-element">Item 1</li><li id="li2-element">Item 2</li></ul>';
|
|
1720
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1721
|
+
expect(content.toJSON()).toEqual([
|
|
1722
|
+
{
|
|
1723
|
+
blocks: [
|
|
1724
|
+
{
|
|
1725
|
+
id: expect.anything(),
|
|
1726
|
+
type: 'list-item',
|
|
1727
|
+
annotations: {
|
|
1728
|
+
textStyle: 'paragraph',
|
|
1729
|
+
customAttribute: {
|
|
1730
|
+
id: 'li1-element',
|
|
1731
|
+
},
|
|
1732
|
+
},
|
|
1733
|
+
nodes: [
|
|
1734
|
+
{
|
|
1735
|
+
id: expect.anything(),
|
|
1736
|
+
text: 'Item 1',
|
|
1737
|
+
type: 'text',
|
|
1738
|
+
annotations: {
|
|
1739
|
+
bold: false,
|
|
1740
|
+
code: false,
|
|
1741
|
+
italic: false,
|
|
1742
|
+
strikethrough: false,
|
|
1743
|
+
underline: false,
|
|
1744
|
+
},
|
|
1745
|
+
},
|
|
1746
|
+
],
|
|
1747
|
+
children: [],
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
id: expect.anything(),
|
|
1751
|
+
type: 'list-item',
|
|
1752
|
+
annotations: {
|
|
1753
|
+
textStyle: 'paragraph',
|
|
1754
|
+
customAttribute: {
|
|
1755
|
+
id: 'li2-element',
|
|
1756
|
+
},
|
|
1757
|
+
},
|
|
1758
|
+
nodes: [
|
|
1759
|
+
{
|
|
1760
|
+
id: expect.anything(),
|
|
1761
|
+
text: 'Item 2',
|
|
1762
|
+
type: 'text',
|
|
1763
|
+
annotations: {
|
|
1764
|
+
bold: false,
|
|
1765
|
+
code: false,
|
|
1766
|
+
italic: false,
|
|
1767
|
+
strikethrough: false,
|
|
1768
|
+
underline: false,
|
|
1769
|
+
},
|
|
1770
|
+
},
|
|
1771
|
+
],
|
|
1772
|
+
children: [],
|
|
1773
|
+
},
|
|
1774
|
+
],
|
|
1775
|
+
id: expect.anything(),
|
|
1776
|
+
type: 'bullet-list',
|
|
1777
|
+
annotations: {
|
|
1778
|
+
customAttribute: {
|
|
1779
|
+
id: 'ul-element',
|
|
1780
|
+
},
|
|
1781
|
+
},
|
|
1782
|
+
},
|
|
1783
|
+
]);
|
|
1784
|
+
});
|
|
1785
|
+
it('should convert a heading element with custom class to the expected RTEContentBlock', () => {
|
|
1786
|
+
const sourceCode = '<h1 class="v-rte-class h1-class">Heading</h1>';
|
|
1787
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1788
|
+
expect(content.toJSON()).toEqual([
|
|
1789
|
+
{
|
|
1790
|
+
id: expect.anything(),
|
|
1791
|
+
type: 'heading-1',
|
|
1792
|
+
annotations: {
|
|
1793
|
+
textStyle: 'heading-1',
|
|
1794
|
+
customClass: ['h1-class'],
|
|
1795
|
+
},
|
|
1796
|
+
nodes: [
|
|
1797
|
+
{
|
|
1798
|
+
id: expect.anything(),
|
|
1799
|
+
text: 'Heading',
|
|
1800
|
+
type: 'text',
|
|
1801
|
+
},
|
|
1802
|
+
],
|
|
1803
|
+
},
|
|
1804
|
+
]);
|
|
1805
|
+
});
|
|
1806
|
+
it('should convert a paragraph element with custom class to the expected RTEContentBlock', () => {
|
|
1807
|
+
const sourceCode = '<p class="p-class1 p-class2">Hello</p>';
|
|
1808
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1809
|
+
expect(content.toJSON()).toEqual([
|
|
1810
|
+
{
|
|
1811
|
+
id: expect.anything(),
|
|
1812
|
+
type: 'paragraph',
|
|
1813
|
+
annotations: {
|
|
1814
|
+
textStyle: 'paragraph',
|
|
1815
|
+
customClass: ['p-class1', 'p-class2'],
|
|
1816
|
+
},
|
|
1817
|
+
nodes: [
|
|
1818
|
+
{
|
|
1819
|
+
id: expect.anything(),
|
|
1820
|
+
text: 'Hello',
|
|
1821
|
+
type: 'text',
|
|
1822
|
+
annotations: {
|
|
1823
|
+
bold: false,
|
|
1824
|
+
code: false,
|
|
1825
|
+
italic: false,
|
|
1826
|
+
strikethrough: false,
|
|
1827
|
+
underline: false,
|
|
1828
|
+
},
|
|
1829
|
+
},
|
|
1830
|
+
],
|
|
1831
|
+
},
|
|
1832
|
+
]);
|
|
1833
|
+
});
|
|
1834
|
+
it('should convert a text code element with custom class to the expected RTEContentBlock', () => {
|
|
1835
|
+
const sourceCode = '<p class="p-class"><code class="code-class">Hello</code></p>';
|
|
1836
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1837
|
+
expect(content.toJSON()).toEqual([
|
|
1838
|
+
{
|
|
1839
|
+
id: expect.anything(),
|
|
1840
|
+
type: 'paragraph',
|
|
1841
|
+
annotations: {
|
|
1842
|
+
textStyle: 'paragraph',
|
|
1843
|
+
customClass: ['p-class'],
|
|
1844
|
+
},
|
|
1845
|
+
nodes: [
|
|
1846
|
+
{
|
|
1847
|
+
id: expect.anything(),
|
|
1848
|
+
text: 'Hello',
|
|
1849
|
+
type: 'text',
|
|
1850
|
+
annotations: {
|
|
1851
|
+
bold: false,
|
|
1852
|
+
italic: false,
|
|
1853
|
+
strikethrough: false,
|
|
1854
|
+
underline: false,
|
|
1855
|
+
code: true,
|
|
1856
|
+
customClass: ['code-class'],
|
|
1857
|
+
},
|
|
1858
|
+
},
|
|
1859
|
+
],
|
|
1860
|
+
},
|
|
1861
|
+
]);
|
|
1862
|
+
});
|
|
1863
|
+
it('should convert a list element with custom class to the expected RTEContentBlock', () => {
|
|
1864
|
+
const sourceCode = '<ul class="ul-class"><li class="li1-class">Item 1</li><li class="li2-class">Item 2</li></ul>';
|
|
1865
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1866
|
+
expect(content.toJSON()).toEqual([
|
|
1867
|
+
{
|
|
1868
|
+
blocks: [
|
|
1869
|
+
{
|
|
1870
|
+
id: expect.anything(),
|
|
1871
|
+
type: 'list-item',
|
|
1872
|
+
annotations: {
|
|
1873
|
+
textStyle: 'paragraph',
|
|
1874
|
+
customClass: ['li1-class'],
|
|
1875
|
+
},
|
|
1876
|
+
nodes: [
|
|
1877
|
+
{
|
|
1878
|
+
id: expect.anything(),
|
|
1879
|
+
text: 'Item 1',
|
|
1880
|
+
type: 'text',
|
|
1881
|
+
annotations: {
|
|
1882
|
+
bold: false,
|
|
1883
|
+
code: false,
|
|
1884
|
+
italic: false,
|
|
1885
|
+
strikethrough: false,
|
|
1886
|
+
underline: false,
|
|
1887
|
+
},
|
|
1888
|
+
},
|
|
1889
|
+
],
|
|
1890
|
+
children: [],
|
|
1891
|
+
},
|
|
1892
|
+
{
|
|
1893
|
+
id: expect.anything(),
|
|
1894
|
+
type: 'list-item',
|
|
1895
|
+
annotations: {
|
|
1896
|
+
textStyle: 'paragraph',
|
|
1897
|
+
customClass: ['li2-class'],
|
|
1898
|
+
},
|
|
1899
|
+
nodes: [
|
|
1900
|
+
{
|
|
1901
|
+
id: expect.anything(),
|
|
1902
|
+
text: 'Item 2',
|
|
1903
|
+
type: 'text',
|
|
1904
|
+
annotations: {
|
|
1905
|
+
bold: false,
|
|
1906
|
+
code: false,
|
|
1907
|
+
italic: false,
|
|
1908
|
+
strikethrough: false,
|
|
1909
|
+
underline: false,
|
|
1910
|
+
},
|
|
1911
|
+
},
|
|
1912
|
+
],
|
|
1913
|
+
children: [],
|
|
1914
|
+
},
|
|
1915
|
+
],
|
|
1916
|
+
id: expect.anything(),
|
|
1917
|
+
type: 'bullet-list',
|
|
1918
|
+
annotations: {
|
|
1919
|
+
customClass: ['ul-class'],
|
|
1920
|
+
},
|
|
1921
|
+
},
|
|
1922
|
+
]);
|
|
1923
|
+
});
|
|
1924
|
+
it('should convert a heading element with custom attributes to the expected RTEContentBlock', () => {
|
|
1925
|
+
const sourceCode = '<h1 id="h1-element">Heading</h1>';
|
|
1926
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1927
|
+
expect(content.toJSON()).toEqual([
|
|
1928
|
+
{
|
|
1929
|
+
id: expect.anything(),
|
|
1930
|
+
type: 'heading-1',
|
|
1931
|
+
annotations: {
|
|
1932
|
+
textStyle: 'heading-1',
|
|
1933
|
+
customAttribute: {
|
|
1934
|
+
id: 'h1-element',
|
|
1935
|
+
},
|
|
1936
|
+
},
|
|
1937
|
+
nodes: [
|
|
1938
|
+
{
|
|
1939
|
+
id: expect.anything(),
|
|
1940
|
+
text: 'Heading',
|
|
1941
|
+
type: 'text',
|
|
1942
|
+
},
|
|
1943
|
+
],
|
|
1944
|
+
},
|
|
1945
|
+
]);
|
|
1946
|
+
});
|
|
1947
|
+
it('should convert a paragraph element with custom style to the expected RTEContentBlock', () => {
|
|
1948
|
+
const sourceCode = '<p style="text-align: center;">Hello</p>';
|
|
1949
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1950
|
+
expect(content.toJSON()).toEqual([
|
|
1951
|
+
{
|
|
1952
|
+
id: expect.anything(),
|
|
1953
|
+
type: 'paragraph',
|
|
1954
|
+
annotations: {
|
|
1955
|
+
textStyle: 'paragraph',
|
|
1956
|
+
textAlign: 'center',
|
|
1957
|
+
customStyle: {
|
|
1958
|
+
textAlign: 'center',
|
|
1959
|
+
},
|
|
1960
|
+
},
|
|
1961
|
+
nodes: [
|
|
1962
|
+
{
|
|
1963
|
+
id: expect.anything(),
|
|
1964
|
+
text: 'Hello',
|
|
1965
|
+
type: 'text',
|
|
1966
|
+
annotations: {
|
|
1967
|
+
bold: false,
|
|
1968
|
+
code: false,
|
|
1969
|
+
italic: false,
|
|
1970
|
+
strikethrough: false,
|
|
1971
|
+
underline: false,
|
|
1972
|
+
},
|
|
1973
|
+
},
|
|
1974
|
+
],
|
|
1975
|
+
},
|
|
1976
|
+
]);
|
|
1977
|
+
});
|
|
1978
|
+
it('should convert a text code element with custom style to the expected RTEContentBlock', () => {
|
|
1979
|
+
const sourceCode = '<p style="text-align: center;"><code style="font-weight: 700;">Hello</code></p>';
|
|
1980
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
1981
|
+
expect(content.toJSON()).toEqual([
|
|
1982
|
+
{
|
|
1983
|
+
id: expect.anything(),
|
|
1984
|
+
type: 'paragraph',
|
|
1985
|
+
annotations: {
|
|
1986
|
+
textStyle: 'paragraph',
|
|
1987
|
+
textAlign: 'center',
|
|
1988
|
+
customStyle: {
|
|
1989
|
+
textAlign: 'center',
|
|
1990
|
+
},
|
|
1991
|
+
},
|
|
1992
|
+
nodes: [
|
|
1993
|
+
{
|
|
1994
|
+
id: expect.anything(),
|
|
1995
|
+
text: 'Hello',
|
|
1996
|
+
type: 'text',
|
|
1997
|
+
annotations: {
|
|
1998
|
+
bold: true,
|
|
1999
|
+
italic: false,
|
|
2000
|
+
strikethrough: false,
|
|
2001
|
+
underline: false,
|
|
2002
|
+
code: true,
|
|
2003
|
+
customStyle: {
|
|
2004
|
+
fontWeight: '700',
|
|
2005
|
+
},
|
|
2006
|
+
},
|
|
2007
|
+
},
|
|
2008
|
+
],
|
|
2009
|
+
},
|
|
2010
|
+
]);
|
|
2011
|
+
});
|
|
2012
|
+
it('should convert a list element with custom style to the expected RTEContentBlock', () => {
|
|
2013
|
+
const sourceCode = '<ul style="padding: 20px;"><li style="text-align: center;">Item 1</li><li style="padding: 20px;">Item 2</li></ul>';
|
|
2014
|
+
const content = VegaRTEContent.fromHtml(sourceCode);
|
|
2015
|
+
expect(content.toJSON()).toEqual([
|
|
2016
|
+
{
|
|
2017
|
+
blocks: [
|
|
2018
|
+
{
|
|
2019
|
+
id: expect.anything(),
|
|
2020
|
+
type: 'list-item',
|
|
2021
|
+
annotations: {
|
|
2022
|
+
textStyle: 'paragraph',
|
|
2023
|
+
textAlign: 'center',
|
|
2024
|
+
customStyle: {
|
|
2025
|
+
textAlign: 'center',
|
|
2026
|
+
},
|
|
2027
|
+
},
|
|
2028
|
+
nodes: [
|
|
2029
|
+
{
|
|
2030
|
+
id: expect.anything(),
|
|
2031
|
+
text: 'Item 1',
|
|
2032
|
+
type: 'text',
|
|
2033
|
+
annotations: {
|
|
2034
|
+
bold: false,
|
|
2035
|
+
code: false,
|
|
2036
|
+
italic: false,
|
|
2037
|
+
strikethrough: false,
|
|
2038
|
+
underline: false,
|
|
2039
|
+
},
|
|
2040
|
+
},
|
|
2041
|
+
],
|
|
2042
|
+
children: [],
|
|
2043
|
+
},
|
|
2044
|
+
{
|
|
2045
|
+
id: expect.anything(),
|
|
2046
|
+
type: 'list-item',
|
|
2047
|
+
annotations: {
|
|
2048
|
+
textStyle: 'paragraph',
|
|
2049
|
+
customStyle: {
|
|
2050
|
+
padding: '20px',
|
|
2051
|
+
},
|
|
2052
|
+
},
|
|
2053
|
+
nodes: [
|
|
2054
|
+
{
|
|
2055
|
+
id: expect.anything(),
|
|
2056
|
+
text: 'Item 2',
|
|
2057
|
+
type: 'text',
|
|
2058
|
+
annotations: {
|
|
2059
|
+
bold: false,
|
|
2060
|
+
code: false,
|
|
2061
|
+
italic: false,
|
|
2062
|
+
strikethrough: false,
|
|
2063
|
+
underline: false,
|
|
2064
|
+
},
|
|
2065
|
+
},
|
|
2066
|
+
],
|
|
2067
|
+
children: [],
|
|
2068
|
+
},
|
|
2069
|
+
],
|
|
2070
|
+
id: expect.anything(),
|
|
2071
|
+
type: 'bullet-list',
|
|
2072
|
+
annotations: {
|
|
2073
|
+
customStyle: {
|
|
2074
|
+
padding: '20px',
|
|
2075
|
+
},
|
|
2076
|
+
},
|
|
2077
|
+
},
|
|
2078
|
+
]);
|
|
2079
|
+
});
|
|
2080
|
+
});
|
|
288
2081
|
});
|