implemented storing of bookmarks

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-08-02 22:48:49 +02:00
parent d1b8d1a062
commit 61b5a6ffbb
10 changed files with 130 additions and 5 deletions

View File

@@ -0,0 +1,43 @@
<script>
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
import Editor from '../../Components/MarkdownEditor.svelte';
let comment = $state({source:null,rendered:null});
let error = $state(null);
let link = $state(null);
async function onclick(ev){
let data = {
url : link,
comment : comment.source
};
const url = api('bookmark/save');
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
if (resp.ok) {
} else {
error = await resp.text();
}
}
</script>
<fieldset>
<legend>{t('Bookmarks')}</legend>
{#if error}
<span class="error">{error}</span>
{/if}
<label>
{t('URL')}
<input bind:value={link} />
</label>
<label>
{t('Comment')}
<Editor simple={true} bind:value={comment} />
</label>
<button {onclick}>{t('save')}</button>
</fieldset>