@myissue/vue-website-page-builder 3.3.14 → 3.3.15
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/dist/vue-website-page-builder.css +1 -1
- package/dist/vue-website-page-builder.js +1693 -1717
- package/dist/vue-website-page-builder.umd.cjs +33 -33
- package/package.json +1 -1
- package/src/DemoComponents/HomeSection.vue +1 -1
- package/src/PageBuilder/PageBuilder.vue +28 -38
- package/src/composables/PageBuilderService.ts +36 -64
- package/src/css/app.css +13 -0
- package/src/css/dev-global.css +0 -12
package/package.json
CHANGED
|
@@ -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-
|
|
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-cursor-pointer 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"
|
|
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 (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
|
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
|
-
//
|
|
408
|
-
|
|
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,20 @@ export class PageBuilderService {
|
|
|
719
696
|
const pageBuilder = document.querySelector('#contains-pagebuilder')
|
|
720
697
|
// scoll to top or bottom # end
|
|
721
698
|
if (pageBuilder) {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
top: 0,
|
|
730
|
-
behavior: 'smooth',
|
|
731
|
-
})
|
|
732
|
-
}
|
|
699
|
+
// push to top
|
|
700
|
+
if (this.getComponentArrayAddMethod.value === 'unshift') {
|
|
701
|
+
pageBuilder.scrollTo({
|
|
702
|
+
top: 0,
|
|
703
|
+
behavior: 'smooth',
|
|
704
|
+
})
|
|
705
|
+
}
|
|
733
706
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}
|
|
707
|
+
// push to bottom
|
|
708
|
+
if (this.getComponentArrayAddMethod.value === 'push') {
|
|
709
|
+
pageBuilder.scrollTo({
|
|
710
|
+
top: pageBuilder.scrollHeight + 400,
|
|
711
|
+
behavior: 'smooth',
|
|
712
|
+
})
|
|
741
713
|
}
|
|
742
714
|
}
|
|
743
715
|
|
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
|
+
}
|
package/src/css/dev-global.css
CHANGED
|
@@ -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';
|