Minor refactoring to form directory element

This commit is contained in:
Dannon Baker
2026-01-14 09:16:08 -05:00
parent a4cd192617
commit 09e85bdfdb
@@ -140,12 +140,23 @@ export default {
},
addPath({ key }) {
if ((key === "Enter" || key === "/") && this.isValidName) {
const newFolder = this.currentDirectoryName;
this.pathChunks.push({ pathChunk: newFolder, editable: true });
this.currentDirectoryName = "";
this.addDirectoryToPath();
}
},
handleBlur() {
if (this.currentDirectoryName && this.isValidName) {
this.addDirectoryToPath();
} else {
// If the input was touched let's propagate the change either way.
this.updateURL();
}
},
addDirectoryToPath() {
const newFolder = this.currentDirectoryName;
this.pathChunks.push({ pathChunk: newFolder, editable: true });
this.currentDirectoryName = "";
this.updateURL();
},
updateURL(isReset = false) {
let url = undefined;
if (!isReset) {
@@ -159,14 +170,6 @@ export default {
}
this.$emit("input", url);
},
handleBlur() {
if (this.currentDirectoryName && this.isValidName) {
const newFolder = this.currentDirectoryName;
this.pathChunks.push({ pathChunk: newFolder, editable: true });
this.currentDirectoryName = "";
}
this.updateURL();
},
},
};
</script>