forked from mirrors/misskey
enhance(frontend): 下書き/予約投稿一覧は投稿フォームのアカウントメニュー内に移動し、下書き保存は「...」メニュー内に移動
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -62,9 +62,10 @@ import { onMounted, onUnmounted, ref, inject, useTemplateRef, computed } from 'v
|
||||
import { scrollToTop } from '@@/js/scroll.js';
|
||||
import XTabs from './MkPageHeader.tabs.vue';
|
||||
import { globalEvents } from '@/events.js';
|
||||
import { openAccountMenu as openAccountMenu_ } from '@/accounts.js';
|
||||
import { getAccountMenu } from '@/accounts.js';
|
||||
import { $i } from '@/i.js';
|
||||
import { DI } from '@/di.js';
|
||||
import * as os from '@/os.js';
|
||||
|
||||
const props = withDefaults(defineProps<PageHeaderProps>(), {
|
||||
tabs: () => ([] as Tab[]),
|
||||
@@ -99,10 +100,12 @@ const top = () => {
|
||||
}
|
||||
};
|
||||
|
||||
function openAccountMenu(ev: MouseEvent) {
|
||||
openAccountMenu_({
|
||||
async function openAccountMenu(ev: MouseEvent) {
|
||||
const menuItems = await getAccountMenu({
|
||||
withExtraOperation: true,
|
||||
}, ev);
|
||||
});
|
||||
|
||||
os.popupMenu(menuItems, ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function onTabClick(): void {
|
||||
|
||||
Reference in New Issue
Block a user