fixed file name bug
This commit is contained in:
@@ -201,18 +201,25 @@ module.exports = {
|
||||
const macrosList = macros.map(item => item.name);
|
||||
var macrosName = document.getElementById("macros-name").value;
|
||||
var macrosColor = document.getElementById("macros-color").value;
|
||||
if (macrosList.includes(macrosName)) {
|
||||
const formattedFilename = macrosName
|
||||
.replace(/\\/g, "_")
|
||||
.replace(/\//g, "_")
|
||||
.replace(/#/g, "-")
|
||||
.replace(/\?/g, "-");
|
||||
|
||||
if (macrosList.includes(formattedFilename)) {
|
||||
this.sameName = true;
|
||||
this.confirmSave = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var file_name = this.fileName == "default" ? macrosName + ".ngc" : this.fileName;
|
||||
|
||||
var file_name = this.fileName == "default" ? formattedFilename + ".ngc" : this.fileName;
|
||||
var file = this.newGcode;
|
||||
|
||||
this.uploadGCode(file_name, file);
|
||||
|
||||
this.config.macros[this.tab - 1].name = macrosName;
|
||||
this.config.macros[this.tab - 1].name = formattedFilename;
|
||||
this.config.macros[this.tab - 1].color = macrosColor;
|
||||
this.config.macros[this.tab - 1].file_name = file_name;
|
||||
this.confirmSave = false;
|
||||
|
||||
@@ -81,7 +81,7 @@ script#macros-template(type="text/x-template")
|
||||
p.title Macros Name
|
||||
.input-container
|
||||
input.input-color(type="color",id="macros-color",value="#ffffff",@change="editedColor")
|
||||
input.input-name(type="text",minlength='1',maxlength='20',id="macros-name" ,v-model="macrosName",@keypress="editedName")
|
||||
input.input-name(type="text",minlength='1',maxlength='15',id="macros-name" ,v-model="macrosName",@keypress="editedName")
|
||||
p.title Macros G-Code
|
||||
.flex-row-container
|
||||
select(id="gcode-select",title="Select previously uploaded GCode programs.",selected
|
||||
|
||||
Reference in New Issue
Block a user