From a8d9d0ebd8d4346aea9f21884ea7ba21613f9070 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 14 Jul 2013 04:45:56 +0400 Subject: [PATCH] now Enter works correctly on buttons in dialogs -- pressing the button (was: accept dialog ignoring the button)... Signed-off-by: Alex A. Naanou --- ui/compatibility.js | 8 ++++++-- ui/keybindings.js | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/compatibility.js b/ui/compatibility.js index 22df1a9a..2156f4b4 100755 --- a/ui/compatibility.js +++ b/ui/compatibility.js @@ -47,12 +47,16 @@ if(window.CEF_dumpJSON != null){ window.osPath = function(p){ - return path.normalize(p.replace(/file:\/\/\//, '')) + return path + .normalize(p.replace(/file:\/\/\//, '')) + } + window.execPathPush = function(p){ + process.env.PATH += ';' + path.normalize(process.cwd() + '/' + p) } // paths to included utils... - process.env.PATH += ';' + path.normalize(process.cwd() + '/vips/bin') + execPathPush('./vips/bin') // Things ImageGrid needs... diff --git a/ui/keybindings.js b/ui/keybindings.js index cd072ac1..99a31f6d 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -80,8 +80,16 @@ var KEYBOARD_CONFIG = { Enter: doc('Accept dialog', function(){ - getOverlay($('.viewer')).trigger('accept') - hideOverlay($('.viewer')) + var f = $(':focus') + // trigger the default button action... + if(/button/i.test(f[0].tagName) || f.attr('type') == 'button'){ + return true + + // accept the dialog... + } else { + getOverlay($('.viewer')).trigger('accept') + hideOverlay($('.viewer')) + } }), Esc: doc('Close dialog', function(){