@designcrowd/library.brand-page 6.2.6 → 6.2.7-ast-faq-1
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-DpeSEnwP.js → CreatedOnBrandCrowd-de-de-7BhvVOyG.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CxYv3NzT.js → CreatedOnBrandCrowd-en-us-DhKWkmpT.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-CzQ1HRHw.js → CreatedOnBrandCrowd-es-es-B8vcPgJ5.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-J77YZaT1.js → CreatedOnBrandCrowd-fr-ca-DJywro34.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-J77YZaT1.js → CreatedOnBrandCrowd-fr-fr-DJywro34.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-1vh4Smqt.js → CreatedOnBrandCrowd-pt-br-8Fe-EYbW.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-1vh4Smqt.js → CreatedOnBrandCrowd-pt-pt-8Fe-EYbW.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-CXX6W_29.js → CreatedOnDcom-de-de-CgIFS1rD.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-D78BmX6f.js → CreatedOnDcom-en-us-xfxOfOmI.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-FfbPM2vD.js → CreatedOnDcom-es-es-NUDILwyj.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-C6L60rxJ.js → CreatedOnDcom-fr-ca-DIC9p-8J.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-BEDnW9w-.js → CreatedOnDcom-fr-fr-CIAM16GN.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-CZXVvc1n.js → CreatedOnDcom-pt-br-CbVwaB2_.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-IQq744nb.js → CreatedOnDcom-pt-pt-ZrwJAVB-.js} +1 -1
- package/lib/src/brand-page/constants/misc.constants.d.ts +8 -0
- package/lib/src/brand-page/constants/misc.constants.js +7 -0
- package/lib/src/brand-page/constants/styles.constants.d.ts +2 -0
- package/lib/src/brand-page/constants/styles.constants.js +2 -0
- package/lib/src/brand-page/models/content.model.d.ts +1 -0
- package/lib/src/brand-page/models/content.model.js +1 -0
- package/lib/src/brand-page/models/index.d.ts +22 -0
- package/lib/src/brand-page/utils/content-callback-util.d.ts +2 -1
- package/lib/src/brand-page/utils/content-callback-util.js +3 -0
- package/lib/src/brand-page/utils/view-model.util.d.ts +2 -0
- package/lib/src/brand-page/utils/view-model.util.js +23 -0
- package/lib/src/brand-page/view-models.d.ts +9 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +10 -0
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +10 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +13 -0
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +33 -12
- package/lib/src/brand-page-maker/constants/config-settings-constant.d.ts +2 -1
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +100 -3
- package/lib/src/brand-page-maker/convertors/faq-display-style.convertor.d.ts +3 -0
- package/lib/src/brand-page-maker/convertors/faq-display-style.convertor.js +47 -0
- package/lib/src/brand-page-maker/models/content-settings-configs.d.ts +1 -0
- package/lib/src/brand-page-maker/models/content-settings-configs.js +1 -0
- package/lib/src/brand-page-maker/models/content-settings.d.ts +4 -1
- package/lib/src/brand-page-maker/models/content-settings.js +47 -1
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +1 -0
- package/lib/src/brand-page-maker/utils/apply-color-strategy.js +45 -17
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +6 -0
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +24 -1
- package/lib/src/brand-page-maker/validators/field.validator.js +2 -0
- package/lib/src/bundled-translations-CRdqhLb8.js +179 -0
- package/lib/src/bundled-translations.de-DE-D2M0pfDi.js +179 -0
- package/lib/src/bundled-translations.es-ES-5kyERvJF.js +179 -0
- package/lib/src/bundled-translations.fr-CA-CC4ymJyN.js +179 -0
- package/lib/src/bundled-translations.fr-FR-yyt0xgH9.js +179 -0
- package/lib/src/bundled-translations.pt-BR-BOSy38EW.js +179 -0
- package/lib/src/bundled-translations.pt-PT-DIdAUI2B.js +179 -0
- package/lib/src/bundles/bundled-translations.de-DE.json +14 -2
- package/lib/src/bundles/bundled-translations.es-ES.json +14 -2
- package/lib/src/bundles/bundled-translations.fr-CA.json +14 -2
- package/lib/src/bundles/bundled-translations.fr-FR.json +14 -2
- package/lib/src/bundles/bundled-translations.json +14 -2
- package/lib/src/bundles/bundled-translations.pt-BR.json +14 -2
- package/lib/src/bundles/bundled-translations.pt-PT.json +14 -2
- 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 +343 -231
- package/lib/src/css/library.brand-page-brandPage.min.css +343 -231
- package/lib/src/css/library.brand-page-designCom.min.css +343 -231
- package/lib/src/css/library.brand-page-preview.min.css +343 -231
- package/lib/src/index.mjs +161 -160
- package/lib/src/{lib-CyVd3FMn.js → lib-DOlxnnrv.js} +26202 -25472
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +1 -1
- package/lib/src/shared/color-strategies/color-strategies.js +4 -0
- package/lib/src/shared/color-strategies/rte-field-pairs.d.ts +12 -0
- package/lib/src/shared/color-strategies/rte-field-pairs.js +10 -0
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +10 -0
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +11 -1
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +10 -0
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +10 -0
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +10 -0
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.d.ts +14 -1
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.js +11 -1
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +12 -0
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.js +5 -0
- package/lib/src/shared/content-settings/models.d.ts +6 -0
- package/lib/src/shared/content-settings/store/content-settings-store.d.ts +14 -1
- package/lib/src/shared/content-settings/store/content-settings-store.js +19 -0
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +10 -0
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +10 -0
- package/package.json +4 -3
- package/src/brand-page/components/button/ButtonStyleWrapper.vue +4 -2
- package/src/brand-page/components/faq-section/FaqSection.test.ts +367 -0
- package/src/brand-page/components/faq-section/FaqSection.vue +337 -0
- package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.vue +1 -0
- package/src/brand-page/components/page/PageComponent.vue +2 -0
- package/src/brand-page/components/page-header/HeaderLayout.vue +3 -3
- package/src/brand-page/constants/misc.constants.ts +12 -0
- package/src/brand-page/constants/styles.constants.ts +2 -0
- package/src/brand-page/models/content.model.ts +1 -0
- package/src/brand-page/models/index.ts +24 -0
- package/src/brand-page/utils/content-callback-util.ts +5 -0
- package/src/brand-page/utils/view-model.util.test.ts +112 -0
- package/src/brand-page/utils/view-model.util.ts +48 -0
- package/src/brand-page/view-models.ts +12 -1
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.test.ts +165 -0
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +13 -5
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +48 -12
- package/src/brand-page-maker/constants/config-settings-constant.ts +104 -1
- package/src/brand-page-maker/constants/faq-section-config.test.ts +69 -0
- package/src/brand-page-maker/convertors/faq-display-style.convertor.ts +59 -0
- package/src/brand-page-maker/convertors/i18n/converter.de-DE.json +26 -23
- package/src/brand-page-maker/convertors/i18n/converter.es-ES.json +26 -23
- package/src/brand-page-maker/convertors/i18n/converter.fr-CA.json +26 -23
- package/src/brand-page-maker/convertors/i18n/converter.fr-FR.json +26 -23
- package/src/brand-page-maker/convertors/i18n/converter.json +4 -1
- package/src/brand-page-maker/convertors/i18n/converter.pt-BR.json +26 -23
- package/src/brand-page-maker/convertors/i18n/converter.pt-PT.json +26 -23
- package/src/brand-page-maker/models/content-settings-configs.ts +1 -0
- package/src/brand-page-maker/models/content-settings.ts +59 -0
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +2 -0
- package/src/brand-page-maker/utils/__snapshots__/apply-color-strategy.golden.test.ts.snap +3820 -300
- package/src/brand-page-maker/utils/apply-color-strategy.test.ts +123 -2
- package/src/brand-page-maker/utils/apply-color-strategy.ts +73 -19
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +110 -0
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +66 -0
- package/src/brand-page-maker/validators/field.validator.ts +2 -0
- package/src/bundles/bundled-translations.de-DE.json +14 -2
- package/src/bundles/bundled-translations.es-ES.json +14 -2
- package/src/bundles/bundled-translations.fr-CA.json +14 -2
- package/src/bundles/bundled-translations.fr-FR.json +14 -2
- package/src/bundles/bundled-translations.json +14 -2
- package/src/bundles/bundled-translations.pt-BR.json +14 -2
- package/src/bundles/bundled-translations.pt-PT.json +14 -2
- package/src/composables/useTranslate.ts +2 -1
- package/src/metadata-builder/builders/item-id-utils.test.ts +24 -0
- package/src/metadata-builder/parsers/section-tool-arguments.ts +2 -1
- package/src/shared/color-strategies/color-strategies.ts +4 -0
- package/src/shared/color-strategies/rte-field-pairs.test.ts +2 -0
- package/src/shared/color-strategies/rte-field-pairs.ts +23 -0
- package/src/shared/content-settings/components/color-field/ColorField.test.ts +29 -0
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.de-DE.json +11 -1
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.es-ES.json +11 -1
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-CA.json +11 -1
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.fr-FR.json +11 -1
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +11 -1
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-BR.json +11 -1
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.pt-PT.json +11 -1
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.vue +2 -0
- package/src/shared/content-settings/components/faq-items-field/FaqItemsField.test.ts +331 -0
- package/src/shared/content-settings/components/faq-items-field/FaqItemsField.vue +276 -0
- package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.vue +1 -0
- package/src/shared/content-settings/components/items-field/ItemsField.mixin.ts +11 -1
- package/src/shared/content-settings/components/items-field/ItemsField.test.ts +106 -0
- package/src/shared/content-settings/components/items-field/ItemsField.vue +8 -2
- package/src/shared/content-settings/components/textarea-field/TextareaField.mixin.ts +6 -0
- package/src/shared/content-settings/components/textarea-field/TextareaField.vue +1 -0
- package/src/shared/content-settings/models.ts +7 -0
- package/src/shared/content-settings/store/content-settings-store.test.ts +49 -0
- package/src/shared/content-settings/store/content-settings-store.ts +37 -0
- package/src/utils/minify-brand-page-metadata.test.ts +35 -0
- package/lib/src/bundled-translations-BNA5h0Dx.js +0 -179
- package/lib/src/bundled-translations.de-DE-fyTHrRxT.js +0 -179
- package/lib/src/bundled-translations.es-ES-BMmvJGGC.js +0 -179
- package/lib/src/bundled-translations.fr-CA-Bo69L_BP.js +0 -179
- package/lib/src/bundled-translations.fr-FR-C4yTVFOW.js +0 -179
- package/lib/src/bundled-translations.pt-BR-CPMPfny0.js +0 -179
- package/lib/src/bundled-translations.pt-PT-C6ZwYs37.js +0 -179
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SOCIAL_LINKS_ICON_DISPLAY_STYLES, BRAND_PAGE_TYPES, DIVIDER_STYLES, MEDIA_TYPES, BUTTON_LINK_TYPE, FONT_SIZE_BODY, LINE_HEIGHT_BODY, MIN_TEXT_SIZE_PX, MAX_TEXT_SIZE_PX, TEXT_COLUMNS, DEFAULT_SHAPE_SIZE, PAYMENT_OPTION_DISPLAY_TYPES, PAYMENT_OPTION_IMAGE_TYPES, GettyVideoMedia, } from '@brand-page';
|
|
2
|
-
import { createInitialButtonContent, createInitialImageContent, createInitialProfileContent, createInitialTextContent, createInitialVideoContent, createInitialLogoContent, createInitialMapContent, createInitialImageGalleryContent, createInitialGeneralLinkContent, createInitialMailingListContent, createInitialRequestPaymentContent, createInitialSupportMeContent, createInitialContactFormContent, CONTENT_SETTINGS_DISPLAY_MODES, createInitialBannerSectionContent, createInitialSocialLinksContent, createInitialImagesSectionContent, createInitialTestimonialSectionContent, createInitialAboutSectionContent, createInitialDividerSectionContent, createInitialShapesSectionContent, VARIANT_DISPLAY_MODES, createInitialShopContent, createInitialBookingSectionContent, } from '../models';
|
|
1
|
+
import { FAQ_DISPLAY_STYLES, SOCIAL_LINKS_ICON_DISPLAY_STYLES, BRAND_PAGE_TYPES, DIVIDER_STYLES, MEDIA_TYPES, BUTTON_LINK_TYPE, FONT_SIZE_BODY, LINE_HEIGHT_BODY, MIN_TEXT_SIZE_PX, MAX_TEXT_SIZE_PX, TEXT_COLUMNS, DEFAULT_SHAPE_SIZE, PAYMENT_OPTION_DISPLAY_TYPES, PAYMENT_OPTION_IMAGE_TYPES, GettyVideoMedia, } from '@brand-page';
|
|
2
|
+
import { createInitialButtonContent, createInitialImageContent, createInitialProfileContent, createInitialTextContent, createInitialVideoContent, createInitialLogoContent, createInitialMapContent, createInitialImageGalleryContent, createInitialGeneralLinkContent, createInitialMailingListContent, createInitialRequestPaymentContent, createInitialSupportMeContent, createInitialContactFormContent, CONTENT_SETTINGS_DISPLAY_MODES, createInitialBannerSectionContent, createInitialSocialLinksContent, createInitialImagesSectionContent, createInitialTestimonialSectionContent, createInitialAboutSectionContent, createInitialDividerSectionContent, createInitialShapesSectionContent, VARIANT_DISPLAY_MODES, createInitialShopContent, createInitialBookingSectionContent, createInitialFaqSectionContent, } from '../models';
|
|
3
3
|
import * as uuid from 'uuid';
|
|
4
4
|
import { colorConvertor, backgroundColorConvertor, borderColorConvertor, displayStyleConvertor, galleryTypeConvertor, imageAspectRatioConvertor, textAlignmentOptionsConvertor, videoContentStateConvertor, fillColorConvertor, bannerAlignDisplayStyleConvertor, aboutDisplayStyleConvertor, dividerStyleConvertor, shapeSizeOptionsConvertor, buttonLinkStyleConvertor, textSizeValueConvertor, textColumnStyleConvertor, contactLayoutStyleConvertor, paymentLinkDisplayStyleConvertor, shopDisplayConvertor, shopAspectRatioConvertor, } from '../convertors';
|
|
5
5
|
import { ALIGN_CENTERED, DISPLAY_STYLE_COLLAPSED, DISPLAY_STYLE_PREVIEW, } from '@brand-page';
|
|
@@ -8,6 +8,7 @@ import { contactFormCardColorDefaultGetter, paymentFillColorFieldDefaultGetter,
|
|
|
8
8
|
import { socialLinksIconDisplayStyleConvertor } from '../convertors/social-links-icon-display-style.convertor';
|
|
9
9
|
import { getTextMediaOptionsConverterByMediaType } from '../convertors/text-image-display-style.convertor';
|
|
10
10
|
import { testimonialDisplayStyleConvertor } from '../convertors/testimonial-display-style-convertor';
|
|
11
|
+
import { faqDisplayStyleConvertor } from '../convertors/faq-display-style.convertor';
|
|
11
12
|
import { pageValidator, urlValidator } from '../validators';
|
|
12
13
|
import { imagesSectionAspectRatioVisibilityAssessor } from '../assessors/images-section-aspect-ratio-visibility.assessor';
|
|
13
14
|
import { bannerLinkTypeVisibilityAssessor, bannerSectionPageVisibilityAssessor, bannerSectionUrlVisibilityAssessor, bannerDisplayTypeVisibilityAssessor, bannerOverlayOptionsVisibilityAssessor, } from '../assessors/banner-section-description-visibility.assessor';
|
|
@@ -15,7 +16,7 @@ import { imagesSectionTextStyleVisibilityAssessor } from '../assessors/images-se
|
|
|
15
16
|
import { bannerPlaceholderFieldTypeAssessor, bannerSectionFieldTypeAssessor, bannerSectionRoleTypeAssessor, } from '../assessors/banner-section-field.assessor';
|
|
16
17
|
import { isValidSvgUrl } from '@brand-page/utils';
|
|
17
18
|
import { brandPageOrbrandContactTypeVisibilityAssessor, brandSiteTypeVisibilityAssessor, } from '../assessors/brand-page-type-visibility.assessor';
|
|
18
|
-
import { contentSettingsTr } from '@src/composables/useTranslate';
|
|
19
|
+
import { commonTr, contentSettingsTr } from '@src/composables/useTranslate';
|
|
19
20
|
const MediaFieldNames = {
|
|
20
21
|
aspectRatio: 'aspectRatio',
|
|
21
22
|
iconUrl: 'iconUrl',
|
|
@@ -2807,6 +2808,101 @@ export const BOOKING_SECTION_SETTINGS_CONFIG = () => ({
|
|
|
2807
2808
|
isEnabled: true,
|
|
2808
2809
|
isLocked: false,
|
|
2809
2810
|
});
|
|
2811
|
+
const FAQ_FIELD_GROUP_IDS = {
|
|
2812
|
+
settings: 'settings',
|
|
2813
|
+
items: 'items',
|
|
2814
|
+
style: 'style',
|
|
2815
|
+
};
|
|
2816
|
+
export const FAQ_SECTION_SETTINGS_CONFIG = () => ({
|
|
2817
|
+
type: 'faq-section',
|
|
2818
|
+
category: 'general',
|
|
2819
|
+
createInitialContent: createInitialFaqSectionContent,
|
|
2820
|
+
displayMode: CONTENT_SETTINGS_DISPLAY_MODES.focused,
|
|
2821
|
+
defaultIconName: 'question-circle-filled',
|
|
2822
|
+
displayName: contentSettingsTr(`faqSectionDisplayName`),
|
|
2823
|
+
fieldGroups: [
|
|
2824
|
+
{
|
|
2825
|
+
id: FAQ_FIELD_GROUP_IDS.settings,
|
|
2826
|
+
displayName: contentSettingsTr(`settingsDisplayName`),
|
|
2827
|
+
isCollapsed: false,
|
|
2828
|
+
},
|
|
2829
|
+
{
|
|
2830
|
+
id: FAQ_FIELD_GROUP_IDS.items,
|
|
2831
|
+
displayName: contentSettingsTr(`faqItemsDisplayName`),
|
|
2832
|
+
isCollapsed: false,
|
|
2833
|
+
},
|
|
2834
|
+
{
|
|
2835
|
+
id: FAQ_FIELD_GROUP_IDS.style,
|
|
2836
|
+
displayName: contentSettingsTr(`styleDisplayName`),
|
|
2837
|
+
isCollapsed: true,
|
|
2838
|
+
},
|
|
2839
|
+
],
|
|
2840
|
+
fields: {
|
|
2841
|
+
titleStyle: DEFAULT_TITLE_STYLE_SETTINGS_FILED_WITH_TITLE(),
|
|
2842
|
+
descriptionStyle: DEFAULT_DESCRIPTION_STYLE_FILED(),
|
|
2843
|
+
title: {
|
|
2844
|
+
type: 'text',
|
|
2845
|
+
placeholder: contentSettingsTr(`titlePlaceholder`),
|
|
2846
|
+
title: contentSettingsTr(`titleTitle`),
|
|
2847
|
+
groupId: FAQ_FIELD_GROUP_IDS.settings,
|
|
2848
|
+
maxLength: 200,
|
|
2849
|
+
},
|
|
2850
|
+
description: {
|
|
2851
|
+
type: 'textarea',
|
|
2852
|
+
placeholder: contentSettingsTr(`descriptionPlaceholder`),
|
|
2853
|
+
title: contentSettingsTr(`descriptionTitle`),
|
|
2854
|
+
groupId: FAQ_FIELD_GROUP_IDS.settings,
|
|
2855
|
+
maxLength: 1000,
|
|
2856
|
+
},
|
|
2857
|
+
// FaqItemsField owns the question/answer inputs and the FAQ_MAX_ITEMS cap.
|
|
2858
|
+
items: {
|
|
2859
|
+
type: 'faq-items',
|
|
2860
|
+
defaultValue: [],
|
|
2861
|
+
groupId: FAQ_FIELD_GROUP_IDS.items,
|
|
2862
|
+
},
|
|
2863
|
+
displayStyle: {
|
|
2864
|
+
type: 'radio',
|
|
2865
|
+
role: 'multi',
|
|
2866
|
+
defaultValue: FAQ_DISPLAY_STYLES.centered,
|
|
2867
|
+
title: contentSettingsTr(`displayStyleTitle`),
|
|
2868
|
+
optionsConvertor: faqDisplayStyleConvertor,
|
|
2869
|
+
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
2870
|
+
variant: 'icon',
|
|
2871
|
+
},
|
|
2872
|
+
...PADDING_CONTROL_FIELDS(FAQ_FIELD_GROUP_IDS.style),
|
|
2873
|
+
iconColor: {
|
|
2874
|
+
type: 'color',
|
|
2875
|
+
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
2876
|
+
defaultValue: {},
|
|
2877
|
+
isInline: true,
|
|
2878
|
+
showToggle: false,
|
|
2879
|
+
disableTransparent: true,
|
|
2880
|
+
title: commonTr(`iconColor`),
|
|
2881
|
+
valueConvertor: colorConvertor,
|
|
2882
|
+
},
|
|
2883
|
+
// Transparent allowed on purpose (it hides the line), unlike the Divider section's field.
|
|
2884
|
+
dividerColor: {
|
|
2885
|
+
type: 'color',
|
|
2886
|
+
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
2887
|
+
defaultValue: {},
|
|
2888
|
+
isInline: true,
|
|
2889
|
+
showToggle: false,
|
|
2890
|
+
title: contentSettingsTr(`dividerColorTitle`),
|
|
2891
|
+
valueConvertor: backgroundColorConvertor,
|
|
2892
|
+
},
|
|
2893
|
+
backgroundStyle: {
|
|
2894
|
+
type: 'color',
|
|
2895
|
+
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
2896
|
+
defaultValue: {},
|
|
2897
|
+
isInline: true,
|
|
2898
|
+
showToggle: false,
|
|
2899
|
+
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2900
|
+
valueConvertor: backgroundColorConvertor,
|
|
2901
|
+
},
|
|
2902
|
+
},
|
|
2903
|
+
isEnabled: true,
|
|
2904
|
+
isLocked: false,
|
|
2905
|
+
});
|
|
2810
2906
|
export const CONTENT_SETTINGS_CONFIGS = () => ({
|
|
2811
2907
|
logo: LOGO_SETTINGS_CONFIG(),
|
|
2812
2908
|
'general-link': GENERAL_LINK_CONTENT_SETTINGS_CONFIG(),
|
|
@@ -2840,4 +2936,5 @@ export const CONTENT_SETTINGS_CONFIGS = () => ({
|
|
|
2840
2936
|
'shapes-section': SHAPES_SECTION_SETTINGS_CONFIG(),
|
|
2841
2937
|
'shop-section': SHOP_SECTION_SETTINGS_CONFIG(),
|
|
2842
2938
|
'booking-section': BOOKING_SECTION_SETTINGS_CONFIG(),
|
|
2939
|
+
'faq-section': FAQ_SECTION_SETTINGS_CONFIG(),
|
|
2843
2940
|
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { FAQ_DISPLAY_STYLES } from '@brand-page/constants';
|
|
2
|
+
import { converterTr } from '@src/composables/useTranslate';
|
|
3
|
+
const ICON_VIEW_BOX = '0 0 96 56';
|
|
4
|
+
export const faqDisplayStyleConvertor = {
|
|
5
|
+
convertBackToMultipleValues: true,
|
|
6
|
+
convert(value) {
|
|
7
|
+
return {
|
|
8
|
+
options: [
|
|
9
|
+
{
|
|
10
|
+
title: converterTr(`faqCenteredAccordion`),
|
|
11
|
+
value: FAQ_DISPLAY_STYLES.centered,
|
|
12
|
+
isSelected: value === FAQ_DISPLAY_STYLES.centered,
|
|
13
|
+
iconName: 'display-style-faq-1',
|
|
14
|
+
iconViewBox: ICON_VIEW_BOX,
|
|
15
|
+
dataAttribute: 'data-test-btn-faq-centered',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: converterTr(`faqSplitAccordion`),
|
|
19
|
+
value: FAQ_DISPLAY_STYLES.split,
|
|
20
|
+
isSelected: value === FAQ_DISPLAY_STYLES.split,
|
|
21
|
+
iconName: 'display-style-faq-2',
|
|
22
|
+
iconViewBox: ICON_VIEW_BOX,
|
|
23
|
+
dataAttribute: 'data-test-btn-faq-split',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: converterTr(`faqGrid`),
|
|
27
|
+
value: FAQ_DISPLAY_STYLES.grid,
|
|
28
|
+
isSelected: value === FAQ_DISPLAY_STYLES.grid,
|
|
29
|
+
iconName: 'display-style-faq-3',
|
|
30
|
+
iconViewBox: ICON_VIEW_BOX,
|
|
31
|
+
dataAttribute: 'data-test-btn-faq-grid',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
// The heading sits left beside the accordion in split, centred above it otherwise.
|
|
37
|
+
convertBack(config) {
|
|
38
|
+
const displayStyle = config.options.find((v) => v.isSelected)?.value ??
|
|
39
|
+
FAQ_DISPLAY_STYLES.centered;
|
|
40
|
+
const textAlign = displayStyle === FAQ_DISPLAY_STYLES.split ? 'left' : 'center';
|
|
41
|
+
return {
|
|
42
|
+
displayStyle,
|
|
43
|
+
titleStyle: { textAlign },
|
|
44
|
+
descriptionStyle: { textAlign },
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -52,6 +52,7 @@ export declare const ITEM_FIELD_TYPES: {
|
|
|
52
52
|
readonly 'color-replacements': "color-replacements";
|
|
53
53
|
readonly 'testimonial-items': "testimonial-items";
|
|
54
54
|
readonly 'text-items': "text-items";
|
|
55
|
+
readonly 'faq-items': "faq-items";
|
|
55
56
|
readonly 'page-dropdown': "page-dropdown";
|
|
56
57
|
readonly 'personalisation-override': "personalisation-override";
|
|
57
58
|
};
|
|
@@ -55,6 +55,7 @@ export const ITEM_FIELD_TYPES = {
|
|
|
55
55
|
'color-replacements': 'color-replacements',
|
|
56
56
|
'testimonial-items': 'testimonial-items',
|
|
57
57
|
'text-items': 'text-items',
|
|
58
|
+
'faq-items': 'faq-items',
|
|
58
59
|
'page-dropdown': 'page-dropdown',
|
|
59
60
|
'personalisation-override': 'personalisation-override',
|
|
60
61
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BrandPageModel } from '@brand-page';
|
|
2
|
-
import type { ButtonContent, ContentType, ImageContent, ProfileContent, TextContent, VideoContent, LogoContent, LogoTheme, MapContent, ImageGalleryContent, GeneralLinkContent, MailingListContent, RequestPaymentContent, ContactFormContent, BannerSectionContent, SocialLinksContent, ImagesSectionContent, TestimonialSectionContent, AboutSectionContent, DividerSectionContent, ShapesSectionContent, BrandPageType, SupportMeContent, ShopContent, BookingSectionContent } from '@brand-page';
|
|
2
|
+
import type { ButtonContent, ContentType, ImageContent, ProfileContent, TextContent, VideoContent, LogoContent, LogoTheme, MapContent, ImageGalleryContent, GeneralLinkContent, MailingListContent, RequestPaymentContent, ContactFormContent, BannerSectionContent, SocialLinksContent, ImagesSectionContent, TestimonialSectionContent, AboutSectionContent, DividerSectionContent, ShapesSectionContent, BrandPageType, SupportMeContent, ShopContent, BookingSectionContent, TextStyleDeclaration, FaqSectionContent } from '@brand-page';
|
|
3
3
|
import type { CreateInitialContentFunction } from './content-settings-configs';
|
|
4
4
|
import type { CreateInitialContentOptions } from '@shared/content-settings/models';
|
|
5
5
|
export declare const createInitialButtonContent: (type: ContentType, iconUrl: string, options?: CreateInitialContentOptions) => () => ButtonContent;
|
|
@@ -18,6 +18,9 @@ export declare const createInitialSupportMeContent: (options?: CreateInitialCont
|
|
|
18
18
|
export declare const createInitialContactFormContent: CreateInitialContentFunction<ContactFormContent>;
|
|
19
19
|
export declare const createInitialBannerSectionContent: CreateInitialContentFunction<BannerSectionContent>;
|
|
20
20
|
export declare const createInitialBookingSectionContent: CreateInitialContentFunction<BookingSectionContent>;
|
|
21
|
+
export declare const createInitialFaqQuestionStyle: (applyAutoScale?: boolean) => TextStyleDeclaration;
|
|
22
|
+
export declare const createInitialFaqAnswerStyle: (applyAutoScale?: boolean) => TextStyleDeclaration;
|
|
23
|
+
export declare const createInitialFaqSectionContent: CreateInitialContentFunction<FaqSectionContent>;
|
|
21
24
|
export declare const createInitialImagesSectionContent: CreateInitialContentFunction<ImagesSectionContent>;
|
|
22
25
|
export declare const createInitialTestimonialSectionContent: CreateInitialContentFunction<TestimonialSectionContent>;
|
|
23
26
|
export declare const createInitialAboutSectionContent: CreateInitialContentFunction<AboutSectionContent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BrandPageModel, PageStyles, FORM_FIELD_IDS, PAYMENT_OPTION_DISPLAY_TYPES, PAYMENT_OPTION_IMAGE_TYPES, SOCIAL_LINKS_ICON_DISPLAY_STYLES, PageHeaderMobile, PageHeaderDesktop, PageFooterMobile, PageFooterDesktop, MEDIA_TYPES, BUTTON_LINK_TYPE, DISPLAY_STYLE_PREVIEW, SUPPORT_ME_CUSTOM_PRODUCT_NAME, DEFAULT_LOGO_HEIGHT, DEFAULT_LOGO_WIDTH, FONT_SIZE_BODY, LINE_HEIGHT_BODY, TEXT_STYLE_TYPES, TEXT_COLUMNS, DEFAULT_LOGO_BACKGROUND_COLOR_RGB, DEFAULT_LOGO_TEXT_COLOR_RGB, EMPTY_LOGO_IMAGE_MODEL, BRAND_PAGE_TYPES, SENSITIVE_CONTENT_TYPES, CONTACT_FORM_LAYOUT_DEFAULT_PADDING, TESTIMONIAL_DEFAULT_PADDING, } from '@brand-page';
|
|
1
|
+
import { BrandPageModel, PageStyles, FORM_FIELD_IDS, PAYMENT_OPTION_DISPLAY_TYPES, PAYMENT_OPTION_IMAGE_TYPES, SOCIAL_LINKS_ICON_DISPLAY_STYLES, PageHeaderMobile, PageHeaderDesktop, PageFooterMobile, PageFooterDesktop, MEDIA_TYPES, BUTTON_LINK_TYPE, DISPLAY_STYLE_PREVIEW, SUPPORT_ME_CUSTOM_PRODUCT_NAME, DEFAULT_LOGO_HEIGHT, DEFAULT_LOGO_WIDTH, FONT_SIZE_BODY, LINE_HEIGHT_BODY, TEXT_STYLE_TYPES, TEXT_COLUMNS, DEFAULT_LOGO_BACKGROUND_COLOR_RGB, DEFAULT_LOGO_TEXT_COLOR_RGB, EMPTY_LOGO_IMAGE_MODEL, BRAND_PAGE_TYPES, SENSITIVE_CONTENT_TYPES, CONTACT_FORM_LAYOUT_DEFAULT_PADDING, TESTIMONIAL_DEFAULT_PADDING, FAQ_DISPLAY_STYLES, } from '@brand-page';
|
|
2
2
|
import * as uuid from 'uuid';
|
|
3
3
|
import { getColorShades, DEFAULT_CARD_SURFACE_REFERENCE, } from '@brand-page/utils';
|
|
4
4
|
import { contentSettingsTr } from '@src/composables/useTranslate';
|
|
@@ -556,6 +556,52 @@ export const createInitialBookingSectionContent = (options) => {
|
|
|
556
556
|
},
|
|
557
557
|
};
|
|
558
558
|
};
|
|
559
|
+
// Questions follow the Headings role, answers the Paragraphs role.
|
|
560
|
+
export const createInitialFaqQuestionStyle = (applyAutoScale = false) => ({
|
|
561
|
+
applyAutoScale,
|
|
562
|
+
textStyleType: TEXT_STYLE_TYPES.headings,
|
|
563
|
+
textAlign: 'left',
|
|
564
|
+
});
|
|
565
|
+
export const createInitialFaqAnswerStyle = (applyAutoScale = false) => ({
|
|
566
|
+
applyAutoScale,
|
|
567
|
+
textStyleType: TEXT_STYLE_TYPES.paragraphs,
|
|
568
|
+
textAlign: 'left',
|
|
569
|
+
});
|
|
570
|
+
export const createInitialFaqSectionContent = (options) => {
|
|
571
|
+
const applyAutoScale = options?.brandPageType === BRAND_PAGE_TYPES.brandSite;
|
|
572
|
+
return {
|
|
573
|
+
id: uuid.v4(),
|
|
574
|
+
type: 'faq-section',
|
|
575
|
+
title: contentSettingsTr(`defaultFaqTitle`),
|
|
576
|
+
description: contentSettingsTr(`defaultFaqDescription`),
|
|
577
|
+
displayStyle: FAQ_DISPLAY_STYLES.centered,
|
|
578
|
+
topPadding: 32,
|
|
579
|
+
bottomPadding: 32,
|
|
580
|
+
// One sample item; the design's four are only there to show a longer list.
|
|
581
|
+
items: [
|
|
582
|
+
{
|
|
583
|
+
id: uuid.v4(),
|
|
584
|
+
question: contentSettingsTr(`defaultFaqQuestion`),
|
|
585
|
+
questionStyle: createInitialFaqQuestionStyle(applyAutoScale),
|
|
586
|
+
answer: contentSettingsTr(`defaultFaqAnswer`),
|
|
587
|
+
answerStyle: createInitialFaqAnswerStyle(applyAutoScale),
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
titleStyle: {
|
|
591
|
+
applyAutoScale,
|
|
592
|
+
textStyleType: TEXT_STYLE_TYPES.titles,
|
|
593
|
+
textAlign: 'center',
|
|
594
|
+
},
|
|
595
|
+
descriptionStyle: {
|
|
596
|
+
applyAutoScale,
|
|
597
|
+
textStyleType: TEXT_STYLE_TYPES.paragraphs,
|
|
598
|
+
textAlign: 'center',
|
|
599
|
+
},
|
|
600
|
+
backgroundStyle: {},
|
|
601
|
+
iconColor: { color: '#555555' },
|
|
602
|
+
dividerColor: { backgroundColor: '#dcdcdc' },
|
|
603
|
+
};
|
|
604
|
+
};
|
|
559
605
|
export const createInitialImagesSectionContent = (options) => {
|
|
560
606
|
return {
|
|
561
607
|
id: uuid.v4(),
|
|
@@ -1477,6 +1477,7 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
1477
1477
|
setVideoUrlsWithToken: videoStore.setVideoUrlsWithToken,
|
|
1478
1478
|
isCustomDomain: false,
|
|
1479
1479
|
brandPageSlug: brandPageContainerStore.brandPageSlug,
|
|
1480
|
+
activeItemIdByContentId: useUiContentSettingsStore().activeItemIdByContentId,
|
|
1480
1481
|
});
|
|
1481
1482
|
},
|
|
1482
1483
|
gettyVideoIds() {
|
|
@@ -2,7 +2,8 @@ import { BRAND_PAGE_TYPES } from '@brand-page';
|
|
|
2
2
|
import { FIELD_SLOT_MAP, raisedLayerFor, strategyRoleRefForField, } from '@shared/color-strategies/color-strategies';
|
|
3
3
|
import { isTransparentDisabled, } from '@shared/content-settings/disable-transparent.util';
|
|
4
4
|
import { setRteTextColor } from '@shared/color-strategies/rte-color';
|
|
5
|
-
import {
|
|
5
|
+
import { isTiptapDocument } from '@brand-page-maker/utils/rte-shape';
|
|
6
|
+
import { pairedRteTextField, RTE_ITEM_FIELD_PAIRS, } from '@shared/color-strategies/rte-field-pairs';
|
|
6
7
|
/**
|
|
7
8
|
* Field types a strategy can assign. `color` fields hold nothing but a colour and are
|
|
8
9
|
* REPLACED via their `valueConvertor`; `text-style` fields hold typography *and* a
|
|
@@ -62,6 +63,17 @@ const sectionLayers = (assignable, content, context) => {
|
|
|
62
63
|
surfaceFields.every(([, field]) => !isTransparentDisabled(field.disableTransparent, context?.brandPageType ?? BRAND_PAGE_TYPES.default)),
|
|
63
64
|
};
|
|
64
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* The strategy's text treatment for one text-style field: `color` set, text background
|
|
68
|
+
* cleared (matching the highlight strip in `setRteTextColor` — the toolbar writes both).
|
|
69
|
+
* The key is deleted rather than set undefined so `'backgroundColor' in style` checks
|
|
70
|
+
* downstream stay honest.
|
|
71
|
+
*/
|
|
72
|
+
const withStrategyTextStyle = (current, ref) => {
|
|
73
|
+
const nextStyle = { ...(current ?? {}), color: ref };
|
|
74
|
+
delete nextStyle.backgroundColor;
|
|
75
|
+
return nextStyle;
|
|
76
|
+
};
|
|
65
77
|
/**
|
|
66
78
|
* Build the per-field colour writes a strategy stamps onto a section. Pure — reads the
|
|
67
79
|
* section config + current content and returns a `{ fieldName: value }` partial. Each
|
|
@@ -97,16 +109,7 @@ export const buildColorStrategyValues = (config, content, strategyId, context, a
|
|
|
97
109
|
}
|
|
98
110
|
if (field.type === 'text-style') {
|
|
99
111
|
const current = contentRecord[name];
|
|
100
|
-
|
|
101
|
-
...(current ?? {}),
|
|
102
|
-
color: ref,
|
|
103
|
-
};
|
|
104
|
-
// A strategy owns the text treatment, so it clears the text background colour
|
|
105
|
-
// too — matching the highlight strip in `setRteTextColor` (the toolbar writes
|
|
106
|
-
// both). Delete the key rather than set it undefined so `'backgroundColor' in
|
|
107
|
-
// style` checks downstream stay honest.
|
|
108
|
-
delete nextStyle.backgroundColor;
|
|
109
|
-
values[name] = nextStyle;
|
|
112
|
+
values[name] = withStrategyTextStyle(current, ref);
|
|
110
113
|
// Also stamp the colour into the paired RTE document, if this field drives one.
|
|
111
114
|
// `setRteTextColor` returns undefined for a plain string or legacy HTML RTE, so
|
|
112
115
|
// that doubles as the "nothing to do" test — no separate type guard here.
|
|
@@ -133,6 +136,28 @@ export const buildColorStrategyValues = (config, content, strategyId, context, a
|
|
|
133
136
|
}
|
|
134
137
|
values[name] = field.valueConvertor.convertBack(ref);
|
|
135
138
|
});
|
|
139
|
+
// Item-level RTE fields (each FAQ question) carry their own style and document, so
|
|
140
|
+
// the section's field loop above never sees them. Same two halves, per item, written
|
|
141
|
+
// back as one new list.
|
|
142
|
+
const itemPairs = typeof contentRecord.type === 'string'
|
|
143
|
+
? (RTE_ITEM_FIELD_PAIRS[contentRecord.type] ?? [])
|
|
144
|
+
: [];
|
|
145
|
+
itemPairs.forEach((pair) => {
|
|
146
|
+
const ref = strategyRoleRefForField(strategyId, pair.styleField, content, context, layers, anchors);
|
|
147
|
+
const items = (values[pair.itemsField] ??
|
|
148
|
+
contentRecord[pair.itemsField]);
|
|
149
|
+
if (!ref || !Array.isArray(items)) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
values[pair.itemsField] = items.map((item) => {
|
|
153
|
+
const nextDoc = setRteTextColor(item[pair.textField], ref);
|
|
154
|
+
return {
|
|
155
|
+
...item,
|
|
156
|
+
[pair.styleField]: withStrategyTextStyle(item[pair.styleField], ref),
|
|
157
|
+
...(nextDoc ? { [pair.textField]: nextDoc } : {}),
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
});
|
|
136
161
|
return values;
|
|
137
162
|
};
|
|
138
163
|
/**
|
|
@@ -147,12 +172,15 @@ export const applyColorStrategyToItem = (store, { id, config, content, strategyI
|
|
|
147
172
|
Object.entries(values).forEach(([name, value]) => {
|
|
148
173
|
store.updateItemValue({ id, name, value });
|
|
149
174
|
});
|
|
150
|
-
// A recoloured RTE field is emitted as a whole Tiptap document
|
|
151
|
-
//
|
|
152
|
-
// to re-seed, so signal it just
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
value
|
|
175
|
+
// A recoloured RTE field is emitted as a whole Tiptap document (at the top level,
|
|
176
|
+
// or inside a rewritten item list); the paired style-object writes are plain
|
|
177
|
+
// objects. Only the former needs the live editor to re-seed, so signal it just
|
|
178
|
+
// when a doc was among the writes.
|
|
179
|
+
const replacedRteDoc = Object.values(values).some((value) => isTiptapDocument(value) ||
|
|
180
|
+
(Array.isArray(value) &&
|
|
181
|
+
value.some((item) => typeof item === 'object' &&
|
|
182
|
+
item !== null &&
|
|
183
|
+
Object.values(item).some(isTiptapDocument))));
|
|
156
184
|
if (replacedRteDoc) {
|
|
157
185
|
markRteResync?.();
|
|
158
186
|
}
|
|
@@ -36,6 +36,12 @@ export declare const getPlainTextFromRTE: (content: unknown) => string;
|
|
|
36
36
|
*/
|
|
37
37
|
export declare const getRteTextLength: (value: RichTextValue | null | undefined) => number;
|
|
38
38
|
export declare const replaceTextInRTE: (existingHtml: string, newText: string) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Convert a new list item's plain text to RTE, as adding its section would. Goes through
|
|
41
|
+
* `transformRTEField` (element-first colour), so an item that copied a sibling's
|
|
42
|
+
* strategy-coloured style bakes that colour rather than the linked global one.
|
|
43
|
+
*/
|
|
44
|
+
export declare const switchRteItemFieldsToRTE: (sectionType: string, item: Record<string, unknown>, externalEditor: Editor, uiStyleSettingsStore?: StyleSettingsState) => void;
|
|
39
45
|
export declare const transformToRTE: (uiPageSettingStore: PageSettingsState, externalEditor: Editor, uiStyleSettingsStore?: StyleSettingsState, newContent?: Content, type?: TextStyleType, newStyle?: TextStyleDeclaration) => void;
|
|
40
46
|
export declare const switchAllContentToRTE: (uiPageSettingStore: PageSettingsState, externalEditor: Editor, uiStyleSettingsStore?: StyleSettingsState) => void;
|
|
41
47
|
export declare const getUpdatedHTMLFromEditor: (externalEditor: Editor, contentText: RichTextValue, newContentStyle: TextStyleDeclaration) => string | import("@tiptap/core").DocumentType<Record<string, any> | undefined, import("@tiptap/core").NodeType<string, Record<string, any> | undefined, any, (import("@tiptap/core").NodeType<any, any, any, any> | import("@tiptap/core").TextType<import("@tiptap/core").MarkType<any, any>>)[]>[]>;
|
|
@@ -5,7 +5,7 @@ import { getRenderText } from '@brand-page/utils';
|
|
|
5
5
|
import createDomPurify, {} from 'dompurify';
|
|
6
6
|
import Color from 'color';
|
|
7
7
|
import { isHrefPageId } from '../composables/rich-text-editor/hyperlink';
|
|
8
|
-
import { RTE_SECTION_FIELD_PAIRS, } from '@shared/color-strategies/rte-field-pairs';
|
|
8
|
+
import { RTE_ITEM_FIELD_PAIRS, RTE_SECTION_FIELD_PAIRS, } from '@shared/color-strategies/rte-field-pairs';
|
|
9
9
|
// Re-exported below so every existing caller keeps importing them from here; they
|
|
10
10
|
// live in a leaf module because this one pulls dompurify at runtime.
|
|
11
11
|
import { isTiptapDocument, isRteHtmlString } from './rte-shape';
|
|
@@ -372,6 +372,24 @@ const switchRTEField = (content, pair, externalEditor, uiStyleSettingsStore) =>
|
|
|
372
372
|
fields[pair.textField] = getUpdatedHTMLFromEditor(externalEditor, fields[pair.textField], style);
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
|
+
// Items are visited as their own "content": each item carries the style that drives its
|
|
376
|
+
// text, so the section-field helpers apply unchanged.
|
|
377
|
+
const forEachRteItem = (sectionType, content, visit) => {
|
|
378
|
+
for (const pair of RTE_ITEM_FIELD_PAIRS[sectionType] ?? []) {
|
|
379
|
+
const items = content[pair.itemsField];
|
|
380
|
+
if (Array.isArray(items)) {
|
|
381
|
+
items.forEach((item) => visit(item, pair));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Convert a new list item's plain text to RTE, as adding its section would. Goes through
|
|
387
|
+
* `transformRTEField` (element-first colour), so an item that copied a sibling's
|
|
388
|
+
* strategy-coloured style bakes that colour rather than the linked global one.
|
|
389
|
+
*/
|
|
390
|
+
export const switchRteItemFieldsToRTE = (sectionType, item, externalEditor, uiStyleSettingsStore) => {
|
|
391
|
+
RTE_ITEM_FIELD_PAIRS[sectionType]?.forEach((pair) => transformRTEField(item, pair, externalEditor, uiStyleSettingsStore, item, undefined, undefined));
|
|
392
|
+
};
|
|
375
393
|
export const transformToRTE = (uiPageSettingStore, externalEditor, uiStyleSettingsStore, newContent, type, newStyle) => {
|
|
376
394
|
for (const page of uiPageSettingStore.pages) {
|
|
377
395
|
for (const contentItem of page.contents) {
|
|
@@ -382,6 +400,10 @@ export const transformToRTE = (uiPageSettingStore, externalEditor, uiStyleSettin
|
|
|
382
400
|
transformRTEField(content, pair, externalEditor, uiStyleSettingsStore, newContent, type, newStyle);
|
|
383
401
|
}
|
|
384
402
|
}
|
|
403
|
+
const isNewContent = !!newContent && newContent.id === contentItem.id;
|
|
404
|
+
forEachRteItem(contentItem.type, contentItem.settings.content, (item, pair) => transformRTEField(item, pair, externalEditor, uiStyleSettingsStore,
|
|
405
|
+
// An unlinked item of the section being added bakes its own style.
|
|
406
|
+
isNewContent ? item : undefined, type, newStyle));
|
|
385
407
|
if (contentItem.type === 'text') {
|
|
386
408
|
const textContent = contentItem.settings.content;
|
|
387
409
|
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
@@ -447,6 +469,7 @@ export const switchAllContentToRTE = (uiPageSettingStore, externalEditor, uiStyl
|
|
|
447
469
|
switchRTEField(content, pair, externalEditor, uiStyleSettingsStore);
|
|
448
470
|
}
|
|
449
471
|
}
|
|
472
|
+
forEachRteItem(contentItem.type, contentItem.settings.content, (item, pair) => switchRTEField(item, pair, externalEditor, uiStyleSettingsStore));
|
|
450
473
|
if (contentItem.type === 'text') {
|
|
451
474
|
const textContent = contentItem.settings.content;
|
|
452
475
|
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
@@ -139,6 +139,7 @@ export const validatorDict = {
|
|
|
139
139
|
'color-replacements': dummyValidator,
|
|
140
140
|
'testimonial-items': dummyValidator,
|
|
141
141
|
'text-items': dummyValidator,
|
|
142
|
+
'faq-items': dummyValidator,
|
|
142
143
|
'page-dropdown': dummyValidator,
|
|
143
144
|
shape: dummyValidator,
|
|
144
145
|
'logo-selection': dummyValidator,
|
|
@@ -181,6 +182,7 @@ export const adminValidatorsDict = {
|
|
|
181
182
|
'color-replacements': dummyValidator,
|
|
182
183
|
'testimonial-items': dummyValidator,
|
|
183
184
|
'text-items': dummyValidator,
|
|
185
|
+
'faq-items': dummyValidator,
|
|
184
186
|
'page-dropdown': dummyValidator,
|
|
185
187
|
shape: dummyValidator,
|
|
186
188
|
'logo-selection': dummyValidator,
|