@designcrowd/library.brand-page 6.2.3-ast-faq → 6.2.3
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-BRisMzFY.js → CreatedOnBrandCrowd-de-de-Cn0M-eZ1.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CDDsL9GX.js → CreatedOnBrandCrowd-en-us-DRLMSDZr.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-BkZrEo4j.js → CreatedOnBrandCrowd-es-es-BglTu73U.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-sx_ury7R.js → CreatedOnBrandCrowd-fr-ca-Bj6YZ_el.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-sx_ury7R.js → CreatedOnBrandCrowd-fr-fr-Bj6YZ_el.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-DCWiAfkU.js → CreatedOnBrandCrowd-pt-br-DEoOmQ1F.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-DCWiAfkU.js → CreatedOnBrandCrowd-pt-pt-DEoOmQ1F.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-C1S7f22L.js → CreatedOnDcom-de-de-BZ7gTt4Z.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-DgTlWaXE.js → CreatedOnDcom-en-us-CD6Km5sH.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CxSQJe_V.js → CreatedOnDcom-es-es-CNpZHvEl.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-Bbam2tt6.js → CreatedOnDcom-fr-ca-URS-ydJ1.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-Cb0XDRPL.js → CreatedOnDcom-fr-fr-D2AVeA3H.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-BjdX3-E3.js → CreatedOnDcom-pt-br-C32frnFs.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-BXpbfopB.js → CreatedOnDcom-pt-pt-TDYGjRXS.js} +1 -1
- package/lib/src/brand-page/constants/misc.constants.d.ts +0 -8
- package/lib/src/brand-page/constants/misc.constants.js +0 -7
- package/lib/src/brand-page/constants/styles.constants.d.ts +0 -2
- package/lib/src/brand-page/constants/styles.constants.js +0 -2
- package/lib/src/brand-page/models/content.model.d.ts +0 -1
- package/lib/src/brand-page/models/content.model.js +0 -1
- package/lib/src/brand-page/models/index.d.ts +0 -19
- package/lib/src/brand-page/utils/content-callback-util.d.ts +1 -2
- package/lib/src/brand-page/utils/content-callback-util.js +0 -3
- package/lib/src/brand-page/utils/model.util.d.ts +1 -2
- package/lib/src/brand-page/utils/model.util.js +0 -3
- package/lib/src/brand-page/utils/view-model.util.d.ts +0 -2
- package/lib/src/brand-page/utils/view-model.util.js +0 -24
- package/lib/src/brand-page/view-models.d.ts +2 -9
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +0 -10
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +0 -10
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.d.ts +0 -13
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +30 -64
- package/lib/src/brand-page-maker/constants/config-settings-constant.d.ts +1 -2
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +2 -101
- package/lib/src/brand-page-maker/models/content-settings-configs.d.ts +1 -22
- package/lib/src/brand-page-maker/models/content-settings-configs.js +0 -1
- package/lib/src/brand-page-maker/models/content-settings.d.ts +1 -4
- package/lib/src/brand-page-maker/models/content-settings.js +1 -45
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +0 -1
- package/lib/src/brand-page-maker/utils/apply-color-strategy.js +17 -47
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.d.ts +0 -6
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +1 -24
- package/lib/src/brand-page-maker/validators/field.validator.js +0 -2
- package/lib/src/bundled-translations-BYUfWBT3.js +179 -0
- package/lib/src/bundles/bundled-translations.json +2 -20
- 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 +36 -143
- package/lib/src/css/library.brand-page-brandPage.min.css +36 -143
- package/lib/src/css/library.brand-page-designCom.min.css +36 -143
- package/lib/src/css/library.brand-page-preview.min.css +36 -143
- package/lib/src/index.mjs +158 -159
- package/lib/src/{lib-DwpSAbLZ.js → lib-Dm9AuOJL.js} +26180 -26906
- package/lib/src/metadata-builder/parsers/section-tool-arguments.d.ts +1 -1
- package/lib/src/shared/color-strategies/color-strategies.js +0 -4
- package/lib/src/shared/color-strategies/rte-field-pairs.d.ts +0 -12
- package/lib/src/shared/color-strategies/rte-field-pairs.js +0 -10
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -11
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.d.ts +0 -10
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.d.ts +1 -14
- package/lib/src/shared/content-settings/components/items-field/ItemsField.mixin.js +1 -11
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.d.ts +0 -12
- package/lib/src/shared/content-settings/components/textarea-field/TextareaField.mixin.js +0 -5
- package/lib/src/shared/content-settings/models.d.ts +0 -6
- package/lib/src/shared/content-settings/store/content-settings-store.d.ts +1 -14
- package/lib/src/shared/content-settings/store/content-settings-store.js +2 -24
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +0 -10
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +0 -10
- package/package.json +2 -2
- package/src/brand-page/components/page/PageComponent.vue +0 -2
- package/src/brand-page/constants/misc.constants.ts +0 -12
- package/src/brand-page/constants/styles.constants.ts +0 -2
- package/src/brand-page/models/content.model.ts +0 -1
- package/src/brand-page/models/index.ts +0 -21
- package/src/brand-page/utils/content-callback-util.ts +0 -5
- package/src/brand-page/utils/model.util.ts +0 -7
- package/src/brand-page/utils/view-model.util.test.ts +0 -96
- package/src/brand-page/utils/view-model.util.ts +0 -49
- package/src/brand-page/view-models.ts +1 -12
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +49 -37
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +30 -87
- package/src/brand-page-maker/constants/config-settings-constant.ts +0 -108
- package/src/brand-page-maker/convertors/i18n/converter.json +1 -4
- package/src/brand-page-maker/models/content-settings-configs.ts +0 -24
- package/src/brand-page-maker/models/content-settings.ts +0 -57
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +0 -2
- package/src/brand-page-maker/utils/__snapshots__/apply-color-strategy.golden.test.ts.snap +389 -3557
- package/src/brand-page-maker/utils/apply-color-strategy.test.ts +2 -104
- package/src/brand-page-maker/utils/apply-color-strategy.ts +19 -77
- package/src/brand-page-maker/utils/rich-text-editor.util.test.ts +0 -110
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +0 -66
- package/src/brand-page-maker/validators/field.validator.ts +0 -2
- package/src/bundles/bundled-translations.json +2 -20
- package/src/composables/useTranslate.ts +1 -2
- package/src/metadata-builder/builders/item-id-utils.test.ts +0 -24
- package/src/metadata-builder/parsers/section-tool-arguments.ts +1 -2
- package/src/shared/color-strategies/color-strategies.ts +0 -4
- package/src/shared/color-strategies/rte-field-pairs.ts +0 -23
- package/src/shared/content-settings/components/content-settings/i18n/content-settings.json +1 -17
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.vue +0 -3
- package/src/shared/content-settings/components/items-field/ItemsField.mixin.ts +1 -11
- package/src/shared/content-settings/components/items-field/ItemsField.vue +2 -8
- package/src/shared/content-settings/components/textarea-field/TextareaField.mixin.ts +0 -6
- package/src/shared/content-settings/components/textarea-field/TextareaField.vue +0 -1
- package/src/shared/content-settings/models.ts +0 -7
- package/src/shared/content-settings/store/content-settings-store.test.ts +0 -70
- package/src/shared/content-settings/store/content-settings-store.ts +3 -37
- package/src/shared/ecommerce-settings/util/refreshDuplicatedMetadata.test.ts +0 -19
- package/src/utils/minify-brand-page-metadata.test.ts +0 -35
- package/lib/src/brand-page-maker/convertors/faq-display-style.convertor.d.ts +0 -3
- package/lib/src/brand-page-maker/convertors/faq-display-style.convertor.js +0 -47
- package/lib/src/bundled-translations-DY9YvuL-.js +0 -179
- package/src/brand-page/components/faq-section/FaqSection.test.ts +0 -292
- package/src/brand-page/components/faq-section/FaqSection.vue +0 -299
- package/src/brand-page/components/section-heading/SectionHeading.vue +0 -52
- package/src/brand-page/components/text-wrapper/TextWrapper.test.ts +0 -33
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.test.ts +0 -165
- package/src/brand-page-maker/constants/faq-section-config.test.ts +0 -151
- package/src/brand-page-maker/convertors/faq-display-style.convertor.ts +0 -59
- package/src/metadata-builder/parsers/section-tool-map.test.ts +0 -12
- package/src/shared/content-settings/components/list-items-field/ListItemsField.test.ts +0 -429
- package/src/shared/content-settings/components/list-items-field/ListItemsField.vue +0 -262
|
@@ -24,24 +24,6 @@ export const useExternalRichTextEditor = () => {
|
|
|
24
24
|
externalEditor,
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
28
|
-
* An editor bound to a list item (`itemStyleTarget`) writes its toolbar styles to that
|
|
29
|
-
* item's own style field instead of the section-level `${name}Style`. Returns false when
|
|
30
|
-
* the editor has no item target, so the caller falls through to its section-level write.
|
|
31
|
-
*/
|
|
32
|
-
export const writeListItemStyles = (store, props, value, isHydrationWrite) => {
|
|
33
|
-
if (!props.itemStyleTarget) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
store.updateListItemTextStyles({
|
|
37
|
-
id: props.rawId,
|
|
38
|
-
name: props.name,
|
|
39
|
-
value,
|
|
40
|
-
target: props.itemStyleTarget,
|
|
41
|
-
isHydrationWrite,
|
|
42
|
-
});
|
|
43
|
-
return true;
|
|
44
|
-
};
|
|
45
27
|
export const useRichTextEditor = (model, props, emit, fontSettings, fontStyleDropdownRef,
|
|
46
28
|
// One entry of `textStyleOptions`; `undefined` when the selection is "none".
|
|
47
29
|
selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyleTypeOptions, markedText, isHyperlinkPopupOpen, selectedLinkTypeValue) => {
|
|
@@ -222,21 +204,6 @@ selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyle
|
|
|
222
204
|
});
|
|
223
205
|
}
|
|
224
206
|
});
|
|
225
|
-
// Set while a toolbar command runs. The toolbar has taken focus by then, so
|
|
226
|
-
// `isFocused` alone would tag the command's write as hydration and fold it into
|
|
227
|
-
// the previous undo entry — hidden only when a style write rides along and opens
|
|
228
|
-
// an entry of its own. Synchronous commands only: the spacing sliders dispatch
|
|
229
|
-
// after a debounce and are not covered.
|
|
230
|
-
let isRunningToolbarCommand = false;
|
|
231
|
-
const runAsToolbarCommand = (command) => {
|
|
232
|
-
isRunningToolbarCommand = true;
|
|
233
|
-
try {
|
|
234
|
-
return command();
|
|
235
|
-
}
|
|
236
|
-
finally {
|
|
237
|
-
isRunningToolbarCommand = false;
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
207
|
// Update model when editor content changes. RTE content is stored as Tiptap
|
|
241
208
|
// JSON (BP-5787). getJSON() is already in hand (the editor holds the doc) and
|
|
242
209
|
// is sanitised natively — no getHTML(), no DOMPurify, no extra editor — so
|
|
@@ -250,9 +217,15 @@ selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyle
|
|
|
250
217
|
// field → store chain and arms the history merge at the moment of the
|
|
251
218
|
// store write — arming here at emit time would lapse before the
|
|
252
219
|
// debounce fires. Genuine edits happen while focused and commit
|
|
253
|
-
// normally
|
|
220
|
+
// normally.
|
|
221
|
+
//
|
|
222
|
+
// Known limitation: a programmatic toolbar command run on an editor the
|
|
223
|
+
// user hasn't focused yet would also merge (losing that undo step). Today
|
|
224
|
+
// the RTE only mounts inside an already-open settings drawer and the user
|
|
225
|
+
// focuses it before formatting, so this doesn't occur — revisit if a
|
|
226
|
+
// consumer ever drives toolbar actions on an unfocused editor.
|
|
254
227
|
emit('update:modelValue', sanitizeRteJson(editor.getJSON()), {
|
|
255
|
-
isHydrationWrite: !editor.isFocused
|
|
228
|
+
isHydrationWrite: !editor.isFocused,
|
|
256
229
|
});
|
|
257
230
|
});
|
|
258
231
|
editor.on('selectionUpdate', () => {
|
|
@@ -330,30 +303,26 @@ selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyle
|
|
|
330
303
|
// write lands ~100ms BEFORE the editor's canonical text write-back, and
|
|
331
304
|
// an unflagged write here would open a plain capture burst that
|
|
332
305
|
// swallows the flagged text write into a phantom entry (BP-5810).
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
value: syncedStyles,
|
|
354
|
-
isHydrationWrite,
|
|
355
|
-
});
|
|
356
|
-
}
|
|
306
|
+
contentSettingStore.updateTextStyles({
|
|
307
|
+
id: props.rawId,
|
|
308
|
+
name: props.name,
|
|
309
|
+
value: {
|
|
310
|
+
fontSize: globalStyles.fontSize,
|
|
311
|
+
fontFamily: globalStyles.fontFamily,
|
|
312
|
+
fontWeight: globalStyles.fontWeight,
|
|
313
|
+
fontStyle: globalStyles.fontStyle,
|
|
314
|
+
textDecoration: globalStyles.textDecoration,
|
|
315
|
+
// Keep an element colour override (a creation-time contrast bake, or a
|
|
316
|
+
// colour picked while linked) — only fall back to the global style's colour
|
|
317
|
+
// when the element has none, mirroring `resolveTextColor`'s element-first
|
|
318
|
+
// cascade. Blindly taking `globalStyles.color` here re-derived the linked
|
|
319
|
+
// colour on every RTE mount and clobbered the override.
|
|
320
|
+
color: props.styles?.color || globalStyles.color,
|
|
321
|
+
lineHeight: globalStyles.lineHeight,
|
|
322
|
+
letterSpacing: globalStyles.letterSpacing,
|
|
323
|
+
},
|
|
324
|
+
isHydrationWrite: !editor.isFocused,
|
|
325
|
+
});
|
|
357
326
|
// sync toolbar editor styles
|
|
358
327
|
fontSettings.selectedFont = globalStyles?.fontFamily ?? 'Lato';
|
|
359
328
|
fontSettings.selectedFontSize = globalStyles?.fontSize ?? '2.25em';
|
|
@@ -507,9 +476,6 @@ selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyle
|
|
|
507
476
|
syncContentSettings(fontStyleChanges);
|
|
508
477
|
};
|
|
509
478
|
const syncContentSettings = (fontStyleChanges) => {
|
|
510
|
-
if (writeListItemStyles(contentSettingStore, props, fontStyleChanges)) {
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
479
|
if (props.name === 'textItems') {
|
|
514
480
|
contentSettingStore.updateTextItemTextStyleTypeWithStyles({
|
|
515
481
|
id: props.rawId,
|
|
@@ -618,7 +584,7 @@ selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyle
|
|
|
618
584
|
editor,
|
|
619
585
|
onFocus,
|
|
620
586
|
onBlur,
|
|
621
|
-
triggerEditorStyleChange
|
|
587
|
+
triggerEditorStyleChange,
|
|
622
588
|
toggleBold,
|
|
623
589
|
toggleItalic,
|
|
624
590
|
toggleUnderline,
|
|
@@ -635,7 +601,7 @@ selectedGlobalTextStyles, onSelectTextStyleType, updateRichTextEditor, textStyle
|
|
|
635
601
|
setInitialStyleSettings,
|
|
636
602
|
copyGlobalStyleSettings,
|
|
637
603
|
unsetAllMarks,
|
|
638
|
-
handleHyperlink
|
|
604
|
+
handleHyperlink,
|
|
639
605
|
hyperlinkValue,
|
|
640
606
|
setHyperlinkUrlValue,
|
|
641
607
|
shouldShow,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LogoContent, FacebookContent, GeneralLinkContent, PhoneContent, EmailContent, ImageContent, InstagramContent, LinkedInContent, PinterestContent, ProfileContent, TextContent, TiktokContent, TwitchContent, XContent, VideoContent, WebsiteContent, YoutubeContent, ContentType, MapContent, ImageGalleryContent, MailingListContent, RequestPaymentContent, SupportMeContent, ContactFormContent, BannerSectionContent, SocialLinksContent, ImagesSectionContent, TestimonialSectionContent, AboutSectionContent, DividerSectionContent, ShapesSectionContent, ShopContent, BookingSectionContent
|
|
1
|
+
import type { LogoContent, FacebookContent, GeneralLinkContent, PhoneContent, EmailContent, ImageContent, InstagramContent, LinkedInContent, PinterestContent, ProfileContent, TextContent, TiktokContent, TwitchContent, XContent, VideoContent, WebsiteContent, YoutubeContent, ContentType, MapContent, ImageGalleryContent, MailingListContent, RequestPaymentContent, SupportMeContent, ContactFormContent, BannerSectionContent, SocialLinksContent, ImagesSectionContent, TestimonialSectionContent, AboutSectionContent, DividerSectionContent, ShapesSectionContent, ShopContent, BookingSectionContent } from '@brand-page';
|
|
2
2
|
import type { ContentSettingsConfig, ContentSettingsField, ContentSettingsMultiField } from '../models';
|
|
3
3
|
export declare const LOGO_SETTINGS_CONFIG: () => ContentSettingsConfig<Omit<LogoContent, "version" | "logoVariation" | "logoImageHeight" | "logoImageWidth" | "logoLastUpdate" | "logoImageBase64Url">>;
|
|
4
4
|
export declare const GENERAL_LINK_CONTENT_SETTINGS_CONFIG: () => ContentSettingsConfig<GeneralLinkContent>;
|
|
@@ -51,5 +51,4 @@ export declare const SHOP_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfig<S
|
|
|
51
51
|
isShippingEnabled: boolean;
|
|
52
52
|
}>;
|
|
53
53
|
export declare const BOOKING_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfig<BookingSectionContent>;
|
|
54
|
-
export declare const FAQ_SECTION_SETTINGS_CONFIG: () => ContentSettingsConfig<FaqSectionContent>;
|
|
55
54
|
export declare const CONTENT_SETTINGS_CONFIGS: () => Record<ContentType, ContentSettingsConfig<any>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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,
|
|
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';
|
|
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,7 +8,6 @@ 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';
|
|
12
11
|
import { pageValidator, urlValidator } from '../validators';
|
|
13
12
|
import { imagesSectionAspectRatioVisibilityAssessor } from '../assessors/images-section-aspect-ratio-visibility.assessor';
|
|
14
13
|
import { bannerLinkTypeVisibilityAssessor, bannerSectionPageVisibilityAssessor, bannerSectionUrlVisibilityAssessor, bannerDisplayTypeVisibilityAssessor, bannerOverlayOptionsVisibilityAssessor, } from '../assessors/banner-section-description-visibility.assessor';
|
|
@@ -2808,103 +2807,6 @@ export const BOOKING_SECTION_SETTINGS_CONFIG = () => ({
|
|
|
2808
2807
|
isEnabled: true,
|
|
2809
2808
|
isLocked: false,
|
|
2810
2809
|
});
|
|
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
|
-
items: {
|
|
2858
|
-
type: 'list-items',
|
|
2859
|
-
defaultValue: [],
|
|
2860
|
-
groupId: FAQ_FIELD_GROUP_IDS.items,
|
|
2861
|
-
maxLength: FAQ_MAX_ITEMS,
|
|
2862
|
-
itemFields: [
|
|
2863
|
-
{
|
|
2864
|
-
key: 'question',
|
|
2865
|
-
kind: 'text',
|
|
2866
|
-
styleKey: 'questionStyle',
|
|
2867
|
-
defaultStyle: () => createInitialFaqQuestionStyle(),
|
|
2868
|
-
maxLength: 200,
|
|
2869
|
-
title: contentSettingsTr(`faqQuestionTitle`),
|
|
2870
|
-
placeholder: contentSettingsTr(`faqQuestionPlaceholder`),
|
|
2871
|
-
defaultValue: () => contentSettingsTr(`faqNewQuestion`),
|
|
2872
|
-
},
|
|
2873
|
-
{
|
|
2874
|
-
key: 'answer',
|
|
2875
|
-
kind: 'textarea',
|
|
2876
|
-
styleKey: 'answerStyle',
|
|
2877
|
-
defaultStyle: () => createInitialFaqAnswerStyle(),
|
|
2878
|
-
maxLength: 1000,
|
|
2879
|
-
title: contentSettingsTr(`faqAnswerTitle`),
|
|
2880
|
-
placeholder: contentSettingsTr(`faqAnswerPlaceholder`),
|
|
2881
|
-
defaultValue: () => contentSettingsTr(`faqNewAnswer`),
|
|
2882
|
-
},
|
|
2883
|
-
],
|
|
2884
|
-
},
|
|
2885
|
-
displayStyle: {
|
|
2886
|
-
type: 'radio',
|
|
2887
|
-
role: 'multi',
|
|
2888
|
-
defaultValue: FAQ_DISPLAY_STYLES.centered,
|
|
2889
|
-
title: contentSettingsTr(`displayStyleTitle`),
|
|
2890
|
-
optionsConvertor: faqDisplayStyleConvertor,
|
|
2891
|
-
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
2892
|
-
variant: 'icon',
|
|
2893
|
-
},
|
|
2894
|
-
...PADDING_CONTROL_FIELDS(FAQ_FIELD_GROUP_IDS.style),
|
|
2895
|
-
backgroundStyle: {
|
|
2896
|
-
type: 'color',
|
|
2897
|
-
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
2898
|
-
defaultValue: {},
|
|
2899
|
-
isInline: true,
|
|
2900
|
-
showToggle: false,
|
|
2901
|
-
title: contentSettingsTr(`backgroundColorTitle`),
|
|
2902
|
-
valueConvertor: backgroundColorConvertor,
|
|
2903
|
-
},
|
|
2904
|
-
},
|
|
2905
|
-
isEnabled: true,
|
|
2906
|
-
isLocked: false,
|
|
2907
|
-
});
|
|
2908
2810
|
export const CONTENT_SETTINGS_CONFIGS = () => ({
|
|
2909
2811
|
logo: LOGO_SETTINGS_CONFIG(),
|
|
2910
2812
|
'general-link': GENERAL_LINK_CONTENT_SETTINGS_CONFIG(),
|
|
@@ -2938,5 +2840,4 @@ export const CONTENT_SETTINGS_CONFIGS = () => ({
|
|
|
2938
2840
|
'shapes-section': SHAPES_SECTION_SETTINGS_CONFIG(),
|
|
2939
2841
|
'shop-section': SHOP_SECTION_SETTINGS_CONFIG(),
|
|
2940
2842
|
'booking-section': BOOKING_SECTION_SETTINGS_CONFIG(),
|
|
2941
|
-
'faq-section': FAQ_SECTION_SETTINGS_CONFIG(),
|
|
2942
2843
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BrandPageContext, BrandPageType, Content, ContentType
|
|
1
|
+
import type { BrandPageContext, BrandPageType, Content, ContentType } from '@brand-page';
|
|
2
2
|
import type { ContentReplaceImageSettings } from '@shared/content-settings/models';
|
|
3
3
|
import type { UIUserFeatures } from '@src/constants/ui';
|
|
4
4
|
import type { OptionsConvertor, ValueConvertor } from './convertor.model';
|
|
@@ -52,7 +52,6 @@ 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 'list-items': "list-items";
|
|
56
55
|
readonly 'page-dropdown': "page-dropdown";
|
|
57
56
|
readonly 'personalisation-override': "personalisation-override";
|
|
58
57
|
};
|
|
@@ -105,26 +104,6 @@ export interface ContentSettingsField<TContent> {
|
|
|
105
104
|
* Defaults to `${fieldName}Style` when not specified.
|
|
106
105
|
*/
|
|
107
106
|
styleName?: string;
|
|
108
|
-
/** `list-items` only: the per-item inputs, in order. The first `text` input labels the row. */
|
|
109
|
-
itemFields?: ListItemFieldSchema[];
|
|
110
|
-
}
|
|
111
|
-
export interface ListItemFieldSchema {
|
|
112
|
-
key: string;
|
|
113
|
-
/** The plain input used when the rich-text editor is unavailable. */
|
|
114
|
-
kind: 'text' | 'textarea';
|
|
115
|
-
title: string;
|
|
116
|
-
placeholder?: string;
|
|
117
|
-
maxLength?: number;
|
|
118
|
-
/**
|
|
119
|
-
* The item field that holds this text's style. Set it to make the text rich text —
|
|
120
|
-
* the same editor as a section title, writing this item's own style — whenever the
|
|
121
|
-
* section allows rich text. Without rich text, a font-style control edits it instead.
|
|
122
|
-
*/
|
|
123
|
-
styleKey?: string;
|
|
124
|
-
/** Style a first item starts with; later items copy the last item's style. */
|
|
125
|
-
defaultStyle?: () => TextStyleDeclaration;
|
|
126
|
-
/** Value a newly added item starts with. */
|
|
127
|
-
defaultValue?: () => string;
|
|
128
107
|
}
|
|
129
108
|
export interface ContentSettingsMultiField<TContent, TField> extends Omit<ContentSettingsField<TContent>, 'type' | 'role'> {
|
|
130
109
|
type: ItemMultiFieldType;
|
|
@@ -55,7 +55,6 @@ export const ITEM_FIELD_TYPES = {
|
|
|
55
55
|
'color-replacements': 'color-replacements',
|
|
56
56
|
'testimonial-items': 'testimonial-items',
|
|
57
57
|
'text-items': 'text-items',
|
|
58
|
-
'list-items': 'list-items',
|
|
59
58
|
'page-dropdown': 'page-dropdown',
|
|
60
59
|
'personalisation-override': 'personalisation-override',
|
|
61
60
|
};
|
|
@@ -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
|
|
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';
|
|
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,9 +18,6 @@ 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>;
|
|
24
21
|
export declare const createInitialImagesSectionContent: CreateInitialContentFunction<ImagesSectionContent>;
|
|
25
22
|
export declare const createInitialTestimonialSectionContent: CreateInitialContentFunction<TestimonialSectionContent>;
|
|
26
23
|
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,
|
|
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';
|
|
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,50 +556,6 @@ 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
|
-
};
|
|
602
|
-
};
|
|
603
559
|
export const createInitialImagesSectionContent = (options) => {
|
|
604
560
|
return {
|
|
605
561
|
id: uuid.v4(),
|
|
@@ -1477,7 +1477,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
1477
1477
|
setVideoUrlsWithToken: videoStore.setVideoUrlsWithToken,
|
|
1478
1478
|
isCustomDomain: false,
|
|
1479
1479
|
brandPageSlug: brandPageContainerStore.brandPageSlug,
|
|
1480
|
-
activeItemIdByContentId: useUiContentSettingsStore().activeItemIdByContentId,
|
|
1481
1480
|
});
|
|
1482
1481
|
},
|
|
1483
1482
|
gettyVideoIds() {
|
|
@@ -2,7 +2,7 @@ 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 { pairedRteTextField
|
|
5
|
+
import { pairedRteTextField } from '@shared/color-strategies/rte-field-pairs';
|
|
6
6
|
/**
|
|
7
7
|
* Field types a strategy can assign. `color` fields hold nothing but a colour and are
|
|
8
8
|
* REPLACED via their `valueConvertor`; `text-style` fields hold typography *and* a
|
|
@@ -62,17 +62,6 @@ const sectionLayers = (assignable, content, context) => {
|
|
|
62
62
|
surfaceFields.every(([, field]) => !isTransparentDisabled(field.disableTransparent, context?.brandPageType ?? BRAND_PAGE_TYPES.default)),
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
66
|
-
* The strategy's text treatment for one text-style field: `color` set, text background
|
|
67
|
-
* cleared (matching the highlight strip in `setRteTextColor` — the toolbar writes both).
|
|
68
|
-
* The key is deleted rather than set undefined so `'backgroundColor' in style` checks
|
|
69
|
-
* downstream stay honest.
|
|
70
|
-
*/
|
|
71
|
-
const withStrategyTextStyle = (current, ref) => {
|
|
72
|
-
const nextStyle = { ...(current ?? {}), color: ref };
|
|
73
|
-
delete nextStyle.backgroundColor;
|
|
74
|
-
return nextStyle;
|
|
75
|
-
};
|
|
76
65
|
/**
|
|
77
66
|
* Build the per-field colour writes a strategy stamps onto a section. Pure — reads the
|
|
78
67
|
* section config + current content and returns a `{ fieldName: value }` partial. Each
|
|
@@ -108,7 +97,16 @@ export const buildColorStrategyValues = (config, content, strategyId, context, a
|
|
|
108
97
|
}
|
|
109
98
|
if (field.type === 'text-style') {
|
|
110
99
|
const current = contentRecord[name];
|
|
111
|
-
|
|
100
|
+
const nextStyle = {
|
|
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
110
|
// Also stamp the colour into the paired RTE document, if this field drives one.
|
|
113
111
|
// `setRteTextColor` returns undefined for a plain string or legacy HTML RTE, so
|
|
114
112
|
// that doubles as the "nothing to do" test — no separate type guard here.
|
|
@@ -135,33 +133,8 @@ export const buildColorStrategyValues = (config, content, strategyId, context, a
|
|
|
135
133
|
}
|
|
136
134
|
values[name] = field.valueConvertor.convertBack(ref);
|
|
137
135
|
});
|
|
138
|
-
// Item-level RTE fields (each FAQ question) carry their own style and document, so
|
|
139
|
-
// the section's field loop above never sees them. Same two halves, per item, written
|
|
140
|
-
// back as one new list.
|
|
141
|
-
const itemPairs = typeof contentRecord.type === 'string'
|
|
142
|
-
? (RTE_ITEM_FIELD_PAIRS[contentRecord.type] ?? [])
|
|
143
|
-
: [];
|
|
144
|
-
itemPairs.forEach((pair) => {
|
|
145
|
-
const ref = strategyRoleRefForField(strategyId, pair.styleField, content, context, layers, anchors);
|
|
146
|
-
const items = (values[pair.itemsField] ??
|
|
147
|
-
contentRecord[pair.itemsField]);
|
|
148
|
-
if (!ref || !Array.isArray(items)) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
values[pair.itemsField] = items.map((item) => {
|
|
152
|
-
const nextDoc = setRteTextColor(item[pair.textField], ref);
|
|
153
|
-
return {
|
|
154
|
-
...item,
|
|
155
|
-
[pair.styleField]: withStrategyTextStyle(item[pair.styleField], ref),
|
|
156
|
-
...(nextDoc ? { [pair.textField]: nextDoc } : {}),
|
|
157
|
-
};
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
136
|
return values;
|
|
161
137
|
};
|
|
162
|
-
const isRteDoc = (value) => typeof value === 'object' &&
|
|
163
|
-
value !== null &&
|
|
164
|
-
value.type === 'doc';
|
|
165
138
|
/**
|
|
166
139
|
* Apply a strategy to one content item. Shared by both settings surfaces — the focused
|
|
167
140
|
* section panel and the inline list item (divider) — so the write semantics can't drift.
|
|
@@ -174,15 +147,12 @@ export const applyColorStrategyToItem = (store, { id, config, content, strategyI
|
|
|
174
147
|
Object.entries(values).forEach(([name, value]) => {
|
|
175
148
|
store.updateItemValue({ id, name, value });
|
|
176
149
|
});
|
|
177
|
-
// A recoloured RTE field is emitted as a whole Tiptap document
|
|
178
|
-
//
|
|
179
|
-
//
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
value.some((item) => typeof item === 'object' &&
|
|
184
|
-
item !== null &&
|
|
185
|
-
Object.values(item).some(isRteDoc))));
|
|
150
|
+
// A recoloured RTE field is emitted as a whole Tiptap document; the paired
|
|
151
|
+
// style-object writes are plain objects. Only the former needs the live editor
|
|
152
|
+
// to re-seed, so signal it just when a doc was among the writes.
|
|
153
|
+
const replacedRteDoc = Object.values(values).some((value) => typeof value === 'object' &&
|
|
154
|
+
value !== null &&
|
|
155
|
+
value.type === 'doc');
|
|
186
156
|
if (replacedRteDoc) {
|
|
187
157
|
markRteResync?.();
|
|
188
158
|
}
|
|
@@ -36,12 +36,6 @@ 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;
|
|
45
39
|
export declare const transformToRTE: (uiPageSettingStore: PageSettingsState, externalEditor: Editor, uiStyleSettingsStore?: StyleSettingsState, newContent?: Content, type?: TextStyleType, newStyle?: TextStyleDeclaration) => void;
|
|
46
40
|
export declare const switchAllContentToRTE: (uiPageSettingStore: PageSettingsState, externalEditor: Editor, uiStyleSettingsStore?: StyleSettingsState) => void;
|
|
47
41
|
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 {
|
|
8
|
+
import { 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,24 +372,6 @@ 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
|
-
};
|
|
393
375
|
export const transformToRTE = (uiPageSettingStore, externalEditor, uiStyleSettingsStore, newContent, type, newStyle) => {
|
|
394
376
|
for (const page of uiPageSettingStore.pages) {
|
|
395
377
|
for (const contentItem of page.contents) {
|
|
@@ -400,10 +382,6 @@ export const transformToRTE = (uiPageSettingStore, externalEditor, uiStyleSettin
|
|
|
400
382
|
transformRTEField(content, pair, externalEditor, uiStyleSettingsStore, newContent, type, newStyle);
|
|
401
383
|
}
|
|
402
384
|
}
|
|
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));
|
|
407
385
|
if (contentItem.type === 'text') {
|
|
408
386
|
const textContent = contentItem.settings.content;
|
|
409
387
|
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
@@ -469,7 +447,6 @@ export const switchAllContentToRTE = (uiPageSettingStore, externalEditor, uiStyl
|
|
|
469
447
|
switchRTEField(content, pair, externalEditor, uiStyleSettingsStore);
|
|
470
448
|
}
|
|
471
449
|
}
|
|
472
|
-
forEachRteItem(contentItem.type, contentItem.settings.content, (item, pair) => switchRTEField(item, pair, externalEditor, uiStyleSettingsStore));
|
|
473
450
|
if (contentItem.type === 'text') {
|
|
474
451
|
const textContent = contentItem.settings.content;
|
|
475
452
|
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
@@ -139,7 +139,6 @@ export const validatorDict = {
|
|
|
139
139
|
'color-replacements': dummyValidator,
|
|
140
140
|
'testimonial-items': dummyValidator,
|
|
141
141
|
'text-items': dummyValidator,
|
|
142
|
-
'list-items': dummyValidator,
|
|
143
142
|
'page-dropdown': dummyValidator,
|
|
144
143
|
shape: dummyValidator,
|
|
145
144
|
'logo-selection': dummyValidator,
|
|
@@ -182,7 +181,6 @@ export const adminValidatorsDict = {
|
|
|
182
181
|
'color-replacements': dummyValidator,
|
|
183
182
|
'testimonial-items': dummyValidator,
|
|
184
183
|
'text-items': dummyValidator,
|
|
185
|
-
'list-items': dummyValidator,
|
|
186
184
|
'page-dropdown': dummyValidator,
|
|
187
185
|
shape: dummyValidator,
|
|
188
186
|
'logo-selection': dummyValidator,
|