Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
| 5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <html> | 7 <html> |
| 8 <body> | 8 <body> |
| 9 <element name="x-editable-label" extends="div" apply-author-styles> | 9 <element name="x-editable-label" extends="div" apply-author-styles> |
| 10 <template> | 10 <template> |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 InputElement get _editBox => _root.query('#edit'); | 38 InputElement get _editBox => _root.query('#edit'); |
| 39 | 39 |
| 40 void created() { | 40 void created() { |
| 41 super.created(); | 41 super.created(); |
| 42 editing = false; | 42 editing = false; |
| 43 value = ''; | 43 value = ''; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void edit() { | 46 void edit() { |
| 47 editing = true; | 47 editing = true; |
| 48 dispatch(); | 48 deliverChangesSync(); |
|
Siggi Cherem (dart-lang)
2013/02/13 01:43:24
interesting that we needed this... I wonder if we
Jennifer Messerly
2013/02/13 05:43:15
Agreed, that's the issue here. on-insert would be
| |
| 49 | 49 |
| 50 // For IE and Firefox: use .focus(), then reset the value to move the | 50 // For IE and Firefox: use .focus(), then reset the value to move the |
| 51 // cursor to the end. | 51 // cursor to the end. |
| 52 _editBox.focus(); | 52 _editBox.focus(); |
| 53 _editBox.value = ''; | 53 _editBox.value = ''; |
| 54 _editBox.value = value; | 54 _editBox.value = value; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void update(Event e) { | 57 void update(Event e) { |
| 58 e.preventDefault(); // don't submit the form | 58 e.preventDefault(); // don't submit the form |
| 59 if (!editing) return; // bail if user canceled | 59 if (!editing) return; // bail if user canceled |
| 60 value = _editBox.value; | 60 value = _editBox.value; |
| 61 editing = false; | 61 editing = false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void maybeCancel(KeyboardEvent e) { | 64 void maybeCancel(KeyboardEvent e) { |
| 65 if (e.keyCode == KeyCode.ESC) { | 65 if (e.keyCode == KeyCode.ESC) { |
| 66 editing = false; | 66 editing = false; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 </script> | 70 </script> |
| 71 </element> | 71 </element> |
| 72 </body> | 72 </body> |
| 73 </html> | 73 </html> |
| OLD | NEW |