From 07692153d5a3b56d9643203e157c65c2abc19709 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Wed, 10 Apr 2024 09:08:00 +0530 Subject: [PATCH] bug fix in save macros --- src/js/macros.js | 4 ++-- src/pug/templates/macros.pug | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index a3ee6b7..2ad6b2c 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -224,7 +224,6 @@ module.exports = { }, save_macro: async function () { if (this.tab == 0 || !this.state.macros[this.tab - 1]) { - this.load_macro(); this.confirmSave = false; return; } @@ -323,10 +322,11 @@ module.exports = { this.deleteGCode = false; }, load_macro: async function () { - if (this.tab == 0) { + if (this.tab == 0 || !this.state.macros[this.tab - 1]) { document.getElementById("macros-name").value = ""; document.getElementById("macros-color").value = "#ffffff"; this.isChecked = true; + this.tab = "0"; this.fileName = "default"; this.newGcode = ""; } else { diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index a591903..51e66d0 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -40,16 +40,16 @@ script#macros-template(type="text/x-template") h1 Macros Configuration .flex-row-container - button.config-button.button-blue(title="Reset Macros", @click="confirmReset=true") Delete All + button.config-button.button-blue(title="Reset Macros", @click="confirmReset=true") Reset message(:show.sync="confirmReset") - h3(slot="header") Delete All Macros? + h3(slot="header") Reset Macros? div(slot="body") - p Are you sure you want to delete all macros? + p Are you sure you want to reset all macros? div(slot="footer") button.pure-button(@click="confirmReset=false") Cancel button.pure-button.button-error(@click="delete_all_macros") - | Delete All + | Reset button.config-button.button-blue(title="Add a Macros", @click="addMacros=true", style="margin-left:5px") New Macro