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

Unified Diff: samples/third_party/todomvc/web/editable_label.dart

Issue 60353013: Update TodoMVC based on https://github.com/polymer/todomvc (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix pubspecs Created 7 years, 1 month 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: samples/third_party/todomvc/web/editable_label.dart
diff --git a/samples/third_party/todomvc/web/editable_label.dart b/samples/third_party/todomvc/web/editable_label.dart
deleted file mode 100644
index 1b4d370d026d9fbdf737e65ea5b012c6f04ecb0a..0000000000000000000000000000000000000000
--- a/samples/third_party/todomvc/web/editable_label.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library todomvc.web.editable_label;
-
-import 'dart:html';
-import 'package:polymer/polymer.dart';
-
-/**
- * Label whose [value] can be edited by double clicking. When editing, it
- * displays a form and input element, otherwise it displays the label.
- */
-// For illustration purposes this type uses Polymer.register instead of
-// CustomTag. We must mark it @reflectable to ensure its members
-// (the event handlers) are preserved and can be referenced from HTML.
-@reflectable
-class EditableLabel extends PolymerElement {
- @observable bool editing = false;
- @published String value = '';
-
- factory EditableLabel() => new Element.tag('editable-label');
-
- EditableLabel.created() : super.created();
-
- bool get applyAuthorStyles => true;
-
- ShadowRoot get _shadowRoot => getShadowRoot('editable-label');
-
- InputElement get _editBox => _shadowRoot.query('#edit');
-
- void edit() {
- editing = true;
-
- // Wait for _editBox to be inserted.
- onMutation(_shadowRoot).then((_) {
- // For IE and Firefox: use .focus(), then reset the value to move the
- // cursor to the end.
- _editBox.focus();
- _editBox.value = '';
- _editBox.value = value;
- });
- }
-
- void update(Event e) {
- e.preventDefault(); // don't submit the form
- if (!editing) return; // bail if user canceled
- value = _editBox.value;
- editing = false;
- }
-
- void maybeCancel(KeyboardEvent e) {
- if (e.keyCode == KeyCode.ESC) {
- editing = false;
- }
- }
-}
-
-@initMethod
-void _init() {
- Polymer.register('editable-label', EditableLabel);
-}

Powered by Google App Engine
This is Rietveld 408576698