| OLD | NEW |
| 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('options', function() { | 5 cr.define('options', function() { |
| 6 /** @const */ var DeletableItem = options.DeletableItem; | 6 /** @const */ var DeletableItem = options.DeletableItem; |
| 7 /** @const */ var DeletableItemList = options.DeletableItemList; | 7 /** @const */ var DeletableItemList = options.DeletableItemList; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Creates a new list item with support for inline editing. | 10 * Creates a new list item with support for inline editing. |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 * Called when a key is pressed. Handles committing and canceling edits. | 473 * Called when a key is pressed. Handles committing and canceling edits. |
| 474 * @param {Event} e The key down event. | 474 * @param {Event} e The key down event. |
| 475 * @private | 475 * @private |
| 476 */ | 476 */ |
| 477 handleKeyDown_: function(e) { | 477 handleKeyDown_: function(e) { |
| 478 if (!this.editing) | 478 if (!this.editing) |
| 479 return; | 479 return; |
| 480 | 480 |
| 481 var endEdit = false; | 481 var endEdit = false; |
| 482 var handledKey = true; | 482 var handledKey = true; |
| 483 switch (e.keyIdentifier) { | 483 switch (e.key) { |
| 484 case 'U+001B': // Esc | 484 case 'Escape': |
| 485 this.editCancelled_ = true; | 485 this.editCancelled_ = true; |
| 486 endEdit = true; | 486 endEdit = true; |
| 487 break; | 487 break; |
| 488 case 'Enter': | 488 case 'Enter': |
| 489 if (this.currentInputIsValid) | 489 if (this.currentInputIsValid) |
| 490 endEdit = true; | 490 endEdit = true; |
| 491 break; | 491 break; |
| 492 default: | 492 default: |
| 493 handledKey = false; | 493 handledKey = false; |
| 494 } | 494 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 this.getListItemByIndex(0)); | 765 this.getListItemByIndex(0)); |
| 766 }, | 766 }, |
| 767 }; | 767 }; |
| 768 | 768 |
| 769 // Export | 769 // Export |
| 770 return { | 770 return { |
| 771 InlineEditableItem: InlineEditableItem, | 771 InlineEditableItem: InlineEditableItem, |
| 772 InlineEditableItemList: InlineEditableItemList, | 772 InlineEditableItemList: InlineEditableItemList, |
| 773 }; | 773 }; |
| 774 }); | 774 }); |
| OLD | NEW |