@myissue/vue-website-page-builder 3.3.58 → 3.3.60
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 +94 -36
- package/dist/vue-website-page-builder.css +1 -1
- package/dist/vue-website-page-builder.js +1037 -1003
- package/dist/vue-website-page-builder.umd.cjs +10 -10
- 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 +1 -1
- package/src/PageBuilder/PageBuilder.vue +1 -1
- package/src/composables/PageBuilderService.ts +102 -81
- 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>
|
|
@@ -90,7 +90,7 @@ const configPageBuilder = {
|
|
|
90
90
|
} as const
|
|
91
91
|
|
|
92
92
|
onMounted(async () => {
|
|
93
|
-
const result = await pageBuilderService.startBuilder(configPageBuilder
|
|
93
|
+
const result = await pageBuilderService.startBuilder(configPageBuilder)
|
|
94
94
|
console.log('Page Builder Result:', result)
|
|
95
95
|
//
|
|
96
96
|
//
|
|
@@ -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
|
}
|
|
@@ -328,35 +332,33 @@ export class PageBuilderService {
|
|
|
328
332
|
// Deselect any selected or hovered elements in the builder UI
|
|
329
333
|
await this.clearHtmlSelection()
|
|
330
334
|
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
335
|
//
|
|
334
336
|
if (formType === 'update' || formType === 'create') {
|
|
335
337
|
if (!this.pendingMountData) {
|
|
336
338
|
// FOCUS ON: passedComponentsArray
|
|
337
339
|
if (passedComponentsArray && !localStorageData) {
|
|
338
|
-
await this.#completeMountProcess(JSON.stringify(passedComponentsArray))
|
|
340
|
+
await this.#completeMountProcess(JSON.stringify(passedComponentsArray), true)
|
|
339
341
|
return
|
|
340
342
|
}
|
|
343
|
+
|
|
341
344
|
if (passedComponentsArray && localStorageData) {
|
|
342
345
|
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
343
346
|
|
|
344
|
-
await this.#completeMountProcess(JSON.stringify(passedComponentsArray))
|
|
347
|
+
await this.#completeMountProcess(JSON.stringify(passedComponentsArray), true)
|
|
345
348
|
return
|
|
346
349
|
}
|
|
347
350
|
|
|
348
|
-
if (passedComponentsArray && localStorageData) {
|
|
349
|
-
this
|
|
350
|
-
|
|
351
|
-
await this.#completeMountProcess(JSON.stringify(passedComponentsArray))
|
|
351
|
+
if (!passedComponentsArray && localStorageData && this.isPageBuilderMissingOnStart) {
|
|
352
|
+
await this.#completeMountProcess(localStorageData)
|
|
352
353
|
return
|
|
353
354
|
}
|
|
354
355
|
|
|
355
|
-
if (localStorageData &&
|
|
356
|
-
await this.#completeMountProcess(
|
|
356
|
+
if (!passedComponentsArray && !localStorageData && this.isPageBuilderMissingOnStart) {
|
|
357
|
+
await this.#completeMountProcess(JSON.stringify([]))
|
|
357
358
|
return
|
|
358
359
|
}
|
|
359
|
-
|
|
360
|
+
|
|
361
|
+
if (!this.isPageBuilderMissingOnStart && !localStorageData && !passedComponentsArray) {
|
|
360
362
|
await this.#completeMountProcess(JSON.stringify([]))
|
|
361
363
|
return
|
|
362
364
|
}
|
|
@@ -364,20 +366,19 @@ export class PageBuilderService {
|
|
|
364
366
|
|
|
365
367
|
// FOCUS ON: pendingMountData
|
|
366
368
|
if (this.pendingMountData) {
|
|
367
|
-
if (localStorageData) {
|
|
369
|
+
if (localStorageData && this.isPageBuilderMissingOnStart) {
|
|
368
370
|
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
369
|
-
await this.#completeMountProcess(JSON.stringify(this.pendingMountData))
|
|
371
|
+
await this.#completeMountProcess(JSON.stringify(this.pendingMountData), true)
|
|
370
372
|
this.pendingMountData = null
|
|
371
373
|
return
|
|
372
374
|
}
|
|
373
|
-
if (!localStorageData && passedComponentsArray) {
|
|
374
|
-
await this.#completeMountProcess(JSON.stringify(this.pendingMountData))
|
|
375
|
-
this.pendingMountData = null
|
|
375
|
+
if (!localStorageData && passedComponentsArray && this.isPageBuilderMissingOnStart) {
|
|
376
|
+
await this.#completeMountProcess(JSON.stringify(this.pendingMountData), true)
|
|
376
377
|
return
|
|
377
378
|
}
|
|
378
379
|
|
|
379
|
-
if (!passedComponentsArray && !localStorageData) {
|
|
380
|
-
await this.#completeMountProcess(JSON.stringify(
|
|
380
|
+
if (!passedComponentsArray && !localStorageData && this.isPageBuilderMissingOnStart) {
|
|
381
|
+
await this.#completeMountProcess(JSON.stringify(this.pendingMountData), true)
|
|
381
382
|
return
|
|
382
383
|
}
|
|
383
384
|
}
|
|
@@ -385,8 +386,8 @@ export class PageBuilderService {
|
|
|
385
386
|
//
|
|
386
387
|
}
|
|
387
388
|
|
|
388
|
-
async #completeMountProcess(html: string) {
|
|
389
|
-
await this.#mountComponentsToDOM(html)
|
|
389
|
+
async #completeMountProcess(html: string, usePassedPageSettings?: boolean) {
|
|
390
|
+
await this.#mountComponentsToDOM(html, usePassedPageSettings)
|
|
390
391
|
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
391
392
|
await nextTick()
|
|
392
393
|
// Attach event listeners to all editable elements in the Builder
|
|
@@ -449,6 +450,25 @@ export class PageBuilderService {
|
|
|
449
450
|
return currentCSS
|
|
450
451
|
}
|
|
451
452
|
|
|
453
|
+
async clearClassesFromPage() {
|
|
454
|
+
const pagebuilder = document.querySelector('#pagebuilder')
|
|
455
|
+
if (!pagebuilder) return
|
|
456
|
+
|
|
457
|
+
pagebuilder.removeAttribute('class')
|
|
458
|
+
|
|
459
|
+
this.initializeElementStyles()
|
|
460
|
+
await nextTick()
|
|
461
|
+
}
|
|
462
|
+
async clearInlineStylesFromPagee() {
|
|
463
|
+
const pagebuilder = document.querySelector('#pagebuilder')
|
|
464
|
+
if (!pagebuilder) return
|
|
465
|
+
|
|
466
|
+
pagebuilder.removeAttribute('style')
|
|
467
|
+
|
|
468
|
+
this.initializeElementStyles()
|
|
469
|
+
await nextTick()
|
|
470
|
+
}
|
|
471
|
+
|
|
452
472
|
async globalPageStyles() {
|
|
453
473
|
const pagebuilder = document.querySelector('#pagebuilder')
|
|
454
474
|
if (!pagebuilder) return
|
|
@@ -1504,7 +1524,7 @@ export class PageBuilderService {
|
|
|
1504
1524
|
|
|
1505
1525
|
const pageSettings = {
|
|
1506
1526
|
classes: pagebuilder.className || '',
|
|
1507
|
-
style: pagebuilder.getAttribute('style') || '',
|
|
1527
|
+
style: pagebuilder.getAttribute('style') || (pagebuilder as HTMLElement).style.cssText || '',
|
|
1508
1528
|
}
|
|
1509
1529
|
|
|
1510
1530
|
const dataToSave = {
|
|
@@ -1590,24 +1610,14 @@ export class PageBuilderService {
|
|
|
1590
1610
|
//
|
|
1591
1611
|
async resumeEditingFromDraft() {
|
|
1592
1612
|
this.#updateLocalStorageItemName()
|
|
1593
|
-
const config = this.pageBuilderStateStore.getPageBuilderConfig
|
|
1594
|
-
const formType = config && config.updateOrCreate && config.updateOrCreate.formType
|
|
1595
|
-
|
|
1596
|
-
//
|
|
1597
|
-
//
|
|
1598
|
-
//
|
|
1599
1613
|
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1602
|
-
if (typeof key === 'string') {
|
|
1603
|
-
const updateDraftFromLocalStorage = localStorage.getItem(key)
|
|
1614
|
+
const localStorageData = this.loadStoredComponentsFromStorage()
|
|
1604
1615
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
}
|
|
1616
|
+
if (localStorageData) {
|
|
1617
|
+
this.pageBuilderStateStore.setIsLoadingResumeEditing(true)
|
|
1618
|
+
await delay(400)
|
|
1619
|
+
await this.#mountComponentsToDOM(localStorageData)
|
|
1620
|
+
this.pageBuilderStateStore.setIsLoadingResumeEditing(false)
|
|
1611
1621
|
}
|
|
1612
1622
|
|
|
1613
1623
|
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
@@ -1620,26 +1630,22 @@ export class PageBuilderService {
|
|
|
1620
1630
|
|
|
1621
1631
|
async restoreOriginalContent() {
|
|
1622
1632
|
this.#updateLocalStorageItemName()
|
|
1623
|
-
const config = this.pageBuilderStateStore.getPageBuilderConfig
|
|
1624
|
-
const formType = config && config.updateOrCreate && config.updateOrCreate.formType
|
|
1625
1633
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
await delay(400)
|
|
1634
|
+
this.pageBuilderStateStore.setIsRestoring(true)
|
|
1635
|
+
await delay(400)
|
|
1629
1636
|
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1637
|
+
// Restore the original content if available
|
|
1638
|
+
if (Array.isArray(this.originalComponents)) {
|
|
1639
|
+
await this.#mountComponentsToDOM(JSON.stringify(this.originalComponents), true)
|
|
1640
|
+
this.removeCurrentComponentsFromLocalStorage()
|
|
1641
|
+
}
|
|
1635
1642
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1643
|
+
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
1644
|
+
await nextTick()
|
|
1645
|
+
// Attach event listeners to all editable elements in the Builder
|
|
1646
|
+
await this.#addListenersToEditableElements()
|
|
1640
1647
|
|
|
1641
|
-
|
|
1642
|
-
}
|
|
1648
|
+
this.pageBuilderStateStore.setIsRestoring(false)
|
|
1643
1649
|
}
|
|
1644
1650
|
|
|
1645
1651
|
getStorageItemNameForResource(): string | null {
|
|
@@ -1652,7 +1658,6 @@ export class PageBuilderService {
|
|
|
1652
1658
|
|
|
1653
1659
|
if (
|
|
1654
1660
|
this.getLocalStorageItemName.value &&
|
|
1655
|
-
typeof this.getLocalStorageItemName.value === 'string' &&
|
|
1656
1661
|
localStorage.getItem(this.getLocalStorageItemName.value)
|
|
1657
1662
|
) {
|
|
1658
1663
|
const savedCurrentDesign = localStorage.getItem(this.getLocalStorageItemName.value)
|
|
@@ -1970,40 +1975,47 @@ export class PageBuilderService {
|
|
|
1970
1975
|
* @param data - JSON string (e.g., '[{"html_code":"...","id":"123","title":"..."}]')
|
|
1971
1976
|
* OR HTML string (e.g., '<section data-componentid="123">...</section>')
|
|
1972
1977
|
*/
|
|
1973
|
-
async #mountComponentsToDOM(htmlString: string): Promise<void> {
|
|
1978
|
+
async #mountComponentsToDOM(htmlString: string, usePassedPageSettings?: boolean): Promise<void> {
|
|
1974
1979
|
// Auto-detect if input is JSON or HTML
|
|
1975
1980
|
const trimmedData = htmlString.trim()
|
|
1976
1981
|
|
|
1977
1982
|
if (trimmedData.startsWith('[') || trimmedData.startsWith('{')) {
|
|
1978
1983
|
// Looks like JSON - parse as JSON
|
|
1979
|
-
await this.#parseJSONComponents(trimmedData)
|
|
1984
|
+
await this.#parseJSONComponents(trimmedData, usePassedPageSettings)
|
|
1980
1985
|
return
|
|
1981
1986
|
}
|
|
1982
1987
|
if (trimmedData.startsWith('<')) {
|
|
1983
1988
|
// Looks like HTML - parse as HTML
|
|
1984
|
-
await this.#parseHTMLComponents(trimmedData)
|
|
1989
|
+
await this.#parseHTMLComponents(trimmedData, usePassedPageSettings)
|
|
1985
1990
|
return
|
|
1986
1991
|
}
|
|
1987
1992
|
|
|
1988
|
-
await this.#parseJSONComponents(trimmedData)
|
|
1993
|
+
await this.#parseJSONComponents(trimmedData, usePassedPageSettings)
|
|
1989
1994
|
}
|
|
1990
1995
|
|
|
1991
1996
|
// Private method to parse JSON components and save pageBuilderContentSavedAt to localStorage
|
|
1992
|
-
|
|
1993
|
-
|
|
1997
|
+
async #parseJSONComponents(jsonData: string, usePassedPageSettings?: boolean): Promise<void> {
|
|
1998
|
+
const storedPageSettings =
|
|
1999
|
+
this.pageBuilderStateStore.getPageBuilderConfig &&
|
|
2000
|
+
this.pageBuilderStateStore.getPageBuilderConfig.pageSettings
|
|
2001
|
+
|
|
1994
2002
|
try {
|
|
1995
2003
|
const parsedData = JSON.parse(jsonData)
|
|
1996
2004
|
let componentsArray: ComponentObject[] = []
|
|
1997
2005
|
|
|
1998
|
-
//
|
|
1999
|
-
const pageSettings =
|
|
2000
|
-
|
|
2001
|
-
|
|
2006
|
+
// Decide which pageSettings to use
|
|
2007
|
+
const pageSettings = usePassedPageSettings
|
|
2008
|
+
? storedPageSettings
|
|
2009
|
+
: parsedData && parsedData.pageSettings
|
|
2010
|
+
? parsedData.pageSettings
|
|
2011
|
+
: null
|
|
2002
2012
|
|
|
2003
2013
|
// Restore page-level settings like class and style
|
|
2004
2014
|
if (pageSettings) {
|
|
2005
2015
|
const pagebuilder = document.querySelector('#pagebuilder') as HTMLElement
|
|
2006
2016
|
if (pagebuilder) {
|
|
2017
|
+
pagebuilder.removeAttribute('class')
|
|
2018
|
+
pagebuilder.removeAttribute('style')
|
|
2007
2019
|
pagebuilder.className = pageSettings.classes || ''
|
|
2008
2020
|
pagebuilder.setAttribute('style', this.#convertStyleObjectToString(pageSettings.style))
|
|
2009
2021
|
}
|
|
@@ -2063,7 +2075,7 @@ export class PageBuilderService {
|
|
|
2063
2075
|
}
|
|
2064
2076
|
}
|
|
2065
2077
|
// Private method to parse HTML components
|
|
2066
|
-
async #parseHTMLComponents(htmlData: string): Promise<void> {
|
|
2078
|
+
async #parseHTMLComponents(htmlData: string, usePassedPageSettings?: boolean): Promise<void> {
|
|
2067
2079
|
try {
|
|
2068
2080
|
const parser = new DOMParser()
|
|
2069
2081
|
const doc = parser.parseFromString(htmlData, 'text/html')
|
|
@@ -2072,24 +2084,32 @@ export class PageBuilderService {
|
|
|
2072
2084
|
const livePageBuilder = document.querySelector('#pagebuilder') as HTMLElement | null
|
|
2073
2085
|
|
|
2074
2086
|
if (livePageBuilder) {
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2087
|
+
const storedPageSettings =
|
|
2088
|
+
this.pageBuilderStateStore.getPageBuilderConfig &&
|
|
2089
|
+
this.pageBuilderStateStore.getPageBuilderConfig.pageSettings
|
|
2090
|
+
|
|
2091
|
+
// Decide which pageSettings to use
|
|
2092
|
+
let pageSettings = null
|
|
2093
|
+
if (usePassedPageSettings) {
|
|
2094
|
+
pageSettings = storedPageSettings
|
|
2095
|
+
} else if (importedPageBuilder) {
|
|
2096
|
+
pageSettings = {
|
|
2097
|
+
classes: importedPageBuilder.className || '',
|
|
2098
|
+
style: importedPageBuilder.getAttribute('style') || '',
|
|
2082
2099
|
}
|
|
2083
2100
|
} else {
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2101
|
+
pageSettings = storedPageSettings
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
// Restore page-level settings like class and style
|
|
2105
|
+
if (pageSettings) {
|
|
2106
|
+
livePageBuilder.removeAttribute('class')
|
|
2107
|
+
livePageBuilder.removeAttribute('style')
|
|
2108
|
+
livePageBuilder.className = pageSettings.classes || ''
|
|
2109
|
+
livePageBuilder.setAttribute(
|
|
2110
|
+
'style',
|
|
2111
|
+
this.#convertStyleObjectToString(pageSettings.style),
|
|
2112
|
+
)
|
|
2093
2113
|
}
|
|
2094
2114
|
}
|
|
2095
2115
|
|
|
@@ -2178,6 +2198,7 @@ export class PageBuilderService {
|
|
|
2178
2198
|
// handle font weight
|
|
2179
2199
|
this.handleFontWeight(undefined)
|
|
2180
2200
|
// handle font family
|
|
2201
|
+
|
|
2181
2202
|
this.handleFontFamily(undefined)
|
|
2182
2203
|
// handle font style
|
|
2183
2204
|
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
|
}
|