@myissue/vue-website-page-builder 3.3.14 → 3.3.18

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.14",
3
+ "version": "3.3.18",
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",
@@ -594,9 +594,9 @@ const handleDownloadHTML = function () {
594
594
  <div class="pbx-flex pbx-items-left pbx-flex-col pbx-gap-1">
595
595
  <h3 class="pbx-myQuaternaryHeader">Complete Configuration Overview</h3>
596
596
  <p class="pbx-myPrimaryParagraph pbx-text-xs">
597
- omplete configuration object currently used by the Page Builder. It includes information
598
- about the user, form behavior, branding settings, and other context-specific data needed
599
- for rendering and managing the builder environment.
597
+ Complete configuration object currently used by the Page Builder. Includes user
598
+ information, branding settings, and other context-specific data needed for rendering and
599
+ managing the builder environment.
600
600
  </p>
601
601
  </div>
602
602
 
@@ -83,7 +83,7 @@ const configPageBuilder = {
83
83
 
84
84
  onMounted(async () => {
85
85
  const result = await pageBuilderService.startBuilder(configPageBuilder, html)
86
- //
86
+ console.log('Page Builder Result:', result)
87
87
  //
88
88
  //
89
89
  //
@@ -278,7 +278,7 @@ onMounted(async () => {
278
278
 
279
279
  <template>
280
280
  <div
281
- class="pbx-font-sans pbx-max-w-full pbx-m-1 pbx-border pbx-border-gray-400 pbx-inset-x-0 pbx-z-10 pbx-bg-white pbx-overflow-x-scroll"
281
+ class="pbx-font-sans pbx-max-w-full pbx-m-1 pbx-border pbx-border-gray-400 pbx-inset-x-0 pbx-z-10 pbx-bg-white pbx-overflow-x-auto"
282
282
  >
283
283
  <div id="pagebuilder-top-area" class="lg:pbx-px-4 pbx-pt-2 pbx-pb-4 pbx-mx-4 pbx-mb-4 pbx-mt-2">
284
284
  <GlobalLoader v-if="getIsLoadingGlobal & !openAppNotStartedModal"></GlobalLoader>
@@ -643,47 +643,12 @@ onMounted(async () => {
643
643
  </div>
644
644
  </div>
645
645
  <!-- Added Components to DOM # end -->
646
-
647
- <!-- Add Component # start -->
648
-
649
- <div
650
- @click="
651
- async () => {
652
- await pageBuilderService.clearHtmlSelection()
653
- }
654
- "
655
- id="pagebuilder-bottom-components-area"
656
- class="pbx-pt-8 pbx-pb-12 pbx-text-center focus:pbx-outline-none focus:pbx-ring-2 focus:pbx-ring-indigo-500 focus:pbx-ring-offset-2 pbx-my-2 pbx-mx-4"
657
- :class="{ 'pbx-border-t pbx-border-gray-200': getComponents.length > 0 }"
658
- >
659
- <div class="pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-font-medium">
660
- <span class="lg:pbx-block pbx-hidden">
661
- <div>Add new components to the bottom of the page</div>
662
- </span>
663
- </div>
664
-
665
- <div class="pbx-mt-6 pbx-flex pbx-items-center pbx-gap-2 pbx-justify-center">
666
- <button
667
- @click="
668
- () => {
669
- pageBuilderStateStore.setComponentArrayAddMethod('unshift')
670
- handleAddComponent()
671
- }
672
- "
673
- type="button"
674
- class="pbx-myPrimaryButton pbx-flex pbx-items-center pbx-gap-2 pbx-justify-center"
675
- >
676
- <span class="pbx-myMediumIcon material-symbols-outlined"> interests </span>
677
- <span class="pbx-font-medium"> Add new Components </span>
678
- </button>
679
- </div>
680
- </div>
681
- <!-- Add Component # end -->
682
646
  </div>
683
647
  </div>
684
- <!-- Add Component # end -->
685
648
  </main>
686
649
 
650
+ <!-- Add Component # end -->
651
+
687
652
  <aside
688
653
  aria-label="Menu"
689
654
  id="pagebuilder-right-area"
@@ -697,6 +662,31 @@ onMounted(async () => {
697
662
  </RightSidebarEditor>
698
663
  </aside>
699
664
  </div>
665
+ <div
666
+ class="pbx-flex pbx-items-center pbx-justify-center pbx-border-t pbx-border-gray-200 pbx-py-4"
667
+ >
668
+ <div
669
+ @click="
670
+ () => {
671
+ pageBuilderStateStore.setComponentArrayAddMethod('push')
672
+ handleAddComponent()
673
+ }
674
+ "
675
+ class="pbx-flex pbx-items-center pbx-justify-center pbx-gap-2 pbx-cursor-pointer"
676
+ >
677
+ <span class="lg:pbx-block pbx-hidden">
678
+ <div class="pbx-whitespace-nowrap">Add to the bottom</div>
679
+ </span>
680
+ <div class="pbx-flex pbx-gap-2 pbx-items-center pbx-justify-center">
681
+ <button
682
+ type="button"
683
+ class="pbx-h-10 pbx-w-10 pbx-cursor-pointer pbx-rounded-full pbx-flex pbx-items-center pbx-border-none pbx-justify-center pbx-bg-gray-50 pbx-aspect-square hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white focus-visible:pbx-ring-0"
684
+ >
685
+ <span class="pbx-myMediumIcon material-symbols-outlined"> interests </span>
686
+ </button>
687
+ </div>
688
+ </div>
689
+ </div>
700
690
  </div>
701
691
  </div>
702
692
  </template>
@@ -181,10 +181,6 @@ export class PageBuilderService {
181
181
  this.pageBuilderStateStore.getPageBuilderConfig.updateOrCreate &&
182
182
  this.pageBuilderStateStore.getPageBuilderConfig.updateOrCreate.formType
183
183
 
184
- if (Array.isArray(components) && components.length === 0) {
185
- return { error: false as const, message: 'No components provided (empty array).' }
186
- }
187
-
188
184
  if (
189
185
  Array.isArray(components) &&
190
186
  components.length >= 1 &&
@@ -198,14 +194,6 @@ export class PageBuilderService {
198
194
  status: 'validation_failed',
199
195
  }
200
196
  }
201
- if (formType === 'create' && components) {
202
- return {
203
- error: true as const,
204
- warning:
205
- 'You cannot set formType to create in your configuration while also passing a components data array to the Page Builder. Please set formType to update.',
206
- status: 'validation_failed',
207
- }
208
- }
209
197
 
210
198
  // Must be an array
211
199
  if (!Array.isArray(components)) {
@@ -218,20 +206,7 @@ export class PageBuilderService {
218
206
  // Check that the first item looks like a component
219
207
  const first = components[0]
220
208
 
221
- // Check that the first item is not an empty object
222
- if (isEmptyObject(first)) {
223
- console.error(
224
- 'The first object in the array is empty. Each component must be a non-empty object and include an html_code key.',
225
- )
226
- return {
227
- error: true as const,
228
- reason:
229
- "The first object in the array is empty. Each component must be a non-empty object and include an 'html_code' key.",
230
- }
231
- }
232
-
233
209
  if (first && 'html_code' in first && typeof first.html_code !== 'string') {
234
- console.error("The 'html_code' property in the first object must be a string.")
235
210
  return {
236
211
  error: true as const,
237
212
  reason: "The 'html_code' property in the first object must be a string.",
@@ -239,16 +214,17 @@ export class PageBuilderService {
239
214
  }
240
215
 
241
216
  // Check that the first item has an 'html_code' key
242
- if (!first || !('html_code' in first)) {
243
- console.error("The first object in the array must include an 'html_code' key.")
244
- return {
245
- error: true as const,
246
- reason: "The first object in the array must include an 'html_code' key.",
217
+ if (Array.isArray(components) && components.length >= 1) {
218
+ if (!first || !('html_code' in first)) {
219
+ return {
220
+ error: true as const,
221
+ reason: "The first object in the array must include an 'html_code' key.",
222
+ }
247
223
  }
248
224
  }
249
225
 
250
226
  // No errors found
251
- return { error: false as const }
227
+ return
252
228
  }
253
229
 
254
230
  #validateConfig(config: PageBuilderConfig): void {
@@ -404,11 +380,24 @@ export class PageBuilderService {
404
380
  this.#completeBuilderInitialization(passedComponentsArray)
405
381
  }
406
382
 
407
- // Return both the success message and validation info if present
408
- return {
383
+ // result to end user
384
+
385
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
386
+ const result: any = {
409
387
  message: 'Page builder started successfully.',
410
- ...(validation || {}),
411
388
  }
389
+
390
+ if (validation) {
391
+ result.validation = validation
392
+ }
393
+
394
+ // passedComponentsArray
395
+ if (Array.isArray(passedComponentsArray) && passedComponentsArray.length >= 0) {
396
+ result.passedComponentsArray = passedComponentsArray
397
+ }
398
+
399
+ // Return messages, validation info if present etc.
400
+ return result
412
401
  } catch (err) {
413
402
  console.error('Not able to start the Page Builder', err)
414
403
  this.pageBuilderStateStore.setIsLoadingGlobal(false)
@@ -452,18 +441,6 @@ export class PageBuilderService {
452
441
  }
453
442
  }
454
443
  //
455
- //
456
- //
457
- //
458
- //
459
- //
460
- //
461
- //
462
- //
463
- //
464
- //
465
- //
466
- //
467
444
 
468
445
  // Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
469
446
  await nextTick()
@@ -719,25 +696,12 @@ export class PageBuilderService {
719
696
  const pageBuilder = document.querySelector('#contains-pagebuilder')
720
697
  // scoll to top or bottom # end
721
698
  if (pageBuilder) {
722
- if (
723
- this.getComponentArrayAddMethod.value === 'unshift' ||
724
- this.getComponentArrayAddMethod.value === 'push'
725
- ) {
726
- // push to top
727
- if (this.getComponentArrayAddMethod.value === 'unshift') {
728
- pageBuilder.scrollTo({
729
- top: 0,
730
- behavior: 'smooth',
731
- })
732
- }
733
-
734
- // push to bottom
735
- if (this.getComponentArrayAddMethod.value === 'push') {
736
- pageBuilder.scrollTo({
737
- top: 0,
738
- behavior: 'smooth',
739
- })
740
- }
699
+ // push to top
700
+ if (this.getComponentArrayAddMethod.value === 'unshift') {
701
+ pageBuilder.scrollTo({
702
+ top: 0,
703
+ behavior: 'smooth',
704
+ })
741
705
  }
742
706
  }
743
707
 
@@ -1898,9 +1862,23 @@ export class PageBuilderService {
1898
1862
 
1899
1863
  this.pageBuilderStateStore.setPushComponents({
1900
1864
  component: clonedComponent,
1901
- componentArrayAddMethod: this.getComponentArrayAddMethod.value || 'push',
1865
+ componentArrayAddMethod: this.getComponentArrayAddMethod.value
1866
+ ? this.getComponentArrayAddMethod.value
1867
+ : 'push',
1902
1868
  })
1903
1869
 
1870
+ const pageBuilder = document.querySelector('#contains-pagebuilder')
1871
+ // scoll to top or bottom # end
1872
+ if (pageBuilder) {
1873
+ // push to bottom
1874
+ if (this.getComponentArrayAddMethod.value === 'push') {
1875
+ pageBuilder.scrollTo({
1876
+ top: pageBuilder.scrollHeight + 50,
1877
+ behavior: 'smooth',
1878
+ })
1879
+ }
1880
+ }
1881
+
1904
1882
  // Wait for Vue to finish DOM updates before attaching event listeners. This ensure elements exist in the DOM.
1905
1883
  await nextTick()
1906
1884
  // Attach event listeners to all editable elements in the Builder
package/src/css/app.css CHANGED
@@ -372,3 +372,16 @@ h2 {
372
372
  h3 {
373
373
  @apply pbx-text-2xl pbx-mt-4 pbx-mb-3 pbx-font-medium;
374
374
  }
375
+
376
+ /* CSS for content inside page builder # start */
377
+ #page-builder-editor .tiptap {
378
+ outline: none !important;
379
+ box-shadow: none !important;
380
+ background: #fff;
381
+ min-height: 25rem;
382
+ border: 1px solid #aaa;
383
+ border-radius: 10px;
384
+ padding: 6px;
385
+ margin-bottom: 20px;
386
+ padding-bottom: 100px;
387
+ }
@@ -12,18 +12,6 @@ These styles affect all HTML elements (like input, button, h1, etc.) in the cons
12
12
  #pagebuilder a {
13
13
  pointer-events: none;
14
14
  }
15
- /* CSS for content inside page builder # start */
16
- #page-builder-editor .tiptap {
17
- outline: none !important;
18
- box-shadow: none !important;
19
- background: #fff;
20
- min-height: 25rem;
21
- border: 1px solid #aaa;
22
- border-radius: 10px;
23
- padding: 6px;
24
- margin-bottom: 20px;
25
- padding-bottom: 100px;
26
- }
27
15
 
28
16
  #pagebuilder #youtube-video::before {
29
17
  content: 'Select Video Element';