mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-21 10:46:35 +00:00
Console updates (#99)
This commit is contained in:
parent
971453d8a9
commit
eb4ebfa17b
@ -126,14 +126,18 @@ export class EwtConsole extends HTMLElement {
|
||||
<form>
|
||||
>
|
||||
<input autofocus>
|
||||
<button type="button">Send</button>
|
||||
</form>
|
||||
`;
|
||||
|
||||
this._console = new ColoredConsole(this.shadowRoot!.querySelector("div")!);
|
||||
const input = this.shadowRoot!.querySelector("input")!;
|
||||
|
||||
this.addEventListener("click", () => input.focus());
|
||||
this.addEventListener("click", () => {
|
||||
// Only focus input if user didn't select some text
|
||||
if (getSelection()?.toString() === "") {
|
||||
input.focus();
|
||||
}
|
||||
});
|
||||
|
||||
input.addEventListener("keydown", (ev) => {
|
||||
if (ev.key === "Enter") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user