@designcrowd/library.brand-page 6.2.11-builder-v2-1 → 6.2.12
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/lib/src/{CreatedOnBrandCrowd-de-de-Dg2pOwbr.js → CreatedOnBrandCrowd-de-de-BtVKllNQ.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-BILs_hsB.js → CreatedOnBrandCrowd-en-us-CX5V0v8u.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-VpxQ0N5F.js → CreatedOnBrandCrowd-es-es-CbA02PCL.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-CFHWRHzi.js → CreatedOnBrandCrowd-fr-ca-BQAKruBF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-CFHWRHzi.js → CreatedOnBrandCrowd-fr-fr-BQAKruBF.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-CZfs45s9.js → CreatedOnBrandCrowd-pt-br-Yk_yzB3s.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-CZfs45s9.js → CreatedOnBrandCrowd-pt-pt-Yk_yzB3s.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-DYMQ6sIF.js → CreatedOnDcom-de-de-DJZQbPSD.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Dj5sdPid.js → CreatedOnDcom-en-us-BJvNAa4l.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-Cx9yNTro.js → CreatedOnDcom-es-es-CUwB1FRY.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Bzr0SjGq.js → CreatedOnDcom-fr-ca-CK54U4oh.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BgqKY35F.js → CreatedOnDcom-fr-fr-DuUNBGrM.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CXK6qfvL.js → CreatedOnDcom-pt-br-BfODpFNV.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-B8SggNTQ.js → CreatedOnDcom-pt-pt-Cf6u2GCg.js} +1 -1
- package/lib/src/brand-page/__fixtures__/production-text-style-resolver.fixture.d.ts +16 -0
- package/lib/src/brand-page/__fixtures__/production-text-style-resolver.fixture.js +35 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +3 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +19 -13
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.d.ts +3 -1
- package/lib/src/brand-page/components/mailing-list/MailingList.mixin.js +17 -2
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.d.ts +11 -3
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.js +35 -1
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.d.ts +8 -2
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.js +27 -3
- package/lib/src/brand-page/components/page/Page.mixin.d.ts +5 -2
- package/lib/src/brand-page/components/page/Page.mixin.js +33 -27
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.d.ts +7 -2
- package/lib/src/brand-page/components/page-footer/PageFooter.mixin.js +21 -1
- package/lib/src/brand-page/components/payment/Payment.mixin.d.ts +5 -2
- package/lib/src/brand-page/components/payment/Payment.mixin.js +22 -2
- package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.d.ts +6 -2
- package/lib/src/brand-page/components/payment/support-me/SupportMe.mixin.js +32 -1
- package/lib/src/brand-page/components/social-links/SocialLinks.stories.js +0 -3
- package/lib/src/brand-page/components/testimonial-section/__fixtures__/data.js +0 -3
- package/lib/src/brand-page/components/text/Text.stories.js +0 -17
- package/lib/src/brand-page/constants/font.constants.d.ts +62 -0
- package/lib/src/brand-page/constants/font.constants.js +35 -0
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +2 -0
- package/lib/src/brand-page/models/brand-page-context.model.js +7 -0
- package/lib/src/brand-page/models/index.d.ts +23 -24
- package/lib/src/brand-page/models/index.js +20 -7
- package/lib/src/brand-page/models/navigation-styles.model.d.ts +1 -1
- package/lib/src/brand-page/models/navigation-styles.model.js +17 -8
- package/lib/src/brand-page/models/payment.model.d.ts +11 -6
- package/lib/src/brand-page/models/styles.model.d.ts +53 -7
- package/lib/src/brand-page/models/styles.model.js +115 -27
- package/lib/src/brand-page/utils/color-palette.util.d.ts +43 -23
- package/lib/src/brand-page/utils/color-palette.util.js +65 -27
- package/lib/src/brand-page/utils/color.util.d.ts +13 -9
- package/lib/src/brand-page/utils/color.util.js +56 -15
- package/lib/src/brand-page/utils/container-text-color.util.d.ts +46 -13
- package/lib/src/brand-page/utils/container-text-color.util.js +321 -41
- package/lib/src/brand-page/utils/index.d.ts +1 -0
- package/lib/src/brand-page/utils/index.js +1 -0
- package/lib/src/brand-page/utils/migration/migration-20.js +6 -2
- package/lib/src/brand-page/utils/migration/migration-21.js +34 -6
- package/lib/src/brand-page/utils/migration/migration-22.d.ts +99 -0
- package/lib/src/brand-page/utils/migration/migration-22.js +909 -0
- package/lib/src/brand-page/utils/migration.util.js +17 -0
- package/lib/src/brand-page/utils/model.util.d.ts +4 -0
- package/lib/src/brand-page/utils/model.util.js +4 -0
- package/lib/src/brand-page/utils/personalisation.util.js +9 -1
- package/lib/src/brand-page/utils/rte-role-lift.util.d.ts +72 -0
- package/lib/src/brand-page/utils/rte-role-lift.util.js +275 -0
- package/lib/src/brand-page/utils/style.util.d.ts +5 -1
- package/lib/src/brand-page/utils/style.util.js +34 -11
- package/lib/src/brand-page/utils/text-role-css.util.d.ts +19 -0
- package/lib/src/brand-page/utils/text-role-css.util.js +186 -0
- package/lib/src/brand-page/utils/text-role-reconnect.util.d.ts +90 -0
- package/lib/src/brand-page/utils/text-role-reconnect.util.js +434 -0
- package/lib/src/brand-page/utils/text-style.util.d.ts +53 -23
- package/lib/src/brand-page/utils/text-style.util.js +122 -22
- package/lib/src/brand-page/utils/view-model.util.d.ts +9 -1
- package/lib/src/brand-page/utils/view-model.util.js +124 -111
- package/lib/src/brand-page/view-models.d.ts +1 -0
- package/lib/src/brand-page-maker/components/action-bar/ActionBar.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +34 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.js +4 -4
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMakerTemplateSettings.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +0 -10
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.js +0 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +44 -138
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.js +0 -28
- package/lib/src/brand-page-maker/components/brandpage-settings/ReplaceImageSettingsForBrandPageSettings.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/navigation/Navigation.mixin.d.ts +1 -1
- package/lib/src/brand-page-maker/components/preview/Preview.mixin.d.ts +7 -0
- package/lib/src/brand-page-maker/components/quick-link-bar/QuickLinkBar.mixin.d.ts +21 -0
- package/lib/src/brand-page-maker/components/seo-settings/SeoPageSettings.mixin.d.ts +25 -1
- package/lib/src/brand-page-maker/components/seo-settings/UrlSettings.mixin.d.ts +25 -1
- package/lib/src/brand-page-maker/components/seo-settings/UseExistingDomainModal.mixin.d.ts +21 -0
- package/lib/src/brand-page-maker/components/social-share/SocialShare.mixin.d.ts +4 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.d.ts +25 -1
- package/lib/src/brand-page-maker/components/upgrade-to-premium-button/UpgradeToPremiumButton.mixin.d.ts +21 -0
- package/lib/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.d.ts +10 -0
- package/lib/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.js +11 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.d.ts +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.js +1 -0
- package/lib/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.js +14 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.d.ts +16 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.js +61 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RteClipboard.d.ts +11 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/RteClipboard.js +236 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/font.d.ts +2 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/font.js +25 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.d.ts +17 -4
- package/lib/src/brand-page-maker/composables/rich-text-editor/formatting.js +204 -17
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.d.ts +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.js +29 -31
- package/lib/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.d.ts +20 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.js +60 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.d.ts +2 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/spacing.js +22 -6
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +10 -4
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +319 -275
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +1 -5
- package/lib/src/brand-page-maker/convertors/text-css-style-options.convertor.js +6 -2
- package/lib/src/brand-page-maker/convertors/text-size-value.convertor.d.ts +1 -1
- package/lib/src/brand-page-maker/convertors/text-size-value.convertor.js +3 -1
- package/lib/src/brand-page-maker/default-getters/payment-text-and-border-color.default-getter.js +7 -14
- package/lib/src/brand-page-maker/default-getters/text-color.default-getter.js +6 -13
- package/lib/src/brand-page-maker/models/content-settings.d.ts +8 -0
- package/lib/src/brand-page-maker/models/content-settings.js +112 -81
- package/lib/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.d.ts +2 -2
- package/lib/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.js +5 -2
- package/lib/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store.js +4 -3
- package/lib/src/brand-page-maker/stores/ai-checkpoint/ai-checkpoint-store.d.ts +1257 -117
- package/lib/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.d.ts +9 -2
- package/lib/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.js +20 -0
- package/lib/src/brand-page-maker/stores/brandpage-container/brand-page-container-store.d.ts +21 -0
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.d.ts +6 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +17 -9
- package/lib/src/brand-page-maker/stores/history/history-store.d.ts +59 -5
- package/lib/src/brand-page-maker/stores/history/history-store.js +22 -2
- package/lib/src/brand-page-maker/utils/apply-color-strategy.js +26 -8
- package/lib/src/brand-page-maker/utils/index.d.ts +2 -1
- package/lib/src/brand-page-maker/utils/index.js +2 -1
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +117 -15
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +435 -281
- package/lib/src/brand-page-maker/utils/rte-authoring.util.d.ts +4 -0
- package/lib/src/brand-page-maker/utils/rte-authoring.util.js +101 -0
- package/lib/src/brand-page-maker/utils/rte-clipboard.util.d.ts +126 -0
- package/lib/src/brand-page-maker/utils/rte-clipboard.util.js +307 -0
- package/lib/src/brand-page-maker/utils/rte-sanitize.util.js +13 -3
- package/lib/src/{bundled-translations-zfiA5Tsw.js → bundled-translations-yGrvPE5i.js} +17 -17
- package/lib/src/{bundled-translations.de-DE-ChsdSyAP.js → bundled-translations.de-DE-L4Znf8Hs.js} +17 -17
- package/lib/src/{bundled-translations.es-ES-DflsWQK0.js → bundled-translations.es-ES-D6iticrK.js} +15 -15
- package/lib/src/{bundled-translations.fr-CA-fpDRuZ52.js → bundled-translations.fr-CA-BgAVE-9k.js} +25 -25
- package/lib/src/{bundled-translations.fr-FR-Bub73Zt-.js → bundled-translations.fr-FR-B8GbyqxQ.js} +17 -17
- package/lib/src/{bundled-translations.pt-BR-BlnWE9TB.js → bundled-translations.pt-BR-DjPU3Db7.js} +25 -25
- package/lib/src/{bundled-translations.pt-PT-DmzXlnaS.js → bundled-translations.pt-PT-BaepaDpr.js} +23 -23
- package/lib/src/bundles/bundled-translations.de-DE.json +21 -2
- package/lib/src/bundles/bundled-translations.es-ES.json +21 -2
- package/lib/src/bundles/bundled-translations.fr-CA.json +21 -2
- package/lib/src/bundles/bundled-translations.fr-FR.json +21 -2
- package/lib/src/bundles/bundled-translations.json +21 -2
- package/lib/src/bundles/bundled-translations.pt-BR.json +21 -2
- package/lib/src/bundles/bundled-translations.pt-PT.json +21 -2
- package/lib/src/clients/ai-assistant-client.d.ts +7 -1
- package/lib/src/clients/ai-assistant-client.js +7 -15
- package/lib/src/composables/useTranslate.d.ts +1 -1
- package/lib/src/composables/useTranslate.js +1 -1
- package/lib/src/css/library.brand-page-brandCrowd.min.css +284 -188
- package/lib/src/css/library.brand-page-brandPage.min.css +284 -188
- package/lib/src/css/library.brand-page-designCom.min.css +284 -188
- package/lib/src/css/library.brand-page-preview.min.css +284 -188
- package/lib/src/index.d.ts +2 -1
- package/lib/src/index.mjs +195 -191
- package/lib/src/{lib-7gtW85nE.js → lib-kGRlD3_P.js} +39082 -36131
- package/lib/src/lib.js +2 -1
- package/lib/src/metadata-builder/builders/footer-builder.js +4 -5
- package/lib/src/metadata-builder/builders/global-role-propagation.d.ts +58 -0
- package/lib/src/metadata-builder/builders/global-role-propagation.js +246 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.d.ts +1 -0
- package/lib/src/metadata-builder/builders/global-styles-builder.js +116 -45
- package/lib/src/metadata-builder/builders/header-builder.js +13 -4
- package/lib/src/metadata-builder/builders/section-builders/about-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/banner-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/booking-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/contact-form-builder.js +4 -4
- package/lib/src/metadata-builder/builders/section-builders/images-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-builder.js +2 -2
- package/lib/src/metadata-builder/builders/section-builders/mailing-list-section-builder.js +2 -2
- package/lib/src/metadata-builder/builders/section-builders/profile-section-builder.js +4 -4
- package/lib/src/metadata-builder/builders/section-builders/shapes-section-builder.js +3 -3
- package/lib/src/metadata-builder/builders/section-builders/social-links-builder.js +8 -2
- package/lib/src/metadata-builder/builders/section-builders/testimonial-section-builder.js +2 -2
- package/lib/src/metadata-builder/builders/section-builders/text-section-builder.js +60 -29
- package/lib/src/metadata-builder/builders/section-field-maps.js +1 -0
- package/lib/src/metadata-builder/builders/section-field-utils.d.ts +48 -19
- package/lib/src/metadata-builder/builders/section-field-utils.js +128 -52
- package/lib/src/metadata-builder/builders/section-rules/global-styles.rules.d.ts +4 -2
- package/lib/src/metadata-builder/builders/section-rules/global-styles.rules.js +28 -12
- package/lib/src/metadata-builder/builders/section-rules/social-links.rules.js +5 -1
- package/lib/src/metadata-builder/helpers/rte.helpers.d.ts +1 -1
- package/lib/src/metadata-builder/helpers/rte.helpers.js +97 -40
- package/lib/src/metadata-builder/metadata-executor.js +23 -1
- package/lib/src/metadata-builder/models.d.ts +2 -0
- package/lib/src/metadata-builder/parsers/ai-toolcall-parser.d.ts +18 -19
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +18 -1
- package/lib/src/metadata-builder/sanitizers/rte-schema-check.js +1 -1
- package/lib/src/metadata-builder/sanitizers/sanitizer-rules.d.ts +0 -1
- package/lib/src/metadata-builder/sanitizers/sanitizer-rules.js +5 -8
- package/lib/src/metadata-builder/sanitizers/section-args-validator.d.ts +7 -16
- package/lib/src/metadata-builder/sanitizers/section-args-validator.js +95 -22
- package/lib/src/shared/color-palette/section-color-matches.js +9 -25
- package/lib/src/shared/color-strategies/color-strategies.d.ts +15 -0
- package/lib/src/shared/color-strategies/color-strategies.js +31 -0
- package/lib/src/shared/color-strategies/rte-color.d.ts +8 -0
- package/lib/src/shared/color-strategies/rte-color.js +16 -0
- package/lib/src/shared/color-strategies/rte-field-pairs.d.ts +23 -0
- package/lib/src/shared/color-strategies/rte-field-pairs.js +28 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +9 -135
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +1 -27
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +12 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +7 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +75 -6
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +18 -7
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +6 -1
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.js +0 -7
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +22 -0
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.js +8 -4
- package/lib/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.d.ts +1255 -26
- package/lib/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.js +203 -59
- package/lib/src/shared/content-settings/store/content-settings-store.d.ts +6 -0
- package/lib/src/shared/content-settings/store/content-settings-store.js +105 -8
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +26 -1
- package/lib/src/shared/navigation-style-settings/store/index.d.ts +7 -3
- package/lib/src/shared/navigation-style-settings/store/index.js +40 -15
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +1 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +38 -5
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +91 -13
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.js +10 -2
- package/lib/src/shared/page-settings/store/page-settings-store.d.ts +2 -1
- package/lib/src/shared/page-settings/store/page-settings-store.js +17 -0
- package/lib/src/shared/publish-brand-page-with-state/PublishBrandPageModalWithState.mixin.d.ts +32 -1
- package/lib/src/shared/rte-extensions/AutoLink.d.ts +17 -0
- package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/AutoLink.js +67 -51
- package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/MaxLength.js +4 -1
- package/lib/src/shared/rte-extensions/TextEffects.d.ts +28 -0
- package/lib/src/shared/rte-extensions/TextEffects.js +96 -0
- package/lib/src/shared/rte-extensions/ViewDomParser.d.ts +2 -0
- package/lib/src/shared/rte-extensions/ViewDomParser.js +21 -0
- package/lib/src/shared/rte-extensions.util.d.ts +25 -0
- package/lib/src/{brand-page-maker/composables/rich-text-editor/getRteExtensions.js → shared/rte-extensions.util.js} +62 -7
- package/lib/src/shared/rte-link.util.d.ts +1 -0
- package/lib/src/shared/rte-link.util.js +1 -0
- package/lib/src/shared/rte-render.util.d.ts +112 -0
- package/lib/src/shared/rte-render.util.js +255 -0
- package/lib/src/shared/rte-shape.util.d.ts +6 -0
- package/lib/src/shared/rte-shape.util.js +18 -0
- package/lib/src/shared/side-bar/components/SideBar.mixin.d.ts +23 -1
- package/lib/src/shared/side-bar/components/SideBarTabButton.mixin.d.ts +1 -0
- package/lib/src/shared/side-bar/store/side-bar-store.d.ts +2 -0
- package/lib/src/shared/side-bar/store/side-bar-store.js +9 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +176 -15
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.js +7 -1
- package/lib/src/shared/style-settings/store/style-settings-store.d.ts +1 -9
- package/lib/src/shared/style-settings/store/style-settings-store.js +3 -33
- package/lib/src/shared/style-settings/text-style-size-order.d.ts +2 -0
- package/lib/src/shared/style-settings/text-style-size-order.js +13 -0
- package/lib/src/shared/text-role-typography.util.d.ts +64 -0
- package/lib/src/shared/text-role-typography.util.js +183 -0
- package/lib/src/utils/minify-brand-page-metadata.d.ts +16 -1
- package/lib/src/utils/minify-brand-page-metadata.js +31 -9
- package/package.json +1 -1
- package/src/brand-page/__fixtures__/migration-22-v21/edited-brandsite-sections.v21.json +982 -0
- package/src/brand-page/__fixtures__/migration-22-v21/new-brandcontact-every-section.v21.json +1231 -0
- package/src/brand-page/__fixtures__/migration-22-v21/new-brandpage-every-section.v21.json +1231 -0
- package/src/brand-page/__fixtures__/migration-22-v21/new-brandsite-every-section.v21.json +1243 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandcontact.v21.json +755 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandpage-general-link.v21.json +527 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandpage-links.v21.json +755 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandpage-social-links.v21.json +514 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-about.v21.json +459 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-footer.v21.json +469 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-header-banner.v21.json +481 -0
- package/src/brand-page/__fixtures__/migration-22-v21/real-brandsite-sections.v21.json +800 -0
- package/src/brand-page/__fixtures__/production-text-style-resolver.fixture.ts +52 -0
- package/src/brand-page/components/about-section/AboutSection.vue.test.ts +0 -10
- package/src/brand-page/components/contact-form/ContactForm.mixin.test.ts +127 -0
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +31 -14
- package/src/brand-page/components/contact-form/ContactForm.vue +26 -12
- package/src/brand-page/components/contact-form/ContactForm.vue.test.ts +60 -0
- package/src/brand-page/components/mailing-list/MailingList.mixin.test.ts +92 -0
- package/src/brand-page/components/mailing-list/MailingList.mixin.ts +28 -3
- package/src/brand-page/components/mailing-list/MailingList.vue +9 -4
- package/src/brand-page/components/mailing-list/MailingList.vue.test.ts +63 -0
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.ts +51 -1
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.test.ts +114 -0
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.vue +8 -2
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.test.ts +182 -0
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.vue +58 -12
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.ts +40 -3
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +15 -7
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue.test.ts +133 -3
- package/src/brand-page/components/page/Page.mixin.ts +41 -34
- package/src/brand-page/components/page/Page.vue +17 -6
- package/src/brand-page/components/page/Page.vue.test.ts +91 -1
- package/src/brand-page/components/page-footer/PageFooter.mixin.ts +32 -2
- package/src/brand-page/components/page-footer/PageFooter.test.ts +79 -0
- package/src/brand-page/components/page-footer/PageFooter.vue +12 -4
- package/src/brand-page/components/payment/Payment.mixin.ts +34 -2
- package/src/brand-page/components/payment/Payment.test.ts +188 -0
- package/src/brand-page/components/payment/Payment.vue +12 -5
- package/src/brand-page/components/payment/RequestPaymentStripe.vue +1 -0
- package/src/brand-page/components/payment/support-me/SupportMe.mixin.ts +49 -2
- package/src/brand-page/components/payment/support-me/SupportMe.test.ts +100 -0
- package/src/brand-page/components/payment/support-me/SupportMe.vue +7 -1
- package/src/brand-page/components/payment/support-me/SupportMe.vue.test.ts +66 -0
- package/src/brand-page/components/save-contact/SaveContactWidget.test.ts +100 -0
- package/src/brand-page/components/save-contact/SaveContactWidget.vue +6 -3
- package/src/brand-page/components/shop/PaymentModal.vue +2 -6
- package/src/brand-page/components/shop/PaymentShippingAddress.vue +6 -0
- package/src/brand-page/components/shop/Shop.vue +15 -2
- package/src/brand-page/components/shop/Shop.vue.test.ts +74 -2
- package/src/brand-page/components/social-links/SocialLinks.stories.ts +0 -3
- package/src/brand-page/components/social-links/SocialLinks.vue.test.ts +0 -3
- package/src/brand-page/components/testimonial-section/__fixtures__/data.ts +0 -3
- package/src/brand-page/components/text/Text.stories.ts +0 -17
- package/src/brand-page/components/text-wrapper/TextWrapper.parity.test.ts +136 -0
- package/src/brand-page/components/text-wrapper/TextWrapper.test.ts +358 -0
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +82 -22
- package/src/brand-page/constants/font.constants.ts +37 -0
- package/src/brand-page/models/brand-page-context.model.ts +13 -0
- package/src/brand-page/models/footer-icon-color.test.ts +22 -0
- package/src/brand-page/models/index.ts +50 -28
- package/src/brand-page/models/navigation-styles.model.test.ts +77 -1
- package/src/brand-page/models/navigation-styles.model.ts +26 -9
- package/src/brand-page/models/payment.model.ts +15 -6
- package/src/brand-page/models/styles.model.test.ts +104 -0
- package/src/brand-page/models/styles.model.ts +181 -47
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +619 -115
- package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +150 -9
- package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +300 -18
- package/src/brand-page/utils/color-palette.util.test.ts +126 -1
- package/src/brand-page/utils/color-palette.util.ts +92 -26
- package/src/brand-page/utils/color.util.test.ts +62 -29
- package/src/brand-page/utils/color.util.ts +77 -14
- package/src/brand-page/utils/container-text-color.util.test.ts +672 -26
- package/src/brand-page/utils/container-text-color.util.ts +472 -46
- package/src/brand-page/utils/index.ts +1 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/edited-brandsite-sections.v22.json +1191 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/new-brandcontact-every-section.v22.json +2026 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/new-brandpage-every-section.v22.json +2017 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/new-brandsite-every-section.v22.json +2031 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandcontact.v22.json +1145 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandpage-general-link.v22.json +645 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandpage-links.v22.json +1136 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandpage-social-links.v22.json +662 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-about.v22.json +638 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-footer.v22.json +610 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-header-banner.v22.json +660 -0
- package/src/brand-page/utils/migration/__snapshots__/migration-22-output/real-brandsite-sections.v22.json +1132 -0
- package/src/brand-page/utils/migration/migration-01.ts +293 -237
- package/src/brand-page/utils/migration/migration-02.ts +8 -1
- package/src/brand-page/utils/migration/migration-20.ts +6 -3
- package/src/brand-page/utils/migration/migration-20_5.test.ts +5 -2
- package/src/brand-page/utils/migration/migration-21.test.ts +34 -0
- package/src/brand-page/utils/migration/migration-21.ts +46 -10
- package/src/brand-page/utils/migration/migration-22.fixed-input.test.ts +43 -0
- package/src/brand-page/utils/migration/migration-22.test.ts +4103 -0
- package/src/brand-page/utils/migration/migration-22.text-font-family.test.ts +72 -0
- package/src/brand-page/utils/migration/migration-22.ts +1336 -0
- package/src/brand-page/utils/migration.util.test.ts +146 -32
- package/src/brand-page/utils/migration.util.ts +18 -0
- package/src/brand-page/utils/model.util.ts +4 -0
- package/src/brand-page/utils/personalisation.util.test.ts +148 -3
- package/src/brand-page/utils/personalisation.util.ts +9 -1
- package/src/brand-page/utils/rte-role-lift.util.ts +409 -0
- package/src/brand-page/utils/style.util.test.ts +35 -2
- package/src/brand-page/utils/style.util.ts +45 -11
- package/src/brand-page/utils/text-role-css.util.test.ts +525 -0
- package/src/brand-page/utils/text-role-css.util.ts +321 -0
- package/src/brand-page/utils/text-role-reconnect.util.test.ts +604 -0
- package/src/brand-page/utils/text-role-reconnect.util.ts +727 -0
- package/src/brand-page/utils/text-style.util.test.ts +305 -0
- package/src/brand-page/utils/text-style.util.ts +198 -24
- package/src/brand-page/utils/view-model.page-data.test.ts +232 -0
- package/src/brand-page/utils/view-model.util.test.ts +954 -133
- package/src/brand-page/utils/view-model.util.ts +187 -139
- package/src/brand-page/view-models.ts +4 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.blank-site.test.ts +57 -0
- package/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.ts +9 -5
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +0 -10
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/content-settings-items.fixture.ts +0 -1
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.ts +0 -44
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +253 -200
- package/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.test.ts +82 -0
- package/src/brand-page-maker/composables/ai-chat/ai-builder-experiment.ts +19 -0
- package/src/brand-page-maker/composables/ai-chat/useAiMetadataBuilder.ts +2 -0
- package/src/brand-page-maker/composables/ai-chat/useAiWebsiteBuilderChat.ts +19 -0
- package/src/brand-page-maker/composables/rich-text-editor/block-typography.test.ts +519 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/FontFamily.test.ts +1 -1
- package/src/brand-page-maker/composables/rich-text-editor/extensions/MaxLength.test.ts +26 -1
- package/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.test.ts +110 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/RoleTypographyFill.ts +99 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/RteClipboard.ts +397 -0
- package/src/brand-page-maker/composables/rich-text-editor/extensions/ViewDomParser.test.ts +139 -0
- package/src/brand-page-maker/composables/rich-text-editor/font.ts +36 -5
- package/src/brand-page-maker/composables/rich-text-editor/formatting.test.ts +375 -1
- package/src/brand-page-maker/composables/rich-text-editor/formatting.ts +301 -17
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.test.ts +82 -1
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.ts +28 -34
- package/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.test.ts +80 -0
- package/src/brand-page-maker/composables/rich-text-editor/keepMarksOnEmpty.ts +75 -0
- package/src/brand-page-maker/composables/rich-text-editor/spacing.ts +31 -6
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.test.ts +2485 -0
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +435 -337
- package/src/brand-page-maker/constants/config-settings-constant.ts +0 -6
- package/src/brand-page-maker/convertors/text-css-style-options.convertor.test.ts +43 -0
- package/src/brand-page-maker/convertors/text-css-style-options.convertor.ts +6 -2
- package/src/brand-page-maker/convertors/text-size-value.convertor.test.ts +24 -0
- package/src/brand-page-maker/convertors/text-size-value.convertor.ts +17 -13
- package/src/brand-page-maker/default-getters/payment-text-and-border-color.default-getter.ts +7 -22
- package/src/brand-page-maker/default-getters/text-color.default-getter.ts +5 -21
- package/src/brand-page-maker/models/content-settings.test.ts +708 -0
- package/src/brand-page-maker/models/content-settings.ts +133 -82
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.test.ts +63 -1
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store-utils.ts +16 -3
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store.test.ts +34 -0
- package/src/brand-page-maker/stores/admin-logo-settings/admin-logo-settings-store.ts +4 -2
- package/src/brand-page-maker/stores/ai-thread/ai-website-builder-thread-store.ts +30 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.test.ts +185 -1
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +22 -34
- package/src/brand-page-maker/stores/history/history-store.ts +35 -2
- package/src/brand-page-maker/utils/__snapshots__/apply-color-strategy.golden.test.ts.snap +528 -0
- package/src/brand-page-maker/utils/__snapshots__/rte-render-parity.test.ts.snap +12 -0
- package/src/brand-page-maker/utils/apply-color-strategy.golden.test.ts +2 -0
- package/src/brand-page-maker/utils/apply-color-strategy.test.ts +181 -3
- package/src/brand-page-maker/utils/apply-color-strategy.ts +36 -4
- package/src/brand-page-maker/utils/index.ts +2 -1
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +447 -410
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +610 -506
- package/src/brand-page-maker/utils/rte-authoring.util.test.ts +244 -0
- package/src/brand-page-maker/utils/rte-authoring.util.ts +175 -0
- package/src/brand-page-maker/utils/rte-clipboard.util.test.ts +558 -0
- package/src/brand-page-maker/utils/rte-clipboard.util.ts +473 -0
- package/src/brand-page-maker/utils/rte-features.test.ts +99 -3
- package/src/brand-page-maker/utils/rte-render-parity.test.ts +1 -1
- package/src/brand-page-maker/utils/rte-render.util.test.ts +230 -0
- package/src/brand-page-maker/utils/rte-sanitize-json.test.ts +1 -1
- package/src/brand-page-maker/utils/rte-sanitize.util.ts +14 -3
- package/src/brand-page-maker/utils/rte-schema-version.test.ts +102 -0
- package/src/bundles/bundled-translations.de-DE.json +21 -2
- package/src/bundles/bundled-translations.es-ES.json +21 -2
- package/src/bundles/bundled-translations.fr-CA.json +21 -2
- package/src/bundles/bundled-translations.fr-FR.json +21 -2
- package/src/bundles/bundled-translations.json +21 -2
- package/src/bundles/bundled-translations.pt-BR.json +21 -2
- package/src/bundles/bundled-translations.pt-PT.json +21 -2
- package/src/clients/ai-assistant-client.ts +13 -18
- package/src/composables/useTranslate.ts +2 -1
- package/src/lib.ts +2 -2
- package/src/metadata-builder/builders/footer-builder.test.ts +70 -45
- package/src/metadata-builder/builders/footer-builder.ts +4 -8
- package/src/metadata-builder/builders/global-role-propagation.test.ts +907 -0
- package/src/metadata-builder/builders/global-role-propagation.ts +430 -0
- package/src/metadata-builder/builders/global-styles-builder.test.ts +1020 -0
- package/src/metadata-builder/builders/global-styles-builder.ts +194 -48
- package/src/metadata-builder/builders/header-builder.test.ts +112 -40
- package/src/metadata-builder/builders/header-builder.ts +18 -8
- package/src/metadata-builder/builders/section-builders/about-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/banner-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/booking-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/contact-form-builder.ts +7 -4
- package/src/metadata-builder/builders/section-builders/images-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/mailing-list-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/mailing-list-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/profile-section-builder.ts +7 -7
- package/src/metadata-builder/builders/section-builders/shapes-section-builder.ts +5 -3
- package/src/metadata-builder/builders/section-builders/social-links-builder.test.ts +2 -2
- package/src/metadata-builder/builders/section-builders/social-links-builder.ts +21 -10
- package/src/metadata-builder/builders/section-builders/support-me-builder.test.ts +10 -0
- package/src/metadata-builder/builders/section-builders/testimonial-section-builder.ts +3 -2
- package/src/metadata-builder/builders/section-builders/text-section-builder.ts +111 -61
- package/src/metadata-builder/builders/section-field-maps.ts +1 -0
- package/src/metadata-builder/builders/section-field-utils.test.ts +545 -2
- package/src/metadata-builder/builders/section-field-utils.ts +202 -69
- package/src/metadata-builder/builders/section-rules/global-styles.rules.ts +38 -13
- package/src/metadata-builder/builders/section-rules/social-links.rules.ts +5 -0
- package/src/metadata-builder/helpers/rte.helpers.test.ts +101 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +129 -43
- package/src/metadata-builder/metadata-executor.test.ts +167 -0
- package/src/metadata-builder/metadata-executor.ts +34 -1
- package/src/metadata-builder/models.ts +2 -0
- package/src/metadata-builder/parsers/ai-toolcall-parser.ts +23 -7
- package/src/metadata-builder/parsers/section-tool-arguments.ts +21 -1
- package/src/metadata-builder/sanitizers/__tests__/section-args-validator.test.ts +215 -0
- package/src/metadata-builder/sanitizers/rte-schema-check.ts +1 -1
- package/src/metadata-builder/sanitizers/sanitizer-rules.ts +4 -8
- package/src/metadata-builder/sanitizers/section-args-validator.ts +136 -53
- package/src/shared/color-palette/section-color-matches.test.ts +15 -11
- package/src/shared/color-palette/section-color-matches.ts +9 -28
- package/src/shared/color-strategies/color-strategies.ts +35 -0
- package/src/shared/color-strategies/rte-color.test.ts +1 -1
- package/src/shared/color-strategies/rte-color.ts +19 -0
- package/src/shared/color-strategies/rte-field-pairs.test.ts +26 -5
- package/src/shared/color-strategies/rte-field-pairs.ts +33 -0
- package/src/shared/content-settings/components/color-matches-panel/ColorMatchesPanel.test.ts +43 -66
- package/src/shared/content-settings/components/color-matches-panel/ColorMatchesPanel.vue +7 -1
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +1 -48
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +33 -7
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.test.ts +128 -1
- package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.ts +0 -6
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.test.ts +56 -3
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.ts +11 -4
- package/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.test.ts +335 -25
- package/src/shared/content-settings/components/text-style-field/TextStyleField.mixin.ts +248 -70
- package/src/shared/content-settings/components/text-style-field/TextStyleField.vue +113 -25
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.de-DE.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.es-ES.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.fr-CA.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.fr-FR.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.json +8 -1
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.pt-BR.json +17 -10
- package/src/shared/content-settings/components/text-style-field/i18n/text-style-field.pt-PT.json +17 -10
- package/src/shared/content-settings/components/text-style-role-dropdown/TextStyleRoleDropdown.test.ts +141 -0
- package/src/shared/content-settings/components/text-style-role-dropdown/TextStyleRoleDropdown.vue +136 -0
- package/src/shared/content-settings/store/content-settings-store.test.ts +491 -6
- package/src/shared/content-settings/store/content-settings-store.ts +159 -17
- package/src/shared/navigation-style-settings/store/index.test.ts +295 -0
- package/src/shared/navigation-style-settings/store/index.ts +65 -15
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderButtonSettings.test.ts +44 -4
- package/src/shared/page-settings/components/page-settings-section-styles/HeaderButtonSettings.vue +13 -4
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.navigation.test.ts +89 -0
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.text-style.test.ts +91 -0
- package/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.ts +14 -2
- package/src/shared/page-settings/store/page-settings-store.text-style.test.ts +84 -0
- package/src/shared/page-settings/store/page-settings-store.ts +30 -1
- package/src/shared/rte-extensions/AutoLink.test.ts +98 -0
- package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/AutoLink.ts +87 -58
- package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/MaxLength.ts +4 -1
- package/src/shared/rte-extensions/TextEffects.ts +151 -0
- package/src/shared/rte-extensions/ViewDomParser.ts +27 -0
- package/src/{brand-page-maker/composables/rich-text-editor/getRteExtensions.ts → shared/rte-extensions.util.ts} +66 -9
- package/src/shared/rte-link.util.ts +2 -0
- package/src/shared/rte-render.util.ts +385 -0
- package/src/shared/rte-shape.util.ts +29 -0
- package/src/shared/side-bar/store/side-bar-store.test.ts +27 -1
- package/src/shared/side-bar/store/side-bar-store.ts +11 -0
- package/src/shared/style-settings/components/StyleSettings.mixin.ts +7 -3
- package/src/shared/style-settings/components/StyleSettings.test.ts +116 -0
- package/src/shared/style-settings/components/StyleSettings.vue +74 -25
- package/src/shared/style-settings/components/i18n/style-settings.de-DE.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.es-ES.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.fr-CA.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.fr-FR.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.json +13 -3
- package/src/shared/style-settings/components/i18n/style-settings.pt-BR.json +32 -20
- package/src/shared/style-settings/components/i18n/style-settings.pt-PT.json +32 -20
- package/src/shared/style-settings/components/text-style-options-settings-with-state/TextStyleOptionsSettingsWithState.vue +14 -34
- package/src/shared/style-settings/store/style-settings-store.ts +3 -49
- package/src/shared/style-settings/text-style-size-order.test.ts +76 -0
- package/src/shared/style-settings/text-style-size-order.ts +28 -0
- package/src/shared/text-role-typography.util.ts +277 -0
- package/src/utils/minify-brand-page-metadata.test.ts +102 -7
- package/src/utils/minify-brand-page-metadata.ts +62 -8
- package/lib/src/brand-page-maker/composables/rich-text-editor/extensions/AutoLink.d.ts +0 -2
- package/lib/src/brand-page-maker/composables/rich-text-editor/getRteExtensions.d.ts +0 -28
- package/lib/src/brand-page-maker/utils/rte-render.util.d.ts +0 -63
- package/lib/src/brand-page-maker/utils/rte-render.util.js +0 -106
- package/lib/src/brand-page-maker/utils/rte-shape.d.ts +0 -18
- package/lib/src/brand-page-maker/utils/rte-shape.js +0 -21
- package/lib/src/metadata-builder/builders/global-font-propagation.d.ts +0 -41
- package/lib/src/metadata-builder/builders/global-font-propagation.js +0 -146
- package/src/brand-page/models/brand-page-context.model.test.ts +0 -38
- package/src/brand-page-maker/utils/rte-render.util.ts +0 -179
- package/src/brand-page-maker/utils/rte-shape.ts +0 -29
- package/src/clients/ai-assistant-client.test.ts +0 -135
- package/src/metadata-builder/builders/global-font-propagation.test.ts +0 -401
- package/src/metadata-builder/builders/global-font-propagation.ts +0 -238
- package/src/shared/style-settings/components/StyleSettingsSection.vue +0 -8
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/FontFamily.d.ts +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/FontFamily.js +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/LetterSpacing.d.ts +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/LetterSpacing.js +0 -0
- /package/lib/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/MaxLength.d.ts +0 -0
- /package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/FontFamily.ts +0 -0
- /package/src/{brand-page-maker/composables/rich-text-editor/extensions → shared/rte-extensions}/LetterSpacing.ts +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { describe, it, expect, vi, type Mock } from 'vitest';
|
|
1
|
+
import { describe, it, expect, vi, afterAll, type Mock } from 'vitest';
|
|
2
2
|
import type { Transaction } from 'prosemirror-state';
|
|
3
|
-
import type { ChainedCommands
|
|
3
|
+
import type { ChainedCommands } from '@tiptap/vue-3';
|
|
4
4
|
import {
|
|
5
5
|
isStyleChanged,
|
|
6
6
|
skipStyleDetection,
|
|
7
7
|
hasRTEContent,
|
|
8
8
|
isRteHtmlString,
|
|
9
|
-
getUpdatedHTMLFromEditor,
|
|
10
9
|
sanitiseClientSideRTE,
|
|
11
10
|
getRTEColor,
|
|
12
11
|
isColorVar,
|
|
@@ -14,8 +13,18 @@ import {
|
|
|
14
13
|
getToolbarColorFromMark,
|
|
15
14
|
resolveToolbarTextColor,
|
|
16
15
|
resolveInitialToolbarTextColor,
|
|
17
|
-
|
|
16
|
+
buildInitialMarks,
|
|
17
|
+
isCanonicalLinked,
|
|
18
|
+
isRoleVarRef,
|
|
19
|
+
normTypographyValue,
|
|
20
|
+
roleVarOrLiteral,
|
|
21
|
+
relinkRoleEqualMarks,
|
|
22
|
+
relinkDocToRole,
|
|
23
|
+
mergePickedMarks,
|
|
18
24
|
} from './rich-text-editor.util';
|
|
25
|
+
import { Editor } from '@tiptap/vue-3';
|
|
26
|
+
import { getRteExtensions } from '@shared/rte-extensions.util';
|
|
27
|
+
import { roleVarRef } from '@shared/text-role-typography.util';
|
|
19
28
|
import type { TextStyleDeclaration } from '@brand-page';
|
|
20
29
|
|
|
21
30
|
describe('isStyleChanged', () => {
|
|
@@ -179,412 +188,6 @@ describe('getRteTextLength', () => {
|
|
|
179
188
|
});
|
|
180
189
|
});
|
|
181
190
|
|
|
182
|
-
describe('getUpdatedHTMLFromEditor', () => {
|
|
183
|
-
it('applies style commands and returns updated JSON', () => {
|
|
184
|
-
// Mock editor
|
|
185
|
-
const runMock = vi.fn();
|
|
186
|
-
const chain = {
|
|
187
|
-
selectAll: () => chain,
|
|
188
|
-
setFontFamily: () => chain,
|
|
189
|
-
setFontSize: () => chain,
|
|
190
|
-
setLetterSpacing: () => chain,
|
|
191
|
-
setLineHeight: () => chain,
|
|
192
|
-
setMark: () => chain,
|
|
193
|
-
setStrike: () => chain,
|
|
194
|
-
unsetStrike: () => chain,
|
|
195
|
-
setUnderline: () => chain,
|
|
196
|
-
unsetUnderline: () => chain,
|
|
197
|
-
setBold: () => chain,
|
|
198
|
-
unsetBold: () => chain,
|
|
199
|
-
setItalic: () => chain,
|
|
200
|
-
unsetItalic: () => chain,
|
|
201
|
-
run: runMock,
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
const externalEditor = {
|
|
205
|
-
commands: {
|
|
206
|
-
setContent: vi.fn(),
|
|
207
|
-
},
|
|
208
|
-
getAttributes: vi.fn(() => ({
|
|
209
|
-
fontFamily: 'Arial',
|
|
210
|
-
fontSize: '2.5em',
|
|
211
|
-
letterSpacing: '1.2',
|
|
212
|
-
lineHeight: '1.5',
|
|
213
|
-
color: '#333',
|
|
214
|
-
textDecoration: 'underline line-through',
|
|
215
|
-
fontWeight: 'bold',
|
|
216
|
-
fontStyle: 'italic',
|
|
217
|
-
})),
|
|
218
|
-
state: {
|
|
219
|
-
selection: {
|
|
220
|
-
$anchor: {
|
|
221
|
-
node: () => ({ type: { name: 'paragraph' } }),
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
chain: () => chain as any,
|
|
226
|
-
getJSON: () => ({ type: 'doc', content: [{ type: 'paragraph' }] }),
|
|
227
|
-
} as unknown as Editor;
|
|
228
|
-
|
|
229
|
-
const newStyle = {
|
|
230
|
-
fontFamily: 'Arial',
|
|
231
|
-
fontSize: '2.5em',
|
|
232
|
-
letterSpacing: '1.2',
|
|
233
|
-
lineHeight: '1.5',
|
|
234
|
-
color: '#333',
|
|
235
|
-
textDecoration: 'underline line-through',
|
|
236
|
-
fontWeight: 'bold',
|
|
237
|
-
fontStyle: 'italic',
|
|
238
|
-
} as TextStyleDeclaration;
|
|
239
|
-
|
|
240
|
-
const result = getUpdatedHTMLFromEditor(externalEditor, 'foo', newStyle);
|
|
241
|
-
|
|
242
|
-
expect(externalEditor.commands.setContent).toHaveBeenCalledWith('foo');
|
|
243
|
-
expect(runMock).toHaveBeenCalled();
|
|
244
|
-
// BP-5787: returns the JSON form (consistent with JSON storage).
|
|
245
|
-
expect(result).toEqual({ type: 'doc', content: [{ type: 'paragraph' }] });
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
describe('transformToRTE — element-first colour (BP-5886)', () => {
|
|
250
|
-
// The plain→RTE rewrap (on section select / add) bakes the linked global text style
|
|
251
|
-
// into the title's marks. It must honour an element-level colour override
|
|
252
|
-
// (a creation-time contrast bake, or a colour picked while linked) instead of
|
|
253
|
-
// overpainting it with the global colour — mirroring `resolveTextColor`.
|
|
254
|
-
const buildEditor = () => {
|
|
255
|
-
const setMarkCalls: { name: string; attrs: any }[] = [];
|
|
256
|
-
const chain: any = new Proxy(
|
|
257
|
-
{},
|
|
258
|
-
{
|
|
259
|
-
get(_t, prop) {
|
|
260
|
-
if (prop === 'run') return () => undefined;
|
|
261
|
-
|
|
262
|
-
if (prop === 'setMark')
|
|
263
|
-
return (name: string, attrs: any) => {
|
|
264
|
-
setMarkCalls.push({ name, attrs });
|
|
265
|
-
|
|
266
|
-
return chain;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
return () => chain;
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
const editor = {
|
|
275
|
-
commands: { setContent: vi.fn() },
|
|
276
|
-
getAttributes: () => ({}),
|
|
277
|
-
state: {
|
|
278
|
-
selection: {
|
|
279
|
-
$anchor: { node: () => ({ type: { name: 'paragraph' } }) },
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
chain: () => chain,
|
|
283
|
-
getJSON: () => ({ type: 'doc', content: [{ type: 'paragraph' }] }),
|
|
284
|
-
} as unknown as Editor;
|
|
285
|
-
|
|
286
|
-
return { editor, setMarkCalls };
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const styleStore = (headingsColor: string) =>
|
|
290
|
-
({
|
|
291
|
-
textStyles: {
|
|
292
|
-
textStyleOptions: {
|
|
293
|
-
headings: {
|
|
294
|
-
style: {
|
|
295
|
-
color: headingsColor,
|
|
296
|
-
fontFamily: 'Lato',
|
|
297
|
-
fontSize: '1.5em',
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
}) as any;
|
|
303
|
-
|
|
304
|
-
const pageStoreWithMailingList = (titleStyle: any) =>
|
|
305
|
-
({
|
|
306
|
-
pages: [
|
|
307
|
-
{
|
|
308
|
-
contents: [
|
|
309
|
-
{
|
|
310
|
-
id: 'ml',
|
|
311
|
-
type: 'mailing-list',
|
|
312
|
-
settings: {
|
|
313
|
-
content: {
|
|
314
|
-
id: 'ml',
|
|
315
|
-
type: 'mailing-list',
|
|
316
|
-
title: 'Join mailing list',
|
|
317
|
-
titleStyle,
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
},
|
|
321
|
-
],
|
|
322
|
-
},
|
|
323
|
-
],
|
|
324
|
-
}) as any;
|
|
325
|
-
|
|
326
|
-
const textStyleColor = (calls: { name: string; attrs: any }[]) =>
|
|
327
|
-
calls.find((c) => c.name === 'textStyle')?.attrs?.color as
|
|
328
|
-
| string
|
|
329
|
-
| undefined;
|
|
330
|
-
|
|
331
|
-
it('bakes the element colour override into the title mark, not the global colour', () => {
|
|
332
|
-
const { editor, setMarkCalls } = buildEditor();
|
|
333
|
-
|
|
334
|
-
transformToRTE(
|
|
335
|
-
pageStoreWithMailingList({
|
|
336
|
-
textStyleType: 'headings',
|
|
337
|
-
textAlign: 'center',
|
|
338
|
-
color: 'var(--palette-1)', // the contrast bake / linked override
|
|
339
|
-
}),
|
|
340
|
-
editor,
|
|
341
|
-
styleStore('var(--palette-0)'), // global headings colour differs
|
|
342
|
-
);
|
|
343
|
-
|
|
344
|
-
expect(textStyleColor(setMarkCalls)).toContain('palette-1');
|
|
345
|
-
expect(textStyleColor(setMarkCalls)).not.toContain('palette-0');
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
it('falls back to the global colour when the element has none (no regression)', () => {
|
|
349
|
-
const { editor, setMarkCalls } = buildEditor();
|
|
350
|
-
|
|
351
|
-
transformToRTE(
|
|
352
|
-
pageStoreWithMailingList({
|
|
353
|
-
textStyleType: 'headings',
|
|
354
|
-
textAlign: 'center',
|
|
355
|
-
}),
|
|
356
|
-
editor,
|
|
357
|
-
styleStore('var(--palette-0)'),
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
expect(textStyleColor(setMarkCalls)).toContain('palette-0');
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
describe('transformToRTE — respects existing RTE marks on selection (BP-5886)', () => {
|
|
365
|
-
// Section-select / add-content call transformToRTE with the style store (store-driven),
|
|
366
|
-
// which walks EVERY section. Before the fix it re-derived `element || global` and
|
|
367
|
-
// `selectAll().setMark`'d it over every linked field's mark — flipping migrated frame
|
|
368
|
-
// colours to the global site-wide the moment any section was selected. A global-style
|
|
369
|
-
// *edit* (type-driven) must still re-stamp existing RTE to propagate the change.
|
|
370
|
-
const RESTAMPED = {
|
|
371
|
-
type: 'doc',
|
|
372
|
-
content: [{ type: 'paragraph', restamped: true }],
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
const buildEditor = () => {
|
|
376
|
-
const chain: any = new Proxy(
|
|
377
|
-
{},
|
|
378
|
-
{
|
|
379
|
-
get(_t, prop) {
|
|
380
|
-
if (prop === 'run') return () => undefined;
|
|
381
|
-
|
|
382
|
-
return () => chain;
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
);
|
|
386
|
-
|
|
387
|
-
return {
|
|
388
|
-
commands: { setContent: vi.fn() },
|
|
389
|
-
getAttributes: () => ({}),
|
|
390
|
-
state: {
|
|
391
|
-
selection: {
|
|
392
|
-
$anchor: { node: () => ({ type: { name: 'paragraph' } }) },
|
|
393
|
-
},
|
|
394
|
-
},
|
|
395
|
-
chain: () => chain,
|
|
396
|
-
getJSON: () => RESTAMPED,
|
|
397
|
-
} as unknown as Editor;
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
const styleStore = () =>
|
|
401
|
-
({
|
|
402
|
-
textStyles: {
|
|
403
|
-
textStyleOptions: {
|
|
404
|
-
headings: {
|
|
405
|
-
style: { color: 'var(--palette-1)', fontFamily: 'Lato' },
|
|
406
|
-
},
|
|
407
|
-
},
|
|
408
|
-
},
|
|
409
|
-
}) as any;
|
|
410
|
-
|
|
411
|
-
// titleStyle links to the headings global with NO element colour override — the exact
|
|
412
|
-
// legacy shape the migration bake leaves (mark carries the colour, element style blank).
|
|
413
|
-
const pageStoreWithTitle = (title: unknown) =>
|
|
414
|
-
({
|
|
415
|
-
pages: [
|
|
416
|
-
{
|
|
417
|
-
contents: [
|
|
418
|
-
{
|
|
419
|
-
id: 'ml',
|
|
420
|
-
type: 'mailing-list',
|
|
421
|
-
settings: {
|
|
422
|
-
content: {
|
|
423
|
-
id: 'ml',
|
|
424
|
-
type: 'mailing-list',
|
|
425
|
-
title,
|
|
426
|
-
titleStyle: {
|
|
427
|
-
textStyleType: 'headings',
|
|
428
|
-
textAlign: 'center',
|
|
429
|
-
},
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
},
|
|
433
|
-
],
|
|
434
|
-
},
|
|
435
|
-
],
|
|
436
|
-
}) as any;
|
|
437
|
-
|
|
438
|
-
const existingRteTitle = () => ({
|
|
439
|
-
type: 'doc',
|
|
440
|
-
content: [
|
|
441
|
-
{
|
|
442
|
-
type: 'paragraph',
|
|
443
|
-
content: [
|
|
444
|
-
{
|
|
445
|
-
type: 'text',
|
|
446
|
-
text: 'Join mailing list',
|
|
447
|
-
marks: [
|
|
448
|
-
{ type: 'textStyle', attrs: { color: 'var(--palette-0)' } },
|
|
449
|
-
],
|
|
450
|
-
},
|
|
451
|
-
],
|
|
452
|
-
},
|
|
453
|
-
],
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
// A `text` section — single-block (`text` + section-level `textStyle`, the
|
|
457
|
-
// brandPage/brandContact shape) or per-item (`textItems`, brandSite). These exercise the
|
|
458
|
-
// other two rewrap blocks in `transformToRTE`, distinct from the field-pair path above.
|
|
459
|
-
const pageStoreWithSingleBlockText = (text: unknown) =>
|
|
460
|
-
({
|
|
461
|
-
pages: [
|
|
462
|
-
{
|
|
463
|
-
contents: [
|
|
464
|
-
{
|
|
465
|
-
id: 't',
|
|
466
|
-
type: 'text',
|
|
467
|
-
settings: {
|
|
468
|
-
content: {
|
|
469
|
-
id: 't',
|
|
470
|
-
type: 'text',
|
|
471
|
-
text,
|
|
472
|
-
textStyle: { textStyleType: 'paragraphs', textAlign: 'left' },
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
},
|
|
476
|
-
],
|
|
477
|
-
},
|
|
478
|
-
],
|
|
479
|
-
}) as any;
|
|
480
|
-
|
|
481
|
-
const pageStoreWithTextItem = (text: unknown) =>
|
|
482
|
-
({
|
|
483
|
-
pages: [
|
|
484
|
-
{
|
|
485
|
-
contents: [
|
|
486
|
-
{
|
|
487
|
-
id: 't',
|
|
488
|
-
type: 'text',
|
|
489
|
-
settings: {
|
|
490
|
-
content: {
|
|
491
|
-
id: 't',
|
|
492
|
-
type: 'text',
|
|
493
|
-
textItems: [
|
|
494
|
-
{
|
|
495
|
-
id: 'i',
|
|
496
|
-
text,
|
|
497
|
-
textStyle: {
|
|
498
|
-
textStyleType: 'paragraphs',
|
|
499
|
-
textAlign: 'left',
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
],
|
|
503
|
-
},
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
|
-
],
|
|
507
|
-
},
|
|
508
|
-
],
|
|
509
|
-
}) as any;
|
|
510
|
-
|
|
511
|
-
it('store-driven select leaves an already-RTE mark untouched', () => {
|
|
512
|
-
// The fix-pinning case: this one FAILS on the pre-fix guard (which re-stamped every
|
|
513
|
-
// already-RTE field on any select). The two positive tests below also pass pre-fix.
|
|
514
|
-
const editor = buildEditor();
|
|
515
|
-
const title = existingRteTitle();
|
|
516
|
-
const pageStore = pageStoreWithTitle(title);
|
|
517
|
-
|
|
518
|
-
// Store-driven (section-select): no `type`, style store present.
|
|
519
|
-
transformToRTE(pageStore, editor, styleStore());
|
|
520
|
-
|
|
521
|
-
const content = pageStore.pages[0].contents[0].settings.content;
|
|
522
|
-
|
|
523
|
-
expect(content.title).toBe(title); // same reference — never rewrapped
|
|
524
|
-
expect(editor.commands.setContent).not.toHaveBeenCalled();
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
it('store-driven select leaves an already-RTE single-block text section untouched', () => {
|
|
528
|
-
const editor = buildEditor();
|
|
529
|
-
const text = existingRteTitle();
|
|
530
|
-
const pageStore = pageStoreWithSingleBlockText(text);
|
|
531
|
-
|
|
532
|
-
transformToRTE(pageStore, editor, styleStore());
|
|
533
|
-
|
|
534
|
-
const content = pageStore.pages[0].contents[0].settings.content;
|
|
535
|
-
|
|
536
|
-
expect(content.text).toBe(text); // single-block `text` path — mark preserved
|
|
537
|
-
expect(editor.commands.setContent).not.toHaveBeenCalled();
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
it('store-driven select leaves an already-RTE text item untouched', () => {
|
|
541
|
-
const editor = buildEditor();
|
|
542
|
-
const text = existingRteTitle();
|
|
543
|
-
const pageStore = pageStoreWithTextItem(text);
|
|
544
|
-
|
|
545
|
-
transformToRTE(pageStore, editor, styleStore());
|
|
546
|
-
|
|
547
|
-
const item = pageStore.pages[0].contents[0].settings.content.textItems[0];
|
|
548
|
-
|
|
549
|
-
expect(item.text).toBe(text); // `textItems` loop — mark preserved
|
|
550
|
-
expect(editor.commands.setContent).not.toHaveBeenCalled();
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
it('store-driven select still converts a genuine plain-text field to RTE', () => {
|
|
554
|
-
const editor = buildEditor();
|
|
555
|
-
const pageStore = pageStoreWithTitle('Join mailing list');
|
|
556
|
-
|
|
557
|
-
transformToRTE(pageStore, editor, styleStore());
|
|
558
|
-
|
|
559
|
-
const content = pageStore.pages[0].contents[0].settings.content;
|
|
560
|
-
|
|
561
|
-
expect(content.title).toBe(RESTAMPED); // plain string → converted
|
|
562
|
-
expect(editor.commands.setContent).toHaveBeenCalled();
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
it('type-driven global-style change still re-stamps an already-RTE field', () => {
|
|
566
|
-
const editor = buildEditor();
|
|
567
|
-
const pageStore = pageStoreWithTitle(existingRteTitle());
|
|
568
|
-
|
|
569
|
-
// Type-driven (global-style edit): `type` matches, no style store.
|
|
570
|
-
transformToRTE(
|
|
571
|
-
pageStore,
|
|
572
|
-
editor,
|
|
573
|
-
undefined,
|
|
574
|
-
undefined,
|
|
575
|
-
'headings' as any,
|
|
576
|
-
{
|
|
577
|
-
color: 'var(--palette-1)',
|
|
578
|
-
} as any,
|
|
579
|
-
);
|
|
580
|
-
|
|
581
|
-
const content = pageStore.pages[0].contents[0].settings.content;
|
|
582
|
-
|
|
583
|
-
expect(content.title).toBe(RESTAMPED); // propagated the global edit into the mark
|
|
584
|
-
expect(editor.commands.setContent).toHaveBeenCalled();
|
|
585
|
-
});
|
|
586
|
-
});
|
|
587
|
-
|
|
588
191
|
describe('sanitiseClientSideRTE', () => {
|
|
589
192
|
it('removes forbidden tags entirely', () => {
|
|
590
193
|
const input =
|
|
@@ -1166,3 +769,437 @@ describe('resolveInitialToolbarTextColor (BP-5886)', () => {
|
|
|
1166
769
|
expect(resolveInitialToolbarTextColor(undefined)).toBe('#000000');
|
|
1167
770
|
});
|
|
1168
771
|
});
|
|
772
|
+
|
|
773
|
+
describe('buildInitialMarks — BP-5969 bakeTypography gate', () => {
|
|
774
|
+
const buildState = () => {
|
|
775
|
+
const created: { type: string; attrs: any }[] = [];
|
|
776
|
+
const markFactory = (type: string) => ({
|
|
777
|
+
create: (attrs: any = {}) => {
|
|
778
|
+
created.push({ type, attrs });
|
|
779
|
+
|
|
780
|
+
return { type, attrs };
|
|
781
|
+
},
|
|
782
|
+
});
|
|
783
|
+
const state = {
|
|
784
|
+
schema: {
|
|
785
|
+
marks: {
|
|
786
|
+
textStyle: markFactory('textStyle'),
|
|
787
|
+
highlight: markFactory('highlight'),
|
|
788
|
+
bold: markFactory('bold'),
|
|
789
|
+
italic: markFactory('italic'),
|
|
790
|
+
underline: markFactory('underline'),
|
|
791
|
+
strike: markFactory('strike'),
|
|
792
|
+
},
|
|
793
|
+
},
|
|
794
|
+
} as any;
|
|
795
|
+
|
|
796
|
+
return { state, created };
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
const fullStyle = {
|
|
800
|
+
fontFamily: 'Lato',
|
|
801
|
+
fontSize: '2.5em',
|
|
802
|
+
color: 'red',
|
|
803
|
+
lineHeight: '1.2',
|
|
804
|
+
letterSpacing: '0.1em',
|
|
805
|
+
fontWeight: 'bold',
|
|
806
|
+
fontStyle: 'italic',
|
|
807
|
+
textDecoration: 'underline line-through',
|
|
808
|
+
} as TextStyleDeclaration;
|
|
809
|
+
|
|
810
|
+
it('references the role via vars when bakeTypography is false (class supplies typography)', () => {
|
|
811
|
+
const { state, created } = buildState();
|
|
812
|
+
|
|
813
|
+
buildInitialMarks(state, fullStyle, false);
|
|
814
|
+
|
|
815
|
+
const textStyle = created.find((m) => m.type === 'textStyle');
|
|
816
|
+
|
|
817
|
+
expect(textStyle?.attrs).toEqual({
|
|
818
|
+
color: expect.stringContaining('red'),
|
|
819
|
+
fontFamily: 'var(--role-font-family)',
|
|
820
|
+
fontSize: 'var(--role-font-size)',
|
|
821
|
+
lineHeight: 'var(--role-line-height)',
|
|
822
|
+
letterSpacing: 'var(--role-letter-spacing)',
|
|
823
|
+
// BP-5969 Phase A: weight/style/decoration are var-backed textStyle attrs too, so linked text
|
|
824
|
+
// references the role for these — not baked as semantic <strong>/<u> marks.
|
|
825
|
+
fontWeight: 'var(--role-font-weight)',
|
|
826
|
+
fontStyle: 'var(--role-font-style)',
|
|
827
|
+
textDecoration: 'var(--role-text-decoration)',
|
|
828
|
+
});
|
|
829
|
+
// …and NOT as per-run semantic marks
|
|
830
|
+
expect(created.some((m) => m.type === 'bold')).toBe(false);
|
|
831
|
+
expect(created.some((m) => m.type === 'italic')).toBe(false);
|
|
832
|
+
expect(created.some((m) => m.type === 'underline')).toBe(false);
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
it('bakes full typography when bakeTypography is true (default)', () => {
|
|
836
|
+
const { state, created } = buildState();
|
|
837
|
+
|
|
838
|
+
buildInitialMarks(state, fullStyle);
|
|
839
|
+
|
|
840
|
+
const textStyle = created.find((m) => m.type === 'textStyle');
|
|
841
|
+
|
|
842
|
+
expect(textStyle?.attrs.fontFamily).toBe('Lato');
|
|
843
|
+
expect(textStyle?.attrs.fontSize).toBe('2.5em');
|
|
844
|
+
expect(created.some((m) => m.type === 'bold')).toBe(true);
|
|
845
|
+
expect(created.some((m) => m.type === 'underline')).toBe(true);
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
it('omits the empty textStyle mark when there is nothing to reference or bake', () => {
|
|
849
|
+
const { state, created } = buildState();
|
|
850
|
+
|
|
851
|
+
// no typography and no colour → nothing to reference → no textStyle mark at all
|
|
852
|
+
buildInitialMarks(state, {} as TextStyleDeclaration, false);
|
|
853
|
+
|
|
854
|
+
expect(created.some((m) => m.type === 'textStyle')).toBe(false);
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
describe('roleVarOrLiteral / isRoleVarRef / normTypographyValue (BP-5969)', () => {
|
|
859
|
+
const role = {
|
|
860
|
+
fontFamily: 'Pacifico',
|
|
861
|
+
fontSize: '2.25em',
|
|
862
|
+
} as TextStyleDeclaration;
|
|
863
|
+
|
|
864
|
+
it('writes the role var when the pick equals the role (re-links)', () => {
|
|
865
|
+
expect(roleVarOrLiteral('fontFamily', 'Pacifico', role)).toBe(
|
|
866
|
+
'var(--role-font-family)',
|
|
867
|
+
);
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
it('writes the literal when the pick differs from the role (override)', () => {
|
|
871
|
+
expect(roleVarOrLiteral('fontFamily', 'Inter', role)).toBe('Inter');
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
it('normalises quotes/whitespace so a quoted family still matches the role', () => {
|
|
875
|
+
expect(roleVarOrLiteral('fontFamily', '"Pacifico"', role)).toBe(
|
|
876
|
+
'var(--role-font-family)',
|
|
877
|
+
);
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
it('always writes the literal for a legacy/unlinked block (no role)', () => {
|
|
881
|
+
expect(roleVarOrLiteral('fontFamily', 'Pacifico', undefined)).toBe(
|
|
882
|
+
'Pacifico',
|
|
883
|
+
);
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
it('the Pacifico → Inter → Pacifico round-trip re-links (no pin)', () => {
|
|
887
|
+
expect(roleVarOrLiteral('fontFamily', 'Inter', role)).toBe('Inter');
|
|
888
|
+
// returning to the role value stores the ref, not a baked literal
|
|
889
|
+
expect(roleVarOrLiteral('fontFamily', 'Pacifico', role)).toBe(
|
|
890
|
+
'var(--role-font-family)',
|
|
891
|
+
);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
it('isRoleVarRef distinguishes a role ref from a literal', () => {
|
|
895
|
+
expect(isRoleVarRef('var(--role-font-family)')).toBe(true);
|
|
896
|
+
expect(isRoleVarRef('var(--palette-3)')).toBe(false);
|
|
897
|
+
expect(isRoleVarRef('Pacifico')).toBe(false);
|
|
898
|
+
expect(isRoleVarRef(undefined)).toBe(false);
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
it('normTypographyValue strips quotes for fontFamily only', () => {
|
|
902
|
+
expect(normTypographyValue('fontFamily', ' "Open Sans" ')).toBe(
|
|
903
|
+
'Open Sans',
|
|
904
|
+
);
|
|
905
|
+
expect(normTypographyValue('fontSize', ' 2em ')).toBe('2em');
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
it('normTypographyValue folds a prop default keyword to empty (normal/none == unset)', () => {
|
|
909
|
+
// A prop's CSS default keyword renders identically to the prop being absent, so both normalise
|
|
910
|
+
// to '' — a block's `normal`/`none` matches a role that simply omits the prop (no false override).
|
|
911
|
+
expect(normTypographyValue('fontWeight', 'normal')).toBe('');
|
|
912
|
+
expect(normTypographyValue('fontStyle', 'normal')).toBe('');
|
|
913
|
+
expect(normTypographyValue('textDecoration', 'none')).toBe('');
|
|
914
|
+
expect(normTypographyValue('letterSpacing', 'normal')).toBe('');
|
|
915
|
+
expect(normTypographyValue('lineHeight', 'normal')).toBe('');
|
|
916
|
+
expect(normTypographyValue('fontWeight', undefined)).toBe('');
|
|
917
|
+
expect(normTypographyValue('fontWeight', '')).toBe('');
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
it('normTypographyValue keeps a real value and folds only the matching key', () => {
|
|
921
|
+
expect(normTypographyValue('fontWeight', 'bold')).toBe('bold');
|
|
922
|
+
expect(normTypographyValue('fontStyle', 'italic')).toBe('italic');
|
|
923
|
+
expect(normTypographyValue('textDecoration', 'underline')).toBe(
|
|
924
|
+
'underline',
|
|
925
|
+
);
|
|
926
|
+
// 'none' is only the default for textDecoration; for fontWeight it is a plain value, not folded.
|
|
927
|
+
expect(normTypographyValue('fontWeight', 'none')).toBe('none');
|
|
928
|
+
// fontFamily has no default keyword — a family literally named 'normal' is kept.
|
|
929
|
+
expect(normTypographyValue('fontFamily', 'normal')).toBe('normal');
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
it('roleVarOrLiteral re-links when block default keyword equals the role default (normal)', () => {
|
|
933
|
+
const bodyRole = { fontWeight: 'normal' } as TextStyleDeclaration;
|
|
934
|
+
|
|
935
|
+
// Toggling bold OFF writes 'normal'; against a role whose weight is 'normal' it must re-link,
|
|
936
|
+
// not pin a redundant literal.
|
|
937
|
+
expect(roleVarOrLiteral('fontWeight', 'normal', bodyRole)).toBe(
|
|
938
|
+
'var(--role-font-weight)',
|
|
939
|
+
);
|
|
940
|
+
});
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
describe('isCanonicalLinked (BP-5969)', () => {
|
|
944
|
+
it('is true only for a canonical role type', () => {
|
|
945
|
+
expect(isCanonicalLinked({ textStyleType: 'heading1' })).toBe(true);
|
|
946
|
+
expect(isCanonicalLinked({ textStyleType: 'button' })).toBe(true);
|
|
947
|
+
expect(isCanonicalLinked({ textStyleType: 'headings' })).toBe(false); // legacy
|
|
948
|
+
expect(isCanonicalLinked({ textStyleType: undefined })).toBe(false);
|
|
949
|
+
expect(isCanonicalLinked(undefined)).toBe(false);
|
|
950
|
+
});
|
|
951
|
+
});
|
|
952
|
+
|
|
953
|
+
describe('relinkRoleEqualMarks (R8 sibling relink)', () => {
|
|
954
|
+
const NEW_ROLE = {
|
|
955
|
+
fontFamily: 'Oswald',
|
|
956
|
+
fontSize: '3.5em',
|
|
957
|
+
fontWeight: 'bold',
|
|
958
|
+
};
|
|
959
|
+
const OLD_ROLE = {
|
|
960
|
+
fontFamily: 'Lato',
|
|
961
|
+
fontSize: '3.1875em',
|
|
962
|
+
fontWeight: 'bold',
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
const run = (attrs: Record<string, unknown>, extraMarks: object[] = []) => ({
|
|
966
|
+
type: 'text',
|
|
967
|
+
text: 'x',
|
|
968
|
+
marks: [{ type: 'textStyle', attrs }, ...extraMarks],
|
|
969
|
+
});
|
|
970
|
+
const docOf = (...runs: object[]) => ({
|
|
971
|
+
type: 'doc',
|
|
972
|
+
content: [{ type: 'paragraph', content: runs }],
|
|
973
|
+
});
|
|
974
|
+
const marksOf = (doc: unknown, index: number) =>
|
|
975
|
+
(
|
|
976
|
+
doc as {
|
|
977
|
+
content: {
|
|
978
|
+
content: {
|
|
979
|
+
marks: { type: string; attrs?: Record<string, unknown> }[];
|
|
980
|
+
}[];
|
|
981
|
+
}[];
|
|
982
|
+
}
|
|
983
|
+
).content[0].content[index].marks;
|
|
984
|
+
const textStyleOf = (doc: unknown, index: number) =>
|
|
985
|
+
marksOf(doc, index).find((mark) => mark.type === 'textStyle')?.attrs;
|
|
986
|
+
|
|
987
|
+
it('relinkRoleEqualMarks relinks each run on its own: new-role and old-role literals, not a real override', () => {
|
|
988
|
+
const doc = docOf(
|
|
989
|
+
run({ fontSize: '3.5em' }),
|
|
990
|
+
run({ fontFamily: 'Lato' }),
|
|
991
|
+
run({ fontSize: '4em' }),
|
|
992
|
+
);
|
|
993
|
+
|
|
994
|
+
const out = relinkRoleEqualMarks(doc, [NEW_ROLE, OLD_ROLE]);
|
|
995
|
+
|
|
996
|
+
expect(textStyleOf(out, 0)?.fontSize).toBe(roleVarRef('fontSize'));
|
|
997
|
+
expect(textStyleOf(out, 1)?.fontFamily).toBe(roleVarRef('fontFamily'));
|
|
998
|
+
expect(textStyleOf(out, 2)?.fontSize).toBe('4em');
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
it('relinkRoleEqualMarks unsets a literal the linked role leaves undefined; normal equals an unset role value', () => {
|
|
1002
|
+
const doc = docOf(run({ fontStyle: 'normal', color: '#111111' }));
|
|
1003
|
+
|
|
1004
|
+
const out = relinkRoleEqualMarks(doc, [NEW_ROLE, OLD_ROLE]);
|
|
1005
|
+
|
|
1006
|
+
expect(textStyleOf(out, 0)?.fontStyle).toBeNull();
|
|
1007
|
+
expect(textStyleOf(out, 0)?.color).toBe('#111111');
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
it('relinkRoleEqualMarks leaves colour, link marks and role refs alone, and returns the same doc when nothing changes', () => {
|
|
1011
|
+
const link = { type: 'link', attrs: { href: 'https://example.com' } };
|
|
1012
|
+
const doc = docOf(
|
|
1013
|
+
run({ fontSize: roleVarRef('fontSize'), color: '#222222' }, [link]),
|
|
1014
|
+
);
|
|
1015
|
+
|
|
1016
|
+
const out = relinkRoleEqualMarks(doc, [NEW_ROLE, OLD_ROLE]);
|
|
1017
|
+
|
|
1018
|
+
expect(out).toBe(doc);
|
|
1019
|
+
expect(marksOf(out, 0)).toContainEqual(link);
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
it('relinkRoleEqualMarks drops a textStyle mark left with nothing in it', () => {
|
|
1023
|
+
const doc = docOf(run({ fontStyle: 'normal' }));
|
|
1024
|
+
|
|
1025
|
+
const out = relinkRoleEqualMarks(doc, [NEW_ROLE]);
|
|
1026
|
+
|
|
1027
|
+
expect(marksOf(out, 0).some((mark) => mark.type === 'textStyle')).toBe(
|
|
1028
|
+
false,
|
|
1029
|
+
);
|
|
1030
|
+
});
|
|
1031
|
+
|
|
1032
|
+
it('relinkRoleEqualMarks drops the reset marker with the decoration it qualified', () => {
|
|
1033
|
+
const doc = docOf(
|
|
1034
|
+
run({ textDecoration: 'line-through', textDecorationReset: true }),
|
|
1035
|
+
);
|
|
1036
|
+
|
|
1037
|
+
const out = relinkRoleEqualMarks(doc, [
|
|
1038
|
+
{ ...NEW_ROLE, textDecoration: 'line-through' },
|
|
1039
|
+
]);
|
|
1040
|
+
|
|
1041
|
+
expect(textStyleOf(out, 0)?.textDecoration).toBe(
|
|
1042
|
+
roleVarRef('textDecoration'),
|
|
1043
|
+
);
|
|
1044
|
+
expect(textStyleOf(out, 0)).not.toHaveProperty('textDecorationReset');
|
|
1045
|
+
});
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
describe('relinkDocToRole (R19 reset-to-role, document form)', () => {
|
|
1049
|
+
const NEW_ROLE = {
|
|
1050
|
+
fontFamily: 'Oswald',
|
|
1051
|
+
fontSize: '3.5em',
|
|
1052
|
+
fontWeight: 'bold',
|
|
1053
|
+
};
|
|
1054
|
+
|
|
1055
|
+
const run = (attrs: Record<string, unknown>, extraMarks: object[] = []) => ({
|
|
1056
|
+
type: 'text',
|
|
1057
|
+
text: 'x',
|
|
1058
|
+
marks: [{ type: 'textStyle', attrs }, ...extraMarks],
|
|
1059
|
+
});
|
|
1060
|
+
const docOf = (...runs: object[]) => ({
|
|
1061
|
+
type: 'doc',
|
|
1062
|
+
content: [{ type: 'paragraph', content: runs }],
|
|
1063
|
+
});
|
|
1064
|
+
const marksOf = (doc: unknown, index: number) =>
|
|
1065
|
+
(
|
|
1066
|
+
doc as {
|
|
1067
|
+
content: {
|
|
1068
|
+
content: {
|
|
1069
|
+
marks: { type: string; attrs?: Record<string, unknown> }[];
|
|
1070
|
+
}[];
|
|
1071
|
+
}[];
|
|
1072
|
+
}
|
|
1073
|
+
).content[0].content[index].marks;
|
|
1074
|
+
const textStyleOf = (doc: unknown, index: number) =>
|
|
1075
|
+
marksOf(doc, index).find((mark) => mark.type === 'textStyle')?.attrs;
|
|
1076
|
+
|
|
1077
|
+
it('relinks every run to the new role — a deliberate accent override included, unlike relinkRoleEqualMarks', () => {
|
|
1078
|
+
const doc = docOf(run({ fontFamily: 'Playfair Display', fontSize: '5em' }));
|
|
1079
|
+
|
|
1080
|
+
const out = relinkDocToRole(doc, NEW_ROLE);
|
|
1081
|
+
|
|
1082
|
+
expect(textStyleOf(out, 0)?.fontFamily).toBe(roleVarRef('fontFamily'));
|
|
1083
|
+
expect(textStyleOf(out, 0)?.fontSize).toBe(roleVarRef('fontSize'));
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
it("drops the reset marker so the run follows the new role's lines", () => {
|
|
1087
|
+
const doc = docOf(
|
|
1088
|
+
run({
|
|
1089
|
+
textDecoration: 'line-through',
|
|
1090
|
+
textDecorationReset: true,
|
|
1091
|
+
color: '#111111',
|
|
1092
|
+
}),
|
|
1093
|
+
);
|
|
1094
|
+
|
|
1095
|
+
const out = relinkDocToRole(doc, {
|
|
1096
|
+
...NEW_ROLE,
|
|
1097
|
+
textDecoration: 'underline',
|
|
1098
|
+
});
|
|
1099
|
+
|
|
1100
|
+
expect(textStyleOf(out, 0)?.textDecoration).toBe(
|
|
1101
|
+
roleVarRef('textDecoration'),
|
|
1102
|
+
);
|
|
1103
|
+
expect(textStyleOf(out, 0)).not.toHaveProperty('textDecorationReset');
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
it('unsets a typography attr the new role leaves undefined', () => {
|
|
1107
|
+
const doc = docOf(run({ letterSpacing: '0.1em' }));
|
|
1108
|
+
|
|
1109
|
+
const out = relinkDocToRole(doc, NEW_ROLE);
|
|
1110
|
+
|
|
1111
|
+
expect(textStyleOf(out, 0)?.letterSpacing).toBeNull();
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
it('removes the legacy semantic emphasis marks (bold/italic/underline/strike)', () => {
|
|
1115
|
+
const doc = docOf(
|
|
1116
|
+
run({}, [{ type: 'bold' }, { type: 'italic' }, { type: 'strike' }]),
|
|
1117
|
+
);
|
|
1118
|
+
|
|
1119
|
+
const out = relinkDocToRole(doc, NEW_ROLE);
|
|
1120
|
+
|
|
1121
|
+
expect(
|
|
1122
|
+
marksOf(out, 0).some((mark) =>
|
|
1123
|
+
['bold', 'italic', 'underline', 'strike'].includes(mark.type),
|
|
1124
|
+
),
|
|
1125
|
+
).toBe(false);
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
it("keeps a link's underline and drops a plain run's", () => {
|
|
1129
|
+
const link = { type: 'link', attrs: { href: 'https://example.com' } };
|
|
1130
|
+
const doc = docOf(
|
|
1131
|
+
run({}, [{ type: 'underline' }]),
|
|
1132
|
+
run({}, [link, { type: 'underline' }]),
|
|
1133
|
+
);
|
|
1134
|
+
|
|
1135
|
+
const out = relinkDocToRole(doc, NEW_ROLE);
|
|
1136
|
+
|
|
1137
|
+
expect(marksOf(out, 0).map((mark) => mark.type)).not.toContain('underline');
|
|
1138
|
+
expect(marksOf(out, 1).map((mark) => mark.type)).toContain('underline');
|
|
1139
|
+
});
|
|
1140
|
+
|
|
1141
|
+
it('keeps colour and the link mark untouched', () => {
|
|
1142
|
+
const link = { type: 'link', attrs: { href: 'https://example.com' } };
|
|
1143
|
+
const doc = docOf(
|
|
1144
|
+
run({ color: '#222222', fontFamily: 'Playfair Display' }, [link]),
|
|
1145
|
+
);
|
|
1146
|
+
|
|
1147
|
+
const out = relinkDocToRole(doc, NEW_ROLE);
|
|
1148
|
+
|
|
1149
|
+
expect(textStyleOf(out, 0)?.color).toBe('#222222');
|
|
1150
|
+
expect(marksOf(out, 0)).toContainEqual(link);
|
|
1151
|
+
});
|
|
1152
|
+
|
|
1153
|
+
it('drops a mark left with no colour and every typography attr unset (no role to relink against)', () => {
|
|
1154
|
+
const doc = docOf(run({ fontFamily: 'Playfair Display', fontSize: '5em' }));
|
|
1155
|
+
|
|
1156
|
+
const out = relinkDocToRole(doc, undefined);
|
|
1157
|
+
|
|
1158
|
+
expect(marksOf(out, 0)).toEqual([]);
|
|
1159
|
+
});
|
|
1160
|
+
});
|
|
1161
|
+
|
|
1162
|
+
describe('mergePickedMarks (R9 first-type seed)', () => {
|
|
1163
|
+
const editor = new Editor({ extensions: getRteExtensions() });
|
|
1164
|
+
const { textStyle, highlight } = editor.schema.marks;
|
|
1165
|
+
const seed = [
|
|
1166
|
+
textStyle.create({
|
|
1167
|
+
color: '#111111',
|
|
1168
|
+
fontFamily: roleVarRef('fontFamily'),
|
|
1169
|
+
fontWeight: roleVarRef('fontWeight'),
|
|
1170
|
+
}),
|
|
1171
|
+
highlight.create({ color: '#ffeeaa' }),
|
|
1172
|
+
];
|
|
1173
|
+
|
|
1174
|
+
afterAll(() => editor.destroy());
|
|
1175
|
+
|
|
1176
|
+
it('mergePickedMarks keeps the seed colour and role refs and adds the picked bold', () => {
|
|
1177
|
+
const [merged, keptHighlight] = mergePickedMarks(seed, [
|
|
1178
|
+
textStyle.create({ fontWeight: 'bold' }),
|
|
1179
|
+
]);
|
|
1180
|
+
|
|
1181
|
+
expect(merged.attrs).toMatchObject({
|
|
1182
|
+
color: '#111111',
|
|
1183
|
+
fontFamily: roleVarRef('fontFamily'),
|
|
1184
|
+
fontWeight: 'bold', // the pick wins over the seed's role ref
|
|
1185
|
+
});
|
|
1186
|
+
expect(keptHighlight.attrs.color).toBe('#ffeeaa');
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
it('mergePickedMarks adds a picked mark the seed lacks', () => {
|
|
1190
|
+
const out = mergePickedMarks(
|
|
1191
|
+
[seed[0]],
|
|
1192
|
+
[highlight.create({ color: '#000' })],
|
|
1193
|
+
);
|
|
1194
|
+
|
|
1195
|
+
expect(out.map((mark) => mark.type.name)).toEqual([
|
|
1196
|
+
'textStyle',
|
|
1197
|
+
'highlight',
|
|
1198
|
+
]);
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
it('mergePickedMarks with nothing picked is the seed', () => {
|
|
1202
|
+
expect(mergePickedMarks(seed, null)).toEqual(seed);
|
|
1203
|
+
expect(mergePickedMarks(seed, [])).toEqual(seed);
|
|
1204
|
+
});
|
|
1205
|
+
});
|