cleanUp
This commit is contained in:
parent
a48dbcb188
commit
a6bc5ef0fa
|
@ -166,10 +166,6 @@ export interface Locale extends ILocale {
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
"save": string;
|
"save": string;
|
||||||
/**
|
|
||||||
* 保存しない
|
|
||||||
*/
|
|
||||||
"dontSave": string;
|
|
||||||
/**
|
/**
|
||||||
* ユーザー
|
* ユーザー
|
||||||
*/
|
*/
|
||||||
|
@ -12252,9 +12248,9 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"cannotCreateDraftAnymore": string;
|
"cannotCreateDraftAnymore": string;
|
||||||
/**
|
/**
|
||||||
* サーバーに下書きを保存するには、下書きを削除する必要があります。ここで「保存しない」を選択しても、下書きは端末内に保存されます。
|
* リノートの下書きは作成できません。
|
||||||
*/
|
*/
|
||||||
"cannotCreateDraftAnymoreDescription": string;
|
"cannotCreateDraftOfRenote": string;
|
||||||
/**
|
/**
|
||||||
* 下書きを削除
|
* 下書きを削除
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,7 +37,6 @@ logout: "ログアウト"
|
||||||
signup: "新規登録"
|
signup: "新規登録"
|
||||||
uploading: "アップロード中"
|
uploading: "アップロード中"
|
||||||
save: "保存"
|
save: "保存"
|
||||||
dontSave: "保存しない"
|
|
||||||
users: "ユーザー"
|
users: "ユーザー"
|
||||||
addUser: "ユーザーを追加"
|
addUser: "ユーザーを追加"
|
||||||
favorite: "お気に入り"
|
favorite: "お気に入り"
|
||||||
|
@ -3282,7 +3281,7 @@ _imageEffector:
|
||||||
_drafts:
|
_drafts:
|
||||||
select: "下書きを選択"
|
select: "下書きを選択"
|
||||||
cannotCreateDraftAnymore: "下書きの作成可能数を超えています。"
|
cannotCreateDraftAnymore: "下書きの作成可能数を超えています。"
|
||||||
cannotCreateDraftAnymoreDescription: "サーバーに下書きを保存するには、下書きを削除する必要があります。ここで「保存しない」を選択しても、下書きは端末内に保存されます。"
|
cannotCreateDraftOfRenote: "リノートの下書きは作成できません。"
|
||||||
delete: "下書きを削除"
|
delete: "下書きを削除"
|
||||||
deleteAreYouSure: "下書きを削除しますか?"
|
deleteAreYouSure: "下書きを削除しますか?"
|
||||||
noDrafts: "下書きはありません"
|
noDrafts: "下書きはありません"
|
||||||
|
|
|
@ -90,7 +90,7 @@ const emit = defineEmits<{
|
||||||
(ev: 'opening'): void;
|
(ev: 'opening'): void;
|
||||||
(ev: 'opened'): void;
|
(ev: 'opened'): void;
|
||||||
(ev: 'click'): void;
|
(ev: 'click'): void;
|
||||||
(ev: 'esc', event: KeyboardEvent): void;
|
(ev: 'esc'): void;
|
||||||
(ev: 'close'): void;
|
(ev: 'close'): void;
|
||||||
(ev: 'closed'): void;
|
(ev: 'closed'): void;
|
||||||
}>();
|
}>();
|
||||||
|
@ -166,7 +166,7 @@ if (type.value === 'drawer') {
|
||||||
const keymap = {
|
const keymap = {
|
||||||
'esc': {
|
'esc': {
|
||||||
allowRepeat: true,
|
allowRepeat: true,
|
||||||
callback: (ev) => emit('esc', ev),
|
callback: () => emit('esc'),
|
||||||
},
|
},
|
||||||
} as const satisfies Keymap;
|
} as const satisfies Keymap;
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,7 @@ const canPost = computed((): boolean => {
|
||||||
(!poll.value || poll.value.choices.length >= 2);
|
(!poll.value || poll.value.choices.length >= 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// cannot save pure renote as draft
|
||||||
const canSaveAsServerDraft = computed((): boolean => {
|
const canSaveAsServerDraft = computed((): boolean => {
|
||||||
return canPost.value && (textLength.value > 0 || files.value.length > 0 || poll.value != null);
|
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() {
|
function cancel() {
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
}
|
}
|
||||||
|
@ -1236,6 +1206,12 @@ function showDraftMenu(ev: MouseEvent) {
|
||||||
text: i18n.ts._drafts.save,
|
text: i18n.ts._drafts.save,
|
||||||
icon: 'ti ti-cloud-upload',
|
icon: 'ti ti-cloud-upload',
|
||||||
action: async () => {
|
action: async () => {
|
||||||
|
if (!canSaveAsServerDraft.value) {
|
||||||
|
return os.alert({
|
||||||
|
type: 'error',
|
||||||
|
text: i18n.ts._drafts.cannotCreateDraftOfRenote,
|
||||||
|
});
|
||||||
|
}
|
||||||
saveServerDraft();
|
saveServerDraft();
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Reference in New Issue