mirror of
https://github.com/esphome/esp-web-tools.git
synced 2025-07-23 11:46:41 +00:00
Console updates (#99)
This commit is contained in:
parent
971453d8a9
commit
eb4ebfa17b
@ -126,14 +126,18 @@ export class EwtConsole extends HTMLElement {
|
|||||||
<form>
|
<form>
|
||||||
>
|
>
|
||||||
<input autofocus>
|
<input autofocus>
|
||||||
<button type="button">Send</button>
|
|
||||||
</form>
|
</form>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
this._console = new ColoredConsole(this.shadowRoot!.querySelector("div")!);
|
this._console = new ColoredConsole(this.shadowRoot!.querySelector("div")!);
|
||||||
const input = this.shadowRoot!.querySelector("input")!;
|
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) => {
|
input.addEventListener("keydown", (ev) => {
|
||||||
if (ev.key === "Enter") {
|
if (ev.key === "Enter") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user