@myissue/vue-website-page-builder 3.3.51 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myissue/vue-website-page-builder",
3
- "version": "3.3.51",
3
+ "version": "3.3.53",
4
4
  "description": "Vue 3 page builder component with drag & drop functionality.",
5
5
  "type": "module",
6
6
  "main": "./dist/vue-website-page-builder.umd.cjs",
@@ -267,59 +267,48 @@ export class PageBuilderService {
267
267
  }
268
268
 
269
269
  async tryMountPendingComponents() {
270
+ this.pageBuilderStateStore.setIsLoadingGlobal(true)
271
+ await delay(400)
272
+
270
273
  // Always clear DOM and store before mounting new resource
271
274
  this.deleteAllComponentsFromDOM()
272
-
273
275
  const localStorageData = this.loadStoredComponentsFromStorage()
274
276
 
275
- this.pageBuilderStateStore.setIsLoadingGlobal(true)
276
- await delay(300)
277
277
  const config = this.pageBuilderStateStore.getPageBuilderConfig
278
278
  const formType = config && config.updateOrCreate && config.updateOrCreate.formType
279
279
 
280
280
  //
281
- if (!config) return
282
- //
283
- if (
284
- config &&
285
- formType === 'update' &&
286
- localStorageData &&
287
- typeof localStorageData === 'string' &&
288
- this.pendingMountData
289
- ) {
290
- this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
291
- }
281
+ if (config) {
282
+ if (formType === 'update') {
283
+ //
284
+ if (localStorageData && typeof localStorageData === 'string') {
285
+ this.pageBuilderStateStore.setHasLocalDraftForUpdate(true)
286
+ }
292
287
 
293
- if (config && formType === 'update') {
294
- if (this.pendingMountData) {
295
- this.#completeBuilderInitialization(this.pendingMountData)
296
- return
297
- }
288
+ if (this.pendingMountData) {
289
+ this.#completeBuilderInitialization(this.pendingMountData)
290
+ }
298
291
 
299
- // Pending data for mount is null at this stage
300
- if (typeof localStorageData === 'string') {
301
- await this.#updateComponentsFromString(localStorageData)
302
- this.#completeBuilderInitialization()
303
- return
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
+ }
304
297
  }
305
298
 
306
- // Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
307
- await nextTick()
308
- // Attach event listeners to all editable elements in the Builder
309
- await this.#addListenersToEditableElements()
310
-
311
- this.pageBuilderStateStore.setIsRestoring(false)
312
- this.pageBuilderStateStore.setIsLoadingGlobal(false)
313
- }
314
-
315
- if (config && formType === 'create') {
316
- // Pending data for mount is null at this stage
317
- if (typeof localStorageData === 'string') {
318
- await this.#updateComponentsFromString(localStorageData)
319
- this.#completeBuilderInitialization()
320
- 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
+ }
321
305
  }
322
306
 
307
+ //
308
+ //
309
+ //
310
+ //
311
+ //
323
312
  // Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
324
313
  await nextTick()
325
314
  // Attach event listeners to all editable elements in the Builder
@@ -389,7 +378,6 @@ export class PageBuilderService {
389
378
  return result
390
379
  } catch (err) {
391
380
  console.error('Not able to start the Page Builder', err)
392
- this.pageBuilderStateStore.setIsLoadingGlobal(false)
393
381
  return {
394
382
  error: true as const,
395
383
  reason: 'Failed to start the Page Builder due to an unexpected error.',
@@ -398,11 +386,8 @@ export class PageBuilderService {
398
386
  }
399
387
 
400
388
  async #completeBuilderInitialization(passedComponentsArray?: BuilderResourceData): Promise<void> {
401
- this.pageBuilderStateStore.setIsLoadingGlobal(true)
402
389
  const localStorageData = this.loadStoredComponentsFromStorage()
403
390
 
404
- await delay(300)
405
-
406
391
  // Deselect any selected or hovered elements in the builder UI
407
392
  await this.clearHtmlSelection()
408
393
 
@@ -436,7 +421,6 @@ export class PageBuilderService {
436
421
  // Attach event listeners to all editable elements in the Builder
437
422
  await this.#addListenersToEditableElements()
438
423
  // Show a global loading indicator while initializing
439
- this.pageBuilderStateStore.setIsLoadingGlobal(false)
440
424
 
441
425
  // Clean up any old localStorage items related to previous builder sessions
442
426
  this.deleteOldPageBuilderLocalStorage()