enhance: 既に入力されている内容がある場合に上書き警告を出すように

This commit is contained in:
yukineko 2024-04-18 19:42:11 +09:00 committed by mattyatea
parent e4cc3a5ab3
commit d7c5f31191
1 changed files with 11 additions and 0 deletions

View File

@ -775,6 +775,15 @@ function chooseDraft() {
}, {
selected: async (res) => {
const draft = await res as noteDrafts.NoteDraft;
if (text.value !== '' || files.value.length > 0) {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.draftOverwriteConfirm,
});
if (canceled) return;
}
applyDraft(draft);
},
}, 'closed');
@ -786,12 +795,14 @@ async function applyDraft(draft: noteDrafts.NoteDraft, native = false) {
case 'quote': {
await os.apiWithDialog('notes/show', { noteId: draft.auxId as string }).then(note => {
renote.value = note;
reply.value = undefined;
});
break;
}
case 'reply': {
await os.apiWithDialog('notes/show', { noteId: draft.auxId as string }).then(note => {
reply.value = note;
renote.value = undefined;
});
break;
}