mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Fix TTS form
This commit is contained in:
parent
8d62654e4f
commit
da62d1bf18
@ -102,7 +102,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- TTS -->
|
<!-- TTS -->
|
||||||
<div hidden$='[[computeHideTTS(ttsLoaded, supportsPlayMedia)]]' class='layout horizontal end'>
|
<div hidden$='[[computeHideTTS(ttsLoaded, supportsPlayMedia)]]' class='layout horizontal end'>
|
||||||
<paper-input label='Text to speak' class='flex' value='{{ttsMessage}}'></paper-input>
|
<paper-input
|
||||||
|
id='ttsInput'
|
||||||
|
label='Text to speak'
|
||||||
|
class='flex'
|
||||||
|
value='{{ttsMessage}}'
|
||||||
|
on-keydown="ttsCheckForEnter"
|
||||||
|
></paper-input>
|
||||||
<paper-icon-button icon='mdi:send' on-tap='sendTTS'></paper-icon-button>
|
<paper-icon-button icon='mdi:send' on-tap='sendTTS'></paper-icon-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -375,6 +381,10 @@ Polymer({
|
|||||||
this.callService('volume_set', { volume_level: vol });
|
this.callService('volume_set', { volume_level: vol });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ttsCheckForEnter: function (ev) {
|
||||||
|
if (ev.keyCode === 13) this.sendTTS();
|
||||||
|
},
|
||||||
|
|
||||||
sendTTS: function () {
|
sendTTS: function () {
|
||||||
var services = this.hass.config.services.tts;
|
var services = this.hass.config.services.tts;
|
||||||
var serviceKeys = Object.keys(services).sort();
|
var serviceKeys = Object.keys(services).sort();
|
||||||
@ -382,8 +392,8 @@ Polymer({
|
|||||||
var i;
|
var i;
|
||||||
|
|
||||||
for (i = 0; i < serviceKeys.length; i++) {
|
for (i = 0; i < serviceKeys.length; i++) {
|
||||||
if (services[serviceKeys[i]].indexOf('_say') !== -1) {
|
if (serviceKeys[i].indexOf('_say') !== -1) {
|
||||||
service = services[serviceKeys[i]];
|
service = serviceKeys[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,7 +407,7 @@ Polymer({
|
|||||||
message: this.ttsMessage,
|
message: this.ttsMessage,
|
||||||
});
|
});
|
||||||
this.ttsMessage = '';
|
this.ttsMessage = '';
|
||||||
document.activeElement.blur();
|
this.$.ttsInput.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
callService: function (service, data) {
|
callService: function (service, data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user