mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Minor refactoring to form directory element
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user