@designcrowd/library.brand-page 5.17.21 → 5.17.23-ast-subnav

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.
Files changed (121) hide show
  1. package/lib/src/{CreatedOnBrandCrowd-de-de-Brtp2yWB.js → CreatedOnBrandCrowd-de-de-Ct9Aewoo.js} +1 -1
  2. package/lib/src/{CreatedOnBrandCrowd-en-us-BIJ5VoX4.js → CreatedOnBrandCrowd-en-us-BsEzGp5K.js} +1 -1
  3. package/lib/src/{CreatedOnBrandCrowd-es-es-JrKK9K0u.js → CreatedOnBrandCrowd-es-es-UiIPmY0h.js} +1 -1
  4. package/lib/src/{CreatedOnBrandCrowd-fr-fr-D_HvOZe-.js → CreatedOnBrandCrowd-fr-ca-CQmEXbU7.js} +1 -1
  5. package/lib/src/{CreatedOnBrandCrowd-fr-ca-D_HvOZe-.js → CreatedOnBrandCrowd-fr-fr-CQmEXbU7.js} +1 -1
  6. package/lib/src/{CreatedOnBrandCrowd-pt-pt-SSLb0vlp.js → CreatedOnBrandCrowd-pt-br-DoMI5QSQ.js} +1 -1
  7. package/lib/src/{CreatedOnBrandCrowd-pt-br-SSLb0vlp.js → CreatedOnBrandCrowd-pt-pt-DoMI5QSQ.js} +1 -1
  8. package/lib/src/{CreatedOnDcom-de-de-BG39ozFo.js → CreatedOnDcom-de-de-gexV_wWX.js} +1 -1
  9. package/lib/src/{CreatedOnDcom-en-us-D2NzqECZ.js → CreatedOnDcom-en-us-C2sLHLjJ.js} +1 -1
  10. package/lib/src/{CreatedOnDcom-es-es-C55r2Lb4.js → CreatedOnDcom-es-es-CZFd666H.js} +1 -1
  11. package/lib/src/{CreatedOnDcom-fr-ca-Bj-sAaJI.js → CreatedOnDcom-fr-ca-CPaRB_io.js} +1 -1
  12. package/lib/src/{CreatedOnDcom-fr-fr-D8l0r-Tc.js → CreatedOnDcom-fr-fr-BQo5D5gE.js} +1 -1
  13. package/lib/src/{CreatedOnDcom-pt-br-CXHC6E1h.js → CreatedOnDcom-pt-br-CRr3CqOj.js} +1 -1
  14. package/lib/src/{CreatedOnDcom-pt-pt-2dMvgnyi.js → CreatedOnDcom-pt-pt-DR6Vi-eZ.js} +1 -1
  15. package/lib/src/brand-page/components/banner-section/BannerSection.mixin.d.ts +1 -1
  16. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +1 -0
  17. package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +20 -2
  18. package/lib/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.d.ts +8 -1
  19. package/lib/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.js +97 -3
  20. package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.js +6 -2
  21. package/lib/src/brand-page/models/index.d.ts +1 -1
  22. package/lib/src/brand-page/models/navigation-styles.model.d.ts +2 -0
  23. package/lib/src/brand-page/models/navigation-styles.model.js +20 -1
  24. package/lib/src/brand-page/utils/migration/migration-14.d.ts +2 -0
  25. package/lib/src/brand-page/utils/migration/migration-14.js +16 -0
  26. package/lib/src/brand-page/utils/migration/migration-15.d.ts +2 -0
  27. package/lib/src/brand-page/utils/migration/migration-15.js +37 -0
  28. package/lib/src/brand-page/utils/migration.util.js +12 -0
  29. package/lib/src/brand-page/utils/style.util.js +16 -2
  30. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.d.ts +1 -1
  31. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -1
  32. package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-site-template.examples.js +1 -1
  33. package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +7 -1
  34. package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -1
  35. package/lib/src/brand-page-maker/constants/config-settings-constant.js +1 -10
  36. package/lib/src/brand-page-maker/models/content-settings-configs.d.ts +5 -0
  37. package/lib/src/brand-page-maker/models/content-settings.js +3 -0
  38. package/lib/src/brand-page-maker/models/navigation-style-configs.d.ts +1 -0
  39. package/lib/src/brand-page-maker/models/navigation-style-configs.js +5 -0
  40. package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +170 -388
  41. package/lib/src/{bundled-translations-Bu_5FO26.js → bundled-translations-Cy6nun02.js} +1 -1
  42. package/lib/src/{bundled-translations.de-DE-CZTzknyj.js → bundled-translations.de-DE-BUZncCAM.js} +1 -1
  43. package/lib/src/{bundled-translations.es-ES-p86F-gOD.js → bundled-translations.es-ES-D4IPwZD-.js} +9 -9
  44. package/lib/src/{bundled-translations.fr-CA-CM5ZA8dQ.js → bundled-translations.fr-CA-BMgRrrwA.js} +9 -9
  45. package/lib/src/{bundled-translations.fr-FR-DV7sOgtb.js → bundled-translations.fr-FR-Ck7kYrK4.js} +1 -1
  46. package/lib/src/{bundled-translations.pt-BR-DkWWGrsz.js → bundled-translations.pt-BR--5_9viJ9.js} +1 -1
  47. package/lib/src/{bundled-translations.pt-PT-C5Td5lLs.js → bundled-translations.pt-PT-DAGUOQ7m.js} +13 -13
  48. package/lib/src/bundles/bundled-translations.de-DE.json +1 -0
  49. package/lib/src/bundles/bundled-translations.es-ES.json +1 -0
  50. package/lib/src/bundles/bundled-translations.fr-CA.json +1 -0
  51. package/lib/src/bundles/bundled-translations.fr-FR.json +1 -0
  52. package/lib/src/bundles/bundled-translations.json +1 -0
  53. package/lib/src/bundles/bundled-translations.pt-BR.json +1 -0
  54. package/lib/src/bundles/bundled-translations.pt-PT.json +1 -0
  55. package/lib/src/css/library.brand-page-brandCrowd.min.css +110 -103
  56. package/lib/src/css/library.brand-page-brandPage.min.css +110 -103
  57. package/lib/src/css/library.brand-page-designCom.min.css +110 -103
  58. package/lib/src/css/library.brand-page-preview.min.css +110 -103
  59. package/lib/src/index.mjs +1 -1
  60. package/lib/src/{lib-CrBvj1a5.js → lib-wvy4koSU.js} +22606 -22689
  61. package/lib/src/metadata-builder/builders/section-field-maps.js +1 -0
  62. package/lib/src/metadata-builder/builders/section-field-utils.js +5 -0
  63. package/lib/src/metadata-builder/helpers/rte.helpers.js +3 -0
  64. package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +2 -1
  65. package/lib/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.d.ts +4 -1
  66. package/lib/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.js +55 -2
  67. package/lib/src/shared/navigation-style-settings/store/index.d.ts +6 -0
  68. package/lib/src/shared/navigation-style-settings/store/index.js +15 -0
  69. package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +27 -1
  70. package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +25 -2
  71. package/package.json +1 -1
  72. package/src/brand-page/components/about-section/AboutSection.vue +63 -6
  73. package/src/brand-page/components/collapsible/Collapsible.vue +8 -2
  74. package/src/brand-page/components/contact-form/ContactForm.mixin.ts +21 -2
  75. package/src/brand-page/components/contact-form/ContactForm.vue +15 -15
  76. package/src/brand-page/components/image-gallery/ImageGalleryModal.mixin.ts +114 -5
  77. package/src/brand-page/components/image-gallery/ImageGalleryModal.vue +25 -8
  78. package/src/brand-page/components/navigation/navigation-carousel/NavigationCarousel.vue +19 -8
  79. package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.ts +6 -2
  80. package/src/brand-page/components/text-wrapper/TextWrapper.vue +5 -1
  81. package/src/brand-page/models/index.ts +1 -1
  82. package/src/brand-page/models/navigation-styles.model.ts +31 -0
  83. package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +15 -3
  84. package/src/brand-page/utils/__snapshots__/migration2.util.test.ts.snap +4 -0
  85. package/src/brand-page/utils/__snapshots__/model.util.test.ts.snap +8 -0
  86. package/src/brand-page/utils/migration/migration-14.ts +23 -0
  87. package/src/brand-page/utils/migration/migration-15.ts +62 -0
  88. package/src/brand-page/utils/migration.util.ts +14 -0
  89. package/src/brand-page/utils/style.util.ts +16 -2
  90. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -1
  91. package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-site-template.examples.ts +1 -1
  92. package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +8 -1
  93. package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -1
  94. package/src/brand-page-maker/constants/config-settings-constant.ts +1 -10
  95. package/src/brand-page-maker/models/content-settings-configs.ts +6 -0
  96. package/src/brand-page-maker/models/content-settings.ts +3 -0
  97. package/src/brand-page-maker/models/i18n/models.de-DE.json +1 -0
  98. package/src/brand-page-maker/models/i18n/models.es-ES.json +1 -0
  99. package/src/brand-page-maker/models/i18n/models.fr-CA.json +1 -0
  100. package/src/brand-page-maker/models/i18n/models.fr-FR.json +1 -0
  101. package/src/brand-page-maker/models/i18n/models.json +1 -0
  102. package/src/brand-page-maker/models/i18n/models.pt-BR.json +1 -0
  103. package/src/brand-page-maker/models/i18n/models.pt-PT.json +1 -0
  104. package/src/brand-page-maker/models/navigation-style-configs.ts +5 -0
  105. package/src/brand-page-maker/utils/rich-text-editor.util.ts +274 -684
  106. package/src/bundles/bundled-translations.de-DE.json +1 -0
  107. package/src/bundles/bundled-translations.es-ES.json +1 -0
  108. package/src/bundles/bundled-translations.fr-CA.json +1 -0
  109. package/src/bundles/bundled-translations.fr-FR.json +1 -0
  110. package/src/bundles/bundled-translations.json +1 -0
  111. package/src/bundles/bundled-translations.pt-BR.json +1 -0
  112. package/src/bundles/bundled-translations.pt-PT.json +1 -0
  113. package/src/metadata-builder/builders/section-field-maps.ts +1 -0
  114. package/src/metadata-builder/builders/section-field-utils.ts +5 -0
  115. package/src/metadata-builder/helpers/rte.helpers.ts +4 -0
  116. package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +2 -1
  117. package/src/shared/navigation-style-settings/components/navigation-style-settings/NavigationStyleSettings.mixin.ts +82 -4
  118. package/src/shared/navigation-style-settings/store/index.ts +30 -0
  119. package/lib/src/brand-page/components/about-section/AboutSection.mixin.d.ts +0 -83
  120. package/lib/src/brand-page/components/about-section/AboutSection.mixin.js +0 -65
  121. package/src/brand-page/components/about-section/AboutSection.mixin.ts +0 -78
