mirror of https://github.com/nextcloud/server
Use keyboard controls for new folder creation
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
0b0ef105c5
commit
16d2238de5
|
@ -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')
|
||||
})
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue