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

Side by Side Diff: sky/framework/sky-input.sky

Issue 844763004: Flex the inside of the input control (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2015 The Chromium Authors. All rights reserved. 2 // Copyright 2015 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> 6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" />
7 7
8 <sky-element name="sky-input" attributes="value:string"> 8 <sky-element name="sky-input" attributes="value:string">
9 <template> 9 <template>
10 <style> 10 <style>
11 :host { 11 :host {
12 display: flex; 12 display: flex;
13 border: 1px solid blue; 13 border: 1px solid blue;
14 margin: 5px; 14 margin: 5px;
15 padding: 4px; 15 padding: 4px;
16 } 16 }
17 #control { 17 #control {
18 flex: 1;
18 align-self: center; 19 align-self: center;
19 height: 1.2em; 20 height: 1.2em;
20 white-space: nowrap; 21 white-space: nowrap;
21 overflow: hidden; 22 overflow: hidden;
22 } 23 }
23 </style> 24 </style>
24 <div id="control" contenteditable on-keydown="handleKeyDown">{{ value }}</div> 25 <div id="control" contenteditable on-keydown="handleKeyDown">{{ value }}</div>
25 </template> 26 </template>
26 <script> 27 <script>
27 module.exports = class extends SkyElement { 28 module.exports = class extends SkyElement {
(...skipping 14 matching lines...) Expand all
42 }); 43 });
43 } 44 }
44 handleKeyDown(event) { 45 handleKeyDown(event) {
45 // TODO(abarth): You can still get newlines if the user pastes them. 46 // TODO(abarth): You can still get newlines if the user pastes them.
46 if (event.keyCode == 0xD) 47 if (event.keyCode == 0xD)
47 event.preventDefault(); 48 event.preventDefault();
48 } 49 }
49 }.register(); 50 }.register();
50 </script> 51 </script>
51 </sky-element> 52 </sky-element>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698