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

Unified Diff: chrome/browser/resources/print_preview/settings/copies_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
Index: chrome/browser/resources/print_preview/settings/copies_settings.js
diff --git a/chrome/browser/resources/print_preview/settings/copies_settings.js b/chrome/browser/resources/print_preview/settings/copies_settings.js
index 189ada79c46ae29f58e0a0a15351458d3f1c6ccc..0c6e783c880a78c317b094cea6bc92fbaab8e59d 100644
--- a/chrome/browser/resources/print_preview/settings/copies_settings.js
+++ b/chrome/browser/resources/print_preview/settings/copies_settings.js
@@ -75,6 +75,10 @@ cr.define('print_preview', function() {
fadeOutOption(this.getElement(), true);
this.tracker.add(
this.getChildElement('input.copies'),
+ 'keydown',
+ this.onTextfieldKeyDown_.bind(this));
+ this.tracker.add(
+ this.getChildElement('input.copies'),
'input',
this.onTextfieldInput_.bind(this));
this.tracker.add(
@@ -168,6 +172,7 @@ cr.define('print_preview', function() {
* @private
*/
onTextfieldTimeout_: function() {
+ this.textfieldTimeout_ = null;
var copiesVal = this.getChildElement('input.copies').value;
if (copiesVal != '') {
this.copiesTicketItem_.updateValue(copiesVal);
@@ -175,6 +180,20 @@ cr.define('print_preview', function() {
},
/**
+ * Called when a key is pressed on the custom input.
+ * @param {Event} event Contains the key that was pressed.
+ * @private
+ */
+ onTextfieldKeyDown_: function(event) {
+ if (event.keyCode == 13 /*enter*/) {
+ if (this.textfieldTimeout_) {
+ clearTimeout(this.textfieldTimeout_);
+ }
+ this.onTextfieldTimeout_();
+ }
+ },
+
+ /**
* Called when a input event occurs on the textfield. Starts an input
* timeout.
* @private

Powered by Google App Engine
This is Rietveld 408576698