@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
|
@@ -394,11 +394,7 @@ import {
|
|
|
394
394
|
} from '@designcrowd/fe-shared-lib';
|
|
395
395
|
import { EditorContent } from '@tiptap/vue-3';
|
|
396
396
|
import { BubbleMenu } from '@tiptap/vue-3/menus';
|
|
397
|
-
import {
|
|
398
|
-
useRichTextEditor,
|
|
399
|
-
writeListItemStyles,
|
|
400
|
-
} from '../../composables/rich-text-editor/useRichTextEditor';
|
|
401
|
-
import type { RteItemStyleTarget } from '@shared/content-settings/models';
|
|
397
|
+
import { useRichTextEditor } from '../../composables/rich-text-editor/useRichTextEditor';
|
|
402
398
|
import FontPicker from '@shared/font-family-selector/FontPicker.vue';
|
|
403
399
|
import ColorField from '@shared/content-settings/components/color-field/ColorField.vue';
|
|
404
400
|
import UrlField from '@shared/content-settings/components/url-field/UrlField.vue';
|
|
@@ -464,8 +460,6 @@ const props = withDefaults(
|
|
|
464
460
|
textItemIndex: number;
|
|
465
461
|
item: TextItem;
|
|
466
462
|
contentType: string;
|
|
467
|
-
/** Edit a list item's text: toolbar styles go to that item's own style field. */
|
|
468
|
-
itemStyleTarget?: RteItemStyleTarget;
|
|
469
463
|
}>(),
|
|
470
464
|
{
|
|
471
465
|
id: '',
|
|
@@ -478,7 +472,6 @@ const props = withDefaults(
|
|
|
478
472
|
textStyleName: '',
|
|
479
473
|
styles: () => ({}),
|
|
480
474
|
rawId: '',
|
|
481
|
-
itemStyleTarget: undefined,
|
|
482
475
|
},
|
|
483
476
|
);
|
|
484
477
|
|
|
@@ -609,29 +602,6 @@ const isAddLinkButtonDisabled = computed(() => {
|
|
|
609
602
|
);
|
|
610
603
|
});
|
|
611
604
|
|
|
612
|
-
// Where this editor's role/colour writes land: the list item it edits, a Text block
|
|
613
|
-
// item, or the section's own `${name}Style`.
|
|
614
|
-
const writeStyles = (value: TextStyleDeclaration): void => {
|
|
615
|
-
if (writeListItemStyles(contentSettingStore, props, value)) {
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
if (props.name === 'textItems') {
|
|
620
|
-
contentSettingStore.updateTextItemTextStyleTypeWithStyles({
|
|
621
|
-
id: props.rawId,
|
|
622
|
-
name: props.name,
|
|
623
|
-
value,
|
|
624
|
-
index: props.textItemIndex,
|
|
625
|
-
});
|
|
626
|
-
} else {
|
|
627
|
-
contentSettingStore.updateTextStyles({
|
|
628
|
-
id: props.rawId,
|
|
629
|
-
name: props.name,
|
|
630
|
-
value,
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
|
|
635
605
|
// Keeps a text ITEM's own style in step with the global text style it links to.
|
|
636
606
|
watch(
|
|
637
607
|
() =>
|
|
@@ -671,7 +641,20 @@ watch(
|
|
|
671
641
|
backgroundColor: undefined,
|
|
672
642
|
};
|
|
673
643
|
|
|
674
|
-
|
|
644
|
+
if (props.name === 'textItems') {
|
|
645
|
+
contentSettingStore.updateTextItemTextStyleTypeWithStyles({
|
|
646
|
+
id: props.rawId,
|
|
647
|
+
name: props.name,
|
|
648
|
+
value,
|
|
649
|
+
index: props.textItemIndex,
|
|
650
|
+
});
|
|
651
|
+
} else {
|
|
652
|
+
contentSettingStore.updateTextStyles({
|
|
653
|
+
id: props.rawId,
|
|
654
|
+
name: props.name,
|
|
655
|
+
value,
|
|
656
|
+
});
|
|
657
|
+
}
|
|
675
658
|
}
|
|
676
659
|
} else {
|
|
677
660
|
// make sure text style options are updated and selected Global style is set to none
|
|
@@ -702,10 +685,26 @@ const onSelectTextStyleType = (option: ButtonGroupOption) => {
|
|
|
702
685
|
if (optionSelected) {
|
|
703
686
|
selectedGlobalTextStyles.value = item.value;
|
|
704
687
|
if (option.value === undefined) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
688
|
+
if (props.name === 'textItems') {
|
|
689
|
+
contentSettingStore.updateTextItemTextStyleTypeWithStyles({
|
|
690
|
+
id: props.rawId,
|
|
691
|
+
name: props.name,
|
|
692
|
+
value: {
|
|
693
|
+
textStyleType: undefined,
|
|
694
|
+
fontSize: fontSettings.selectedFontSize,
|
|
695
|
+
},
|
|
696
|
+
index: props.textItemIndex,
|
|
697
|
+
});
|
|
698
|
+
} else {
|
|
699
|
+
contentSettingStore.updateTextStyles({
|
|
700
|
+
id: props.rawId,
|
|
701
|
+
name: props.name,
|
|
702
|
+
value: {
|
|
703
|
+
textStyleType: undefined,
|
|
704
|
+
fontSize: fontSettings.selectedFontSize,
|
|
705
|
+
},
|
|
706
|
+
});
|
|
707
|
+
}
|
|
709
708
|
} else {
|
|
710
709
|
const selectedStyle: BrandPageCssStyle =
|
|
711
710
|
styleSettingsStore.textStyles.textStyleOptions[
|
|
@@ -724,7 +723,20 @@ const onSelectTextStyleType = (option: ButtonGroupOption) => {
|
|
|
724
723
|
backgroundColor: undefined,
|
|
725
724
|
};
|
|
726
725
|
|
|
727
|
-
|
|
726
|
+
if (props.name === 'textItems') {
|
|
727
|
+
contentSettingStore.updateTextItemTextStyleTypeWithStyles({
|
|
728
|
+
id: props.rawId,
|
|
729
|
+
name: props.name,
|
|
730
|
+
value,
|
|
731
|
+
index: props.textItemIndex,
|
|
732
|
+
});
|
|
733
|
+
} else {
|
|
734
|
+
contentSettingStore.updateTextStyles({
|
|
735
|
+
id: props.rawId,
|
|
736
|
+
name: props.name,
|
|
737
|
+
value,
|
|
738
|
+
});
|
|
739
|
+
}
|
|
728
740
|
}
|
|
729
741
|
item.isSelected = true;
|
|
730
742
|
} else {
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
import type { ButtonGroupOption } from '@brand-page-maker/models/button-group.model';
|
|
33
33
|
import { letterSpacingValueConvertor } from '@brand-page-maker/convertors';
|
|
34
34
|
import { useUiContentSettingsStore } from '@shared/content-settings/store';
|
|
35
|
-
import type { RteItemStyleTarget } from '@shared/content-settings/models';
|
|
36
35
|
import { useHistoryStore } from '@brand-page-maker/stores/history/history-store';
|
|
37
36
|
import { AllSelection } from 'prosemirror-state';
|
|
38
37
|
import { useHyperlink } from './hyperlink';
|
|
@@ -114,32 +113,6 @@ export const useExternalRichTextEditor = (): {
|
|
|
114
113
|
};
|
|
115
114
|
};
|
|
116
115
|
|
|
117
|
-
/**
|
|
118
|
-
* An editor bound to a list item (`itemStyleTarget`) writes its toolbar styles to that
|
|
119
|
-
* item's own style field instead of the section-level `${name}Style`. Returns false when
|
|
120
|
-
* the editor has no item target, so the caller falls through to its section-level write.
|
|
121
|
-
*/
|
|
122
|
-
export const writeListItemStyles = (
|
|
123
|
-
store: ReturnType<typeof useUiContentSettingsStore>,
|
|
124
|
-
props: { rawId: string; name: string; itemStyleTarget?: RteItemStyleTarget },
|
|
125
|
-
value: TextStyleDeclaration,
|
|
126
|
-
isHydrationWrite?: boolean,
|
|
127
|
-
): boolean => {
|
|
128
|
-
if (!props.itemStyleTarget) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
store.updateListItemTextStyles({
|
|
133
|
-
id: props.rawId,
|
|
134
|
-
name: props.name,
|
|
135
|
-
value,
|
|
136
|
-
target: props.itemStyleTarget,
|
|
137
|
-
isHydrationWrite,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
return true;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
116
|
export const useRichTextEditor = (
|
|
144
117
|
model: ModelRef<any>,
|
|
145
118
|
props: {
|
|
@@ -153,7 +126,6 @@ export const useRichTextEditor = (
|
|
|
153
126
|
textItemIndex: number;
|
|
154
127
|
item: TextItem;
|
|
155
128
|
contentType: string;
|
|
156
|
-
itemStyleTarget?: RteItemStyleTarget;
|
|
157
129
|
},
|
|
158
130
|
emit: (event: 'focus' | 'blur' | 'update:modelValue', ...args: any[]) => void,
|
|
159
131
|
fontSettings: {
|
|
@@ -454,23 +426,6 @@ export const useRichTextEditor = (
|
|
|
454
426
|
}
|
|
455
427
|
});
|
|
456
428
|
|
|
457
|
-
// Set while a toolbar command runs. The toolbar has taken focus by then, so
|
|
458
|
-
// `isFocused` alone would tag the command's write as hydration and fold it into
|
|
459
|
-
// the previous undo entry — hidden only when a style write rides along and opens
|
|
460
|
-
// an entry of its own. Synchronous commands only: the spacing sliders dispatch
|
|
461
|
-
// after a debounce and are not covered.
|
|
462
|
-
let isRunningToolbarCommand = false;
|
|
463
|
-
|
|
464
|
-
const runAsToolbarCommand = <T>(command: () => T): T => {
|
|
465
|
-
isRunningToolbarCommand = true;
|
|
466
|
-
|
|
467
|
-
try {
|
|
468
|
-
return command();
|
|
469
|
-
} finally {
|
|
470
|
-
isRunningToolbarCommand = false;
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
|
|
474
429
|
// Update model when editor content changes. RTE content is stored as Tiptap
|
|
475
430
|
// JSON (BP-5787). getJSON() is already in hand (the editor holds the doc) and
|
|
476
431
|
// is sanitised natively — no getHTML(), no DOMPurify, no extra editor — so
|
|
@@ -484,9 +439,15 @@ export const useRichTextEditor = (
|
|
|
484
439
|
// field → store chain and arms the history merge at the moment of the
|
|
485
440
|
// store write — arming here at emit time would lapse before the
|
|
486
441
|
// debounce fires. Genuine edits happen while focused and commit
|
|
487
|
-
// normally
|
|
442
|
+
// normally.
|
|
443
|
+
//
|
|
444
|
+
// Known limitation: a programmatic toolbar command run on an editor the
|
|
445
|
+
// user hasn't focused yet would also merge (losing that undo step). Today
|
|
446
|
+
// the RTE only mounts inside an already-open settings drawer and the user
|
|
447
|
+
// focuses it before formatting, so this doesn't occur — revisit if a
|
|
448
|
+
// consumer ever drives toolbar actions on an unfocused editor.
|
|
488
449
|
emit('update:modelValue', sanitizeRteJson(editor.getJSON()), {
|
|
489
|
-
isHydrationWrite: !editor.isFocused
|
|
450
|
+
isHydrationWrite: !editor.isFocused,
|
|
490
451
|
});
|
|
491
452
|
});
|
|
492
453
|
|
|
@@ -590,38 +551,26 @@ export const useRichTextEditor = (
|
|
|
590
551
|
// write lands ~100ms BEFORE the editor's canonical text write-back, and
|
|
591
552
|
// an unflagged write here would open a plain capture burst that
|
|
592
553
|
// swallows the flagged text write into a phantom entry (BP-5810).
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
!
|
|
612
|
-
|
|
613
|
-
props,
|
|
614
|
-
syncedStyles,
|
|
615
|
-
isHydrationWrite,
|
|
616
|
-
)
|
|
617
|
-
) {
|
|
618
|
-
contentSettingStore.updateTextStyles({
|
|
619
|
-
id: props.rawId,
|
|
620
|
-
name: props.name,
|
|
621
|
-
value: syncedStyles,
|
|
622
|
-
isHydrationWrite,
|
|
623
|
-
});
|
|
624
|
-
}
|
|
554
|
+
contentSettingStore.updateTextStyles({
|
|
555
|
+
id: props.rawId,
|
|
556
|
+
name: props.name,
|
|
557
|
+
value: {
|
|
558
|
+
fontSize: globalStyles.fontSize,
|
|
559
|
+
fontFamily: globalStyles.fontFamily,
|
|
560
|
+
fontWeight: globalStyles.fontWeight,
|
|
561
|
+
fontStyle: globalStyles.fontStyle,
|
|
562
|
+
textDecoration: globalStyles.textDecoration,
|
|
563
|
+
// Keep an element colour override (a creation-time contrast bake, or a
|
|
564
|
+
// colour picked while linked) — only fall back to the global style's colour
|
|
565
|
+
// when the element has none, mirroring `resolveTextColor`'s element-first
|
|
566
|
+
// cascade. Blindly taking `globalStyles.color` here re-derived the linked
|
|
567
|
+
// colour on every RTE mount and clobbered the override.
|
|
568
|
+
color: props.styles?.color || globalStyles.color,
|
|
569
|
+
lineHeight: globalStyles.lineHeight,
|
|
570
|
+
letterSpacing: globalStyles.letterSpacing,
|
|
571
|
+
},
|
|
572
|
+
isHydrationWrite: !editor.isFocused,
|
|
573
|
+
});
|
|
625
574
|
|
|
626
575
|
// sync toolbar editor styles
|
|
627
576
|
fontSettings.selectedFont = globalStyles?.fontFamily ?? 'Lato';
|
|
@@ -813,10 +762,6 @@ export const useRichTextEditor = (
|
|
|
813
762
|
};
|
|
814
763
|
|
|
815
764
|
const syncContentSettings = (fontStyleChanges: TextStyleDeclaration) => {
|
|
816
|
-
if (writeListItemStyles(contentSettingStore, props, fontStyleChanges)) {
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
|
|
820
765
|
if (props.name === 'textItems') {
|
|
821
766
|
contentSettingStore.updateTextItemTextStyleTypeWithStyles({
|
|
822
767
|
id: props.rawId,
|
|
@@ -952,8 +897,7 @@ export const useRichTextEditor = (
|
|
|
952
897
|
editor,
|
|
953
898
|
onFocus,
|
|
954
899
|
onBlur,
|
|
955
|
-
triggerEditorStyleChange
|
|
956
|
-
runAsToolbarCommand(() => triggerEditorStyleChange(editorOption)),
|
|
900
|
+
triggerEditorStyleChange,
|
|
957
901
|
toggleBold,
|
|
958
902
|
toggleItalic,
|
|
959
903
|
toggleUnderline,
|
|
@@ -970,8 +914,7 @@ export const useRichTextEditor = (
|
|
|
970
914
|
setInitialStyleSettings,
|
|
971
915
|
copyGlobalStyleSettings,
|
|
972
916
|
unsetAllMarks,
|
|
973
|
-
handleHyperlink
|
|
974
|
-
runAsToolbarCommand(() => handleHyperlink(...args)),
|
|
917
|
+
handleHyperlink,
|
|
975
918
|
hyperlinkValue,
|
|
976
919
|
setHyperlinkUrlValue,
|
|
977
920
|
shouldShow,
|
|
@@ -35,11 +35,8 @@ import type {
|
|
|
35
35
|
Content,
|
|
36
36
|
ShopContent,
|
|
37
37
|
BookingSectionContent,
|
|
38
|
-
FaqSectionContent,
|
|
39
38
|
} from '@brand-page';
|
|
40
39
|
import {
|
|
41
|
-
FAQ_DISPLAY_STYLES,
|
|
42
|
-
FAQ_MAX_ITEMS,
|
|
43
40
|
SOCIAL_LINKS_ICON_DISPLAY_STYLES,
|
|
44
41
|
BRAND_PAGE_TYPES,
|
|
45
42
|
DIVIDER_STYLES,
|
|
@@ -87,9 +84,6 @@ import {
|
|
|
87
84
|
VARIANT_DISPLAY_MODES,
|
|
88
85
|
createInitialShopContent,
|
|
89
86
|
createInitialBookingSectionContent,
|
|
90
|
-
createInitialFaqSectionContent,
|
|
91
|
-
createInitialFaqQuestionStyle,
|
|
92
|
-
createInitialFaqAnswerStyle,
|
|
93
87
|
} from '../models';
|
|
94
88
|
import * as uuid from 'uuid';
|
|
95
89
|
import type {
|
|
@@ -155,7 +149,6 @@ import {
|
|
|
155
149
|
import { socialLinksIconDisplayStyleConvertor } from '../convertors/social-links-icon-display-style.convertor';
|
|
156
150
|
import { getTextMediaOptionsConverterByMediaType } from '../convertors/text-image-display-style.convertor';
|
|
157
151
|
import { testimonialDisplayStyleConvertor } from '../convertors/testimonial-display-style-convertor';
|
|
158
|
-
import { faqDisplayStyleConvertor } from '../convertors/faq-display-style.convertor';
|
|
159
152
|
import { pageValidator, urlValidator } from '../validators';
|
|
160
153
|
import { imagesSectionAspectRatioVisibilityAssessor } from '../assessors/images-section-aspect-ratio-visibility.assessor';
|
|
161
154
|
import {
|
|
@@ -3302,106 +3295,6 @@ export const BOOKING_SECTION_SETTINGS_CONFIG =
|
|
|
3302
3295
|
isLocked: false,
|
|
3303
3296
|
});
|
|
3304
3297
|
|
|
3305
|
-
const FAQ_FIELD_GROUP_IDS = {
|
|
3306
|
-
settings: 'settings',
|
|
3307
|
-
items: 'items',
|
|
3308
|
-
style: 'style',
|
|
3309
|
-
} as const;
|
|
3310
|
-
|
|
3311
|
-
export const FAQ_SECTION_SETTINGS_CONFIG =
|
|
3312
|
-
(): ContentSettingsConfig<FaqSectionContent> => ({
|
|
3313
|
-
type: 'faq-section',
|
|
3314
|
-
category: 'general',
|
|
3315
|
-
createInitialContent: createInitialFaqSectionContent,
|
|
3316
|
-
displayMode: CONTENT_SETTINGS_DISPLAY_MODES.focused,
|
|
3317
|
-
defaultIconName: 'question-circle-filled',
|
|
3318
|
-
displayName: contentSettingsTr(`faqSectionDisplayName`),
|
|
3319
|
-
fieldGroups: [
|
|
3320
|
-
{
|
|
3321
|
-
id: FAQ_FIELD_GROUP_IDS.settings,
|
|
3322
|
-
displayName: contentSettingsTr(`settingsDisplayName`),
|
|
3323
|
-
isCollapsed: false,
|
|
3324
|
-
},
|
|
3325
|
-
{
|
|
3326
|
-
id: FAQ_FIELD_GROUP_IDS.items,
|
|
3327
|
-
displayName: contentSettingsTr(`faqItemsDisplayName`),
|
|
3328
|
-
isCollapsed: false,
|
|
3329
|
-
},
|
|
3330
|
-
{
|
|
3331
|
-
id: FAQ_FIELD_GROUP_IDS.style,
|
|
3332
|
-
displayName: contentSettingsTr(`styleDisplayName`),
|
|
3333
|
-
isCollapsed: true,
|
|
3334
|
-
},
|
|
3335
|
-
],
|
|
3336
|
-
fields: {
|
|
3337
|
-
titleStyle: DEFAULT_TITLE_STYLE_SETTINGS_FILED_WITH_TITLE(),
|
|
3338
|
-
descriptionStyle: DEFAULT_DESCRIPTION_STYLE_FILED(),
|
|
3339
|
-
title: {
|
|
3340
|
-
type: 'text',
|
|
3341
|
-
placeholder: contentSettingsTr(`titlePlaceholder`),
|
|
3342
|
-
title: contentSettingsTr(`titleTitle`),
|
|
3343
|
-
groupId: FAQ_FIELD_GROUP_IDS.settings,
|
|
3344
|
-
maxLength: 200,
|
|
3345
|
-
},
|
|
3346
|
-
description: {
|
|
3347
|
-
type: 'textarea',
|
|
3348
|
-
placeholder: contentSettingsTr(`descriptionPlaceholder`),
|
|
3349
|
-
title: contentSettingsTr(`descriptionTitle`),
|
|
3350
|
-
groupId: FAQ_FIELD_GROUP_IDS.settings,
|
|
3351
|
-
maxLength: 1000,
|
|
3352
|
-
},
|
|
3353
|
-
items: {
|
|
3354
|
-
type: 'list-items',
|
|
3355
|
-
defaultValue: [],
|
|
3356
|
-
groupId: FAQ_FIELD_GROUP_IDS.items,
|
|
3357
|
-
maxLength: FAQ_MAX_ITEMS,
|
|
3358
|
-
itemFields: [
|
|
3359
|
-
{
|
|
3360
|
-
key: 'question',
|
|
3361
|
-
kind: 'text',
|
|
3362
|
-
styleKey: 'questionStyle',
|
|
3363
|
-
defaultStyle: () => createInitialFaqQuestionStyle(),
|
|
3364
|
-
maxLength: 200,
|
|
3365
|
-
title: contentSettingsTr(`faqQuestionTitle`),
|
|
3366
|
-
placeholder: contentSettingsTr(`faqQuestionPlaceholder`),
|
|
3367
|
-
defaultValue: () => contentSettingsTr(`faqNewQuestion`),
|
|
3368
|
-
},
|
|
3369
|
-
{
|
|
3370
|
-
key: 'answer',
|
|
3371
|
-
kind: 'textarea',
|
|
3372
|
-
styleKey: 'answerStyle',
|
|
3373
|
-
defaultStyle: () => createInitialFaqAnswerStyle(),
|
|
3374
|
-
maxLength: 1000,
|
|
3375
|
-
title: contentSettingsTr(`faqAnswerTitle`),
|
|
3376
|
-
placeholder: contentSettingsTr(`faqAnswerPlaceholder`),
|
|
3377
|
-
defaultValue: () => contentSettingsTr(`faqNewAnswer`),
|
|
3378
|
-
},
|
|
3379
|
-
],
|
|
3380
|
-
},
|
|
3381
|
-
displayStyle: {
|
|
3382
|
-
type: 'radio',
|
|
3383
|
-
role: 'multi',
|
|
3384
|
-
defaultValue: FAQ_DISPLAY_STYLES.centered,
|
|
3385
|
-
title: contentSettingsTr(`displayStyleTitle`),
|
|
3386
|
-
optionsConvertor: faqDisplayStyleConvertor,
|
|
3387
|
-
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
3388
|
-
variant: 'icon',
|
|
3389
|
-
},
|
|
3390
|
-
...PADDING_CONTROL_FIELDS(FAQ_FIELD_GROUP_IDS.style),
|
|
3391
|
-
backgroundStyle: {
|
|
3392
|
-
type: 'color',
|
|
3393
|
-
groupId: FAQ_FIELD_GROUP_IDS.style,
|
|
3394
|
-
defaultValue: {},
|
|
3395
|
-
isInline: true,
|
|
3396
|
-
showToggle: false,
|
|
3397
|
-
title: contentSettingsTr(`backgroundColorTitle`),
|
|
3398
|
-
valueConvertor: backgroundColorConvertor,
|
|
3399
|
-
},
|
|
3400
|
-
},
|
|
3401
|
-
isEnabled: true,
|
|
3402
|
-
isLocked: false,
|
|
3403
|
-
});
|
|
3404
|
-
|
|
3405
3298
|
export const CONTENT_SETTINGS_CONFIGS = (): Record<
|
|
3406
3299
|
ContentType,
|
|
3407
3300
|
ContentSettingsConfig<any>
|
|
@@ -3438,5 +3331,4 @@ export const CONTENT_SETTINGS_CONFIGS = (): Record<
|
|
|
3438
3331
|
'shapes-section': SHAPES_SECTION_SETTINGS_CONFIG(),
|
|
3439
3332
|
'shop-section': SHOP_SECTION_SETTINGS_CONFIG(),
|
|
3440
3333
|
'booking-section': BOOKING_SECTION_SETTINGS_CONFIG(),
|
|
3441
|
-
'faq-section': FAQ_SECTION_SETTINGS_CONFIG(),
|
|
3442
3334
|
});
|
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
BrandPageType,
|
|
4
4
|
Content,
|
|
5
5
|
ContentType,
|
|
6
|
-
TextStyleDeclaration,
|
|
7
6
|
} from '@brand-page';
|
|
8
7
|
import type { ContentReplaceImageSettings } from '@shared/content-settings/models';
|
|
9
8
|
import type { UIUserFeatures } from '@src/constants/ui';
|
|
@@ -87,7 +86,6 @@ export const ITEM_FIELD_TYPES = {
|
|
|
87
86
|
'color-replacements': 'color-replacements',
|
|
88
87
|
'testimonial-items': 'testimonial-items',
|
|
89
88
|
'text-items': 'text-items',
|
|
90
|
-
'list-items': 'list-items',
|
|
91
89
|
'page-dropdown': 'page-dropdown',
|
|
92
90
|
'personalisation-override': 'personalisation-override',
|
|
93
91
|
} as const;
|
|
@@ -156,28 +154,6 @@ export interface ContentSettingsField<TContent> {
|
|
|
156
154
|
* Defaults to `${fieldName}Style` when not specified.
|
|
157
155
|
*/
|
|
158
156
|
styleName?: string;
|
|
159
|
-
|
|
160
|
-
/** `list-items` only: the per-item inputs, in order. The first `text` input labels the row. */
|
|
161
|
-
itemFields?: ListItemFieldSchema[];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface ListItemFieldSchema {
|
|
165
|
-
key: string;
|
|
166
|
-
/** The plain input used when the rich-text editor is unavailable. */
|
|
167
|
-
kind: 'text' | 'textarea';
|
|
168
|
-
title: string;
|
|
169
|
-
placeholder?: string;
|
|
170
|
-
maxLength?: number;
|
|
171
|
-
/**
|
|
172
|
-
* The item field that holds this text's style. Set it to make the text rich text —
|
|
173
|
-
* the same editor as a section title, writing this item's own style — whenever the
|
|
174
|
-
* section allows rich text. Without rich text, a font-style control edits it instead.
|
|
175
|
-
*/
|
|
176
|
-
styleKey?: string;
|
|
177
|
-
/** Style a first item starts with; later items copy the last item's style. */
|
|
178
|
-
defaultStyle?: () => TextStyleDeclaration;
|
|
179
|
-
/** Value a newly added item starts with. */
|
|
180
|
-
defaultValue?: () => string;
|
|
181
157
|
}
|
|
182
158
|
|
|
183
159
|
export interface ContentSettingsMultiField<TContent, TField> extends Omit<
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
SENSITIVE_CONTENT_TYPES,
|
|
27
27
|
CONTACT_FORM_LAYOUT_DEFAULT_PADDING,
|
|
28
28
|
TESTIMONIAL_DEFAULT_PADDING,
|
|
29
|
-
FAQ_DISPLAY_STYLES,
|
|
30
29
|
} from '@brand-page';
|
|
31
30
|
import type {
|
|
32
31
|
ButtonContent,
|
|
@@ -54,8 +53,6 @@ import type {
|
|
|
54
53
|
SupportMeContent,
|
|
55
54
|
ShopContent,
|
|
56
55
|
BookingSectionContent,
|
|
57
|
-
TextStyleDeclaration,
|
|
58
|
-
FaqSectionContent,
|
|
59
56
|
} from '@brand-page';
|
|
60
57
|
import * as uuid from 'uuid';
|
|
61
58
|
import type { CreateInitialContentFunction } from './content-settings-configs';
|
|
@@ -674,60 +671,6 @@ export const createInitialBookingSectionContent: CreateInitialContentFunction<
|
|
|
674
671
|
};
|
|
675
672
|
};
|
|
676
673
|
|
|
677
|
-
// Questions follow the Headings role, answers the Paragraphs role.
|
|
678
|
-
export const createInitialFaqQuestionStyle = (
|
|
679
|
-
applyAutoScale = false,
|
|
680
|
-
): TextStyleDeclaration => ({
|
|
681
|
-
applyAutoScale,
|
|
682
|
-
textStyleType: TEXT_STYLE_TYPES.headings,
|
|
683
|
-
textAlign: 'left',
|
|
684
|
-
});
|
|
685
|
-
|
|
686
|
-
export const createInitialFaqAnswerStyle = (
|
|
687
|
-
applyAutoScale = false,
|
|
688
|
-
): TextStyleDeclaration => ({
|
|
689
|
-
applyAutoScale,
|
|
690
|
-
textStyleType: TEXT_STYLE_TYPES.paragraphs,
|
|
691
|
-
textAlign: 'left',
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
export const createInitialFaqSectionContent: CreateInitialContentFunction<
|
|
695
|
-
FaqSectionContent
|
|
696
|
-
> = (options?: CreateInitialContentOptions) => {
|
|
697
|
-
const applyAutoScale = options?.brandPageType === BRAND_PAGE_TYPES.brandSite;
|
|
698
|
-
|
|
699
|
-
return {
|
|
700
|
-
id: uuid.v4(),
|
|
701
|
-
type: 'faq-section',
|
|
702
|
-
title: contentSettingsTr(`defaultFaqTitle`),
|
|
703
|
-
description: contentSettingsTr(`defaultFaqDescription`),
|
|
704
|
-
displayStyle: FAQ_DISPLAY_STYLES.centered,
|
|
705
|
-
topPadding: 32,
|
|
706
|
-
bottomPadding: 32,
|
|
707
|
-
// One sample item; the design's four are only there to show a longer list.
|
|
708
|
-
items: [
|
|
709
|
-
{
|
|
710
|
-
id: uuid.v4(),
|
|
711
|
-
question: contentSettingsTr(`defaultFaqQuestion`),
|
|
712
|
-
questionStyle: createInitialFaqQuestionStyle(applyAutoScale),
|
|
713
|
-
answer: contentSettingsTr(`defaultFaqAnswer`),
|
|
714
|
-
answerStyle: createInitialFaqAnswerStyle(applyAutoScale),
|
|
715
|
-
},
|
|
716
|
-
],
|
|
717
|
-
titleStyle: {
|
|
718
|
-
applyAutoScale,
|
|
719
|
-
textStyleType: TEXT_STYLE_TYPES.titles,
|
|
720
|
-
textAlign: 'center',
|
|
721
|
-
},
|
|
722
|
-
descriptionStyle: {
|
|
723
|
-
applyAutoScale,
|
|
724
|
-
textStyleType: TEXT_STYLE_TYPES.paragraphs,
|
|
725
|
-
textAlign: 'center',
|
|
726
|
-
},
|
|
727
|
-
backgroundStyle: {},
|
|
728
|
-
};
|
|
729
|
-
};
|
|
730
|
-
|
|
731
674
|
export const createInitialImagesSectionContent: CreateInitialContentFunction<
|
|
732
675
|
ImagesSectionContent
|
|
733
676
|
> = (options?: CreateInitialContentOptions) => {
|
|
@@ -2109,8 +2109,6 @@ export const useBrandPageMakerStore = defineStore('brandPageMaker', {
|
|
|
2109
2109
|
setVideoUrlsWithToken: videoStore.setVideoUrlsWithToken,
|
|
2110
2110
|
isCustomDomain: false,
|
|
2111
2111
|
brandPageSlug: brandPageContainerStore.brandPageSlug,
|
|
2112
|
-
activeItemIdByContentId:
|
|
2113
|
-
useUiContentSettingsStore().activeItemIdByContentId,
|
|
2114
2112
|
},
|
|
2115
2113
|
);
|
|
2116
2114
|
},
|