Allow preview for empty body in ExtendedTextarea

Instead of disabling the preview feature when the body is empty, we show
`Nothing to preview`
This commit is contained in:
Sebastian Martinez
2024-12-19 14:06:34 +01:00
parent 684a5df136
commit 01416e8aa5
2 changed files with 11 additions and 6 deletions
+6 -5
View File
@@ -231,7 +231,11 @@
<div class="comment-section" aria-label="extended-textarea" class:inline>
{#if preview}
<div class="preview">
<Markdown {rid} breaks content={body} />
{#if body.trim().length === 0}
<span class="txt-missing">Nothing to preview.</span>
{:else}
<Markdown {rid} breaks content={body} />
{/if}
</div>
{:else}
<Textarea
@@ -277,10 +281,7 @@
<Icon name="attachment" />
Attach
</OutlineButton>
<OutlineButton
variant="ghost"
disabled={body.trim() === ""}
onclick={() => (preview = !preview)}>
<OutlineButton variant="ghost" onclick={() => (preview = !preview)}>
<Icon name={preview ? "pen" : "eye"} />
{preview ? "Edit" : "Preview"}
</OutlineButton>
+5 -1
View File
@@ -101,7 +101,11 @@
<div class="content">
{#if preview}
<div class="title">
<InlineTitle content={title} fontSize="medium" />
{#if title.trim().length === 0}
<span class="txt-missing">No title</span>
{:else}
<InlineTitle content={title} fontSize="medium" />
{/if}
</div>
{:else}
<div style:margin-bottom="1rem">