File tree Expand file tree Collapse file tree 5 files changed +36
-20
lines changed Expand file tree Collapse file tree 5 files changed +36
-20
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ Description:
6
6
7
7
<template >
8
8
<div class =" codesnippet-container" >
9
- <div class =" top-p" v-if =" activeComponent === ''" >Select a component</div >
10
- <div v-else >{{ `${activeComponent}.vue` }}</div >
9
+ <div class =" top-p" v-if =" this. activeComponent === ''" >Select a component</div >
10
+ <div v-else >{{ `${this. activeComponent}.vue` }}</div >
11
11
<prism-editor
12
12
v-model =" code"
13
13
language =" js"
@@ -172,19 +172,32 @@ export default {
172
172
window .removeEventListener (' resize' , this .getWindowHeight )
173
173
},
174
174
watch: {
175
- // If HTML elements or components are added, rerenders Code Snippet
176
- componentMap: {
177
- deep: true ,
175
+
176
+ activeComponent: {
178
177
handler () {
179
- // console.log('component Map has changed');
178
+ console .log (' component Map has changed' )
180
179
if (this .componentMap [this .activeComponent ]) {
180
+ console .log (' we made it here' )
181
181
this .code = ` ${ this .createCodeSnippet (
182
182
this .activeComponent ,
183
183
this .componentMap [this .activeComponent ].children
184
184
)} `
185
185
}
186
186
}
187
187
}
188
+ },
189
+ // If HTML elements or components are added, rerenders Code Snippet
190
+ componentMap: {
191
+ deep: true ,
192
+ handler () {
193
+ // console.log('component Map has changed');
194
+ if (this .componentMap [this .activeComponent ]) {
195
+ this .code = ` ${ this .createCodeSnippet (
196
+ this .activeComponent ,
197
+ this .componentMap [this .activeComponent ].children
198
+ )} `
199
+ }
200
+ }
188
201
}
189
202
}
190
203
</script >
Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ export default {
378
378
}
379
379
},
380
380
watch: {
381
- activeComponent : function () {
381
+ activeComponent : function () {
382
382
this .onActivated (this .activeComponentObj )
383
383
}
384
384
}
@@ -466,4 +466,4 @@ export default {
466
466
#counter {
467
467
margin-top : 20px ;
468
468
}
469
- </style >
469
+ </style >
Original file line number Diff line number Diff line change @@ -64,10 +64,10 @@ export default {
64
64
// console.log('component', component)
65
65
return component
66
66
},
67
- activeComponentData () {
67
+ activeComponentData () {
68
68
return this .activeComponentObj
69
69
// set(name){
70
- // this.editComponentName(name)
70
+ // this.editComponentName(name)
71
71
// }
72
72
},
73
73
options () {
@@ -111,13 +111,9 @@ export default {
111
111
this .setActiveComponent (' ' )
112
112
}
113
113
},
114
- editCompName (name ){
114
+ editCompName (name ) {
115
115
if (name) this .editComponentName (name)
116
116
this .setActiveComponent (this .activeComponent )
117
- // console.log(this.routes[this.activeRoute])
118
- // console.log(this.activeComponentObj)
119
- // console.log(this.activeComponent)
120
- console .log (this .$refs .boxes )
121
117
}
122
118
},
123
119
watch: {
Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ Description:
31
31
<template >
32
32
<div id =" action-select" >
33
33
<multiselect
34
- v-on:keyup.delete.stop
35
34
v-model =" selectAction"
36
35
class =" multiselect"
37
36
placeholder =" Select Action"
@@ -42,6 +41,7 @@ Description:
42
41
open-direction =" top"
43
42
:options =" actionOptions"
44
43
:searchable =" true"
44
+ @search-change =" stopDelete($event)"
45
45
>
46
46
<span slot =" noResult" >No actions found.</span >
47
47
</multiselect >
@@ -87,7 +87,7 @@ Description:
87
87
open-direction =" top"
88
88
:options =" stateOptions"
89
89
:searchable =" true"
90
- v-on:keyup.delete.stop
90
+ @search-change = " stopDelete($event) "
91
91
>
92
92
<span slot =" noResult" >No state found.</span >
93
93
</multiselect >
@@ -133,7 +133,7 @@ Description:
133
133
open-direction =" top"
134
134
:options =" propsOptions"
135
135
:searchable =" true"
136
- v-on:keyup.delete.stop
136
+ @search-change = " stopDelete($event) "
137
137
>
138
138
<span slot =" noResult" >No props found.</span >
139
139
</multiselect >
@@ -231,6 +231,12 @@ export default {
231
231
' addPropsToComponent'
232
232
]),
233
233
234
+ // Prevent Delete on changes to seafrchable multiselect
235
+ stopDelete (e ) {
236
+ if (e .code === ' Backspace' ) e .stopPropogation ()
237
+ console .log (e)
238
+ },
239
+
234
240
// Create's a new action that will be stored in the userActions array within store, and it will be added to the action drop-down menu
235
241
createNewAction (text ) {
236
242
if (! this .userActions .includes (text) && text) {
Original file line number Diff line number Diff line change @@ -177,8 +177,9 @@ const mutations = {
177
177
} ) [ 0 ] )
178
178
active . componentName = payload
179
179
state . activeComponentObj = Object . assign ( { } ,
180
- state . activeComponentObj , { componentName : payload } )
181
- state . activeComponent = payload ;
180
+ state . activeComponentObj , { componentName : payload } )
181
+ state . activeComponent = payload
182
+ state . componentMap [ state . activeComponent ] = state . activeComponentObj
182
183
} ,
183
184
184
185
// *** HTML ELEMENTS *** //////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments