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

Side by Side Diff: example/todomvc/editable_label.html

Issue 12225039: Support for observable models, fixes #259 (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: small formatting fixes Created 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | example/todomvc/main.dart » ('j') | example/todomvc/model.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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>
OLDNEW
« no previous file with comments | « no previous file | example/todomvc/main.dart » ('j') | example/todomvc/model.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698