From 0648b9ff9fb1d7f2eac7489243ef26360eec83a2 Mon Sep 17 00:00:00 2001 From: Natty Date: Wed, 11 Oct 2023 20:09:55 +0000 Subject: [PATCH] Remote copy button --- locales/en-US.yml | 1 + packages/frontend/src/scripts/get-note-menu.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/locales/en-US.yml b/locales/en-US.yml index 09fd726c9..7ad0e50a9 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -45,6 +45,7 @@ pin: "Pin to profile" unpin: "Unpin from profile" copyContent: "Copy contents" copyLink: "Copy link" +copyLinkRemote: "Copy remote link" copyLinkRenote: "Copy renote link" delete: "Delete" deleteAndEdit: "Delete and edit" diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index d0753872f..3cf39812e 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -118,6 +118,17 @@ export function getCopyNoteLinkMenu(note: misskey.entities.Note, text: string): }; } +export function getCopyNoteLinkRemoteMenu(note: misskey.entities.Note, text: string): MenuItem { + return note.url ? { + icon: 'ti ti-link', + text, + action: (): void => { + copyToClipboard(note.url); + os.success(); + }, + } : undefined; +} + export function getNoteMenu(props: { note: Misskey.entities.Note; menuButton: Ref; @@ -273,6 +284,7 @@ export function getNoteMenu(props: { text: i18n.ts.copyContent, action: copyContent, }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) + , getCopyNoteLinkRemoteMenu(appearNote, i18n.ts.copyLinkRemote) , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, @@ -377,6 +389,7 @@ export function getNoteMenu(props: { text: i18n.ts.copyContent, action: copyContent, }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) + , getCopyNoteLinkRemoteMenu(appearNote, i18n.ts.copyLinkRemote) , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote,