@tano.page/workbench 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +21 -8
- package/src/App.vue +76 -17
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +424 -7
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/engine.ts +56 -3
- package/src/assistant/files.ts +5 -13
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/locales/de-DE.json +4 -1
- package/src/assistant/locales/en-US.json +4 -1
- package/src/assistant/locales/es-ES.json +4 -1
- package/src/assistant/locales/ja-JP.json +4 -1
- package/src/assistant/locales/zh-CN.json +4 -1
- package/src/assistant/locales/zh-TW.json +4 -1
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/prompts.ts +7 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +319 -12
- package/src/assistant/structures.ts +7 -5
- package/src/assistant/tasks.ts +3 -5
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-shortcuts.ts +26 -22
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/features.ts +1 -0
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locales/de-DE.json +349 -3
- package/src/i18n/locales/en-US.json +349 -2
- package/src/i18n/locales/es-ES.json +349 -3
- package/src/i18n/locales/ja-JP.json +348 -2
- package/src/i18n/locales/zh-TW.json +348 -2
- package/src/mail/components/MailAccountDialog.vue +449 -0
- package/src/mail/components/MailComposerDialog.vue +325 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +820 -0
- package/src/mail/components/SidebarMail.vue +133 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/workspace-objects.ts +1 -1
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +63 -7
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarView.vue +1736 -276
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +129 -54
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +15 -21
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +39 -145
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +21 -6
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +111 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-sdk.ts +174 -8
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +3 -1
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +101 -3
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +21 -8
- package/src/shell/components/WorkbenchModals.vue +27 -46
- package/src/shell/components/WorkbenchPanes.vue +267 -84
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/use-workbench.ts +116 -145
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-knowledge.ts +1 -113
- package/src/stores/workspace-plugins-state.ts +537 -14
- package/src/stores/workspace-tabs-layout.ts +5 -43
- package/src/stores/workspace.ts +69 -66
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +1 -1
- package/src/tabs/components/DesktopTabs.vue +0 -3
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
3
|
+
import { AlertTriangle, Paperclip, Send, X } from 'lucide-vue-next';
|
|
4
|
+
import { t } from '../../i18n/i18n';
|
|
5
|
+
import { useMailStore } from '../../stores/mail';
|
|
6
|
+
import { markdownToEmailHtml } from '../mail-markdown';
|
|
7
|
+
import type { MailSendAttachment } from '../types';
|
|
8
|
+
|
|
9
|
+
const mail = useMailStore();
|
|
10
|
+
|
|
11
|
+
const accountId = ref('');
|
|
12
|
+
const toText = ref('');
|
|
13
|
+
const ccText = ref('');
|
|
14
|
+
const bccText = ref('');
|
|
15
|
+
const showCcBcc = ref(false);
|
|
16
|
+
const subject = ref('');
|
|
17
|
+
const markdownBody = ref('');
|
|
18
|
+
const attachments = ref<MailSendAttachment[]>([]);
|
|
19
|
+
const sending = ref(false);
|
|
20
|
+
const savingDraft = ref(false);
|
|
21
|
+
const error = ref('');
|
|
22
|
+
const fileInput = ref<HTMLInputElement>();
|
|
23
|
+
|
|
24
|
+
watch(
|
|
25
|
+
() => [mail.composerOpen, mail.composeSeed] as const,
|
|
26
|
+
([open, seed]) => {
|
|
27
|
+
if (!open) return;
|
|
28
|
+
accountId.value = seed?.accountId || mail.accounts[0]?.id || '';
|
|
29
|
+
toText.value = (seed?.to ?? []).join(', ');
|
|
30
|
+
ccText.value = (seed?.cc ?? []).join(', ');
|
|
31
|
+
bccText.value = '';
|
|
32
|
+
showCcBcc.value = Boolean(seed?.cc?.length);
|
|
33
|
+
subject.value = seed?.subject ?? '';
|
|
34
|
+
markdownBody.value = seed?.markdownBody ?? '';
|
|
35
|
+
attachments.value = [...(seed?.attachments ?? [])];
|
|
36
|
+
error.value = '';
|
|
37
|
+
},
|
|
38
|
+
{ immediate: true },
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
function parseAddressInput(raw: string): string[] {
|
|
42
|
+
return raw
|
|
43
|
+
.split(/[,;\n]+/)
|
|
44
|
+
.map((item) => item.trim())
|
|
45
|
+
.filter(Boolean);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function onPickFiles(event: Event) {
|
|
49
|
+
await addFiles(Array.from((event.target as HTMLInputElement).files ?? []));
|
|
50
|
+
(event.target as HTMLInputElement).value = '';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const dragOver = ref(false);
|
|
54
|
+
async function onDrop(event: DragEvent) {
|
|
55
|
+
dragOver.value = false;
|
|
56
|
+
const files = Array.from(event.dataTransfer?.files ?? []);
|
|
57
|
+
if (files.length) await addFiles(files);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function addFiles(files: File[]) {
|
|
61
|
+
for (const file of files) {
|
|
62
|
+
if (file.size > 25 * 1024 * 1024) {
|
|
63
|
+
error.value = t('单个附件不能超过 25 MiB:{0}', [file.name]);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const buffer = await file.arrayBuffer();
|
|
67
|
+
const bytes = new Uint8Array(buffer);
|
|
68
|
+
let binary = '';
|
|
69
|
+
for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]!);
|
|
70
|
+
attachments.value.push({
|
|
71
|
+
filename: file.name,
|
|
72
|
+
contentType: file.type || 'application/octet-stream',
|
|
73
|
+
bytesBase64: btoa(binary),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function close() {
|
|
79
|
+
if (sending.value) return;
|
|
80
|
+
mail.closeComposer();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function onKeydown(event: KeyboardEvent) {
|
|
84
|
+
if (!mail.composerOpen) return;
|
|
85
|
+
if (event.key === 'Escape') {
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
close();
|
|
88
|
+
} else if (event.key === 'Enter' && (event.ctrlKey || event.metaKey) && !sending.value) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
void send();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
onMounted(() => window.addEventListener('keydown', onKeydown, true));
|
|
94
|
+
onBeforeUnmount(() => window.removeEventListener('keydown', onKeydown, true));
|
|
95
|
+
|
|
96
|
+
// Land the caret where the user would type first: recipients, else the body.
|
|
97
|
+
const toInput = ref<HTMLInputElement>();
|
|
98
|
+
const bodyInput = ref<HTMLTextAreaElement>();
|
|
99
|
+
watch(
|
|
100
|
+
() => mail.composerOpen,
|
|
101
|
+
async (open) => {
|
|
102
|
+
if (!open) return;
|
|
103
|
+
await nextTick();
|
|
104
|
+
if (!toText.value) toInput.value?.focus();
|
|
105
|
+
else {
|
|
106
|
+
bodyInput.value?.focus();
|
|
107
|
+
bodyInput.value?.setSelectionRange(0, 0);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{ immediate: true },
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
function formatAttachmentSize(base64: string): string {
|
|
114
|
+
const bytes = Math.floor((base64.length * 3) / 4);
|
|
115
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
116
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
117
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function removeAttachment(index: number) {
|
|
121
|
+
attachments.value.splice(index, 1);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function saveLocalDraft() {
|
|
125
|
+
if (!accountId.value) return;
|
|
126
|
+
savingDraft.value = true;
|
|
127
|
+
error.value = '';
|
|
128
|
+
try {
|
|
129
|
+
await mail.saveDraft({
|
|
130
|
+
id: '',
|
|
131
|
+
accountId: accountId.value,
|
|
132
|
+
to: parseAddressInput(toText.value),
|
|
133
|
+
cc: parseAddressInput(ccText.value),
|
|
134
|
+
bcc: parseAddressInput(bccText.value),
|
|
135
|
+
subject: subject.value,
|
|
136
|
+
markdownBody: markdownBody.value,
|
|
137
|
+
inReplyTo: mail.composeSeed?.inReplyTo ?? null,
|
|
138
|
+
references: mail.composeSeed?.references ?? [],
|
|
139
|
+
updatedAt: 0,
|
|
140
|
+
});
|
|
141
|
+
mail.closeComposer();
|
|
142
|
+
} catch (err) {
|
|
143
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
144
|
+
} finally {
|
|
145
|
+
savingDraft.value = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function send() {
|
|
150
|
+
if (!accountId.value) {
|
|
151
|
+
error.value = t('请先选择发件邮箱');
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const to = parseAddressInput(toText.value);
|
|
155
|
+
const cc = parseAddressInput(ccText.value);
|
|
156
|
+
const bcc = parseAddressInput(bccText.value);
|
|
157
|
+
if (!to.length && !cc.length && !bcc.length) {
|
|
158
|
+
error.value = t('请至少填写一位收件人');
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
sending.value = true;
|
|
162
|
+
error.value = '';
|
|
163
|
+
try {
|
|
164
|
+
await mail.sendMail({
|
|
165
|
+
accountId: accountId.value,
|
|
166
|
+
to,
|
|
167
|
+
cc,
|
|
168
|
+
bcc,
|
|
169
|
+
subject: subject.value.trim() || t('(无主题)'),
|
|
170
|
+
textBody: markdownBody.value,
|
|
171
|
+
htmlBody: markdownToEmailHtml(markdownBody.value),
|
|
172
|
+
inReplyTo: mail.composeSeed?.inReplyTo ?? undefined,
|
|
173
|
+
references: mail.composeSeed?.references,
|
|
174
|
+
attachments: attachments.value,
|
|
175
|
+
});
|
|
176
|
+
mail.closeComposer();
|
|
177
|
+
} catch (err) {
|
|
178
|
+
error.value = err instanceof Error ? err.message : String(err);
|
|
179
|
+
} finally {
|
|
180
|
+
sending.value = false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<template>
|
|
186
|
+
<Transition name="mail-modal">
|
|
187
|
+
<div
|
|
188
|
+
v-if="mail.composerOpen"
|
|
189
|
+
class="mail-modal-backdrop"
|
|
190
|
+
@mousedown.self="close"
|
|
191
|
+
>
|
|
192
|
+
<section
|
|
193
|
+
class="mail-modal mail-composer-modal"
|
|
194
|
+
:class="{ 'drag-over': dragOver }"
|
|
195
|
+
role="dialog"
|
|
196
|
+
aria-modal="true"
|
|
197
|
+
:aria-label="t('撰写邮件')"
|
|
198
|
+
@dragover.prevent="dragOver = true"
|
|
199
|
+
@dragleave.self="dragOver = false"
|
|
200
|
+
@drop.prevent="onDrop"
|
|
201
|
+
>
|
|
202
|
+
<header class="mail-modal-header compact">
|
|
203
|
+
<h2>{{ subject.trim() || t('撰写邮件') }}</h2>
|
|
204
|
+
<button
|
|
205
|
+
type="button"
|
|
206
|
+
class="icon-button"
|
|
207
|
+
:disabled="sending"
|
|
208
|
+
:aria-label="t('关闭')"
|
|
209
|
+
:data-tooltip="t('关闭')"
|
|
210
|
+
@click="close"
|
|
211
|
+
>
|
|
212
|
+
<X :size="16" />
|
|
213
|
+
</button>
|
|
214
|
+
</header>
|
|
215
|
+
|
|
216
|
+
<div class="mail-composer-fields">
|
|
217
|
+
<label v-if="mail.accounts.length > 1" class="mail-composer-row">
|
|
218
|
+
<span>{{ t('发件人') }}</span>
|
|
219
|
+
<select v-model="accountId">
|
|
220
|
+
<option v-for="acc in mail.accounts" :key="acc.id" :value="acc.id">
|
|
221
|
+
{{ acc.label }} <{{ acc.email }}>
|
|
222
|
+
</option>
|
|
223
|
+
</select>
|
|
224
|
+
</label>
|
|
225
|
+
|
|
226
|
+
<label class="mail-composer-row">
|
|
227
|
+
<span>{{ t('收件人') }}</span>
|
|
228
|
+
<input
|
|
229
|
+
ref="toInput"
|
|
230
|
+
v-model="toText"
|
|
231
|
+
type="text"
|
|
232
|
+
:placeholder="t('多个地址用逗号分隔,例如 alice@example.com')"
|
|
233
|
+
/>
|
|
234
|
+
<button
|
|
235
|
+
v-if="!showCcBcc"
|
|
236
|
+
type="button"
|
|
237
|
+
class="mail-link-btn"
|
|
238
|
+
@click="showCcBcc = true"
|
|
239
|
+
>
|
|
240
|
+
{{ t('抄送/密送') }}
|
|
241
|
+
</button>
|
|
242
|
+
</label>
|
|
243
|
+
|
|
244
|
+
<template v-if="showCcBcc">
|
|
245
|
+
<label class="mail-composer-row">
|
|
246
|
+
<span>{{ t('抄送') }}</span>
|
|
247
|
+
<input v-model="ccText" type="text" placeholder="cc@example.com" />
|
|
248
|
+
</label>
|
|
249
|
+
<label class="mail-composer-row">
|
|
250
|
+
<span>{{ t('密送') }}</span>
|
|
251
|
+
<input v-model="bccText" type="text" placeholder="bcc@example.com" />
|
|
252
|
+
</label>
|
|
253
|
+
</template>
|
|
254
|
+
|
|
255
|
+
<label class="mail-composer-row">
|
|
256
|
+
<span>{{ t('主题') }}</span>
|
|
257
|
+
<input v-model="subject" type="text" class="mail-composer-subject" :placeholder="t('输入邮件主题')" />
|
|
258
|
+
</label>
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
<textarea
|
|
262
|
+
ref="bodyInput"
|
|
263
|
+
v-model="markdownBody"
|
|
264
|
+
class="mail-composer-editor"
|
|
265
|
+
:placeholder="t('支持 Markdown 语法,发送时将自动生成纯文本与干净的 HTML 双版本正文…')"
|
|
266
|
+
/>
|
|
267
|
+
|
|
268
|
+
<TransitionGroup
|
|
269
|
+
v-if="attachments.length"
|
|
270
|
+
tag="div"
|
|
271
|
+
name="mail-chip"
|
|
272
|
+
class="mail-composer-attachments"
|
|
273
|
+
>
|
|
274
|
+
<span v-for="(att, idx) in attachments" :key="`${att.filename}-${idx}`" class="mail-att-chip">
|
|
275
|
+
<Paperclip :size="13" />
|
|
276
|
+
<span class="mail-att-name">{{ att.filename }}</span>
|
|
277
|
+
<small>{{ formatAttachmentSize(att.bytesBase64) }}</small>
|
|
278
|
+
<button type="button" :aria-label="t('移除')" @click="removeAttachment(idx)">
|
|
279
|
+
<X :size="12" />
|
|
280
|
+
</button>
|
|
281
|
+
</span>
|
|
282
|
+
</TransitionGroup>
|
|
283
|
+
|
|
284
|
+
<Transition name="mail-notice">
|
|
285
|
+
<p v-if="error" class="mail-alert error mail-composer-error" role="alert">
|
|
286
|
+
<AlertTriangle :size="14" /> <span>{{ error }}</span>
|
|
287
|
+
</p>
|
|
288
|
+
</Transition>
|
|
289
|
+
|
|
290
|
+
<footer class="mail-composer-footer">
|
|
291
|
+
<input ref="fileInput" type="file" multiple hidden @change="onPickFiles" />
|
|
292
|
+
<button
|
|
293
|
+
type="button"
|
|
294
|
+
class="icon-button"
|
|
295
|
+
:disabled="sending"
|
|
296
|
+
:aria-label="t('添加附件')"
|
|
297
|
+
:data-tooltip="t('添加附件')"
|
|
298
|
+
@click="fileInput?.click()"
|
|
299
|
+
>
|
|
300
|
+
<Paperclip :size="16" />
|
|
301
|
+
</button>
|
|
302
|
+
<span class="mail-composer-hint">Ctrl + Enter</span>
|
|
303
|
+
<button
|
|
304
|
+
type="button"
|
|
305
|
+
class="mail-btn-ghost"
|
|
306
|
+
:disabled="sending || savingDraft"
|
|
307
|
+
@click="saveLocalDraft"
|
|
308
|
+
>
|
|
309
|
+
{{ t('存为本机草稿') }}
|
|
310
|
+
</button>
|
|
311
|
+
<button
|
|
312
|
+
type="button"
|
|
313
|
+
class="mail-btn-primary"
|
|
314
|
+
:disabled="sending"
|
|
315
|
+
@click="send"
|
|
316
|
+
>
|
|
317
|
+
<span v-if="sending" class="mail-btn-spinner" aria-hidden="true" />
|
|
318
|
+
<Send v-else :size="14" />
|
|
319
|
+
{{ sending ? t('正在发送…') : t('发送邮件') }}
|
|
320
|
+
</button>
|
|
321
|
+
</footer>
|
|
322
|
+
</section>
|
|
323
|
+
</div>
|
|
324
|
+
</Transition>
|
|
325
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
import { Settings2 } from 'lucide-vue-next';
|
|
4
|
+
import aliyunMail from '../../assets/mail-provider-icons/aliyun-mail.svg';
|
|
5
|
+
import gmail from '../../assets/mail-provider-icons/gmail.svg';
|
|
6
|
+
import icloud from '../../assets/mail-provider-icons/icloud.svg';
|
|
7
|
+
import netease126 from '../../assets/mail-provider-icons/netease-126.svg';
|
|
8
|
+
import netease163 from '../../assets/mail-provider-icons/netease-163.svg';
|
|
9
|
+
import qq from '../../assets/mail-provider-icons/qq.svg';
|
|
10
|
+
import tencentExmail from '../../assets/mail-provider-icons/tencent-exmail.svg';
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{ provider: string }>();
|
|
13
|
+
const icons = new Map([
|
|
14
|
+
['aliyun-mail', aliyunMail],
|
|
15
|
+
['gmail', gmail],
|
|
16
|
+
['icloud', icloud],
|
|
17
|
+
['netease-126', netease126],
|
|
18
|
+
['netease-163', netease163],
|
|
19
|
+
['qq', qq],
|
|
20
|
+
['tencent-exmail', tencentExmail],
|
|
21
|
+
]);
|
|
22
|
+
const icon = computed(() => icons.get(props.provider));
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<span class="mail-provider-icon" :class="{ generic: !icon }" aria-hidden="true">
|
|
27
|
+
<img v-if="icon" :src="icon" alt="" />
|
|
28
|
+
<Settings2 v-else :size="15" />
|
|
29
|
+
</span>
|
|
30
|
+
</template>
|