From 56ac2631b5fe92dc056016947a3476f774a0c057 Mon Sep 17 00:00:00 2001 From: Xylight <80978739+Xyphyn@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:19:19 -0700 Subject: [PATCH] fix: use inline reply editor for comments (#590) --- .../components/lemmy/comment/Comment.svelte | 114 +++++++----------- 1 file changed, 45 insertions(+), 69 deletions(-) diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index 0f6ff6f5..fbc66b33 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -8,13 +8,14 @@ import { t } from '$lib/i18n/translations' import { getClient } from '$lib/lemmy.svelte.js' import { errorMessage } from '$lib/lemmy/error' - import { Button, Material, Modal, toast } from 'mono-svelte' + import { Button, Modal, toast } from 'mono-svelte' import { Bookmark, Icon, Microphone, Pencil, Trash } from 'svelte-hero-icons' + import { expoOut } from 'svelte/easing' import type { ClassValue } from 'svelte/elements' + import { slide } from 'svelte/transition' import ShieldIcon from '../moderation/ShieldIcon.svelte' import CommentForm from './CommentForm.svelte' import type { CommentNodeI } from './comments.svelte' - import CommentItem from './CommentItem.svelte' interface Props { node: CommentNodeI @@ -85,38 +86,11 @@ }, 500) -{#if editing || replying} - replying || editing, - v => { - replying = v - editing = v - } - } - > +{#if editing} + {#snippet customTitle()} -
{replying ? $t('comment.reply') : $t('form.edit')}
+
{$t('form.edit')}
{/snippet} - {#if replying} - - - - -
-
- {/if}
{ e.preventDefault() @@ -124,43 +98,22 @@ }} class="contents" > - {#if replying} - { - node.children = [ - { - children: [], - comment_view: e.comment_view, - depth: node.depth + 1, - expanded: true, - }, - ...node.children, - ] - replying = false - }} - oncancel={() => (replying = false)} - /> - {:else if editing} - - - {/if} + +
{/if} @@ -250,6 +203,29 @@ /> {/if} + + {#if replying} +
+ { + node.children = [ + { + children: [], + comment_view: e.comment_view, + depth: node.depth + 1, + expanded: true, + }, + ...node.children, + ] + replying = false + }} + oncancel={() => (replying = false)} + /> +
+ {/if}
{@render children?.()}