From 6cc5419bf830cab2be9110b981a876cbfc5383d9 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Tue, 30 Jan 2024 01:15:01 +0530 Subject: [PATCH] fixing save macros --- src/js/macros.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index d20ff77..f5cab7c 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -188,7 +188,7 @@ module.exports = { } }, saveMacros: async function () { - const macrosList = this.macrosList(); + const macrosList = this.config.macros.map(item => item.name); var macrosName = document.getElementById("macros-name").value; console.log("Macros Name: ", this.macrosName); var macrosColor = document.getElementById("macros-color").value; @@ -251,13 +251,15 @@ module.exports = { if (this.tab == 0) { document.getElementById("macros-name").value = ""; document.getElementById("macros-color").value = ""; + this.fileName = "default"; + this.newGcode = ""; } else { const defaultValue = this.config.macros[this.tab - 1]; document.getElementById("macros-name").value = defaultValue.name; document.getElementById("macros-color").value = defaultValue.color; + this.fileName = defaultValue.file_name; + this.loadMacrosGcode(); } - this.newGcode = ""; - this.fileName = "default"; this.edited = false; }, deleteAllMacros: async function () {