@globalpayments/vega 2.98.0 → 2.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{action-color-accessibility-validator-24498816.js → action-color-accessibility-validator-b8a9ef0f.js} +2 -2
- package/dist/cjs/{app-globals-b3f05631.js → app-globals-a306dce6.js} +10 -10
- package/dist/cjs/{code-block-d78c2b2c.js → code-block-ea1f5eb3.js} +43 -6
- package/dist/cjs/{component-global-style-slimmer-93c5fb50.js → component-global-style-slimmer-ba588eb4.js} +1 -1
- package/dist/cjs/{component-value-history-controller-slimmer.abstract-beb00fea.js → component-value-history-controller-slimmer.abstract-7071b064.js} +24 -5
- package/dist/cjs/{content-state-78a620a9.js → content-state-8d07d530.js} +60 -8
- package/dist/cjs/{dark-mode-style-controller-32d4054a.js → dark-mode-style-controller-f3da3342.js} +2 -2
- package/dist/cjs/{date-required-rule-5250f26d.js → date-required-rule-c0c498ad.js} +1 -1
- package/dist/cjs/{design-token-74674ee7.js → design-token-58bf7fe8.js} +3 -3
- package/dist/cjs/{element-appender-slimmer-597e9e48.js → element-appender-slimmer-a0269315.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-a743be34.js → form-field-controller-slimmer-f73f200e.js} +2 -2
- package/dist/cjs/{image-annotation-action-85c4bd83.js → image-annotation-action-2a28038e.js} +3 -3
- package/dist/cjs/{image-extension-260fa69c.js → image-extension-9659708b.js} +2 -2
- package/dist/cjs/{index-592b4052.js → index-5d1adcd1.js} +86 -0
- package/dist/cjs/index.cjs.js +19 -19
- package/dist/cjs/{inject-keyboard-manager-6a6f5c9f.js → inject-keyboard-manager-4fa45f9c.js} +1 -1
- package/dist/cjs/{internal-calendar-period-factory-dfcdd3f6.js → internal-calendar-period-factory-6196bc80.js} +1 -1
- package/dist/cjs/{internal-translation-controller-1dac2df8.js → internal-translation-controller-51f7f865.js} +2 -0
- package/dist/cjs/{keyboard-manager-c56033b1.js → keyboard-manager-482fe257.js} +1 -1
- package/dist/cjs/{keyboard-manager-slimmer-7043a106.js → keyboard-manager-slimmer-a19430dd.js} +1 -1
- package/dist/cjs/{link-extension-220ff6a9.js → link-extension-11340e1c.js} +26 -7
- package/dist/cjs/loader.cjs.js +13 -13
- package/dist/cjs/{month-view-generator-7b704a80.js → month-view-generator-1a534451.js} +1 -1
- package/dist/cjs/{public-rules-5657bce4.js → public-rules-6c77b545.js} +9 -9
- package/dist/cjs/{range-c5afd53a.js → range-22ddd452.js} +1 -1
- package/dist/cjs/{responsive-format-facade-493d1763.js → responsive-format-facade-74e6d791.js} +1 -1
- package/dist/cjs/{rich-text-editor-required-rule-385c1b61.js → rich-text-editor-required-rule-09d1093a.js} +1 -1
- package/dist/cjs/{split-cell-operation-873d5db7.js → split-cell-operation-11bfb305.js} +14 -4
- package/dist/cjs/{state-border-formatter-711c7aaa.js → state-border-formatter-bf4f9f1c.js} +1 -1
- package/dist/cjs/{string-format-strategy.abstract-b61bdcbd.js → string-format-strategy.abstract-bf37b14c.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-ef65cca7.js → string-input-formatter-slimmer-ffeb18a6.js} +1 -1
- package/dist/cjs/{string-mask-strategy-ad3fa0ac.js → string-mask-strategy-7f394726.js} +2 -2
- package/dist/cjs/{style-formatter-8f711cb0.js → style-formatter-4ac63910.js} +2 -2
- package/dist/cjs/{time-required-rule-87417359.js → time-required-rule-e2a50003.js} +1 -1
- package/dist/cjs/{token-extension-78b5a026.js → token-extension-4686cb3b.js} +2920 -157
- package/dist/cjs/{translation-slimmer-77c7f37d.js → translation-slimmer-e4997f8f.js} +1 -1
- package/dist/cjs/{type-guard-a57ef3ac.js → type-guard-b8d7bb3f.js} +1 -1
- package/dist/cjs/{valid-credit-card-number-rule-4c0a3040.js → valid-credit-card-number-rule-f5a6f009.js} +1 -1
- package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
- package/dist/cjs/vega-app-footer.cjs.entry.js +2 -2
- package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
- package/dist/cjs/vega-box.cjs.entry.js +7 -7
- package/dist/cjs/vega-brand-logo.cjs.entry.js +2 -2
- package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
- package/dist/cjs/vega-button-circle.cjs.entry.js +6 -6
- package/dist/cjs/vega-button-link.cjs.entry.js +1 -1
- package/dist/cjs/vega-button.cjs.entry.js +4 -4
- package/dist/cjs/vega-calendar_5.cjs.entry.js +21 -10
- package/dist/cjs/vega-card.cjs.entry.js +5 -5
- package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-chip.cjs.entry.js +5 -5
- package/dist/cjs/vega-code-block.cjs.entry.js +11 -11
- package/dist/cjs/vega-color-picker.cjs.entry.js +3 -3
- package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +4 -4
- package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +9 -9
- package/dist/cjs/vega-counter-badge.cjs.entry.js +2 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +14 -14
- package/dist/cjs/vega-dialog_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-divider.cjs.entry.js +5 -5
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +23 -14
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-field-label.cjs.entry.js +3 -3
- package/dist/cjs/vega-file-uploader.cjs.entry.js +4 -4
- package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
- package/dist/cjs/vega-flex.cjs.entry.js +6 -6
- package/dist/cjs/vega-font.cjs.entry.js +5 -5
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-grid.cjs.entry.js +5 -5
- package/dist/cjs/vega-icon.cjs.entry.js +6 -6
- package/dist/cjs/vega-image-uploader.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +7 -7
- package/dist/cjs/vega-input-numeric.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-passcode.cjs.entry.js +6 -6
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +5 -5
- package/dist/cjs/vega-input-range.cjs.entry.js +4 -4
- package/dist/cjs/vega-input-select.cjs.entry.js +6 -6
- package/dist/cjs/vega-input.cjs.entry.js +7 -7
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +10 -10
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
- package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
- package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
- package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-radio_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +39 -11
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +79 -22
- package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +1 -1
- package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
- package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +10 -10
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +5 -5
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +8 -8
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -3
- package/dist/cjs/vega-tab-group_2.cjs.entry.js +21 -8
- package/dist/cjs/vega-table_11.cjs.entry.js +81 -45
- package/dist/cjs/vega-textarea.cjs.entry.js +3 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +10 -10
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +3 -3
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
- package/dist/cjs/vega.cjs.js +13 -13
- package/dist/collection/components/vega-calendar/slimmers/common/renderers/vega-calendar-event-item-renderer.js +5 -2
- package/dist/collection/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.js +9 -1
- package/dist/collection/components/vega-counter-badge/vega-counter-badge.js +2 -2
- package/dist/collection/components/vega-dropdown/vega-dropdown-group/slimmers/renderers/vega-dropdown-group-renderer.js +6 -4
- package/dist/collection/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.js +10 -2
- package/dist/collection/components/vega-field-label/vega-field-label.css +1 -0
- package/dist/collection/components/vega-rich-text-editor/constants/constant.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/dto/annotations/text-style-default-styles.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy-registry.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy.abstract.js +5 -2
- package/dist/collection/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/title-heading-node-filter-styles-strategy.js +36 -2
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.js +20 -3
- package/dist/collection/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/block-boundary-registry.js +34 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/extension.abstract.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/action-handler-strategies/insert-function-block-strategy.js +3 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/constants.js +8 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +14 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/logic-control-block.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-containing-function-block-strategy.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +9 -5
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-content-strategy.js +3 -3
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-logic-control-block-strategy.js +4 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js +18 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-block-renderer.js +5 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/logic-control-block-renderer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/functions/utils.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js +1 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/action-handler-strategies/image-replace-src-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/actions/image-replace-src-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/paste-image-parser.js +295 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/pending-image-registry.js +116 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.js +13 -4
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-extension.js +70 -7
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/default-paste-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.js +59 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/word-paste-strategy.js +416 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-code-block-transformer.js +106 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-image-transformer.js +198 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-list-transformer.js +591 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-paragraph-transformer.js +112 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-table-transformer.js +551 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-transformer.js +7 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/table/dto/table-block.js +10 -0
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.js +4 -2
- package/dist/collection/components/vega-rich-text-editor/extensions/tokens/token-node.js +44 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/extension-controller.js +2 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.js +7 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +18 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +21 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.js +7 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/vega-rich-text-editor-source-view-renderer.js +5 -2
- package/dist/collection/components/vega-tab-group/slimmers/vega-tab-group/renderers/vega-tab-group-tab-list-renderer.js +14 -7
- package/dist/collection/components/vega-tab-group/vega-tab-group.css +6 -0
- package/dist/collection/components/vega-tab-group/vega-tab-group.js +5 -0
- package/dist/collection/components/vega-table/slimmers/controllers/vega-table-body-col-span-controller.js +31 -1
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-body-col-span-resolver.js +18 -11
- package/dist/collection/helpers/translation/locales/en.js +2 -0
- package/dist/collection/utils/sanitize/index.js +3 -2
- package/dist/collection/utils/sanitize/strategies/index.js +1 -0
- package/dist/collection/utils/sanitize/strategies/label-sanitize-strategy.js +14 -0
- package/dist/collection/utils/sanitize/strategies/plain-text-sanitize-strategy.js +70 -0
- package/dist/esm/{action-color-accessibility-validator-ce55cb07.js → action-color-accessibility-validator-08877515.js} +2 -2
- package/dist/esm/{app-globals-95c7110a.js → app-globals-c59364c2.js} +10 -10
- package/dist/esm/{code-block-9c513169.js → code-block-e6443949.js} +39 -7
- package/dist/esm/{component-global-style-slimmer-ac703085.js → component-global-style-slimmer-7d60a04a.js} +1 -1
- package/dist/esm/{component-value-history-controller-slimmer.abstract-9cef2a2a.js → component-value-history-controller-slimmer.abstract-ee393213.js} +24 -5
- package/dist/esm/{content-state-25c81c08.js → content-state-43cdacff.js} +60 -9
- package/dist/esm/{dark-mode-style-controller-ca5afd2d.js → dark-mode-style-controller-352f15ff.js} +2 -2
- package/dist/esm/{date-required-rule-85334d0c.js → date-required-rule-b5b67498.js} +1 -1
- package/dist/esm/{design-token-10ff79b5.js → design-token-8319bb59.js} +3 -3
- package/dist/esm/{element-appender-slimmer-8a06ecdd.js → element-appender-slimmer-c81d1fe3.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-68fc5380.js → form-field-controller-slimmer-511b7ac5.js} +2 -2
- package/dist/esm/{image-annotation-action-d7f2aecc.js → image-annotation-action-d7cb80aa.js} +3 -3
- package/dist/esm/{image-extension-fbd1ed6e.js → image-extension-9b8abd0d.js} +2 -2
- package/dist/esm/{index-3b327f29.js → index-35451d12.js} +86 -1
- package/dist/esm/index.js +19 -19
- package/dist/esm/{inject-keyboard-manager-ea1aad5b.js → inject-keyboard-manager-dd368d56.js} +1 -1
- package/dist/esm/{internal-calendar-period-factory-7b294fb6.js → internal-calendar-period-factory-d58f35c6.js} +1 -1
- package/dist/esm/{internal-translation-controller-fac22598.js → internal-translation-controller-b33430c6.js} +2 -0
- package/dist/esm/{keyboard-manager-50da85d7.js → keyboard-manager-b4a0d97d.js} +1 -1
- package/dist/esm/{keyboard-manager-slimmer-1f7c8bfb.js → keyboard-manager-slimmer-0517fc70.js} +1 -1
- package/dist/esm/{link-extension-e8ee103e.js → link-extension-230bae8d.js} +26 -7
- package/dist/esm/loader.js +13 -13
- package/dist/esm/{month-view-generator-a1a9a4ec.js → month-view-generator-f470caac.js} +1 -1
- package/dist/esm/{public-rules-49de79c7.js → public-rules-28ef32d3.js} +9 -9
- package/dist/esm/{range-b678c693.js → range-efad2578.js} +1 -1
- package/dist/esm/{responsive-format-facade-f19b601c.js → responsive-format-facade-dec87e46.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-578e0958.js → rich-text-editor-required-rule-a697e5bd.js} +1 -1
- package/dist/esm/{split-cell-operation-1c8e7585.js → split-cell-operation-89b91a38.js} +14 -4
- package/dist/esm/{state-border-formatter-bfda33aa.js → state-border-formatter-1e900a2f.js} +1 -1
- package/dist/esm/{string-format-strategy.abstract-1f4ff1b3.js → string-format-strategy.abstract-d0ce3f65.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-0006a107.js → string-input-formatter-slimmer-6546cfc7.js} +1 -1
- package/dist/esm/{string-mask-strategy-bbbcdbef.js → string-mask-strategy-dd13ae21.js} +2 -2
- package/dist/esm/{style-formatter-e9adc8f4.js → style-formatter-057d7120.js} +2 -2
- package/dist/esm/{time-required-rule-1ce2d0a0.js → time-required-rule-73753a54.js} +1 -1
- package/dist/esm/{token-extension-f2d009e3.js → token-extension-74a0eeb1.js} +2918 -155
- package/dist/esm/{translation-slimmer-ee0f0e76.js → translation-slimmer-ef970ffc.js} +1 -1
- package/dist/esm/{type-guard-f2624334.js → type-guard-6fc96870.js} +1 -1
- package/dist/esm/{valid-credit-card-number-rule-60212b1d.js → valid-credit-card-number-rule-b54a31e7.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +6 -6
- package/dist/esm/vega-app-footer.entry.js +2 -2
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-box.entry.js +7 -7
- package/dist/esm/vega-brand-logo.entry.js +2 -2
- package/dist/esm/vega-breadcrumb.entry.js +2 -2
- package/dist/esm/vega-button-circle.entry.js +6 -6
- package/dist/esm/vega-button-link.entry.js +1 -1
- package/dist/esm/vega-button.entry.js +4 -4
- package/dist/esm/vega-calendar_5.entry.js +21 -10
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +3 -3
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +11 -11
- package/dist/esm/vega-color-picker.entry.js +3 -3
- package/dist/esm/vega-color-swatch-picker.entry.js +4 -4
- package/dist/esm/vega-color-swatch.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +9 -9
- package/dist/esm/vega-counter-badge.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +14 -14
- package/dist/esm/vega-dialog_2.entry.js +5 -5
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +23 -14
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-field-label.entry.js +3 -3
- package/dist/esm/vega-file-uploader.entry.js +4 -4
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +6 -6
- package/dist/esm/vega-image-uploader.entry.js +7 -7
- package/dist/esm/vega-input-credit-card.entry.js +7 -7
- package/dist/esm/vega-input-numeric.entry.js +6 -6
- package/dist/esm/vega-input-passcode.entry.js +6 -6
- package/dist/esm/vega-input-phone-number.entry.js +5 -5
- package/dist/esm/vega-input-range.entry.js +4 -4
- package/dist/esm/vega-input-select.entry.js +6 -6
- package/dist/esm/vega-input.entry.js +7 -7
- package/dist/esm/vega-left-nav_5.entry.js +10 -10
- package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-popover_2.entry.js +8 -8
- package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
- package/dist/esm/vega-radio_2.entry.js +6 -6
- package/dist/esm/vega-rich-text-content.entry.js +39 -11
- package/dist/esm/vega-rich-text-editor_4.entry.js +79 -22
- package/dist/esm/vega-rich-text-find-replace-panel.entry.js +1 -1
- package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
- package/dist/esm/vega-rich-text-table-properties_3.entry.js +10 -10
- package/dist/esm/vega-selection-chip_2.entry.js +5 -5
- package/dist/esm/vega-selection-tile_2.entry.js +3 -3
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +8 -8
- package/dist/esm/vega-stepper.entry.js +3 -3
- package/dist/esm/vega-tab-group_2.entry.js +21 -8
- package/dist/esm/vega-table_11.entry.js +53 -17
- package/dist/esm/vega-textarea.entry.js +3 -3
- package/dist/esm/vega-time-picker_2.entry.js +10 -10
- package/dist/esm/vega-toggle-switch.entry.js +3 -3
- package/dist/esm/vega-tooltip_2.entry.js +6 -6
- package/dist/esm/vega.js +13 -13
- package/dist/sri/vega-sri-manifest.json +349 -349
- package/dist/types/components/vega-calendar/vega-calendar-event-preview/slimmers/renderers/vega-calendar-event-preview-detail-renderer.d.ts +2 -0
- package/dist/types/components/vega-dropdown/vega-dropdown-item/slimmers/renderers/vega-dropdown-item-renderer.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/annotations/text-style-default-styles.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +9 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy-registry.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/filter-styles-strategy.abstract.d.ts +3 -2
- package/dist/types/components/vega-rich-text-editor/dto/filter-styles-strategies/text-node/title-heading-node-filter-styles-strategy.d.ts +25 -3
- package/dist/types/components/vega-rich-text-editor/dto/renderers/blocks/block-text-nodes-renderer.abstract.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/dto/renderers/nodes/text-node-renderer.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/block-boundary-registry.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/extensions/extension.abstract.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/constants.d.ts +4 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +7 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-containing-function-block-strategy.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/function-extension.d.ts +6 -0
- package/dist/types/components/vega-rich-text-editor/extensions/functions/utils.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/action-handler-strategies/image-replace-src-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/actions/image-replace-src-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/paste-image-parser.d.ts +136 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/pending-image-registry.d.ts +68 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.d.ts +9 -4
- package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-extension.d.ts +39 -2
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/default-paste-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.d.ts +61 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.d.ts +45 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/word-paste-strategy.d.ts +186 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-code-block-transformer.d.ts +51 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-image-transformer.d.ts +86 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-list-transformer.d.ts +271 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-paragraph-transformer.d.ts +25 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-table-transformer.d.ts +240 -0
- package/dist/types/components/vega-rich-text-editor/extensions/paste/word-paste-transformers/word-structure-transformer.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/extensions/table/dto/table-block.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/span-to-token-node-strategy.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/extensions/tokens/token-node.d.ts +19 -1
- package/dist/types/components/vega-rich-text-editor/interface.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/text-style-annotation-handler.d.ts +4 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/element-to-dto-strategy/continue-inline-to-rte-text-block-strategy.d.ts +8 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/renderers/tools/source-edit-toolbar-button-slimmer.d.ts +1 -0
- package/dist/types/components/vega-tab-group/slimmers/vega-tab-group/renderers/vega-tab-group-tab-list-renderer.d.ts +1 -0
- package/dist/types/components/vega-tab-group/types.d.ts +3 -1
- package/dist/types/components/vega-tab-group/vega-tab-group.d.ts +2 -0
- package/dist/types/components/vega-table/interface.d.ts +4 -4
- package/dist/types/components/vega-table/slimmers/controllers/vega-table-body-col-span-controller.d.ts +16 -0
- package/dist/types/components/vega-table/slimmers/renderers/vega-table-body-col-span-resolver.d.ts +8 -10
- package/dist/types/helpers/translation/interface.d.ts +3 -1
- package/dist/types/types/public-api.d.ts +1 -0
- package/dist/types/utils/sanitize/index.d.ts +3 -2
- package/dist/types/utils/sanitize/strategies/index.d.ts +1 -0
- package/dist/types/utils/sanitize/strategies/label-sanitize-strategy.d.ts +9 -0
- package/dist/types/utils/sanitize/strategies/plain-text-sanitize-strategy.d.ts +36 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-0cbf09f7.entry.js → p-024db952.entry.js} +1 -1
- package/dist/vega/p-0b2c4c0b.js +1 -0
- package/dist/vega/{p-c2277448.entry.js → p-0ca3b4bf.entry.js} +1 -1
- package/dist/vega/{p-6f537797.entry.js → p-1a37d63c.entry.js} +1 -1
- package/dist/vega/{p-b622c455.js → p-1fa22fda.js} +1 -1
- package/dist/vega/{p-d609c3fd.js → p-2044eba9.js} +1 -1
- package/dist/vega/{p-56db3323.js → p-22edd3cc.js} +1 -1
- package/dist/vega/{p-5f96e741.entry.js → p-23c1f378.entry.js} +1 -1
- package/dist/vega/{p-6c95a6a3.js → p-2529820e.js} +1 -1
- package/dist/vega/{p-8d96f0e8.entry.js → p-2af1d8b8.entry.js} +1 -1
- package/dist/vega/{p-17c69503.entry.js → p-2f89ee14.entry.js} +1 -1
- package/dist/vega/{p-2bb5a232.js → p-3091b105.js} +1 -1
- package/dist/vega/{p-52c69f9e.entry.js → p-328ebbdb.entry.js} +1 -1
- package/dist/vega/p-35628af4.js +1 -0
- package/dist/vega/{p-9abf7d0a.entry.js → p-35d37477.entry.js} +1 -1
- package/dist/vega/{p-8c56d74d.entry.js → p-3a230d4b.entry.js} +1 -1
- package/dist/vega/{p-4bfe3258.entry.js → p-3c152bad.entry.js} +1 -1
- package/dist/vega/p-3c559c8b.js +1 -0
- package/dist/vega/{p-d470fce2.entry.js → p-3c8421d5.entry.js} +1 -1
- package/dist/vega/{p-7dcd2850.entry.js → p-4022412e.entry.js} +1 -1
- package/dist/vega/{p-c70748f7.entry.js → p-433b1395.entry.js} +1 -1
- package/dist/vega/{p-b98ead05.entry.js → p-4370b954.entry.js} +1 -1
- package/dist/vega/p-444e24c6.js +1 -0
- package/dist/vega/p-4473d8b1.js +3 -0
- package/dist/vega/{p-a484e32d.entry.js → p-44999c88.entry.js} +1 -1
- package/dist/vega/{p-f29ea345.entry.js → p-47a48329.entry.js} +1 -1
- package/dist/vega/{p-0cf3b5c1.entry.js → p-49d7cfed.entry.js} +1 -1
- package/dist/vega/{p-92528dc9.entry.js → p-4afd6715.entry.js} +1 -1
- package/dist/vega/{p-461100b8.entry.js → p-4f6aaac5.entry.js} +1 -1
- package/dist/vega/p-50eda925.js +1 -0
- package/dist/vega/{p-ae2abdfa.js → p-5110c84f.js} +1 -1
- package/dist/vega/{p-2a245138.entry.js → p-5147c30d.entry.js} +1 -1
- package/dist/vega/{p-874e5624.js → p-52878ea9.js} +1 -1
- package/dist/vega/{p-b00ec194.entry.js → p-55dc3053.entry.js} +1 -1
- package/dist/vega/p-5af312f8.js +1 -0
- package/dist/vega/{p-3e09aeed.js → p-5b3c8a56.js} +1 -1
- package/dist/vega/{p-2acf9b42.entry.js → p-5e9e04f3.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-6493f13a.entry.js +1 -0
- package/dist/vega/{p-56598858.entry.js → p-6659c910.entry.js} +1 -1
- package/dist/vega/{p-95c18f79.entry.js → p-66728dd4.entry.js} +1 -1
- package/dist/vega/{p-4cbfc01e.entry.js → p-66a785d0.entry.js} +1 -1
- package/dist/vega/{p-36d9e782.entry.js → p-66fe8b4e.entry.js} +1 -1
- package/dist/vega/p-67e88cd7.entry.js +1 -0
- package/dist/vega/{p-456f678b.js → p-691bdc20.js} +1 -1
- package/dist/vega/{p-94975537.entry.js → p-6d6b4495.entry.js} +1 -1
- package/dist/vega/p-7754b10f.entry.js +1 -0
- package/dist/vega/{p-085d1647.entry.js → p-77fb3971.entry.js} +1 -1
- package/dist/vega/{p-544ce391.entry.js → p-7977352b.entry.js} +1 -1
- package/dist/vega/{p-a91927eb.entry.js → p-7b133734.entry.js} +1 -1
- package/dist/vega/p-7b84a943.entry.js +1 -0
- package/dist/vega/{p-02d3ce79.entry.js → p-840444c9.entry.js} +1 -1
- package/dist/vega/{p-3737b9e2.entry.js → p-860e76f5.entry.js} +1 -1
- package/dist/vega/{p-72fd17a1.entry.js → p-867cc602.entry.js} +1 -1
- package/dist/vega/p-8d2a9012.js +1 -0
- package/dist/vega/{p-7e8fdac4.js → p-8d4be607.js} +1 -1
- package/dist/vega/p-8d77c7cf.js +1 -0
- package/dist/vega/{p-4fd0cf01.js → p-8f3b93db.js} +1 -1
- package/dist/vega/{p-56417ec5.entry.js → p-944e284d.entry.js} +1 -1
- package/dist/vega/{p-6fd4f2c6.js → p-94b54a95.js} +1 -1
- package/dist/vega/p-9c2b3279.js +1 -0
- package/dist/vega/{p-ca3c1317.entry.js → p-9c5289dc.entry.js} +1 -1
- package/dist/vega/{p-810c9c29.js → p-9c9b0629.js} +1 -1
- package/dist/vega/{p-585e4f1c.entry.js → p-9c9ff871.entry.js} +1 -1
- package/dist/vega/{p-2f07d719.entry.js → p-9d90e271.entry.js} +1 -1
- package/dist/vega/{p-d319ebb5.js → p-9e9f49f4.js} +1 -1
- package/dist/vega/{p-dcd3e3a7.js → p-a1f220ca.js} +1 -1
- package/dist/vega/{p-035e2f05.entry.js → p-a4360b7e.entry.js} +1 -1
- package/dist/vega/{p-6d4518d7.entry.js → p-a7517760.entry.js} +1 -1
- package/dist/vega/{p-c5fb8a69.entry.js → p-aa433430.entry.js} +1 -1
- package/dist/vega/{p-1cff027b.entry.js → p-aa914dbd.entry.js} +1 -1
- package/dist/vega/{p-72ab5cd5.entry.js → p-b12de1bf.entry.js} +1 -1
- package/dist/vega/p-b21cc390.entry.js +1 -0
- package/dist/vega/{p-dbb4b1d1.js → p-b3c4943b.js} +1 -1
- package/dist/vega/{p-1aedbfd2.entry.js → p-ba6881da.entry.js} +1 -1
- package/dist/vega/{p-9834d5d4.entry.js → p-bd7725f7.entry.js} +1 -1
- package/dist/vega/{p-a090b2be.js → p-c348eaf5.js} +1 -1
- package/dist/vega/{p-ccbe3f1b.entry.js → p-c8ad7207.entry.js} +1 -1
- package/dist/vega/{p-b3733762.entry.js → p-c8fb3aac.entry.js} +1 -1
- package/dist/vega/p-cc569b54.js +1 -0
- package/dist/vega/{p-c98c2f5f.entry.js → p-ccbed811.entry.js} +1 -1
- package/dist/vega/{p-da867019.entry.js → p-ce82d6bb.entry.js} +1 -1
- package/dist/vega/{p-a81ad3bd.js → p-cede3535.js} +1 -1
- package/dist/vega/p-d35a31a5.entry.js +1 -0
- package/dist/vega/{p-ac94ba1b.entry.js → p-d4d90ce2.entry.js} +1 -1
- package/dist/vega/{p-cb81126a.entry.js → p-d6023dc0.entry.js} +1 -1
- package/dist/vega/{p-a8174ad8.entry.js → p-d62e618a.entry.js} +1 -1
- package/dist/vega/{p-1ea9ad9a.js → p-dd0bd78b.js} +1 -1
- package/dist/vega/{p-36d2df7a.entry.js → p-ded1ecc1.entry.js} +1 -1
- package/dist/vega/p-df63c2fb.entry.js +1 -0
- package/dist/vega/{p-c6d775b8.entry.js → p-e1a65e06.entry.js} +1 -1
- package/dist/vega/{p-39c5054b.js → p-e1c82ca9.js} +1 -1
- package/dist/vega/{p-f6c0e9e7.entry.js → p-e469ba27.entry.js} +1 -1
- package/dist/vega/{p-373541fa.js → p-e4c5cb4f.js} +1 -1
- package/dist/vega/{p-ec64cc59.entry.js → p-f0a0fc77.entry.js} +1 -1
- package/dist/vega/{p-12e8a1b2.js → p-f13b39d8.js} +1 -1
- package/dist/vega/{p-4e065ef7.entry.js → p-f2384411.entry.js} +1 -1
- package/dist/vega/{p-8d2501b2.js → p-f9a3805d.js} +1 -1
- package/dist/vega/{p-1e0a8fd3.js → p-fa5cd8b1.js} +1 -1
- package/dist/vega/{p-2c2e8615.js → p-fcb6b499.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-constants.js +0 -6
- package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-constants.d.ts +0 -6
- package/dist/vega/p-03eeadc1.entry.js +0 -1
- package/dist/vega/p-0eb29065.js +0 -3
- package/dist/vega/p-10d30c03.js +0 -1
- package/dist/vega/p-1250b1ab.entry.js +0 -1
- package/dist/vega/p-1abd3c17.js +0 -1
- package/dist/vega/p-2d158cbd.js +0 -1
- package/dist/vega/p-3d0b4074.js +0 -1
- package/dist/vega/p-56493601.js +0 -1
- package/dist/vega/p-571ec00b.js +0 -1
- package/dist/vega/p-5b1f5e4a.entry.js +0 -1
- package/dist/vega/p-6234852e.entry.js +0 -1
- package/dist/vega/p-781b7a54.js +0 -1
- package/dist/vega/p-cd69aeae.js +0 -1
- package/dist/vega/p-cfe268a8.entry.js +0 -1
- package/dist/vega/p-de8f0d98.js +0 -1
- package/dist/vega/p-f0e828d8.js +0 -1
- package/dist/vega/p-f62c5a20.entry.js +0 -1
- package/dist/vega/p-fa65956c.entry.js +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { generateUUID } from '../../../../../utils/misc';
|
|
2
2
|
import { ElementToDTOStrategy } from '../../../slimmers/controllers/helper/element-to-dto-strategy/element-to-dto-strategy.abstract';
|
|
3
3
|
import { RTEFunctionBlock } from '../dto/function-block';
|
|
4
|
+
import { FUNCTION_BLOCK_CLASS, FUNCTION_SYNTAX_CLASS } from '../constants';
|
|
5
|
+
import { isFunctionBoundaryContainer } from '../utils';
|
|
4
6
|
/**
|
|
5
7
|
* Strategy to convert a div with class 'statement' into an function block.
|
|
6
8
|
*/
|
|
@@ -10,11 +12,13 @@ export class DivToFunctionBlockStrategy extends ElementToDTOStrategy {
|
|
|
10
12
|
*/
|
|
11
13
|
canHandle(elementsArray, currentIndex) {
|
|
12
14
|
const element = elementsArray[currentIndex];
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
if (element.nodeType !== Node.ELEMENT_NODE)
|
|
16
|
+
return 0;
|
|
17
|
+
const isFunctionBoundary = isFunctionBoundaryContainer(element);
|
|
18
|
+
return element.tagName === 'DIV' &&
|
|
19
|
+
isFunctionBoundary &&
|
|
16
20
|
element.childNodes.length &&
|
|
17
|
-
element.querySelector(
|
|
21
|
+
element.querySelector(`.${FUNCTION_SYNTAX_CLASS}`)
|
|
18
22
|
? 1
|
|
19
23
|
: 0;
|
|
20
24
|
}
|
|
@@ -26,7 +30,7 @@ export class DivToFunctionBlockStrategy extends ElementToDTOStrategy {
|
|
|
26
30
|
id: generateUUID(),
|
|
27
31
|
type: 'function-block',
|
|
28
32
|
annotations: {
|
|
29
|
-
customClass: [
|
|
33
|
+
customClass: [FUNCTION_BLOCK_CLASS],
|
|
30
34
|
},
|
|
31
35
|
children: [],
|
|
32
36
|
});
|
|
@@ -2,13 +2,14 @@ import { generateUUID } from '../../../../../utils/misc';
|
|
|
2
2
|
import { RTETextBlock } from '../../../dto/blocks/text-block';
|
|
3
3
|
import htmlElementToAnnotationGenerator from '../../../slimmers/controllers/helper/element-to-dto-strategy/annotation-handler/html-element-to-annotation-generator';
|
|
4
4
|
import { DivToLogicControlBlockStrategy } from './div-to-logic-control-block-strategy';
|
|
5
|
+
import { FUNCTION_CONTENT_CLASS } from '../constants';
|
|
5
6
|
/**
|
|
6
7
|
* Strategy to convert a div with class 'statementelement' into an function block.
|
|
7
8
|
*/
|
|
8
9
|
export class DivToFunctionContentStrategy extends DivToLogicControlBlockStrategy {
|
|
9
10
|
constructor() {
|
|
10
11
|
super(...arguments);
|
|
11
|
-
this.blockClassName =
|
|
12
|
+
this.blockClassName = FUNCTION_CONTENT_CLASS;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* @inheritDoc
|
|
@@ -16,12 +17,11 @@ export class DivToFunctionContentStrategy extends DivToLogicControlBlockStrategy
|
|
|
16
17
|
handle(elementsArray, options) {
|
|
17
18
|
const element = elementsArray[0];
|
|
18
19
|
const annotations = htmlElementToAnnotationGenerator.generate(RTETextBlock, element);
|
|
19
|
-
const nodes = Array.from(elementsArray[0].childNodes);
|
|
20
20
|
return RTETextBlock.from({
|
|
21
21
|
id: generateUUID(),
|
|
22
22
|
type: 'paragraph',
|
|
23
23
|
annotations: Object.assign({ customClass: [this.blockClassName] }, annotations),
|
|
24
|
-
nodes: this.generateChildNodes(
|
|
24
|
+
nodes: this.generateChildNodes(Array.from(elementsArray[0].childNodes), undefined, options),
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { generateUUID } from '../../../../../utils/misc';
|
|
2
2
|
import { RTELogicControlBlock } from '../dto/logic-control-block';
|
|
3
3
|
import { BlockToRTEBlockStrategyAbstract } from '../../../slimmers/controllers/helper/element-to-dto-strategy/block-to-rte-block-strategy.abstract';
|
|
4
|
+
import { FUNCTION_SYNTAX_CLASS } from '../constants';
|
|
5
|
+
import { isFunctionBoundaryContainer } from '../utils';
|
|
4
6
|
/**
|
|
5
7
|
* Strategy to convert a div with class 'statementsyntax' into an RTELogicControlBlock DTO.
|
|
6
8
|
*/
|
|
7
9
|
export class DivToLogicControlBlockStrategy extends BlockToRTEBlockStrategyAbstract {
|
|
8
10
|
constructor() {
|
|
9
11
|
super(...arguments);
|
|
10
|
-
this.blockClassName =
|
|
12
|
+
this.blockClassName = FUNCTION_SYNTAX_CLASS;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* @inheritDoc
|
|
@@ -50,6 +52,6 @@ export class DivToLogicControlBlockStrategy extends BlockToRTEBlockStrategyAbstr
|
|
|
50
52
|
* @returns {boolean} True if the element is a child of a function block, false otherwise
|
|
51
53
|
*/
|
|
52
54
|
isFunctionBlockChild(element) {
|
|
53
|
-
return !!(element.parentElement && element.parentElement
|
|
55
|
+
return !!(element.parentElement && isFunctionBoundaryContainer(element.parentElement));
|
|
54
56
|
}
|
|
55
57
|
}
|
package/dist/collection/components/vega-rich-text-editor/extensions/functions/function-extension.js
CHANGED
|
@@ -10,6 +10,7 @@ import { RTELogicControlBlockRenderer } from './renderers/logic-control-block-re
|
|
|
10
10
|
import { DivToLogicControlBlockStrategy } from './element-to-dto-strategies/div-to-logic-control-block-strategy';
|
|
11
11
|
import { DivToFunctionBlockStrategy } from './element-to-dto-strategies/div-to-function-block-strategy';
|
|
12
12
|
import { DivToFunctionContentStrategy } from './element-to-dto-strategies/div-to-function-content-strategy';
|
|
13
|
+
import { FunctionBlockContainerStrategy } from './element-to-dto-strategies/div-containing-function-block-strategy';
|
|
13
14
|
import { RTEFunctionBlock } from './dto/function-block';
|
|
14
15
|
import { RTEFunctionBlockRenderer } from './renderers/function-block-renderer';
|
|
15
16
|
import { ModifyContentActionType } from '../../dto/actions/modify-content-action.abstract';
|
|
@@ -18,15 +19,18 @@ import { FunctionBlockInsertParagraphStrategy } from './action-handler-strategie
|
|
|
18
19
|
import { PreventPasteContentInterceptor } from './action-handler-interceptor/prevent-paste-content-interceptor';
|
|
19
20
|
import { PASTE_PLAIN_TEXT } from './actions/paste-plain-text-action';
|
|
20
21
|
import { PastePlainTextStrategy } from './action-handler-strategies/paste-plain-text-strategy';
|
|
22
|
+
import { isFunctionBlockElement } from './utils';
|
|
21
23
|
const convertLogicControlBlockStrategy = new DivToLogicControlBlockStrategy();
|
|
22
24
|
const convertFunctionContentStrategy = new DivToFunctionContentStrategy();
|
|
23
25
|
const convertFunctionBlockStrategy = new DivToFunctionBlockStrategy();
|
|
26
|
+
const convertFunctionBlockContainerStrategy = new FunctionBlockContainerStrategy();
|
|
24
27
|
/**
|
|
25
28
|
* Function extension class for Vega Rich Text Editor.
|
|
26
29
|
*/
|
|
27
30
|
export class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
28
31
|
constructor() {
|
|
29
32
|
super();
|
|
33
|
+
this.unregisterBlockBoundaryPredicate = null;
|
|
30
34
|
this.registerBlockBasicStrategies(RTELogicControlBlock.name);
|
|
31
35
|
this.registerBlockBasicStrategies(RTEFunctionBlock.name);
|
|
32
36
|
this.preventFunctionBlockDefaultInsertNewParagraph();
|
|
@@ -37,11 +41,25 @@ export class VegaRTEFunctionExtension extends VegaRTEExtension {
|
|
|
37
41
|
this.registerElementToBlockDTOClassStrategy(convertLogicControlBlockStrategy);
|
|
38
42
|
this.registerElementToBlockDTOClassStrategy(convertFunctionContentStrategy);
|
|
39
43
|
this.registerElementToBlockDTOClassStrategy(convertFunctionBlockStrategy);
|
|
44
|
+
this.registerElementToBlockDTOClassStrategy(convertFunctionBlockContainerStrategy);
|
|
40
45
|
}
|
|
41
46
|
/** @inheritDoc */
|
|
42
47
|
prepareBeforeLoad(host) {
|
|
43
48
|
this.registerToolbarButtonRenderer(VegaRTEFunctionExtension.TOOLBAR_BUTTON_KEY, new FunctionToolbarButtonRenderer(), host);
|
|
44
49
|
}
|
|
50
|
+
/** @inheritDoc */
|
|
51
|
+
initialExtensionAfterLoad(context) {
|
|
52
|
+
var _a;
|
|
53
|
+
super.initialExtensionAfterLoad(context);
|
|
54
|
+
(_a = this.unregisterBlockBoundaryPredicate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
55
|
+
this.unregisterBlockBoundaryPredicate = this.registerBlockBoundaryPredicate(isFunctionBlockElement);
|
|
56
|
+
}
|
|
57
|
+
/** @inheritDoc */
|
|
58
|
+
destroyExtension() {
|
|
59
|
+
var _a;
|
|
60
|
+
(_a = this.unregisterBlockBoundaryPredicate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
61
|
+
this.unregisterBlockBoundaryPredicate = null;
|
|
62
|
+
}
|
|
45
63
|
/**
|
|
46
64
|
* Remove the appen children strategies to prevent default insert new paragraph logic in function block
|
|
47
65
|
*/
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { VegaRTEExtensionRenderer } from '../../base-extension-renderer';
|
|
2
|
+
import { FUNCTION_BLOCK_CLASS } from '../constants';
|
|
3
|
+
import { RTE_BLOCK_BOUNDARY_ATTRIBUTE } from '../../../constants/constant';
|
|
2
4
|
import styles from './function-block-styles.css';
|
|
3
5
|
/**
|
|
4
6
|
* Renderer for Function Block
|
|
@@ -11,6 +13,7 @@ export class RTEFunctionBlockRenderer extends VegaRTEExtensionRenderer {
|
|
|
11
13
|
return createElement('div', {
|
|
12
14
|
key: renderData.id,
|
|
13
15
|
class: this.getElementClassName(renderData),
|
|
16
|
+
[RTE_BLOCK_BOUNDARY_ATTRIBUTE]: '',
|
|
14
17
|
ref: this.useRef(renderData),
|
|
15
18
|
});
|
|
16
19
|
}
|
|
@@ -30,8 +33,8 @@ export class RTEFunctionBlockRenderer extends VegaRTEExtensionRenderer {
|
|
|
30
33
|
*/
|
|
31
34
|
getElementClassName(block) {
|
|
32
35
|
let classes = block.getClasses();
|
|
33
|
-
if (classes.indexOf(
|
|
34
|
-
classes = '
|
|
36
|
+
if (classes.indexOf(FUNCTION_BLOCK_CLASS) < 0) {
|
|
37
|
+
classes = FUNCTION_BLOCK_CLASS + ' ' + classes;
|
|
35
38
|
}
|
|
36
39
|
return classes.trim();
|
|
37
40
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VegaRTEExtensionRenderer } from '../../base-extension-renderer';
|
|
2
|
+
import { FUNCTION_SYNTAX_CLASS } from '../constants';
|
|
2
3
|
/**
|
|
3
4
|
* Renders a logic control block in the rich text editor.
|
|
4
5
|
*/
|
|
@@ -9,7 +10,7 @@ export class RTELogicControlBlockRenderer extends VegaRTEExtensionRenderer {
|
|
|
9
10
|
doRender(h, renderData) {
|
|
10
11
|
return h('div', {
|
|
11
12
|
key: renderData.id,
|
|
12
|
-
class:
|
|
13
|
+
class: FUNCTION_SYNTAX_CLASS,
|
|
13
14
|
ref: this.useRef(renderData),
|
|
14
15
|
}, h('span', {
|
|
15
16
|
key: `${renderData.id}-1`,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RTE_BLOCK_BOUNDARY_ATTRIBUTE } from '../../constants/constant';
|
|
2
|
+
import { FUNCTION_BLOCK_CLASS, FUNCTION_ELEMENT_CLASSES } from './constants';
|
|
3
|
+
/**
|
|
4
|
+
* Returns true when the element belongs to function extension blocks by semantic
|
|
5
|
+
* boundary attribute or known function element classes.
|
|
6
|
+
*
|
|
7
|
+
* Use this helper for broad detection (e.g., extension-level boundary predicate
|
|
8
|
+
* registration) where both container and child function elements should be
|
|
9
|
+
* treated as part of the function block structure.
|
|
10
|
+
*
|
|
11
|
+
* @param {HTMLElement} element - Element to inspect.
|
|
12
|
+
* @returns {boolean} Whether the element belongs to a function block structure.
|
|
13
|
+
* @example
|
|
14
|
+
* this.registerBlockBoundaryPredicate(isFunctionBlockElement);
|
|
15
|
+
*/
|
|
16
|
+
export const isFunctionBlockElement = (element) => {
|
|
17
|
+
return (element.hasAttribute(RTE_BLOCK_BOUNDARY_ATTRIBUTE) ||
|
|
18
|
+
FUNCTION_ELEMENT_CLASSES.some((functionClass) => element.classList.contains(functionClass)));
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Returns true when the element is a function block boundary container.
|
|
22
|
+
*
|
|
23
|
+
* Use this helper when conversion logic must identify only the function block
|
|
24
|
+
* container element (the DIV that maps to RTEFunctionBlock), not function child
|
|
25
|
+
* elements such as syntax/content nodes.
|
|
26
|
+
*
|
|
27
|
+
* @param {HTMLElement} element - Element to inspect.
|
|
28
|
+
* @returns {boolean} Whether the element is a function block boundary container.
|
|
29
|
+
* @example
|
|
30
|
+
* if (isFunctionBoundaryContainer(element)) {
|
|
31
|
+
* // map the DIV to RTEFunctionBlock
|
|
32
|
+
* }
|
|
33
|
+
*/
|
|
34
|
+
export const isFunctionBoundaryContainer = (element) => {
|
|
35
|
+
return (element.hasAttribute(RTE_BLOCK_BOUNDARY_ATTRIBUTE) || element.classList.contains(FUNCTION_BLOCK_CLASS));
|
|
36
|
+
};
|
package/dist/collection/components/vega-rich-text-editor/extensions/languages/language-extension.js
CHANGED
|
@@ -130,6 +130,7 @@ export class VegaRTELanguageExtension extends VegaRTEExtension {
|
|
|
130
130
|
options = {
|
|
131
131
|
autoMatchFormat: (_a = host.sourceEditConfig.autoMatchFormat) !== null && _a !== void 0 ? _a : true,
|
|
132
132
|
filterInlineStyles: host.sourceEditConfig.filterInlineStyles,
|
|
133
|
+
blockBoundaryRegistry: this.extensionContext.blockBoundaryRegistry,
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
136
|
result = VegaRTEContent.fromHtml(codeBlock.value.code, options);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ActionHandleStrategy } from '../../../dto/action-handle-strategies/action-handle-strategy.abstract';
|
|
2
|
+
import { PasteImageParser } from '../parse-local-images-helper/paste-image-parser';
|
|
3
|
+
/**
|
|
4
|
+
* Strategy to handle the `ImageReplaceSrcAction` for replacing the `src` attribute of an `<img>` element in the RTE content.
|
|
5
|
+
*/
|
|
6
|
+
export class ImageReplaceSrcStrategy extends ActionHandleStrategy {
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
|
+
handleAction(action, target) {
|
|
11
|
+
const { img, url } = action;
|
|
12
|
+
img.setAttribute('src', url);
|
|
13
|
+
img.removeAttribute(PasteImageParser.PREVIEW_IMG_KEY);
|
|
14
|
+
target.url = url;
|
|
15
|
+
if (target.annotationMap && target.annotationMap.has('CUSTOM_ATTRIBUTE')) {
|
|
16
|
+
const customAttributeAnnotation = target.annotationMap.get('CUSTOM_ATTRIBUTE');
|
|
17
|
+
customAttributeAnnotation.customAttribute.src = url;
|
|
18
|
+
delete customAttributeAnnotation.customAttribute[PasteImageParser.PREVIEW_IMG_KEY];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ModifyContentAction } from '../../../dto/actions/modify-content-action.abstract';
|
|
2
|
+
export const REPLACE_IMAGE_SRC = 'REPLACE_IMAGE_SRC';
|
|
3
|
+
/**
|
|
4
|
+
* Action to replace the `src` attribute of an `<img>` element in the RTE content.
|
|
5
|
+
*/
|
|
6
|
+
export class ImageReplaceSrcAction extends ModifyContentAction {
|
|
7
|
+
constructor(imageElement, url) {
|
|
8
|
+
super();
|
|
9
|
+
this.type = REPLACE_IMAGE_SRC;
|
|
10
|
+
this.img = imageElement;
|
|
11
|
+
this.url = url;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { generateUUID } from '../../../../../utils/misc';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts pasted image files from clipboard payloads and swaps matching
|
|
4
|
+
* `<img>` elements to local object-URL previews.
|
|
5
|
+
*
|
|
6
|
+
* The parser is stateless: callers own the returned {@link PasteImagePreview}
|
|
7
|
+
* list and decide how to track pending uploads.
|
|
8
|
+
*/
|
|
9
|
+
export class PasteImageParser {
|
|
10
|
+
/**
|
|
11
|
+
* Parses local `file://` images from the HTML, swaps matching `<img>`
|
|
12
|
+
* elements to object-URL previews, and returns the rewritten HTML alongside
|
|
13
|
+
* the resolved pending previews.
|
|
14
|
+
*
|
|
15
|
+
* When no local images are resolved, the original HTML is returned unchanged
|
|
16
|
+
* with an empty preview list.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} html HTML content to parse.
|
|
19
|
+
* @param {ClipboardFileContent | null} clipboardFileContent Clipboard payload for image extraction.
|
|
20
|
+
* @returns {ParseLocalImagesResult} Rewritten HTML and resolved previews.
|
|
21
|
+
*/
|
|
22
|
+
parseLocalImages(html, clipboardFileContent) {
|
|
23
|
+
if (!html.includes('<img')) {
|
|
24
|
+
return { html, previews: [] };
|
|
25
|
+
}
|
|
26
|
+
const safeHtml = html.replace(/\s+style=/g, ' data-style=');
|
|
27
|
+
const parser = new DOMParser();
|
|
28
|
+
const parsedDoc = parser.parseFromString(safeHtml, 'text/html');
|
|
29
|
+
const localImageElements = Array.from(parsedDoc.querySelectorAll('img')).filter((img) => img.src.startsWith('file://'));
|
|
30
|
+
if (localImageElements.length === 0) {
|
|
31
|
+
return { html, previews: [] };
|
|
32
|
+
}
|
|
33
|
+
const imageFiles = this.extractImageFiles(clipboardFileContent, localImageElements);
|
|
34
|
+
if (imageFiles.length === 0) {
|
|
35
|
+
return { html, previews: [] };
|
|
36
|
+
}
|
|
37
|
+
const previews = this.createImagePreviews(localImageElements, imageFiles);
|
|
38
|
+
const rewrittenHtml = parsedDoc.body.innerHTML.replace(/ data-style=/g, ' style=');
|
|
39
|
+
return { html: rewrittenHtml, previews };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Swaps each `<img>` src to a local object-URL preview using the provided
|
|
43
|
+
* image files (paired by order), returning one preview per resolved image.
|
|
44
|
+
*
|
|
45
|
+
* Images that live inside a list are dropped instead of being previewed: the
|
|
46
|
+
* RTE does not support list images. They are removed here (after holding their
|
|
47
|
+
* position while the RTF images are paired by order) so the remaining images
|
|
48
|
+
* stay aligned with their files even when a list image is not the last one.
|
|
49
|
+
*
|
|
50
|
+
* @param {HTMLImageElement[]} images Placeholder `<img>` elements in document order.
|
|
51
|
+
* @param {File[]} files Image files to pair with the elements, in the same order.
|
|
52
|
+
* @returns {PasteImagePreview[]} Previews for the images that were resolved to a file.
|
|
53
|
+
*/
|
|
54
|
+
createImagePreviews(images, files) {
|
|
55
|
+
const previews = [];
|
|
56
|
+
images.forEach((imageElement, index) => {
|
|
57
|
+
// List images have no editor representation, so drop them here instead of
|
|
58
|
+
// creating a preview. Removing them at this stage (rather than earlier)
|
|
59
|
+
// keeps the remaining images aligned with their files.
|
|
60
|
+
if (this.isListImage(imageElement)) {
|
|
61
|
+
imageElement.remove();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const file = files[index];
|
|
65
|
+
if (!file) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const objectUrl = URL.createObjectURL(file);
|
|
69
|
+
imageElement.setAttribute('src', objectUrl);
|
|
70
|
+
const imageId = generateUUID();
|
|
71
|
+
imageElement.setAttribute(PasteImageParser.PREVIEW_IMG_KEY, imageId);
|
|
72
|
+
previews.push({ id: imageId, file, objectUrl });
|
|
73
|
+
});
|
|
74
|
+
return previews;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extracts image files from clipboard data, preferring Word RTF-decoded
|
|
78
|
+
* images and falling back to the clipboard file list when RTF yields none.
|
|
79
|
+
*
|
|
80
|
+
* @param {ClipboardFileContent | null} clipboardFileContent Clipboard payload from a paste event.
|
|
81
|
+
* @param {HTMLElement[]} images `<img>` elements the files will be paired with.
|
|
82
|
+
* @returns {File[]} Image files found on the clipboard.
|
|
83
|
+
*/
|
|
84
|
+
extractImageFiles(clipboardFileContent, images) {
|
|
85
|
+
let result = [];
|
|
86
|
+
if (clipboardFileContent) {
|
|
87
|
+
if (clipboardFileContent.rtf) {
|
|
88
|
+
result = this.safeExtractWordImages(clipboardFileContent.rtf, images);
|
|
89
|
+
}
|
|
90
|
+
if (result.length === 0 && clipboardFileContent.files) {
|
|
91
|
+
result = clipboardFileContent.files.filter((file) => file.type.startsWith('image/'));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Safely extracts image files from Word RTF clipboard data.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} rtf Clipboard payload from a paste event.
|
|
100
|
+
* @param {HTMLElement[]} images Array of `<img>` elements that may be updated with staged previews.
|
|
101
|
+
* @returns {File[]} Image files found in the clipboard data.
|
|
102
|
+
*/
|
|
103
|
+
safeExtractWordImages(rtf, images) {
|
|
104
|
+
// Word defines a list's picture bullet once in the list table
|
|
105
|
+
// (`{\*\listpicture ...}`) with no rendered counterpart. Drop that
|
|
106
|
+
// definition so its blip is not counted as a content image; the per-item
|
|
107
|
+
// `{\listtext ...}` bullet blips are kept because each still pairs with a
|
|
108
|
+
// preserved bullet placeholder `<img>`.
|
|
109
|
+
const contentRtf = this.stripListPictureDefinitions(rtf);
|
|
110
|
+
const fileObjects = [];
|
|
111
|
+
const imageRegex = /\\pngblip|\\jpegblip/g;
|
|
112
|
+
const matches = [...contentRtf.matchAll(imageRegex)];
|
|
113
|
+
matches.forEach((match, index) => {
|
|
114
|
+
if (index >= images.length || match.index === undefined) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const mimeType = match[0].includes('png') ? 'image/png' : 'image/jpeg';
|
|
118
|
+
const startIndex = match.index + match[0].length;
|
|
119
|
+
const bytes = this.extractImageBytes(contentRtf, startIndex);
|
|
120
|
+
if (bytes.length === 0) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const extension = mimeType.split('/')[1];
|
|
124
|
+
const file = new File(
|
|
125
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
126
|
+
[new Uint8Array(bytes)], `word_img_${Date.now()}_${index}.${extension}`, { type: mimeType });
|
|
127
|
+
fileObjects.push(file);
|
|
128
|
+
});
|
|
129
|
+
return fileObjects;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Removes Word list-table picture-bullet definitions from the RTF so they are
|
|
133
|
+
* not counted as content images.
|
|
134
|
+
*
|
|
135
|
+
* Word declares a list's picture bullet once as a `{\*\listpicture ...}`
|
|
136
|
+
* destination inside the list table. It renders nothing on its own, so its
|
|
137
|
+
* blip has no matching content `<img>`; leaving it in shifts the ordinal
|
|
138
|
+
* pairing and makes the first real image resolve to the bullet. The per-item
|
|
139
|
+
* `{\listtext ...}` bullets are intentionally left untouched because each is
|
|
140
|
+
* kept as a placeholder `<img>` that consumes its blip downstream.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} rtf Full RTF clipboard payload.
|
|
143
|
+
* @returns {string} RTF with list-table picture-bullet definitions removed.
|
|
144
|
+
*/
|
|
145
|
+
stripListPictureDefinitions(rtf) {
|
|
146
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
147
|
+
return this.removeBalancedGroups(rtf, '{\\*\\listpicture');
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Removes every balanced-brace RTF group that starts with the given marker.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} rtf RTF payload to scan.
|
|
153
|
+
* @param {string} marker Opening delimiter of the group to remove (including its `{`).
|
|
154
|
+
* @returns {string} RTF with the matching groups removed.
|
|
155
|
+
*/
|
|
156
|
+
removeBalancedGroups(rtf, marker) {
|
|
157
|
+
let index = rtf.indexOf(marker);
|
|
158
|
+
while (index !== -1) {
|
|
159
|
+
const end = this.findGroupEnd(rtf, index);
|
|
160
|
+
rtf = rtf.slice(0, index) + rtf.slice(end);
|
|
161
|
+
index = rtf.indexOf(marker, index);
|
|
162
|
+
}
|
|
163
|
+
return rtf;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Finds the index just past the brace that closes the group opened at `start`.
|
|
167
|
+
*
|
|
168
|
+
* A backslash escapes the next character (such as `\{` or `\}`) so escaped
|
|
169
|
+
* braces are not counted. When the group is unbalanced the RTF length is
|
|
170
|
+
* returned so the trailing remainder is dropped.
|
|
171
|
+
*
|
|
172
|
+
* @param {string} rtf RTF payload to scan.
|
|
173
|
+
* @param {number} start Index of the group's opening `{`.
|
|
174
|
+
* @returns {number} Index immediately after the matching closing `}`.
|
|
175
|
+
*/
|
|
176
|
+
findGroupEnd(rtf, start) {
|
|
177
|
+
const length = rtf.length;
|
|
178
|
+
let depth = 0;
|
|
179
|
+
let position = start;
|
|
180
|
+
while (position < length) {
|
|
181
|
+
const char = rtf[position];
|
|
182
|
+
if (char === '\\') {
|
|
183
|
+
position += 2;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (char === '{') {
|
|
187
|
+
depth++;
|
|
188
|
+
}
|
|
189
|
+
else if (char === '}') {
|
|
190
|
+
depth--;
|
|
191
|
+
if (depth === 0) {
|
|
192
|
+
return position + 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
position++;
|
|
196
|
+
}
|
|
197
|
+
return length;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Extracts the raw image bytes that follow a Word RTF blip marker.
|
|
201
|
+
*
|
|
202
|
+
* Starting just after the blip control word, RTF control words (such as
|
|
203
|
+
* `\bliptag`) and nested groups (such as `{\*\blipuid ...}`) are skipped so
|
|
204
|
+
* their hex is not mistaken for image data. Hex digits are decoded into bytes
|
|
205
|
+
* until the enclosing `{\pict}` group is closed.
|
|
206
|
+
*
|
|
207
|
+
* @param {string} rtf Full RTF clipboard payload.
|
|
208
|
+
* @param {number} startIndex Index immediately after the blip marker.
|
|
209
|
+
* @returns {number[]} Decoded image byte values.
|
|
210
|
+
*/
|
|
211
|
+
extractImageBytes(rtf, startIndex) {
|
|
212
|
+
const length = rtf.length;
|
|
213
|
+
const bytes = [];
|
|
214
|
+
let depth = 0;
|
|
215
|
+
let highNibble = -1;
|
|
216
|
+
let position = startIndex;
|
|
217
|
+
while (position < length) {
|
|
218
|
+
const char = rtf[position];
|
|
219
|
+
if (char === '{') {
|
|
220
|
+
depth++;
|
|
221
|
+
position++;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (char === '}') {
|
|
225
|
+
if (depth === 0) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
depth--;
|
|
229
|
+
position++;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (depth > 0) {
|
|
233
|
+
position++;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (char === '\\') {
|
|
237
|
+
position++;
|
|
238
|
+
while (position < length && /[a-zA-Z]/.test(rtf[position])) {
|
|
239
|
+
position++;
|
|
240
|
+
}
|
|
241
|
+
if (position < length && rtf[position] === '-') {
|
|
242
|
+
position++;
|
|
243
|
+
}
|
|
244
|
+
while (position < length && /[0-9]/.test(rtf[position])) {
|
|
245
|
+
position++;
|
|
246
|
+
}
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
const nibble = this.hexNibble(char);
|
|
250
|
+
if (nibble >= 0) {
|
|
251
|
+
if (highNibble < 0) {
|
|
252
|
+
highNibble = nibble;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
bytes.push((highNibble << 4) | nibble);
|
|
256
|
+
highNibble = -1;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
position++;
|
|
260
|
+
}
|
|
261
|
+
return bytes;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Converts a single hex character to its numeric value.
|
|
265
|
+
*
|
|
266
|
+
* @param {string} char Candidate hex character.
|
|
267
|
+
* @returns {number} Value in `[0, 15]`, or `-1` when not a hex digit.
|
|
268
|
+
*/
|
|
269
|
+
hexNibble(char) {
|
|
270
|
+
if (char >= '0' && char <= '9') {
|
|
271
|
+
return char.charCodeAt(0) - 48;
|
|
272
|
+
}
|
|
273
|
+
if (char >= 'a' && char <= 'f') {
|
|
274
|
+
return char.charCodeAt(0) - 87;
|
|
275
|
+
}
|
|
276
|
+
if (char >= 'A' && char <= 'F') {
|
|
277
|
+
return char.charCodeAt(0) - 55;
|
|
278
|
+
}
|
|
279
|
+
return -1;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Returns whether an `<img>` element is nested inside list content.
|
|
283
|
+
*
|
|
284
|
+
* The Word paste sanitizer strips non-allowlisted attributes but keeps the
|
|
285
|
+
* `ul`/`ol`/`li` structure, so list membership is detected by DOM ancestry
|
|
286
|
+
* here rather than by a marker attribute set upstream.
|
|
287
|
+
*
|
|
288
|
+
* @param {HTMLImageElement} imageElement Image element to test.
|
|
289
|
+
* @returns {boolean} Whether the image is part of list content.
|
|
290
|
+
*/
|
|
291
|
+
isListImage(imageElement) {
|
|
292
|
+
return Boolean(imageElement.closest('li,ul,ol'));
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
PasteImageParser.PREVIEW_IMG_KEY = 'data-rte-id';
|