summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkPostForm.vue
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-10-21 20:03:57 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-10-21 20:03:57 +0900
commit3c97c12e7fde60291bd26dc24217ec73eeed345b (patch)
treea8c9fb90009d62d4c2326d55b1f2f2f7db5dc607 /packages/frontend/src/components/MkPostForm.vue
parentenhance(backend): 管理者/モデレーターはファイルのアップロ... (diff)
downloadmisskey-3c97c12e7fde60291bd26dc24217ec73eeed345b.tar.gz
misskey-3c97c12e7fde60291bd26dc24217ec73eeed345b.tar.bz2
misskey-3c97c12e7fde60291bd26dc24217ec73eeed345b.zip
enhance(frontend): 下書き/予約投稿一覧は投稿フォームのアカウントメニュー内に移動し、下書き保存は「...」メニュー内に移動
Diffstat (limited to 'packages/frontend/src/components/MkPostForm.vue')
-rw-r--r--packages/frontend/src/components/MkPostForm.vue95
1 files changed, 39 insertions, 56 deletions
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index c1b950a6c8..afa70cdbae 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -17,7 +17,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-click-anime v-tooltip="i18n.ts.switchAccount" :class="$style.account" class="_button" @click="openAccountMenu">
<img :class="$style.avatar" :src="(postAccount ?? $i).avatarUrl" style="border-radius: 100%;"/>
</button>
- <button v-if="$i.policies.noteDraftLimit > 0" v-tooltip="(postAccount != null && postAccount.id !== $i.id) ? null : i18n.ts.draftsAndScheduledNotes" class="_button" :class="$style.draftButton" :disabled="postAccount != null && postAccount.id !== $i.id" @click="showDraftMenu"><i class="ti ti-list"></i></button>
</div>
<div :class="$style.headerRight">
<template v-if="!(targetChannel != null && fixed)">
@@ -141,7 +140,7 @@ import MkInfo from '@/components/MkInfo.vue';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { ensureSignin, notesCount, incNotesCount } from '@/i.js';
-import { getAccounts, openAccountMenu as openAccountMenu_ } from '@/accounts.js';
+import { getAccounts, getAccountMenu } from '@/accounts.js';
import { deepClone } from '@/utility/clone.js';
import MkRippleEffect from '@/components/MkRippleEffect.vue';
import { miLocalStorage } from '@/local-storage.js';
@@ -620,6 +619,19 @@ function showOtherSettings() {
action: () => {
toggleReactionAcceptance();
},
+ }, { type: 'divider' }, {
+ type: 'button',
+ text: i18n.ts._drafts.saveToDraft,
+ icon: 'ti ti-cloud-upload',
+ action: async () => {
+ if (!canSaveAsServerDraft.value) {
+ return os.alert({
+ type: 'error',
+ text: i18n.ts._drafts.cannotCreateDraft,
+ });
+ }
+ saveServerDraft();
+ },
}, ...($i.policies.scheduledNoteLimit > 0 ? [{
icon: 'ti ti-calendar-time',
text: i18n.ts.schedulePost + '...',
@@ -1159,34 +1171,9 @@ function showActions(ev: MouseEvent) {
const postAccount = ref<Misskey.entities.UserDetailed | null>(null);
-function openAccountMenu(ev: MouseEvent) {
+async function openAccountMenu(ev: MouseEvent) {
if (props.mock) return;
- openAccountMenu_({
- withExtraOperation: false,
- includeCurrentAccount: true,
- active: postAccount.value != null ? postAccount.value.id : $i.id,
- onChoose: (account) => {
- if (account.id === $i.id) {
- postAccount.value = null;
- } else {
- postAccount.value = account;
- }
- },
- }, ev);
-}
-
-function showPerUploadItemMenu(item: UploaderItem, ev: MouseEvent) {
- const menu = uploader.getMenu(item);
- os.popupMenu(menu, ev.currentTarget ?? ev.target);
-}
-
-function showPerUploadItemMenuViaContextmenu(item: UploaderItem, ev: MouseEvent) {
- const menu = uploader.getMenu(item);
- os.contextMenu(menu, ev);
-}
-
-function showDraftMenu(ev: MouseEvent) {
function showDraftsDialog(scheduled: boolean) {
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkNoteDraftsDialog.vue')), {
scheduled,
@@ -1244,34 +1231,44 @@ function showDraftMenu(ev: MouseEvent) {
});
}
- os.popupMenu([{
- type: 'button',
- text: i18n.ts._drafts.saveToDraft,
- icon: 'ti ti-cloud-upload',
- action: async () => {
- if (!canSaveAsServerDraft.value) {
- return os.alert({
- type: 'error',
- text: i18n.ts._drafts.cannotCreateDraft,
- });
+ const items = await getAccountMenu({
+ withExtraOperation: false,
+ includeCurrentAccount: true,
+ active: postAccount.value != null ? postAccount.value.id : $i.id,
+ onChoose: (account) => {
+ if (account.id === $i.id) {
+ postAccount.value = null;
+ } else {
+ postAccount.value = account;
}
- saveServerDraft();
},
- }, {
+ });
+
+ os.popupMenu([{
type: 'button',
text: i18n.ts._drafts.listDrafts,
icon: 'ti ti-cloud-download',
action: () => {
showDraftsDialog(false);
},
- }, { type: 'divider' }, {
+ }, {
type: 'button',
text: i18n.ts._drafts.listScheduledNotes,
icon: 'ti ti-clock-down',
action: () => {
showDraftsDialog(true);
},
- }], (ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined);
+ }, { type: 'divider' }, ...items], (ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined);
+}
+
+function showPerUploadItemMenu(item: UploaderItem, ev: MouseEvent) {
+ const menu = uploader.getMenu(item);
+ os.popupMenu(menu, ev.currentTarget ?? ev.target);
+}
+
+function showPerUploadItemMenuViaContextmenu(item: UploaderItem, ev: MouseEvent) {
+ const menu = uploader.getMenu(item);
+ os.contextMenu(menu, ev);
}
async function schedule() {
@@ -1422,20 +1419,6 @@ defineExpose({
margin: auto;
}
-.draftButton {
- padding: 8px;
- font-size: 90%;
- border-radius: 6px;
-
- &:hover {
- background: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.05));
- }
-
- &:disabled {
- background: none;
- }
-}
-
.headerRight {
display: flex;
min-height: 48px;