diff options
| author | metamuffin <metamuffin@disroot.org> | 2022-09-10 22:50:15 +0200 | 
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2022-09-10 22:50:15 +0200 | 
| commit | 33fe5396ec837c7ddfab32571027f2e43e6b7725 (patch) | |
| tree | c62f6a40a5ff3508f89d3af02892394de081450a /client-web | |
| parent | cce2eba43e19d9d4efbd46fcc160832dede9b67e (diff) | |
| download | keks-meet-33fe5396ec837c7ddfab32571027f2e43e6b7725.tar keks-meet-33fe5396ec837c7ddfab32571027f2e43e6b7725.tar.bz2 keks-meet-33fe5396ec837c7ddfab32571027f2e43e6b7725.tar.zst | |
open chat keybind
Diffstat (limited to 'client-web')
| -rw-r--r-- | client-web/source/chat.ts | 15 | 
1 files changed, 14 insertions, 1 deletions
| diff --git a/client-web/source/chat.ts b/client-web/source/chat.ts index 877a374..bafed73 100644 --- a/client-web/source/chat.ts +++ b/client-web/source/chat.ts @@ -23,7 +23,11 @@ export class Chat extends OverlayUi {          send.onkeydown = (ev) => {              if (ev.code == "Enter") { -                if (send.value.trim().length == 0) return // no! +                if (send.value.trim().length == 0) { +                    // keybind for toggle chat is Enter, so lets close here +                    this.shown = false +                    return +                }                  this.send({ text: send.value })                  send.value = ""              } @@ -45,6 +49,15 @@ export class Chat extends OverlayUi {                  reader.readAsDataURL(blob);              }          } +        document.body.addEventListener("keydown", ev => { +            // TODO is there a proper solution? +            if (ev.target instanceof HTMLInputElement && !(ev.target.type == "button")) return +            if (ev.code == "Enter") { +                this.shown = !this.shown +                if (this.shown) send.focus() +                ev.preventDefault() // so focused buttons dont trigger +            } +        })      }      send(msg: ChatMessage) { | 
