chore(frontend): fix type errors
This commit is contained in:
parent
288f0abeac
commit
c4fdf5a47c
|
@ -6,9 +6,9 @@
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
|
||||||
export interface PostFormProps {
|
export interface PostFormProps {
|
||||||
reply?: Misskey.entities.Note;
|
reply?: Misskey.entities.Note | null;
|
||||||
renote?: Misskey.entities.Note;
|
renote?: Misskey.entities.Note | null;
|
||||||
channel?: Misskey.entities.Channel; // TODO
|
channel?: Misskey.entities.Channel | null; // TODO
|
||||||
mention?: Misskey.entities.User;
|
mention?: Misskey.entities.User;
|
||||||
specified?: Misskey.entities.UserDetailed;
|
specified?: Misskey.entities.UserDetailed;
|
||||||
initialText?: string;
|
initialText?: string;
|
||||||
|
|
|
@ -180,6 +180,7 @@ export function getNoteMenu(props: {
|
||||||
currentClip?: Misskey.entities.Clip;
|
currentClip?: Misskey.entities.Clip;
|
||||||
}) {
|
}) {
|
||||||
const appearNote = getAppearNote(props.note);
|
const appearNote = getAppearNote(props.note);
|
||||||
|
const link = appearNote.url ?? appearNote.uri;
|
||||||
|
|
||||||
const cleanups = [] as (() => void)[];
|
const cleanups = [] as (() => void)[];
|
||||||
|
|
||||||
|
@ -189,6 +190,7 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.noteDeleteConfirm,
|
text: i18n.ts.noteDeleteConfirm,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
if ($i == null) return;
|
||||||
|
|
||||||
misskeyApi('notes/delete', {
|
misskeyApi('notes/delete', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
|
@ -208,6 +210,7 @@ export function getNoteMenu(props: {
|
||||||
text: i18n.ts.deleteAndEditConfirm,
|
text: i18n.ts.deleteAndEditConfirm,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
if ($i == null) return;
|
||||||
|
|
||||||
misskeyApi('notes/delete', {
|
misskeyApi('notes/delete', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
|
@ -317,22 +320,25 @@ export function getNoteMenu(props: {
|
||||||
action: copyContent,
|
action: copyContent,
|
||||||
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink));
|
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink));
|
||||||
|
|
||||||
if (appearNote.url || appearNote.uri) {
|
if (link) {
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
icon: 'ti ti-link',
|
icon: 'ti ti-link',
|
||||||
text: i18n.ts.copyRemoteLink,
|
text: i18n.ts.copyRemoteLink,
|
||||||
action: () => {
|
action: () => {
|
||||||
copyToClipboard(appearNote.url ?? appearNote.uri);
|
copyToClipboard(link);
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.showOnRemote,
|
text: i18n.ts.showOnRemote,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
window.open(link, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
menuItems.push(getNoteEmbedCodeMenu(appearNote, i18n.ts.embed));
|
const embedMenu = getNoteEmbedCodeMenu(appearNote, i18n.ts.embed);
|
||||||
|
if (embedMenu != null) {
|
||||||
|
menuItems.push(embedMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSupportShare()) {
|
if (isSupportShare()) {
|
||||||
|
@ -475,22 +481,25 @@ export function getNoteMenu(props: {
|
||||||
action: copyContent,
|
action: copyContent,
|
||||||
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink));
|
}, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink));
|
||||||
|
|
||||||
if (appearNote.url || appearNote.uri) {
|
if (link != null) {
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
icon: 'ti ti-link',
|
icon: 'ti ti-link',
|
||||||
text: i18n.ts.copyRemoteLink,
|
text: i18n.ts.copyRemoteLink,
|
||||||
action: () => {
|
action: () => {
|
||||||
copyToClipboard(appearNote.url ?? appearNote.uri);
|
copyToClipboard(link);
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
icon: 'ti ti-external-link',
|
icon: 'ti ti-external-link',
|
||||||
text: i18n.ts.showOnRemote,
|
text: i18n.ts.showOnRemote,
|
||||||
action: () => {
|
action: () => {
|
||||||
window.open(appearNote.url ?? appearNote.uri, '_blank', 'noopener');
|
window.open(link, '_blank', 'noopener');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
menuItems.push(getNoteEmbedCodeMenu(appearNote, i18n.ts.embed));
|
const embedMenu = getNoteEmbedCodeMenu(appearNote, i18n.ts.embed);
|
||||||
|
if (embedMenu != null) {
|
||||||
|
menuItems.push(embedMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -625,7 +634,7 @@ export function getRenoteMenu(props: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}, (props.mock) ? undefined : {
|
}, ...(props.mock ? [] : [{
|
||||||
text: i18n.ts.quote,
|
text: i18n.ts.quote,
|
||||||
icon: 'ti ti-quote',
|
icon: 'ti ti-quote',
|
||||||
action: () => {
|
action: () => {
|
||||||
|
@ -633,7 +642,7 @@ export function getRenoteMenu(props: {
|
||||||
renote: appearNote,
|
renote: appearNote,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}]);
|
}])]);
|
||||||
|
|
||||||
normalExternalChannelRenoteItems.push({
|
normalExternalChannelRenoteItems.push({
|
||||||
type: 'parent',
|
type: 'parent',
|
||||||
|
|
Loading…
Reference in New Issue