mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
Activate the primary dialog button on enter if there is a single input
Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
parent
edba92d1f4
commit
9f09caaaea
3 changed files with 18 additions and 3 deletions
15
core/src/jquery/ocdialog.js
vendored
15
core/src/jquery/ocdialog.js
vendored
|
|
@ -56,6 +56,21 @@ $.widget('oc.ocdialog', {
|
|||
this.$dialog.append(this.element.detach())
|
||||
this.element.removeAttr('title').addClass('oc-dialog-content').appendTo(this.$dialog)
|
||||
|
||||
// Activate the primary button on enter if there is a single input
|
||||
if (self.element.find('input').length === 1) {
|
||||
const $input = self.element.find('input')
|
||||
$input.on('keydown', function(event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (self.$buttonrow) {
|
||||
const $button = self.$buttonrow.find('button.primary')
|
||||
if ($button && !$button.prop('disabled')) {
|
||||
$button.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.$dialog.css({
|
||||
display: 'inline-block',
|
||||
position: 'fixed',
|
||||
|
|
|
|||
4
dist/core-main.js
vendored
4
dist/core-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/core-main.js.map
vendored
2
dist/core-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue