@mixd-id/web-scaffold 0.1.230406309 → 0.1.230406311

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406309",
4
+ "version": "0.1.230406311",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -210,14 +210,14 @@ export default{
210
210
  }
211
211
 
212
212
  .button-secondary{
213
- @apply bg-primary-100 border-primary-100 text-primary-700 rounded-lg text-text;
214
- border: solid 1px rgb(var(--primary-100));
213
+ @apply bg-secondary-500 border-secondary-500 text-primary-700 rounded-lg text-white;
214
+ border: solid 1px rgb(var(--secondary-500));
215
215
  }
216
216
  .button-secondary:hover{
217
- @apply bg-primary-200 border-primary-200;
217
+ @apply bg-secondary-600 border-secondary-600;
218
218
  }
219
219
  .button-secondary:disabled{
220
- @apply bg-primary-100 top-0 left-0 cursor-not-allowed;
220
+ @apply bg-secondary-400 border-secondary-400 cursor-not-allowed;
221
221
  }
222
222
  .button-secondary *{
223
223
  @apply text-text-500 fill-white;
@@ -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
- <svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="fill-text"><path class="primary" d="M15 15v-3a3 3 0 0 0-6 0v3H6a4 4 0 0 1-.99-7.88 5.5 5.5 0 0 1 10.86-.82A4.49 4.49 0 0 1 22 10.5a4.5 4.5 0 0 1-4.5 4.5H15z"/><path class="secondary" d="M11 18.59V12a1 1 0 0 1 2 0v6.59l1.3-1.3a1 1 0 0 1 1.4 1.42l-3 3a1 1 0 0 1-1.4 0l-3-3a1 1 0 0 1 1.4-1.42l1.3 1.3z"/></svg>
7
- </a>
8
- <button class="ml-3" @click="close">
9
- <svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 24 24" class="fill-text"><path class="secondary" fill-rule="evenodd" d="M15.78 14.36a1 1 0 0 1-1.42 1.42l-2.82-2.83-2.83 2.83a1 1 0 1 1-1.42-1.42l2.83-2.82L7.3 8.7a1 1 0 0 1 1.42-1.42l2.83 2.83 2.82-2.83a1 1 0 0 1 1.42 1.42l-2.83 2.83 2.83 2.82z"/></svg>
10
- </button>
7
+ <svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" class="fill-text" 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" class="fill-text" 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(){
@@ -117,6 +117,10 @@ export default{
117
117
 
118
118
  methods:{
119
119
 
120
+ focus(){
121
+ this.$refs.input.focus()
122
+ },
123
+
120
124
  select(){
121
125
  this.$refs.input.select()
122
126
  },
@@ -1,16 +1,17 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
 
4
- <TreeViewItem v-for="(item, index) in items"
4
+ <TreeViewItem v-for="(item, index) in modelValue"
5
5
  :item="item"
6
- :selectedItem="selectedItem"
7
- :index="index"
8
- :parent="parent"
9
- :config="config"
10
- :depth="0"
11
- @change="$emit('change')">
12
- <template #default="{ item, parent, index, depth }">
13
- <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
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
- items: Array,
36
+ modelValue: Array,
36
37
 
37
- selectedItem: Object,
38
+ selectedItem: Object
38
39
 
39
- config: Object,
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
- computed: {
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
- @mousemove="hoverMouseOver"
6
- @mouseout="hoverMouseOut">
7
-
8
- <div class="flex-1 flex flex-row items-center px-2">
9
- <div @mousedown="mouseDown" class="pr-3">
10
- <svg width="11" height="11" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
11
- </div>
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
- <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
15
+ <div class="flex-1 flex px-3">
16
+ <slot :item="item" :parent="parent"></slot>
21
17
  </div>
22
18
 
23
- <div class="hidden flex flex-row items-center">
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
- :config="config"
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, parent, index, depth }">
50
- <slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
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
- parent: Object,
74
- index: Number,
75
- depth: Number,
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
- if(dragged){
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
- if(dragged.parent && dragged.targetParent){
159
+ let destIdx = undefined
135
160
 
136
- if(dragged.dragArea === 3){
137
- dragged.target.items.push(dragged.parent.items.splice(dragged.parent.items.indexOf(dragged.item), 1)[0])
138
- this.$emit('change')
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
- const targetIdx = dragged.targetParent.items.indexOf(dragged.target)
142
- const moveDirection = e.clientY < dragged.startY ? -1 : 1
143
- const sameParent = dragged.parent === dragged.targetParent
144
-
145
- let destIdx = undefined
146
-
147
- if(dragged.dragArea === 1){
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 if(dragged.dragArea === 2){
161
- if(sameParent){
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
- if(destIdx !== undefined){
180
- dragged.targetParent.items.splice(destIdx, 0,
181
- dragged.parent.items.splice(dragged.parent.items.indexOf(dragged.item), 1)[0])
182
- this.$emit('change')
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.config){
288
- if(!this.config.components)
289
- this.config.components = {}
302
+ if(this.store && this.store.components){
303
+ if(!this.store.components.treeviewitem)
304
+ this.store.components.treeviewitem = {}
290
305
 
291
- if(!this.config.components.treeviewitem)
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.childCollapsed = this.componentStore ? this.componentStore[this.item.uid] : this.childCollapsed
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-[2px] bg-primary rounded-lg;
417
+ @apply h-[1px] bg-primary rounded-lg;
404
418
  }
405
419
 
406
420
  .item.dragInto{
@@ -140,11 +140,11 @@ const strSlug = (title, separator) => {
140
140
  return title.replace(new RegExp('^[' + separator + '\\s]+|[' + separator + '\\s]+$', 'g'),'');
141
141
  }
142
142
 
143
- const strVars = (text, vars) => {
143
+ const strVars = (text, vars, opt = { emptyUndefined:true }) => {
144
144
 
145
145
  (text.match(/\{.*?(?=\})\}/gi) ?? []).forEach((match) => {
146
146
  const key = match.substring(1, match.length - 1)
147
- const value = vars[key] ?? ''
147
+ const value = vars[key] ?? (opt?.emptyUndefined ? '' : `{${key}}`)
148
148
  text = text.replace(match, value)
149
149
  })
150
150
 
@@ -84,11 +84,11 @@ const parseBoolean = function(exp){
84
84
  exp.toLowerCase() : exp)
85
85
  }
86
86
 
87
- const strVars = function(text, vars){
87
+ const strVars = function(text, vars, opt = { emptyUndefined:true }){
88
88
 
89
89
  (text.match(/\{.*?(?=\})\}/gi) ?? []).forEach((match) => {
90
90
  const key = match.substring(1, match.length - 1)
91
- const value = vars[key] ?? ''
91
+ const value = vars[key] ?? (opt?.emptyUndefined ? '' : `{${key}}`)
92
92
  text = text.replace(match, value)
93
93
  })
94
94
 
@@ -381,7 +381,8 @@ export {
381
381
  removeStyleFromTag,
382
382
  createFormData,
383
383
  unslugAndCapitalize,
384
- applyDatasourceReplacer
384
+ applyDatasourceReplacer,
385
+ strVars
385
386
  }
386
387
 
387
388
  function observeInit(){
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', 'viewTypes', 'postIframe', 'onPostMessageToIframe' ],
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
- config: Object,
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.onPostMessageToIframe(this.item.uid, { action:'format', type, value })
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
- this.onPostMessageToIframe(this.item.uid, { action:'insertTable' })
385
+ this.$emit('postMessageToIframe', this.item.uid, { action:'insertTable' })
374
386
  },
375
387
 
376
388
  removeFormat(){
377
- this.onPostMessageToIframe(this.item.uid, { action:'removeFormat' })
389
+ this.$emit('postMessageToIframe', this.item.uid, { action:'removeFormat' })
378
390
  },
379
391
 
380
392
  addTableColumn(){
381
- this.onPostMessageToIframe(this.item.uid, { action:'addTableColumn' })
393
+ this.$emit('postMessageToIframe', this.item.uid, { action:'addTableColumn' })
382
394
  },
383
395
 
384
396
  addTableRow(){
385
- this.onPostMessageToIframe(this.item.uid, { action:'addTableRow' })
397
+ this.$emit('postMessageToIframe', this.item.uid, { action:'addTableRow' })
386
398
  },
387
399
 
388
400
  removeTableColumn(){
389
- this.onPostMessageToIframe(this.item.uid, { action:'removeTableColumn' })
401
+ this.$emit('postMessageToIframe', this.item.uid, { action:'removeTableColumn' })
390
402
  },
391
403
 
392
404
  removeTableRow(){
393
- this.onPostMessageToIframe(this.item.uid, { action:'removeTableRow' })
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>