frontend: initial multi-line support

This commit is contained in:
hippoz 2022-05-07 16:50:04 +03:00
parent d1654546fa
commit 97d155667d
Signed by: hippoz
GPG key ID: 7C52899193467641
2 changed files with 11 additions and 6 deletions

View file

@ -28,6 +28,7 @@
.message-content { .message-content {
color: var(--foreground-color-2); color: var(--foreground-color-2);
white-space: pre-wrap;
} }
.pending { .pending {

View file

@ -44,10 +44,14 @@
}; };
const onKeydown = async (e) => { const onKeydown = async (e) => {
if (e.code !== "Enter") if (e.code === "Enter") {
if (e.shiftKey) {
return; return;
} else {
e.preventDefault();
await sendMessage(); await sendMessage();
}
}
}; };
</script> </script>
@ -82,13 +86,13 @@
</style> </style>
<div class="message-input-container"> <div class="message-input-container">
<input <textarea
placeholder={`Send something interesting to #${channel.name}`} placeholder={`Send something interesting to #${channel.name}`}
type="text" type="text"
class="message-input" class="message-input"
on:keydown={ onKeydown } on:keydown={ onKeydown }
bind:value={ messageInput } bind:value={ messageInput }
> />
{#if $smallViewport} {#if $smallViewport}
<button class="icon-button send-button" on:click="{ sendMessage }"> <button class="icon-button send-button" on:click="{ sendMessage }">
<SendIcon /> <SendIcon />