From e535bff56dcba4763f797e4ec7d17189ecf62828 Mon Sep 17 00:00:00 2001 From: Joakim Lundborg Date: Wed, 20 Nov 2024 23:32:21 +0100 Subject: [PATCH] Preserve macros defined in keyboard JSON --- src/components/ControllerBottom.vue | 7 +++++++ src/store/modules/app/mutations.js | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/components/ControllerBottom.vue b/src/components/ControllerBottom.vue index 5f4efbc0f6..eb1e2d7c98 100644 --- a/src/components/ControllerBottom.vue +++ b/src/components/ControllerBottom.vue @@ -164,6 +164,7 @@ export default { 'firmwareSourceURL', 'keymapSourceURL', 'author', + 'macros', 'notes', 'electron' ]), @@ -209,6 +210,7 @@ export default { 'setKeymapName', 'setLayout', 'setNotes', + 'setMacros', 'startListening', 'stopListening' ]), @@ -258,6 +260,7 @@ export default { const { keymap } = this.templates; let data = Object.assign(keymap, { keyboard: this.keyboard, + macros: this.macros, keymap: this.exportKeymapName, layout: this.layout, layers: layers, @@ -367,6 +370,10 @@ export default { this.setNotes(notes); } + if (!isUndefined(data.macros)) { + this.setMacros(data.macros); + } + // remap old json files to new mappings if they need it data = Object.assign( data, diff --git a/src/store/modules/app/mutations.js b/src/store/modules/app/mutations.js index d670d6abd2..9955a4c00d 100644 --- a/src/store/modules/app/mutations.js +++ b/src/store/modules/app/mutations.js @@ -177,6 +177,9 @@ const mutations = { setNotes(state, newNotes) { state.notes = newNotes; }, + setMacros(state, newMacros) { + state.macros = newMacros; + }, toggleTutorial(state) { state.tutorialEnabled = !state.tutorialEnabled; },