@myissue/vue-website-page-builder 3.0.33 → 3.1.0
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 +1160 -1159
- package/dist/vue-website-page-builder.umd.cjs +12 -12
- package/package.json +1 -1
- package/src/Components/Modals/MediaLibraryModal.vue +1 -1
- package/src/Components/PageBuilder/{NoneCustomSearchComponent.vue → DemoContent/NoneCustomSearchComponent.vue} +9 -9
- package/src/Components/PageBuilder/DropdownsPlusToggles/OptionsDropdown.vue +2 -2
- package/src/Components/PageBuilder/Settings/AdvancedPageBuilderSettings.vue +6 -0
- package/src/Components/Search/SearchComponents.vue +1 -1
- package/src/PageBuilder/PageBuilder.vue +3 -2
- package/src/composables/PageBuilderClass.ts +46 -37
- package/src/Components/Homepage/Navbar.vue +0 -30
- package/src/Components/MediaLibrary/SidebarUnsplash.vue +0 -33
- package/src/Components/MediaLibrary/Unsplash.vue +0 -265
- package/src/Components/PageBuilder/AdvancedPageBuilderSettings.vue +0 -7
- package/src/Components/PageBuilder/DropdownsPlusToggles/SaveDesign.vue +0 -7
- package/src/Components/PageBuilder/PageBuilderSettings.vue +0 -8
- package/src/composables/extract-text-content-html.ts +0 -34
- /package/src/Components/PageBuilder/{NoneCustomMediaLibraryComponent.vue → DemoContent/NoneCustomMediaLibraryComponent.vue} +0 -0
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, computed, onMounted, inject } from 'vue'
|
|
3
|
-
import { useUnsplashStore } from '@/stores/unsplash'
|
|
4
|
-
|
|
5
|
-
// Get stores from parent PageBuilder component
|
|
6
|
-
const unsplashStore = useUnsplashStore()
|
|
7
|
-
const searchQuery = ref('')
|
|
8
|
-
const currentPage = ref(1)
|
|
9
|
-
const orientation = ref(null)
|
|
10
|
-
|
|
11
|
-
const getSearchTerm = computed(() => {
|
|
12
|
-
return unsplashStore.getSearchTerm
|
|
13
|
-
})
|
|
14
|
-
// unspalsh images
|
|
15
|
-
const getUnsplashImages = computed(() => {
|
|
16
|
-
return unsplashStore.getUnsplashImages
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const handleImageClick = function (file) {
|
|
20
|
-
pageBuilderStateStore.setCurrentImage({ src: file })
|
|
21
|
-
pageBuilderStateStore.setCurrentPreviewImage(null)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// search by orientation
|
|
25
|
-
const searchByOrientation = function (orientationParameter) {
|
|
26
|
-
// check if search term length is more than 0
|
|
27
|
-
if (getSearchTerm.value.length > 0 && orientation.value !== orientationParameter) {
|
|
28
|
-
orientation.value = orientationParameter
|
|
29
|
-
currentPage.value = 1
|
|
30
|
-
searchUnsplash()
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//
|
|
34
|
-
// load images for previous page
|
|
35
|
-
const previousPage = function () {
|
|
36
|
-
searchUnsplash()
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// load images for next page
|
|
40
|
-
const nextPage = function () {
|
|
41
|
-
searchUnsplash()
|
|
42
|
-
}
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
// search images
|
|
46
|
-
const searchUnsplash = function () {
|
|
47
|
-
if (
|
|
48
|
-
getUnsplashImages.value &&
|
|
49
|
-
getUnsplashImages.value.fetchedMedia &&
|
|
50
|
-
Array.isArray(getUnsplashImages.value.fetchedMedia.results) &&
|
|
51
|
-
getUnsplashImages.value.fetchedMedia.results.length === 0
|
|
52
|
-
) {
|
|
53
|
-
currentPage.value = 1
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// set values in store
|
|
57
|
-
|
|
58
|
-
localStorage.setItem('unsplash-query', searchQuery.value)
|
|
59
|
-
|
|
60
|
-
unsplashStore.setSearchTerm(searchQuery.value)
|
|
61
|
-
unsplashStore.setCurrentPageNumber(currentPage.value)
|
|
62
|
-
unsplashStore.setOrientationValue(orientation.value)
|
|
63
|
-
unsplashStore.setLoadUnsplashImages({
|
|
64
|
-
searchTerm: getSearchTerm.value,
|
|
65
|
-
currentPage: currentPage.value,
|
|
66
|
-
orientation: orientation.value,
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// on mounted
|
|
71
|
-
onMounted(() => {
|
|
72
|
-
if (localStorage.getItem('unsplash-query') && localStorage.getItem('unsplash-query').length > 0) {
|
|
73
|
-
unsplashStore.setSearchTerm(localStorage.getItem('unsplash-query'))
|
|
74
|
-
searchQuery.value = localStorage.getItem('unsplash-query')
|
|
75
|
-
searchUnsplash()
|
|
76
|
-
} else {
|
|
77
|
-
searchQuery.value = 'Magazine'
|
|
78
|
-
searchUnsplash()
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<template>
|
|
84
|
-
<div>
|
|
85
|
-
<form @submit.prevent="searchUnsplash">
|
|
86
|
-
<label
|
|
87
|
-
for="default-search"
|
|
88
|
-
class="mb-2 text-sm font-normal text-gray-900 sr-only dark:text-gray-300"
|
|
89
|
-
>Search</label
|
|
90
|
-
>
|
|
91
|
-
|
|
92
|
-
<div class="mysearchBarWithOptions">
|
|
93
|
-
<div class="relative w-full">
|
|
94
|
-
<div class="flex absolute inset-y-0 left-0 items-center pl-3 pointer-events-none">
|
|
95
|
-
<span class="material-symbols-outlined"> search </span>
|
|
96
|
-
</div>
|
|
97
|
-
<input
|
|
98
|
-
type="search"
|
|
99
|
-
id="search_query"
|
|
100
|
-
v-model="searchQuery"
|
|
101
|
-
class="myPrimarySearchInput"
|
|
102
|
-
autocomplete="off"
|
|
103
|
-
placeholder="Search..."
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<button type="submit" class="myPrimaryButton">Search</button>
|
|
108
|
-
</div>
|
|
109
|
-
</form>
|
|
110
|
-
|
|
111
|
-
<div
|
|
112
|
-
v-if="
|
|
113
|
-
getUnsplashImages &&
|
|
114
|
-
!getUnsplashImages.isLoading &&
|
|
115
|
-
getUnsplashImages.isError &&
|
|
116
|
-
!getUnsplashImages.isSuccess
|
|
117
|
-
"
|
|
118
|
-
>
|
|
119
|
-
<p class="myPrimaryParagraphError">{{ getUnsplashImages.error }}</p>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<div
|
|
123
|
-
v-if="
|
|
124
|
-
getUnsplashImages &&
|
|
125
|
-
getUnsplashImages.fetchedMedia &&
|
|
126
|
-
getUnsplashImages.fetchedMedia.results &&
|
|
127
|
-
!getUnsplashImages.isLoading &&
|
|
128
|
-
!getUnsplashImages.isError
|
|
129
|
-
"
|
|
130
|
-
class="mt-2"
|
|
131
|
-
>
|
|
132
|
-
<div class="flex lg:justify-between justify-end items-center gap-2 py-2 mb-1">
|
|
133
|
-
<div class="lg:flex hidden justify-left items-center gap-2">
|
|
134
|
-
<button
|
|
135
|
-
@click="searchByOrientation('landscape')"
|
|
136
|
-
type="button"
|
|
137
|
-
class="myPrimaryTag"
|
|
138
|
-
:class="{
|
|
139
|
-
'bg-myPrimaryBrandColor text-white': orientation === 'landscape',
|
|
140
|
-
'': orientation !== 'landscape',
|
|
141
|
-
}"
|
|
142
|
-
>
|
|
143
|
-
Landscape
|
|
144
|
-
</button>
|
|
145
|
-
<button
|
|
146
|
-
@click="searchByOrientation('portrait')"
|
|
147
|
-
type="button"
|
|
148
|
-
class="myPrimaryTag"
|
|
149
|
-
:class="{
|
|
150
|
-
'bg-myPrimaryBrandColor text-white': orientation === 'portrait',
|
|
151
|
-
'': orientation !== 'portrait',
|
|
152
|
-
}"
|
|
153
|
-
>
|
|
154
|
-
Portrait
|
|
155
|
-
</button>
|
|
156
|
-
<button
|
|
157
|
-
@click="searchByOrientation('squarish')"
|
|
158
|
-
type="button"
|
|
159
|
-
class="myPrimaryTag"
|
|
160
|
-
:class="{
|
|
161
|
-
'bg-myPrimaryBrandColor text-white': orientation === 'squarish',
|
|
162
|
-
'': orientation !== 'squarish',
|
|
163
|
-
}"
|
|
164
|
-
>
|
|
165
|
-
Squarish
|
|
166
|
-
</button>
|
|
167
|
-
|
|
168
|
-
<svg
|
|
169
|
-
@click="searchByOrientation(null)"
|
|
170
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
171
|
-
fill="none"
|
|
172
|
-
viewBox="0 0 24 24"
|
|
173
|
-
stroke-width="2"
|
|
174
|
-
stroke="currentColor"
|
|
175
|
-
class="w-4 h-4 cursor-pointer"
|
|
176
|
-
>
|
|
177
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
178
|
-
</svg>
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
<nav class="flex items-center gap-2 justify-start" aria-label="Pagination">
|
|
182
|
-
<p class="myPrimaryParagraph text-xs italic">
|
|
183
|
-
Total pages {{ getUnsplashImages.fetchedMedia.total_pages }}
|
|
184
|
-
</p>
|
|
185
|
-
<p class="myPrimaryParagraph text-xs italic">
|
|
186
|
-
Images {{ getUnsplashImages.fetchedMedia.total }}
|
|
187
|
-
</p>
|
|
188
|
-
<div class="flex flex-1 justify-between sm:justify-end items-center gap-2">
|
|
189
|
-
<span
|
|
190
|
-
v-if="currentPage !== 1"
|
|
191
|
-
class="myPrimaryParagraph text-xs italic pr-2 pl-1 cursor-pointer underline"
|
|
192
|
-
@click="nextPage((currentPage = 1))"
|
|
193
|
-
>
|
|
194
|
-
First page
|
|
195
|
-
</span>
|
|
196
|
-
</div>
|
|
197
|
-
<button
|
|
198
|
-
v-if="currentPage > 1"
|
|
199
|
-
:disabled="currentPage < 1"
|
|
200
|
-
class="myPrimaryButton"
|
|
201
|
-
@click="previousPage(currentPage--)"
|
|
202
|
-
>
|
|
203
|
-
{{ `Prev ${currentPage > 0 ? currentPage - 1 : currentPage - 1}` }}
|
|
204
|
-
</button>
|
|
205
|
-
|
|
206
|
-
<span class="myPrimaryTag p-2.5">
|
|
207
|
-
{{ currentPage }}
|
|
208
|
-
</span>
|
|
209
|
-
<button
|
|
210
|
-
:disabled="currentPage >= getUnsplashImages.fetchedMedia.total_pages"
|
|
211
|
-
class="myPrimaryButton"
|
|
212
|
-
:class="{
|
|
213
|
-
'opacity-50': currentPage >= getUnsplashImages.fetchedMedia.total_pages,
|
|
214
|
-
}"
|
|
215
|
-
@click="nextPage(currentPage++)"
|
|
216
|
-
>
|
|
217
|
-
{{ `Next ${currentPage > 0 ? currentPage + 1 : currentPage + 1}` }}
|
|
218
|
-
</button>
|
|
219
|
-
</nav>
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
<div
|
|
223
|
-
class="overflow-y-scroll pr-1 rounded-lg md:min-h-[25.5rem] md:max-h-[25.5em] min-h-[12rem] max-h-[12rem]"
|
|
224
|
-
>
|
|
225
|
-
<div class="grid md:grid-cols-6 sm:grid-cols-4 grid-cols-2 gap-2">
|
|
226
|
-
<div
|
|
227
|
-
v-for="image in getUnsplashImages.fetchedMedia.results"
|
|
228
|
-
:key="image.id"
|
|
229
|
-
@click="handleImageClick(image.urls.regular)"
|
|
230
|
-
class="border border-myPrimaryLightGrayColor rounded-lg px-2 p-2 cursor-pointer bg-gray-50"
|
|
231
|
-
>
|
|
232
|
-
<img
|
|
233
|
-
:alt="image.user.name"
|
|
234
|
-
class="group aspect-w-10 aspect-h-7 block w-full overflow-hidden rounded-lg bg-gray-100 focus-within:ring-2 focus-within:ring-myPrimaryBrandColor focus-within:ring-offset-2 focus-within:ring-offset-gray-100 cursor-pointer"
|
|
235
|
-
:src="image.urls.thumb"
|
|
236
|
-
/>
|
|
237
|
-
<p class="myPrimaryParagraph text-xs font-normal mt-2">By: {{ image.user.name }}</p>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
<div v-if="getUnsplashImages.fetchedMedia.results.length < 1">
|
|
242
|
-
<p class="myPrimaryParagraph py-4 px-4">
|
|
243
|
-
<span v-if="currentPage === 1"> We did not find any images. Make a new search. </span>
|
|
244
|
-
<span v-if="currentPage > 1" @click="nextPage(1)" class="myPrimaryLink">
|
|
245
|
-
No results on current page. Navigate to First Page.
|
|
246
|
-
</span>
|
|
247
|
-
</p>
|
|
248
|
-
</div>
|
|
249
|
-
</div>
|
|
250
|
-
</div>
|
|
251
|
-
|
|
252
|
-
<div v-if="getUnsplashImages && getUnsplashImages.isLoading && !getUnsplashImages.isError">
|
|
253
|
-
<div class="flex items-center justify-center mt-4">
|
|
254
|
-
<div
|
|
255
|
-
class="inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]"
|
|
256
|
-
>
|
|
257
|
-
<span
|
|
258
|
-
class="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]"
|
|
259
|
-
>Loading...</span
|
|
260
|
-
>
|
|
261
|
-
</div>
|
|
262
|
-
</div>
|
|
263
|
-
</div>
|
|
264
|
-
</div>
|
|
265
|
-
</template>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, onMounted, inject } from 'vue'
|
|
3
|
-
import { Switch } from '@headlessui/vue'
|
|
4
|
-
import Modal from '@/Components/Modals/Modal.vue'
|
|
5
|
-
|
|
6
|
-
// Get stores from parent PageBuilder component
|
|
7
|
-
const pageBuilderStateStore = inject('pageBuilderStateStore')
|
|
8
|
-
</script>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const extractAllTextContent = (html: string, maxLength: number): string => {
|
|
2
|
-
const parser = new DOMParser()
|
|
3
|
-
const doc = parser.parseFromString(html, 'text/html')
|
|
4
|
-
|
|
5
|
-
// Extract content from all elements and insert space after each dot
|
|
6
|
-
const allElements = doc.body.querySelectorAll('*')
|
|
7
|
-
const contentArray = Array.from(allElements).map(
|
|
8
|
-
(element) => element.textContent?.trim().replace(/\./g, '. ') || '',
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
// Join the extracted content into a single string
|
|
12
|
-
let content = contentArray.join(' ')
|
|
13
|
-
content = content.replace(/\s+/g, ' ')
|
|
14
|
-
|
|
15
|
-
// Limit the content to the first maxLength characters
|
|
16
|
-
content = content.slice(0, maxLength)
|
|
17
|
-
|
|
18
|
-
return content
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const extractTextContentHTML = function extractTextContentHTML(
|
|
22
|
-
html: string | null | undefined,
|
|
23
|
-
maxLength: number,
|
|
24
|
-
postType: string = 'Page',
|
|
25
|
-
): string {
|
|
26
|
-
if (html) {
|
|
27
|
-
// Extract all text content
|
|
28
|
-
const extractedContent = extractAllTextContent(html, maxLength)
|
|
29
|
-
|
|
30
|
-
return extractedContent ? extractedContent : `Fashion & Jobs | ${postType}`
|
|
31
|
-
} else {
|
|
32
|
-
return `Fashion & Jobs | ${postType}`
|
|
33
|
-
}
|
|
34
|
-
}
|