@myissue/vue-website-page-builder 3.3.1 → 3.3.11

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": "v3.3.1",
3
+ "version": "v3.3.11",
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",
@@ -17,7 +17,7 @@
17
17
  </div>
18
18
  <div
19
19
  :class="[expanded ? 'pbx-block' : 'pbx-hidden']"
20
- class="pbx-px-4 pbx-ease-linear pbx-duration-75"
20
+ class="pbx-px-4 pbx-ease-linear pbx-duration-75 pbx-pb-8"
21
21
  >
22
22
  <slot name="content" />
23
23
  </div>
@@ -260,10 +260,7 @@ const ensureBuilderInitialized = function () {
260
260
  }
261
261
 
262
262
  onMounted(async () => {
263
- // Try to mount any pending data if #pagebuilder is now present
264
- if (pageBuilderService.statuspendingMountData()) {
265
- await pageBuilderService.tryMountPendingData()
266
- }
263
+ await pageBuilderService.tryMountPendingData()
267
264
 
268
265
  // Check if Builder started
269
266
  await delay(10000)
@@ -224,6 +224,11 @@ export class PageBuilderService {
224
224
  this.#updateLocalStorageItemName()
225
225
 
226
226
  this.completeBuilderInitialization()
227
+
228
+ const formType = config.updateOrCreate && config.updateOrCreate.formType
229
+ if (formType === 'create') {
230
+ await this.mountComponentsToDOM('')
231
+ }
227
232
  }
228
233
 
229
234
  async completeBuilderInitialization() {
@@ -1836,7 +1841,14 @@ export class PageBuilderService {
1836
1841
 
1837
1842
  // If #pagebuilder is not present, cache the data and exit
1838
1843
  if (!pagebuilder) {
1839
- this.pendingMountData = passedData
1844
+ // For 'create', set pendingMountData to '' (empty string)
1845
+ const config = this.pageBuilderStateStore.getPageBuilderConfig
1846
+ const formType = config && config.updateOrCreate && config.updateOrCreate.formType
1847
+ if (formType === 'create') {
1848
+ this.pendingMountData = ''
1849
+ } else {
1850
+ this.pendingMountData = passedData
1851
+ }
1840
1852
  return
1841
1853
  }
1842
1854
 
@@ -1892,16 +1904,34 @@ export class PageBuilderService {
1892
1904
  }
1893
1905
  }
1894
1906
 
1895
- statuspendingMountData(): string | null {
1896
- return this.pendingMountData
1897
- }
1898
-
1899
- // Try re-mounting
1900
1907
  async tryMountPendingData() {
1901
- if (this.pendingMountData && document.querySelector('#pagebuilder')) {
1908
+ const pagebuilder = document.querySelector('#pagebuilder')
1909
+
1910
+ // Only run if #pagebuilder exists
1911
+ if (!pagebuilder) return
1912
+
1913
+ // If pendingMountData is a non-empty string (update or demo), always mount
1914
+ if (this.pendingMountData && typeof this.pendingMountData === 'string') {
1902
1915
  await this.mountComponentsToDOM(this.pendingMountData)
1903
1916
  this.pendingMountData = null
1904
1917
  this.completeBuilderInitialization()
1918
+ return
1919
+ }
1920
+
1921
+ // If pendingMountData is exactly '', and formType is 'create', and no components are mounted, mount for create
1922
+ const config = this.pageBuilderStateStore.getPageBuilderConfig
1923
+ const formType = config && config.updateOrCreate && config.updateOrCreate.formType
1924
+ const components = this.pageBuilderStateStore.getComponents
1925
+
1926
+ if (
1927
+ this.pendingMountData === '' &&
1928
+ formType === 'create' &&
1929
+ (!components || (Array.isArray(components) && components.length === 0))
1930
+ ) {
1931
+ await this.mountComponentsToDOM('')
1932
+ this.pendingMountData = null
1933
+ this.completeBuilderInitialization()
1934
+ return
1905
1935
  }
1906
1936
  }
1907
1937