@myissue/vue-website-page-builder 3.4.20 → 3.4.22
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 +22 -24
- package/dist/vue-website-page-builder.js +1 -1
- package/dist/vue-website-page-builder.umd.cjs +1 -1
- package/package.json +2 -3
- 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 -341
- 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,389 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, onMounted } from 'vue'
|
|
3
|
-
const unsplashKey = import.meta.env.VITE_UNSPLASH_KEY
|
|
4
|
-
import { usePageBuilderModal } from '../../composables/usePageBuilderModal'
|
|
5
|
-
import { delay } from '../../composables/delay'
|
|
6
|
-
import { preloadImage } from '../../composables/preloadImage'
|
|
7
|
-
import { getPageBuilder } from '../../composables/builderInstance'
|
|
8
|
-
import { useTranslations } from '../../composables/useTranslations'
|
|
9
|
-
const { translate } = useTranslations()
|
|
10
|
-
|
|
11
|
-
const pageBuilderService = getPageBuilder()
|
|
12
|
-
|
|
13
|
-
const { closeMediaLibraryModal } = usePageBuilderModal()
|
|
14
|
-
|
|
15
|
-
const getIsLoading = ref(false)
|
|
16
|
-
const getIsLoadingImage = ref(false)
|
|
17
|
-
const getSearchTerm = ref('')
|
|
18
|
-
const getCurrentPageNumber = ref(1)
|
|
19
|
-
const getOrientationValue = ref('')
|
|
20
|
-
const getApplyImageToSelection = ref('')
|
|
21
|
-
const getCurrentUser = ref('')
|
|
22
|
-
|
|
23
|
-
const getUnsplashImages = ref([])
|
|
24
|
-
|
|
25
|
-
const fetchUnsplash = async function () {
|
|
26
|
-
getIsLoading.value = true
|
|
27
|
-
await delay(300)
|
|
28
|
-
localStorage.setItem('unsplash-query', getSearchTerm.value)
|
|
29
|
-
localStorage.setItem('unsplash-page', getCurrentPageNumber.value)
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
getUnsplashImages.value &&
|
|
33
|
-
Array.isArray(getUnsplashImages.value.results) &&
|
|
34
|
-
getUnsplashImages.value.results.length === 0
|
|
35
|
-
) {
|
|
36
|
-
getCurrentPageNumber.value = 1
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const orientationParam = getOrientationValue.value
|
|
40
|
-
? `&orientation=${getOrientationValue.value}`
|
|
41
|
-
: ''
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const response = await fetch(
|
|
45
|
-
`https://api.unsplash.com/search/photos?page=${getCurrentPageNumber.value}&per_page=24&query=${getSearchTerm.value || 'kinfolk'}${orientationParam}`,
|
|
46
|
-
{
|
|
47
|
-
headers: {
|
|
48
|
-
'Accept-Version': 'v1',
|
|
49
|
-
Authorization: `Client-ID ${unsplashKey}`,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
if (!response.ok) {
|
|
55
|
-
throw new Error(`HTTP error! status: ${response.status}`)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const images = await response.json()
|
|
59
|
-
getUnsplashImages.value = images
|
|
60
|
-
getIsLoading.value = false
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.error('Error fetching Unsplash images:', error)
|
|
63
|
-
} finally {
|
|
64
|
-
getIsLoading.value = false
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const handleImageClick = async function (data) {
|
|
69
|
-
getIsLoadingImage.value = true
|
|
70
|
-
|
|
71
|
-
if (data.url) {
|
|
72
|
-
await preloadImage(data.url)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
await delay(100)
|
|
76
|
-
getApplyImageToSelection.value = data.url || ''
|
|
77
|
-
|
|
78
|
-
getIsLoadingImage.value = false
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const searchByOrientation = function (orientationParameter) {
|
|
82
|
-
// check if search term length is more than 0
|
|
83
|
-
if (getOrientationValue.value !== orientationParameter) {
|
|
84
|
-
getOrientationValue.value = orientationParameter
|
|
85
|
-
getCurrentPageNumber.value = 1
|
|
86
|
-
fetchUnsplash()
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
//
|
|
90
|
-
// load images for previous page
|
|
91
|
-
const previousPage = function () {
|
|
92
|
-
localStorage.setItem('unsplash-page', getCurrentPageNumber.value)
|
|
93
|
-
fetchUnsplash()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// load images for next page
|
|
97
|
-
const nextPage = async function () {
|
|
98
|
-
localStorage.setItem('unsplash-page', getCurrentPageNumber.value)
|
|
99
|
-
fetchUnsplash()
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const isLoading = ref(false)
|
|
103
|
-
|
|
104
|
-
const applySelectedImage = async function (imageURL) {
|
|
105
|
-
isLoading.value = true
|
|
106
|
-
await pageBuilderService.applySelectedImage({
|
|
107
|
-
src: `${imageURL}`,
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
closeMediaLibraryModal()
|
|
111
|
-
isLoading.value = false
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// on mounted
|
|
115
|
-
onMounted(async () => {
|
|
116
|
-
getSearchTerm.value = localStorage.getItem('unsplash-query') || 'kinfolk'
|
|
117
|
-
getCurrentPageNumber.value = Number(localStorage.getItem('unsplash-page')) || 1
|
|
118
|
-
|
|
119
|
-
await fetchUnsplash()
|
|
120
|
-
})
|
|
121
|
-
</script>
|
|
122
|
-
|
|
123
|
-
<template>
|
|
124
|
-
<div>
|
|
125
|
-
<div v-if="getIsLoading || isLoading" class="pbx-min-h-[98vh] pbx-h-[98vh]">
|
|
126
|
-
<div class="pbx-flex pbx-items-center pbx-justify-center">
|
|
127
|
-
<div
|
|
128
|
-
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]"
|
|
129
|
-
>
|
|
130
|
-
<span
|
|
131
|
-
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)]"
|
|
132
|
-
>{{ translate('Loading...') }}</span
|
|
133
|
-
>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
<div v-if="!isLoading && !getIsLoading">
|
|
138
|
-
<form
|
|
139
|
-
@submit.prevent="
|
|
140
|
-
() => {
|
|
141
|
-
getCurrentPageNumber = 1
|
|
142
|
-
fetchUnsplash()
|
|
143
|
-
}
|
|
144
|
-
"
|
|
145
|
-
>
|
|
146
|
-
<div class="pbx-mysearchBarWithOptions">
|
|
147
|
-
<div class="pbx-relative pbx-w-full pbx-flex pbx-gap-2">
|
|
148
|
-
<input
|
|
149
|
-
type="search"
|
|
150
|
-
id="search_query"
|
|
151
|
-
v-model="getSearchTerm"
|
|
152
|
-
class="pbx-myPrimarySearchInput pbx-w-full pbx-pl-10 pbx-border-0"
|
|
153
|
-
autocomplete="off"
|
|
154
|
-
:placeholder="translate('Search...')"
|
|
155
|
-
/>
|
|
156
|
-
<div
|
|
157
|
-
class="pbx-flex pbx-absolute pbx-inset-y-0 pbx-left-0 pbx-items-center pbx-pl-3 pbx-pointer-events-none"
|
|
158
|
-
>
|
|
159
|
-
<span class="material-symbols-outlined"> search </span>
|
|
160
|
-
</div>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<button
|
|
164
|
-
@click="
|
|
165
|
-
() => {
|
|
166
|
-
getCurrentPageNumber = 1
|
|
167
|
-
fetchUnsplash()
|
|
168
|
-
}
|
|
169
|
-
"
|
|
170
|
-
type="submit"
|
|
171
|
-
class="pbx-myPrimaryTag pbx-break-keep pbx-mr-4"
|
|
172
|
-
>
|
|
173
|
-
{{ translate('Search') }}
|
|
174
|
-
</button>
|
|
175
|
-
</div>
|
|
176
|
-
</form>
|
|
177
|
-
<div class="pbx-mt-2">
|
|
178
|
-
<div
|
|
179
|
-
v-if="getUnsplashImages && getUnsplashImages.results"
|
|
180
|
-
class="pbx-flex lg:pbx-justify-between pbx-justify-end pbx-items-center pbx-gap-2 pbx-py-2 pbx-px-2 pbx-mb-1 pbx-rounded-full pbx-border-solid pbx-border pbx-border-gray-200 pbx-shadow-sm"
|
|
181
|
-
>
|
|
182
|
-
<div class="lg:pbx-flex pbx-hidden pbx-justify-left pbx-items-center pbx-gap-2">
|
|
183
|
-
<button
|
|
184
|
-
@click="searchByOrientation('landscape')"
|
|
185
|
-
type="button"
|
|
186
|
-
class="pbx-myPrimaryTag pbx-cursor-pointer"
|
|
187
|
-
:class="{
|
|
188
|
-
'pbx-bg-myPrimaryBrandColor pbx-text-white': getOrientationValue === 'landscape',
|
|
189
|
-
'': getOrientationValue !== 'landscape',
|
|
190
|
-
}"
|
|
191
|
-
>
|
|
192
|
-
{{ translate('Landscape') }}
|
|
193
|
-
</button>
|
|
194
|
-
<button
|
|
195
|
-
@click="searchByOrientation('portrait')"
|
|
196
|
-
type="button"
|
|
197
|
-
class="pbx-myPrimaryTag pbx-cursor-pointer"
|
|
198
|
-
:class="{
|
|
199
|
-
'pbx-bg-myPrimaryBrandColor pbx-text-white': getOrientationValue === 'portrait',
|
|
200
|
-
'': getOrientationValue !== 'portrait',
|
|
201
|
-
}"
|
|
202
|
-
>
|
|
203
|
-
{{ translate('Portrait') }}
|
|
204
|
-
</button>
|
|
205
|
-
<button
|
|
206
|
-
@click="searchByOrientation('squarish')"
|
|
207
|
-
type="button"
|
|
208
|
-
class="pbx-myPrimaryTag pbx-cursor-pointer"
|
|
209
|
-
:class="{
|
|
210
|
-
'pbx-bg-myPrimaryBrandColor pbx-text-white': getOrientationValue === 'squarish',
|
|
211
|
-
'': getOrientationValue !== 'squarish',
|
|
212
|
-
}"
|
|
213
|
-
>
|
|
214
|
-
{{ translate('Squarish') }}
|
|
215
|
-
</button>
|
|
216
|
-
|
|
217
|
-
<svg
|
|
218
|
-
@click="searchByOrientation(null)"
|
|
219
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
220
|
-
fill="none"
|
|
221
|
-
viewBox="0 0 24 24"
|
|
222
|
-
stroke-width="2"
|
|
223
|
-
stroke="currentColor"
|
|
224
|
-
class="pbx-w-4 pbx-h-4 pbx-cursor-pointer"
|
|
225
|
-
>
|
|
226
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
227
|
-
</svg>
|
|
228
|
-
</div>
|
|
229
|
-
|
|
230
|
-
<nav
|
|
231
|
-
class="pbx-flex pbx-items-center pbx-gap-2 pbx-justify-start"
|
|
232
|
-
aria-label="Pagination"
|
|
233
|
-
>
|
|
234
|
-
<p class="pbx-myPrimaryParagraph pbx-text-xs pbx-italic">
|
|
235
|
-
{{ translate('Total pages') }} {{ getUnsplashImages.total_pages }}
|
|
236
|
-
</p>
|
|
237
|
-
<p class="pbx-myPrimaryParagraph pbx-text-xs pbx-italic">
|
|
238
|
-
{{ translate('Images') }} {{ getUnsplashImages.total }}
|
|
239
|
-
</p>
|
|
240
|
-
<div
|
|
241
|
-
class="pbx-flex pbx-flex-1 pbx-justify-between sm:pbx-justify-end pbx-items-center pbx-gap-2"
|
|
242
|
-
>
|
|
243
|
-
<span
|
|
244
|
-
v-if="Number(getCurrentPageNumber) !== 1"
|
|
245
|
-
class="pbx-myPrimaryParagraph pbx-text-xs pbx-italic pbx-pr-2 pbx-pl-1 pbx-cursor-pointer pbx-underline"
|
|
246
|
-
@click="nextPage(Number((getCurrentPageNumber = 1)))"
|
|
247
|
-
>
|
|
248
|
-
{{ translate('First page') }}
|
|
249
|
-
</span>
|
|
250
|
-
</div>
|
|
251
|
-
<button
|
|
252
|
-
v-if="Number(getCurrentPageNumber) > 1"
|
|
253
|
-
:disabled="Number(getCurrentPageNumber) < 1"
|
|
254
|
-
class="pbx-myPrimaryTag pbx-cursor-pointer"
|
|
255
|
-
@click="previousPage(Number(getCurrentPageNumber--))"
|
|
256
|
-
>
|
|
257
|
-
{{
|
|
258
|
-
`${translate('Prev')} ${Number(getCurrentPageNumber) > 0 ? Number(getCurrentPageNumber) - 1 : Number(getCurrentPageNumber) - 1}`
|
|
259
|
-
}}
|
|
260
|
-
</button>
|
|
261
|
-
|
|
262
|
-
<span class="pbx-myPrimaryTag pbx-py-2.5 pbx-px-4">
|
|
263
|
-
{{ Number(getCurrentPageNumber) }}
|
|
264
|
-
</span>
|
|
265
|
-
<button
|
|
266
|
-
:disabled="Number(getCurrentPageNumber) >= getUnsplashImages.total_pages"
|
|
267
|
-
class="pbx-myPrimaryTag pbx-cursor-pointer"
|
|
268
|
-
:class="{
|
|
269
|
-
'pbx-opacity-50': Number(getCurrentPageNumber) >= getUnsplashImages.total_pages,
|
|
270
|
-
}"
|
|
271
|
-
@click="nextPage(Number(getCurrentPageNumber++))"
|
|
272
|
-
>
|
|
273
|
-
{{
|
|
274
|
-
`${translate('Next')} ${Number(getCurrentPageNumber) > 0 ? Number(getCurrentPageNumber) + 1 : Number(getCurrentPageNumber) + 1}`
|
|
275
|
-
}}
|
|
276
|
-
</button>
|
|
277
|
-
</nav>
|
|
278
|
-
</div>
|
|
279
|
-
|
|
280
|
-
<div class="pbx-min-h-full pbx-max-h-full pbx-flex pbx-gap-6">
|
|
281
|
-
<div class="pbx-w-9/12 pbx-pr-1 pbx-rounded-lg pbx-overflow-y-auto">
|
|
282
|
-
<div v-if="getUnsplashImages && getUnsplashImages.results">
|
|
283
|
-
<div
|
|
284
|
-
v-if="!getIsLoading"
|
|
285
|
-
class="pbx-grid lg:pbx-grid-cols-6 md:pbx-grid-cols-4 sm:pbx-grid-cols-4 pbx-grid-cols-3 pbx-gap-2"
|
|
286
|
-
>
|
|
287
|
-
<div
|
|
288
|
-
v-for="image in getUnsplashImages.results"
|
|
289
|
-
:key="image.id"
|
|
290
|
-
@click="handleImageClick({ url: image.urls.regular, user: image.user.name })"
|
|
291
|
-
class="pbx-border-solid pbx-border pbx-border-gray-200 pbx-my-2 pbx-px-2 pbx-p-2 pbx-cursor-pointer"
|
|
292
|
-
>
|
|
293
|
-
<img
|
|
294
|
-
:alt="image.user.name"
|
|
295
|
-
class="pbx-group pbx-block pbx-w-full pbx-overflow-hidden pbx-cursor-pointer"
|
|
296
|
-
:src="image.urls.thumb"
|
|
297
|
-
/>
|
|
298
|
-
<p class="pbx-myPrimaryParagraph pbx-text-xs pbx-font-normal pbx-mt-2">
|
|
299
|
-
{{ translate('By:') }} {{ image.user.name }}
|
|
300
|
-
</p>
|
|
301
|
-
</div>
|
|
302
|
-
</div>
|
|
303
|
-
</div>
|
|
304
|
-
|
|
305
|
-
<div
|
|
306
|
-
v-if="
|
|
307
|
-
getUnsplashImages &&
|
|
308
|
-
getUnsplashImages.results &&
|
|
309
|
-
getUnsplashImages.results.length < 1
|
|
310
|
-
"
|
|
311
|
-
>
|
|
312
|
-
<p class="pbx-myPrimaryParagraph pbx-py-4 pbx-px-4">
|
|
313
|
-
<span v-if="getCurrentPageNumber === 1">
|
|
314
|
-
{{ translate('We did not find any images. Make a new search.') }}
|
|
315
|
-
</span>
|
|
316
|
-
<span
|
|
317
|
-
v-if="getCurrentPageNumber > 1"
|
|
318
|
-
@click="nextPage(1)"
|
|
319
|
-
class="pbx-myPrimaryLink"
|
|
320
|
-
>
|
|
321
|
-
{{ translate('No results on current page. Navigate to First Page.') }}
|
|
322
|
-
</span>
|
|
323
|
-
</p>
|
|
324
|
-
</div>
|
|
325
|
-
</div>
|
|
326
|
-
<!-- Sidebar # start -->
|
|
327
|
-
<aside class="pbx-w-3/12 pbx-overflow-y-auto">
|
|
328
|
-
<template v-if="getIsLoadingImage">
|
|
329
|
-
<div class="pbx-flex pbx-items-center pbx-justify-center pbx-mt-4">
|
|
330
|
-
<div
|
|
331
|
-
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]"
|
|
332
|
-
>
|
|
333
|
-
<span
|
|
334
|
-
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)]"
|
|
335
|
-
>{{ translate('Loading...') }}</span
|
|
336
|
-
>
|
|
337
|
-
</div>
|
|
338
|
-
</div>
|
|
339
|
-
</template>
|
|
340
|
-
<template v-if="getApplyImageToSelection && !getIsLoadingImage">
|
|
341
|
-
<img
|
|
342
|
-
class="pbx-mx-auto pbx-block pbx-w-full pbx-object-cover pbx-object-center pbx-cursor-pointer"
|
|
343
|
-
:src="`${getApplyImageToSelection}`"
|
|
344
|
-
alt="file"
|
|
345
|
-
/>
|
|
346
|
-
<div class="md:pbx-px-3 pbx-px-2">
|
|
347
|
-
<div>
|
|
348
|
-
<p class="pbx-myPrimaryParagraph pbx-font-normal pbx-text-gray-900 pbx-pt-4">
|
|
349
|
-
{{ translate('Information') }}
|
|
350
|
-
</p>
|
|
351
|
-
<dl
|
|
352
|
-
class="pbx-mt-2 pbx-border-t pbx-border-b pbx-border-gray-200 pbx-divide-y pbx-divide-gray-200"
|
|
353
|
-
>
|
|
354
|
-
<div
|
|
355
|
-
class="pbx-py-3 pbx-flex pbx-justify-between pbx-text-sm pbx-font-normal pbx-items-center"
|
|
356
|
-
>
|
|
357
|
-
<dt class="pbx-text-gray-500">{{ translate('From:') }}</dt>
|
|
358
|
-
<dd class="pbx-text-gray-900">Unsplash</dd>
|
|
359
|
-
</div>
|
|
360
|
-
<div
|
|
361
|
-
class="pbx-py-3 pbx-flex pbx-justify-between pbx-text-sm pbx-font-normal pbx-items-center"
|
|
362
|
-
>
|
|
363
|
-
<dt class="pbx-text-gray-500">{{ translate('By:') }}</dt>
|
|
364
|
-
<dd class="pbx-text-gray-900">{{ getCurrentUser }}</dd>
|
|
365
|
-
</div>
|
|
366
|
-
</dl>
|
|
367
|
-
</div>
|
|
368
|
-
<div class="pbx-flex pbx-justify-end pbx-mt-4 pbx-w-full">
|
|
369
|
-
<button
|
|
370
|
-
v-if="getApplyImageToSelection && typeof getApplyImageToSelection === 'string'"
|
|
371
|
-
@click="applySelectedImage(getApplyImageToSelection)"
|
|
372
|
-
class="pbx-myPrimaryButton"
|
|
373
|
-
type="button"
|
|
374
|
-
>
|
|
375
|
-
{{ translate(' Select image') }}
|
|
376
|
-
</button>
|
|
377
|
-
</div>
|
|
378
|
-
</div>
|
|
379
|
-
</template>
|
|
380
|
-
</aside>
|
|
381
|
-
</div>
|
|
382
|
-
<!-- Sidebar # end -->
|
|
383
|
-
</div>
|
|
384
|
-
<div>
|
|
385
|
-
<button class="pbx-sr-only">Focusable fallback</button>
|
|
386
|
-
</div>
|
|
387
|
-
</div>
|
|
388
|
-
</div>
|
|
389
|
-
</template>
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"html_code": "<section data-component-title=\"Header H2\"><div class=\"pbx-relative pbx-py-4\"><div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\"><div class=\"pbx-break-words pbx-text-6xl lg:pbx-text-8xl pbx-font-medium\"><h2>{{ translate('Demo Content') }}</h2></div></div></div></section>",
|
|
4
|
-
"id": "ba0e9774-3779-467c-9c9f-5c95dd47fa6d",
|
|
5
|
-
"title": "Header H2"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"html_code": "<section data-component-title=\"Text\">\n <div class=\"pbx-relative pbx-py-4\">\n <div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\">\n <div><p>{{ translate('Demo Description') }}</p></div>\n </div>\n </div>\n </section>",
|
|
9
|
-
"id": "d9fe6bdb-60df-45e4-bed5-1a6f8edf28e5",
|
|
10
|
-
"title": "Text"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"html_code": "<section data-component-title=\"Three Vertical Images\">\n<div class=\"md:pbx-pt-12 md:pbx-pb-12 pbx-pt-4 pbx-pb-4 lg:pbx-px-4 pbx-px-2 pbx-bg-black\"><div class=\"pbx-mx-auto pbx-max-w-7xl pbx-m\"><div class=\"pbx-myPrimaryGap pbx-grid pbx-grid-cols-1 sm:pbx-grid-cols-3 lg:pbx-grid-cols-3\"> <div class=\"pbx-flex-1 pbx-py-2\"> <img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-[9/16] pbx-rounded-tl-full\" src=\"https://images.unsplash.com/photo-1632765866070-3fadf25d3d5b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwxMjh8fG1vZGVsfGVufDB8fHx8MTc0OTgzMDgzMXww&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"provider\" data-image=\"b2fb2e61-c916-4195-9cd2-c1d25747b4f7\"> </div> <div class=\"pbx-flex-1 pbx-py-2\"> <img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-[9/16] pbx-rounded-full\" src=\"https://images.unsplash.com/photo-1542513217-0b0eedf7005d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwxMDR8fG1vZGVsfGVufDB8fHx8MTc0OTgzMDc5MXww&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"provider\" data-image=\"fdf36a14-f7ef-4025-942f-c87b20b18005\"> </div> <div class=\"pbx-flex-1 pbx-py-2\"> <img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-[9/16] pbx-rounded-br-full\" src=\"https://images.unsplash.com/photo-1574015974293-817f0ebebb74?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwyNnx8bW9kZWx8ZW58MHx8fHwxNzQ5ODMwNzM1fDA&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"provider\" data-image=\"618a74a7-5d41-4dce-937c-130dd7490569\"></div></div> </div></div>\n</section>",
|
|
14
|
-
"id": "0bb012a0-631a-497f-9b7f-832313b64a2b",
|
|
15
|
-
"title": "Three Vertical Images"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"html_code": "<section data-component-title=\"Header H3\"><div class=\"pbx-relative pbx-py-4\"><div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\"><div class=\"pbx-break-words pbx-mt-6 pbx-font-medium pbx-text-2xl lg:pbx-text-4xl\"><h3>{{ translate('Demo Title') }}</h3></div></div></div></section>",
|
|
19
|
-
"id": "cd7e27ac-b152-4714-a5f7-5ad660f183bf",
|
|
20
|
-
"title": "Header H3"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"html_code": "<section data-component-title=\"Text\">\n <div class=\"pbx-relative pbx-py-4\">\n <div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\">\n <div><p>{{ translate('Demo Description Two') }}</p></div>\n </div>\n </div>\n </section>",
|
|
24
|
-
"id": "b1e75d09-0e72-4c61-a207-a97277cbbfed",
|
|
25
|
-
"title": "Text"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"html_code": "<section data-component-title=\"Two Vertical Images\">\n<div class=\"md:pbx-pt-12 md:pbx-pb-12 pbx-pt-4 pbx-pb-4 lg:pbx-px-4 pbx-px-2\"><div class=\"pbx-mx-auto pbx-max-w-7xl\"><div class=\"pbx-myPrimaryGap pbx-grid pbx-grid-cols-2 sm:pbx-grid-cols-2 lg:pbx-grid-cols-2\"> <div class=\"pbx-flex-1 pbx-py-2\"> <img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-[9/16] \" src=\"https://images.unsplash.com/photo-1592966719124-2ca2978ba325?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwzfHxraW5mb2xrfGVufDB8fHx8MTc0OTgzMTAzM3ww&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"provider\" data-image=\"536340a5-c7e1-479d-a2ae-a85e6dacc2df\"> </div> <div class=\"pbx-flex-1 pbx-py-2\"> <img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-[9/16] \" src=\"https://images.unsplash.com/photo-1549298222-1c31e8915347?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwzfHxtYWdhemluZSUyMGZhc2hpb258ZW58MHx8fHwxNzQ5ODMxNTEwfDA&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"provider\" data-image=\"41655496-4742-4cc6-bc3c-abe7c2b241fb\"> </div> </div> </div> </div>\n</section>",
|
|
29
|
-
"id": "d3b5a3e4-29a3-4b03-88b6-1f77d319af74",
|
|
30
|
-
"title": "Two Vertical Images"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"html_code": "<section data-component-title=\"Header H3\"><div class=\"pbx-relative pbx-py-4\"><div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\"><div class=\"pbx-break-words pbx-mt-6 pbx-font-medium pbx-text-2xl lg:pbx-text-4xl\"><h3>{{ translate('Demo Title Two') }}</h3></div></div></div></section>",
|
|
34
|
-
"id": "f164929b-4460-4b17-9933-119b47e8bbef",
|
|
35
|
-
"title": "Header H3"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"html_code": "<section data-component-title=\"Text\">\n <div class=\"pbx-relative pbx-py-4\">\n <div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\">\n <div class=\"\"><p>{{ translate('Demo Description Three') }}</p></div>\n </div>\n </div>\n </section>",
|
|
39
|
-
"id": "fa721207-2444-4892-9de3-5260d576a34b",
|
|
40
|
-
"title": "Text"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"html_code": "<section data-component-title=\"YouTube Video\">\n <div class=\"pbx-py-4\">\n <div class=\"pbx-mx-auto pbx-max-w-7xl pbx-pt-6 pbx-pb-6\">\n <div id=\"youtube-video\" class=\"pbx-aspect-video pbx-p-4\">\n\n <iframe frameborder=\"0\" allowfullscreen=\"\" class=\"pbx-w-full pbx-aspect-video\" src=\"https://www.youtube.com/embed/pJvwV1Fm0vU\" allow=\"accelerometer; autoplay; clipboard-write;\">\n </iframe>\n </div>\n </div>\n </div>\n </section>",
|
|
44
|
-
"id": "33a26684-eb95-43c9-adb4-d7bce0ca60f7",
|
|
45
|
-
"title": "YouTube Video"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"html_code": "<section data-component-title=\"Header H3\"><div class=\"pbx-relative pbx-py-4\"><div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\"><div class=\"pbx-break-words pbx-text-2xl lg:pbx-text-4xl pbx-font-medium\"><h3>{{ translate('Demo Title Three') }}</h3></div></div></div></section>",
|
|
49
|
-
"id": "de2208e1-5b65-4302-8ffb-b9beb7d192d7",
|
|
50
|
-
"title": "Header H3"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"html_code": "<section data-component-title=\"Text\">\n <div class=\"pbx-relative pbx-py-4\">\n <div class=\"pbx-mx-auto pbx-max-w-7xl lg:pbx-px-4 pbx-px-2\">\n <div><p>{{ translate('Demo Description Four') }}</p><p></p></div>\n </div>\n </div>\n </section>",
|
|
54
|
-
"id": "e9a5c794-5972-473d-8181-af4345cbaabe",
|
|
55
|
-
"title": "Text"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"html_code": "<sectio data-component-title=\"Six Square Images Grid\">\n<div class=\"md:pbx-pt-12 md:pbx-pb-12 pbx-pt-4 pbx-pb-4 lg:pbx-px-4 pbx-px-2 pbx-rounded-tr-full pbx-bg-yellow-100 pbx-rounded-bl-full\">\n<div class=\"pbx-mx-auto pbx-max-w-7xl\">\n<div class=\"pbx-grid pbx-grid-cols-2 md:pbx-grid-cols-3 pbx-myPrimaryGap\">\n\n<div>\n<img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-square \" src=\"https://images.unsplash.com/photo-1616837874254-8d5aaa63e273?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwxOXx8amV3ZXJseXxlbnwwfHx8fDE3NTEwMjE1MDR8MA&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"image\">\n</div>\n\n<div>\n<img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-square \" src=\"https://images.unsplash.com/photo-1608042314453-ae338d80c427?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwyfHxqZXdlcmx5fGVufDB8fHx8MTc1MTAyMTUwNHww&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"image\">\n</div>\n\n<div>\n<img class=\"pbx-object-cover pbx-w-full pbx-object-top pbx-aspect-square \" src=\"https://images.unsplash.com/photo-1621939745912-aad97fd3a34d?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHw1MXx8amV3ZXJseXxlbnwwfHx8fDE3NTEwMjE1NDN8MA&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"image\">\n</div>\n\n<div>\n<img class=\"pbx-object-cover pbx-w-full pbx-aspect-square pbx-object-bottom\" src=\"https://images.unsplash.com/photo-1617038220319-276d3cfab638?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHw1fHxqZXdlcmx5fGVufDB8fHx8MTc1MTAyMTUwNHww&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"image\">\n</div>\n\n<div>\n<img class=\"pbx-object-cover pbx-w-full pbx-aspect-square pbx-object-bottom\" src=\"https://images.unsplash.com/photo-1594924571793-f6517415f594?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHw0Nnx8amV3ZXJseXxlbnwwfHx8fDE3NTEwMjE1Mjd8MA&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"image\">\n</div>\n\n<div>\n<img class=\"pbx-object-cover pbx-w-full pbx-aspect-square pbx-object-top\" src=\"https://images.unsplash.com/photo-1683099869102-bcf8791eb0e5?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wzMTI0Mzl8MHwxfHNlYXJjaHwxMjV8fGpld2VybHl8ZW58MHx8fHwxNzUxMDIxNTc4fDA&ixlib=rb-4.1.0&q=80&w=1080\" alt=\"image\">\n</div>\n\n</div>\n</div>\n</div>\n</sectio>",
|
|
59
|
-
"id": "7bcda060-8ed5-482f-bcf4-aa6bd7fdb193",
|
|
60
|
-
"title": "Six Square Images Grid"
|
|
61
|
-
}
|
|
62
|
-
]
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { describe, it, expect, vi, beforeEach, beforeAll } from 'vitest'
|
|
3
|
-
import { PageBuilderService } from '../services/PageBuilderService'
|
|
4
|
-
import { usePageBuilderStateStore } from '../stores/page-builder-state'
|
|
5
|
-
import componentsArray from './componentsArray.test.json'
|
|
6
|
-
|
|
7
|
-
// Mock store (replace with your actual store or a better mock if needed)
|
|
8
|
-
const mockStore = {
|
|
9
|
-
// Mock getters
|
|
10
|
-
getApplyImageToSelection: { src: '' },
|
|
11
|
-
getLocalStorageItemName: 'test-key',
|
|
12
|
-
getHyberlinkEnable: false,
|
|
13
|
-
getComponents: [],
|
|
14
|
-
getComponent: null,
|
|
15
|
-
getElement: null,
|
|
16
|
-
getComponentArrayAddMethod: null,
|
|
17
|
-
getShowModalTipTap: false,
|
|
18
|
-
getMenuRight: false,
|
|
19
|
-
getBorderStyle: null,
|
|
20
|
-
getBorderWidth: null,
|
|
21
|
-
getBorderColor: null,
|
|
22
|
-
getBorderRadiusGlobal: null,
|
|
23
|
-
getBorderRadiusTopLeft: null,
|
|
24
|
-
getBorderRadiusTopRight: null,
|
|
25
|
-
getBorderRadiusBottomleft: null,
|
|
26
|
-
getBorderRadiusBottomRight: null,
|
|
27
|
-
getElementContainsHyperlink: null,
|
|
28
|
-
getHyperlinkAbility: null,
|
|
29
|
-
getHyperlinkInput: null,
|
|
30
|
-
getHyperlinkMessage: null,
|
|
31
|
-
getHyperlinkError: null,
|
|
32
|
-
getOpenHyperlinkInNewTab: null,
|
|
33
|
-
getOpacity: null,
|
|
34
|
-
getBackgroundOpacity: null,
|
|
35
|
-
getTextAreaVueModel: null,
|
|
36
|
-
getCurrentClasses: [],
|
|
37
|
-
getCurrentStyles: {},
|
|
38
|
-
getFontVerticalPadding: null,
|
|
39
|
-
getFontHorizontalPadding: null,
|
|
40
|
-
getFontVerticalMargin: null,
|
|
41
|
-
getFontHorizontalMargin: null,
|
|
42
|
-
getFontStyle: null,
|
|
43
|
-
getFontFamily: null,
|
|
44
|
-
getFontWeight: null,
|
|
45
|
-
getFontBase: null,
|
|
46
|
-
getFontDesktop: null,
|
|
47
|
-
getFontTablet: null,
|
|
48
|
-
getFontMobile: null,
|
|
49
|
-
getBackgroundColor: null,
|
|
50
|
-
getTextColor: null,
|
|
51
|
-
getBasePrimaryImage: null,
|
|
52
|
-
getPageBuilderConfig: null,
|
|
53
|
-
getCurrentPreviewImage: null,
|
|
54
|
-
getBuilderStarted: false,
|
|
55
|
-
getIsLoadingGlobal: false,
|
|
56
|
-
getIsSaving: false,
|
|
57
|
-
getHasLocalDraftForUpdate: false,
|
|
58
|
-
getIsLoadingResumeEditing: false,
|
|
59
|
-
getIsRestoring: false,
|
|
60
|
-
getCurrentLanguage: null,
|
|
61
|
-
getHistoryIndex: 0,
|
|
62
|
-
getHistoryLength: 0,
|
|
63
|
-
|
|
64
|
-
// Mock actions
|
|
65
|
-
setBuilderStarted: vi.fn(),
|
|
66
|
-
setPageBuilderConfig: vi.fn(),
|
|
67
|
-
setHistoryIndex: vi.fn(),
|
|
68
|
-
setHistoryLength: vi.fn(),
|
|
69
|
-
setLocalStorageItemName: vi.fn(),
|
|
70
|
-
setShowModalTipTap: vi.fn(),
|
|
71
|
-
setMenuRight: vi.fn(),
|
|
72
|
-
setBorderStyle: vi.fn(),
|
|
73
|
-
setBorderWidth: vi.fn(),
|
|
74
|
-
setBorderColor: vi.fn(),
|
|
75
|
-
setBorderRadiusGlobal: vi.fn(),
|
|
76
|
-
setBorderRadiusTopLeft: vi.fn(),
|
|
77
|
-
setBorderRadiusTopRight: vi.fn(),
|
|
78
|
-
setBorderRadiusBottomleft: vi.fn(),
|
|
79
|
-
setBorderRadiusBottomRight: vi.fn(),
|
|
80
|
-
setElementContainsHyperlink: vi.fn(),
|
|
81
|
-
setHyperlinkAbility: vi.fn(),
|
|
82
|
-
setHyperlinkInput: vi.fn(),
|
|
83
|
-
setHyperlinkMessage: vi.fn(),
|
|
84
|
-
setHyperlinkError: vi.fn(),
|
|
85
|
-
setHyberlinkEnable: vi.fn(),
|
|
86
|
-
setOpenHyperlinkInNewTab: vi.fn(),
|
|
87
|
-
setOpacity: vi.fn(),
|
|
88
|
-
setBackgroundOpacity: vi.fn(),
|
|
89
|
-
setTextAreaVueModel: vi.fn(),
|
|
90
|
-
setClass: vi.fn(),
|
|
91
|
-
removeClass: vi.fn(),
|
|
92
|
-
setCurrentClasses: vi.fn(),
|
|
93
|
-
setCurrentStyles: vi.fn(),
|
|
94
|
-
setFontVerticalPadding: vi.fn(),
|
|
95
|
-
setFontHorizontalPadding: vi.fn(),
|
|
96
|
-
setFontVerticalMargin: vi.fn(),
|
|
97
|
-
setFontHorizontalMargin: vi.fn(),
|
|
98
|
-
setFontStyle: vi.fn(),
|
|
99
|
-
setFontFamily: vi.fn(),
|
|
100
|
-
setFontWeight: vi.fn(),
|
|
101
|
-
setFontBase: vi.fn(),
|
|
102
|
-
setFontDesktop: vi.fn(),
|
|
103
|
-
setFontTablet: vi.fn(),
|
|
104
|
-
setFontMobile: vi.fn(),
|
|
105
|
-
setBackgroundColor: vi.fn(),
|
|
106
|
-
setTextColor: vi.fn(),
|
|
107
|
-
setElement: vi.fn(),
|
|
108
|
-
setComponent: vi.fn(),
|
|
109
|
-
setComponents: vi.fn(),
|
|
110
|
-
setPushComponents: vi.fn(),
|
|
111
|
-
setBasePrimaryImage: vi.fn(),
|
|
112
|
-
setCurrentLayoutPreview: vi.fn(),
|
|
113
|
-
setApplyImageToSelection: vi.fn(),
|
|
114
|
-
setCurrentPreviewImage: vi.fn(),
|
|
115
|
-
setIsLoadingGlobal: vi.fn(),
|
|
116
|
-
setIsSaving: vi.fn(),
|
|
117
|
-
setHasLocalDraftForUpdate: vi.fn(),
|
|
118
|
-
setIsLoadingResumeEditing: vi.fn(),
|
|
119
|
-
setIsRestoring: vi.fn(),
|
|
120
|
-
setCurrentLanguage: vi.fn(),
|
|
121
|
-
} as unknown as ReturnType<typeof usePageBuilderStateStore>
|
|
122
|
-
|
|
123
|
-
const configPageBuilder = {
|
|
124
|
-
updateOrCreate: {
|
|
125
|
-
formType: 'update',
|
|
126
|
-
formName: 'collection',
|
|
127
|
-
},
|
|
128
|
-
// ...other config options as needed
|
|
129
|
-
} as const
|
|
130
|
-
|
|
131
|
-
beforeAll(() => {
|
|
132
|
-
// Create a fake #pagebuilder element in the DOM for the test
|
|
133
|
-
const div = document.createElement('div')
|
|
134
|
-
div.id = 'pagebuilder'
|
|
135
|
-
document.body.appendChild(div)
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
describe('PageBuilderService', () => {
|
|
139
|
-
let service: PageBuilderService
|
|
140
|
-
|
|
141
|
-
beforeEach(() => {
|
|
142
|
-
// Reset mocks before each test
|
|
143
|
-
Object.values(mockStore).forEach(
|
|
144
|
-
(fn) =>
|
|
145
|
-
typeof fn === 'function' &&
|
|
146
|
-
typeof (fn as { mockClear?: () => void }).mockClear === 'function' &&
|
|
147
|
-
(fn as { mockClear: () => void }).mockClear(),
|
|
148
|
-
)
|
|
149
|
-
service = new PageBuilderService(mockStore)
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
it('should start builder and return a success message', async () => {
|
|
153
|
-
const result = await service.startBuilder(configPageBuilder, componentsArray)
|
|
154
|
-
expect(result).toHaveProperty('message', 'Page builder started successfully.')
|
|
155
|
-
expect(mockStore.setBuilderStarted).toHaveBeenCalledWith(true)
|
|
156
|
-
expect(mockStore.setPageBuilderConfig).toHaveBeenCalledWith(configPageBuilder)
|
|
157
|
-
// Add more assertions as needed
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
it('should handle missing components array gracefully', async () => {
|
|
161
|
-
const result = await service.startBuilder(configPageBuilder)
|
|
162
|
-
expect(result).toHaveProperty('validation.error', true)
|
|
163
|
-
expect(result).toHaveProperty('validation.reason', 'Components data must be an array.')
|
|
164
|
-
})
|
|
165
|
-
})
|
package/src/types/global.d.ts
DELETED