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

Side by Side Diff: chrome/browser/resources/print_preview/previewarea/margin_control.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, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/settings/copies_settings.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Draggable control for setting a page margin. 9 * Draggable control for setting a page margin.
10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation 10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 * Called when a key down event occurs on the textbox. Dispatches a 414 * Called when a key down event occurs on the textbox. Dispatches a
415 * TEXT_CHANGE event if the "Enter" key was pressed. 415 * TEXT_CHANGE event if the "Enter" key was pressed.
416 * @param {Event} event Contains the key that was pressed. 416 * @param {Event} event Contains the key that was pressed.
417 * @private 417 * @private
418 */ 418 */
419 onTextboxKeyDown_: function(event) { 419 onTextboxKeyDown_: function(event) {
420 if (this.textTimeout_) { 420 if (this.textTimeout_) {
421 clearTimeout(this.textTimeout_); 421 clearTimeout(this.textTimeout_);
422 this.textTimeout_ = null; 422 this.textTimeout_ = null;
423 } 423 }
424 if (event.keyIdentifier == 'Enter') { 424 if (event.keyCode == 13 /*enter*/) {
425 this.preTimeoutValue_ = null; 425 this.preTimeoutValue_ = null;
426 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); 426 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE);
427 } else { 427 } else {
428 if (this.preTimeoutValue_ == null) { 428 if (this.preTimeoutValue_ == null) {
429 this.preTimeoutValue_ = this.textbox_.value; 429 this.preTimeoutValue_ = this.textbox_.value;
430 } 430 }
431 this.textTimeout_ = setTimeout( 431 this.textTimeout_ = setTimeout(
432 this.onTextboxTimeout_.bind(this), MarginControl.TEXTBOX_TIMEOUT_); 432 this.onTextboxTimeout_.bind(this), MarginControl.TEXTBOX_TIMEOUT_);
433 } 433 }
434 }, 434 },
(...skipping 23 matching lines...) Expand all
458 this.setIsFocused_(false); 458 this.setIsFocused_(false);
459 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); 459 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE);
460 } 460 }
461 }; 461 };
462 462
463 // Export 463 // Export
464 return { 464 return {
465 MarginControl: MarginControl 465 MarginControl: MarginControl
466 }; 466 };
467 }); 467 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/settings/copies_settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698