Optimize message editor

This commit is contained in:
dtonon 2026-04-27 19:39:38 +01:00
parent 7b79b0914a
commit e94764b865
2 changed files with 10 additions and 10 deletions

View file

@ -357,7 +357,7 @@
onblur={onTextareaBlur} onblur={onTextareaBlur}
aria-autocomplete="list" aria-autocomplete="list"
aria-controls={mentionOpen ? "mention-listbox" : undefined} aria-controls={mentionOpen ? "mention-listbox" : undefined}
class="w-full rounded-t border border-gray-200 px-3 py-2 focus:outline-none focus:ring-1 focus:ring-brand disabled:opacity-50 resize-none {minHeightClass}" class="block w-full rounded-t border border-gray-200 px-3 py-2 focus:outline-none focus:ring-1 focus:ring-brand disabled:opacity-50 resize-y {minHeightClass}"
></textarea> ></textarea>
{#if mentionOpen} {#if mentionOpen}
<div <div

View file

@ -71,9 +71,12 @@
const source = (selectedText ?? post.content).trim(); const source = (selectedText ?? post.content).trim();
if (!source) return; if (!source) return;
const block = formatQuoteBlock(source, ref); const block = formatQuoteBlock(source, ref);
const sep = replyContent.length > 0 && !replyContent.endsWith("\n\n") const sep =
? replyContent.endsWith("\n") ? "\n" : "\n\n" replyContent.length > 0 && !replyContent.endsWith("\n\n")
: ""; ? replyContent.endsWith("\n")
? "\n"
: "\n\n"
: "";
replyContent = replyContent + sep + block + "\n\n"; replyContent = replyContent + sep + block + "\n\n";
await tick(); await tick();
editorEl?.focus({ caretAtEnd: true }); editorEl?.focus({ caretAtEnd: true });
@ -228,11 +231,7 @@
> >
</div> </div>
<div data-quote-post-index={index} id="post-{p.id}" class="scroll-mt-32"> <div data-quote-post-index={index} id="post-{p.id}" class="scroll-mt-32">
<PostContent <PostContent content={p.content} {profiles} {threadEventAuthors} />
content={p.content}
{profiles}
{threadEventAuthors}
/>
</div> </div>
<div class="flex items-center justify-between mt-3"> <div class="flex items-center justify-between mt-3">
<Reactions reactions={[]} zaps={0} /> <Reactions reactions={[]} zaps={0} />
@ -303,7 +302,8 @@
bind:this={editorEl} bind:this={editorEl}
bind:value={replyContent} bind:value={replyContent}
disabled={replying} disabled={replying}
rows={4} rows={8}
minHeightClass="min-h-[12rem]"
placeholder="Write a reply..." placeholder="Write a reply..."
contextPubkeys={allPosts.map((p) => p.pubkey)} contextPubkeys={allPosts.map((p) => p.pubkey)}
{threadEventAuthors} {threadEventAuthors}