mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-05 14:33:09 +02:00
add: copy link to origin note/remote note
Closes transfem-org/Sharkey#40
This commit is contained in:
parent
794dfafbec
commit
0c248a955c
1 changed files with 19 additions and 2 deletions
|
@ -117,6 +117,17 @@ export function getCopyNoteLinkMenu(note: misskey.entities.Note, text: string):
|
|||
};
|
||||
}
|
||||
|
||||
export function getCopyNoteOriginLinkMenu(note: misskey.entities.Note, text: string): MenuItem {
|
||||
return {
|
||||
icon: 'ph-link ph-bold ph-lg',
|
||||
text,
|
||||
action: (): void => {
|
||||
copyToClipboard(note.url ?? note.uri);
|
||||
os.success();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function getNoteMenu(props: {
|
||||
note: Misskey.entities.Note;
|
||||
menuButton: Ref<HTMLElement>;
|
||||
|
@ -281,7 +292,10 @@ export function getNoteMenu(props: {
|
|||
text: i18n.ts.copyContent,
|
||||
action: copyContent,
|
||||
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink)
|
||||
, (appearNote.url || appearNote.uri) ? {
|
||||
, (appearNote.url || appearNote.uri) ?
|
||||
getCopyNoteOriginLinkMenu(appearNote, 'Copy link (Origin)')
|
||||
: undefined,
|
||||
(appearNote.url || appearNote.uri) ? {
|
||||
icon: 'ph-arrow-square-out ph-bold ph-lg',
|
||||
text: i18n.ts.showOnRemote,
|
||||
action: () => {
|
||||
|
@ -391,7 +405,10 @@ export function getNoteMenu(props: {
|
|||
text: i18n.ts.copyContent,
|
||||
action: copyContent,
|
||||
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink)
|
||||
, (appearNote.url || appearNote.uri) ? {
|
||||
, (appearNote.url || appearNote.uri) ?
|
||||
getCopyNoteOriginLinkMenu(appearNote, 'Copy link (Origin)')
|
||||
: undefined,
|
||||
(appearNote.url || appearNote.uri) ? {
|
||||
icon: 'ph-arrow-square-out ph-bold ph-lg',
|
||||
text: i18n.ts.showOnRemote,
|
||||
action: () => {
|
||||
|
|
Loading…
Reference in a new issue