@@ -12,6 +12,13 @@ import {
12
12
  type TextContent,
13
13
  type TextStyleDeclaration,
14
14
  type TextStyleType,
15
+ type ContactFormContent,
16
+ type AboutSectionContent,
17
+ type TestimonialSectionContent,
18
+ type SocialLinksContent,
19
+ type RequestPaymentContent,
20
+ type SupportMeContent,
21
+ type ShopContent,
15
22
  } from '@brand-page';
16
23
  import type { PageSettingsState } from '@shared/page-settings/store';
17
24
  import type { StyleSettingsState } from '@shared/style-settings/store';
@@ -21,16 +28,81 @@ import type { Mark } from 'prosemirror-model';
21
28
  import createDomPurify, { type DOMPurify } from 'dompurify';
22
29
  import { isHrefPageId } from '../composables/rich-text-editor/hyperlink';
23
30
 
31
+ interface RTEFieldPair {
32
+ textField: string;
33
+ styleField: string;
34
+ }
35
+
36
+ const RTE_SECTION_FIELD_PAIRS: Record<string, RTEFieldPair[]> = {
37
+ 'banner-section': [
38
+ { textField: 'title', styleField: 'titleStyle' },
39
+ { textField: 'description', styleField: 'descriptionStyle' },
40
+ ],
41
+ 'booking-section': [
42
+ { textField: 'title', styleField: 'titleStyle' },
43
+ { textField: 'description', styleField: 'descriptionStyle' },
44
+ ],
45
+ 'images-section': [
46
+ { textField: 'title', styleField: 'titleStyle' },
47
+ { textField: 'description', styleField: 'descriptionStyle' },
48
+ ],
49
+ 'shapes-section': [
50
+ { textField: 'title', styleField: 'titleStyle' },
51
+ { textField: 'description', styleField: 'descriptionStyle' },
52
+ ],
53
+ 'mailing-list': [{ textField: 'title', styleField: 'titleStyle' }],
54
+ profile: [
55
+ { textField: 'name', styleField: 'nameStyle' },
56
+ { textField: 'title', styleField: 'titleStyle' },
57
+ { textField: 'description', styleField: 'descriptionStyle' },
58
+ ],
59
+ 'contact-form': [
60
+ { textField: 'title', styleField: 'titleStyle' },
61
+ { textField: 'description', styleField: 'descriptionStyle' },
62
+ { textField: 'successMessage', styleField: 'successMessageStyle' },
63
+ ],
64
+ 'about-section': [
65
+ { textField: 'title', styleField: 'titleStyle' },
66
+ { textField: 'paragraph', styleField: 'paragraphStyle' },
67
+ ],
68
+ 'testimonial-section': [{ textField: 'title', styleField: 'titleStyle' }],
69
+ 'social-links': [{ textField: 'title', styleField: 'titleStyle' }],
70
+ 'request-payment': [
71
+ { textField: 'title', styleField: 'titleStyle' },
72
+ { textField: 'description', styleField: 'descriptionStyle' },
73
+ ],
74
+ 'support-me': [
75
+ { textField: 'title', styleField: 'titleStyle' },
76
+ { textField: 'description', styleField: 'descriptionStyle' },
77
+ ],
78
+ 'shop-section': [
79
+ { textField: 'title', styleField: 'titleStyle' },
80
+ { textField: 'description', styleField: 'descriptionStyle' },
81
+ ],
82
+ };
83
+
84
+ // 'text' has special textItems handling, so it's not in the map but is RTE-enabled
24
85
  export const RTE_ALLOWED_SECTION_TYPES = [
25
- 'banner-section',
86
+ ...Object.keys(RTE_SECTION_FIELD_PAIRS),
26
87
  'text',
27
- 'booking-section',
28
- 'images-section',
29
- 'shapes-section',
30
- 'mailing-list',
31
- 'profile',
32
88
  ];
