From 0fc9ddfe0c0005d3774cd03b31271a31d4a8b737 Mon Sep 17 00:00:00 2001 From: Freeplay Date: Wed, 24 May 2023 14:00:18 -0400 Subject: [PATCH] Add 'View on remote server' to right click menu --- packages/client/src/components/MkNote.vue | 17 ++++++++++++----- packages/client/src/components/MkNoteSub.vue | 19 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index 7d7f0e71e..99c3fe018 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -401,20 +401,20 @@ function onContextmenu(ev: MouseEvent): void { os.pageWindow(notePage(appearNote)); }, }, - { + notePage(appearNote) != location.pathname ? { icon: "ph-arrows-out-simple ph-bold ph-lg", text: i18n.ts.showInPage, action: () => { router.push(notePage(appearNote), "forcePage"); }, - }, + } : undefined, null, { + type: "a", icon: "ph-arrow-square-out ph-bold ph-lg", text: i18n.ts.openInNewTab, - action: () => { - window.open(notePage(appearNote), "_blank"); - }, + href: notePage(appearNote), + target: "_blank", }, { icon: "ph-link-simple ph-bold ph-lg", @@ -423,6 +423,13 @@ function onContextmenu(ev: MouseEvent): void { copyToClipboard(`${url}${notePage(appearNote)}`); }, }, + note.user.host != null ? { + type: "a", + icon: "ph-arrow-square-up-right ph-bold ph-lg", + text: i18n.ts.showOnRemote, + href: note.url ?? note.uri ?? "", + target: "_blank", + } : undefined, ], ev ); diff --git a/packages/client/src/components/MkNoteSub.vue b/packages/client/src/components/MkNoteSub.vue index 77046dcba..72f6473e7 100644 --- a/packages/client/src/components/MkNoteSub.vue +++ b/packages/client/src/components/MkNoteSub.vue @@ -337,7 +337,7 @@ function onContextmenu(ev: MouseEvent): void { } else { os.contextMenu( [ - { + { type: "label", text: notePage(appearNote), }, @@ -348,20 +348,20 @@ function onContextmenu(ev: MouseEvent): void { os.pageWindow(notePage(appearNote)); }, }, - { + notePage(appearNote) != location.pathname ? { icon: "ph-arrows-out-simple ph-bold ph-lg", text: i18n.ts.showInPage, action: () => { router.push(notePage(appearNote), "forcePage"); }, - }, + } : undefined, null, { + type: "a", icon: "ph-arrow-square-out ph-bold ph-lg", text: i18n.ts.openInNewTab, - action: () => { - window.open(notePage(appearNote), "_blank"); - }, + href: notePage(appearNote), + target: "_blank", }, { icon: "ph-link-simple ph-bold ph-lg", @@ -370,6 +370,13 @@ function onContextmenu(ev: MouseEvent): void { copyToClipboard(`${url}${notePage(appearNote)}`); }, }, + note.user.host != null ? { + type: "a", + icon: "ph-arrow-square-up-right ph-bold ph-lg", + text: i18n.ts.showOnRemote, + href: note.url ?? note.uri ?? "", + target: "_blank", + } : undefined, ], ev );