Remote copy button

This commit is contained in:
Natty 2023-10-11 20:09:55 +00:00
parent 45594d6d91
commit 0648b9ff9f
2 changed files with 14 additions and 0 deletions

View File

@ -45,6 +45,7 @@ pin: "Pin to profile"
unpin: "Unpin from profile" unpin: "Unpin from profile"
copyContent: "Copy contents" copyContent: "Copy contents"
copyLink: "Copy link" copyLink: "Copy link"
copyLinkRemote: "Copy remote link"
copyLinkRenote: "Copy renote link" copyLinkRenote: "Copy renote link"
delete: "Delete" delete: "Delete"
deleteAndEdit: "Delete and edit" deleteAndEdit: "Delete and edit"

View File

@ -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: { export function getNoteMenu(props: {
note: Misskey.entities.Note; note: Misskey.entities.Note;
menuButton: Ref<HTMLElement>; menuButton: Ref<HTMLElement>;
@ -273,6 +284,7 @@ export function getNoteMenu(props: {
text: i18n.ts.copyContent, text: i18n.ts.copyContent,
action: copyContent, action: copyContent,
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink)
, getCopyNoteLinkRemoteMenu(appearNote, i18n.ts.copyLinkRemote)
, (appearNote.url || appearNote.uri) ? { , (appearNote.url || appearNote.uri) ? {
icon: 'ti ti-external-link', icon: 'ti ti-external-link',
text: i18n.ts.showOnRemote, text: i18n.ts.showOnRemote,
@ -377,6 +389,7 @@ export function getNoteMenu(props: {
text: i18n.ts.copyContent, text: i18n.ts.copyContent,
action: copyContent, action: copyContent,
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink)
, getCopyNoteLinkRemoteMenu(appearNote, i18n.ts.copyLinkRemote)
, (appearNote.url || appearNote.uri) ? { , (appearNote.url || appearNote.uri) ? {
icon: 'ti ti-external-link', icon: 'ti ti-external-link',
text: i18n.ts.showOnRemote, text: i18n.ts.showOnRemote,