improved file module GUI: now pushing a notification when markdown was copied
All checks were successful
Build Docker Image / Docker-Build (push) Successful in 2m31s
Build Docker Image / Clean-Registry (push) Successful in 1s

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-01-16 15:48:56 +01:00
parent 968e5bfb95
commit cf485055a6
4 changed files with 12 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router'; import { useTinyRouter } from 'svelte-tiny-router';
import { api } from '../../urls.svelte'; import { api } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte'; import { error, warn, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte'; import { t } from '../../translations.svelte';
import { user } from '../../user.svelte'; import { user } from '../../user.svelte';
@@ -95,7 +95,7 @@
path = p; path = p;
if (p == '/'){ if (p == '/'){
children.dirs = [ children.dirs = [
{ path : `/user/${user.id}`, name : t('my_files') }, { path : `/user/${user.id}`, name : t('my files') },
{ path : '/project', name : t('projects')}, { path : '/project', name : t('projects')},
{ path : '/company', name : t('companies')}, { path : '/company', name : t('companies')},
] ]
@@ -114,13 +114,16 @@
error(res); error(res);
} }
} }
console.log(children);
} }
function markdown(file){ function markdown(file){
let parts = file.split('/'); let parts = file.split('/');
let md = `![${parts.pop()}](/api/files${file})`; let path = `/api/files${file}`;
path = encodeURI(path);
let md = `![${parts.pop()}](${path})`;
navigator.clipboard.writeText(md); navigator.clipboard.writeText(md);
warn(t('Markdown has been copied to clipboard!'));
setTimeout(yikes, 2500);
} }
function onclick(ev){ function onclick(ev){

View File

@@ -15,5 +15,5 @@ export async function warn(msg){
export function yikes(){ export function yikes(){
messages.error = null; messages.error = null;
messages.warn = null; messages.warning = null;
} }

View File

@@ -173,6 +173,7 @@
"logout_user": "{user} abmelden", "logout_user": "{user} abmelden",
"markdown_code": "Markdown-Code", "markdown_code": "Markdown-Code",
"Markdown has been copied to clipboard!": "Markdown wurde in die Zwischenablage kopiert!",
"markdown_supported": "Markdown & <a target=\"_blank\" href=\"https://plantuml.com\">Plantuml</a> nutzbar!", "markdown_supported": "Markdown & <a target=\"_blank\" href=\"https://plantuml.com\">Plantuml</a> nutzbar!",
"MANAGE_LOGIN_SERVICES": "Login-Services verwalten", "MANAGE_LOGIN_SERVICES": "Login-Services verwalten",
"member": "Mitarbeiter", "member": "Mitarbeiter",
@@ -205,6 +206,7 @@
"month": "Monat", "month": "Monat",
"move_to_top": "nach ganz oben bewegen", "move_to_top": "nach ganz oben bewegen",
"must_not_be_empty": "darf nicht leer sein", "must_not_be_empty": "darf nicht leer sein",
"my files": "Meine Dateien",
"name": "Name", "name": "Name",
"net_price": "Nettopreis", "net_price": "Nettopreis",

View File

@@ -173,6 +173,7 @@
"logout_user": "logout {user}", "logout_user": "logout {user}",
"markdown_code": "Markdown-Code", "markdown_code": "Markdown-Code",
"Markdown has been copied to clipboard!": "Markdown has been copied to clipboard!",
"markdown_supported": "Markdown & <a target=\"_blank\" href=\"https://plantuml.com\">Plantuml</a> supported!", "markdown_supported": "Markdown & <a target=\"_blank\" href=\"https://plantuml.com\">Plantuml</a> supported!",
"MANAGE_LOGIN_SERVICES": "manage login services", "MANAGE_LOGIN_SERVICES": "manage login services",
"member": "member", "member": "member",
@@ -205,6 +206,7 @@
"month": "month", "month": "month",
"move_to_top": "move to top level", "move_to_top": "move to top level",
"must_not_be_empty": "must not be empty", "must_not_be_empty": "must not be empty",
"my files": "my files",
"name": "Name", "name": "Name",
"net_price": "net price", "net_price": "net price",