@mixd-id/web-scaffold 0.1.230406309 → 0.1.230406310
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/package.json +1 -1
- package/src/components/ImagePreview.vue +10 -7
- package/src/components/TreeView.vue +59 -20
- package/src/components/TreeViewItem.vue +102 -88
- package/src/utils/helpers.mjs +2 -1
- package/src/utils/wss.js +1 -6
- package/src/widgets/ArticleSetting.vue +31 -15
- package/src/widgets/ButtonSetting.vue +92 -21
- package/src/widgets/CarouselSetting.vue +140 -62
- package/src/widgets/ComponentSetting2.vue +3 -1
- package/src/widgets/FlexSetting.vue +168 -182
- package/src/widgets/GridSetting.vue +260 -97
- package/src/widgets/Header1Setting.vue +1 -1
- package/src/widgets/Header2.vue +32 -59
- package/src/widgets/Header2Setting.vue +210 -108
- package/src/widgets/ImageSetting.vue +110 -42
- package/src/widgets/MarginSetting.vue +35 -57
- package/src/widgets/PaddingSetting.vue +31 -53
- package/src/widgets/ParagraphSetting.vue +32 -7
- package/src/widgets/Share.vue +41 -11
- package/src/widgets/SvgSetting.vue +106 -82
- package/src/widgets/WebComponentSelector.vue +8 -24
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Modal :state="isOpen" width="400" height="400" :class="$style.previewModal">
|
|
3
|
-
<div class="flex-1 flex flex-col">
|
|
4
|
-
<div class="flex flex-row justify-end items-center p-3">
|
|
3
|
+
<div class="flex-1 flex flex-col gap-3">
|
|
4
|
+
<div class="flex flex-row gap-4 justify-end items-center p-3 pr-6">
|
|
5
|
+
<slot name="moreButtons"></slot>
|
|
5
6
|
<a v-if="download" :href="imageUrl" target="_blank" download>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<button
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M480 352h-133.5l-45.25 45.25C289.2 409.3 273.1 416 256 416s-33.16-6.656-45.25-18.75L165.5 352H32c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96C512 366.3 497.7 352 480 352zM432 456c-13.2 0-24-10.8-24-24c0-13.2 10.8-24 24-24s24 10.8 24 24C456 445.2 445.2 456 432 456zM233.4 374.6C239.6 380.9 247.8 384 256 384s16.38-3.125 22.62-9.375l128-128c12.49-12.5 12.49-32.75 0-45.25c-12.5-12.5-32.76-12.5-45.25 0L288 274.8V32c0-17.67-14.33-32-32-32C238.3 0 224 14.33 224 32v242.8L150.6 201.4c-12.49-12.5-32.75-12.5-45.25 0c-12.49 12.5-12.49 32.75 0 45.25L233.4 374.6z"/></svg>
|
|
8
|
+
</a>
|
|
9
|
+
<button @click="close">
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 320 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>
|
|
11
|
+
</button>
|
|
11
12
|
</div>
|
|
12
13
|
<div class="flex items-center justify-center">
|
|
13
14
|
<img :src="imageUrl" class="max-h-[75vh]"/>
|
|
@@ -27,6 +28,8 @@ export default{
|
|
|
27
28
|
default: false
|
|
28
29
|
},
|
|
29
30
|
|
|
31
|
+
|
|
32
|
+
|
|
30
33
|
},
|
|
31
34
|
|
|
32
35
|
data(){
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
|
-
<TreeViewItem v-for="(item, index) in
|
|
4
|
+
<TreeViewItem v-for="(item, index) in modelValue"
|
|
5
5
|
:item="item"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
:parent="modelValue"
|
|
7
|
+
:selected-item="selectedItem"
|
|
8
|
+
@moveup="moveUp(item)"
|
|
9
|
+
@movedown="moveDown(item)"
|
|
10
|
+
@change="$emit('change')"
|
|
11
|
+
@remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { modelValue.splice(index, 1);$emit('change') }})"
|
|
12
|
+
@add="(items) => $emit('add', items)">
|
|
13
|
+
<template #default="{ item, parent }">
|
|
14
|
+
<slot :item="item" :parent="parent"></slot>
|
|
14
15
|
</template>
|
|
15
16
|
</TreeViewItem>
|
|
16
17
|
|
|
@@ -26,29 +27,67 @@ export default{
|
|
|
26
27
|
|
|
27
28
|
components: {TreeViewItem},
|
|
28
29
|
|
|
29
|
-
emits: [ 'change' ],
|
|
30
|
+
emits: [ 'add', 'change', 'paste' ],
|
|
30
31
|
|
|
31
32
|
inject: [ 'confirm', 'toast' ],
|
|
32
33
|
|
|
33
34
|
props: {
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
modelValue: Array,
|
|
36
37
|
|
|
37
|
-
selectedItem: Object
|
|
38
|
+
selectedItem: Object
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
methods: {
|
|
43
|
+
|
|
44
|
+
copy(){
|
|
45
|
+
if(this.selectedItem){
|
|
46
|
+
copyToClipboard(JSON.stringify(this.selectedItem))
|
|
47
|
+
.then(() => this.toast('Copied to clipboard'))
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
paste(){
|
|
52
|
+
getClipboardData().then(text => {
|
|
53
|
+
try{
|
|
54
|
+
const item = JSON.parse(text)
|
|
55
|
+
this.$emit('paste', item)
|
|
56
|
+
}
|
|
57
|
+
catch(e){}
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
moveDown(item){
|
|
62
|
+
const idx = this.modelValue.indexOf(item)
|
|
63
|
+
if(idx < this.modelValue.length - 1){
|
|
64
|
+
this.modelValue.splice(idx + 1, 0, this.modelValue.splice(idx, 1)[0])
|
|
65
|
+
this.$emit('change')
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
moveUp(item){
|
|
70
|
+
const idx = this.modelValue.indexOf(item)
|
|
71
|
+
if(idx - 1 >= 0){
|
|
72
|
+
this.modelValue.splice(idx - 1, 0, this.modelValue.splice(idx, 1)[0])
|
|
73
|
+
this.$emit('change')
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
add(){
|
|
78
|
+
this.$emit('add', this.modelValue)
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
},
|
|
40
82
|
|
|
83
|
+
mounted() {
|
|
84
|
+
window.addEventListener('keydown', this.onKeyUp)
|
|
41
85
|
},
|
|
42
86
|
|
|
43
|
-
|
|
87
|
+
watch: {
|
|
44
88
|
|
|
45
|
-
parent(){
|
|
46
|
-
return {
|
|
47
|
-
items: this.items
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
89
|
|
|
51
|
-
}
|
|
90
|
+
}
|
|
52
91
|
|
|
53
92
|
}
|
|
54
93
|
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div @mousemove="hoverMouseOver"
|
|
3
|
+
@mouseout="hoverMouseOut">
|
|
3
4
|
<div ref="item"
|
|
4
5
|
:class="itemClass"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<button type="button" class="pr-2"
|
|
14
|
-
v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
|
|
15
|
-
@click="childCollapsed = !childCollapsed">
|
|
16
|
-
<svg v-if="!childCollapsed" width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
|
|
17
|
-
<svg v-else width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"/></svg>
|
|
18
|
-
</button>
|
|
6
|
+
@mousedown="mouseDown">
|
|
7
|
+
|
|
8
|
+
<button type="button" class="p-1 w-[18px]"
|
|
9
|
+
v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
|
|
10
|
+
@click="childCollapsed = !childCollapsed">
|
|
11
|
+
<svg v-if="!childCollapsed" width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
|
|
12
|
+
<svg v-else width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"/></svg>
|
|
13
|
+
</button>
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
<div class="flex-1 flex px-3">
|
|
16
|
+
<slot :item="item" :parent="parent"></slot>
|
|
21
17
|
</div>
|
|
22
18
|
|
|
23
|
-
<div class="
|
|
19
|
+
<div class="flex flex-row items-center">
|
|
24
20
|
<button v-if="item && Array.isArray(item.items)"
|
|
25
21
|
type="button"
|
|
26
22
|
class="p-1"
|
|
@@ -37,17 +33,20 @@
|
|
|
37
33
|
|
|
38
34
|
</div>
|
|
39
35
|
<div ref="container"
|
|
40
|
-
v-show="item && Array.isArray(item.items) && !childCollapsed" class="ml-6"
|
|
36
|
+
v-show="item && Array.isArray(item.items) && !childCollapsed" class="ml-6"
|
|
37
|
+
@mousemove.stop=""
|
|
38
|
+
@mouseout.stop="">
|
|
41
39
|
<TreeViewItem v-for="(subItem, index) in item.items"
|
|
42
40
|
:item="subItem"
|
|
43
|
-
:
|
|
44
|
-
:parent="item"
|
|
45
|
-
:index="index"
|
|
46
|
-
:depth="depth + 1"
|
|
41
|
+
:parent="item.items"
|
|
47
42
|
:selected-item="selectedItem"
|
|
43
|
+
@moveup="moveUp(subItem)"
|
|
44
|
+
@movedown="moveDown(subItem)"
|
|
45
|
+
@remove="confirm({ title:$t('Remove this item?'), onConfirm: () => { item.items.splice(index, 1);$emit('change') }})"
|
|
46
|
+
@add="(items) => $emit('add', items)"
|
|
48
47
|
@change="$emit('change')">
|
|
49
|
-
<template #default="{ item
|
|
50
|
-
<slot :item="item"
|
|
48
|
+
<template #default="{ item }">
|
|
49
|
+
<slot :item="item"></slot>
|
|
51
50
|
</template>
|
|
52
51
|
</TreeViewItem>
|
|
53
52
|
</div>
|
|
@@ -63,17 +62,17 @@ export default{
|
|
|
63
62
|
|
|
64
63
|
name: 'TreeViewItem',
|
|
65
64
|
|
|
66
|
-
emits: [ 'change' ],
|
|
65
|
+
emits: [ 'add', 'change', 'moveup', 'movedown', 'remove' ],
|
|
67
66
|
|
|
68
|
-
inject: [ 'confirm', 'toast' ],
|
|
67
|
+
inject: [ 'confirm', 'toast', 'store', 'getConfig' ],
|
|
69
68
|
|
|
70
69
|
props: {
|
|
71
|
-
config: Object,
|
|
72
70
|
item: Object,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
|
|
72
|
+
parent: Array,
|
|
73
|
+
|
|
76
74
|
selectedItem: Object,
|
|
75
|
+
|
|
77
76
|
state: {
|
|
78
77
|
type: [ Number, String ],
|
|
79
78
|
default: 1
|
|
@@ -82,6 +81,27 @@ export default{
|
|
|
82
81
|
|
|
83
82
|
methods: {
|
|
84
83
|
|
|
84
|
+
moveDown(item){
|
|
85
|
+
const idx = this.item.items.indexOf(item)
|
|
86
|
+
if(idx < this.item.items.length - 1){
|
|
87
|
+
this.item.items.splice(idx + 1, 0, this.item.items.splice(idx, 1)[0])
|
|
88
|
+
this.$emit('change')
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
moveUp(item){
|
|
93
|
+
const idx = this.item.items.indexOf(item)
|
|
94
|
+
if(idx - 1 >= 0){
|
|
95
|
+
this.item.items.splice(idx - 1, 0, this.item.items.splice(idx, 1)[0])
|
|
96
|
+
this.$emit('change')
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
add(){
|
|
101
|
+
this.$emit('add', this.item.items)
|
|
102
|
+
this.childCollapsed = false
|
|
103
|
+
},
|
|
104
|
+
|
|
85
105
|
mouseDown(e){
|
|
86
106
|
if(!this.$el || this.$el.nodeType !== 1) return
|
|
87
107
|
|
|
@@ -99,8 +119,9 @@ export default{
|
|
|
99
119
|
|
|
100
120
|
const mouseMove = (e) => {
|
|
101
121
|
const distanceX = e.clientX - startX
|
|
122
|
+
const distanceY = e.clientY - startY
|
|
102
123
|
|
|
103
|
-
if(!dragged.cloned){
|
|
124
|
+
if(!dragged.cloned && Math.abs(distanceY) > 10){
|
|
104
125
|
const cloned = this.$el.cloneNode(true)
|
|
105
126
|
cloned.style.position = 'absolute'
|
|
106
127
|
cloned.style.left = rect.x + "px"
|
|
@@ -129,62 +150,56 @@ export default{
|
|
|
129
150
|
window.removeEventListener('mousemove', mouseMove)
|
|
130
151
|
window.removeEventListener('mouseup', mouseUp)
|
|
131
152
|
|
|
132
|
-
|
|
153
|
+
if(dragged && dragged.parent && dragged.targetParent){
|
|
154
|
+
|
|
155
|
+
const targetIdx = dragged.targetParent.indexOf(dragged.target)
|
|
156
|
+
const moveDirection = e.clientY < dragged.startY ? -1 : 1
|
|
157
|
+
const sameParent = dragged.parent === dragged.targetParent
|
|
133
158
|
|
|
134
|
-
|
|
159
|
+
let destIdx = undefined
|
|
135
160
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
161
|
+
if(dragged.dragArea === 1){
|
|
162
|
+
if(sameParent){
|
|
163
|
+
if(moveDirection === -1){
|
|
164
|
+
destIdx = targetIdx
|
|
165
|
+
}
|
|
166
|
+
else{
|
|
167
|
+
destIdx = targetIdx - 1
|
|
168
|
+
}
|
|
139
169
|
}
|
|
140
170
|
else{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if(sameParent){
|
|
149
|
-
if(moveDirection === -1){
|
|
150
|
-
destIdx = targetIdx
|
|
151
|
-
}
|
|
152
|
-
else{
|
|
153
|
-
destIdx = targetIdx - 1
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else{
|
|
157
|
-
destIdx = targetIdx
|
|
158
|
-
}
|
|
171
|
+
destIdx = targetIdx
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if(dragged.dragArea === 2){
|
|
175
|
+
if(sameParent){
|
|
176
|
+
if(moveDirection === -1){
|
|
177
|
+
destIdx = targetIdx + 1
|
|
159
178
|
}
|
|
160
|
-
else
|
|
161
|
-
|
|
162
|
-
if(moveDirection === -1){
|
|
163
|
-
destIdx = targetIdx + 1
|
|
164
|
-
}
|
|
165
|
-
else{
|
|
166
|
-
destIdx = targetIdx
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else{
|
|
170
|
-
if(moveDirection === -1){
|
|
171
|
-
destIdx = targetIdx + 1
|
|
172
|
-
}
|
|
173
|
-
else{
|
|
174
|
-
destIdx = targetIdx + 1
|
|
175
|
-
}
|
|
176
|
-
}
|
|
179
|
+
else{
|
|
180
|
+
destIdx = targetIdx
|
|
177
181
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
}
|
|
183
|
+
else{
|
|
184
|
+
if(moveDirection === -1){
|
|
185
|
+
destIdx = targetIdx + 1
|
|
186
|
+
}
|
|
187
|
+
else{
|
|
188
|
+
destIdx = targetIdx + 1
|
|
183
189
|
}
|
|
184
190
|
}
|
|
191
|
+
}
|
|
185
192
|
|
|
193
|
+
if(destIdx !== undefined){
|
|
194
|
+
dragged.targetParent.splice(destIdx, 0,
|
|
195
|
+
dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
|
|
196
|
+
this.$emit('change')
|
|
186
197
|
}
|
|
187
|
-
|
|
198
|
+
else if(dragged.dragArea === 3){
|
|
199
|
+
dragged.targetParent.push(dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
|
|
200
|
+
this.$emit('change')
|
|
201
|
+
}
|
|
202
|
+
}
|
|
188
203
|
|
|
189
204
|
if(guide1 && guide1.parentNode){
|
|
190
205
|
guide1.parentNode.removeChild(guide1)
|
|
@@ -284,14 +299,11 @@ export default{
|
|
|
284
299
|
computed: {
|
|
285
300
|
|
|
286
301
|
componentStore(){
|
|
287
|
-
if(this.
|
|
288
|
-
if(!this.
|
|
289
|
-
this.
|
|
302
|
+
if(this.store && this.store.components){
|
|
303
|
+
if(!this.store.components.treeviewitem)
|
|
304
|
+
this.store.components.treeviewitem = {}
|
|
290
305
|
|
|
291
|
-
|
|
292
|
-
this.config.components.treeviewitem = {}
|
|
293
|
-
|
|
294
|
-
return this.config.components.treeviewitem
|
|
306
|
+
return this.store.components.treeviewitem
|
|
295
307
|
}
|
|
296
308
|
},
|
|
297
309
|
|
|
@@ -313,12 +325,15 @@ export default{
|
|
|
313
325
|
|
|
314
326
|
data(){
|
|
315
327
|
return {
|
|
316
|
-
childCollapsed: true
|
|
328
|
+
childCollapsed: true,
|
|
329
|
+
hvm: null
|
|
317
330
|
}
|
|
318
331
|
},
|
|
319
332
|
|
|
320
333
|
mounted() {
|
|
321
|
-
this.
|
|
334
|
+
if(this.componentStore){
|
|
335
|
+
this.childCollapsed = this.componentStore[this.item.uid] ?? this.childCollapsed
|
|
336
|
+
}
|
|
322
337
|
},
|
|
323
338
|
|
|
324
339
|
watch: {
|
|
@@ -333,7 +348,6 @@ export default{
|
|
|
333
348
|
},
|
|
334
349
|
|
|
335
350
|
childCollapsed(to){
|
|
336
|
-
|
|
337
351
|
if(this.item.uid && this.componentStore){
|
|
338
352
|
this.componentStore[this.item.uid] = to
|
|
339
353
|
}
|
|
@@ -400,7 +414,7 @@ export default{
|
|
|
400
414
|
}
|
|
401
415
|
|
|
402
416
|
.guide{
|
|
403
|
-
@apply h-[
|
|
417
|
+
@apply h-[1px] bg-primary rounded-lg;
|
|
404
418
|
}
|
|
405
419
|
|
|
406
420
|
.item.dragInto{
|
package/src/utils/helpers.mjs
CHANGED
package/src/utils/wss.js
CHANGED
|
@@ -97,12 +97,7 @@ class WSS extends EventEmitter2{
|
|
|
97
97
|
this._opt = opt
|
|
98
98
|
this._instance = new WebSocket.Server(opt);
|
|
99
99
|
|
|
100
|
-
this._client = redis.createClient(
|
|
101
|
-
socket: {
|
|
102
|
-
host: process.env.REDIS_HOST ?? '127.0.0.1',
|
|
103
|
-
port: process.env.REDIS_PORT ?? 6379
|
|
104
|
-
}
|
|
105
|
-
})
|
|
100
|
+
this._client = redis.createClient()
|
|
106
101
|
this._client.connect().then()
|
|
107
102
|
|
|
108
103
|
this._instance.on('connection', async (socket, req) => {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
3
|
|
|
4
4
|
<div class="flex flex-col gap-4" v-if="viewType === ''">
|
|
5
|
+
<div>
|
|
6
|
+
<strong class="flex-1 text-text-400">Article</strong>
|
|
7
|
+
<div class="h-[1px] bg-text-100 mt-2"></div>
|
|
8
|
+
</div>
|
|
5
9
|
|
|
6
10
|
<div class="overflow-x-auto">
|
|
7
11
|
<label class="text-text-400">Action</label>
|
|
@@ -236,6 +240,12 @@
|
|
|
236
240
|
|
|
237
241
|
</div>
|
|
238
242
|
|
|
243
|
+
<ComponentSetting2 :item="item"
|
|
244
|
+
:view-type="viewType"
|
|
245
|
+
:view-types="viewTypes"
|
|
246
|
+
defaultDisplay="block"
|
|
247
|
+
@change="$emit('change')" />
|
|
248
|
+
|
|
239
249
|
</div>
|
|
240
250
|
</template>
|
|
241
251
|
|
|
@@ -247,9 +257,9 @@ import axios from "axios";
|
|
|
247
257
|
|
|
248
258
|
export default{
|
|
249
259
|
|
|
250
|
-
emits: [ 'change' ],
|
|
260
|
+
emits: [ 'change', 'postMessageToIframe' ],
|
|
251
261
|
|
|
252
|
-
inject: [ 'alert', '
|
|
262
|
+
inject: [ 'alert', 'postIframe' ],
|
|
253
263
|
|
|
254
264
|
props: {
|
|
255
265
|
|
|
@@ -258,7 +268,9 @@ export default{
|
|
|
258
268
|
required: true
|
|
259
269
|
},
|
|
260
270
|
|
|
261
|
-
|
|
271
|
+
viewType: String,
|
|
272
|
+
|
|
273
|
+
viewTypes: Array,
|
|
262
274
|
|
|
263
275
|
},
|
|
264
276
|
|
|
@@ -329,7 +341,7 @@ export default{
|
|
|
329
341
|
case 'bold':
|
|
330
342
|
case 'italic':
|
|
331
343
|
default:
|
|
332
|
-
this
|
|
344
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'format', type, value })
|
|
333
345
|
break
|
|
334
346
|
|
|
335
347
|
}
|
|
@@ -370,27 +382,27 @@ export default{
|
|
|
370
382
|
},
|
|
371
383
|
|
|
372
384
|
insertTable(){
|
|
373
|
-
|
|
385
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'insertTable' })
|
|
374
386
|
},
|
|
375
387
|
|
|
376
388
|
removeFormat(){
|
|
377
|
-
this
|
|
389
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'removeFormat' })
|
|
378
390
|
},
|
|
379
391
|
|
|
380
392
|
addTableColumn(){
|
|
381
|
-
this
|
|
393
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'addTableColumn' })
|
|
382
394
|
},
|
|
383
395
|
|
|
384
396
|
addTableRow(){
|
|
385
|
-
this
|
|
397
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'addTableRow' })
|
|
386
398
|
},
|
|
387
399
|
|
|
388
400
|
removeTableColumn(){
|
|
389
|
-
this
|
|
401
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'removeTableColumn' })
|
|
390
402
|
},
|
|
391
403
|
|
|
392
404
|
removeTableRow(){
|
|
393
|
-
this
|
|
405
|
+
this.$emit('postMessageToIframe', this.item.uid, { action:'removeTableRow' })
|
|
394
406
|
},
|
|
395
407
|
|
|
396
408
|
setSubAction(subAction){
|
|
@@ -436,10 +448,6 @@ export default{
|
|
|
436
448
|
return this.item.props.textColor
|
|
437
449
|
},
|
|
438
450
|
|
|
439
|
-
viewType(){
|
|
440
|
-
return this.config.viewType
|
|
441
|
-
},
|
|
442
|
-
|
|
443
451
|
},
|
|
444
452
|
|
|
445
453
|
data(){
|
|
@@ -451,3 +459,11 @@ export default{
|
|
|
451
459
|
}
|
|
452
460
|
|
|
453
461
|
</script>
|
|
462
|
+
|
|
463
|
+
<style module>
|
|
464
|
+
|
|
465
|
+
.comp{
|
|
466
|
+
@apply flex flex-col gap-6;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
</style>
|