diff --git a/frontend/src/components/prompts/NewDir.vue b/frontend/src/components/prompts/NewDir.vue index 653ae953..4497a68b 100644 --- a/frontend/src/components/prompts/NewDir.vue +++ b/frontend/src/components/prompts/NewDir.vue @@ -11,7 +11,7 @@ type="text" @keyup.enter="submit" v-model.trim="name" - v-focus + ref="wantInput" /> @@ -61,6 +61,9 @@ export default { computed: { ...mapGetters(["isFiles", "isListing"]), }, + mounted() { + this.$nextTick(() => setTimeout(() => this.$refs.wantInput.focus(), 100)) + }, methods: { submit: async function (event) { event.preventDefault(); diff --git a/frontend/src/components/prompts/NewFile.vue b/frontend/src/components/prompts/NewFile.vue index 8b6fc582..96ef9459 100644 --- a/frontend/src/components/prompts/NewFile.vue +++ b/frontend/src/components/prompts/NewFile.vue @@ -8,7 +8,7 @@

{{ $t("prompts.newFileMessage") }}

setTimeout(() => this.$refs.wantInput.focus(), 100)) + }, methods: { submit: async function (event) { event.preventDefault(); diff --git a/frontend/src/components/prompts/Prompts.vue b/frontend/src/components/prompts/Prompts.vue index 53b3949f..0e2c5e64 100644 --- a/frontend/src/components/prompts/Prompts.vue +++ b/frontend/src/components/prompts/Prompts.vue @@ -93,6 +93,7 @@ export default { computed: { ...mapState(["plugins"]), ...mapGetters(["currentPrompt", "currentPromptName"]), + // yes, if the stack of modals/dialogs is not empty showOverlay: function () { return ( this.currentPrompt !== null && diff --git a/frontend/src/components/prompts/Rename.vue b/frontend/src/components/prompts/Rename.vue index f3a96c2e..7af41390 100644 --- a/frontend/src/components/prompts/Rename.vue +++ b/frontend/src/components/prompts/Rename.vue @@ -11,7 +11,7 @@

setTimeout(() => this.$refs.wantInput.focus(), 100)) + }, + methods: { cancel: function () { this.$store.commit("closeHovers"); diff --git a/frontend/src/store/mutations.js b/frontend/src/store/mutations.js index 1f9912c5..7c43a04e 100644 --- a/frontend/src/store/mutations.js +++ b/frontend/src/store/mutations.js @@ -9,6 +9,8 @@ const mutations = { state.show = null; state.showShell = !state.showShell; }, + // display a modal prompt or a dialog, such as when renaming a file + // opinion: should be renamed to showPrompt or showDialog because "hover" means something else in HTML speak showHover: (state, value) => { if (typeof value !== "object") { state.prompts.push({ @@ -21,7 +23,7 @@ const mutations = { } state.prompts.push({ - prompt: value.prompt, // Should not be null + prompt: value.prompt, // Should not be null ('newDir', 'newFile', etc) confirm: value?.confirm, action: value?.action, props: value?.props,