comand-component-library 3.3.84 → 3.3.85
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/comand-component-library.js +5630 -3936
- package/dist/comand-component-library.umd.cjs +4 -4
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +215 -112
- package/src/assets/data/component-structure.json +228 -0
- package/src/assets/data/form-elements.json +156 -0
- package/src/assets/data/opening-hours.json +79 -37
- package/src/components/CmdAddressData.vue +187 -201
- package/src/components/CmdAddressDataItem.vue +306 -0
- package/src/components/CmdBox.vue +1 -0
- package/src/components/CmdBoxWrapper.vue +53 -5
- package/src/components/CmdFancyBox.vue +31 -4
- package/src/components/CmdForm.vue +98 -4
- package/src/components/CmdFormElement.vue +5 -1
- package/src/components/CmdHeadline.vue +179 -52
- package/src/components/CmdImage.vue +150 -21
- package/src/components/CmdImageGallery.vue +88 -85
- package/src/components/CmdListOfLinks.vue +63 -43
- package/src/components/CmdListOfLinksItem.vue +97 -0
- package/src/components/CmdLoginForm.vue +3 -6
- package/src/components/CmdMultistepFormProgressBar.vue +37 -8
- package/src/components/CmdOpeningHours.vue +280 -63
- package/src/components/CmdOpeningHoursItem.vue +264 -0
- package/src/components/{CmdPager.vue → CmdPagination.vue} +2 -2
- package/src/components/CmdSlideshow.vue +137 -10
- package/src/components/CmdSocialNetworks.vue +115 -28
- package/src/components/CmdSocialNetworksItem.vue +184 -0
- package/src/components/CmdTable.vue +0 -1
- package/src/components/CmdTextImageBlock.vue +158 -0
- package/src/components/CmdThumbnailScroller.vue +132 -12
- package/src/components/CmdToggleDarkMode.vue +58 -1
- package/src/components/EditComponentWrapper.vue +553 -0
- package/src/index.js +2 -2
- package/src/mixins/EditMode.vue +28 -9
- package/src/utils/editmode.js +30 -5
- package/src/components/CmdTextBlock.vue +0 -73
- package/src/editmode/editModeContext.js +0 -50
@@ -1,31 +1,85 @@
|
|
1
1
|
<template>
|
2
|
-
<div v-if="!editModeContext
|
2
|
+
<div v-if="!editModeContext || settingsContext || mainSidebarContext"
|
3
|
+
:class="['cmd-headline', {'has-pre-headline-text': preHeadlineText, 'has-icon': headlineIcon?.iconClass}, getTextAlign]">
|
3
4
|
<!-- begin CmdIcon -->
|
4
5
|
<CmdIcon v-if="headlineIcon" :iconClass="headlineIcon?.iconClass" :type="headlineIcon?.iconType" />
|
5
6
|
<!-- end CmdIcon -->
|
6
7
|
|
7
8
|
<div v-if="preHeadlineText">
|
8
9
|
<span class="pre-headline-text">{{ preHeadlineText }}</span>
|
9
|
-
<component :is="
|
10
|
+
<component v-if="headlineText" :is="headlineTag">
|
10
11
|
<!-- being slot -->
|
11
12
|
<slot>{{ headlineText }}</slot>
|
12
13
|
<!-- end slot -->
|
13
14
|
</component>
|
14
15
|
</div>
|
15
|
-
<component v-else :is="
|
16
|
+
<component v-else-if="headlineText" :is="headlineTag">
|
16
17
|
<!-- being slot -->
|
17
18
|
<slot>{{ headlineText }}</slot>
|
18
19
|
<!-- end slot -->
|
19
20
|
</component>
|
20
21
|
</div>
|
21
22
|
<!-- begin edit-mode -->
|
22
|
-
<
|
23
|
+
<EditComponentWrapper
|
24
|
+
v-else
|
25
|
+
ref="editComponentWrapper"
|
26
|
+
class="edit-items"
|
27
|
+
:showComponentName="false"
|
28
|
+
:allowedComponentTypes="[]"
|
29
|
+
componentName="CmdHeadline"
|
30
|
+
:componentProps="{headlineText, headlineLevel}"
|
31
|
+
:componentPath="headlineComponentPath"
|
32
|
+
:allowDeleteComponent="!!headlineText"
|
33
|
+
>
|
34
|
+
<template v-slot="slotProps">
|
35
|
+
<CmdFormElement
|
36
|
+
v-if="slotProps.editing"
|
37
|
+
element="input"
|
38
|
+
type="text"
|
39
|
+
:class="['edit-mode', 'headline', 'h'+ headlineLevel, getTextAlign]"
|
40
|
+
labelText="Headline"
|
41
|
+
:showLabel="false"
|
42
|
+
placeholder="Headline"
|
43
|
+
v-model="editableHeadlineText"
|
44
|
+
/>
|
45
|
+
<div v-else-if="headlineText"
|
46
|
+
:class="['cmd-headline', {'has-pre-headline-text': preHeadlineText, 'has-icon': headlineIcon?.iconClass}, getTextAlign]">
|
47
|
+
<!-- begin CmdIcon -->
|
48
|
+
<CmdIcon v-if="headlineIcon" :iconClass="headlineIcon?.iconClass" :type="headlineIcon?.iconType"/>
|
49
|
+
<!-- end CmdIcon -->
|
50
|
+
|
51
|
+
<div v-if="preHeadlineText">
|
52
|
+
<span class="pre-headline-text">{{ preHeadlineText }}</span>
|
53
|
+
<component v-if="headlineText" :is="headlineTag">
|
54
|
+
<!-- being slot -->
|
55
|
+
<slot>{{ headlineText }}</slot>
|
56
|
+
<!-- end slot -->
|
57
|
+
</component>
|
58
|
+
</div>
|
59
|
+
<component v-else-if="headlineText" :is="headlineTag">
|
60
|
+
<!-- being slot -->
|
61
|
+
<slot>{{ headlineText }}</slot>
|
62
|
+
<!-- end slot -->
|
63
|
+
</component>
|
64
|
+
</div>
|
65
|
+
<!-- begin show placeholder if no image exists (and component is not edited) -->
|
66
|
+
<button v-else-if="componentActive" type="button" class="button confirm" @click="onAddItem">
|
67
|
+
<span class="icon-plus"></span>
|
68
|
+
<span>Add new headline</span>
|
69
|
+
</button>
|
70
|
+
<!-- end show placeholder if no image exists (and component is not edited) -->
|
71
|
+
</template>
|
72
|
+
</EditComponentWrapper>
|
23
73
|
<!-- end edit-mode -->
|
24
74
|
</template>
|
25
75
|
|
26
76
|
<script>
|
77
|
+
import EditMode from "../mixins/EditMode.vue"
|
78
|
+
import {buildComponentPath, findEditComponentWrapper, updateHandlerProvider} from "../utils/editmode.js"
|
79
|
+
|
27
80
|
export default {
|
28
81
|
name: "CmdHeadline",
|
82
|
+
mixins: [EditMode],
|
29
83
|
inject: {
|
30
84
|
editModeContext: {
|
31
85
|
default: null
|
@@ -33,7 +87,8 @@ export default {
|
|
33
87
|
},
|
34
88
|
data() {
|
35
89
|
return {
|
36
|
-
editableHeadlineText:
|
90
|
+
editableHeadlineText: null,
|
91
|
+
editablePreHeadlineText: null
|
37
92
|
}
|
38
93
|
},
|
39
94
|
props: {
|
@@ -49,7 +104,7 @@ export default {
|
|
49
104
|
*/
|
50
105
|
headlineLevel: {
|
51
106
|
type: [String, Number],
|
52
|
-
|
107
|
+
default: "2"
|
53
108
|
},
|
54
109
|
/**
|
55
110
|
* small pre-headline-text above main-headline
|
@@ -73,16 +128,16 @@ export default {
|
|
73
128
|
textAlign: {
|
74
129
|
type: String,
|
75
130
|
default: null
|
76
|
-
},
|
77
|
-
editModeContextData: {
|
78
|
-
type: Object
|
79
131
|
}
|
80
132
|
},
|
81
|
-
mounted() {
|
82
|
-
this.editModeContext?.addSaveHandler(this.onSave)
|
83
|
-
},
|
84
133
|
computed: {
|
85
|
-
|
134
|
+
componentActive() {
|
135
|
+
return this.editModeContext?.system.isActiveComponent(buildComponentPath(findEditComponentWrapper(this)))
|
136
|
+
},
|
137
|
+
headlineComponentPath() {
|
138
|
+
return this.componentPath || ["props", "cmdHeadline"]
|
139
|
+
},
|
140
|
+
headlineTag() {
|
86
141
|
if(this.headlineLevel) {
|
87
142
|
return "h" + this.headlineLevel
|
88
143
|
}
|
@@ -96,17 +151,36 @@ export default {
|
|
96
151
|
}
|
97
152
|
},
|
98
153
|
methods: {
|
99
|
-
|
154
|
+
updateHandlerProvider() {
|
100
155
|
const headlineText = this.editableHeadlineText
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
headlineText,
|
156
|
+
const preHeadlineText = this.editablePreHeadlineText
|
157
|
+
const headlineLevel = this.headlineLevel
|
158
|
+
|
159
|
+
return updateHandlerProvider(this, {
|
106
160
|
update(props) {
|
107
161
|
props.headlineText = headlineText
|
162
|
+
props.preHeadlineText = preHeadlineText
|
163
|
+
props.headlineLevel = headlineLevel
|
108
164
|
}
|
165
|
+
})
|
166
|
+
},
|
167
|
+
onAddItem() {
|
168
|
+
// execute editComponent-function from editComponentWrapper to enter editMode directly on "add"
|
169
|
+
this.$refs.editComponentWrapper.editComponent()
|
109
170
|
}
|
171
|
+
},
|
172
|
+
watch: {
|
173
|
+
headlineText: {
|
174
|
+
handler() {
|
175
|
+
this.editableHeadlineText = this.headlineText
|
176
|
+
},
|
177
|
+
immediate: true
|
178
|
+
},
|
179
|
+
preHeadlineText: {
|
180
|
+
handler() {
|
181
|
+
this.editablePreHeadlineText = this.preHeadlineText
|
182
|
+
},
|
183
|
+
immediate: true
|
110
184
|
}
|
111
185
|
}
|
112
186
|
}
|
@@ -117,50 +191,103 @@ export default {
|
|
117
191
|
//@import '../assets/styles/variables';
|
118
192
|
|
119
193
|
.cmd-headline {
|
120
|
-
|
121
|
-
|
194
|
+
margin-bottom: var(--default-margin);
|
195
|
+
gap: calc(var(--default-gap) / 2);
|
196
|
+
|
197
|
+
&.text-center > * {
|
198
|
+
text-align: center;
|
199
|
+
}
|
200
|
+
|
201
|
+
&.text-right > * {
|
202
|
+
text-align: right;
|
203
|
+
}
|
204
|
+
|
205
|
+
&.has-pre-headline-text {
|
206
|
+
text-align: inherit;
|
207
|
+
}
|
208
|
+
|
209
|
+
p {
|
210
|
+
margin-bottom: 0;
|
211
|
+
}
|
212
|
+
|
213
|
+
&:has(span[class*="icon"]) {
|
214
|
+
display: flex;
|
215
|
+
align-items: center;
|
216
|
+
}
|
217
|
+
|
218
|
+
&:has(h1) span[class*="icon"] {
|
219
|
+
font-size: calc(var(--headline-font-size-h1) * 1.6);
|
220
|
+
}
|
221
|
+
|
222
|
+
&:has(h2) span[class*="icon"] {
|
223
|
+
font-size: calc(var(--headline-font-size-h2) * 1.8);
|
224
|
+
}
|
122
225
|
|
123
|
-
|
124
|
-
|
125
|
-
|
226
|
+
&:has(h3) span[class*="icon"] {
|
227
|
+
font-size: calc(var(--headline-font-size-h3) * 1.9);
|
228
|
+
}
|
229
|
+
|
230
|
+
&:has(h4) span[class*="icon"] {
|
231
|
+
font-size: calc(var(--headline-font-size-h4) * 2);
|
232
|
+
}
|
126
233
|
|
127
|
-
|
128
|
-
|
129
|
-
|
234
|
+
&:has(h5) span[class*="icon"] {
|
235
|
+
font-size: calc(var(--headline-font-size-h5) * 2.1);
|
236
|
+
}
|
130
237
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
}
|
238
|
+
&:has(h6) span[class*="icon"] {
|
239
|
+
font-size: calc(var(--headline-font-size-h6) * 2.2);
|
240
|
+
}
|
135
241
|
|
136
|
-
|
137
|
-
|
242
|
+
&:has(h4, h5, h6) .pre-headline-text {
|
243
|
+
font-size: var(--font-size-small);
|
244
|
+
}
|
138
245
|
|
139
|
-
|
140
|
-
|
246
|
+
.pre-headline-text {
|
247
|
+
line-height: 1;
|
141
248
|
}
|
142
|
-
}
|
143
249
|
|
144
|
-
|
145
|
-
|
146
|
-
}
|
250
|
+
h1, h2, h3, h4, h5, h6 {
|
251
|
+
margin: 0;
|
147
252
|
|
148
|
-
|
149
|
-
|
253
|
+
&:only-child {
|
254
|
+
flex: none;
|
255
|
+
width: 100%;
|
256
|
+
}
|
257
|
+
}
|
258
|
+
}
|
150
259
|
|
151
|
-
|
152
|
-
|
153
|
-
|
260
|
+
.edit-mode label.headline {
|
261
|
+
input {
|
262
|
+
padding: 0;
|
263
|
+
height: auto;
|
264
|
+
font-weight: var(--headline-font-weight);
|
154
265
|
}
|
155
|
-
}
|
156
266
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
267
|
+
&.h1 input {
|
268
|
+
font-size: var(--headline-font-size-h1);
|
269
|
+
text-transform: var(--headline-text-transform);
|
270
|
+
}
|
271
|
+
|
272
|
+
&.h2 input {
|
273
|
+
font-size: var(--headline-font-size-h2);
|
274
|
+
}
|
275
|
+
|
276
|
+
&.h3 input {
|
277
|
+
font-size: var(--headline-font-size-h3);
|
278
|
+
}
|
279
|
+
|
280
|
+
&.h4 input {
|
281
|
+
font-size: var(--headline-font-size-h4);
|
282
|
+
}
|
283
|
+
|
284
|
+
&.h5 input {
|
285
|
+
font-size: var(--headline-font-size-h5);
|
286
|
+
}
|
287
|
+
|
288
|
+
&.h6 input {
|
289
|
+
font-size: var(--headline-font-size-h6);
|
290
|
+
}
|
164
291
|
}
|
165
292
|
/* end cmd-headline ------------------------------------------------------------------------------------------ */
|
166
293
|
</style>
|
@@ -1,42 +1,105 @@
|
|
1
1
|
<template>
|
2
2
|
<!-- begin edit-mode -->
|
3
|
-
<
|
4
|
-
|
3
|
+
<EditComponentWrapper
|
4
|
+
v-if="editModeContext"
|
5
|
+
ref="editComponentWrapper"
|
6
|
+
class="edit-items"
|
7
|
+
:showComponentName="false"
|
8
|
+
:allowedComponentTypes="[]"
|
9
|
+
componentName="CmdImage"
|
10
|
+
:componentProps="{image, figcaption}"
|
11
|
+
:componentPath="imageComponentPath"
|
12
|
+
:allowDeleteComponent="!!imageSource"
|
13
|
+
:itemProvider="editModeConfig?.allowAddItem !== false ? itemProvider : null"
|
14
|
+
>
|
15
|
+
<template v-slot="slotProps">
|
16
|
+
<figure :class="['cmd-image flex-container no-gap vertical', textAlign]">
|
17
|
+
<!-- begin figcaption above image -->
|
18
|
+
<template v-if="figcaption.show && figcaption?.position === 'top'">
|
5
19
|
<CmdFormElement
|
20
|
+
v-if="slotProps.editing"
|
6
21
|
element="input"
|
7
22
|
type="text"
|
23
|
+
:class="[textAlign, 'edit-mode']"
|
8
24
|
:required="true"
|
9
25
|
labelText="Text figcaption"
|
10
26
|
v-model="editableFigcaptionText"
|
11
27
|
/>
|
28
|
+
<figcaption v-else-if="figcaption?.text">{{ figcaption?.text }}</figcaption>
|
12
29
|
</template>
|
13
|
-
|
30
|
+
<!-- end figcaption above image -->
|
31
|
+
|
32
|
+
<!-- begin image-wrapper -->
|
33
|
+
<template v-if="slotProps.editing">
|
34
|
+
<!-- begin image with drop-area -->
|
35
|
+
<a href="#" :class="['box drop-area flex-container vertical', { 'allow-drop': allowDrop }]"
|
36
|
+
v-on="dragAndDropHandler"
|
37
|
+
@click.prevent="selectFiles"
|
38
|
+
title="Drag new image to this area to replace old one!">
|
14
39
|
<span class="icon-image"></span>
|
15
|
-
|
16
|
-
|
40
|
+
<img :src="imageSource" :alt="image?.alt" :title="image?.tooltip"/>
|
41
|
+
</a>
|
42
|
+
<!-- end image with drop-area -->
|
43
|
+
|
44
|
+
<!-- begin CmdFormElement -->
|
45
|
+
<CmdFormElement
|
46
|
+
class="hidden"
|
47
|
+
element="input"
|
48
|
+
type="file"
|
49
|
+
labelText="Select new image"
|
50
|
+
:disabled="uploadInitiated"
|
51
|
+
@change="fileSelected"
|
52
|
+
ref="formElement"
|
53
|
+
/>
|
54
|
+
<!-- end CmdFormElement -->
|
55
|
+
</template>
|
56
|
+
<template v-else-if="imageSource">
|
57
|
+
<!-- begin image without drop-area -->
|
58
|
+
<img :src="imageSource" :alt="image?.alt" :title="image?.tooltip"/>
|
59
|
+
<!-- end image without drop-area -->
|
60
|
+
</template>
|
61
|
+
<!-- end image-wrapper -->
|
17
62
|
|
18
|
-
|
63
|
+
<!-- begin figcaption below image -->
|
64
|
+
<template v-if="figcaption.show && figcaption?.position !== 'top'">
|
19
65
|
<CmdFormElement
|
66
|
+
v-if="slotProps.editing"
|
20
67
|
element="input"
|
21
68
|
type="text"
|
22
|
-
|
69
|
+
:class="[textAlign, 'edit-mode']"
|
23
70
|
:required="true"
|
24
71
|
labelText="Text figcaption"
|
25
72
|
:showLabel="false"
|
26
73
|
v-model="editableFigcaptionText"
|
74
|
+
placeholder="figcaption"
|
27
75
|
/>
|
76
|
+
<figcaption v-else-if="figcaption?.text">{{ figcaption?.text }}</figcaption>
|
28
77
|
</template>
|
78
|
+
<!-- end figcaption below image -->
|
79
|
+
|
80
|
+
<!-- begin show placeholder if no image exists (and component is not edited) -->
|
81
|
+
<button v-if="!slotProps.editing && !imageSource" type="button" class="button confirm"
|
82
|
+
@click="onAddItem">
|
83
|
+
<span class="icon-add"></span>
|
84
|
+
<span>Add new image</span>
|
85
|
+
</button>
|
86
|
+
<!-- end show placeholder if no image exists (and component is not edited) -->
|
29
87
|
</figure>
|
88
|
+
</template>
|
89
|
+
</EditComponentWrapper>
|
30
90
|
<!-- end edit-mode -->
|
31
91
|
|
32
|
-
|
92
|
+
<!-- begin default-view -->
|
93
|
+
<figure v-else :class="['cmd-image', textAlign]">
|
33
94
|
<figcaption v-if="figcaption?.show && figcaption?.position === 'top'">{{ figcaption?.text }}</figcaption>
|
34
|
-
<img :src="imageSource" :alt="image
|
95
|
+
<img :src="imageSource" :alt="image?.alt" :title="image?.tooltip"/>
|
35
96
|
<figcaption v-if="figcaption?.show && figcaption?.position !== 'top'">{{ figcaption?.text }}</figcaption>
|
36
97
|
</figure>
|
98
|
+
<!-- end default-view -->
|
37
99
|
</template>
|
38
100
|
|
39
101
|
<script>
|
102
|
+
import {createUuid} from "../utils/common.js"
|
40
103
|
import {checkAndUploadFile} from "../utils/checkAndUploadFile"
|
41
104
|
import EditMode from "../mixins/EditMode.vue"
|
42
105
|
import {updateHandlerProvider} from "../utils/editmode.js"
|
@@ -53,6 +116,7 @@ export default {
|
|
53
116
|
uploadInitiated: false,
|
54
117
|
allowDrop: false,
|
55
118
|
showFigcaption: true,
|
119
|
+
figcaptionText: null,
|
56
120
|
figcaptionPosition: null,
|
57
121
|
figcaptionTextAlign: null,
|
58
122
|
tooltip: null,
|
@@ -81,8 +145,7 @@ export default {
|
|
81
145
|
text: "Right",
|
82
146
|
value: "right"
|
83
147
|
}
|
84
|
-
]
|
85
|
-
figcaptionText: null
|
148
|
+
]
|
86
149
|
}
|
87
150
|
},
|
88
151
|
props: {
|
@@ -91,7 +154,7 @@ export default {
|
|
91
154
|
*/
|
92
155
|
image: {
|
93
156
|
type: Object,
|
94
|
-
required:
|
157
|
+
required: false
|
95
158
|
},
|
96
159
|
/**
|
97
160
|
* figcaption-object including visibility, position (top/bottom), text
|
@@ -101,12 +164,15 @@ export default {
|
|
101
164
|
required: false
|
102
165
|
},
|
103
166
|
/**
|
104
|
-
*
|
167
|
+
* maximum file size (in bytes) for file to upload
|
105
168
|
*/
|
106
169
|
maxFileUploadSize: {
|
107
170
|
type: Number,
|
108
171
|
default: 500000
|
109
172
|
},
|
173
|
+
/**
|
174
|
+
* minimum image width (in pixels) for file to upload
|
175
|
+
*/
|
110
176
|
minImageWidth: {
|
111
177
|
type: Number,
|
112
178
|
default: 600
|
@@ -125,6 +191,9 @@ export default {
|
|
125
191
|
window.removeEventListener("resize", this.updateWindowWidth)
|
126
192
|
},
|
127
193
|
computed: {
|
194
|
+
imageComponentPath() {
|
195
|
+
return this.componentPath || ["props", "cmdImage"]
|
196
|
+
},
|
128
197
|
imageSource() {
|
129
198
|
// check if a new image is provided
|
130
199
|
if(this.newImageSource) {
|
@@ -132,7 +201,11 @@ export default {
|
|
132
201
|
}
|
133
202
|
|
134
203
|
// if only one src exists
|
135
|
-
const imgSrc = this.image
|
204
|
+
const imgSrc = this.image?.src
|
205
|
+
|
206
|
+
if (!imgSrc) {
|
207
|
+
return null
|
208
|
+
}
|
136
209
|
|
137
210
|
if(typeof imgSrc === "string") {
|
138
211
|
return imgSrc
|
@@ -150,7 +223,7 @@ export default {
|
|
150
223
|
// else return large (will be used if images for small-and -medium-devices do not exist or if screen resolution is larger than mediumMaxWidth)
|
151
224
|
return imgSrc.large
|
152
225
|
},
|
153
|
-
|
226
|
+
textAlign() {
|
154
227
|
if (this.figcaption?.textAlign) {
|
155
228
|
return "text-" + this.figcaption.textAlign
|
156
229
|
}
|
@@ -167,7 +240,7 @@ export default {
|
|
167
240
|
},
|
168
241
|
editableFigcaptionText: {
|
169
242
|
get() {
|
170
|
-
return this.figcaptionText == null ? this.figcaption
|
243
|
+
return this.figcaptionText == null ? this.figcaption?.text : this.figcaptionText
|
171
244
|
},
|
172
245
|
set(value) {
|
173
246
|
this.figcaptionText = value
|
@@ -175,6 +248,36 @@ export default {
|
|
175
248
|
}
|
176
249
|
},
|
177
250
|
methods: {
|
251
|
+
itemProvider() {
|
252
|
+
const editModeConfig = this.editModeConfig?.itemProviderOverwrite?.()
|
253
|
+
return {
|
254
|
+
"image": {
|
255
|
+
"src": "/media/images/demo-images/medium/landscape-01.jpg",
|
256
|
+
"alt": "Alternative Text",
|
257
|
+
// add additional keys from editModeConfig
|
258
|
+
...editModeConfig?.image || {}
|
259
|
+
},
|
260
|
+
"figcaption": {
|
261
|
+
"text": "Figcaption DE",
|
262
|
+
"position": "bottom",
|
263
|
+
"textAlign": "center",
|
264
|
+
"show": true
|
265
|
+
}
|
266
|
+
}
|
267
|
+
},
|
268
|
+
onAddItem() {
|
269
|
+
// execute editComponent-function from editComponentWrapper to enter editMode directly on "add"
|
270
|
+
this.$refs.editComponentWrapper.editComponent()
|
271
|
+
},
|
272
|
+
selectFiles() {
|
273
|
+
let inputFile = this.$refs.formElement.getDomElement().querySelector("input[type='file']")
|
274
|
+
inputFile.click()
|
275
|
+
},
|
276
|
+
fileSelected(event) {
|
277
|
+
if (event.target.files.length > 0) {
|
278
|
+
checkAndUploadFile(event.target.files[0], this.allowedFileExtensions, this.minImageWidth, this.maxFileUploadSize, (imageSource) => this.newImageSource = imageSource)
|
279
|
+
}
|
280
|
+
},
|
178
281
|
updateWindowWidth() {
|
179
282
|
this.currentWindowWidth = window.innerWidth
|
180
283
|
},
|
@@ -182,10 +285,10 @@ export default {
|
|
182
285
|
return {
|
183
286
|
image: {...this.image},
|
184
287
|
figcaption: {
|
185
|
-
show: this.
|
186
|
-
position: this.
|
187
|
-
textAlign: this.
|
188
|
-
text: this.
|
288
|
+
show: this.showFigcaption,
|
289
|
+
position: this.figcaptionPosition,
|
290
|
+
textAlign: this.figcaptionTextAlign,
|
291
|
+
text: this.figcaptionText
|
189
292
|
}
|
190
293
|
}
|
191
294
|
},
|
@@ -238,7 +341,9 @@ export default {
|
|
238
341
|
})
|
239
342
|
},
|
240
343
|
updateHandlerProvider() {
|
241
|
-
const figcaptionText = this.
|
344
|
+
const figcaptionText = this.figcaptionText
|
345
|
+
this.figcaptionText = null // reset data-property
|
346
|
+
|
242
347
|
return updateHandlerProvider(this, {
|
243
348
|
update(props) {
|
244
349
|
if (!props.figcaption) {
|
@@ -248,6 +353,18 @@ export default {
|
|
248
353
|
}
|
249
354
|
})
|
250
355
|
}
|
356
|
+
},
|
357
|
+
watch: {
|
358
|
+
figcaption: {
|
359
|
+
handler() {
|
360
|
+
this.showFigcaption = this.figcaption?.show
|
361
|
+
this.figcaptionText = this.figcaption?.text
|
362
|
+
this.figcaptionPosition = this.figcaption?.position
|
363
|
+
this.figcaptionTextAlign = this.figcaption?.textAlign
|
364
|
+
},
|
365
|
+
immediate: true,
|
366
|
+
deep: true
|
367
|
+
}
|
251
368
|
}
|
252
369
|
}
|
253
370
|
</script>
|
@@ -296,9 +413,21 @@ export default {
|
|
296
413
|
opacity: 1;
|
297
414
|
transition: var(--default-transition);
|
298
415
|
}
|
416
|
+
|
417
|
+
&:not([src]) {
|
418
|
+
display: block;
|
419
|
+
width: 100%;
|
420
|
+
min-height: 30rem;
|
421
|
+
}
|
299
422
|
}
|
300
423
|
}
|
301
424
|
}
|
302
425
|
|
426
|
+
.edit-mode .edit-component-wrapper .cmd-image {
|
427
|
+
label.edit-mode input {
|
428
|
+
padding: calc(var(--default-padding) / 2);
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
303
432
|
/* end cmd-image ------------------------------------------------------------------------------------------ */
|
304
433
|
</style>
|