From d04ede201ae761565c419c89ff6b87240aa80b41 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Fri, 15 Dec 2023 15:42:15 -0800 Subject: [PATCH] Add "send" button https://github.com/arianne/stendhal/issues/417 --- srcjs/stendhal.css | 2 +- srcjs/stendhal.html | 5 +++-- srcjs/stendhal/ui/component/ChatInputComponent.ts | 10 +++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/srcjs/stendhal.css b/srcjs/stendhal.css index 7d3586d281d..ac63b025408 100644 --- a/srcjs/stendhal.css +++ b/srcjs/stendhal.css @@ -588,7 +588,7 @@ div.logcolR { font-family: Tally; } -.shortcut-launcher { +#send-button, #keywords-button, #emojis-button { margin-left: 2px; } diff --git a/srcjs/stendhal.html b/srcjs/stendhal.html index 9df39a57eb5..4b4dd0dc26e 100644 --- a/srcjs/stendhal.html +++ b/srcjs/stendhal.html @@ -64,8 +64,9 @@
- - + + +
diff --git a/srcjs/stendhal/ui/component/ChatInputComponent.ts b/srcjs/stendhal/ui/component/ChatInputComponent.ts index 3c421c06054..535bfe9d03d 100644 --- a/srcjs/stendhal/ui/component/ChatInputComponent.ts +++ b/srcjs/stendhal/ui/component/ChatInputComponent.ts @@ -45,16 +45,20 @@ export class ChatInputComponent extends Component { this.history = config.getObject("chat.history") || []; this.historyIndex = config.getInt("chat.history.index", 0); + const btn_send = document.getElementById("send-button")!; + btn_send.addEventListener("click", (e) => { + this.send(); + }); + // ** keyword shortcuts ** // - const btn_keyword = document.getElementById("keywords")!; + const btn_keyword = document.getElementById("keywords-button")!; // event to bring up keywords dialog btn_keyword.addEventListener("click", (e) => { this.buildChatOptions(); }); // ** emoji shortcuts ** // - - const btn_emoji = document.getElementById("emojis")!; + const btn_emoji = document.getElementById("emojis-button")!; // clear default text & add emoji image btn_emoji.innerText = ""; // set image for emoji button