Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Unified Diff: chrome/browser/resources/print_preview/settings/page_settings.js

Issue 187813007: Force save changes when Enter is pressed for the controls with buffered updates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/print_preview/settings/copies_settings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/settings/page_settings.js
diff --git a/chrome/browser/resources/print_preview/settings/page_settings.js b/chrome/browser/resources/print_preview/settings/page_settings.js
index ec5c50c8e21c20ffaa1d2bf71e4b85103314241a..6cec4e04d73c27b4fa3b494de7e1aa83b1a6ef6b 100644
--- a/chrome/browser/resources/print_preview/settings/page_settings.js
+++ b/chrome/browser/resources/print_preview/settings/page_settings.js
@@ -100,6 +100,8 @@ cr.define('print_preview', function() {
this.tracker.add(
this.customInput_, 'focus', this.onCustomInputFocus_.bind(this));
this.tracker.add(
+ this.customInput_, 'keydown', this.onCustomInputKeyDown_.bind(this));
+ this.tracker.add(
this.customInput_, 'keyup', this.onCustomInputKeyUp_.bind(this));
this.tracker.add(
this.pageRangeTicketItem_,
@@ -188,13 +190,27 @@ cr.define('print_preview', function() {
* @param {Event} event Contains the key that was pressed.
* @private
*/
+ onCustomInputKeyDown_: function(event) {
+ if (event.keyCode == 13 /*enter*/) {
+ if (this.customInputTimeout_) {
+ clearTimeout(this.customInputTimeout_);
+ this.customInputTimeout_ = null;
+ }
+ this.pageRangeTicketItem_.updateValue(this.customInput_.value);
+ }
+ },
+
+ /**
+ * Called when a key is pressed on the custom input.
+ * @param {Event} event Contains the key that was pressed.
+ * @private
+ */
onCustomInputKeyUp_: function(event) {
if (this.customInputTimeout_) {
clearTimeout(this.customInputTimeout_);
+ this.customInputTimeout_ = null;
}
- if (event.keyIdentifier == 'Enter') {
- this.pageRangeTicketItem_.updateValue(this.customInput_.value);
- } else {
+ if (event.keyCode != 13 /*enter*/) {
this.customRadio_.checked = true;
this.customInputTimeout_ = setTimeout(
this.onCustomInputTimeout_.bind(this),
« no previous file with comments | « chrome/browser/resources/print_preview/settings/copies_settings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698