@myissue/vue-website-page-builder 3.4.19 → 3.4.21
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 +32 -26
- package/dist/vue-website-page-builder.js +1263 -1259
- package/dist/vue-website-page-builder.umd.cjs +46 -46
- package/package.json +3 -5
- package/src/App.vue +0 -28
- package/src/Components/Homepage/Footer.vue +0 -32
- package/src/Components/Homepage/Navbar.vue +0 -25
- package/src/Components/Layouts/FullWidthElement.vue +0 -34
- package/src/Components/Loaders/GlobalLoader.vue +0 -18
- package/src/Components/Modals/BuilderComponents.vue +0 -53
- package/src/Components/Modals/DynamicModalBuilder.vue +0 -209
- package/src/Components/Modals/MediaLibraryModal.vue +0 -61
- package/src/Components/Modals/ModalBuilder.vue +0 -117
- package/src/Components/PageBuilder/EditorMenu/Editables/BackgroundColorEditor.vue +0 -121
- package/src/Components/PageBuilder/EditorMenu/Editables/BorderRadius.vue +0 -188
- package/src/Components/PageBuilder/EditorMenu/Editables/Borders.vue +0 -176
- package/src/Components/PageBuilder/EditorMenu/Editables/ClassEditor.vue +0 -112
- package/src/Components/PageBuilder/EditorMenu/Editables/ComponentTopMenu.vue +0 -108
- package/src/Components/PageBuilder/EditorMenu/Editables/EditGetElement.vue +0 -541
- package/src/Components/PageBuilder/EditorMenu/Editables/HTMLEditor.vue +0 -203
- package/src/Components/PageBuilder/EditorMenu/Editables/ImageEditor.vue +0 -96
- package/src/Components/PageBuilder/EditorMenu/Editables/LinkEditor.vue +0 -315
- package/src/Components/PageBuilder/EditorMenu/Editables/ManageBackgroundOpacity.vue +0 -107
- package/src/Components/PageBuilder/EditorMenu/Editables/ManageOpacity.vue +0 -106
- package/src/Components/PageBuilder/EditorMenu/Editables/Margin.vue +0 -116
- package/src/Components/PageBuilder/EditorMenu/Editables/OpacityEditor.vue +0 -19
- package/src/Components/PageBuilder/EditorMenu/Editables/Padding.vue +0 -117
- package/src/Components/PageBuilder/EditorMenu/Editables/StyleEditor.vue +0 -123
- package/src/Components/PageBuilder/EditorMenu/Editables/TextColorEditor.vue +0 -123
- package/src/Components/PageBuilder/EditorMenu/Editables/Typography.vue +0 -237
- package/src/Components/PageBuilder/EditorMenu/EditorAccordion.vue +0 -46
- package/src/Components/PageBuilder/EditorMenu/RightSidebarEditor.vue +0 -368
- package/src/Components/PageBuilder/Settings/AdvancedPageBuilderSettings.vue +0 -476
- package/src/Components/PageBuilder/Settings/PageBuilderSettings.vue +0 -581
- package/src/Components/PageBuilder/ToolbarOption/ToolbarOption.vue +0 -248
- package/src/Components/PageBuilder/UndoRedo/UndoRedo.vue +0 -90
- package/src/Components/TipTap/TipTap.vue +0 -25
- package/src/Components/TipTap/TipTapInput.vue +0 -340
- package/src/PageBuilder/PageBuilder.vue +0 -1025
- package/src/PageBuilder/Preview.vue +0 -64
- package/src/composables/builderInstance.ts +0 -47
- package/src/composables/delay.ts +0 -5
- package/src/composables/extractCleanHTMLFromPageBuilder.ts +0 -59
- package/src/composables/preloadImage.ts +0 -8
- package/src/composables/useDebounce.ts +0 -8
- package/src/composables/usePageBuilderModal.ts +0 -25
- package/src/composables/useTranslations.ts +0 -28
- package/src/css/dev-global.css +0 -24
- package/src/css/style.css +0 -600
- package/src/helpers/isEmptyObject.ts +0 -5
- package/src/index.ts +0 -28
- package/src/locales/ar.json +0 -170
- package/src/locales/de.json +0 -171
- package/src/locales/en.json +0 -171
- package/src/locales/es.json +0 -171
- package/src/locales/fr.json +0 -171
- package/src/locales/hi.json +0 -172
- package/src/locales/ja.json +0 -171
- package/src/locales/pt.json +0 -171
- package/src/locales/ru.json +0 -171
- package/src/locales/zh-Hans.json +0 -171
- package/src/main.ts +0 -14
- package/src/plugin.ts +0 -16
- package/src/services/LocalStorageManager.ts +0 -25
- package/src/services/PageBuilderService.ts +0 -3191
- package/src/stores/page-builder-state.ts +0 -498
- package/src/stores/shared-store.ts +0 -13
- package/src/tailwind-safelist.html +0 -3
- package/src/tests/DefaultComponents/DefaultBuilderComponents.vue +0 -284
- package/src/tests/DefaultComponents/DefaultMediaLibraryComponent.vue +0 -10
- package/src/tests/PageBuilderTest.vue +0 -82
- package/src/tests/TestComponents/DemoBuilderComponentsTest.vue +0 -5
- package/src/tests/TestComponents/DemoMediaLibraryComponentTest.vue +0 -8
- package/src/tests/TestComponents/DemoUnsplash.vue +0 -389
- package/src/tests/componentsArray.test.json +0 -62
- package/src/tests/pageBuilderService.test.ts +0 -165
- package/src/types/global.d.ts +0 -11
- package/src/types/index.ts +0 -306
- package/src/utils/builder/html-doc-declaration-with-components.ts +0 -7
- package/src/utils/builder/tailwaind-colors.ts +0 -503
- package/src/utils/builder/tailwind-border-radius.ts +0 -67
- package/src/utils/builder/tailwind-border-style-width-color.ts +0 -272
- package/src/utils/builder/tailwind-font-sizes.ts +0 -75
- package/src/utils/builder/tailwind-font-styles.ts +0 -56
- package/src/utils/builder/tailwind-opacities.ts +0 -45
- package/src/utils/builder/tailwind-padding-margin.ts +0 -159
- package/src/utils/html-elements/component.ts +0 -485
- package/src/utils/html-elements/componentHelpers.ts +0 -98
- package/src/utils/html-elements/themes.ts +0 -85
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref, computed } from 'vue'
|
|
3
|
-
import componentHelpers from '../../utils/html-elements/componentHelpers'
|
|
4
|
-
import components from '../../utils/html-elements/component'
|
|
5
|
-
import themes from '../../utils/html-elements/themes'
|
|
6
|
-
import { usePageBuilderModal } from '../../composables/usePageBuilderModal'
|
|
7
|
-
import type { ComponentObject } from '../../types'
|
|
8
|
-
import { getPageBuilder } from '../../composables/builderInstance'
|
|
9
|
-
import { useTranslations } from '../../composables/useTranslations'
|
|
10
|
-
|
|
11
|
-
const { translate } = useTranslations()
|
|
12
|
-
|
|
13
|
-
const pageBuilderService = getPageBuilder()
|
|
14
|
-
|
|
15
|
-
defineProps({
|
|
16
|
-
customMediaComponent: {
|
|
17
|
-
type: Object,
|
|
18
|
-
default: null,
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const isLoading = ref(false)
|
|
23
|
-
|
|
24
|
-
const selectedThemeSelection = ref('Components')
|
|
25
|
-
|
|
26
|
-
const componentOrThemes = ['Components', 'Themes']
|
|
27
|
-
const selectedCategory = ref('All')
|
|
28
|
-
|
|
29
|
-
const categories = computed(() => {
|
|
30
|
-
const allCategories = components[0].components.data.map((comp) => comp.category)
|
|
31
|
-
return ['All', ...new Set(allCategories)]
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const filteredComponents = computed(() => {
|
|
35
|
-
if (selectedCategory.value === 'All') {
|
|
36
|
-
return components[0].components.data
|
|
37
|
-
}
|
|
38
|
-
return components[0].components.data.filter((comp) => comp.category === selectedCategory.value)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
const selectedThemeCategory = ref('All')
|
|
42
|
-
|
|
43
|
-
const themeCategories = computed(() => {
|
|
44
|
-
const allCategories = themes[0].themes.data.map((comp) => comp.category)
|
|
45
|
-
return ['All', ...new Set(allCategories)]
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
const filteredThemes = computed(() => {
|
|
49
|
-
if (selectedThemeCategory.value === 'All') {
|
|
50
|
-
return themes[0].themes.data
|
|
51
|
-
}
|
|
52
|
-
return themes[0].themes.data.filter((comp) => comp.category === selectedThemeCategory.value)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
// Get modal close function
|
|
56
|
-
const { closeAddComponentModal } = usePageBuilderModal()
|
|
57
|
-
|
|
58
|
-
// Super simple component addition with professional modal closing!
|
|
59
|
-
const handleDropTheme = async function (components: string) {
|
|
60
|
-
isLoading.value = true
|
|
61
|
-
|
|
62
|
-
await pageBuilderService.addTheme(components)
|
|
63
|
-
closeAddComponentModal()
|
|
64
|
-
isLoading.value = false
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Super simple component addition with professional modal closing!
|
|
68
|
-
const handleDropComponent = async function (componentObject: ComponentObject) {
|
|
69
|
-
isLoading.value = true
|
|
70
|
-
// Translate all occurrences of the hardcoded strings in the html_code
|
|
71
|
-
const translatedHtmlCode = componentObject.html_code
|
|
72
|
-
.replace(/Layouts and visual\./g, translate('Layouts and visual.'))
|
|
73
|
-
.replace(
|
|
74
|
-
/Start customizing by editing this default text directly in the editor\./g,
|
|
75
|
-
translate('Start customizing by editing this default text directly in the editor.'),
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
// Create a new component object with the translated html_code and title
|
|
79
|
-
const translatedComponentObject = {
|
|
80
|
-
...componentObject,
|
|
81
|
-
html_code: translatedHtmlCode,
|
|
82
|
-
title: componentObject.title,
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
await pageBuilderService.addComponent(translatedComponentObject)
|
|
86
|
-
closeAddComponentModal()
|
|
87
|
-
isLoading.value = false
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Helper function to convert ComponentData to ComponentObject
|
|
91
|
-
const convertToComponentObject = function (comp: any): ComponentObject {
|
|
92
|
-
return {
|
|
93
|
-
id: null, // Generate ID when needed in PageBuilderClass
|
|
94
|
-
html_code: comp.html_code,
|
|
95
|
-
title: comp.title,
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<style scoped>
|
|
101
|
-
/* Add any additional styling if needed */
|
|
102
|
-
.category-button {
|
|
103
|
-
background-color: #f0f0f0;
|
|
104
|
-
border: 1px solid #ccc;
|
|
105
|
-
padding: 8px 16px;
|
|
106
|
-
margin: 4px;
|
|
107
|
-
cursor: pointer;
|
|
108
|
-
border-radius: 4px;
|
|
109
|
-
}
|
|
110
|
-
.category-button.active {
|
|
111
|
-
background-color: #007bff;
|
|
112
|
-
color: white;
|
|
113
|
-
border-color: #007bff;
|
|
114
|
-
}
|
|
115
|
-
</style>
|
|
116
|
-
|
|
117
|
-
<template>
|
|
118
|
-
<div>
|
|
119
|
-
<template v-if="isLoading">
|
|
120
|
-
<div class="pbx-min-h-[90vh] pbx-h-[90vh]">
|
|
121
|
-
<div class="pbx-flex pbx-items-center pbx-justify-center">
|
|
122
|
-
<div
|
|
123
|
-
class="pbx-inline-block pbx-h-8 pbx-w-8 pbx-animate-spin pbx-rounded-full pbx-border-4 pbx-border-solid pbx-border-current pbx-border-r-transparent pbx-align-[-0.125em] motion-reduce:pbx-animate-[spin_1.5s_linear_infinite]"
|
|
124
|
-
>
|
|
125
|
-
<span
|
|
126
|
-
class="!pbx-absolute !pbx-m-px !pbx-h-px !pbx-w-px !pbx-overflow-hidden !pbx-whitespace-nowrap !pbx-border-0 !pbx-p-0 !pbx-[clip:rect(0,0,0,0)]"
|
|
127
|
-
>{{ translate('Loading...') }}</span
|
|
128
|
-
>
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
</div>
|
|
132
|
-
</template>
|
|
133
|
-
<div v-if="!isLoading">
|
|
134
|
-
<div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
|
|
135
|
-
<button
|
|
136
|
-
v-for="category in componentOrThemes"
|
|
137
|
-
:key="category"
|
|
138
|
-
@click="selectedThemeSelection = category"
|
|
139
|
-
class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
|
|
140
|
-
:class="[
|
|
141
|
-
selectedThemeSelection === category
|
|
142
|
-
? 'pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white'
|
|
143
|
-
: 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white',
|
|
144
|
-
]"
|
|
145
|
-
>
|
|
146
|
-
{{ translate(category) }}
|
|
147
|
-
</button>
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<!-- theme is selected start -->
|
|
151
|
-
<template v-if="selectedThemeSelection === 'Themes'">
|
|
152
|
-
<div class="pbx-mb-8">
|
|
153
|
-
<h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Themes') }}</h3>
|
|
154
|
-
<div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
|
|
155
|
-
<button
|
|
156
|
-
v-for="category in themeCategories"
|
|
157
|
-
:key="category"
|
|
158
|
-
@click="selectedThemeCategory = category"
|
|
159
|
-
class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
|
|
160
|
-
:class="[
|
|
161
|
-
selectedThemeCategory === category
|
|
162
|
-
? 'pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white'
|
|
163
|
-
: 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white',
|
|
164
|
-
]"
|
|
165
|
-
>
|
|
166
|
-
{{ translate(category) }}
|
|
167
|
-
</button>
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
<div
|
|
171
|
-
class="pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 pbx-gap-4 pbx-pb-4 pbx-min-h-[96rem]"
|
|
172
|
-
>
|
|
173
|
-
<div
|
|
174
|
-
v-for="theme in filteredThemes"
|
|
175
|
-
:key="theme.title"
|
|
176
|
-
class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer pbx-max-h-96"
|
|
177
|
-
@click="handleDropTheme(theme.html_code)"
|
|
178
|
-
>
|
|
179
|
-
<div
|
|
180
|
-
class="pbx-overflow-hidden pbx-whitespace-pre-line pbx-flex-1 pbx-h-auto pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 lg:pbx-py-10 pbx-py-8 pbx-px-2"
|
|
181
|
-
>
|
|
182
|
-
<!-- Use SVG preview instead of external images -->
|
|
183
|
-
<div
|
|
184
|
-
class="pbx-max-h-72 pbx-cursor-pointer pbx-bg-white pbx-mx-auto pbx-flex pbx-items-center pbx-justify-center"
|
|
185
|
-
v-html="theme.cover_image"
|
|
186
|
-
></div>
|
|
187
|
-
</div>
|
|
188
|
-
<div class="pbx-p-3">
|
|
189
|
-
<h4 class="pbx-myPrimaryParagraph pbx-text-sm pbx-font-normal">
|
|
190
|
-
{{ translate(theme.title) }}
|
|
191
|
-
</h4>
|
|
192
|
-
<div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
|
|
193
|
-
{{ translate('Click to add theme') }}
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
</template>
|
|
200
|
-
<!-- theme is selected end -->
|
|
201
|
-
|
|
202
|
-
<template v-if="selectedThemeSelection === 'Components'">
|
|
203
|
-
<!-- Helper Components Section -->
|
|
204
|
-
<div class="pbx-mb-8">
|
|
205
|
-
<h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Helper Components') }}</h3>
|
|
206
|
-
<div
|
|
207
|
-
class="pbx-px-2 pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 lg:pbx-grid-cols-4 pbx-gap-4"
|
|
208
|
-
>
|
|
209
|
-
<div
|
|
210
|
-
v-for="helper in componentHelpers"
|
|
211
|
-
:key="helper.title"
|
|
212
|
-
class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer pbx-max-h-96 pbx-p-4"
|
|
213
|
-
@click="handleDropComponent(helper)"
|
|
214
|
-
>
|
|
215
|
-
<div
|
|
216
|
-
class="pbx-max-h-72 pbx-cursor-pointer pbx-object-contain pbx-bg-white pbx-mx-auto"
|
|
217
|
-
>
|
|
218
|
-
<div v-if="false" class="pbx-mr-2" v-html="helper.icon"></div>
|
|
219
|
-
<h4 class="pbx-myPrimaryParagraph pbx-text-base pbx-font-medium">
|
|
220
|
-
{{ translate(helper.title) }}
|
|
221
|
-
</h4>
|
|
222
|
-
</div>
|
|
223
|
-
<div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
|
|
224
|
-
{{ translate('Click to add') }} {{ helper.title.toLowerCase() }}
|
|
225
|
-
{{ translate('component') }}
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
|
|
231
|
-
<!-- Regular Components Section -->
|
|
232
|
-
<div class="pbx-px-2" v-if="customMediaComponent">
|
|
233
|
-
<h3 class="pbx-myQuaternaryHeader pbx-mb-4">{{ translate('Layout Components') }}</h3>
|
|
234
|
-
<div class="pbx-mb-4 pbx-flex pbx-jusitify-left pbx-items-center pbx-gap-2">
|
|
235
|
-
<button
|
|
236
|
-
v-for="category in categories"
|
|
237
|
-
:key="category"
|
|
238
|
-
@click="selectedCategory = category"
|
|
239
|
-
class="pbx-mySecondaryButton pbx-text-xs pbx-px-4"
|
|
240
|
-
:class="[
|
|
241
|
-
selectedCategory === category
|
|
242
|
-
? 'pbx-bg-myPrimaryLinkColor pbx-text-white hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white'
|
|
243
|
-
: 'hover:pbx-bg-myPrimaryLinkColor hover:pbx-text-white',
|
|
244
|
-
]"
|
|
245
|
-
>
|
|
246
|
-
{{ translate(category) }}
|
|
247
|
-
</button>
|
|
248
|
-
</div>
|
|
249
|
-
<div
|
|
250
|
-
class="pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-2 md:pbx-grid-cols-3 pbx-gap-4 pbx-pb-4 pbx-min-h-[96rem]"
|
|
251
|
-
>
|
|
252
|
-
<div
|
|
253
|
-
v-for="comp in filteredComponents"
|
|
254
|
-
:key="comp.title"
|
|
255
|
-
class="pbx-border-solid pbx-border pbx-border-gray-400 pbx-overflow-hidden hover:pbx-border-myPrimaryLinkColor pbx-duration-100 pbx-cursor-pointer pbx-max-h-96"
|
|
256
|
-
@click="handleDropComponent(convertToComponentObject(comp))"
|
|
257
|
-
>
|
|
258
|
-
<div
|
|
259
|
-
class="pbx-overflow-hidden pbx-whitespace-pre-line pbx-flex-1 pbx-h-auto pbx-border-0 pbx-border-solid pbx-border-b pbx-border-gray-200 lg:pbx-py-10 pbx-py-8 pbx-px-2"
|
|
260
|
-
>
|
|
261
|
-
<!-- Use SVG preview instead of external images -->
|
|
262
|
-
<div
|
|
263
|
-
class="pbx-max-h-72 pbx-cursor-pointer pbx-bg-white pbx-mx-auto pbx-flex pbx-items-center pbx-justify-center"
|
|
264
|
-
v-html="comp.cover_image"
|
|
265
|
-
></div>
|
|
266
|
-
</div>
|
|
267
|
-
<div class="pbx-p-3">
|
|
268
|
-
<h4 class="pbx-myPrimaryParagraph pbx-text-sm pbx-font-normal">
|
|
269
|
-
{{ translate(comp.title) }}
|
|
270
|
-
</h4>
|
|
271
|
-
<div class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-pt-2">
|
|
272
|
-
{{ translate('Click to add component') }}
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
</div>
|
|
276
|
-
</div>
|
|
277
|
-
</div>
|
|
278
|
-
</template>
|
|
279
|
-
<div>
|
|
280
|
-
<button class="pbx-sr-only">Focusable fallback</button>
|
|
281
|
-
</div>
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
</template>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="pbx-min-h-40">
|
|
3
|
-
<p class="pbx-myPrimaryParagraph">
|
|
4
|
-
Provide your own Media Library Component to integrate a custom media picker into the Page
|
|
5
|
-
Builder.
|
|
6
|
-
<br />
|
|
7
|
-
This allows full control over how media is selected and inserted.
|
|
8
|
-
</p>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import FullWidthElement from '../Components/Layouts/FullWidthElement.vue'
|
|
3
|
-
import PageBuilder from '../PageBuilder/PageBuilder.vue'
|
|
4
|
-
import DemoMediaLibraryComponentTest from '../tests/TestComponents/DemoMediaLibraryComponentTest.vue'
|
|
5
|
-
import DemoBuilderComponentsTest from '../tests/TestComponents/DemoBuilderComponentsTest.vue'
|
|
6
|
-
import { computed, watch } from 'vue'
|
|
7
|
-
import componentsArray from '../tests/componentsArray.test.json'
|
|
8
|
-
import { getPageBuilder } from '../composables/builderInstance'
|
|
9
|
-
import { useTranslations } from '../composables/useTranslations'
|
|
10
|
-
|
|
11
|
-
const pageBuilderService = getPageBuilder()
|
|
12
|
-
const { translate, currentTranslations } = useTranslations()
|
|
13
|
-
|
|
14
|
-
const publishPageBuilder = function () {}
|
|
15
|
-
|
|
16
|
-
const translatedComponents = computed(() => {
|
|
17
|
-
return componentsArray.map((component) => {
|
|
18
|
-
const newComponent = { ...component }
|
|
19
|
-
newComponent.html_code = newComponent.html_code.replace(
|
|
20
|
-
/{{\s*translate\('([^']+)'\)\s*}}/g,
|
|
21
|
-
(_, key) => translate(key),
|
|
22
|
-
)
|
|
23
|
-
return newComponent
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
watch(currentTranslations, async () => {
|
|
28
|
-
const { components: newComponents, pageSettings: pageSettings } =
|
|
29
|
-
pageBuilderService.parsePageBuilderHTML(
|
|
30
|
-
'<div id="pagebuilder" class="" style="">' +
|
|
31
|
-
translatedComponents.value.map((c) => c.html_code).join('\n') +
|
|
32
|
-
'</div>',
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
const configPageBuilder = {
|
|
36
|
-
userForPageBuilder: {
|
|
37
|
-
name: 'Jane Doe',
|
|
38
|
-
image: '/jane_doe.jpg',
|
|
39
|
-
},
|
|
40
|
-
updateOrCreate: {
|
|
41
|
-
formType: 'update',
|
|
42
|
-
formName: 'collection',
|
|
43
|
-
},
|
|
44
|
-
pageBuilderLogo: {
|
|
45
|
-
src: '/logo/mybuilder_new_lowercase.svg',
|
|
46
|
-
},
|
|
47
|
-
resourceData: {
|
|
48
|
-
title: 'Demo Article',
|
|
49
|
-
id: 1,
|
|
50
|
-
},
|
|
51
|
-
userSettings: {
|
|
52
|
-
theme: 'light',
|
|
53
|
-
language: {
|
|
54
|
-
default: 'en',
|
|
55
|
-
enable: ['en', 'zh-Hans', 'fr', 'ja', 'ru', 'es', 'pt', 'de', 'ar', 'hi'],
|
|
56
|
-
disableLanguageDropDown: false,
|
|
57
|
-
},
|
|
58
|
-
autoSave: true,
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
settings: {
|
|
62
|
-
brandColor: '#DB93B0',
|
|
63
|
-
},
|
|
64
|
-
pageSettings: pageSettings,
|
|
65
|
-
} as const
|
|
66
|
-
|
|
67
|
-
await pageBuilderService.startBuilder(configPageBuilder, newComponents)
|
|
68
|
-
})
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<template>
|
|
72
|
-
<div class="pbx-bg-white">
|
|
73
|
-
<div class="lg:pbx-p-2">
|
|
74
|
-
<!-- :CustomBuilderComponents="DemoBuilderComponentsTest" -->
|
|
75
|
-
<PageBuilder
|
|
76
|
-
:CustomMediaLibraryComponent="DemoMediaLibraryComponentTest"
|
|
77
|
-
:showPublishButton="true"
|
|
78
|
-
@handlePublishPageBuilder="publishPageBuilder"
|
|
79
|
-
></PageBuilder>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</template>
|