Add enter key handling and map to default button.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/5ebefa82 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/5ebefa82 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/5ebefa82 Branch: refs/heads/1.3.x Commit: 5ebefa82d5220b4525602b3c38e9198095f80d8c Parents: 9a19139 Author: Jesse MacFadyen <[email protected]> Authored: Fri Sep 9 16:05:38 2016 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Fri Sep 9 16:30:51 2016 -0700 ---------------------------------------------------------------------- src/windows/NotificationProxy.js | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/5ebefa82/src/windows/NotificationProxy.js ---------------------------------------------------------------------- diff --git a/src/windows/NotificationProxy.js b/src/windows/NotificationProxy.js index 2d32f83..e826557 100644 --- a/src/windows/NotificationProxy.js +++ b/src/windows/NotificationProxy.js @@ -116,6 +116,13 @@ function createPromptDialog(title, message, buttons, defaultText, callback) { // make sure input field is under focus dlg.querySelector('#prompt-input').select(); + // add Enter/Return key handling + var defaultButton = dlg.querySelector(".dlgButtonFirst"); + dlg.addEventListener("keypress",function(e) { + if (e.keyCode === 13) { // enter key + defaultButton && defaultButton.click(); + } + }); return dlgWrap; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
