Skip to content

Commit

Permalink
Preserve macros defined in keyboard JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
cortex committed Nov 20, 2024
1 parent cf968a0 commit 4a19923
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/ControllerBottom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export default {
'firmwareSourceURL',
'keymapSourceURL',
'author',
'macros',
'notes',
'electron'
]),
Expand Down Expand Up @@ -209,6 +210,7 @@ export default {
'setKeymapName',
'setLayout',
'setNotes',
'setMacros',
'startListening',
'stopListening'
]),
Expand Down Expand Up @@ -253,11 +255,13 @@ export default {
let layers = this.exportLayers({
compiler: false
});
console.log('exportJSON!');
console.log(this.macros);
//API payload format
const { keymap } = this.templates;
let data = Object.assign(keymap, {
keyboard: this.keyboard,
macros: this.macros,
keymap: this.exportKeymapName,
layout: this.layout,
layers: layers,
Expand Down Expand Up @@ -367,6 +371,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,
Expand Down
4 changes: 4 additions & 0 deletions src/store/modules/app/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ const mutations = {
setNotes(state, newNotes) {
state.notes = newNotes;
},
setMacros(state, newMacros) {
console.log('macros!');
state.macros = newMacros;
},
toggleTutorial(state) {
state.tutorialEnabled = !state.tutorialEnabled;
},
Expand Down

0 comments on commit 4a19923

Please sign in to comment.