Skip to content

Commit

Permalink
Add "send" button
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Dec 15, 2023
1 parent 68204fa commit d04ede2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion srcjs/stendhal.css
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ div.logcolR {
font-family: Tally;
}

.shortcut-launcher {
#send-button, #keywords-button, #emojis-button {
margin-left: 2px;
}

Expand Down
5 changes: 3 additions & 2 deletions srcjs/stendhal.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@
<div id="bottomPanel" class="mainColumn">
<div class="horizontalgroup">
<input id="chatinput" type="text" name="chatinput" autocomplete="off" autofocus>
<button id="keywords" class="shortcut-launcher">Hi!</button>
<button id="emojis" class="shortcut-launcher">emoji</button>
<button id="send-button">send</button>
<button id="keywords-button">Hi!</button>
<button id="emojis-button">emoji</button>
</div>
<div id="chat"></div>
</div>
Expand Down
10 changes: 7 additions & 3 deletions srcjs/stendhal/ui/component/ChatInputComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d04ede2

Please sign in to comment.