非公開ノートには埋め込みコードボタンを出さないように
This commit is contained in:
parent
84c22ed200
commit
0582c264a9
|
@ -156,6 +156,19 @@ export function getCopyNoteLinkMenu(note: Misskey.entities.Note, text: string):
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNoteEmbedCodeMenu(note: Misskey.entities.Note, text: string): MenuItem | undefined {
|
||||||
|
if (note.url != null || note.uri != null) return undefined;
|
||||||
|
if (['specified', 'followers'].includes(note.visibility)) return undefined;
|
||||||
|
|
||||||
|
return {
|
||||||
|
icon: 'ti ti-code',
|
||||||
|
text,
|
||||||
|
action: (): void => {
|
||||||
|
copyEmbedCode('notes', note.id);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function getNoteMenu(props: {
|
export function getNoteMenu(props: {
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
translation: Ref<Misskey.entities.NotesTranslateResponse | null>;
|
translation: Ref<Misskey.entities.NotesTranslateResponse | null>;
|
||||||
|
@ -316,13 +329,7 @@ export function getNoteMenu(props: {
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : {
|
} : getNoteEmbedCodeMenu(appearNote, i18n.ts.copyEmbedCode),
|
||||||
icon: 'ti ti-code',
|
|
||||||
text: i18n.ts.copyEmbedCode,
|
|
||||||
action: () => {
|
|
||||||
copyEmbedCode('notes', appearNote.id);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
...(isSupportShare() ? [{
|
...(isSupportShare() ? [{
|
||||||
icon: 'ti ti-share',
|
icon: 'ti ti-share',
|
||||||
text: i18n.ts.share,
|
text: i18n.ts.share,
|
||||||
|
@ -462,13 +469,7 @@ export function getNoteMenu(props: {
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
} : {
|
} : getNoteEmbedCodeMenu(appearNote, i18n.ts.copyEmbedCode)]
|
||||||
icon: 'ti ti-code',
|
|
||||||
text: i18n.ts.copyEmbedCode,
|
|
||||||
action: () => {
|
|
||||||
copyEmbedCode('notes', appearNote.id);
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
.filter(x => x !== undefined);
|
.filter(x => x !== undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue