Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Allow preview for empty body in ExtendedTextarea
Merged did:key:z6MkkfM3...sVz5 opened 1 year ago

Instead of disabling the preview feature when the body is empty, we show Nothing to preview

  • Fix the Markdown height during preview in ExtendedTextarea

checkcheck-e2e

👉 Workflow runs 👉 Branch on GitHub

2 files changed +12 -6 3276e5f7 01416e8a
modified src/components/ExtendedTextarea.svelte
@@ -224,13 +224,18 @@
    padding: 0.75rem;
    margin-left: 1px;
    margin-top: 1px;
+
    flex: 1;
  }
</style>

<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
@@ -276,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>
modified src/views/repo/CreateIssue.svelte
@@ -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">