From ed0f6329003f229c0bbf1c5744d74696d9d6d0f8 Mon Sep 17 00:00:00 2001 From: nelu Date: Mon, 16 Dec 2024 01:20:02 +0200 Subject: [PATCH] bind Enter on dialogs start button --- js/ui-dialogs.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/ui-dialogs.js b/js/ui-dialogs.js index bcd1c51..fb9898e 100644 --- a/js/ui-dialogs.js +++ b/js/ui-dialogs.js @@ -71,6 +71,11 @@ export function FileManagerDialogs(browser) { self.startedPromise = null; self.dirBrowser = {}; // multiple file operations are ui blocking + self.bindKeys = (diagId) => { + $("#"+diagId).keydown(function (e) { + (e.keyCode === 13) && self.startButton(diagId).click(); + }); + }; self.setDialogConfig = (diagId, config) => { self.forms[diagId] = config; @@ -95,7 +100,7 @@ export function FileManagerDialogs(browser) { self.afterShow = (diagId) => { setTimeout(function () { - self.startButton(diagId).select().focus(); + $("#"+diagId).select().focus(); }); } // common dialog cleanup @@ -248,6 +253,8 @@ export function FileManagerDialogs(browser) { self.getDialogHeader(diagId) .prepend(''); + self.bindKeys(diagId); + // $("#"+diagId).find('.flm-diag-cancel') // .click(function () { // console.log("cancel triggered");