Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Public documents: quick actions & improved sharing (#690)

arch1eafc800aaf3f2
diff --git a/frontend/app/components/Node/Document/HeaderActionRow.vue b/frontend/app/components/Node/Document/HeaderActionRow.vue
index a237518b..e8925e32 100644
--- a/frontend/app/components/Node/Document/HeaderActionRow.vue
+++ b/frontend/app/components/Node/Document/HeaderActionRow.vue
@@ -1,4 +1,6 @@
<template>
+ <AppBtnIcon v-if="isPublic" nav icon="link" :tooltip="t('nodes.actions.copyPublicLink')" @click="copyPublicLink" />
+ <AppBtnIcon v-if="isPublic" nav icon="share" :tooltip="t('nodes.actions.share')" @click="share" />
<AppBtnIcon v-if="doc.accessibility == 3 && !isPublic" nav icon="link" :tooltip="t('nodes.actions.publicLink')" :to="`/doc/${doc.id}`" :blank="true" />
<AppBtnIcon
v-if="nodesPermissionsStore.hasPermissions(doc, 2)"
@@ -35,8 +37,29 @@ const nodesPermissionsStore = useNodesPermissionsStore();
const { t } = useI18nT();
const modals = useModal();
+const notifications = useNotifications();
+const requestUrl = useRequestURL();
+
+const publicUrl = computed(() => `${requestUrl.origin}/doc/${props.doc.id}`);
// Actions
+const copyPublicLink = async () => {
+ try {
+ await navigator.clipboard.writeText(publicUrl.value);
+ notifications.add({ type: 'success', title: t('nodes.notifications.linkCopied') });
+ } catch (e) {
+ notifications.add({ type: 'error', title: t('common.errors.generic'), message: e as string });
+ }
+};
+const share = async () => {
+ // Not every browser exposes the Web Share API (and it needs a secure context): fall back to copying the link.
+ if (!navigator.share) return copyPublicLink();
+ try {
+ await navigator.share({ title: props.doc.name, text: props.doc.description, url: publicUrl.value });
+ } catch {
+ // The user dismissed the share sheet, nothing to report.
+ }
+};
const print = () => window.print();
const openDeleteModal = () =>
modals.add(
diff --git a/frontend/i18n/locales/de/nodes.ts b/frontend/i18n/locales/de/nodes.ts
index 0343c6e0..ce7f9acb 100644
--- a/frontend/i18n/locales/de/nodes.ts
+++ b/frontend/i18n/locales/de/nodes.ts
@@ -1,6 +1,7 @@
export default {
nodes: 'Nodes',
actions: {
+ copyPublicLink: 'Öffentlichen Link kopieren',
editMeta: 'Metadaten bearbeiten',
exportAsMarkdown: 'Als Markdown exportieren',
managePermissions: 'Berechtigungen verwalten',
@@ -8,6 +9,7 @@ export default {
publicLink: 'Öffentlicher Link',
removeFromShared: 'Aus der Freigabe entfernen',
resetBoard: 'Board zurücksetzen',
+ share: 'Teilen',
},
category: {
@@ -110,6 +112,10 @@ export default {
},
},
+ notifications: {
+ linkCopied: 'Link in die Zwischenablage kopiert',
+ },
+
// From the shared_target api (PWA)
share: {
actionChoose: 'Was möchtest du tun?',
diff --git a/frontend/i18n/locales/en/nodes.ts b/frontend/i18n/locales/en/nodes.ts
index a457d4cd..33c6556b 100644
--- a/frontend/i18n/locales/en/nodes.ts
+++ b/frontend/i18n/locales/en/nodes.ts
@@ -1,6 +1,7 @@
export default {
nodes: 'Nodes',
actions: {
+ copyPublicLink: 'Copy public link',
editMeta: 'Edit metadata',
exportAsMarkdown: 'Export as Markdown',
managePermissions: 'Manage permissions',
@@ -8,6 +9,7 @@ export default {
publicLink: 'Public link',
removeFromShared: 'Remove from shared',
resetBoard: 'Reset board',
+ share: 'Share',
},
category: {
@@ -110,6 +112,10 @@ export default {
},
},
+ notifications: {
+ linkCopied: 'Link copied to clipboard',
+ },
+
// From the shared_target api (PWA)
share: {
actionChoose: 'What do you want to do?',
diff --git a/frontend/i18n/locales/fr/nodes.ts b/frontend/i18n/locales/fr/nodes.ts
index 26a57d93..2db2c1de 100644
--- a/frontend/i18n/locales/fr/nodes.ts
+++ b/frontend/i18n/locales/fr/nodes.ts
@@ -1,6 +1,7 @@
export default {
nodes: 'Nœuds',
actions: {
+ copyPublicLink: 'Copier le lien public',
editMeta: 'Modifier les métadonnées',
exportAsMarkdown: 'Exporter en Markdown',
managePermissions: 'Gérer les permissions',
@@ -8,6 +9,7 @@ export default {
publicLink: 'Lien public',
removeFromShared: 'Retirer du partage',
resetBoard: 'Réinitialiser le tableau',
+ share: 'Partager',
},
category: {
@@ -110,6 +112,10 @@ export default {
},
},
+ notifications: {
+ linkCopied: 'Lien copié dans le presse-papiers',
+ },
+
// From the shared_target api (PWA)
share: {
actionChoose: 'Que voulez-vous faire ?',
diff --git a/frontend/i18n/locales/it/nodes.ts b/frontend/i18n/locales/it/nodes.ts
index e248706c..a9add596 100644
--- a/frontend/i18n/locales/it/nodes.ts
+++ b/frontend/i18n/locales/it/nodes.ts
@@ -1,6 +1,7 @@
export default {
nodes: 'Nodi',
actions: {
+ copyPublicLink: 'Copia link pubblico',
editMeta: 'Modifica metadati',
exportAsMarkdown: 'Esporta come Markdown',
managePermissions: 'Gestisci permessi',
@@ -8,6 +9,7 @@ export default {
publicLink: 'Link pubblico',
removeFromShared: 'Rimuovi dai condivisi',
resetBoard: 'Ripristina lavagna',
+ share: 'Condividi',
},
category: {
@@ -110,6 +112,10 @@ export default {
},
},
+ notifications: {
+ linkCopied: 'Link copiato negli appunti',
+ },
+
// From the shared_target api (PWA)
share: {
actionChoose: 'Cosa vuoi fare?',
diff --git a/frontend/i18n/locales/ko/nodes.ts b/frontend/i18n/locales/ko/nodes.ts
index 024e171f..efb26e92 100644
--- a/frontend/i18n/locales/ko/nodes.ts
+++ b/frontend/i18n/locales/ko/nodes.ts
@@ -1,6 +1,7 @@
export default {
nodes: '노드',
actions: {
+ copyPublicLink: '공개 링크 복사',
editMeta: '메타데이터 편집',
exportAsMarkdown: '마크다운으로 내보내기',
managePermissions: '권한 관리',
@@ -8,6 +9,7 @@ export default {
publicLink: '공개 링크',
removeFromShared: '공유에서 제거',
resetBoard: '보드 초기화',
+ share: '공유',
},
category: {
@@ -109,6 +111,10 @@ export default {
},
},
+ notifications: {
+ linkCopied: '링크가 클립보드에 복사되었습니다',
+ },
+
// From the shared_target api (PWA)
share: {
actionChoose: '무엇을 하시겠습니까?',
diff --git a/frontend/i18n/locales/uk/nodes.ts b/frontend/i18n/locales/uk/nodes.ts
index 68005aa9..0be4c2c0 100644
--- a/frontend/i18n/locales/uk/nodes.ts
+++ b/frontend/i18n/locales/uk/nodes.ts
@@ -1,6 +1,7 @@
export default {
nodes: 'Вузли',
actions: {
+ copyPublicLink: 'Копіювати публічне посилання',
editMeta: 'Редагувати метадані',
exportAsMarkdown: 'Експортувати як Markdown',
managePermissions: 'Керувати правами доступу',
@@ -8,6 +9,7 @@ export default {
publicLink: 'Публічне посилання',
removeFromShared: 'Вилучити зі спільного доступу',
resetBoard: 'Скинути дошку',
+ share: 'Поділитися',
},
category: {
@@ -110,6 +112,10 @@ export default {
},
},
+ notifications: {
+ linkCopied: 'Посилання скопійовано в буфер обміну',
+ },
+
// From the shared_target api (PWA)
share: {
actionChoose: 'Що ви хочете зробити?',