Use keyboard controls for new folder creation

Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
Christopher Ng 2022-05-27 20:54:23 +00:00
parent 0b0ef105c5
commit 16d2238de5
5 changed files with 9 additions and 9 deletions

View File

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

BIN
dist/core-login.js vendored

Binary file not shown.

BIN
dist/core-login.js.map vendored

Binary file not shown.

BIN
dist/core-main.js vendored

Binary file not shown.

BIN
dist/core-main.js.map vendored

Binary file not shown.