@designcrowd/library.brand-page 5.17.22 → 5.17.23-ast-bugs
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-CE3q_ouk.js → CreatedOnBrandCrowd-de-de-CDAxjKt-.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-YmCINEd2.js → CreatedOnBrandCrowd-en-us-DkA_TUjP.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-po716FZh.js → CreatedOnBrandCrowd-es-es-BYpg9xvN.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-DgSeh7zq.js → CreatedOnBrandCrowd-fr-ca-C8hTipTz.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-DgSeh7zq.js → CreatedOnBrandCrowd-fr-fr-C8hTipTz.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-BY3I3OVc.js → CreatedOnBrandCrowd-pt-br-G8yyoNtI.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-BY3I3OVc.js → CreatedOnBrandCrowd-pt-pt-G8yyoNtI.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-VF__9AH9.js → CreatedOnDcom-de-de-DyaUv6JA.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-B653tDEJ.js → CreatedOnDcom-en-us-DpGsEh5B.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-Cc3g0BMj.js → CreatedOnDcom-es-es-BiOgNsAu.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-NzxsUZqx.js → CreatedOnDcom-fr-ca-tg_w97_1.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-DFuj0umw.js → CreatedOnDcom-fr-fr-CwqXK1VU.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-VxpFX1Jd.js → CreatedOnDcom-pt-br-B4QG_xx7.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-CG2qMIlw.js → CreatedOnDcom-pt-pt-CD2m6NMT.js} +1 -1
- package/lib/src/brand-page/components/banner-section/BannerSection.mixin.d.ts +1 -1
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.d.ts +1 -0
- package/lib/src/brand-page/components/contact-form/ContactForm.mixin.js +20 -2
- package/lib/src/brand-page/models/index.d.ts +1 -1
- package/lib/src/brand-page/utils/migration/migration-14.d.ts +2 -0
- package/lib/src/brand-page/utils/migration/migration-14.js +16 -0
- package/lib/src/brand-page/utils/migration.util.js +6 -0
- package/lib/src/brand-page/utils/style.util.js +8 -1
- package/lib/src/brand-page/utils/text.util.d.ts +2 -0
- package/lib/src/brand-page/utils/text.util.js +21 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.d.ts +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -1
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-site-template.examples.js +1 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -1
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +1 -10
- package/lib/src/brand-page-maker/models/content-settings-configs.d.ts +5 -0
- package/lib/src/brand-page-maker/models/content-settings.js +3 -0
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +170 -388
- package/lib/src/css/library.brand-page-brandCrowd.min.css +89 -86
- package/lib/src/css/library.brand-page-brandPage.min.css +89 -86
- package/lib/src/css/library.brand-page-designCom.min.css +89 -86
- package/lib/src/css/library.brand-page-preview.min.css +89 -86
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-DO1Zk3d3.js → lib-CFEFnrUm.js} +24167 -24368
- package/lib/src/metadata-builder/builders/section-field-maps.js +1 -0
- package/lib/src/metadata-builder/builders/section-field-utils.js +5 -0
- package/lib/src/metadata-builder/helpers/rte.helpers.js +3 -0
- package/lib/src/shared/content-settings/components/GenericTextInput.mixin.js +10 -5
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.js +2 -1
- package/lib/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.js +3 -3
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.d.ts +1 -0
- package/lib/src/shared/style-settings/components/StyleSettings.mixin.js +8 -0
- package/package.json +1 -1
- package/src/brand-page/components/about-section/AboutSection.vue +63 -6
- package/src/brand-page/components/collapsible/Collapsible.vue +8 -2
- package/src/brand-page/components/contact-form/ContactForm.mixin.ts +21 -2
- package/src/brand-page/components/contact-form/ContactForm.vue +15 -15
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +5 -1
- package/src/brand-page/models/index.ts +1 -1
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +3 -3
- package/src/brand-page/utils/migration/migration-14.ts +23 -0
- package/src/brand-page/utils/migration.util.ts +7 -0
- package/src/brand-page/utils/style.util.ts +8 -1
- package/src/brand-page/utils/text.util.ts +26 -1
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -1
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-site-template.examples.ts +1 -1
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +9 -1
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -1
- package/src/brand-page-maker/constants/config-settings-constant.ts +1 -10
- package/src/brand-page-maker/models/content-settings-configs.ts +6 -0
- package/src/brand-page-maker/models/content-settings.ts +3 -0
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +274 -684
- package/src/metadata-builder/builders/section-field-maps.ts +1 -0
- package/src/metadata-builder/builders/section-field-utils.ts +5 -0
- package/src/metadata-builder/helpers/rte.helpers.ts +4 -0
- package/src/shared/content-settings/components/GenericTextInput.mixin.ts +16 -5
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.ts +2 -1
- package/src/shared/content-settings/components/testimonial-items-field/TestimonialItemsField.vue +3 -1
- package/src/shared/content-settings/components/text-items-field/TextItemsField.mixin.ts +3 -3
- package/src/shared/style-settings/components/StyleSettings.mixin.ts +11 -0
- package/src/shared/style-settings/components/StyleSettings.vue +1 -1
- package/lib/src/brand-page/components/about-section/AboutSection.mixin.d.ts +0 -83
- package/lib/src/brand-page/components/about-section/AboutSection.mixin.js +0 -65
- package/src/brand-page/components/about-section/AboutSection.mixin.ts +0 -78
|
@@ -3,14 +3,57 @@ import { ESCAPED_NEWLINE_CHARACTER } from '@src/constants/ui';
|
|
|
3
3
|
import { getRenderText } from '@brand-page/utils';
|
|
4
4
|
import createDomPurify, {} from 'dompurify';
|
|
5
5
|
import { isHrefPageId } from '../composables/rich-text-editor/hyperlink';
|
|
6
|
+
const RTE_SECTION_FIELD_PAIRS = {
|
|
7
|
+
'banner-section': [
|
|
8
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
9
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
10
|
+
],
|
|
11
|
+
'booking-section': [
|
|
12
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
13
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
14
|
+
],
|
|
15
|
+
'images-section': [
|
|
16
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
17
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
18
|
+
],
|
|
19
|
+
'shapes-section': [
|
|
20
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
21
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
22
|
+
],
|
|
23
|
+
'mailing-list': [{ textField: 'title', styleField: 'titleStyle' }],
|
|
24
|
+
profile: [
|
|
25
|
+
{ textField: 'name', styleField: 'nameStyle' },
|
|
26
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
27
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
28
|
+
],
|
|
29
|
+
'contact-form': [
|
|
30
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
31
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
32
|
+
{ textField: 'successMessage', styleField: 'successMessageStyle' },
|
|
33
|
+
],
|
|
34
|
+
'about-section': [
|
|
35
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
36
|
+
{ textField: 'paragraph', styleField: 'paragraphStyle' },
|
|
37
|
+
],
|
|
38
|
+
'testimonial-section': [{ textField: 'title', styleField: 'titleStyle' }],
|
|
39
|
+
'social-links': [{ textField: 'title', styleField: 'titleStyle' }],
|
|
40
|
+
'request-payment': [
|
|
41
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
42
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
43
|
+
],
|
|
44
|
+
'support-me': [
|
|
45
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
46
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
47
|
+
],
|
|
48
|
+
'shop-section': [
|
|
49
|
+
{ textField: 'title', styleField: 'titleStyle' },
|
|
50
|
+
{ textField: 'description', styleField: 'descriptionStyle' },
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
// 'text' has special textItems handling, so it's not in the map but is RTE-enabled
|
|
6
54
|
export const RTE_ALLOWED_SECTION_TYPES = [
|
|
7
|
-
|
|
55
|
+
...Object.keys(RTE_SECTION_FIELD_PAIRS),
|
|
8
56
|
'text',
|
|
9
|
-
'booking-section',
|
|
10
|
-
'images-section',
|
|
11
|
-
'shapes-section',
|
|
12
|
-
'mailing-list',
|
|
13
|
-
'profile',
|
|
14
57
|
];
|
|
15
58
|
// Only allow tags used by the enabled Tiptap extensions
|
|
16
59
|
const allowedTags = [
|
|
@@ -256,229 +299,110 @@ export const replaceTextInRTE = (existingHtml, newText) => {
|
|
|
256
299
|
blockElement.appendChild(newSpan);
|
|
257
300
|
return tempDiv.innerHTML;
|
|
258
301
|
};
|
|
302
|
+
const transformRTEField = (content, pair, externalEditor, uiStyleSettingsStore, newContent, type, newStyle) => {
|
|
303
|
+
const fields = content;
|
|
304
|
+
const style = fields[pair.styleField];
|
|
305
|
+
const textStyleType = style?.textStyleType;
|
|
306
|
+
if (textStyleType && (textStyleType === type || uiStyleSettingsStore)) {
|
|
307
|
+
let globalContentStyle = uiStyleSettingsStore
|
|
308
|
+
? uiStyleSettingsStore.textStyles.textStyleOptions[textStyleType].style
|
|
309
|
+
: newStyle ?? {};
|
|
310
|
+
globalContentStyle = {
|
|
311
|
+
...globalContentStyle,
|
|
312
|
+
textAlign: style?.textAlign,
|
|
313
|
+
};
|
|
314
|
+
fields[pair.textField] = getUpdatedHTMLFromEditor(externalEditor, fields[pair.textField], globalContentStyle);
|
|
315
|
+
}
|
|
316
|
+
else if (!textStyleType &&
|
|
317
|
+
newContent &&
|
|
318
|
+
newContent.id === content.id &&
|
|
319
|
+
!hasRTEContent(fields[pair.textField])) {
|
|
320
|
+
const newContentFields = newContent;
|
|
321
|
+
const newContentStyle = newContentFields[pair.styleField] ||
|
|
322
|
+
style;
|
|
323
|
+
if (newContentStyle) {
|
|
324
|
+
fields[pair.textField] = getUpdatedHTMLFromEditor(externalEditor, fields[pair.textField], newContentStyle);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const switchRTEField = (content, pair, externalEditor, uiStyleSettingsStore) => {
|
|
329
|
+
const fields = content;
|
|
330
|
+
const style = fields[pair.styleField];
|
|
331
|
+
const textStyleType = style?.textStyleType;
|
|
332
|
+
if (textStyleType && uiStyleSettingsStore) {
|
|
333
|
+
let globalContentStyle = uiStyleSettingsStore.textStyles.textStyleOptions[textStyleType].style;
|
|
334
|
+
globalContentStyle = {
|
|
335
|
+
...globalContentStyle,
|
|
336
|
+
textAlign: style?.textAlign,
|
|
337
|
+
};
|
|
338
|
+
if (!hasRTEContent(fields[pair.textField]))
|
|
339
|
+
fields[pair.textField] = getUpdatedHTMLFromEditor(externalEditor, fields[pair.textField], globalContentStyle);
|
|
340
|
+
}
|
|
341
|
+
else if (!textStyleType &&
|
|
342
|
+
style &&
|
|
343
|
+
!hasRTEContent(fields[pair.textField])) {
|
|
344
|
+
fields[pair.textField] = getUpdatedHTMLFromEditor(externalEditor, fields[pair.textField], style);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
259
347
|
export const transformToRTE = (uiPageSettingStore, externalEditor, uiStyleSettingsStore, newContent, type, newStyle) => {
|
|
260
348
|
for (const page of uiPageSettingStore.pages) {
|
|
261
349
|
for (const contentItem of page.contents) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
};
|
|
277
|
-
sectionContent.title = getUpdatedHTMLFromEditor(externalEditor, sectionContent.title, globalContentStyle);
|
|
278
|
-
}
|
|
279
|
-
else if (!titleTextStyleType &&
|
|
280
|
-
newContent &&
|
|
281
|
-
newContent.id === sectionContent.id &&
|
|
282
|
-
!hasRTEContent(sectionContent.title)) {
|
|
283
|
-
const newContentStyle = newContent.titleStyle;
|
|
284
|
-
sectionContent.title = getUpdatedHTMLFromEditor(externalEditor, sectionContent.title, newContentStyle);
|
|
285
|
-
}
|
|
286
|
-
if (descriptionTextStyleType &&
|
|
287
|
-
(descriptionTextStyleType === type || uiStyleSettingsStore)) {
|
|
288
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
289
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[descriptionTextStyleType].style
|
|
290
|
-
: newStyle ?? {};
|
|
291
|
-
globalContentStyle = {
|
|
292
|
-
...globalContentStyle,
|
|
293
|
-
textAlign: sectionContent.descriptionStyle.textAlign,
|
|
294
|
-
};
|
|
295
|
-
sectionContent.description = getUpdatedHTMLFromEditor(externalEditor, sectionContent.description, globalContentStyle);
|
|
296
|
-
}
|
|
297
|
-
else if (!descriptionTextStyleType &&
|
|
298
|
-
newContent &&
|
|
299
|
-
newContent.id === sectionContent.id &&
|
|
300
|
-
!hasRTEContent(sectionContent.description)) {
|
|
301
|
-
const newContentStyle = newContent.descriptionStyle;
|
|
302
|
-
sectionContent.description = getUpdatedHTMLFromEditor(externalEditor, sectionContent.description, newContentStyle);
|
|
303
|
-
}
|
|
304
|
-
break;
|
|
305
|
-
case 'images-section':
|
|
306
|
-
case 'shapes-section':
|
|
307
|
-
const mediaSectionContent = contentItem.settings.content;
|
|
308
|
-
const mediaTitleTextStyleType = mediaSectionContent.titleStyle.textStyleType;
|
|
309
|
-
const mediaDescriptionTextStyleType = mediaSectionContent.descriptionStyle.textStyleType;
|
|
310
|
-
if (mediaTitleTextStyleType &&
|
|
311
|
-
(mediaTitleTextStyleType === type || uiStyleSettingsStore)) {
|
|
312
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
313
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[mediaTitleTextStyleType].style
|
|
314
|
-
: newStyle ?? {};
|
|
315
|
-
globalContentStyle = {
|
|
316
|
-
...globalContentStyle,
|
|
317
|
-
textAlign: mediaSectionContent.titleStyle.textAlign,
|
|
318
|
-
};
|
|
319
|
-
mediaSectionContent.title = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.title, globalContentStyle);
|
|
320
|
-
}
|
|
321
|
-
else if (!mediaTitleTextStyleType &&
|
|
322
|
-
newContent &&
|
|
323
|
-
newContent.id === mediaSectionContent.id &&
|
|
324
|
-
!hasRTEContent(mediaSectionContent.title)) {
|
|
325
|
-
const newContentStyle = newContent.titleStyle;
|
|
326
|
-
mediaSectionContent.title = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.title, newContentStyle);
|
|
327
|
-
}
|
|
328
|
-
if (mediaDescriptionTextStyleType &&
|
|
329
|
-
(mediaDescriptionTextStyleType === type || uiStyleSettingsStore)) {
|
|
330
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
331
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[mediaDescriptionTextStyleType].style
|
|
332
|
-
: newStyle ?? {};
|
|
333
|
-
globalContentStyle = {
|
|
334
|
-
...globalContentStyle,
|
|
335
|
-
textAlign: mediaSectionContent.descriptionStyle.textAlign,
|
|
336
|
-
};
|
|
337
|
-
mediaSectionContent.description = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.description, globalContentStyle);
|
|
338
|
-
}
|
|
339
|
-
else if (!mediaDescriptionTextStyleType &&
|
|
340
|
-
newContent &&
|
|
341
|
-
newContent.id === mediaSectionContent.id &&
|
|
342
|
-
!hasRTEContent(mediaSectionContent.description)) {
|
|
343
|
-
const newContentStyle = newContent.descriptionStyle;
|
|
344
|
-
mediaSectionContent.description = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.description, newContentStyle);
|
|
345
|
-
}
|
|
346
|
-
break;
|
|
347
|
-
case 'text':
|
|
348
|
-
const textContent = contentItem.settings.content;
|
|
349
|
-
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
350
|
-
for (const [itemIndex, textItemContent,] of textContent.textItems.entries()) {
|
|
351
|
-
const textItemStyleType = textItemContent.textStyle.textStyleType;
|
|
352
|
-
if (textItemStyleType &&
|
|
353
|
-
(textItemStyleType === type || uiStyleSettingsStore)) {
|
|
354
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
355
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[textItemStyleType].style
|
|
356
|
-
: newStyle ?? {};
|
|
357
|
-
globalContentStyle = {
|
|
358
|
-
...globalContentStyle,
|
|
359
|
-
textAlign: textItemContent.textStyle.textAlign,
|
|
360
|
-
};
|
|
361
|
-
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, globalContentStyle);
|
|
362
|
-
}
|
|
363
|
-
else if (!textItemStyleType &&
|
|
364
|
-
newContent &&
|
|
365
|
-
newContent.id === textContent.id &&
|
|
366
|
-
!hasRTEContent(textItemContent.text)) {
|
|
367
|
-
const newContentStyle = newContent?.textItems?.[itemIndex]
|
|
368
|
-
?.textStyle ?? newContent.textStyle;
|
|
369
|
-
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, newContentStyle);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
if ((!textContent.textItems || textContent.textItems.length === 0) &&
|
|
374
|
-
textContent.textStyle) {
|
|
375
|
-
const textStyleType = textContent.textStyle.textStyleType;
|
|
376
|
-
if (textStyleType &&
|
|
377
|
-
(textStyleType === type || uiStyleSettingsStore)) {
|
|
350
|
+
const fieldPairs = RTE_SECTION_FIELD_PAIRS[contentItem.type];
|
|
351
|
+
if (fieldPairs) {
|
|
352
|
+
const content = contentItem.settings.content;
|
|
353
|
+
for (const pair of fieldPairs) {
|
|
354
|
+
transformRTEField(content, pair, externalEditor, uiStyleSettingsStore, newContent, type, newStyle);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (contentItem.type === 'text') {
|
|
358
|
+
const textContent = contentItem.settings.content;
|
|
359
|
+
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
360
|
+
for (const [itemIndex, textItemContent,] of textContent.textItems.entries()) {
|
|
361
|
+
const textItemStyleType = textItemContent.textStyle.textStyleType;
|
|
362
|
+
if (textItemStyleType &&
|
|
363
|
+
(textItemStyleType === type || uiStyleSettingsStore)) {
|
|
378
364
|
let globalContentStyle = uiStyleSettingsStore
|
|
379
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[
|
|
365
|
+
? uiStyleSettingsStore.textStyles.textStyleOptions[textItemStyleType].style
|
|
380
366
|
: newStyle ?? {};
|
|
381
367
|
globalContentStyle = {
|
|
382
368
|
...globalContentStyle,
|
|
383
|
-
textAlign:
|
|
369
|
+
textAlign: textItemContent.textStyle.textAlign,
|
|
384
370
|
};
|
|
385
|
-
|
|
371
|
+
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, globalContentStyle);
|
|
386
372
|
}
|
|
387
|
-
else if (!
|
|
373
|
+
else if (!textItemStyleType &&
|
|
388
374
|
newContent &&
|
|
389
375
|
newContent.id === textContent.id &&
|
|
390
|
-
!hasRTEContent(
|
|
391
|
-
const newContentStyle = newContent
|
|
392
|
-
|
|
376
|
+
!hasRTEContent(textItemContent.text)) {
|
|
377
|
+
const newContentStyle = newContent?.textItems?.[itemIndex]
|
|
378
|
+
?.textStyle ?? newContent.textStyle;
|
|
379
|
+
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, newContentStyle);
|
|
393
380
|
}
|
|
394
381
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
if (nameStyleType &&
|
|
402
|
-
(nameStyleType === type || uiStyleSettingsStore)) {
|
|
382
|
+
}
|
|
383
|
+
if ((!textContent.textItems || textContent.textItems.length === 0) &&
|
|
384
|
+
textContent.textStyle) {
|
|
385
|
+
const textStyleType = textContent.textStyle.textStyleType;
|
|
386
|
+
if (textStyleType &&
|
|
387
|
+
(textStyleType === type || uiStyleSettingsStore)) {
|
|
403
388
|
let globalContentStyle = uiStyleSettingsStore
|
|
404
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[
|
|
389
|
+
? uiStyleSettingsStore.textStyles.textStyleOptions[textStyleType]
|
|
405
390
|
.style
|
|
406
391
|
: newStyle ?? {};
|
|
407
392
|
globalContentStyle = {
|
|
408
393
|
...globalContentStyle,
|
|
409
|
-
textAlign:
|
|
410
|
-
};
|
|
411
|
-
profileContent.name = getUpdatedHTMLFromEditor(externalEditor, profileContent.name, globalContentStyle);
|
|
412
|
-
}
|
|
413
|
-
else if (!nameStyleType &&
|
|
414
|
-
newContent &&
|
|
415
|
-
newContent.id === profileContent.id &&
|
|
416
|
-
!hasRTEContent(profileContent.name)) {
|
|
417
|
-
const newContentStyle = newContent.nameStyle;
|
|
418
|
-
profileContent.name = getUpdatedHTMLFromEditor(externalEditor, profileContent.name, newContentStyle);
|
|
419
|
-
}
|
|
420
|
-
if (profileTitleStyleType &&
|
|
421
|
-
(profileTitleStyleType === type || uiStyleSettingsStore)) {
|
|
422
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
423
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[profileTitleStyleType].style
|
|
424
|
-
: newStyle ?? {};
|
|
425
|
-
globalContentStyle = {
|
|
426
|
-
...globalContentStyle,
|
|
427
|
-
textAlign: profileContent.titleStyle.textAlign,
|
|
428
|
-
};
|
|
429
|
-
profileContent.title = getUpdatedHTMLFromEditor(externalEditor, profileContent.title, globalContentStyle);
|
|
430
|
-
}
|
|
431
|
-
else if (!profileTitleStyleType &&
|
|
432
|
-
newContent &&
|
|
433
|
-
newContent.id === profileContent.id &&
|
|
434
|
-
!hasRTEContent(profileContent.title)) {
|
|
435
|
-
const newContentStyle = newContent.titleStyle;
|
|
436
|
-
profileContent.title = getUpdatedHTMLFromEditor(externalEditor, profileContent.title, newContentStyle);
|
|
437
|
-
}
|
|
438
|
-
if (profileDescriptionTextStyleType &&
|
|
439
|
-
(profileDescriptionTextStyleType === type || uiStyleSettingsStore)) {
|
|
440
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
441
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[profileDescriptionTextStyleType].style
|
|
442
|
-
: newStyle ?? {};
|
|
443
|
-
globalContentStyle = {
|
|
444
|
-
...globalContentStyle,
|
|
445
|
-
textAlign: profileContent.descriptionStyle.textAlign,
|
|
394
|
+
textAlign: textContent.textStyle.textAlign,
|
|
446
395
|
};
|
|
447
|
-
|
|
396
|
+
textContent.text = getUpdatedHTMLFromEditor(externalEditor, textContent.text, globalContentStyle);
|
|
448
397
|
}
|
|
449
|
-
else if (!
|
|
398
|
+
else if (!textStyleType &&
|
|
450
399
|
newContent &&
|
|
451
|
-
newContent.id ===
|
|
452
|
-
!hasRTEContent(
|
|
453
|
-
const newContentStyle = newContent
|
|
454
|
-
|
|
455
|
-
profileContent.description = getUpdatedHTMLFromEditor(externalEditor, profileContent.description, newContentStyle);
|
|
400
|
+
newContent.id === textContent.id &&
|
|
401
|
+
!hasRTEContent(textContent.text)) {
|
|
402
|
+
const newContentStyle = newContent.textStyle;
|
|
403
|
+
textContent.text = getUpdatedHTMLFromEditor(externalEditor, textContent.text, newContentStyle);
|
|
456
404
|
}
|
|
457
|
-
|
|
458
|
-
case 'mailing-list':
|
|
459
|
-
const mailingListContent = contentItem.settings
|
|
460
|
-
.content;
|
|
461
|
-
const titleStyle = mailingListContent.titleStyle;
|
|
462
|
-
const mailingTitleStyleType = titleStyle?.textStyleType;
|
|
463
|
-
if (mailingTitleStyleType &&
|
|
464
|
-
(mailingTitleStyleType === type || uiStyleSettingsStore)) {
|
|
465
|
-
let globalContentStyle = uiStyleSettingsStore
|
|
466
|
-
? uiStyleSettingsStore.textStyles.textStyleOptions[mailingTitleStyleType].style
|
|
467
|
-
: newStyle ?? {};
|
|
468
|
-
globalContentStyle = {
|
|
469
|
-
...globalContentStyle,
|
|
470
|
-
textAlign: titleStyle.textAlign,
|
|
471
|
-
};
|
|
472
|
-
mailingListContent.title = getUpdatedHTMLFromEditor(externalEditor, mailingListContent.title, globalContentStyle);
|
|
473
|
-
}
|
|
474
|
-
else if (!mailingTitleStyleType &&
|
|
475
|
-
newContent &&
|
|
476
|
-
newContent.id === mailingListContent.id &&
|
|
477
|
-
!hasRTEContent(mailingListContent.title)) {
|
|
478
|
-
const newContentStyle = newContent.titleStyle || titleStyle;
|
|
479
|
-
mailingListContent.title = getUpdatedHTMLFromEditor(externalEditor, mailingListContent.title, newContentStyle);
|
|
480
|
-
}
|
|
481
|
-
break;
|
|
405
|
+
}
|
|
482
406
|
}
|
|
483
407
|
}
|
|
484
408
|
}
|
|
@@ -486,204 +410,62 @@ export const transformToRTE = (uiPageSettingStore, externalEditor, uiStyleSettin
|
|
|
486
410
|
export const switchAllContentToRTE = (uiPageSettingStore, externalEditor, uiStyleSettingsStore) => {
|
|
487
411
|
for (const page of uiPageSettingStore.pages) {
|
|
488
412
|
for (const contentItem of page.contents) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
};
|
|
503
|
-
if (!hasRTEContent(sectionContent.title))
|
|
504
|
-
sectionContent.title = getUpdatedHTMLFromEditor(externalEditor, sectionContent.title, globalContentStyle);
|
|
505
|
-
}
|
|
506
|
-
else if (!titleTextStyleType &&
|
|
507
|
-
!hasRTEContent(sectionContent.title)) {
|
|
508
|
-
const newContentStyle = sectionContent.titleStyle;
|
|
509
|
-
sectionContent.title = getUpdatedHTMLFromEditor(externalEditor, sectionContent.title, newContentStyle);
|
|
510
|
-
}
|
|
511
|
-
if (descriptionTextStyleType && uiStyleSettingsStore) {
|
|
512
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
513
|
-
.textStyleOptions[descriptionTextStyleType]
|
|
514
|
-
.style;
|
|
515
|
-
globalContentStyle = {
|
|
516
|
-
...globalContentStyle,
|
|
517
|
-
textAlign: sectionContent.descriptionStyle.textAlign,
|
|
518
|
-
};
|
|
519
|
-
if (!hasRTEContent(sectionContent.description))
|
|
520
|
-
sectionContent.description = getUpdatedHTMLFromEditor(externalEditor, sectionContent.description, globalContentStyle);
|
|
521
|
-
}
|
|
522
|
-
else if (!descriptionTextStyleType &&
|
|
523
|
-
!hasRTEContent(sectionContent.description)) {
|
|
524
|
-
const newContentStyle = sectionContent.descriptionStyle;
|
|
525
|
-
sectionContent.description = getUpdatedHTMLFromEditor(externalEditor, sectionContent.description, newContentStyle);
|
|
526
|
-
}
|
|
527
|
-
break;
|
|
528
|
-
case 'images-section':
|
|
529
|
-
case 'shapes-section':
|
|
530
|
-
const mediaSectionContent = contentItem.settings.content;
|
|
531
|
-
const mediaTitleTextStyleType = mediaSectionContent.titleStyle.textStyleType;
|
|
532
|
-
const mediaDescriptionTextStyleType = mediaSectionContent.descriptionStyle.textStyleType;
|
|
533
|
-
if (mediaTitleTextStyleType && uiStyleSettingsStore) {
|
|
534
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
535
|
-
.textStyleOptions[mediaTitleTextStyleType]
|
|
536
|
-
.style;
|
|
537
|
-
globalContentStyle = {
|
|
538
|
-
...globalContentStyle,
|
|
539
|
-
textAlign: mediaSectionContent.titleStyle.textAlign,
|
|
540
|
-
};
|
|
541
|
-
if (!hasRTEContent(mediaSectionContent.title))
|
|
542
|
-
mediaSectionContent.title = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.title, globalContentStyle);
|
|
543
|
-
}
|
|
544
|
-
else if (!mediaTitleTextStyleType &&
|
|
545
|
-
!hasRTEContent(mediaSectionContent.title)) {
|
|
546
|
-
const newContentStyle = mediaSectionContent.titleStyle;
|
|
547
|
-
mediaSectionContent.title = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.title, newContentStyle);
|
|
548
|
-
}
|
|
549
|
-
if (mediaDescriptionTextStyleType && uiStyleSettingsStore) {
|
|
550
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
551
|
-
.textStyleOptions[mediaDescriptionTextStyleType]
|
|
552
|
-
.style;
|
|
553
|
-
globalContentStyle = {
|
|
554
|
-
...globalContentStyle,
|
|
555
|
-
textAlign: mediaSectionContent.descriptionStyle.textAlign,
|
|
556
|
-
};
|
|
557
|
-
if (!hasRTEContent(mediaSectionContent.description))
|
|
558
|
-
mediaSectionContent.description = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.description, globalContentStyle);
|
|
559
|
-
}
|
|
560
|
-
else if (!mediaDescriptionTextStyleType &&
|
|
561
|
-
!hasRTEContent(mediaSectionContent.description)) {
|
|
562
|
-
const newContentStyle = mediaSectionContent.descriptionStyle;
|
|
563
|
-
mediaSectionContent.description = getUpdatedHTMLFromEditor(externalEditor, mediaSectionContent.description, newContentStyle);
|
|
564
|
-
}
|
|
565
|
-
break;
|
|
566
|
-
case 'text':
|
|
567
|
-
const textContent = contentItem.settings.content;
|
|
568
|
-
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
569
|
-
for (const [itemIndex, textItemContent,] of textContent.textItems.entries()) {
|
|
570
|
-
const textItemStyleType = textItemContent.textStyle.textStyleType;
|
|
571
|
-
if (textItemStyleType && uiStyleSettingsStore) {
|
|
572
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
573
|
-
.textStyleOptions[textItemStyleType]
|
|
574
|
-
.style;
|
|
575
|
-
globalContentStyle = {
|
|
576
|
-
...globalContentStyle,
|
|
577
|
-
textAlign: textItemContent.textStyle.textAlign,
|
|
578
|
-
};
|
|
579
|
-
if (!hasRTEContent(textItemContent.text))
|
|
580
|
-
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, globalContentStyle);
|
|
581
|
-
}
|
|
582
|
-
else if (!textItemStyleType &&
|
|
583
|
-
!hasRTEContent(textItemContent.text)) {
|
|
584
|
-
const newContentStyle = textItemContent.textStyle;
|
|
585
|
-
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, newContentStyle);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
if ((!textContent.textItems || textContent.textItems.length === 0) &&
|
|
590
|
-
textContent.textStyle) {
|
|
591
|
-
const textStyleType = textContent.textStyle.textStyleType;
|
|
592
|
-
if (textStyleType && uiStyleSettingsStore) {
|
|
413
|
+
const fieldPairs = RTE_SECTION_FIELD_PAIRS[contentItem.type];
|
|
414
|
+
if (fieldPairs) {
|
|
415
|
+
const content = contentItem.settings.content;
|
|
416
|
+
for (const pair of fieldPairs) {
|
|
417
|
+
switchRTEField(content, pair, externalEditor, uiStyleSettingsStore);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (contentItem.type === 'text') {
|
|
421
|
+
const textContent = contentItem.settings.content;
|
|
422
|
+
if (textContent.textItems && textContent.textItems.length > 0) {
|
|
423
|
+
for (const [itemIndex, textItemContent,] of textContent.textItems.entries()) {
|
|
424
|
+
const textItemStyleType = textItemContent.textStyle.textStyleType;
|
|
425
|
+
if (textItemStyleType && uiStyleSettingsStore) {
|
|
593
426
|
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
594
|
-
.textStyleOptions[
|
|
427
|
+
.textStyleOptions[textItemStyleType]
|
|
428
|
+
.style;
|
|
595
429
|
globalContentStyle = {
|
|
596
430
|
...globalContentStyle,
|
|
597
|
-
textAlign:
|
|
431
|
+
textAlign: textItemContent.textStyle.textAlign,
|
|
598
432
|
};
|
|
599
|
-
if (!hasRTEContent(
|
|
600
|
-
|
|
433
|
+
if (!hasRTEContent(textItemContent.text))
|
|
434
|
+
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, globalContentStyle);
|
|
601
435
|
}
|
|
602
|
-
else if (!
|
|
603
|
-
|
|
604
|
-
|
|
436
|
+
else if (!textItemStyleType &&
|
|
437
|
+
!hasRTEContent(textItemContent.text)) {
|
|
438
|
+
const newContentStyle = textItemContent.textStyle;
|
|
439
|
+
textItemContent.text = getUpdatedHTMLFromEditor(externalEditor, textItemContent.text, newContentStyle);
|
|
605
440
|
}
|
|
606
441
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
const profileDescriptionTextStyleType = profileContent.descriptionStyle.textStyleType;
|
|
613
|
-
if (nameStyleType && uiStyleSettingsStore) {
|
|
614
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
615
|
-
.textStyleOptions[nameStyleType].style;
|
|
616
|
-
globalContentStyle = {
|
|
617
|
-
...globalContentStyle,
|
|
618
|
-
textAlign: profileContent.nameStyle.textAlign,
|
|
619
|
-
};
|
|
620
|
-
if (!hasRTEContent(profileContent.name))
|
|
621
|
-
profileContent.name = getUpdatedHTMLFromEditor(externalEditor, profileContent.name, globalContentStyle);
|
|
622
|
-
}
|
|
623
|
-
else if (!nameStyleType && !hasRTEContent(profileContent.name)) {
|
|
624
|
-
const newContentStyle = profileContent.nameStyle;
|
|
625
|
-
profileContent.name = getUpdatedHTMLFromEditor(externalEditor, profileContent.name, newContentStyle);
|
|
626
|
-
}
|
|
627
|
-
if (profileTitleStyleType && uiStyleSettingsStore) {
|
|
628
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
629
|
-
.textStyleOptions[profileTitleStyleType]
|
|
630
|
-
.style;
|
|
631
|
-
globalContentStyle = {
|
|
632
|
-
...globalContentStyle,
|
|
633
|
-
textAlign: profileContent.titleStyle.textAlign,
|
|
634
|
-
};
|
|
635
|
-
if (!hasRTEContent(profileContent.title))
|
|
636
|
-
profileContent.title = getUpdatedHTMLFromEditor(externalEditor, profileContent.title, globalContentStyle);
|
|
637
|
-
}
|
|
638
|
-
else if (!profileTitleStyleType &&
|
|
639
|
-
!hasRTEContent(profileContent.title)) {
|
|
640
|
-
const newContentStyle = profileContent.titleStyle;
|
|
641
|
-
profileContent.title = getUpdatedHTMLFromEditor(externalEditor, profileContent.title, newContentStyle);
|
|
642
|
-
}
|
|
643
|
-
if (profileDescriptionTextStyleType && uiStyleSettingsStore) {
|
|
644
|
-
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
645
|
-
.textStyleOptions[profileDescriptionTextStyleType]
|
|
646
|
-
.style;
|
|
647
|
-
globalContentStyle = {
|
|
648
|
-
...globalContentStyle,
|
|
649
|
-
textAlign: profileContent.descriptionStyle.textAlign,
|
|
650
|
-
};
|
|
651
|
-
if (!hasRTEContent(profileContent.description))
|
|
652
|
-
profileContent.description = getUpdatedHTMLFromEditor(externalEditor, profileContent.description, globalContentStyle);
|
|
653
|
-
}
|
|
654
|
-
else if (!profileDescriptionTextStyleType &&
|
|
655
|
-
!hasRTEContent(profileContent.description)) {
|
|
656
|
-
const newContentStyle = profileContent.descriptionStyle;
|
|
657
|
-
profileContent.description = getUpdatedHTMLFromEditor(externalEditor, profileContent.description, newContentStyle);
|
|
658
|
-
}
|
|
659
|
-
break;
|
|
660
|
-
case 'mailing-list':
|
|
661
|
-
const mailingListContent = contentItem.settings
|
|
662
|
-
.content;
|
|
663
|
-
const titleStyle = mailingListContent.titleStyle;
|
|
664
|
-
const titleStyleStyleType = titleStyle?.textStyleType;
|
|
665
|
-
if (titleStyleStyleType && uiStyleSettingsStore) {
|
|
442
|
+
}
|
|
443
|
+
if ((!textContent.textItems || textContent.textItems.length === 0) &&
|
|
444
|
+
textContent.textStyle) {
|
|
445
|
+
const textStyleType = textContent.textStyle.textStyleType;
|
|
446
|
+
if (textStyleType && uiStyleSettingsStore) {
|
|
666
447
|
let globalContentStyle = uiStyleSettingsStore.textStyles
|
|
667
|
-
.textStyleOptions[
|
|
668
|
-
.style;
|
|
448
|
+
.textStyleOptions[textStyleType].style;
|
|
669
449
|
globalContentStyle = {
|
|
670
450
|
...globalContentStyle,
|
|
671
|
-
textAlign:
|
|
451
|
+
textAlign: textContent.textStyle.textAlign,
|
|
672
452
|
};
|
|
673
|
-
if (!hasRTEContent(
|
|
674
|
-
|
|
453
|
+
if (!hasRTEContent(textContent.text))
|
|
454
|
+
textContent.text = getUpdatedHTMLFromEditor(externalEditor, textContent.text, globalContentStyle);
|
|
675
455
|
}
|
|
676
|
-
else if (!
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
mailingListContent.title = getUpdatedHTMLFromEditor(externalEditor, mailingListContent.title, newContentStyle);
|
|
456
|
+
else if (!textStyleType && !hasRTEContent(textContent.text)) {
|
|
457
|
+
const newContentStyle = textContent.textStyle;
|
|
458
|
+
textContent.text = getUpdatedHTMLFromEditor(externalEditor, textContent.text, newContentStyle);
|
|
680
459
|
}
|
|
681
|
-
|
|
460
|
+
}
|
|
682
461
|
}
|
|
683
462
|
}
|
|
684
463
|
}
|
|
685
464
|
};
|
|
686
465
|
export const getUpdatedHTMLFromEditor = (externalEditor, contentText, newContentStyle) => {
|
|
466
|
+
if (!contentText) {
|
|
467
|
+
return contentText;
|
|
468
|
+
}
|
|
687
469
|
const content = contentText.includes(ESCAPED_NEWLINE_CHARACTER)
|
|
688
470
|
? getRenderText(contentText)
|
|
689
471
|
: contentText;
|
|
@@ -755,7 +537,7 @@ export const buildInitialMarks = (state, style) => {
|
|
|
755
537
|
}));
|
|
756
538
|
}
|
|
757
539
|
// Bold and italic
|
|
758
|
-
if (fontWeight) {
|
|
540
|
+
if (fontWeight === 'bold') {
|
|
759
541
|
marks.push(state.schema.marks.bold.create());
|
|
760
542
|
}
|
|
761
543
|
if (fontStyle) {
|