Skip to content

Commit e6fbbef

Browse files
committed
committing full edit functionality
1 parent cb5b453 commit e6fbbef

File tree

5 files changed

+36
-20
lines changed

5 files changed

+36
-20
lines changed

src/components/CodeSnippet.vue

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Description:
66

77
<template>
88
<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>
1111
<prism-editor
1212
v-model="code"
1313
language="js"
@@ -172,19 +172,32 @@ export default {
172172
window.removeEventListener('resize', this.getWindowHeight)
173173
},
174174
watch: {
175-
// If HTML elements or components are added, rerenders Code Snippet
176-
componentMap: {
177-
deep: true,
175+
176+
activeComponent: {
178177
handler () {
179-
// console.log('component Map has changed');
178+
console.log('component Map has changed')
180179
if (this.componentMap[this.activeComponent]) {
180+
console.log('we made it here')
181181
this.code = `${this.createCodeSnippet(
182182
this.activeComponent,
183183
this.componentMap[this.activeComponent].children
184184
)}`
185185
}
186186
}
187187
}
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+
}
188201
}
189202
}
190203
</script>

src/components/ComponentDisplay.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export default {
378378
}
379379
},
380380
watch: {
381-
activeComponent: function(){
381+
activeComponent: function () {
382382
this.onActivated(this.activeComponentObj)
383383
}
384384
}
@@ -466,4 +466,4 @@ export default {
466466
#counter {
467467
margin-top: 20px;
468468
}
469-
</style>
469+
</style>

src/components/HomeSideDropDownItems/ComponentList.vue

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export default {
6464
// console.log('component', component)
6565
return component
6666
},
67-
activeComponentData() {
67+
activeComponentData () {
6868
return this.activeComponentObj
6969
// set(name){
70-
// this.editComponentName(name)
70+
// this.editComponentName(name)
7171
// }
7272
},
7373
options () {
@@ -111,13 +111,9 @@ export default {
111111
this.setActiveComponent('')
112112
}
113113
},
114-
editCompName(name){
114+
editCompName (name) {
115115
if (name) this.editComponentName(name)
116116
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)
121117
}
122118
},
123119
watch: {

src/components/HomeSideDropDownItems/VuexForm.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Description:
3131
<template>
3232
<div id="action-select">
3333
<multiselect
34-
v-on:keyup.delete.stop
3534
v-model="selectAction"
3635
class="multiselect"
3736
placeholder="Select Action"
@@ -42,6 +41,7 @@ Description:
4241
open-direction="top"
4342
:options="actionOptions"
4443
:searchable="true"
44+
@search-change="stopDelete($event)"
4545
>
4646
<span slot="noResult">No actions found.</span>
4747
</multiselect>
@@ -87,7 +87,7 @@ Description:
8787
open-direction="top"
8888
:options="stateOptions"
8989
:searchable="true"
90-
v-on:keyup.delete.stop
90+
@search-change="stopDelete($event)"
9191
>
9292
<span slot="noResult">No state found.</span>
9393
</multiselect>
@@ -133,7 +133,7 @@ Description:
133133
open-direction="top"
134134
:options="propsOptions"
135135
:searchable="true"
136-
v-on:keyup.delete.stop
136+
@search-change="stopDelete($event)"
137137
>
138138
<span slot="noResult">No props found.</span>
139139
</multiselect>
@@ -231,6 +231,12 @@ export default {
231231
'addPropsToComponent'
232232
]),
233233
234+
// Prevent Delete on changes to seafrchable multiselect
235+
stopDelete (e) {
236+
if (e.code === 'Backspace') e.stopPropogation()
237+
console.log(e)
238+
},
239+
234240
// 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
235241
createNewAction (text) {
236242
if (!this.userActions.includes(text) && text) {

src/store/mutations.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ const mutations = {
177177
})[0])
178178
active.componentName = payload
179179
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
182183
},
183184

184185
// *** HTML ELEMENTS *** //////////////////////////////////////////////

0 commit comments

Comments
 (0)