This commit is contained in:
syuilo 2022-06-18 18:27:47 +09:00
parent 2ee931e0c6
commit c97f41c250
3 changed files with 8 additions and 8 deletions

View file

@ -225,7 +225,7 @@ function undoReact(note): void {
});
}
const cullentClipPage = inject<Ref<misskey.entities.Clip>>('cullentClipPage');
const currentClipPage = inject<Ref<misskey.entities.Clip>>('currentClipPage');
function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => {
@ -241,12 +241,12 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault();
react();
} else {
os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, cullentClipPage }), ev).then(focus);
os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClipPage }), ev).then(focus);
}
}
function menu(viaKeyboard = false): void {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, cullentClipPage }), menuButton.value, {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClipPage }), menuButton.value, {
viaKeyboard,
}).then(focus);
}

View file

@ -47,7 +47,7 @@ watch(() => props.clipId, async () => {
immediate: true,
});
provide('cullentClipPage', $$(clip));
provide('currentClipPage', $$(clip));
defineExpose({
[symbols.PAGE_INFO]: computed(() => clip ? {

View file

@ -15,7 +15,7 @@ export function getNoteMenu(props: {
translation: Ref<any>;
translating: Ref<boolean>;
isDeleted: Ref<boolean>;
cullentClipPage?: Ref<misskey.entities.Clip>;
currentClipPage?: Ref<misskey.entities.Clip>;
}) {
const isRenote = (
props.note.renote != null &&
@ -138,7 +138,7 @@ export function getNoteMenu(props: {
});
if (!confirm.canceled) {
os.apiWithDialog('clips/remove-note', { clipId: clip.id, noteId: appearNote.id });
if (props.cullentClipPage?.value.id === clip.id) props.isDeleted.value = true;
if (props.currentClipPage?.value.id === clip.id) props.isDeleted.value = true;
}
} else {
os.alert({
@ -154,7 +154,7 @@ export function getNoteMenu(props: {
}
async function unclip(): Promise<void> {
os.apiWithDialog('clips/remove-note', { clipId: props.cullentClipPage.value.id, noteId: appearNote.id });
os.apiWithDialog('clips/remove-note', { clipId: props.currentClipPage.value.id, noteId: appearNote.id });
props.isDeleted.value = true;
}
@ -198,7 +198,7 @@ export function getNoteMenu(props: {
menu = [
...(
props.cullentClipPage?.value.userId === $i.id ? [{
props.currentClipPage?.value.userId === $i.id ? [{
icon: 'fas fa-circle-minus',
text: i18n.ts.unclip,
danger: true,