@myissue/vue-website-page-builder 3.3.57 → 3.3.59
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/README.md +1 -0
- package/dist/vue-website-page-builder.css +1 -1
- package/dist/vue-website-page-builder.js +1161 -1131
- package/dist/vue-website-page-builder.umd.cjs +26 -26
- package/package.json +1 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/BackgroundColorEditor.vue +9 -2
- package/src/Components/PageBuilder/EditorMenu/Editables/TextColorEditor.vue +9 -2
- package/src/Components/PageBuilder/EditorMenu/RightSidebarEditor.vue +36 -4
- package/src/DemoComponents/HomeSection.vue +9 -9
- package/src/PageBuilder/PageBuilder.vue +1 -1
- package/src/composables/PageBuilderService.ts +98 -80
- package/src/css/app.css +3 -5
package/package.json
CHANGED
|
@@ -44,13 +44,20 @@ watch(
|
|
|
44
44
|
v-if="globalPageLayout"
|
|
45
45
|
class="pbx-flex pbx-flex-row pbx-justify-between pbx-items-center pbx-pl-3 pbx-pr-3 pbx-py-5 pbx-cursor-pointer pbx-duration-200 hover:pbx-bg-myPrimaryLightGrayColor"
|
|
46
46
|
>
|
|
47
|
-
<
|
|
47
|
+
<div class="pbx-flex pbx-justify-start pbx-items-center pbx-gap-2">
|
|
48
|
+
<div
|
|
49
|
+
class="pbx-aspect-square pbx-w-6 pbx-h-6 pbx-border pbx-border-gray-800 pbx-rounded-sm"
|
|
50
|
+
:class="`pbx-bg-${backgroundColor?.replace('pbx-bg-', '')}`"
|
|
51
|
+
></div>
|
|
52
|
+
<div>Background Color</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
48
55
|
<span v-if="globalPageLayout" class="material-symbols-outlined"> chevron_right </span>
|
|
49
56
|
</ListboxButton>
|
|
50
57
|
|
|
51
58
|
<ListboxButton
|
|
52
59
|
v-if="!globalPageLayout"
|
|
53
|
-
class="pbx-h-10 pbx-w-10 pbx-flex-end pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-
|
|
60
|
+
class="pbx-h-10 pbx-w-10 pbx-flex-end pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-aspect-square hover:pbx-bg-gray-100 hover:pbx-fill-white pbx-bg-gray-300 focus-visible:pbx-ring-0"
|
|
54
61
|
>
|
|
55
62
|
<div class="pbx-flex pbx-flex-col">
|
|
56
63
|
<div class="pbx-flex pbx-gap-2 pbx-items-center">
|
|
@@ -44,13 +44,20 @@ watch(
|
|
|
44
44
|
v-if="globalPageLayout"
|
|
45
45
|
class="pbx-flex pbx-flex-row pbx-justify-between pbx-items-center pbx-pl-3 pbx-pr-3 pbx-py-5 pbx-cursor-pointer pbx-duration-200 hover:pbx-bg-myPrimaryLightGrayColor"
|
|
46
46
|
>
|
|
47
|
-
<
|
|
47
|
+
<div class="pbx-flex pbx-justify-start pbx-items-center pbx-gap-2">
|
|
48
|
+
<div
|
|
49
|
+
class="pbx-aspect-square pbx-w-6 pbx-h-6 pbx-border pbx-border-gray-800 pbx-rounded-sm"
|
|
50
|
+
:class="`pbx-bg-${textColor?.replace('pbx-text-', '')}`"
|
|
51
|
+
></div>
|
|
52
|
+
<div>Text Color</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
48
55
|
<span v-if="globalPageLayout" class="material-symbols-outlined"> chevron_right </span>
|
|
49
56
|
</ListboxButton>
|
|
50
57
|
|
|
51
58
|
<ListboxButton
|
|
52
59
|
v-if="!globalPageLayout"
|
|
53
|
-
class="pbx-h-10 pbx-w-10 pbx-flex-end pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-
|
|
60
|
+
class="pbx-h-10 pbx-w-10 pbx-flex-end pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-aspect-square hover:pbx-bg-gray-100 hover:pbx-fill-white pbx-bg-gray-300 focus-visible:pbx-ring-0"
|
|
54
61
|
>
|
|
55
62
|
<div class="pbx-flex pbx-flex-col">
|
|
56
63
|
<div class="pbx-flex pbx-gap-2 pbx-items-center">
|
|
@@ -105,12 +105,24 @@ const handleUpdatePageStyles = async function () {
|
|
|
105
105
|
|
|
106
106
|
await pageBuilderService.globalPageStyles()
|
|
107
107
|
}
|
|
108
|
+
|
|
109
|
+
const clearClassesFromPage = async function () {
|
|
110
|
+
await pageBuilderService.clearClassesFromPage()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const clearInlineStylesFromPagee = async function () {
|
|
114
|
+
await pageBuilderService.clearInlineStylesFromPagee()
|
|
115
|
+
}
|
|
116
|
+
|
|
108
117
|
const handleCloseGlobalPageStyles = async function () {
|
|
118
|
+
await pageBuilderService.handleManualSave()
|
|
119
|
+
|
|
109
120
|
// Remove global highlight if present
|
|
110
121
|
const pagebuilder = document.querySelector('#pagebuilder')
|
|
111
122
|
if (pagebuilder) {
|
|
112
123
|
pagebuilder.removeAttribute('data-global-selected')
|
|
113
124
|
}
|
|
125
|
+
|
|
114
126
|
showModalGlobalPageStyles.value = false
|
|
115
127
|
}
|
|
116
128
|
</script>
|
|
@@ -171,10 +183,7 @@ const handleCloseGlobalPageStyles = async function () {
|
|
|
171
183
|
</div>
|
|
172
184
|
|
|
173
185
|
<!-- Global Page Styles -->
|
|
174
|
-
<article
|
|
175
|
-
v-if="Array.isArray(getComponents) && getComponents.length >= 1"
|
|
176
|
-
class="pbx-my-1 pbx-bg-white"
|
|
177
|
-
>
|
|
186
|
+
<article class="pbx-my-1 pbx-bg-white">
|
|
178
187
|
<EditorAccordion>
|
|
179
188
|
<template #title>Global Page Styles</template>
|
|
180
189
|
<template #content>
|
|
@@ -253,6 +262,29 @@ const handleCloseGlobalPageStyles = async function () {
|
|
|
253
262
|
<ClassEditor></ClassEditor>
|
|
254
263
|
</article>
|
|
255
264
|
</div>
|
|
265
|
+
<label class="pbx-myPrimaryInputLabel pbx-my-4">
|
|
266
|
+
Choose an action to clean up your page:
|
|
267
|
+
</label>
|
|
268
|
+
<div
|
|
269
|
+
class="pbx-border-0 pbx-border-solid pbx-border-t pbx-border-gray-200 pbx-mt-4 pbx-flex pbx-items-center pbx-justify-end"
|
|
270
|
+
>
|
|
271
|
+
<div class="pbx-py-4 pbx-flex sm:pbx-justify-end pbx-justify-center">
|
|
272
|
+
<div
|
|
273
|
+
class="sm:pbx-grid-cols-1 sm:pbx-items-end sm:pbx-justify-end pbx-flex sm:pbx-flex-row pbx-flex-col pbx-myPrimaryGap sm:pbx-w-5/6 pbx-w-full pbx-mt-4"
|
|
274
|
+
>
|
|
275
|
+
<!-- Button: Clear all CSS classes -->
|
|
276
|
+
<button @click="clearClassesFromPage" class="pbx-myPrimaryButton" type="button">
|
|
277
|
+
Clear All CSS Classes
|
|
278
|
+
</button>
|
|
279
|
+
|
|
280
|
+
<!-- Button: Clear all inline styles -->
|
|
281
|
+
<button @click="clearInlineStylesFromPagee" class="pbx-myPrimaryButton" type="button">
|
|
282
|
+
Clear All Inline Styles
|
|
283
|
+
</button>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
<!--v-if-->
|
|
287
|
+
</div>
|
|
256
288
|
</ModalBuilder>
|
|
257
289
|
</div>
|
|
258
290
|
</template>
|
|
@@ -61,7 +61,7 @@ const configPageBuilder = {
|
|
|
61
61
|
image: '/jane_doe.jpg',
|
|
62
62
|
},
|
|
63
63
|
updateOrCreate: {
|
|
64
|
-
formType: '
|
|
64
|
+
formType: 'update',
|
|
65
65
|
formName: 'collection',
|
|
66
66
|
},
|
|
67
67
|
pageBuilderLogo: {
|
|
@@ -79,14 +79,14 @@ const configPageBuilder = {
|
|
|
79
79
|
settings: {
|
|
80
80
|
brandColor: '#DB93B0',
|
|
81
81
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
pageSettings: {
|
|
83
|
+
classes:
|
|
84
|
+
'pbx-font-didot pbx-italic pbx-px-20 pbx-rounded-full pbx-rounded-tr-full pbx-border-8 pbx-border-green-800 pbx-border-solid pbx-text-neutral-300 pbx-bg-stone-700',
|
|
85
|
+
style: {
|
|
86
|
+
backgroundColor: 'red',
|
|
87
|
+
border: '6px solid yellow',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
90
|
} as const
|
|
91
91
|
|
|
92
92
|
onMounted(async () => {
|
|
@@ -729,7 +729,7 @@ onMounted(async () => {
|
|
|
729
729
|
>
|
|
730
730
|
<div
|
|
731
731
|
id="editToolbar"
|
|
732
|
-
class="pbx-z-30 lg:pbx-mx-20 pbx-flex pbx-gap-2 pbx-justify-center pbx-min-w-
|
|
732
|
+
class="pbx-z-30 lg:pbx-mx-20 pbx-flex pbx-gap-2 pbx-justify-center pbx-min-w-72 pbx-items-center pbx-rounded-full pbx-px-4 pbx-bg-red-200 pbx-h-0"
|
|
733
733
|
style="
|
|
734
734
|
box-shadow: 0 0 0 10px oklch(86.9% 0.005 56.366);
|
|
735
735
|
background: oklch(86.9% 0.005 56.366);
|
|
@@ -45,6 +45,7 @@ export class PageBuilderService {
|
|
|
45
45
|
private originalComponents: BuilderResourceData | undefined = undefined
|
|
46
46
|
// Holds data to be mounted when #pagebuilder is not yet present in the DOM
|
|
47
47
|
private pendingMountData: BuilderResourceData | null = null
|
|
48
|
+
private isPageBuilderMissingOnStart: boolean = false
|
|
48
49
|
|
|
49
50
|
constructor(pageBuilderStateStore: ReturnType<typeof usePageBuilderStateStore>) {
|
|
50
51
|
this.hasStartedEditing = false
|
|
@@ -278,6 +279,9 @@ export class PageBuilderService {
|
|
|
278
279
|
this.#updateLocalStorageItemName()
|
|
279
280
|
|
|
280
281
|
// Page Builder is not Present in the DOM but Components have been passed to the Builder
|
|
282
|
+
if (!pagebuilder) {
|
|
283
|
+
this.isPageBuilderMissingOnStart = true
|
|
284
|
+
}
|
|
281
285
|
if (passedComponentsArray && !pagebuilder) {
|
|
282
286
|
this.pendingMountData = passedComponentsArray
|
|
283
287
|
}
|
|
@@ -335,28 +339,23 @@ export class PageBuilderService {
|
|
|
335
339
|
if (!this.pendingMountData) {
|
|
336
340
|
// FOCUS ON: passedComponentsArray
|
|
337
341
|
if (passedComponentsArray && !localStorageData) {
|
|
338
|
-
await this.#completeMountProcess(JSON.stringify(passedComponentsArray))
|
|
339
|
-
return
|
|
340
|
-
}
|
|
341
|
-
if (passedComponentsArray && localStorageData) {
|
|
342
|
-
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
343
|
-
|
|
344
|
-
await this.#completeMountProcess(JSON.stringify(passedComponentsArray))
|
|
342
|
+
await this.#completeMountProcess(JSON.stringify(passedComponentsArray), true)
|
|
345
343
|
return
|
|
346
344
|
}
|
|
347
345
|
|
|
348
346
|
if (passedComponentsArray && localStorageData) {
|
|
349
347
|
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
350
348
|
|
|
351
|
-
await this.#completeMountProcess(JSON.stringify(passedComponentsArray))
|
|
349
|
+
await this.#completeMountProcess(JSON.stringify(passedComponentsArray), true)
|
|
352
350
|
return
|
|
353
351
|
}
|
|
354
352
|
|
|
355
|
-
if (localStorageData &&
|
|
353
|
+
if (!passedComponentsArray && localStorageData && this.isPageBuilderMissingOnStart) {
|
|
356
354
|
await this.#completeMountProcess(localStorageData)
|
|
357
355
|
return
|
|
358
356
|
}
|
|
359
|
-
|
|
357
|
+
|
|
358
|
+
if (!passedComponentsArray && !localStorageData && this.isPageBuilderMissingOnStart) {
|
|
360
359
|
await this.#completeMountProcess(JSON.stringify([]))
|
|
361
360
|
return
|
|
362
361
|
}
|
|
@@ -364,20 +363,19 @@ export class PageBuilderService {
|
|
|
364
363
|
|
|
365
364
|
// FOCUS ON: pendingMountData
|
|
366
365
|
if (this.pendingMountData) {
|
|
367
|
-
if (localStorageData) {
|
|
366
|
+
if (localStorageData && this.isPageBuilderMissingOnStart) {
|
|
368
367
|
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
369
|
-
await this.#completeMountProcess(JSON.stringify(this.pendingMountData))
|
|
368
|
+
await this.#completeMountProcess(JSON.stringify(this.pendingMountData), true)
|
|
370
369
|
this.pendingMountData = null
|
|
371
370
|
return
|
|
372
371
|
}
|
|
373
|
-
if (!localStorageData && passedComponentsArray) {
|
|
374
|
-
await this.#completeMountProcess(JSON.stringify(this.pendingMountData))
|
|
375
|
-
this.pendingMountData = null
|
|
372
|
+
if (!localStorageData && passedComponentsArray && this.isPageBuilderMissingOnStart) {
|
|
373
|
+
await this.#completeMountProcess(JSON.stringify(this.pendingMountData), true)
|
|
376
374
|
return
|
|
377
375
|
}
|
|
378
376
|
|
|
379
|
-
if (!passedComponentsArray && !localStorageData) {
|
|
380
|
-
await this.#completeMountProcess(JSON.stringify(
|
|
377
|
+
if (!passedComponentsArray && !localStorageData && this.isPageBuilderMissingOnStart) {
|
|
378
|
+
await this.#completeMountProcess(JSON.stringify(this.pendingMountData), true)
|
|
381
379
|
return
|
|
382
380
|
}
|
|
383
381
|
}
|
|
@@ -385,8 +383,8 @@ export class PageBuilderService {
|
|
|
385
383
|
//
|
|
386
384
|
}
|
|
387
385
|
|
|
388
|
-
async #completeMountProcess(html: string) {
|
|
389
|
-
await this.#mountComponentsToDOM(html)
|
|
386
|
+
async #completeMountProcess(html: string, usePassedPageSettings?: boolean) {
|
|
387
|
+
await this.#mountComponentsToDOM(html, usePassedPageSettings)
|
|
390
388
|
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
391
389
|
await nextTick()
|
|
392
390
|
// Attach event listeners to all editable elements in the Builder
|
|
@@ -449,6 +447,25 @@ export class PageBuilderService {
|
|
|
449
447
|
return currentCSS
|
|
450
448
|
}
|
|
451
449
|
|
|
450
|
+
async clearClassesFromPage() {
|
|
451
|
+
const pagebuilder = document.querySelector('#pagebuilder')
|
|
452
|
+
if (!pagebuilder) return
|
|
453
|
+
|
|
454
|
+
pagebuilder.removeAttribute('class')
|
|
455
|
+
|
|
456
|
+
this.initializeElementStyles()
|
|
457
|
+
await nextTick()
|
|
458
|
+
}
|
|
459
|
+
async clearInlineStylesFromPagee() {
|
|
460
|
+
const pagebuilder = document.querySelector('#pagebuilder')
|
|
461
|
+
if (!pagebuilder) return
|
|
462
|
+
|
|
463
|
+
pagebuilder.removeAttribute('style')
|
|
464
|
+
|
|
465
|
+
this.initializeElementStyles()
|
|
466
|
+
await nextTick()
|
|
467
|
+
}
|
|
468
|
+
|
|
452
469
|
async globalPageStyles() {
|
|
453
470
|
const pagebuilder = document.querySelector('#pagebuilder')
|
|
454
471
|
if (!pagebuilder) return
|
|
@@ -1504,7 +1521,7 @@ export class PageBuilderService {
|
|
|
1504
1521
|
|
|
1505
1522
|
const pageSettings = {
|
|
1506
1523
|
classes: pagebuilder.className || '',
|
|
1507
|
-
style: pagebuilder.getAttribute('style') || '',
|
|
1524
|
+
style: pagebuilder.getAttribute('style') || (pagebuilder as HTMLElement).style.cssText || '',
|
|
1508
1525
|
}
|
|
1509
1526
|
|
|
1510
1527
|
const dataToSave = {
|
|
@@ -1590,24 +1607,14 @@ export class PageBuilderService {
|
|
|
1590
1607
|
//
|
|
1591
1608
|
async resumeEditingFromDraft() {
|
|
1592
1609
|
this.#updateLocalStorageItemName()
|
|
1593
|
-
const config = this.pageBuilderStateStore.getPageBuilderConfig
|
|
1594
|
-
const formType = config && config.updateOrCreate && config.updateOrCreate.formType
|
|
1595
|
-
|
|
1596
|
-
//
|
|
1597
|
-
//
|
|
1598
|
-
//
|
|
1599
|
-
|
|
1600
|
-
const key = this.getLocalStorageItemName.value
|
|
1601
1610
|
|
|
1602
|
-
|
|
1603
|
-
const updateDraftFromLocalStorage = localStorage.getItem(key)
|
|
1611
|
+
const localStorageData = this.loadStoredComponentsFromStorage()
|
|
1604
1612
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
}
|
|
1613
|
+
if (localStorageData) {
|
|
1614
|
+
this.pageBuilderStateStore.setIsLoadingResumeEditing(true)
|
|
1615
|
+
await delay(400)
|
|
1616
|
+
await this.#mountComponentsToDOM(localStorageData)
|
|
1617
|
+
this.pageBuilderStateStore.setIsLoadingResumeEditing(false)
|
|
1611
1618
|
}
|
|
1612
1619
|
|
|
1613
1620
|
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
@@ -1620,26 +1627,22 @@ export class PageBuilderService {
|
|
|
1620
1627
|
|
|
1621
1628
|
async restoreOriginalContent() {
|
|
1622
1629
|
this.#updateLocalStorageItemName()
|
|
1623
|
-
const config = this.pageBuilderStateStore.getPageBuilderConfig
|
|
1624
|
-
const formType = config && config.updateOrCreate && config.updateOrCreate.formType
|
|
1625
1630
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
await delay(400)
|
|
1631
|
+
this.pageBuilderStateStore.setIsRestoring(true)
|
|
1632
|
+
await delay(400)
|
|
1629
1633
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1634
|
+
// Restore the original content if available
|
|
1635
|
+
if (Array.isArray(this.originalComponents)) {
|
|
1636
|
+
await this.#mountComponentsToDOM(JSON.stringify(this.originalComponents), true)
|
|
1637
|
+
this.removeCurrentComponentsFromLocalStorage()
|
|
1638
|
+
}
|
|
1635
1639
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
+
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
1641
|
+
await nextTick()
|
|
1642
|
+
// Attach event listeners to all editable elements in the Builder
|
|
1643
|
+
await this.#addListenersToEditableElements()
|
|
1640
1644
|
|
|
1641
|
-
|
|
1642
|
-
}
|
|
1645
|
+
this.pageBuilderStateStore.setIsRestoring(false)
|
|
1643
1646
|
}
|
|
1644
1647
|
|
|
1645
1648
|
getStorageItemNameForResource(): string | null {
|
|
@@ -1652,7 +1655,6 @@ export class PageBuilderService {
|
|
|
1652
1655
|
|
|
1653
1656
|
if (
|
|
1654
1657
|
this.getLocalStorageItemName.value &&
|
|
1655
|
-
typeof this.getLocalStorageItemName.value === 'string' &&
|
|
1656
1658
|
localStorage.getItem(this.getLocalStorageItemName.value)
|
|
1657
1659
|
) {
|
|
1658
1660
|
const savedCurrentDesign = localStorage.getItem(this.getLocalStorageItemName.value)
|
|
@@ -1970,40 +1972,47 @@ export class PageBuilderService {
|
|
|
1970
1972
|
* @param data - JSON string (e.g., '[{"html_code":"...","id":"123","title":"..."}]')
|
|
1971
1973
|
* OR HTML string (e.g., '<section data-componentid="123">...</section>')
|
|
1972
1974
|
*/
|
|
1973
|
-
async #mountComponentsToDOM(htmlString: string): Promise<void> {
|
|
1975
|
+
async #mountComponentsToDOM(htmlString: string, usePassedPageSettings?: boolean): Promise<void> {
|
|
1974
1976
|
// Auto-detect if input is JSON or HTML
|
|
1975
1977
|
const trimmedData = htmlString.trim()
|
|
1976
1978
|
|
|
1977
1979
|
if (trimmedData.startsWith('[') || trimmedData.startsWith('{')) {
|
|
1978
1980
|
// Looks like JSON - parse as JSON
|
|
1979
|
-
await this.#parseJSONComponents(trimmedData)
|
|
1981
|
+
await this.#parseJSONComponents(trimmedData, usePassedPageSettings)
|
|
1980
1982
|
return
|
|
1981
1983
|
}
|
|
1982
1984
|
if (trimmedData.startsWith('<')) {
|
|
1983
1985
|
// Looks like HTML - parse as HTML
|
|
1984
|
-
await this.#parseHTMLComponents(trimmedData)
|
|
1986
|
+
await this.#parseHTMLComponents(trimmedData, usePassedPageSettings)
|
|
1985
1987
|
return
|
|
1986
1988
|
}
|
|
1987
1989
|
|
|
1988
|
-
await this.#parseJSONComponents(trimmedData)
|
|
1990
|
+
await this.#parseJSONComponents(trimmedData, usePassedPageSettings)
|
|
1989
1991
|
}
|
|
1990
1992
|
|
|
1991
1993
|
// Private method to parse JSON components and save pageBuilderContentSavedAt to localStorage
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
+
async #parseJSONComponents(jsonData: string, usePassedPageSettings?: boolean): Promise<void> {
|
|
1995
|
+
const storedPageSettings =
|
|
1996
|
+
this.pageBuilderStateStore.getPageBuilderConfig &&
|
|
1997
|
+
this.pageBuilderStateStore.getPageBuilderConfig.pageSettings
|
|
1998
|
+
|
|
1994
1999
|
try {
|
|
1995
2000
|
const parsedData = JSON.parse(jsonData)
|
|
1996
2001
|
let componentsArray: ComponentObject[] = []
|
|
1997
2002
|
|
|
1998
|
-
//
|
|
1999
|
-
const pageSettings =
|
|
2000
|
-
|
|
2001
|
-
|
|
2003
|
+
// Decide which pageSettings to use
|
|
2004
|
+
const pageSettings = usePassedPageSettings
|
|
2005
|
+
? storedPageSettings
|
|
2006
|
+
: parsedData && parsedData.pageSettings
|
|
2007
|
+
? parsedData.pageSettings
|
|
2008
|
+
: null
|
|
2002
2009
|
|
|
2003
2010
|
// Restore page-level settings like class and style
|
|
2004
2011
|
if (pageSettings) {
|
|
2005
2012
|
const pagebuilder = document.querySelector('#pagebuilder') as HTMLElement
|
|
2006
2013
|
if (pagebuilder) {
|
|
2014
|
+
pagebuilder.removeAttribute('class')
|
|
2015
|
+
pagebuilder.removeAttribute('style')
|
|
2007
2016
|
pagebuilder.className = pageSettings.classes || ''
|
|
2008
2017
|
pagebuilder.setAttribute('style', this.#convertStyleObjectToString(pageSettings.style))
|
|
2009
2018
|
}
|
|
@@ -2063,7 +2072,7 @@ export class PageBuilderService {
|
|
|
2063
2072
|
}
|
|
2064
2073
|
}
|
|
2065
2074
|
// Private method to parse HTML components
|
|
2066
|
-
async #parseHTMLComponents(htmlData: string): Promise<void> {
|
|
2075
|
+
async #parseHTMLComponents(htmlData: string, usePassedPageSettings?: boolean): Promise<void> {
|
|
2067
2076
|
try {
|
|
2068
2077
|
const parser = new DOMParser()
|
|
2069
2078
|
const doc = parser.parseFromString(htmlData, 'text/html')
|
|
@@ -2072,24 +2081,32 @@ export class PageBuilderService {
|
|
|
2072
2081
|
const livePageBuilder = document.querySelector('#pagebuilder') as HTMLElement | null
|
|
2073
2082
|
|
|
2074
2083
|
if (livePageBuilder) {
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2084
|
+
const storedPageSettings =
|
|
2085
|
+
this.pageBuilderStateStore.getPageBuilderConfig &&
|
|
2086
|
+
this.pageBuilderStateStore.getPageBuilderConfig.pageSettings
|
|
2087
|
+
|
|
2088
|
+
// Decide which pageSettings to use
|
|
2089
|
+
let pageSettings = null
|
|
2090
|
+
if (usePassedPageSettings) {
|
|
2091
|
+
pageSettings = storedPageSettings
|
|
2092
|
+
} else if (importedPageBuilder) {
|
|
2093
|
+
pageSettings = {
|
|
2094
|
+
classes: importedPageBuilder.className || '',
|
|
2095
|
+
style: importedPageBuilder.getAttribute('style') || '',
|
|
2082
2096
|
}
|
|
2083
2097
|
} else {
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2098
|
+
pageSettings = storedPageSettings
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
// Restore page-level settings like class and style
|
|
2102
|
+
if (pageSettings) {
|
|
2103
|
+
livePageBuilder.removeAttribute('class')
|
|
2104
|
+
livePageBuilder.removeAttribute('style')
|
|
2105
|
+
livePageBuilder.className = pageSettings.classes || ''
|
|
2106
|
+
livePageBuilder.setAttribute(
|
|
2107
|
+
'style',
|
|
2108
|
+
this.#convertStyleObjectToString(pageSettings.style),
|
|
2109
|
+
)
|
|
2093
2110
|
}
|
|
2094
2111
|
}
|
|
2095
2112
|
|
|
@@ -2178,6 +2195,7 @@ export class PageBuilderService {
|
|
|
2178
2195
|
// handle font weight
|
|
2179
2196
|
this.handleFontWeight(undefined)
|
|
2180
2197
|
// handle font family
|
|
2198
|
+
|
|
2181
2199
|
this.handleFontFamily(undefined)
|
|
2182
2200
|
// handle font style
|
|
2183
2201
|
this.handleFontStyle(undefined)
|
package/src/css/app.css
CHANGED
|
@@ -426,8 +426,8 @@
|
|
|
426
426
|
opacity: 1;
|
|
427
427
|
pointer-events: auto;
|
|
428
428
|
transform: translateY(0) scale(1);
|
|
429
|
-
min-width:
|
|
430
|
-
width:
|
|
429
|
+
min-width: 20rem;
|
|
430
|
+
width: 20rem;
|
|
431
431
|
height: 2.5rem;
|
|
432
432
|
border-radius: 9999px;
|
|
433
433
|
}
|
|
@@ -552,8 +552,6 @@
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
#pagebuilder[data-global-selected] {
|
|
555
|
-
outline:
|
|
555
|
+
outline: 4px dashed #b91010 !important;
|
|
556
556
|
outline-offset: -2px !important;
|
|
557
|
-
box-shadow: 0 0 0 2px #fbbf24;
|
|
558
|
-
/* Or any style you want */
|
|
559
557
|
}
|