Skip to content

Commit

Permalink
bind Enter on dialogs start button
Browse files Browse the repository at this point in the history
  • Loading branch information
nelu committed Dec 15, 2024
1 parent d91f1c8 commit ed0f632
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/ui-dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -95,7 +100,7 @@ export function FileManagerDialogs(browser) {

self.afterShow = (diagId) => {
setTimeout(function () {
self.startButton(diagId).select().focus();
$("#"+diagId).select().focus();
});
}
// common dialog cleanup
Expand Down Expand Up @@ -248,6 +253,8 @@ export function FileManagerDialogs(browser) {
self.getDialogHeader(diagId)
.prepend('<icon class="flm-sprite-diag flm-sprite sprite-' + what + '"></icon>');

self.bindKeys(diagId);

// $("#"+diagId).find('.flm-diag-cancel')
// .click(function () {
// console.log("cancel triggered");
Expand Down

0 comments on commit ed0f632

Please sign in to comment.