diff --git a/frontend/src/routes/files/Index.svelte b/frontend/src/routes/files/Index.svelte index 5b69a2bd..28e63107 100644 --- a/frontend/src/routes/files/Index.svelte +++ b/frontend/src/routes/files/Index.svelte @@ -2,7 +2,7 @@ import { onMount } from 'svelte'; import { useTinyRouter } from 'svelte-tiny-router'; import { api } from '../../urls.svelte'; - import { error, yikes } from '../../warn.svelte'; + import { error, warn, yikes } from '../../warn.svelte'; import { t } from '../../translations.svelte'; import { user } from '../../user.svelte'; @@ -95,7 +95,7 @@ path = p; if (p == '/'){ children.dirs = [ - { path : `/user/${user.id}`, name : t('my_files') }, + { path : `/user/${user.id}`, name : t('my files') }, { path : '/project', name : t('projects')}, { path : '/company', name : t('companies')}, ] @@ -114,13 +114,16 @@ error(res); } } - console.log(children); } function markdown(file){ 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); + warn(t('Markdown has been copied to clipboard!')); + setTimeout(yikes, 2500); } function onclick(ev){ diff --git a/frontend/src/warn.svelte.js b/frontend/src/warn.svelte.js index 176b350f..41aaf2a4 100644 --- a/frontend/src/warn.svelte.js +++ b/frontend/src/warn.svelte.js @@ -15,5 +15,5 @@ export async function warn(msg){ export function yikes(){ messages.error = null; - messages.warn = null; + messages.warning = null; } diff --git a/translations/src/main/resources/de.json b/translations/src/main/resources/de.json index 3c0e211b..f0ef8317 100644 --- a/translations/src/main/resources/de.json +++ b/translations/src/main/resources/de.json @@ -173,6 +173,7 @@ "logout_user": "{user} abmelden", "markdown_code": "Markdown-Code", + "Markdown has been copied to clipboard!": "Markdown wurde in die Zwischenablage kopiert!", "markdown_supported": "Markdown & Plantuml nutzbar!", "MANAGE_LOGIN_SERVICES": "Login-Services verwalten", "member": "Mitarbeiter", @@ -205,6 +206,7 @@ "month": "Monat", "move_to_top": "nach ganz oben bewegen", "must_not_be_empty": "darf nicht leer sein", + "my files": "Meine Dateien", "name": "Name", "net_price": "Nettopreis", diff --git a/translations/src/main/resources/en.json b/translations/src/main/resources/en.json index aa45cbe0..0f3ead01 100644 --- a/translations/src/main/resources/en.json +++ b/translations/src/main/resources/en.json @@ -173,6 +173,7 @@ "logout_user": "logout {user}", "markdown_code": "Markdown-Code", + "Markdown has been copied to clipboard!": "Markdown has been copied to clipboard!", "markdown_supported": "Markdown & Plantuml supported!", "MANAGE_LOGIN_SERVICES": "manage login services", "member": "member", @@ -205,6 +206,7 @@ "month": "month", "move_to_top": "move to top level", "must_not_be_empty": "must not be empty", + "my files": "my files", "name": "Name", "net_price": "net price",