Only send message when enter is pressed with ctrl/cmd

This commit is contained in:
Jonathan Staab 2022-12-23 13:38:31 -08:00
parent 34db1df405
commit f5aae29582
2 changed files with 10 additions and 4 deletions

View File

@ -112,7 +112,13 @@
})
</script>
<svelte:body on:keydown={e => e.key === 'Escape' && modal.set(null)} />
<svelte:body
on:keydown={e => {
if (e.key === 'Escape') {
modal.set(null)
menuIsOpen.set(false)
}
}} />
<Router {url}>
<div use:links class="h-full">

View File

@ -91,8 +91,8 @@
}
}
const onReplyKeyPress = e => {
if (e.key === 'Enter' && !e.shiftKey) {
const onReplyKeyDown = e => {
if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
sendReply()
}
@ -170,7 +170,7 @@
autofocus
placeholder="Type something..."
bind:value={reply}
on:keypress={onReplyKeyPress}
on:keydown={onReplyKeyDown}
class="w-full p-2 text-white bg-medium
placeholder:text-light outline-0 resize-none" />
<div