Skip to content

Commit

Permalink
Add inputSelectionRange to create new file (#6803)
Browse files Browse the repository at this point in the history
* Add inputSelectionRange
  • Loading branch information
Jan authored Apr 22, 2022
1 parent d6c1faf commit 59c3ece
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: Apply text selection range for new files

We've fixed a bug, where the text selection range for a new file has not been applied only for the file name but also
for the file extension.
This is now working as in the rename modal and just selects the text for the file name.

https://github.com/owncloud/web/issues/6756
https://github.com/owncloud/web/pull/6803
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ export default {
this.newFileAction = openAction
}
const inputSelectionRange =
isFolder || !this.areFileExtensionsShown ? null : [0, defaultName.length - (ext.length + 1)]
const modal = {
variation: 'passive',
title: isFolder ? this.$gettext('Create a new folder') : this.$gettext('Create a new file'),
Expand All @@ -362,6 +365,7 @@ export default {
: this.checkNewFileName(
this.areFileExtensionsShown ? defaultName : `${defaultName}.${ext}`
),
inputSelectionRange,
onCancel: this.hideModal,
onConfirm: isFolder
? this.addNewFolder
Expand Down

0 comments on commit 59c3ece

Please sign in to comment.