8 changed files with 89 additions and 21 deletions
@ -0,0 +1,18 @@ |
|||||||
|
<script> |
||||||
|
import Tags from '../tags/TagList.svelte'; |
||||||
|
|
||||||
|
let { bookmark } = $props(); |
||||||
|
</script> |
||||||
|
|
||||||
|
{#if bookmark} |
||||||
|
<fieldset class="bookmark"> |
||||||
|
<legend> |
||||||
|
<a href={bookmark.url} target="_blank" class="url">{bookmark.url}</a> |
||||||
|
</legend> |
||||||
|
<legend class="date"> |
||||||
|
{bookmark.timestamp.replace('T',' ')} |
||||||
|
</legend> |
||||||
|
{@html bookmark.comment.rendered} |
||||||
|
<Tags module="bookmark" id={bookmark.id} /> |
||||||
|
</fieldset> |
||||||
|
{/if} |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
<script> |
||||||
|
import { onMount } from 'svelte'; |
||||||
|
|
||||||
|
import Bookmark from './Template.svelte'; |
||||||
|
|
||||||
|
import { api } from '../../urls.svelte.js'; |
||||||
|
import { t } from '../../translations.svelte.js'; |
||||||
|
|
||||||
|
import Editor from '../../Components/MarkdownEditor.svelte'; |
||||||
|
import Template from './Template.svelte'; |
||||||
|
|
||||||
|
let bookmark = $state(null); |
||||||
|
let error = $state(null); |
||||||
|
let { id } = $props(); |
||||||
|
|
||||||
|
async function load(){ |
||||||
|
const url = api(`bookmark/${id}`); |
||||||
|
const resp = await fetch(url,{credentials:'include'}); |
||||||
|
if (resp.ok){ |
||||||
|
bookmark = await resp.json(); |
||||||
|
} else { |
||||||
|
error = await resp.text(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
onMount(load); |
||||||
|
</script> |
||||||
|
|
||||||
|
{#if error} |
||||||
|
<span class="error">{error}</span> |
||||||
|
{/if} |
||||||
|
<Template {bookmark} /> |
||||||
Loading…
Reference in new issue