浏览代码

Merge pull request #44847 from nextcloud/fix/files-focus-new-node-dialog

fix(files): Focus filename input in new-node dialog when opened
pull/44860/head
Ferdinand Thiessen 2 个月前
父节点
当前提交
33c4ddd640
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 21 次插入4 次删除
  1. 18
    1
      apps/files/src/components/NewNodeDialog.vue
  2. 2
    2
      dist/files-init.js
  3. 1
    1
      dist/files-init.js.map

+ 18
- 1
apps/files/src/components/NewNodeDialog.vue 查看文件

@@ -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)
},

+ 2
- 2
dist/files-init.js
文件差异内容过多而无法显示
查看文件


+ 1
- 1
dist/files-init.js.map
文件差异内容过多而无法显示
查看文件


正在加载...
取消
保存