@myissue/vue-website-page-builder 3.4.20 → 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 +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,203 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, computed, watch, nextTick } from 'vue'
|
|
3
|
-
import { sharedPageBuilderStore } from '../../../../stores/shared-store'
|
|
4
|
-
import ModalBuilder from '../../../../Components/Modals/ModalBuilder.vue'
|
|
5
|
-
import EditorAccordion from '../EditorAccordion.vue'
|
|
6
|
-
import { getPageBuilder } from '../../../../composables/builderInstance'
|
|
7
|
-
import { useTranslations } from '../../../../composables/useTranslations'
|
|
8
|
-
import { delay } from '../../../../composables/delay'
|
|
9
|
-
|
|
10
|
-
const pageBuilderService = getPageBuilder()
|
|
11
|
-
const pageBuilderStateStore = sharedPageBuilderStore
|
|
12
|
-
const { translate } = useTranslations()
|
|
13
|
-
|
|
14
|
-
const props = defineProps({
|
|
15
|
-
globalPage: {
|
|
16
|
-
type: Boolean,
|
|
17
|
-
},
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const getElement = computed(() => pageBuilderStateStore.getElement)
|
|
21
|
-
const getShowModalHTMLEditor = computed(() => pageBuilderStateStore.getShowModalHTMLEditor)
|
|
22
|
-
|
|
23
|
-
const elementHTML = computed(() => {
|
|
24
|
-
if (!getElement.value || !(getElement.value instanceof HTMLElement)) {
|
|
25
|
-
return ''
|
|
26
|
-
}
|
|
27
|
-
return getElement.value.outerHTML
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
const editableHtml = ref('')
|
|
31
|
-
const editableComponents = ref('')
|
|
32
|
-
|
|
33
|
-
watch(getShowModalHTMLEditor, async (newVal) => {
|
|
34
|
-
if (newVal) {
|
|
35
|
-
if (!props.globalPage) {
|
|
36
|
-
editableHtml.value = elementHTML.value
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
editableComponents.value = await pageBuilderService.generateHtmlFromComponents()
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
const handleShowHTMLEditor = async () => {
|
|
45
|
-
pageBuilderStateStore.setShowModalHTMLEditor(true)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const handleCloseHTMLEditor = () => {
|
|
49
|
-
pageBuilderStateStore.setShowModalHTMLEditor(false)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const isLoading = ref(false)
|
|
53
|
-
const errSaveComponents = ref(null)
|
|
54
|
-
|
|
55
|
-
const handleSaveChangesElement = async () => {
|
|
56
|
-
errSaveComponents.value = null
|
|
57
|
-
isLoading.value = true
|
|
58
|
-
await delay(300)
|
|
59
|
-
|
|
60
|
-
const error = await pageBuilderService.applyModifiedHTML(editableHtml.value)
|
|
61
|
-
|
|
62
|
-
if (error) {
|
|
63
|
-
errSaveComponents.value = error
|
|
64
|
-
isLoading.value = false
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
pageBuilderStateStore.setShowModalHTMLEditor(false)
|
|
69
|
-
isLoading.value = false
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const handleSaveChangesComponents = async () => {
|
|
73
|
-
errSaveComponents.value = null
|
|
74
|
-
isLoading.value = true
|
|
75
|
-
errSaveComponents.value = null
|
|
76
|
-
await delay(300)
|
|
77
|
-
|
|
78
|
-
const error = await pageBuilderService.applyModifiedComponents(editableComponents.value)
|
|
79
|
-
|
|
80
|
-
if (error) {
|
|
81
|
-
errSaveComponents.value = error
|
|
82
|
-
isLoading.value = false
|
|
83
|
-
return
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
pageBuilderStateStore.setShowModalHTMLEditor(false)
|
|
87
|
-
isLoading.value = false
|
|
88
|
-
}
|
|
89
|
-
</script>
|
|
90
|
-
<template>
|
|
91
|
-
<EditorAccordion>
|
|
92
|
-
<template #title>{{ translate('HTML Editor') }}</template>
|
|
93
|
-
<template #content>
|
|
94
|
-
<div class="pbx-my-2 pbx-py-2">
|
|
95
|
-
<label for="vertical-margin" class="pbx-myPrimaryInputLabel">{{
|
|
96
|
-
translate('Gain full control over components by editing the raw HTML.')
|
|
97
|
-
}}</label>
|
|
98
|
-
<hr />
|
|
99
|
-
</div>
|
|
100
|
-
<button @click="handleShowHTMLEditor" type="button" class="pbx-myPrimaryButton">
|
|
101
|
-
{{ translate('HTML Editor') }}
|
|
102
|
-
</button>
|
|
103
|
-
</template>
|
|
104
|
-
</EditorAccordion>
|
|
105
|
-
<ModalBuilder
|
|
106
|
-
maxWidth="7xl"
|
|
107
|
-
:showModalBuilder="getShowModalHTMLEditor"
|
|
108
|
-
:title="translate('HTML Editor')"
|
|
109
|
-
@closeMainModalBuilder="handleCloseHTMLEditor"
|
|
110
|
-
>
|
|
111
|
-
<template v-if="!globalPage">
|
|
112
|
-
<textarea
|
|
113
|
-
id="html-editor"
|
|
114
|
-
v-model="editableHtml"
|
|
115
|
-
class="pbx-h-full pbx-font-sans pbx-bg-gray-900 pbx-text-white pbx-w-full"
|
|
116
|
-
style="overflow: auto; min-height: 400px"
|
|
117
|
-
></textarea>
|
|
118
|
-
<div class="pbx-flex pbx-justify-end pbx-min-h-6">
|
|
119
|
-
<p v-if="errSaveComponents" class="pbx-myPrimaryParagraphError">
|
|
120
|
-
Error: {{ errSaveComponents }}
|
|
121
|
-
</p>
|
|
122
|
-
</div>
|
|
123
|
-
<div
|
|
124
|
-
class="pbx-border-0 pbx-border-solid pbx-border-t pbx-border-gray-200 pbx-flex pbx-items-center pbx-justify-end"
|
|
125
|
-
>
|
|
126
|
-
<div class="pbx-py-4 pbx-flex sm:pbx-justify-end pbx-justify-center">
|
|
127
|
-
<div
|
|
128
|
-
class="sm:pbx-grid-cols-2 sm:pbx-items-end sm:pbx-justify-end pbx-flex sm:pbx-flex-row pbx-flex-col pbx-myPrimaryGap sm:pbx-w-5/6 pbx-w-full"
|
|
129
|
-
>
|
|
130
|
-
<template v-if="!isLoading">
|
|
131
|
-
<button @click="handleCloseHTMLEditor" type="button" class="pbx-mySecondaryButton">
|
|
132
|
-
{{ translate('Close') }}
|
|
133
|
-
</button>
|
|
134
|
-
<button @click="handleSaveChangesElement" type="button" class="pbx-myPrimaryButton">
|
|
135
|
-
{{ translate('Save') }}
|
|
136
|
-
</button>
|
|
137
|
-
</template>
|
|
138
|
-
<template v-if="isLoading">
|
|
139
|
-
<div class="pbx-flex pbx-items-center pbx-my-2 pbx-justify-end">
|
|
140
|
-
<div
|
|
141
|
-
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]"
|
|
142
|
-
>
|
|
143
|
-
<span
|
|
144
|
-
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)]"
|
|
145
|
-
>Loading...</span
|
|
146
|
-
>
|
|
147
|
-
</div>
|
|
148
|
-
</div>
|
|
149
|
-
</template>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
</template>
|
|
154
|
-
|
|
155
|
-
<template v-if="globalPage">
|
|
156
|
-
<textarea
|
|
157
|
-
id="html-editor"
|
|
158
|
-
v-model="editableComponents"
|
|
159
|
-
class="pbx-h-full pbx-font-sans pbx-bg-gray-900 pbx-text-white pbx-w-full"
|
|
160
|
-
style="overflow: auto; min-height: 400px"
|
|
161
|
-
></textarea>
|
|
162
|
-
<div class="pbx-flex pbx-justify-end pbx-min-h-6">
|
|
163
|
-
<p v-if="errSaveComponents" class="pbx-myPrimaryParagraphError">
|
|
164
|
-
Error: {{ errSaveComponents }}
|
|
165
|
-
</p>
|
|
166
|
-
</div>
|
|
167
|
-
<div
|
|
168
|
-
class="pbx-border-0 pbx-border-solid pbx-border-t pbx-border-gray-200 pbx-flex pbx-items-center pbx-justify-end"
|
|
169
|
-
>
|
|
170
|
-
<div class="pbx-py-4 pbx-flex sm:pbx-justify-end pbx-justify-center">
|
|
171
|
-
<div
|
|
172
|
-
class="sm:pbx-grid-cols-2 sm:pbx-items-end sm:pbx-justify-end pbx-flex sm:pbx-flex-row pbx-flex-col pbx-myPrimaryGap sm:pbx-w-5/6 pbx-w-full"
|
|
173
|
-
>
|
|
174
|
-
<template v-if="!isLoading">
|
|
175
|
-
<button @click="handleCloseHTMLEditor" type="button" class="pbx-mySecondaryButton">
|
|
176
|
-
{{ translate('Close') }}
|
|
177
|
-
</button>
|
|
178
|
-
<button
|
|
179
|
-
@click="handleSaveChangesComponents"
|
|
180
|
-
type="button"
|
|
181
|
-
class="pbx-myPrimaryButton"
|
|
182
|
-
>
|
|
183
|
-
{{ translate('Save') }}
|
|
184
|
-
</button>
|
|
185
|
-
</template>
|
|
186
|
-
<template v-if="isLoading">
|
|
187
|
-
<div class="pbx-flex pbx-items-center pbx-my-2 pbx-justify-end">
|
|
188
|
-
<div
|
|
189
|
-
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]"
|
|
190
|
-
>
|
|
191
|
-
<span
|
|
192
|
-
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)]"
|
|
193
|
-
>Loading...</span
|
|
194
|
-
>
|
|
195
|
-
</div>
|
|
196
|
-
</div>
|
|
197
|
-
</template>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
</template>
|
|
202
|
-
</ModalBuilder>
|
|
203
|
-
</template>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, ref, inject } from 'vue'
|
|
3
|
-
import MediaLibraryModal from '../../../Modals/MediaLibraryModal.vue'
|
|
4
|
-
import { sharedPageBuilderStore } from '../../../../stores/shared-store'
|
|
5
|
-
import { preloadImage } from '../../../../composables/preloadImage'
|
|
6
|
-
import { delay } from '../../../../composables/delay'
|
|
7
|
-
import { useTranslations } from '../../../../composables/useTranslations'
|
|
8
|
-
|
|
9
|
-
const { translate } = useTranslations()
|
|
10
|
-
|
|
11
|
-
// Use shared store instance
|
|
12
|
-
const pageBuilderStateStore = sharedPageBuilderStore
|
|
13
|
-
const customMediaComponent = inject('CustomMediaComponent')
|
|
14
|
-
|
|
15
|
-
const getIsLoadingImage = ref(false)
|
|
16
|
-
|
|
17
|
-
const showMediaLibraryModal = ref(false)
|
|
18
|
-
// modal content
|
|
19
|
-
const titleMedia = ref('')
|
|
20
|
-
const descriptionMedia = ref('')
|
|
21
|
-
const firstButtonMedia = ref('')
|
|
22
|
-
const secondButtonMedia = ref(null)
|
|
23
|
-
const thirdButtonMedia = ref(null)
|
|
24
|
-
// set dynamic modal handle functions
|
|
25
|
-
const firstMediaButtonFunction = ref(null)
|
|
26
|
-
|
|
27
|
-
// get current image from store
|
|
28
|
-
const getBasePrimaryImage = computed(() => {
|
|
29
|
-
if (pageBuilderStateStore.getBasePrimaryImage) {
|
|
30
|
-
loadingImage(pageBuilderStateStore.getBasePrimaryImage)
|
|
31
|
-
}
|
|
32
|
-
return pageBuilderStateStore.getBasePrimaryImage
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const handleAddImage = function () {
|
|
36
|
-
// open modal to true
|
|
37
|
-
showMediaLibraryModal.value = true
|
|
38
|
-
|
|
39
|
-
titleMedia.value = translate('Media Library')
|
|
40
|
-
descriptionMedia.value = null
|
|
41
|
-
firstButtonMedia.value = translate('Close')
|
|
42
|
-
secondButtonMedia.value = translate(' Select image')
|
|
43
|
-
|
|
44
|
-
// handle click
|
|
45
|
-
firstMediaButtonFunction.value = function () {
|
|
46
|
-
showMediaLibraryModal.value = false
|
|
47
|
-
}
|
|
48
|
-
//
|
|
49
|
-
// end modal
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const loadingImage = async function (imageURL) {
|
|
53
|
-
getIsLoadingImage.value = true
|
|
54
|
-
|
|
55
|
-
if (imageURL && typeof imageURL === 'string' && imageURL.length > 2) {
|
|
56
|
-
await preloadImage(imageURL)
|
|
57
|
-
await delay(200)
|
|
58
|
-
getIsLoadingImage.value = false
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
</script>
|
|
62
|
-
<template>
|
|
63
|
-
<div>
|
|
64
|
-
<div v-show="getIsLoadingImage">
|
|
65
|
-
<div class="pbx-flex pbx-items-center pbx-justify-center pbx-mt-4 pbx-min-h-80">
|
|
66
|
-
<div
|
|
67
|
-
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]"
|
|
68
|
-
>
|
|
69
|
-
<span
|
|
70
|
-
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)]"
|
|
71
|
-
>Loading...</span
|
|
72
|
-
>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
<div v-show="getBasePrimaryImage && !getIsLoadingImage">
|
|
77
|
-
<img
|
|
78
|
-
class="pbx-object-cover pbx-object-center pbx-w-full pbx-cursor-pointer"
|
|
79
|
-
:src="getBasePrimaryImage"
|
|
80
|
-
@click="handleAddImage"
|
|
81
|
-
alt="image"
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
<MediaLibraryModal
|
|
85
|
-
:open="showMediaLibraryModal"
|
|
86
|
-
:title="titleMedia"
|
|
87
|
-
:description="descriptionMedia"
|
|
88
|
-
:firstButtonText="firstButtonMedia"
|
|
89
|
-
:secondButtonText="secondButtonMedia"
|
|
90
|
-
:thirdButtonText="thirdButtonMedia"
|
|
91
|
-
:customMediaComponent="customMediaComponent"
|
|
92
|
-
@firstMediaButtonFunction="firstMediaButtonFunction"
|
|
93
|
-
>
|
|
94
|
-
</MediaLibraryModal>
|
|
95
|
-
</div>
|
|
96
|
-
</template>
|
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, computed, watch, nextTick } from 'vue'
|
|
3
|
-
import { sharedPageBuilderStore } from '../../../../stores/shared-store'
|
|
4
|
-
import EditorAccordion from '../EditorAccordion.vue'
|
|
5
|
-
import { Switch } from '@headlessui/vue'
|
|
6
|
-
import { getPageBuilder } from '../../../../composables/builderInstance'
|
|
7
|
-
const pageBuilderService = getPageBuilder()
|
|
8
|
-
|
|
9
|
-
// Use shared store instance
|
|
10
|
-
const pageBuilderStateStore = sharedPageBuilderStore
|
|
11
|
-
|
|
12
|
-
const hyperlinkEnable = ref(false)
|
|
13
|
-
const urlInput = ref(null)
|
|
14
|
-
const openHyperlinkInNewTab = ref(false)
|
|
15
|
-
const getElementContainsHyperlink = computed(() => {
|
|
16
|
-
return pageBuilderStateStore.getElementContainsHyperlink
|
|
17
|
-
})
|
|
18
|
-
const getHyperlinkAbility = computed(() => {
|
|
19
|
-
return pageBuilderStateStore.getHyperlinkAbility
|
|
20
|
-
})
|
|
21
|
-
const getHyperlinkMessage = computed(() => {
|
|
22
|
-
return pageBuilderStateStore.getHyperlinkMessage
|
|
23
|
-
})
|
|
24
|
-
const getHyperlinkError = computed(() => {
|
|
25
|
-
return pageBuilderStateStore.getHyperlinkError
|
|
26
|
-
})
|
|
27
|
-
const getHyperlinkInput = computed(() => {
|
|
28
|
-
return pageBuilderStateStore.getHyperlinkInput
|
|
29
|
-
})
|
|
30
|
-
const getHyberlinkEnable = computed(() => {
|
|
31
|
-
return pageBuilderStateStore.getHyberlinkEnable
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const getOpenHyperlinkInNewTab = computed(() => {
|
|
35
|
-
return pageBuilderStateStore.getOpenHyperlinkInNewTab
|
|
36
|
-
})
|
|
37
|
-
const getElement = computed(() => {
|
|
38
|
-
return pageBuilderStateStore.getElement
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
watch(getHyperlinkInput, (newValue) => {
|
|
42
|
-
urlInput.value = newValue
|
|
43
|
-
})
|
|
44
|
-
watch(getHyberlinkEnable, (newValue) => {
|
|
45
|
-
hyperlinkEnable.value = newValue
|
|
46
|
-
})
|
|
47
|
-
watch(getOpenHyperlinkInNewTab, (newValue) => {
|
|
48
|
-
openHyperlinkInNewTab.value = newValue
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
// remove hyperlink
|
|
52
|
-
watch(hyperlinkEnable, (hyperlinkEnableNewValue) => {
|
|
53
|
-
hyperlinkEnable.value = hyperlinkEnableNewValue
|
|
54
|
-
pageBuilderStateStore.setHyberlinkEnable(hyperlinkEnable.value)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const handleToggleHyperlinkEnable = async function (data) {
|
|
58
|
-
await nextTick()
|
|
59
|
-
|
|
60
|
-
// remove hyperlink
|
|
61
|
-
if (hyperlinkEnable.value === false) {
|
|
62
|
-
pageBuilderService.handleHyperlink(hyperlinkEnable.value, data)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// add hyperlink
|
|
66
|
-
const handleHyperlink = function () {
|
|
67
|
-
pageBuilderService.handleHyperlink(
|
|
68
|
-
hyperlinkEnable.value,
|
|
69
|
-
urlInput.value,
|
|
70
|
-
openHyperlinkInNewTab.value,
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const handleToggleOpenHyperlinkInNewTab = async function () {
|
|
75
|
-
await nextTick()
|
|
76
|
-
|
|
77
|
-
pageBuilderService.handleHyperlink(
|
|
78
|
-
hyperlinkEnable.value,
|
|
79
|
-
urlInput.value,
|
|
80
|
-
openHyperlinkInNewTab.value,
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
</script>
|
|
84
|
-
|
|
85
|
-
<template>
|
|
86
|
-
<EditorAccordion>
|
|
87
|
-
<template #title>Link</template>
|
|
88
|
-
<template #content>
|
|
89
|
-
<!-- Hyperlink ability / start -->
|
|
90
|
-
<div v-if="getHyperlinkAbility === false" class="pbx-rounded-md pbx-bg-red-50 pbx-p-2">
|
|
91
|
-
<div class="pbx-flex pbx-items-center">
|
|
92
|
-
<div class="pbx-flex-shrink-0">
|
|
93
|
-
<span class="pbx-myMediumIcon material-symbols-outlined"> warning </span>
|
|
94
|
-
</div>
|
|
95
|
-
<div class="pbx-ml-2">
|
|
96
|
-
<p class="pbx-text-sm pbx-font-medium pbx-text-green-800">
|
|
97
|
-
Not able to add hyperlink on this element
|
|
98
|
-
</p>
|
|
99
|
-
</div>
|
|
100
|
-
<div class="pbx-ml-auto pbx-pl-3">
|
|
101
|
-
<div class="pbx-mx-1.5 pbx-my-1.5">
|
|
102
|
-
<button
|
|
103
|
-
type="button"
|
|
104
|
-
class="pbx-inline-flex pbx-rounded-md pbx-bg-green-50 pbx-p-1.5 pbx-text-green-500 hover:pbx-bg-green-100 focus:pbx-outline-none focus:pbx-ring-2 focus:pbx-ring-green-600 focus:pbx-ring-offset-2 focus:pbx-ring-offset-green-50"
|
|
105
|
-
></button>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
<!-- Hyperlink ability / end -->
|
|
111
|
-
<div v-if="getHyperlinkAbility === true">
|
|
112
|
-
<div class="pbx-my-2 pbx-py-2">
|
|
113
|
-
<div class="pbx-flex pbx-items-center pbx-justify-between pbx-gap-2 pbx-w-full">
|
|
114
|
-
<p class="pbx-myPrimaryParagraph">Enable hyperlink</p>
|
|
115
|
-
<!-- Toggle start -->
|
|
116
|
-
<Switch
|
|
117
|
-
v-model="hyperlinkEnable"
|
|
118
|
-
@click="handleToggleHyperlinkEnable('removeHyperlink')"
|
|
119
|
-
:class="[
|
|
120
|
-
hyperlinkEnable ? 'pbx-bg-myPrimaryLinkColor' : 'pbx-bg-gray-200',
|
|
121
|
-
'pbx-relative pbx-inline-flex pbx-h-6 pbx-w-11 pbx-flex-shrink-0 pbx-cursor-pointer pbx-rounded-full pbx-border-2 pbx-border-transparent pbx-transition-colors pbx-duration-200 pbx-ease-in-out focus:pbx-outline-none focus:pbx-ring-2 focus:pbx-ring-myPrimaryLinkColor focus:pbx-ring-offset-2',
|
|
122
|
-
]"
|
|
123
|
-
>
|
|
124
|
-
<span class="pbx-sr-only">Use setting</span>
|
|
125
|
-
<span
|
|
126
|
-
:class="[
|
|
127
|
-
hyperlinkEnable ? 'pbx-translate-x-5' : 'pbx-translate-x-0',
|
|
128
|
-
'pbx-pointer-events-none pbx-relative pbx-inline-block pbx-h-5 pbx-w-5 pbx-transform pbx-rounded-full pbx-bg-white pbx-shadow pbx-ring-0 pbx-transition pbx-duration-200 pbx-ease-in-out',
|
|
129
|
-
]"
|
|
130
|
-
>
|
|
131
|
-
<span
|
|
132
|
-
:class="[
|
|
133
|
-
hyperlinkEnable
|
|
134
|
-
? 'pbx-opacity-0 pbx-ease-out pbx-duration-100'
|
|
135
|
-
: 'pbx-opacity-100 pbx-ease-in pbx-duration-200',
|
|
136
|
-
'pbx-absolute pbx-inset-0 pbx-flex pbx-h-full pbx-w-full pbx-items-center pbx-justify-center pbx-transition-opacity',
|
|
137
|
-
]"
|
|
138
|
-
aria-hidden="true"
|
|
139
|
-
>
|
|
140
|
-
<svg class="pbx-h-3 pbx-w-3 pbx-text-gray-400" fill="none" viewBox="0 0 12 12">
|
|
141
|
-
<path
|
|
142
|
-
d="M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2"
|
|
143
|
-
stroke="currentColor"
|
|
144
|
-
stroke-width="1.5"
|
|
145
|
-
stroke-linecap="round"
|
|
146
|
-
stroke-linejoin="round"
|
|
147
|
-
/>
|
|
148
|
-
</svg>
|
|
149
|
-
</span>
|
|
150
|
-
<span
|
|
151
|
-
:class="[
|
|
152
|
-
hyperlinkEnable
|
|
153
|
-
? 'pbx-opacity-100 pbx-ease-in pbx-duration-200'
|
|
154
|
-
: 'pbx-opacity-0 pbx-ease-out pbx-duration-100',
|
|
155
|
-
'pbx-absolute pbx-inset-0 pbx-flex pbx-h-full pbx-w-full pbx-items-center pbx-justify-center pbx-transition-opacity',
|
|
156
|
-
]"
|
|
157
|
-
aria-hidden="true"
|
|
158
|
-
>
|
|
159
|
-
<svg
|
|
160
|
-
class="pbx-h-3 pbx-w-3 pbx-text-myPrimaryLinkColor"
|
|
161
|
-
fill="currentColor"
|
|
162
|
-
viewBox="0 0 12 12"
|
|
163
|
-
>
|
|
164
|
-
<path
|
|
165
|
-
d="M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"
|
|
166
|
-
/>
|
|
167
|
-
</svg>
|
|
168
|
-
</span>
|
|
169
|
-
</span>
|
|
170
|
-
</Switch>
|
|
171
|
-
<!-- Toggle end -->
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
<!-- attached url - start -->
|
|
175
|
-
<div
|
|
176
|
-
v-if="getElementContainsHyperlink === true"
|
|
177
|
-
class="pbx-rounded-md pbx-bg-green-50 pbx-p-2"
|
|
178
|
-
>
|
|
179
|
-
<div class="pbx-flex pbx-items-center">
|
|
180
|
-
<div class="pbx-flex-shrink-0">
|
|
181
|
-
<span class="pbx-myMediumIcon material-symbols-outlined"> check </span>
|
|
182
|
-
</div>
|
|
183
|
-
<div class="pbx-ml-2">
|
|
184
|
-
<p class="pbx-text-sm pbx-font-medium pbx-text-green-800">Hyperlink added</p>
|
|
185
|
-
</div>
|
|
186
|
-
<div class="pbx-ml-auto pbx-pl-3">
|
|
187
|
-
<div class="pbx-mx-1.5 pbx-my-1.5">
|
|
188
|
-
<button
|
|
189
|
-
type="button"
|
|
190
|
-
class="pbx-inline-flex pbx-rounded-md pbx-bg-green-50 pbx-p-1.5 pbx-text-green-500 hover:pbx-bg-green-100 focus:pbx-outline-none focus:pbx-ring-2 focus:pbx-ring-green-600 focus:pbx-ring-offset-2 focus:pbx-ring-offset-green-50"
|
|
191
|
-
></button>
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
</div>
|
|
195
|
-
</div>
|
|
196
|
-
<!-- attached url - end -->
|
|
197
|
-
<!-- no attached url - start -->
|
|
198
|
-
<div
|
|
199
|
-
v-if="getElementContainsHyperlink === false"
|
|
200
|
-
class="pbx-rounded-md pbx-bg-red-50 pbx-p-2"
|
|
201
|
-
>
|
|
202
|
-
<div class="pbx-flex pbx-items-center">
|
|
203
|
-
<div class="pbx-flex-shrink-0">
|
|
204
|
-
<span class="pbx-myMediumIcon material-symbols-outlined"> warning </span>
|
|
205
|
-
</div>
|
|
206
|
-
<div class="pbx-ml-2">
|
|
207
|
-
<p class="pbx-text-sm pbx-font-medium pbx-text-green-800">No hyperlink added</p>
|
|
208
|
-
</div>
|
|
209
|
-
<div class="pbx-ml-auto pbx-pl-3">
|
|
210
|
-
<div class="pbx-mx-1.5 pbx-my-1.5">
|
|
211
|
-
<button
|
|
212
|
-
type="button"
|
|
213
|
-
class="pbx-inline-flex pbx-rounded-md pbx-bg-green-50 pbx-p-1.5 pbx-text-green-500 hover:pbx-bg-green-100 focus:pbx-outline-none focus:pbx-ring-2 focus:pbx-ring-green-600 focus:pbx-ring-offset-2 focus:pbx-ring-offset-green-50"
|
|
214
|
-
></button>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
<!-- no attached url - end -->
|
|
220
|
-
<div v-if="hyperlinkEnable === true" class="pbx-my-2 pbx-py-2">
|
|
221
|
-
<div
|
|
222
|
-
class="pbx-relative pbx-flex pbx-items-center pbx-w-full pbx-border-solid pbx-border pbx-border-gray-200 pbx-myPrimaryInput pbx-py-0 pbx-p-0"
|
|
223
|
-
>
|
|
224
|
-
<input
|
|
225
|
-
v-model="urlInput"
|
|
226
|
-
type="text"
|
|
227
|
-
placeholder="URL.."
|
|
228
|
-
autocomplete="off"
|
|
229
|
-
class="pbx-myPrimaryInput pbx-border-none pbx-rounded-r-none pbx-ml-0 pbx-w-full"
|
|
230
|
-
@keydown.enter.tab.prevent="handleHyperlink()"
|
|
231
|
-
/>
|
|
232
|
-
<div
|
|
233
|
-
class="pbx-border-none pbx-rounded pbx-flex pbx-items-center pbx-justify-center pbx-h-full pbx-w-8"
|
|
234
|
-
>
|
|
235
|
-
<kbd class="pbx-myPrimaryParagraph pbx-text-gray-400 pbx-border-none"> ⏎ </kbd>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
|
|
239
|
-
<p
|
|
240
|
-
v-if="getHyperlinkMessage !== null"
|
|
241
|
-
class="pbx-myPrimaryParagraph pbx-text-myPrimarySuccesColor pbx-mt-1"
|
|
242
|
-
>
|
|
243
|
-
{{ getHyperlinkMessage }}
|
|
244
|
-
</p>
|
|
245
|
-
<p v-if="getHyperlinkError !== null" class="pbx-myPrimaryParagraphError pbx-mt-1">
|
|
246
|
-
{{ getHyperlinkError }}
|
|
247
|
-
</p>
|
|
248
|
-
|
|
249
|
-
<div class="pbx-my-2 pbx-py-2">
|
|
250
|
-
<div class="pbx-flex pbx-items-center pbx-justify-between pbx-gap-2 pbx-w-full">
|
|
251
|
-
<p class="pbx-myPrimaryParagraph">Open in new tab</p>
|
|
252
|
-
<!-- Toggle start -->
|
|
253
|
-
<Switch
|
|
254
|
-
v-model="openHyperlinkInNewTab"
|
|
255
|
-
@click="handleToggleOpenHyperlinkInNewTab"
|
|
256
|
-
:class="[
|
|
257
|
-
openHyperlinkInNewTab ? 'pbx-bg-myPrimaryLinkColor' : 'pbx-bg-gray-200',
|
|
258
|
-
'pbx-relative pbx-inline-flex pbx-h-6 pbx-w-11 pbx-flex-shrink-0 pbx-cursor-pointer pbx-rounded-full pbx-border-2 pbx-border-transparent pbx-transition-colors pbx-duration-200 pbx-ease-in-out focus:pbx-outline-none focus:pbx-ring-2 focus:pbx-ring-myPrimaryLinkColor focus:pbx-ring-offset-2',
|
|
259
|
-
]"
|
|
260
|
-
>
|
|
261
|
-
<span class="pbx-sr-only">Use setting</span>
|
|
262
|
-
<span
|
|
263
|
-
:class="[
|
|
264
|
-
openHyperlinkInNewTab ? 'pbx-translate-x-5' : 'pbx-translate-x-0',
|
|
265
|
-
'pbx-pointer-events-none pbx-relative pbx-inline-block pbx-h-5 pbx-w-5 pbx-transform pbx-rounded-full pbx-bg-white pbx-shadow pbx-ring-0 pbx-transition pbx-duration-200 pbx-ease-in-out',
|
|
266
|
-
]"
|
|
267
|
-
>
|
|
268
|
-
<span
|
|
269
|
-
:class="[
|
|
270
|
-
openHyperlinkInNewTab
|
|
271
|
-
? 'pbx-opacity-0 pbx-ease-out pbx-duration-100'
|
|
272
|
-
: 'pbx-opacity-100 pbx-ease-in pbx-duration-200',
|
|
273
|
-
'pbx-absolute pbx-inset-0 pbx-flex pbx-h-full pbx-w-full pbx-items-center pbx-justify-center pbx-transition-opacity',
|
|
274
|
-
]"
|
|
275
|
-
aria-hidden="true"
|
|
276
|
-
>
|
|
277
|
-
<svg class="pbx-h-3 pbx-w-3 pbx-text-gray-400" fill="none" viewBox="0 0 12 12">
|
|
278
|
-
<path
|
|
279
|
-
d="M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2"
|
|
280
|
-
stroke="currentColor"
|
|
281
|
-
stroke-width="1.5"
|
|
282
|
-
stroke-linecap="round"
|
|
283
|
-
stroke-linejoin="round"
|
|
284
|
-
/>
|
|
285
|
-
</svg>
|
|
286
|
-
</span>
|
|
287
|
-
<span
|
|
288
|
-
:class="[
|
|
289
|
-
openHyperlinkInNewTab
|
|
290
|
-
? 'pbx-opacity-100 pbx-ease-in pbx-duration-200'
|
|
291
|
-
: 'pbx-opacity-0 pbx-ease-out pbx-duration-100',
|
|
292
|
-
'pbx-absolute pbx-inset-0 pbx-flex pbx-h-full pbx-w-full pbx-items-center pbx-justify-center pbx-transition-opacity',
|
|
293
|
-
]"
|
|
294
|
-
aria-hidden="true"
|
|
295
|
-
>
|
|
296
|
-
<svg
|
|
297
|
-
class="pbx-h-3 pbx-w-3 pbx-text-myPrimaryLinkColor"
|
|
298
|
-
fill="currentColor"
|
|
299
|
-
viewBox="0 0 12 12"
|
|
300
|
-
>
|
|
301
|
-
<path
|
|
302
|
-
d="M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"
|
|
303
|
-
/>
|
|
304
|
-
</svg>
|
|
305
|
-
</span>
|
|
306
|
-
</span>
|
|
307
|
-
</Switch>
|
|
308
|
-
<!-- Toggle end -->
|
|
309
|
-
</div>
|
|
310
|
-
</div>
|
|
311
|
-
</div>
|
|
312
|
-
</div>
|
|
313
|
-
</template>
|
|
314
|
-
</EditorAccordion>
|
|
315
|
-
</template>
|