implemented tagging of bookmarks

This commit is contained in:
2025-08-03 14:25:25 +02:00
parent 6de65f3070
commit b041e4e9be
8 changed files with 46 additions and 18 deletions

View File

@@ -111,4 +111,4 @@
{#if editing}
<textarea bind:value={editValue.source} onkeyup={typed} autofocus={!simple}></textarea>
{/if}
<svelte:element this={type} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('double_click_to_edit')} >{@html editValue.rendered}</svelte:element>
<svelte:element this={type} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('long_click_to_edit')} >{@html editValue.rendered}</svelte:element>

View File

@@ -85,7 +85,7 @@
<textarea bind:value={editValue} onkeyup={typed} autofocus></textarea>
{:else}
{#if value}
<svelte:element this={type} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('double_click_to_edit')} >
<svelte:element this={type} {onmousedown} {onmouseup} {ontouchstart} {ontouchend} class={{editable}} title={t('long_click_to_edit')} >
{#each value.split("\n") as line}
{line}<br/>
{/each}

View File

@@ -5,11 +5,18 @@
import { t } from '../../translations.svelte.js';
import Editor from '../../Components/MarkdownEditor.svelte';
import Tags from '../tags/TagList.svelte';
let bookmarks = $state(null);
let comment = $state({source:null,rendered:null});
let error = $state(null);
let link = $state(null);
let bookmarks = $state(null);
let new_bookmark = $state({
comment:{
source:null,
rendered:null
},
tags:[],
url:null
});
let error = $state(null);
async function loadBookmarks(){
const url = api('bookmark/list');
@@ -28,11 +35,13 @@
}
async function onclick(ev){
let data = {
url : link,
comment : comment.source
};
delete new_bookmark.comment.rendered;
const url = api('bookmark/save');
const data = {
comment : new_bookmark.comment.source,
url : new_bookmark.url,
tags : new_bookmark.tags
}
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
@@ -56,12 +65,13 @@
{/if}
<label>
{t('URL')}
<input bind:value={link} />
<input bind:value={new_bookmark.url} />
</label>
<label>
{t('Comment')}
<Editor simple={true} bind:value={comment} />
<Editor simple={true} bind:value={new_bookmark.comment} />
</label>
<Tags module="bookmark" bind:tags={new_bookmark.tags} />
<button {onclick}>{t('save')}</button>
{#if bookmarks}
{#each bookmarks as bookmark}
@@ -73,6 +83,7 @@
{bookmark.timestamp.replace('T',' ')}
</legend>
{bookmark.comment}
<Tags module="bookmark" id={bookmark.id} />
</fieldset>
{/each}
{/if}