Better formatting
This commit is contained in:
parent
9a443a6f36
commit
e368b99775
6 changed files with 111 additions and 38 deletions
|
@ -1,7 +1,15 @@
|
|||
<style>
|
||||
img {
|
||||
max-width: 100px;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
img.only-img {
|
||||
max-width: 450px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
p {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -18,10 +26,20 @@
|
|||
|
||||
<span>
|
||||
{#each contentSplit as line}
|
||||
{#if line && line.type == 'img'}
|
||||
<img src={line.url} alt='Image preview'>
|
||||
{:else}
|
||||
<p>{line}</p>
|
||||
{/if}
|
||||
<p>
|
||||
{#each line as elem}
|
||||
{#if elem && elem.type == 'img'}
|
||||
{#if line.filter(x => x.type == 'img').length < 2}
|
||||
<img src={elem.url} class='only-img' alt='Image preview'>
|
||||
{:else}
|
||||
<img src={elem.url} alt='Image preview'>
|
||||
{/if}
|
||||
{:else if elem.type == 'link'}
|
||||
<a href={elem.url}>{elem.display + ' '}</a>
|
||||
{:else}
|
||||
{elem + ' '}
|
||||
{/if}
|
||||
{/each}
|
||||
</p>
|
||||
{/each}
|
||||
</span>
|
Loading…
Add table
Add a link
Reference in a new issue