mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
fix(files): Focus filename input in new-node dialog when opened
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
cfd7e99240
commit
65d09bdfbd
1 changed files with 18 additions and 1 deletions
|
|
@ -128,14 +128,31 @@ export default defineComponent({
|
|||
defaultName() {
|
||||
this.localDefaultName = this.defaultName || t('files', 'New folder')
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensure the input is focussed even if the dialog is already mounted but not open
|
||||
*/
|
||||
open() {
|
||||
this.$nextTick(() => this.focusInput())
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// on mounted lets use the unique name
|
||||
this.localDefaultName = this.uniqueName
|
||||
this.$nextTick(() => (this.$refs.input as unknown as ICanFocus)?.focus?.())
|
||||
this.$nextTick(() => this.focusInput())
|
||||
},
|
||||
methods: {
|
||||
t,
|
||||
|
||||
/**
|
||||
* Focus the filename input field
|
||||
*/
|
||||
focusInput() {
|
||||
if (this.open) {
|
||||
this.$nextTick(() => (this.$refs.input as unknown as ICanFocus)?.focus?.())
|
||||
}
|
||||
},
|
||||
|
||||
onCreate() {
|
||||
this.$emit('close', this.localDefaultName)
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue