@myissue/vue-website-page-builder 3.3.49 → 3.3.53
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 +23 -0
- package/dist/home/page_builder_architecture.png +0 -0
- package/dist/jane_doe.jpg +0 -0
- package/dist/vue-website-page-builder.js +793 -812
- package/dist/vue-website-page-builder.umd.cjs +28 -28
- package/package.json +1 -1
- package/src/Components/Loaders/GlobalLoader.vue +10 -3
- package/src/Components/Modals/DynamicModalBuilder.vue +1 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/ImageEditor.vue +1 -1
- package/src/DemoComponents/DemoUnsplash.vue +2 -2
- package/src/DemoComponents/HomeSection.vue +1 -1
- package/src/PageBuilder/PageBuilder.vue +1 -1
- package/src/composables/PageBuilderService.ts +34 -53
package/package.json
CHANGED
|
@@ -3,9 +3,16 @@
|
|
|
3
3
|
class="pbx-bg-white pbx-flex pbx-justify-center pbx-items-center min-pbx-h-screen pbx-h-screen pbx-w-screen pbx-fixed pbx-inset-0 pbx-z-[10000]"
|
|
4
4
|
>
|
|
5
5
|
<div class="pbx-absolute pbx-top-1/3">
|
|
6
|
-
<div
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<div class="pbx-flex pbx-items-center pbx-justify-center pbx-mt-4">
|
|
7
|
+
<div
|
|
8
|
+
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"
|
|
9
|
+
>
|
|
10
|
+
<span
|
|
11
|
+
class="!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"
|
|
12
|
+
>Loading...</span
|
|
13
|
+
>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
9
16
|
</div>
|
|
10
17
|
</div>
|
|
11
18
|
</template>
|
|
@@ -157,7 +157,7 @@ const thirdButtonBuilder = function () {
|
|
|
157
157
|
<template v-if="isLoading">
|
|
158
158
|
<div class="pbx-flex pbx-items-center pbx-my-2 pbx-py-4 pbx-px-2 pbx-justify-end">
|
|
159
159
|
<div
|
|
160
|
-
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border
|
|
160
|
+
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"
|
|
161
161
|
>
|
|
162
162
|
<span
|
|
163
163
|
class="!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"
|
|
@@ -64,7 +64,7 @@ const loadingImage = async function (imageURL) {
|
|
|
64
64
|
<div v-show="getIsLoadingImage">
|
|
65
65
|
<div class="pbx-flex pbx-items-center pbx-justify-center pbx-mt-4 pbx-min-h-80">
|
|
66
66
|
<div
|
|
67
|
-
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border
|
|
67
|
+
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"
|
|
68
68
|
>
|
|
69
69
|
<span
|
|
70
70
|
class="!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"
|
|
@@ -274,7 +274,7 @@ onMounted(async () => {
|
|
|
274
274
|
<div v-if="getIsLoading">
|
|
275
275
|
<div class="pbx-flex pbx-items-center pbx-justify-center pbx-mt-4">
|
|
276
276
|
<div
|
|
277
|
-
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border
|
|
277
|
+
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"
|
|
278
278
|
>
|
|
279
279
|
<span
|
|
280
280
|
class="!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"
|
|
@@ -332,7 +332,7 @@ onMounted(async () => {
|
|
|
332
332
|
<template v-if="getIsLoadingImage">
|
|
333
333
|
<div class="pbx-flex pbx-items-center pbx-justify-center pbx-mt-4">
|
|
334
334
|
<div
|
|
335
|
-
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border
|
|
335
|
+
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"
|
|
336
336
|
>
|
|
337
337
|
<span
|
|
338
338
|
class="!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"
|
|
@@ -371,7 +371,7 @@ onMounted(async () => {
|
|
|
371
371
|
<div
|
|
372
372
|
class="pbx-font-sans pbx-max-w-full pbx-border-solid pbx-border pbx-border-gray-400 pbx-inset-x-0 pbx-z-10 pbx-bg-white pbx-overflow-x-auto pbx-h-full"
|
|
373
373
|
>
|
|
374
|
-
<GlobalLoader v-if="getIsLoadingGlobal
|
|
374
|
+
<GlobalLoader v-if="getIsLoadingGlobal && !openAppNotStartedModal"></GlobalLoader>
|
|
375
375
|
<ModalBuilder
|
|
376
376
|
title="The builder hasn’t started yet"
|
|
377
377
|
:showModalBuilder="openAppNotStartedModal"
|
|
@@ -39,7 +39,6 @@ export class PageBuilderService {
|
|
|
39
39
|
private getRestoredElement: ComputedRef<string | null>
|
|
40
40
|
private getComponentArrayAddMethod: ComputedRef<string | null>
|
|
41
41
|
private NoneListernesTags: string[]
|
|
42
|
-
private delay: (ms?: number) => Promise<void>
|
|
43
42
|
private hasStartedEditing: boolean = false
|
|
44
43
|
// Hold data from Database or Backend for updated post
|
|
45
44
|
private originalComponents: BuilderResourceData | undefined = undefined
|
|
@@ -91,8 +90,6 @@ export class PageBuilderService {
|
|
|
91
90
|
'BLOCKQUOTE',
|
|
92
91
|
'BR',
|
|
93
92
|
]
|
|
94
|
-
|
|
95
|
-
this.delay = delay
|
|
96
93
|
}
|
|
97
94
|
|
|
98
95
|
// Deselect any selected or hovered elements in the builder UI
|
|
@@ -270,59 +267,48 @@ export class PageBuilderService {
|
|
|
270
267
|
}
|
|
271
268
|
|
|
272
269
|
async tryMountPendingComponents() {
|
|
270
|
+
this.pageBuilderStateStore.setIsLoadingGlobal(true)
|
|
271
|
+
await delay(400)
|
|
272
|
+
|
|
273
273
|
// Always clear DOM and store before mounting new resource
|
|
274
274
|
this.deleteAllComponentsFromDOM()
|
|
275
|
-
|
|
276
275
|
const localStorageData = this.loadStoredComponentsFromStorage()
|
|
277
276
|
|
|
278
|
-
this.pageBuilderStateStore.setIsLoadingGlobal(true)
|
|
279
|
-
await delay(200)
|
|
280
277
|
const config = this.pageBuilderStateStore.getPageBuilderConfig
|
|
281
278
|
const formType = config && config.updateOrCreate && config.updateOrCreate.formType
|
|
282
279
|
|
|
283
280
|
//
|
|
284
|
-
if (
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
typeof localStorageData === 'string' &&
|
|
291
|
-
this.pendingMountData
|
|
292
|
-
) {
|
|
293
|
-
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
294
|
-
}
|
|
281
|
+
if (config) {
|
|
282
|
+
if (formType === 'update') {
|
|
283
|
+
//
|
|
284
|
+
if (localStorageData && typeof localStorageData === 'string') {
|
|
285
|
+
this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
|
|
286
|
+
}
|
|
295
287
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return
|
|
300
|
-
}
|
|
288
|
+
if (this.pendingMountData) {
|
|
289
|
+
this.#completeBuilderInitialization(this.pendingMountData)
|
|
290
|
+
}
|
|
301
291
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
292
|
+
// Pending data for mount is null at this stage
|
|
293
|
+
if (typeof localStorageData === 'string' && !this.pendingMountData) {
|
|
294
|
+
await this.#updateComponentsFromString(localStorageData)
|
|
295
|
+
this.#completeBuilderInitialization()
|
|
296
|
+
}
|
|
307
297
|
}
|
|
308
298
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.pageBuilderStateStore.setIsLoadingGlobal(false)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
if (config && formType === 'create') {
|
|
319
|
-
// Pending data for mount is null at this stage
|
|
320
|
-
if (typeof localStorageData === 'string') {
|
|
321
|
-
await this.#updateComponentsFromString(localStorageData)
|
|
322
|
-
this.#completeBuilderInitialization()
|
|
323
|
-
return
|
|
299
|
+
if (formType === 'create') {
|
|
300
|
+
// Pending data for mount is null at this stage
|
|
301
|
+
if (typeof localStorageData === 'string') {
|
|
302
|
+
await this.#updateComponentsFromString(localStorageData)
|
|
303
|
+
this.#completeBuilderInitialization()
|
|
304
|
+
}
|
|
324
305
|
}
|
|
325
306
|
|
|
307
|
+
//
|
|
308
|
+
//
|
|
309
|
+
//
|
|
310
|
+
//
|
|
311
|
+
//
|
|
326
312
|
// Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
|
|
327
313
|
await nextTick()
|
|
328
314
|
// Attach event listeners to all editable elements in the Builder
|
|
@@ -392,7 +378,6 @@ export class PageBuilderService {
|
|
|
392
378
|
return result
|
|
393
379
|
} catch (err) {
|
|
394
380
|
console.error('Not able to start the Page Builder', err)
|
|
395
|
-
this.pageBuilderStateStore.setIsLoadingGlobal(false)
|
|
396
381
|
return {
|
|
397
382
|
error: true as const,
|
|
398
383
|
reason: 'Failed to start the Page Builder due to an unexpected error.',
|
|
@@ -401,11 +386,8 @@ export class PageBuilderService {
|
|
|
401
386
|
}
|
|
402
387
|
|
|
403
388
|
async #completeBuilderInitialization(passedComponentsArray?: BuilderResourceData): Promise<void> {
|
|
404
|
-
this.pageBuilderStateStore.setIsLoadingGlobal(true)
|
|
405
389
|
const localStorageData = this.loadStoredComponentsFromStorage()
|
|
406
390
|
|
|
407
|
-
await this.delay(300)
|
|
408
|
-
|
|
409
391
|
// Deselect any selected or hovered elements in the builder UI
|
|
410
392
|
await this.clearHtmlSelection()
|
|
411
393
|
|
|
@@ -439,7 +421,6 @@ export class PageBuilderService {
|
|
|
439
421
|
// Attach event listeners to all editable elements in the Builder
|
|
440
422
|
await this.#addListenersToEditableElements()
|
|
441
423
|
// Show a global loading indicator while initializing
|
|
442
|
-
this.pageBuilderStateStore.setIsLoadingGlobal(false)
|
|
443
424
|
|
|
444
425
|
// Clean up any old localStorage items related to previous builder sessions
|
|
445
426
|
this.deleteOldPageBuilderLocalStorage()
|
|
@@ -730,7 +711,7 @@ export class PageBuilderService {
|
|
|
730
711
|
// Deselect any selected or hovered elements in the builder UI
|
|
731
712
|
//
|
|
732
713
|
this.#saveDomComponentsToLocalStorage()
|
|
733
|
-
await
|
|
714
|
+
await delay(400)
|
|
734
715
|
} catch (err) {
|
|
735
716
|
console.error('Error trying auto save.', err)
|
|
736
717
|
} finally {
|
|
@@ -742,7 +723,7 @@ export class PageBuilderService {
|
|
|
742
723
|
try {
|
|
743
724
|
this.pageBuilderStateStore.setIsSaving(true)
|
|
744
725
|
this.#saveDomComponentsToLocalStorage()
|
|
745
|
-
await
|
|
726
|
+
await delay(400)
|
|
746
727
|
} catch (err) {
|
|
747
728
|
console.error('Error trying saving.', err)
|
|
748
729
|
} finally {
|
|
@@ -768,7 +749,7 @@ export class PageBuilderService {
|
|
|
768
749
|
) {
|
|
769
750
|
this.pageBuilderStateStore.setIsSaving(true)
|
|
770
751
|
this.#saveDomComponentsToLocalStorage()
|
|
771
|
-
await
|
|
752
|
+
await delay(400)
|
|
772
753
|
|
|
773
754
|
this.pageBuilderStateStore.setIsSaving(false)
|
|
774
755
|
}
|
|
@@ -776,7 +757,7 @@ export class PageBuilderService {
|
|
|
776
757
|
if (passedConfig && !passedConfig.userSettings) {
|
|
777
758
|
this.pageBuilderStateStore.setIsSaving(true)
|
|
778
759
|
this.#saveDomComponentsToLocalStorage()
|
|
779
|
-
await
|
|
760
|
+
await delay(400)
|
|
780
761
|
|
|
781
762
|
this.pageBuilderStateStore.setIsSaving(false)
|
|
782
763
|
}
|
|
@@ -1650,7 +1631,7 @@ export class PageBuilderService {
|
|
|
1650
1631
|
|
|
1651
1632
|
if (typeof updateDraftFromLocalStorage === 'string') {
|
|
1652
1633
|
this.pageBuilderStateStore.setIsLoadingResumeEditing(true)
|
|
1653
|
-
await delay(
|
|
1634
|
+
await delay(400)
|
|
1654
1635
|
await this.#updateComponentsFromString(updateDraftFromLocalStorage)
|
|
1655
1636
|
this.pageBuilderStateStore.setIsLoadingResumeEditing(false)
|
|
1656
1637
|
}
|
|
@@ -1671,7 +1652,7 @@ export class PageBuilderService {
|
|
|
1671
1652
|
|
|
1672
1653
|
if (formType === 'update') {
|
|
1673
1654
|
this.pageBuilderStateStore.setIsRestoring(true)
|
|
1674
|
-
await
|
|
1655
|
+
await delay(400)
|
|
1675
1656
|
|
|
1676
1657
|
// Restore the original content if available
|
|
1677
1658
|
if (Array.isArray(this.originalComponents)) {
|