Skip to content

Commit

Permalink
fix: message box pop when sending messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Aug 25, 2024
1 parent 7c8b50a commit 8086d05
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/views/WatchTogether/Lobby.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@
let rows = 1
function sendMessage () {
if (message) {
if (message.trim()) {
state.value.message(message.trim())
message = ''
rows = 1
}
}
function checkInput (e) {
if (e.key === 'Enter' && e.shiftKey === false && message) {
if (e.key === 'Enter' && e.shiftKey === false && message.trim()) {
sendMessage()
e.preventDefault()
} else {
rows = message.split('\n').length || 1
}
Expand All @@ -71,7 +72,7 @@
style='resize: none; min-height: 0 !important'
autocomplete='off'
maxlength='2048'
placeholder='Message' on:keyup={checkInput} />
placeholder='Message' on:keydown={checkInput} />
<button class='btn d-flex mt-auto align-items-center justify-content-center ml-20 border-0 px-0 shadow-none' type='button' use:click={sendMessage} style='height: 3.75rem !important; width: 3.75rem !important;'>
<SendHorizontal size='1.8rem' strokeWidth={2.5} />
</button>
Expand Down

0 comments on commit 8086d05

Please sign in to comment.