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

Unified Diff: sky/framework/sky-input.sky

Issue 999873002: Move sky-*.sky into framework/elements (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: One missing Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/sky-ink-splash.sky ('k') | sky/framework/sky-menu-divider.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/sky-input.sky
diff --git a/sky/framework/sky-input.sky b/sky/framework/sky-input.sky
deleted file mode 100644
index ae49b907005c1ab9d43ca1d80d5d50ce13d404b6..0000000000000000000000000000000000000000
--- a/sky/framework/sky-input.sky
+++ /dev/null
@@ -1,78 +0,0 @@
-<!--
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
--->
-<import src="sky-element.sky" />
-
-<sky-element name="sky-input" attributes="value:string">
-<template>
- <style>
- :host {
- display: flex;
- }
- #control {
- margin: 8px;
- padding: 8px;
- border-bottom: 1px solid #E7E7E7;
- flex: 1;
- align-self: center;
- height: 1.2em;
- white-space: nowrap;
- overflow: hidden;
- }
- #control.focused {
- padding-bottom: 7px;
- border-bottom: 2px solid #009cf3;
- }
- </style>
- <div id="control" contenteditable />
-</template>
-<script>
-import "dart:sky";
-
-// TODO(abarth): Connect to the mojo:keyboard service.
-
-@Tagname('sky-input')
-class SkyInput extends SkyElement {
- Element _control;
-
- static String _textForValue(String value) => value == null ? '' : value;
-
- shadowRootReady() {
- _control = shadowRoot.getElementById('control');
- _control.setChild(new Text(_textForValue(getAttribute('text'))));
- _control.addEventListener('focus', _handleFocus);
- _control.addEventListener('blur', _handleBlur);
- _control.addEventListener('keydown', _handleKeyDown);
- }
-
- String get text => _control == null ? null : _control.textContent;
-
- void textChanged(String oldValue, String newValue) {
- if (_control != null)
- _control.setChild(new Text(_textForValue(newValue)));
- }
-
- void _handleKeyDown(KeyboardEvent event) {
- // TODO(abarth): You can still get newlines if the user pastes them.
- if (event.key == 0xD)
- event.preventDefault();
- }
-
- void _handleFocus(_) {
- if (_control)
- _control.setAttribute('class', 'focused');
- // TODO(abarth): Show the keyboard.
- }
-
- void _handleBlur(_) {
- if (_control)
- _control.removeAttribute('class');
- // TODO(abarth): Hide the keyboard.
- }
-}
-
-_init(script) => register(script, SkyInput);
-</script>
-</sky-element>
« no previous file with comments | « sky/framework/sky-ink-splash.sky ('k') | sky/framework/sky-menu-divider.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698