Apply custom spacing to paragraphs
This commit is contained in:
parent
c73b0f0c78
commit
8f0b66589e
1 changed files with 19 additions and 8 deletions
|
|
@ -277,15 +277,17 @@
|
||||||
>{formatDate(p.createdAt)}</span
|
>{formatDate(p.createdAt)}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="prose leading-5 max-w-none text-gray-700">
|
<div
|
||||||
{#each p.content.split("\n\n") as para}
|
class="prose leading-5 max-w-none text-gray-700 [&_p]:my-3 [&_img]:my-3"
|
||||||
|
>
|
||||||
|
{#each p.content.split(/\n{2,}/) as para}
|
||||||
{#each tokenize(para) as block}
|
{#each tokenize(para) as block}
|
||||||
{#if block.type === "image"}
|
{#if block.type === "image"}
|
||||||
<img
|
<img
|
||||||
src={block.value}
|
src={block.value}
|
||||||
alt=""
|
alt=""
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
class="block mx-auto w-full max-h-[80vh] object-contain rounded my-3"
|
class="block mx-auto w-full max-h-[80vh] object-contain rounded"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -296,22 +298,26 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="text-brand hover:underline break-all"
|
class="text-brand hover:underline break-all"
|
||||||
>{inline.label}</a>
|
>{inline.label}</a
|
||||||
|
>
|
||||||
{:else if inline.type === "mention"}
|
{:else if inline.type === "mention"}
|
||||||
{@const u = profiles[inline.pubkey] ?? resolvedUsers[inline.pubkey]}
|
{@const u =
|
||||||
|
profiles[inline.pubkey] ?? resolvedUsers[inline.pubkey]}
|
||||||
<a
|
<a
|
||||||
href="https://njump.me/{inline.entity}"
|
href="https://njump.me/{inline.entity}"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="text-brand hover:underline"
|
class="text-brand hover:underline"
|
||||||
>@{u?.shortName ?? inline.fallback}</a>
|
>@{u?.shortName ?? inline.fallback}</a
|
||||||
|
>
|
||||||
{:else if inline.type === "entity"}
|
{:else if inline.type === "entity"}
|
||||||
<a
|
<a
|
||||||
href="https://njump.me/{inline.entity}"
|
href="https://njump.me/{inline.entity}"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="text-brand hover:underline break-all"
|
class="text-brand hover:underline break-all"
|
||||||
>{inline.label}</a>
|
>{inline.label}</a
|
||||||
|
>
|
||||||
{:else}{inline.value}{/if}
|
{:else}{inline.value}{/if}
|
||||||
{/each}
|
{/each}
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -398,7 +404,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ThreadScrubber posts={allPosts} {postEls} topOffset={opTopOffset} bind:visible={scrubberVisible} />
|
<ThreadScrubber
|
||||||
|
posts={allPosts}
|
||||||
|
{postEls}
|
||||||
|
topOffset={opTopOffset}
|
||||||
|
bind:visible={scrubberVisible}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="py-12 text-center text-gray-400">Loading…</div>
|
<div class="py-12 text-center text-gray-400">Loading…</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue