@myissue/vue-website-page-builder 3.3.54 → 3.3.56
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 +3 -15
- package/dist/home/page_builder_architecture.png +0 -0
- package/dist/vue-website-page-builder.js +873 -895
- package/dist/vue-website-page-builder.umd.cjs +31 -31
- package/package.json +1 -1
- package/src/Components/PageBuilder/EditorMenu/Editables/ClassEditor.vue +46 -25
- package/src/Components/PageBuilder/EditorMenu/RightSidebarEditor.vue +52 -5
- package/src/Components/PageBuilder/Settings/PageBuilderSettings.vue +1 -48
- package/src/DemoComponents/HomeSection.vue +1 -1
- package/src/composables/PageBuilderService.ts +10 -8
package/package.json
CHANGED
|
@@ -6,13 +6,10 @@ import { getPageBuilder } from '../../../../composables/builderInstance'
|
|
|
6
6
|
|
|
7
7
|
const pageBuilderService = getPageBuilder()
|
|
8
8
|
|
|
9
|
-
// Use shared store instance
|
|
10
9
|
const pageBuilderStateStore = sharedPageBuilderStore
|
|
11
10
|
|
|
12
11
|
const currentClasses = ref(null)
|
|
13
|
-
const getCurrentClasses = computed(() =>
|
|
14
|
-
return pageBuilderStateStore.getCurrentClasses
|
|
15
|
-
})
|
|
12
|
+
const getCurrentClasses = computed(() => pageBuilderStateStore.getCurrentClasses)
|
|
16
13
|
|
|
17
14
|
watch(
|
|
18
15
|
getCurrentClasses,
|
|
@@ -23,9 +20,28 @@ watch(
|
|
|
23
20
|
)
|
|
24
21
|
|
|
25
22
|
const inputClass = ref('')
|
|
23
|
+
const errorMessage = ref('') // <-- error message reactive ref
|
|
26
24
|
|
|
27
|
-
const handleAddClasses = async
|
|
28
|
-
|
|
25
|
+
const handleAddClasses = async () => {
|
|
26
|
+
const classToAdd = inputClass.value.trim()
|
|
27
|
+
|
|
28
|
+
if (!classToAdd) {
|
|
29
|
+
errorMessage.value = 'Please enter a class name.'
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Add prefix if missing
|
|
34
|
+
const prefixedClass = classToAdd.startsWith('pbx-') ? classToAdd : 'pbx-' + classToAdd
|
|
35
|
+
|
|
36
|
+
// Check if class already exists
|
|
37
|
+
if (currentClasses.value?.includes(prefixedClass)) {
|
|
38
|
+
errorMessage.value = `Class "${prefixedClass}" is already added.`
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
errorMessage.value = '' // Clear error
|
|
43
|
+
|
|
44
|
+
pageBuilderService.handleAddClasses(classToAdd)
|
|
29
45
|
await pageBuilderService.initializeElementStyles()
|
|
30
46
|
|
|
31
47
|
inputClass.value = ''
|
|
@@ -36,6 +52,13 @@ const handleAddClasses = async function () {
|
|
|
36
52
|
<EditorAccordion>
|
|
37
53
|
<template #title>Generated CSS</template>
|
|
38
54
|
<template #content>
|
|
55
|
+
<p class="pbx-myPrimaryParagraph pbx-font-medium pbx-py-0 pbx-my-4">CSS applied</p>
|
|
56
|
+
|
|
57
|
+
<label class="pbx-myPrimaryInputLabel">
|
|
58
|
+
This is the CSS applied by the builder. Add your own CSS and press Enter to apply it to the
|
|
59
|
+
selected element.
|
|
60
|
+
</label>
|
|
61
|
+
|
|
39
62
|
<div class="pbx-flex pbx-flex-row pbx-flex-wrap pbx-gap-2 pbx-mt-2 pbx-mb-4">
|
|
40
63
|
<div
|
|
41
64
|
v-for="className in currentClasses"
|
|
@@ -56,28 +79,26 @@ const handleAddClasses = async function () {
|
|
|
56
79
|
</div>
|
|
57
80
|
</div>
|
|
58
81
|
|
|
59
|
-
<div
|
|
82
|
+
<div>
|
|
83
|
+
<label class="pbx-myPrimaryInputLabel">
|
|
84
|
+
Add your CSS.
|
|
85
|
+
<br />
|
|
86
|
+
The pbx- prefix is added automatically.
|
|
87
|
+
</label>
|
|
60
88
|
<div class="pbx-flex pbx-gap-2 pbx-item-center">
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/>
|
|
72
|
-
<div
|
|
73
|
-
class="pbx-border-none pbx-rounded pbx-flex pbx-items-center pbx-justify-center pbx-h-full pbx-w-8"
|
|
74
|
-
>
|
|
75
|
-
<kbd class="pbx-myPrimaryParagraph pbx-text-gray-400 pbx-border-none"> ⏎ </kbd>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
89
|
+
<input
|
|
90
|
+
v-model="inputClass"
|
|
91
|
+
type="text"
|
|
92
|
+
placeholder="Type class"
|
|
93
|
+
@keydown.enter="handleAddClasses()"
|
|
94
|
+
autocomplete="off"
|
|
95
|
+
class="pbx-myPrimaryInput"
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<button @click="handleAddClasses" type="button" class="pbx-myPrimaryButton">Add</button>
|
|
78
99
|
</div>
|
|
79
|
-
<p class="pbx-myPrimaryInputError"></p>
|
|
80
100
|
</div>
|
|
101
|
+
<p v-if="errorMessage" class="pbx-myPrimaryInputError">{{ errorMessage }}</p>
|
|
81
102
|
</template>
|
|
82
103
|
</EditorAccordion>
|
|
83
104
|
</template>
|
|
@@ -15,6 +15,8 @@ import TipTap from '../../TipTap/TipTap.vue'
|
|
|
15
15
|
import EditGetElement from './Editables/EditGetElement.vue'
|
|
16
16
|
import ElementEditor from './Editables/ElementEditor.vue'
|
|
17
17
|
import { getPageBuilder } from '../../../composables/builderInstance'
|
|
18
|
+
import EditorAccordion from '../EditorMenu/EditorAccordion.vue'
|
|
19
|
+
import fullHTMLContent from '../../../utils/builder/html-doc-declaration-with-components'
|
|
18
20
|
const pageBuilderService = getPageBuilder()
|
|
19
21
|
// Use shared store instance
|
|
20
22
|
const pageBuilderStateStore = sharedPageBuilderStore
|
|
@@ -62,6 +64,37 @@ function onScroll() {
|
|
|
62
64
|
lastScrollTop = scrollContainer.value.scrollTop
|
|
63
65
|
}
|
|
64
66
|
}
|
|
67
|
+
|
|
68
|
+
// generate HTML
|
|
69
|
+
const generateHTML = function (filename, HTML) {
|
|
70
|
+
const element = document.createElement('a')
|
|
71
|
+
element.setAttribute(
|
|
72
|
+
'href',
|
|
73
|
+
'data:text/html;charset=utf-8,' + encodeURIComponent(fullHTMLContent(HTML)),
|
|
74
|
+
)
|
|
75
|
+
element.setAttribute('download', filename)
|
|
76
|
+
|
|
77
|
+
element.style.display = 'none'
|
|
78
|
+
document.body.appendChild(element)
|
|
79
|
+
|
|
80
|
+
element.click()
|
|
81
|
+
|
|
82
|
+
document.body.removeChild(element)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const getComponents = computed(() => {
|
|
86
|
+
return pageBuilderStateStore.getComponents
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const downloadedComponents = ref(null)
|
|
90
|
+
// handle download HTML
|
|
91
|
+
const handleDownloadHTML = function () {
|
|
92
|
+
downloadedComponents.value = getComponents.value.map((component) => {
|
|
93
|
+
return component.html_code
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
generateHTML('downloaded_html.html', downloadedComponents.value.join(''))
|
|
97
|
+
}
|
|
65
98
|
</script>
|
|
66
99
|
|
|
67
100
|
<template>
|
|
@@ -119,11 +152,25 @@ function onScroll() {
|
|
|
119
152
|
</article>
|
|
120
153
|
</div>
|
|
121
154
|
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
155
|
+
<article class="pbx-my-1 pbx-bg-white">
|
|
156
|
+
<EditorAccordion>
|
|
157
|
+
<template #title>Download HTML</template>
|
|
158
|
+
<template #content>
|
|
159
|
+
<p class="pbx-myPrimaryParagraph pbx-font-medium pbx-py-0 pbx-my-4">
|
|
160
|
+
Download Page as HTML
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<div class="pbx-mt-4">
|
|
164
|
+
<button @click="handleDownloadHTML" type="button" class="pbx-myPrimaryButton">
|
|
165
|
+
Download HTML file
|
|
166
|
+
</button>
|
|
167
|
+
</div>
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<!-- Download Layout HTML - end -->
|
|
171
|
+
</EditorAccordion>
|
|
172
|
+
</article>
|
|
173
|
+
|
|
127
174
|
<article class="pbx-mt-1 pbx-bg-white"></article>
|
|
128
175
|
</div>
|
|
129
176
|
</div>
|
|
@@ -1,48 +1,16 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, computed } from 'vue'
|
|
3
3
|
import { sharedPageBuilderStore } from '../../../stores/shared-store'
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import { isEmptyObject } from '../../../helpers/isEmptyObject.ts'
|
|
6
6
|
const version = __APP_VERSION__
|
|
7
7
|
|
|
8
8
|
// Use shared store instance
|
|
9
9
|
const pageBuilderStateStore = sharedPageBuilderStore
|
|
10
10
|
|
|
11
|
-
const downloadedComponents = ref(null)
|
|
12
|
-
|
|
13
11
|
const getPageBuilderConfig = computed(() => {
|
|
14
12
|
return pageBuilderStateStore.getPageBuilderConfig
|
|
15
13
|
})
|
|
16
|
-
|
|
17
|
-
const getComponents = computed(() => {
|
|
18
|
-
return pageBuilderStateStore.getComponents
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
// generate HTML
|
|
22
|
-
const generateHTML = function (filename, HTML) {
|
|
23
|
-
const element = document.createElement('a')
|
|
24
|
-
element.setAttribute(
|
|
25
|
-
'href',
|
|
26
|
-
'data:text/html;charset=utf-8,' + encodeURIComponent(fullHTMLContent(HTML)),
|
|
27
|
-
)
|
|
28
|
-
element.setAttribute('download', filename)
|
|
29
|
-
|
|
30
|
-
element.style.display = 'none'
|
|
31
|
-
document.body.appendChild(element)
|
|
32
|
-
|
|
33
|
-
element.click()
|
|
34
|
-
|
|
35
|
-
document.body.removeChild(element)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// handle download HTML
|
|
39
|
-
const handleDownloadHTML = function () {
|
|
40
|
-
downloadedComponents.value = getComponents.value.map((component) => {
|
|
41
|
-
return component.html_code
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
generateHTML('downloaded_html.html', downloadedComponents.value.join(''))
|
|
45
|
-
}
|
|
46
14
|
</script>
|
|
47
15
|
|
|
48
16
|
<template>
|
|
@@ -577,21 +545,6 @@ const handleDownloadHTML = function () {
|
|
|
577
545
|
</div>
|
|
578
546
|
</div>
|
|
579
547
|
<!-- Advanced Settings - end -->
|
|
580
|
-
<!-- Download Layout HTML - start -->
|
|
581
|
-
<div
|
|
582
|
-
class="pbx-mt-4 pbx-mb-4 pbx-py-8 pbx-px-2 pbx-border pbx-border-solid pbx-border-gray-600 pbx-rounded-xl"
|
|
583
|
-
>
|
|
584
|
-
<div class="pbx-flex pbx-items-left pbx-flex-col pbx-gap-1">
|
|
585
|
-
<h3 class="pbx-myQuaternaryHeader">Download Page as HTML</h3>
|
|
586
|
-
<p class="pbx-myPrimaryParagraph pbx-text-xs">Download current page layout.</p>
|
|
587
|
-
</div>
|
|
588
|
-
<div class="pbx-mt-4">
|
|
589
|
-
<button @click="handleDownloadHTML" type="button" class="pbx-myPrimaryButton">
|
|
590
|
-
Download HTML file
|
|
591
|
-
</button>
|
|
592
|
-
</div>
|
|
593
|
-
</div>
|
|
594
|
-
<!-- Download Layout HTML - end -->
|
|
595
548
|
|
|
596
549
|
<!-- Congig - start -->
|
|
597
550
|
<div
|
|
@@ -850,22 +850,24 @@ export class PageBuilderService {
|
|
|
850
850
|
handleAddClasses(userSelectedClass: string): void {
|
|
851
851
|
if (
|
|
852
852
|
typeof userSelectedClass === 'string' &&
|
|
853
|
-
userSelectedClass !== '' &&
|
|
853
|
+
userSelectedClass.trim() !== '' &&
|
|
854
854
|
!userSelectedClass.includes(' ') &&
|
|
855
|
-
// Check if class already exists
|
|
856
|
-
!this.getElement.value?.classList.contains(userSelectedClass)
|
|
855
|
+
// Check if class (with prefix) already exists
|
|
856
|
+
!this.getElement.value?.classList.contains('pbx-' + userSelectedClass.trim())
|
|
857
857
|
) {
|
|
858
|
-
// Remove any leading/trailing spaces
|
|
859
858
|
const cleanedClass = userSelectedClass.trim()
|
|
860
859
|
|
|
861
|
-
|
|
860
|
+
// Add prefix if missing
|
|
861
|
+
const prefixedClass = cleanedClass.startsWith('pbx-') ? cleanedClass : 'pbx-' + cleanedClass
|
|
862
862
|
|
|
863
|
-
|
|
863
|
+
console.log('Adding class:', prefixedClass)
|
|
864
|
+
|
|
865
|
+
this.getElement.value?.classList.add(prefixedClass)
|
|
864
866
|
|
|
865
|
-
this.pageBuilderStateStore.
|
|
867
|
+
this.pageBuilderStateStore.setElement(this.getElement.value)
|
|
868
|
+
this.pageBuilderStateStore.setClass(prefixedClass)
|
|
866
869
|
}
|
|
867
870
|
}
|
|
868
|
-
|
|
869
871
|
handleFontFamily(userSelectedFontFamily?: string): void {
|
|
870
872
|
this.#applyElementClassChanges(
|
|
871
873
|
userSelectedFontFamily,
|