Skip to content

Commit

Permalink
fix(input-config): adds clear action for focused input ids (#489)
Browse files Browse the repository at this point in the history
Adds a clear action to set the focused input id and title to null. Adds this to the activemodule.vue
remove function to clear the input config panel when a focused module is removed

closes #482
  • Loading branch information
2xAA authored Dec 9, 2020
1 parent d81d7ac commit e745b58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/application/worker/store/modules/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const actions = {
commit("SET_FOCUSED_INPUT", { id, title, writeToSwap });
},

clearFocusedInput({ commit }) {
commit("SET_FOCUSED_INPUT", { id: null, title: null });
},

addInput({ commit }, { type, location, data, id = uuidv4(), writeToSwap }) {
const input = { type, location, data, id };
commit("ADD_INPUT", { input, writeToSwap });
Expand Down
4 changes: 3 additions & 1 deletion src/components/ActiveModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ export default {
return this.$modV.store.state.inputs.focusedInput.id === id;
},
removeModule(e) {
async removeModule(e) {
if (e.keyCode === 8 || e.keyCode === 46) {
this.$store.commit("ui-modules/SET_FOCUSED", null);
await this.$modV.store.dispatch("inputs/clearFocusedInput");
this.$emit("remove-module", this.id);
}
}
Expand Down

0 comments on commit e745b58

Please sign in to comment.