33
89
 
90
+ // Union of all section content types that support RTE field-pair processing
91
+ type RTESectionContent =
92
+ | BannerSectionContent
93
+ | BookingSectionContent
94
+ | ImagesSectionContent
95
+ | ShapesSectionContent
96
+ | MailingListContent
97
+ | ProfileContent
98
+ | ContactFormContent
99
+ | AboutSectionContent
100
+ | TestimonialSectionContent
101
+ | SocialLinksContent
102
+ | RequestPaymentContent
103
+ | SupportMeContent
104
+ | ShopContent;
105
+
34
106
  // Only allow tags used by the enabled Tiptap extensions
35
107
  const allowedTags = [
36
108
  'p',
@@ -330,6 +402,94 @@ export const replaceTextInRTE = (
330
402
  return tempDiv.innerHTML;
331
403
  };
332
404
 
405
+ const transformRTEField = (
406
+ content: RTESectionContent,
407
+ pair: RTEFieldPair,
408
+ externalEditor: Editor,
409
+ uiStyleSettingsStore: StyleSettingsState | undefined,
410
+ newContent: Content | undefined,
411
+ type: TextStyleType | undefined,
412
+ newStyle: TextStyleDeclaration | undefined,
413
+ ) => {
414
+ const fields = content as unknown as Record<string, unknown>;
415
+ const style = fields[pair.styleField] as TextStyleDeclaration | undefined;
416
+ const textStyleType = style?.textStyleType;
417
+
418
+ if (textStyleType && (textStyleType === type || uiStyleSettingsStore)) {
419
+ let globalContentStyle = uiStyleSettingsStore
420
+ ? uiStyleSettingsStore.textStyles.textStyleOptions[textStyleType].style
421
+ : newStyle ?? ({} as TextStyleDeclaration);
422
+
423
+ globalContentStyle = {
424
+ ...globalContentStyle,
425
+ textAlign: style?.textAlign,
426
+ };
427
+
428
+ fields[pair.textField] = getUpdatedHTMLFromEditor(
429
+ externalEditor,
430
+ fields[pair.textField] as string,
431
+ globalContentStyle,
432
+ );
433
+ } else if (
434
+ !textStyleType &&
435
+ newContent &&
436
+ newContent.id === content.id &&
437
+ !hasRTEContent(fields[pair.textField] as string)
438
+ ) {
439
+ const newContentFields = newContent as unknown as Record<string, unknown>;
440
+ const newContentStyle =
441
+ (newContentFields[pair.styleField] as TextStyleDeclaration | undefined) ||
442
+ style;
443
+
444
+ if (newContentStyle) {
445
+ fields[pair.textField] = getUpdatedHTMLFromEditor(
446
+ externalEditor,
447
+ fields[pair.textField] as string,
448
+ newContentStyle,
449
+ );
450
+ }
451
+ }
452
+ };
453
+
454
+ const switchRTEField = (
455
+ content: RTESectionContent,
456
+ pair: RTEFieldPair,
457
+ externalEditor: Editor,
458
+ uiStyleSettingsStore: StyleSettingsState | undefined,
459
+ ) => {
460
+ const fields = content as unknown as Record<string, unknown>;
461
+ const style = fields[pair.styleField] as TextStyleDeclaration | undefined;
462
+ const textStyleType = style?.textStyleType;
463
+
464
+ if (textStyleType && uiStyleSettingsStore) {
465
+ let globalContentStyle = uiStyleSettingsStore.textStyles.textStyleOptions[
466
+ textStyleType
467
+ ].style as TextStyleDeclaration;
468
+
469
+ globalContentStyle = {
470
+ ...globalContentStyle,
471
+ textAlign: style?.textAlign,
472
+ };
473
+
474
+ if (!hasRTEContent(fields[pair.textField] as string))
475
+ fields[pair.textField] = getUpdatedHTMLFromEditor(
476
+ externalEditor,
477
+ fields[pair.textField] as string,
478
+ globalContentStyle,
479
+ );
480
+ } else if (
481
+ !textStyleType &&
482
+ style &&
483
+ !hasRTEContent(fields[pair.textField] as string)
484
+ ) {
485
+ fields[pair.textField] = getUpdatedHTMLFromEditor(
486
+ externalEditor,
487
+ fields[pair.textField] as string,
488
+ style,
489
+ );
490
+ }
491
+ };
492
+
333
493
  export const transformToRTE = (
334
494
  uiPageSettingStore: PageSettingsState,
335
495
  externalEditor: Editor,
@@ -340,427 +500,113 @@ export const transformToRTE = (
340
500
  ) => {
341
501
  for (const page of uiPageSettingStore.pages) {
342
502
  for (const contentItem of page.contents) {
343
- switch (contentItem.type) {
344
- case 'banner-section':
345
- case 'booking-section':
346
- const sectionContent = contentItem.settings.content as
347
- | BannerSectionContent
348
- | BookingSectionContent;
349
- const titleTextStyleType = sectionContent.titleStyle.textStyleType;
350
- const descriptionTextStyleType =
351
- sectionContent.descriptionStyle.textStyleType;
352
-
353
- if (
354
- titleTextStyleType &&
355
- (titleTextStyleType === type || uiStyleSettingsStore)
356
- ) {
357
- let globalContentStyle = uiStyleSettingsStore
358
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
359
- titleTextStyleType
360
- ].style
361
- : newStyle ?? ({} as TextStyleDeclaration);
362
-
363
- globalContentStyle = {
364
- ...globalContentStyle,
365
- textAlign: sectionContent.titleStyle.textAlign,
366
- };
367
-
368
- sectionContent.title = getUpdatedHTMLFromEditor(
369
- externalEditor,
370
- sectionContent.title,
371
- globalContentStyle,
372
- );
373
- } else if (
374
- !titleTextStyleType &&
375
- newContent &&
376
- newContent.id === sectionContent.id &&
377
- !hasRTEContent(sectionContent.title)
378
- ) {
379
- const newContentStyle = (
380
- newContent as BannerSectionContent | BookingSectionContent
381
- ).titleStyle;
382
-
383
- sectionContent.title = getUpdatedHTMLFromEditor(
384
- externalEditor,
385
- sectionContent.title,
386
- newContentStyle,
387
- );
388
- }
389
-
390
- if (
391
- descriptionTextStyleType &&
392
- (descriptionTextStyleType === type || uiStyleSettingsStore)
393
- ) {
394
- let globalContentStyle = uiStyleSettingsStore
395
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
396
- descriptionTextStyleType
397
- ].style
398
- : newStyle ?? ({} as TextStyleDeclaration);
399
-
400
- globalContentStyle = {
401
- ...globalContentStyle,
402
- textAlign: sectionContent.descriptionStyle.textAlign,
403
- };
404
-
405
- sectionContent.description = getUpdatedHTMLFromEditor(
406
- externalEditor,
407
- sectionContent.description,
408
- globalContentStyle,
409
- );
410
- } else if (
411
- !descriptionTextStyleType &&
412
- newContent &&
413
- newContent.id === sectionContent.id &&
414
- !hasRTEContent(sectionContent.description)
415
- ) {
416
- const newContentStyle = (
417
- newContent as BannerSectionContent | BookingSectionContent
418
- ).descriptionStyle;
419
-
420
- sectionContent.description = getUpdatedHTMLFromEditor(
421
- externalEditor,
422
- sectionContent.description,
423
- newContentStyle,
424
- );
425
- }
426
-
427
- break;
428
- case 'images-section':
429
- case 'shapes-section':
430
- const mediaSectionContent = contentItem.settings.content as
431
- | ImagesSectionContent
432
- | ShapesSectionContent;
433
- const mediaTitleTextStyleType =
434
- mediaSectionContent.titleStyle.textStyleType;
435
- const mediaDescriptionTextStyleType =
436
- mediaSectionContent.descriptionStyle.textStyleType;
437
-
438
- if (
439
- mediaTitleTextStyleType &&
440
- (mediaTitleTextStyleType === type || uiStyleSettingsStore)
441
- ) {
442
- let globalContentStyle = uiStyleSettingsStore
443
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
444
- mediaTitleTextStyleType
445
- ].style
446
- : newStyle ?? ({} as TextStyleDeclaration);
447
-
448
- globalContentStyle = {
449
- ...globalContentStyle,
450
- textAlign: mediaSectionContent.titleStyle.textAlign,
451
- };
452
-
453
- mediaSectionContent.title = getUpdatedHTMLFromEditor(
454
- externalEditor,
455
- mediaSectionContent.title,
456
- globalContentStyle,
457
- );
458
- } else if (
459
- !mediaTitleTextStyleType &&
460
- newContent &&
461
- newContent.id === mediaSectionContent.id &&
462
- !hasRTEContent(mediaSectionContent.title)
463
- ) {
464
- const newContentStyle = (
465
- newContent as ImagesSectionContent | ShapesSectionContent
466
- ).titleStyle;
467
-
468
- mediaSectionContent.title = getUpdatedHTMLFromEditor(
469
- externalEditor,
470
- mediaSectionContent.title,
471
- newContentStyle,
472
- );
473
- }
474
-
475
- if (
476
- mediaDescriptionTextStyleType &&
477
- (mediaDescriptionTextStyleType === type || uiStyleSettingsStore)
478
- ) {
479
- let globalContentStyle = uiStyleSettingsStore
480
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
481
- mediaDescriptionTextStyleType
482
- ].style
483
- : newStyle ?? ({} as TextStyleDeclaration);
484
-
485
- globalContentStyle = {
486
- ...globalContentStyle,
487
- textAlign: mediaSectionContent.descriptionStyle.textAlign,
488
- };
489
-
490
- mediaSectionContent.description = getUpdatedHTMLFromEditor(
491
- externalEditor,
492
- mediaSectionContent.description,
493
- globalContentStyle,
494
- );
495
- } else if (
496
- !mediaDescriptionTextStyleType &&
497
- newContent &&
498
- newContent.id === mediaSectionContent.id &&
499
- !hasRTEContent(mediaSectionContent.description)
500
- ) {
501
- const newContentStyle = (
502
- newContent as ImagesSectionContent | ShapesSectionContent
503
- ).descriptionStyle;
504
-
505
- mediaSectionContent.description = getUpdatedHTMLFromEditor(
506
- externalEditor,
507
- mediaSectionContent.description,
508
- newContentStyle,
509
- );
510
- }
511
-
512
- break;
513
- case 'text':
514
- const textContent = contentItem.settings.content as TextContent;
515
-
516
- if (textContent.textItems && textContent.textItems.length > 0) {
517
- for (const [
518
- itemIndex,
519
- textItemContent,
520
- ] of textContent.textItems.entries()) {
521
- const textItemStyleType = textItemContent.textStyle.textStyleType;
522
-
523
- if (
524
- textItemStyleType &&
525
- (textItemStyleType === type || uiStyleSettingsStore)
526
- ) {
527
- let globalContentStyle = uiStyleSettingsStore
528
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
529
- textItemStyleType
530
- ].style
531
- : newStyle ?? ({} as TextStyleDeclaration);
532
-
533
- globalContentStyle = {
534
- ...globalContentStyle,
535
- textAlign: textItemContent.textStyle.textAlign,
536
- };
537
-
538
- textItemContent.text = getUpdatedHTMLFromEditor(
539
- externalEditor,
540
- textItemContent.text,
541
- globalContentStyle,
542
- );
543
- } else if (
544
- !textItemStyleType &&
545
- newContent &&
546
- newContent.id === textContent.id &&
547
- !hasRTEContent(textItemContent.text)
548
- ) {
549
- const newContentStyle =
550
- (newContent as TextContent)?.textItems?.[itemIndex]
551
- ?.textStyle ?? (newContent as TextContent).textStyle;
503
+ const fieldPairs = RTE_SECTION_FIELD_PAIRS[contentItem.type];
504
+
505
+ if (fieldPairs) {
506
+ const content = contentItem.settings.content as RTESectionContent;
507
+
508
+ for (const pair of fieldPairs) {
509
+ transformRTEField(
510
+ content,
511
+ pair,
512
+ externalEditor,
513
+ uiStyleSettingsStore,
514
+ newContent,
515
+ type,
516
+ newStyle,
517
+ );
518
+ }
519
+ }
552
520
 
553
- textItemContent.text = getUpdatedHTMLFromEditor(
554
- externalEditor,
555
- textItemContent.text,
556
- newContentStyle,
557
- );
558
- }
559
- }
560
- }
521
+ if (contentItem.type === 'text') {
522
+ const textContent = contentItem.settings.content as TextContent;
561
523
 
562
- if (
563
- (!textContent.textItems || textContent.textItems.length === 0) &&
564
- textContent.textStyle
565
- ) {
566
- const textStyleType = textContent.textStyle.textStyleType;
524
+ if (textContent.textItems && textContent.textItems.length > 0) {
525
+ for (const [
526
+ itemIndex,
527
+ textItemContent,
528
+ ] of textContent.textItems.entries()) {
529
+ const textItemStyleType = textItemContent.textStyle.textStyleType;
567
530
 
568
531
  if (
569
- textStyleType &&
570
- (textStyleType === type || uiStyleSettingsStore)
532
+ textItemStyleType &&
533
+ (textItemStyleType === type || uiStyleSettingsStore)
571
534
  ) {
572
535
  let globalContentStyle = uiStyleSettingsStore
573
536
  ? uiStyleSettingsStore.textStyles.textStyleOptions[
574
- textStyleType
537
+ textItemStyleType
575
538
  ].style
576
539
  : newStyle ?? ({} as TextStyleDeclaration);
577
540
 
578
541
  globalContentStyle = {
579
542
  ...globalContentStyle,
580
- textAlign: textContent.textStyle.textAlign,
543
+ textAlign: textItemContent.textStyle.textAlign,
581
544
  };
582
545
 
583
- textContent.text = getUpdatedHTMLFromEditor(
546
+ textItemContent.text = getUpdatedHTMLFromEditor(
584
547
  externalEditor,
585
- textContent.text,
548
+ textItemContent.text,
586
549
  globalContentStyle,
587
550
  );
588
551
  } else if (
589
- !textStyleType &&
552
+ !textItemStyleType &&
590
553
  newContent &&
591
554
  newContent.id === textContent.id &&
592
- !hasRTEContent(textContent.text)
555
+ !hasRTEContent(textItemContent.text)
593
556
  ) {
594
- const newContentStyle = (newContent as TextContent).textStyle;
557
+ const newContentStyle =
558
+ (newContent as TextContent)?.textItems?.[itemIndex]
559
+ ?.textStyle ?? (newContent as TextContent).textStyle;
595
560
 
596
- textContent.text = getUpdatedHTMLFromEditor(
561
+ textItemContent.text = getUpdatedHTMLFromEditor(
597
562
  externalEditor,
598
- textContent.text,
563
+ textItemContent.text,
599
564
  newContentStyle,
600
565
  );
601
566
  }
602
567
  }
568
+ }
603
569
 
604
- break;
605
- case 'profile':
606
- const profileContent = contentItem.settings.content as ProfileContent;
607
-
608
- const nameStyleType = profileContent.nameStyle.textStyleType;
609
- const profileTitleStyleType = profileContent.titleStyle.textStyleType;
610
- const profileDescriptionTextStyleType =
611
- profileContent.descriptionStyle.textStyleType;
570
+ if (
571
+ (!textContent.textItems || textContent.textItems.length === 0) &&
572
+ textContent.textStyle
573
+ ) {
574
+ const textStyleType = textContent.textStyle.textStyleType;
612
575
 
613
576
  if (
614
- nameStyleType &&
615
- (nameStyleType === type || uiStyleSettingsStore)
577
+ textStyleType &&
578
+ (textStyleType === type || uiStyleSettingsStore)
616
579
  ) {
617
580
  let globalContentStyle = uiStyleSettingsStore
618
- ? uiStyleSettingsStore.textStyles.textStyleOptions[nameStyleType]
581
+ ? uiStyleSettingsStore.textStyles.textStyleOptions[textStyleType]
619
582
  .style
620
583
  : newStyle ?? ({} as TextStyleDeclaration);
621
584
 
622
585
  globalContentStyle = {
623
586
  ...globalContentStyle,
624
- textAlign: profileContent.nameStyle.textAlign,
625
- };
626
-
627
- profileContent.name = getUpdatedHTMLFromEditor(
628
- externalEditor,
629
- profileContent.name,
630
- globalContentStyle,
631
- );
632
- } else if (
633
- !nameStyleType &&
634
- newContent &&
635
- newContent.id === profileContent.id &&
636
- !hasRTEContent(profileContent.name)
637
- ) {
638
- const newContentStyle = (newContent as ProfileContent).nameStyle;
639
-
640
- profileContent.name = getUpdatedHTMLFromEditor(
641
- externalEditor,
642
- profileContent.name,
643
- newContentStyle,
644
- );
645
- }
646
-
647
- if (
648
- profileTitleStyleType &&
649
- (profileTitleStyleType === type || uiStyleSettingsStore)
650
- ) {
651
- let globalContentStyle = uiStyleSettingsStore
652
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
653
- profileTitleStyleType
654
- ].style
655
- : newStyle ?? ({} as TextStyleDeclaration);
656
-
657
- globalContentStyle = {
658
- ...globalContentStyle,
659
- textAlign: profileContent.titleStyle.textAlign,
660
- };
661
-
662
- profileContent.title = getUpdatedHTMLFromEditor(
663
- externalEditor,
664
- profileContent.title,
665
- globalContentStyle,
666
- );
667
- } else if (
668
- !profileTitleStyleType &&
669
- newContent &&
670
- newContent.id === profileContent.id &&
671
- !hasRTEContent(profileContent.title)
672
- ) {
673
- const newContentStyle = (newContent as ProfileContent).titleStyle;
674
-
675
- profileContent.title = getUpdatedHTMLFromEditor(
676
- externalEditor,
677
- profileContent.title,
678
- newContentStyle,
679
- );
680
- }
681
-
682
- if (
683
- profileDescriptionTextStyleType &&
684
- (profileDescriptionTextStyleType === type || uiStyleSettingsStore)
685
- ) {
686
- let globalContentStyle = uiStyleSettingsStore
687
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
688
- profileDescriptionTextStyleType
689
- ].style
690
- : newStyle ?? ({} as TextStyleDeclaration);
691
-
692
- globalContentStyle = {
693
- ...globalContentStyle,
694
- textAlign: profileContent.descriptionStyle.textAlign,
587
+ textAlign: textContent.textStyle.textAlign,
695
588
  };
696
589
 
697
- profileContent.description = getUpdatedHTMLFromEditor(
590
+ textContent.text = getUpdatedHTMLFromEditor(
698
591
  externalEditor,
699
- profileContent.description,
592
+ textContent.text,
700
593
  globalContentStyle,
701
594
  );
702
595
  } else if (
703
- !profileDescriptionTextStyleType &&
596
+ !textStyleType &&
704
597
  newContent &&
705
- newContent.id === profileContent.id &&
706
- !hasRTEContent(profileContent.description)
598
+ newContent.id === textContent.id &&
599
+ !hasRTEContent(textContent.text)
707
600
  ) {
708
- const newContentStyle = (newContent as ProfileContent)
709
- .descriptionStyle;
601
+ const newContentStyle = (newContent as TextContent).textStyle;
710
602
 
711
- profileContent.description = getUpdatedHTMLFromEditor(
603
+ textContent.text = getUpdatedHTMLFromEditor(
712
604
  externalEditor,
713
- profileContent.description,
605
+ textContent.text,
714
606
  newContentStyle,
715
607
  );
716
608
  }
717
-
718
- break;
719
- case 'mailing-list':
720
- const mailingListContent = contentItem.settings
721
- .content as MailingListContent;
722
-
723
- const titleStyle = mailingListContent.titleStyle;
724
-
725
- const mailingTitleStyleType = titleStyle?.textStyleType;
726
-
727
- if (
728
- mailingTitleStyleType &&
729
- (mailingTitleStyleType === type || uiStyleSettingsStore)
730
- ) {
731
- let globalContentStyle = uiStyleSettingsStore
732
- ? uiStyleSettingsStore.textStyles.textStyleOptions[
733
- mailingTitleStyleType
734
- ].style
735
- : newStyle ?? ({} as TextStyleDeclaration);
736
-
737
- globalContentStyle = {
738
- ...globalContentStyle,
739
- textAlign: titleStyle.textAlign,
740
- };
741
-
742
- mailingListContent.title = getUpdatedHTMLFromEditor(
743
- externalEditor,
744
- mailingListContent.title,
745
- globalContentStyle,
746
- );
747
- } else if (
748
- !mailingTitleStyleType &&
749
- newContent &&
750
- newContent.id === mailingListContent.id &&
751
- !hasRTEContent(mailingListContent.title)
752
- ) {
753
- const newContentStyle =
754
- (newContent as MailingListContent).titleStyle || titleStyle;
755
-
756
- mailingListContent.title = getUpdatedHTMLFromEditor(
757
- externalEditor,
758
- mailingListContent.title,
759
- newContentStyle,
760
- );
761
- }
762
-
763
- break;
609
+ }
764
610
  }
765
611
  }
766
612
  }
@@ -773,348 +619,88 @@ export const switchAllContentToRTE = (
773
619
  ) => {
774
620
  for (const page of uiPageSettingStore.pages) {
775
621
  for (const contentItem of page.contents) {
776
- switch (contentItem.type) {
777
- case 'banner-section':
778
- case 'booking-section':
779
- const sectionContent = contentItem.settings.content as
780
- | BannerSectionContent
781
- | BookingSectionContent;
782
- const titleTextStyleType = sectionContent.titleStyle.textStyleType;
783
- const descriptionTextStyleType =
784
- sectionContent.descriptionStyle.textStyleType;
785
-
786
- if (titleTextStyleType && uiStyleSettingsStore) {
787
- let globalContentStyle = uiStyleSettingsStore.textStyles
788
- .textStyleOptions[titleTextStyleType]
789
- .style as TextStyleDeclaration;
790
-
791
- globalContentStyle = {
792
- ...globalContentStyle,
793
- textAlign: sectionContent.titleStyle.textAlign,
794
- };
795
-
796
- if (!hasRTEContent(sectionContent.title))
797
- sectionContent.title = getUpdatedHTMLFromEditor(
798
- externalEditor,
799
- sectionContent.title,
800
- globalContentStyle,
801
- );
802
- } else if (
803
- !titleTextStyleType &&
804
- !hasRTEContent(sectionContent.title)
805
- ) {
806
- const newContentStyle = sectionContent.titleStyle;
807
-
808
- sectionContent.title = getUpdatedHTMLFromEditor(
809
- externalEditor,
810
- sectionContent.title,
811
- newContentStyle,
812
- );
813
- }
814
-
815
- if (descriptionTextStyleType && uiStyleSettingsStore) {
816
- let globalContentStyle = uiStyleSettingsStore.textStyles
817
- .textStyleOptions[descriptionTextStyleType]
818
- .style as TextStyleDeclaration;
819
-
820
- globalContentStyle = {
821
- ...globalContentStyle,
822
- textAlign: sectionContent.descriptionStyle.textAlign,
823
- };
824
-
825
- if (!hasRTEContent(sectionContent.description))
826
- sectionContent.description = getUpdatedHTMLFromEditor(
827
- externalEditor,
828
- sectionContent.description,
829
- globalContentStyle,
830
- );
831
- } else if (
832
- !descriptionTextStyleType &&
833
- !hasRTEContent(sectionContent.description)
834
- ) {
835
- const newContentStyle = sectionContent.descriptionStyle;
836
-
837
- sectionContent.description = getUpdatedHTMLFromEditor(
838
- externalEditor,
839
- sectionContent.description,
840
- newContentStyle,
841
- );
842
- }
843
-
844
- break;
845
- case 'images-section':
846
- case 'shapes-section':
847
- const mediaSectionContent = contentItem.settings.content as
848
- | ImagesSectionContent
849
- | ShapesSectionContent;
850
- const mediaTitleTextStyleType =
851
- mediaSectionContent.titleStyle.textStyleType;
852
- const mediaDescriptionTextStyleType =
853
- mediaSectionContent.descriptionStyle.textStyleType;
854
-
855
- if (mediaTitleTextStyleType && uiStyleSettingsStore) {
856
- let globalContentStyle = uiStyleSettingsStore.textStyles
857
- .textStyleOptions[mediaTitleTextStyleType]
858
- .style as TextStyleDeclaration;
859
-
860
- globalContentStyle = {
861
- ...globalContentStyle,
862
- textAlign: mediaSectionContent.titleStyle.textAlign,
863
- };
864
-
865
- if (!hasRTEContent(mediaSectionContent.title))
866
- mediaSectionContent.title = getUpdatedHTMLFromEditor(
867
- externalEditor,
868
- mediaSectionContent.title,
869
- globalContentStyle,
870
- );
871
- } else if (
872
- !mediaTitleTextStyleType &&
873
- !hasRTEContent(mediaSectionContent.title)
874
- ) {
875
- const newContentStyle = mediaSectionContent.titleStyle;
876
-
877
- mediaSectionContent.title = getUpdatedHTMLFromEditor(
878
- externalEditor,
879
- mediaSectionContent.title,
880
- newContentStyle,
881
- );
882
- }
883
-
884
- if (mediaDescriptionTextStyleType && uiStyleSettingsStore) {
885
- let globalContentStyle = uiStyleSettingsStore.textStyles
886
- .textStyleOptions[mediaDescriptionTextStyleType]
887
- .style as TextStyleDeclaration;
888
-
889
- globalContentStyle = {
890
- ...globalContentStyle,
891
- textAlign: mediaSectionContent.descriptionStyle.textAlign,
892
- };
893
-
894
- if (!hasRTEContent(mediaSectionContent.description))
895
- mediaSectionContent.description = getUpdatedHTMLFromEditor(
896
- externalEditor,
897
- mediaSectionContent.description,
898
- globalContentStyle,
899
- );
900
- } else if (
901
- !mediaDescriptionTextStyleType &&
902
- !hasRTEContent(mediaSectionContent.description)
903
- ) {
904
- const newContentStyle = mediaSectionContent.descriptionStyle;
622
+ const fieldPairs = RTE_SECTION_FIELD_PAIRS[contentItem.type];
905
623
 
906
- mediaSectionContent.description = getUpdatedHTMLFromEditor(
907
- externalEditor,
908
- mediaSectionContent.description,
909
- newContentStyle,
910
- );
911
- }
624
+ if (fieldPairs) {
625
+ const content = contentItem.settings.content as RTESectionContent;
912
626
 
913
- break;
914
- case 'text':
915
- const textContent = contentItem.settings.content as TextContent;
916
-
917
- if (textContent.textItems && textContent.textItems.length > 0) {
918
- for (const [
919
- itemIndex,
920
- textItemContent,
921
- ] of textContent.textItems.entries()) {
922
- const textItemStyleType = textItemContent.textStyle.textStyleType;
923
-
924
- if (textItemStyleType && uiStyleSettingsStore) {
925
- let globalContentStyle = uiStyleSettingsStore.textStyles
926
- .textStyleOptions[textItemStyleType]
927
- .style as TextStyleDeclaration;
928
-
929
- globalContentStyle = {
930
- ...globalContentStyle,
931
- textAlign: textItemContent.textStyle.textAlign,
932
- };
933
-
934
- if (!hasRTEContent(textItemContent.text))
935
- textItemContent.text = getUpdatedHTMLFromEditor(
936
- externalEditor,
937
- textItemContent.text,
938
- globalContentStyle,
939
- );
940
- } else if (
941
- !textItemStyleType &&
942
- !hasRTEContent(textItemContent.text)
943
- ) {
944
- const newContentStyle = textItemContent.textStyle;
627
+ for (const pair of fieldPairs) {
628
+ switchRTEField(content, pair, externalEditor, uiStyleSettingsStore);
629
+ }
630
+ }
945
631
 
946
- textItemContent.text = getUpdatedHTMLFromEditor(
947
- externalEditor,
948
- textItemContent.text,
949
- newContentStyle,
950
- );
951
- }
952
- }
953
- }
632
+ if (contentItem.type === 'text') {
633
+ const textContent = contentItem.settings.content as TextContent;
954
634
 
955
- if (
956
- (!textContent.textItems || textContent.textItems.length === 0) &&
957
- textContent.textStyle
958
- ) {
959
- const textStyleType = textContent.textStyle.textStyleType;
635
+ if (textContent.textItems && textContent.textItems.length > 0) {
636
+ for (const [
637
+ itemIndex,
638
+ textItemContent,
639
+ ] of textContent.textItems.entries()) {
640
+ const textItemStyleType = textItemContent.textStyle.textStyleType;
960
641
 
961
- if (textStyleType && uiStyleSettingsStore) {
642
+ if (textItemStyleType && uiStyleSettingsStore) {
962
643
  let globalContentStyle = uiStyleSettingsStore.textStyles
963
- .textStyleOptions[textStyleType].style as TextStyleDeclaration;
644
+ .textStyleOptions[textItemStyleType]
645
+ .style as TextStyleDeclaration;
964
646
 
965
647
  globalContentStyle = {
966
648
  ...globalContentStyle,
967
- textAlign: textContent.textStyle.textAlign,
649
+ textAlign: textItemContent.textStyle.textAlign,
968
650
  };
969
651
 
970
- if (!hasRTEContent(textContent.text))
971
- textContent.text = getUpdatedHTMLFromEditor(
652
+ if (!hasRTEContent(textItemContent.text))
653
+ textItemContent.text = getUpdatedHTMLFromEditor(
972
654
  externalEditor,
973
- textContent.text,
655
+ textItemContent.text,
974
656
  globalContentStyle,
975
657
  );
976
- } else if (!textStyleType && !hasRTEContent(textContent.text)) {
977
- const newContentStyle = textContent.textStyle;
658
+ } else if (
659
+ !textItemStyleType &&
660
+ !hasRTEContent(textItemContent.text)
661
+ ) {
662
+ const newContentStyle = textItemContent.textStyle;
978
663
 
979
- textContent.text = getUpdatedHTMLFromEditor(
664
+ textItemContent.text = getUpdatedHTMLFromEditor(
980
665
  externalEditor,
981
- textContent.text,
666
+ textItemContent.text,
982
667
  newContentStyle,
983
668
  );
984
669
  }
985
670
  }
671
+ }
986
672
 
987
- break;
988
- case 'profile':
989
- const profileContent = contentItem.settings.content as ProfileContent;
990
-
991
- const nameStyleType = profileContent.nameStyle.textStyleType;
992
- const profileTitleStyleType = profileContent.titleStyle.textStyleType;
993
- const profileDescriptionTextStyleType =
994
- profileContent.descriptionStyle.textStyleType;
995
-
996
- if (nameStyleType && uiStyleSettingsStore) {
997
- let globalContentStyle = uiStyleSettingsStore.textStyles
998
- .textStyleOptions[nameStyleType].style as TextStyleDeclaration;
999
-
1000
- globalContentStyle = {
1001
- ...globalContentStyle,
1002
- textAlign: profileContent.nameStyle.textAlign,
1003
- };
1004
-
1005
- if (!hasRTEContent(profileContent.name))
1006
- profileContent.name = getUpdatedHTMLFromEditor(
1007
- externalEditor,
1008
- profileContent.name,
1009
- globalContentStyle,
1010
- );
1011
- } else if (!nameStyleType && !hasRTEContent(profileContent.name)) {
1012
- const newContentStyle = profileContent.nameStyle;
1013
-
1014
- profileContent.name = getUpdatedHTMLFromEditor(
1015
- externalEditor,
1016
- profileContent.name,
1017
- newContentStyle,
1018
- );
1019
- }
1020
-
1021
- if (profileTitleStyleType && uiStyleSettingsStore) {
1022
- let globalContentStyle = uiStyleSettingsStore.textStyles
1023
- .textStyleOptions[profileTitleStyleType]
1024
- .style as TextStyleDeclaration;
1025
-
1026
- globalContentStyle = {
1027
- ...globalContentStyle,
1028
- textAlign: profileContent.titleStyle.textAlign,
1029
- };
1030
-
1031
- if (!hasRTEContent(profileContent.title))
1032
- profileContent.title = getUpdatedHTMLFromEditor(
1033
- externalEditor,
1034
- profileContent.title,
1035
- globalContentStyle,
1036
- );
1037
- } else if (
1038
- !profileTitleStyleType &&
1039
- !hasRTEContent(profileContent.title)
1040
- ) {
1041
- const newContentStyle = profileContent.titleStyle;
1042
-
1043
- profileContent.title = getUpdatedHTMLFromEditor(
1044
- externalEditor,
1045
- profileContent.title,
1046
- newContentStyle,
1047
- );
1048
- }
1049
-
1050
- if (profileDescriptionTextStyleType && uiStyleSettingsStore) {
1051
- let globalContentStyle = uiStyleSettingsStore.textStyles
1052
- .textStyleOptions[profileDescriptionTextStyleType]
1053
- .style as TextStyleDeclaration;
1054
-
1055
- globalContentStyle = {
1056
- ...globalContentStyle,
1057
- textAlign: profileContent.descriptionStyle.textAlign,
1058
- };
1059
-
1060
- if (!hasRTEContent(profileContent.description))
1061
- profileContent.description = getUpdatedHTMLFromEditor(
1062
- externalEditor,
1063
- profileContent.description,
1064
- globalContentStyle,
1065
- );
1066
- } else if (
1067
- !profileDescriptionTextStyleType &&
1068
- !hasRTEContent(profileContent.description)
1069
- ) {
1070
- const newContentStyle = profileContent.descriptionStyle;
1071
-
1072
- profileContent.description = getUpdatedHTMLFromEditor(
1073
- externalEditor,
1074
- profileContent.description,
1075
- newContentStyle,
1076
- );
1077
- }
1078
-
1079
- break;
1080
- case 'mailing-list':
1081
- const mailingListContent = contentItem.settings
1082
- .content as MailingListContent;
1083
-
1084
- const titleStyle = mailingListContent.titleStyle;
1085
-
1086
- const titleStyleStyleType = titleStyle?.textStyleType;
673
+ if (
674
+ (!textContent.textItems || textContent.textItems.length === 0) &&
675
+ textContent.textStyle
676
+ ) {
677
+ const textStyleType = textContent.textStyle.textStyleType;
1087
678
 
1088
- if (titleStyleStyleType && uiStyleSettingsStore) {
679
+ if (textStyleType && uiStyleSettingsStore) {
1089
680
  let globalContentStyle = uiStyleSettingsStore.textStyles
1090
- .textStyleOptions[titleStyleStyleType]
1091
- .style as TextStyleDeclaration;
681
+ .textStyleOptions[textStyleType].style as TextStyleDeclaration;
1092
682
 
1093
683
  globalContentStyle = {
1094
684
  ...globalContentStyle,
1095
- textAlign: mailingListContent.titleStyle.textAlign,
685
+ textAlign: textContent.textStyle.textAlign,
1096
686
  };
1097
687
 
1098
- if (!hasRTEContent(mailingListContent.title))
1099
- mailingListContent.title = getUpdatedHTMLFromEditor(
688
+ if (!hasRTEContent(textContent.text))
689
+ textContent.text = getUpdatedHTMLFromEditor(
1100
690
  externalEditor,
1101
- mailingListContent.title,
691
+ textContent.text,
1102
692
  globalContentStyle,
1103
693
  );
1104
- } else if (
1105
- !titleStyleStyleType &&
1106
- !hasRTEContent(mailingListContent.title)
1107
- ) {
1108
- const newContentStyle = mailingListContent.titleStyle;
694
+ } else if (!textStyleType && !hasRTEContent(textContent.text)) {
695
+ const newContentStyle = textContent.textStyle;
1109
696
 
1110
- mailingListContent.title = getUpdatedHTMLFromEditor(
697
+ textContent.text = getUpdatedHTMLFromEditor(
1111
698
  externalEditor,
1112
- mailingListContent.title,
699
+ textContent.text,
1113
700
  newContentStyle,
1114
701
  );
1115
702
  }
1116
-
1117
- break;
703
+ }
1118
704
  }
1119
705
  }
1120
706
  }
@@ -1125,6 +711,10 @@ export const getUpdatedHTMLFromEditor = (
1125
711
  contentText: string,
1126
712
  newContentStyle: TextStyleDeclaration,
1127
713
  ) => {
714
+ if (!contentText) {
715
+ return contentText;
716
+ }
717
+
1128
718
  const content = contentText.includes(ESCAPED_NEWLINE_CHARACTER)
1129
719
  ? getRenderText(contentText)
1130
720
  : contentText;
@@ -1234,7 +824,7 @@ export const buildInitialMarks = (
1234
824
  }
1235
825
 
1236
826
  // Bold and italic
1237
- if (fontWeight) {
827
+ if (fontWeight === 'bold') {
1238
828
  marks.push(state.schema.marks.bold.create());
1239
829
  }
1240
830