diff --git a/src/lib/components/lemmy/post/PostBody.svelte b/src/lib/components/lemmy/post/PostBody.svelte index a9a9b177..6a6f7b02 100644 --- a/src/lib/components/lemmy/post/PostBody.svelte +++ b/src/lib/components/lemmy/post/PostBody.svelte @@ -6,16 +6,22 @@ export let body: string export let view: View = 'cozy' - let overflows = false let expanded = false + let element: Element - function isOverflown(element: Element) { - overflows = + function isOverflown(element: Element, body: string = '') { + if (!element) return + let overflows = element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth if (!overflows) expanded = true + else expanded = false + + return overflows } + + $: overflows = isOverflown(element, body)
{#if overflows} diff --git a/src/lib/components/lemmy/post/PostVote.svelte b/src/lib/components/lemmy/post/PostVote.svelte index 19167377..76206983 100644 --- a/src/lib/components/lemmy/post/PostVote.svelte +++ b/src/lib/components/lemmy/post/PostVote.svelte @@ -77,26 +77,28 @@ {/key} -
- + > + + + {#key downvotes} + + + + {/key} + + + {/if}