This commit is contained in:
tai-cha 2025-06-25 02:28:22 +09:00
parent a48dbcb188
commit a6bc5ef0fa
4 changed files with 12 additions and 41 deletions

8
locales/index.d.ts vendored
View File

@ -166,10 +166,6 @@ export interface Locale extends ILocale {
*
*/
"save": string;
/**
*
*/
"dontSave": string;
/**
*
*/
@ -12252,9 +12248,9 @@ export interface Locale extends ILocale {
*/
"cannotCreateDraftAnymore": string;
/**
*
*
*/
"cannotCreateDraftAnymoreDescription": string;
"cannotCreateDraftOfRenote": string;
/**
*
*/

View File

@ -37,7 +37,6 @@ logout: "ログアウト"
signup: "新規登録"
uploading: "アップロード中"
save: "保存"
dontSave: "保存しない"
users: "ユーザー"
addUser: "ユーザーを追加"
favorite: "お気に入り"
@ -3282,7 +3281,7 @@ _imageEffector:
_drafts:
select: "下書きを選択"
cannotCreateDraftAnymore: "下書きの作成可能数を超えています。"
cannotCreateDraftAnymoreDescription: "サーバーに下書きを保存するには、下書きを削除する必要があります。ここで「保存しない」を選択しても、下書きは端末内に保存されます。"
cannotCreateDraftOfRenote: "リノートの下書きは作成できません。"
delete: "下書きを削除"
deleteAreYouSure: "下書きを削除しますか?"
noDrafts: "下書きはありません"

View File

@ -90,7 +90,7 @@ const emit = defineEmits<{
(ev: 'opening'): void;
(ev: 'opened'): void;
(ev: 'click'): void;
(ev: 'esc', event: KeyboardEvent): void;
(ev: 'esc'): void;
(ev: 'close'): void;
(ev: 'closed'): void;
}>();
@ -166,7 +166,7 @@ if (type.value === 'drawer') {
const keymap = {
'esc': {
allowRepeat: true,
callback: (ev) => emit('esc', ev),
callback: () => emit('esc'),
},
} as const satisfies Keymap;

View File

@ -302,6 +302,7 @@ const canPost = computed((): boolean => {
(!poll.value || poll.value.choices.length >= 2);
});
// cannot save pure renote as draft
const canSaveAsServerDraft = computed((): boolean => {
return canPost.value && (textLength.value > 0 || files.value.length > 0 || poll.value != null);
});
@ -1039,37 +1040,6 @@ async function post(ev?: MouseEvent) {
});
}
async function handleSavingServerDraft(ev?: Event) {
const draftCount = await misskeyApi('notes/drafts/count');
const isOver = draftCount >= $i.policies.noteDraftLimit;
if (canSaveAsServerDraft.value && !isOver) {
return await saveServerDraft(true);
} else if (canSaveAsServerDraft.value) {
ev?.stopPropagation();
const { canceled, result } = await os.actions({
type: 'question',
title: i18n.ts._drafts.cannotCreateDraftAnymore,
text: i18n.ts._drafts.cannotCreateDraftAnymoreDescription,
actions: [{
value: 'discard' as const,
text: i18n.ts.dontSave,
}, {
value: 'cancel' as const,
text: i18n.ts.cancel,
}],
});
if (canceled || result === 'cancel') {
return { canClosePostForm: false };
} else {
return { canClosePostForm: true };
}
} else {
return { canClosePostForm: true };
}
}
function cancel() {
emit('cancel');
}
@ -1236,6 +1206,12 @@ function showDraftMenu(ev: MouseEvent) {
text: i18n.ts._drafts.save,
icon: 'ti ti-cloud-upload',
action: async () => {
if (!canSaveAsServerDraft.value) {
return os.alert({
type: 'error',
text: i18n.ts._drafts.cannotCreateDraftOfRenote,
});
}
saveServerDraft();
},
}, {