This commit is contained in:
syuilo 2022-06-18 18:27:47 +09:00 committed by Chloe Kudryavtsev
parent 42e3ddae91
commit a0deecfdee
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 { function onContextmenu(ev: MouseEvent): void {
const isLink = (el: HTMLElement) => { const isLink = (el: HTMLElement) => {
@ -241,12 +241,12 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault(); ev.preventDefault();
react(); react();
} else { } 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 { 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, viaKeyboard,
}).then(focus); }).then(focus);
} }

View file

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

View file

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