You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2016/12/08 00:56:49 UTC

[06/12] cordova-plugin-dialogs git commit: Add enter key handling and map to default button.

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 <pu...@gmail.com>
Authored: Fri Sep 9 16:05:38 2016 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
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: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org