summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2022-05-27 20:54:23 +0000
committerChristopher Ng <chrng8@gmail.com>2022-06-09 00:12:24 +0000
commit16d2238de55bc551d14af597468765e98b5fb1eb (patch)
tree8827779718fd69425260c5d60bc5deb63b9610cd /core
parent0b0ef105c5e3b1c3295d0dc2993925bc535b155a (diff)
downloadnextcloud-server-16d2238de55bc551d14af597468765e98b5fb1eb.tar.gz
nextcloud-server-16d2238de55bc551d14af597468765e98b5fb1eb.zip
Use keyboard controls for new folder creation
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/src/OC/dialogs.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js
index eb314625859..e32cb6f936e 100644
--- a/core/src/OC/dialogs.js
+++ b/core/src/OC/dialogs.js
@@ -323,7 +323,7 @@ const Dialogs = {
newButton.hide()
}
newButton.on('focus', function() {
- self.$filePicker.ocdialog('setEnterCallback', function() {
+ self.$filePicker.ocdialog('setEnterCallback', function(event) {
event.stopImmediatePropagation()
event.preventDefault()
newButton.click()
@@ -336,7 +336,7 @@ const Dialogs = {
OC.registerMenu(newButton, self.$filePicker.find('.menu'), function() {
$input.tooltip('hide')
$input.focus()
- self.$filePicker.ocdialog('setEnterCallback', function() {
+ self.$filePicker.ocdialog('setEnterCallback', function(event) {
event.stopImmediatePropagation()
event.preventDefault()
self.$filePicker.submit()
@@ -351,6 +351,13 @@ const Dialogs = {
var $form = self.$filePicker.find('.filenameform')
var $input = $form.find('input[type=\'text\']')
var $submit = $form.find('input[type=\'submit\']')
+ $input.on('keydown', function(event) {
+ if (event.key === 'Enter') {
+ event.stopImmediatePropagation()
+ event.preventDefault()
+ $form.submit()
+ }
+ })
$submit.on('click', function(event) {
event.stopImmediatePropagation()
event.preventDefault()
@@ -427,13 +434,6 @@ const Dialogs = {
$input.val(newText)
}
})
- $input.keypress(function(event) {
- if (event.keyCode === 13 || event.which === 13) {
- event.stopImmediatePropagation()
- event.preventDefault()
- $form.submit()
- }
- })
$input.on('input', function(event) {
$input.tooltip('hide')
})