Chromium Code Reviews| Index: sky/framework/sky-input.sky |
| diff --git a/sky/framework/sky-input.sky b/sky/framework/sky-input.sky |
| index 9ad21fb988ae688d17a1e1c1fbe22d73184a8236..d1a44aedfa0fff616a0dfc3b3ef6e06de8a1d48c 100644 |
| --- a/sky/framework/sky-input.sky |
| +++ b/sky/framework/sky-input.sky |
| @@ -3,7 +3,9 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| --> |
| +<import src="/sky/framework/shell.sky" as="shell" /> |
| <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> |
| +<import src="/mojo/services/keyboard/public/interfaces/keyboard.mojom.sky" as="keyboard" /> |
| <sky-element name="sky-input" attributes="value:string"> |
| <template> |
| @@ -22,9 +24,13 @@ |
| overflow: hidden; |
| } |
| </style> |
| - <div id="control" contenteditable on-keydown="handleKeyDown">{{ value }}</div> |
| + <div id="control" contenteditable |
| + on-focus="handleFocus" |
| + on-blur="handleBlur" |
| + on-keydown="handleKeyDown">{{ value }}</div> |
| </template> |
| <script> |
| +module.keyboard = shell.connectToService("mojo:keyboard", keyboard.Keyboard); |
|
qsr
2015/01/21 15:33:05
What is the right way to set a service to be used
abarth-chromium
2015/01/21 17:43:58
You can just store it in a variable:
var keyboard
qsr
2015/01/21 18:13:15
Done.
|
| module.exports = class extends SkyElement { |
| shadowRootReady() { |
| var control = this.shadowRoot.getElementById('control'); |
| @@ -54,6 +60,12 @@ module.exports = class extends SkyElement { |
| if (event.keyCode == 0xD) |
| event.preventDefault(); |
| } |
| + handleFocus(event) { |
| + module.keyboard.show(); |
|
qsr
2015/01/21 15:33:05
Is that fine with you? Is there no change of this
abarth-chromium
2015/01/21 17:43:58
Yeah, this looks right.
|
| + } |
| + handleBlur(event) { |
| + module.keyboard.hide(); |
| + } |
| }.register(); |
| </script> |
| </sky-element> |