diff --git a/src/lib/components/channel/Channel.svelte b/src/lib/components/channel/Channel.svelte index 776f5605f..e83e37c08 100644 --- a/src/lib/components/channel/Channel.svelte +++ b/src/lib/components/channel/Channel.svelte @@ -94,12 +94,18 @@ } } else if (type === 'message:delete') { messages = messages.filter((message) => message.id !== data.id); + } else if (type === 'message:reply') { + const idx = messages.findIndex((message) => message.id === data.id); + + if (idx !== -1) { + messages[idx] = data; + } } else if (type.includes('message:reaction')) { const idx = messages.findIndex((message) => message.id === data.id); if (idx !== -1) { messages[idx] = data; } - } else if (type === 'typing') { + } else if (type === 'typing' && event.message_id === null) { if (event.user.id === $user.id) { return; } @@ -242,6 +248,7 @@
{ window.setTimeout(() => { - const chatInput = document.getElementById('chat-input'); + const chatInput = document.getElementById(`chat-input-${id}`); chatInput?.focus(); }, 0); @@ -373,7 +375,7 @@ recording = false; await tick(); - document.getElementById('chat-input')?.focus(); + document.getElementById(`chat-input-${id}`)?.focus(); }} on:confirm={async (e) => { const { text, filename } = e.detail; @@ -381,7 +383,7 @@ recording = false; await tick(); - document.getElementById('chat-input')?.focus(); + document.getElementById(`chat-input-${id}`)?.focus(); }} /> {:else} @@ -478,61 +480,21 @@
- {#if $settings?.richTextInput ?? true} -
- 0 || - navigator.msMaxTouchPoints > 0 - )} - {placeholder} - largeTextAsFile={$settings?.largeTextAsFile ?? false} - on:keydown={async (e) => { - e = e.detail.event; - const isCtrlPressed = e.ctrlKey || e.metaKey; // metaKey is for Cmd key on Mac - if ( - !$mobile || - !( - 'ontouchstart' in window || - navigator.maxTouchPoints > 0 || - navigator.msMaxTouchPoints > 0 - ) - ) { - // Prevent Enter key from creating a new line - // Uses keyCode '13' for Enter key for chinese/japanese keyboards - if (e.keyCode === 13 && !e.shiftKey) { - e.preventDefault(); - } - - // Submit the content when Enter key is pressed - if (content !== '' && e.keyCode === 13 && !e.shiftKey) { - submitHandler(); - } - } - - if (e.key === 'Escape') { - console.log('Escape'); - } - }} - on:paste={async (e) => { - e = e.detail.event; - console.log(e); - }} - /> -
- {:else} -