@tano.page/workbench 0.15.0 → 0.16.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 +35 -14
- package/src/App.vue +68 -797
- package/src/assistant/agent-identities.ts +1 -97
- package/src/assistant/agent-task-context.ts +1 -54
- package/src/assistant/attachments.ts +1 -1
- package/src/assistant/completion.ts +1 -61
- package/src/assistant/components/AssistantPanel.vue +1 -1
- package/src/assistant/connection-actions.ts +237 -0
- package/src/assistant/document-mentions.ts +1 -33
- package/src/assistant/engine.ts +1 -585
- package/src/assistant/execution.ts +6 -33
- package/src/assistant/hash.ts +1 -4
- package/src/assistant/language.ts +10 -37
- package/src/assistant/plugin-bridge-builder.ts +146 -0
- package/src/assistant/prompts.ts +1 -65
- package/src/assistant/proposal-actions.ts +336 -0
- package/src/assistant/store.ts +87 -554
- package/src/assistant/structures.ts +1 -157
- package/src/assistant/tasks.ts +8 -94
- package/src/assistant/tool-rules.ts +1 -7
- package/src/composables/use-workbench-help.ts +177 -0
- package/src/composables/use-workbench-lifecycle.ts +249 -0
- package/src/composables/use-workbench-settings.ts +185 -0
- package/src/composables/use-workbench-shortcuts.ts +37 -1022
- package/src/composables/use-workbench-views.ts +325 -0
- package/src/documents/components/DocumentActionMenu.vue +279 -0
- package/src/documents/components/DocumentInspector.vue +168 -0
- package/src/documents/components/DocumentPane.vue +482 -0
- package/src/documents/description-merge.ts +1 -9
- package/src/files/components/FileMetadataPanel.vue +49 -15
- package/src/i18n/locale-catalogs.ts +7 -6
- package/src/i18n/locale-registry.ts +8 -6
- package/src/i18n/locales/de-DE.json +23 -1
- package/src/i18n/locales/en-US.json +23 -1
- package/src/i18n/locales/es-ES.json +23 -1
- package/src/i18n/locales/ja-JP.json +23 -1
- package/src/i18n/locales/zh-TW.json +23 -1
- package/src/mail/components/MailAccountDialog.vue +1 -0
- package/src/mail/components/MailComposerDialog.vue +1 -0
- package/src/mail/components/MailWorkspaceView.vue +1 -0
- package/src/mail/components/SidebarMail.vue +1 -0
- package/src/objects/content-references.ts +6 -56
- package/src/objects/wiki-links.ts +1 -48
- package/src/objects/workspace-objects.ts +2 -3
- package/src/plans/calendar.ts +2 -2
- package/src/plans/components/CalendarAgendaView.vue +165 -0
- package/src/plans/components/CalendarFilterBar.vue +128 -0
- package/src/plans/components/CalendarMonthView.vue +224 -0
- package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
- package/src/plans/components/CalendarTimelineView.vue +517 -0
- package/src/plans/components/CalendarTopbarControls.vue +101 -0
- package/src/plans/components/CalendarView.vue +162 -2106
- package/src/plans/components/CalendarYearView.vue +138 -0
- package/src/plans/components/PlanConnectionsDialog.vue +1 -1
- package/src/plans/components/calendar-shared.css +192 -0
- package/src/plans/composables/use-calendar-interactions.ts +396 -0
- package/src/plans/composables/use-calendar-scroll.ts +420 -0
- package/src/plugins/components/PluginDetailPage.vue +10 -6
- package/src/plugins/components/PluginDeveloperArea.vue +192 -0
- package/src/plugins/components/PluginExplorer.vue +6 -4
- package/src/plugins/components/PluginImportDialog.vue +1 -1
- package/src/plugins/components/PluginInstaller.vue +269 -178
- package/src/plugins/components/PluginMaintenance.vue +37 -49
- package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
- package/src/plugins/components/PluginSettingsForm.vue +2 -1
- package/src/plugins/components/PluginsTabPage.vue +61 -0
- package/src/plugins/components/plugin-center.css +5 -0
- package/src/plugins/data.ts +9 -86
- package/src/plugins/editor-plugin-adapters.ts +169 -0
- package/src/plugins/plugin-data.ts +2 -3
- package/src/plugins/plugin-rpc-router.ts +558 -0
- package/src/plugins/plugin-sdk.ts +1 -260
- package/src/plugins/plugin-ui-dialogs.ts +167 -0
- package/src/plugins/queries.ts +1 -75
- package/src/plugins/view-header.ts +2 -7
- package/src/runtime.ts +3 -2
- package/src/settings/components/SettingsPanel.vue +8 -3
- package/src/settings/components/WorkbenchSettings.vue +20 -7
- package/src/settings/components/settings-context.ts +1 -1
- package/src/settings/settings-tab.ts +1 -0
- package/src/shell/command-palette.ts +3 -3
- package/src/shell/components/EditorToolbar.vue +8 -9
- package/src/shell/components/EditorTools.vue +1 -5
- package/src/shell/components/PaneTopbar.vue +393 -0
- package/src/shell/components/SelectionToolbar.vue +0 -2
- package/src/shell/components/WorkbenchContextMenus.vue +37 -26
- package/src/shell/components/WorkbenchModals.vue +22 -18
- package/src/shell/components/WorkbenchPanes.vue +358 -1512
- package/src/shell/components/WorkbenchSidebar.vue +486 -0
- package/src/shell/pane-registry.ts +69 -0
- package/src/shell/use-surface-dismissal.ts +219 -0
- package/src/shell/use-workbench-commands.ts +599 -0
- package/src/shell/use-workbench-keybindings.ts +337 -0
- package/src/shell/use-workbench.ts +488 -1081
- package/src/shell/workbench-context.ts +30 -3
- package/src/stores/workspace-document-io.ts +807 -0
- package/src/stores/workspace-file-ops.ts +1 -1
- package/src/stores/workspace-knowledge.ts +1 -1
- package/src/stores/workspace-lifecycle.ts +459 -0
- package/src/stores/workspace-plugins-state.ts +71 -599
- package/src/stores/workspace-session.ts +287 -0
- package/src/stores/workspace-tabs-layout.ts +1 -1
- package/src/stores/workspace-types.ts +50 -0
- package/src/stores/workspace.ts +163 -1345
- package/src/styles.css +0 -1
- package/src/tabs/components/DesktopTabs.vue +19 -11
- package/src/windows/AuxiliaryWindows.vue +2 -2
- package/src/windows/use-window-event-bridge.ts +152 -0
- package/src/workspace/components/TemplateLibrary.vue +1 -1
- package/src/workspace/components/WorkspaceIconPicker.vue +5 -4
- package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
- package/src/assistant/locales/de-DE.json +0 -129
- package/src/assistant/locales/en-US.json +0 -129
- package/src/assistant/locales/es-ES.json +0 -129
- package/src/assistant/locales/ja-JP.json +0 -129
- package/src/assistant/locales/zh-CN.json +0 -129
- package/src/assistant/locales/zh-TW.json +0 -129
- package/src/assistant/task-prompts.json +0 -39
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, ref, toRefs } from 'vue';
|
|
3
|
+
import { CalendarDays, FolderPlus, GitFork, Mail, Search, SquarePen } from 'lucide-vue-next';
|
|
4
|
+
import { GRAPH_TAB_ID } from '../../documents/document-graph';
|
|
5
|
+
import { openExternalUrl } from '../../files/attachments';
|
|
6
|
+
import FileTree from '../../files/components/FileTree.vue';
|
|
7
|
+
import HelpLauncher from '../../help/components/HelpLauncher.vue';
|
|
8
|
+
import { t } from '../../i18n/i18n';
|
|
9
|
+
import { MAIL_TAB_ID } from '../../mail/types';
|
|
10
|
+
import { mobile } from '../../platform/platform';
|
|
11
|
+
import PluginExplorer from '../../plugins/components/PluginExplorer.vue';
|
|
12
|
+
import PluginView from '../../plugins/components/PluginView.vue';
|
|
13
|
+
import { isOverlaySidebarNavHidden } from '../../plugins/overlay-mapping';
|
|
14
|
+
import WorkspacePickerMenu from '../../workspace/components/WorkspacePickerMenu.vue';
|
|
15
|
+
import { vScrollFade } from '../scroll-fade';
|
|
16
|
+
import {
|
|
17
|
+
SidebarAssistant,
|
|
18
|
+
SidebarMail,
|
|
19
|
+
SidebarPlan,
|
|
20
|
+
} from '../workbench-async-components';
|
|
21
|
+
import {
|
|
22
|
+
workbenchDocumentsKey,
|
|
23
|
+
workbenchModalsKey,
|
|
24
|
+
workbenchPrefsKey,
|
|
25
|
+
workbenchShellKey,
|
|
26
|
+
workbenchTreeMenusKey,
|
|
27
|
+
} from '../workbench-context';
|
|
28
|
+
import ButtonVisibilityGroup from './ButtonVisibilityGroup.vue';
|
|
29
|
+
import SidebarNavigation from './SidebarNavigation.vue';
|
|
30
|
+
import SidebarUpdateButton from './SidebarUpdateButton.vue';
|
|
31
|
+
import WorkspaceSidebar from './WorkspaceSidebar.vue';
|
|
32
|
+
import WorkspaceViewSwitcher from './WorkspaceViewSwitcher.vue';
|
|
33
|
+
|
|
34
|
+
const props = defineProps<{
|
|
35
|
+
appMenuOpen: boolean;
|
|
36
|
+
}>();
|
|
37
|
+
|
|
38
|
+
const emit = defineEmits<{
|
|
39
|
+
'toggle-app-menu': [];
|
|
40
|
+
'brand-button': [el: HTMLElement | null];
|
|
41
|
+
}>();
|
|
42
|
+
|
|
43
|
+
const shell = inject(workbenchShellKey);
|
|
44
|
+
const prefs = inject(workbenchPrefsKey);
|
|
45
|
+
const documents = inject(workbenchDocumentsKey);
|
|
46
|
+
const treeMenus = inject(workbenchTreeMenusKey);
|
|
47
|
+
const modals = inject(workbenchModalsKey);
|
|
48
|
+
if (!shell || !prefs || !documents || !treeMenus || !modals) {
|
|
49
|
+
throw new Error('Workbench context is required');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
native,
|
|
54
|
+
workspace,
|
|
55
|
+
compactPanes,
|
|
56
|
+
isAuxiliaryWindow,
|
|
57
|
+
sidebar,
|
|
58
|
+
store,
|
|
59
|
+
busy,
|
|
60
|
+
activeId,
|
|
61
|
+
startupPending,
|
|
62
|
+
filesPending,
|
|
63
|
+
switchingWorkspace,
|
|
64
|
+
mainColumn,
|
|
65
|
+
returnHome,
|
|
66
|
+
sidebarHeaderItems,
|
|
67
|
+
closeButtonVisibilityMenus,
|
|
68
|
+
extensionViews,
|
|
69
|
+
viewActions,
|
|
70
|
+
navigationContext,
|
|
71
|
+
sidebarNavigationItems,
|
|
72
|
+
navigationModule,
|
|
73
|
+
selectModule,
|
|
74
|
+
sidebarView,
|
|
75
|
+
workspaceView,
|
|
76
|
+
selectWorkspaceView,
|
|
77
|
+
workspaceMenu,
|
|
78
|
+
mailEnabled,
|
|
79
|
+
openMail,
|
|
80
|
+
repositoryActionItems,
|
|
81
|
+
createNewDocument,
|
|
82
|
+
createNewEntry,
|
|
83
|
+
noteCount,
|
|
84
|
+
sidebarCalendarDate,
|
|
85
|
+
openCalendar,
|
|
86
|
+
showPlanEvent,
|
|
87
|
+
extensions,
|
|
88
|
+
extensionActions,
|
|
89
|
+
openSettings,
|
|
90
|
+
updates,
|
|
91
|
+
helpContext,
|
|
92
|
+
helpAvailability,
|
|
93
|
+
helpBlocked,
|
|
94
|
+
documentationBaseUrl,
|
|
95
|
+
} = toRefs(shell);
|
|
96
|
+
|
|
97
|
+
const {
|
|
98
|
+
shortcuts,
|
|
99
|
+
sidebarWidth,
|
|
100
|
+
defaultSidebarWidth,
|
|
101
|
+
SIDEBAR_MIN_WIDTH,
|
|
102
|
+
sidebarWidthLimit,
|
|
103
|
+
startSidebarResize,
|
|
104
|
+
resizeSidebarWithKeyboard,
|
|
105
|
+
} = toRefs(prefs);
|
|
106
|
+
|
|
107
|
+
const { menu } = toRefs(documents);
|
|
108
|
+
|
|
109
|
+
const {
|
|
110
|
+
setFileTree,
|
|
111
|
+
draggedEntry,
|
|
112
|
+
dropFolder,
|
|
113
|
+
dropPlaceholders,
|
|
114
|
+
fileDragOver,
|
|
115
|
+
fileDragLeave,
|
|
116
|
+
fileDrop,
|
|
117
|
+
openDirectoryContextMenu,
|
|
118
|
+
treeFiles,
|
|
119
|
+
revealedHomeId,
|
|
120
|
+
treeDocumentIcons,
|
|
121
|
+
loadTreeDocumentIcon,
|
|
122
|
+
selectedEntryIds,
|
|
123
|
+
fileContextMenu,
|
|
124
|
+
canDragEntry,
|
|
125
|
+
treeRename,
|
|
126
|
+
renameTreeEntry,
|
|
127
|
+
openTreeEntry,
|
|
128
|
+
selectFileTreeEntry,
|
|
129
|
+
openFileContextMenu,
|
|
130
|
+
fileDragStart,
|
|
131
|
+
fileDragEnd,
|
|
132
|
+
finishTreeRename,
|
|
133
|
+
} = toRefs(treeMenus);
|
|
134
|
+
|
|
135
|
+
const { modal, settingsPanel, showModal } = toRefs(modals);
|
|
136
|
+
|
|
137
|
+
const brandButton = ref<HTMLElement | null>(null);
|
|
138
|
+
function setBrandButton(el: unknown) {
|
|
139
|
+
brandButton.value = (el as HTMLElement | null) ?? null;
|
|
140
|
+
emit('brand-button', brandButton.value);
|
|
141
|
+
}
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<template>
|
|
145
|
+
<WorkspaceSidebar
|
|
146
|
+
v-if="!isAuxiliaryWindow"
|
|
147
|
+
:open="sidebar"
|
|
148
|
+
:compact="compactPanes"
|
|
149
|
+
:content-element="mainColumn"
|
|
150
|
+
@dismiss="sidebar = false"
|
|
151
|
+
>
|
|
152
|
+
<div class="sidebar-header">
|
|
153
|
+
<div class="sidebar-brand-slot">
|
|
154
|
+
<button
|
|
155
|
+
v-if="native && !mobile"
|
|
156
|
+
:ref="setBrandButton"
|
|
157
|
+
type="button"
|
|
158
|
+
class="brand brand-menu-button"
|
|
159
|
+
aria-haspopup="menu"
|
|
160
|
+
:aria-expanded="props.appMenuOpen"
|
|
161
|
+
:aria-label="t('同页')"
|
|
162
|
+
@click="emit('toggle-app-menu')"
|
|
163
|
+
>
|
|
164
|
+
<img src="../../assets/tano-logo.svg" alt="" />
|
|
165
|
+
</button>
|
|
166
|
+
<component
|
|
167
|
+
:is="native ? 'div' : 'a'"
|
|
168
|
+
v-else
|
|
169
|
+
class="brand"
|
|
170
|
+
:href="native ? undefined : '/'"
|
|
171
|
+
:aria-label="native ? undefined : t('返回同页首页')"
|
|
172
|
+
@click="returnHome"
|
|
173
|
+
>
|
|
174
|
+
<img src="../../assets/tano-logo.svg" alt="" />
|
|
175
|
+
</component>
|
|
176
|
+
</div>
|
|
177
|
+
<ButtonVisibilityGroup
|
|
178
|
+
v-slot="{ isVisible }"
|
|
179
|
+
:items="sidebarHeaderItems"
|
|
180
|
+
:active="sidebar"
|
|
181
|
+
preference-key="tano.preference.sidebarHiddenHeaderActions"
|
|
182
|
+
group-class="sidebar-header-actions"
|
|
183
|
+
:label="t('侧栏顶部按钮')"
|
|
184
|
+
:menu-label="t('侧栏顶部按钮显示设置')"
|
|
185
|
+
@open="closeButtonVisibilityMenus"
|
|
186
|
+
>
|
|
187
|
+
<template v-if="navigationModule === 'workspace'">
|
|
188
|
+
<button
|
|
189
|
+
v-if="isVisible('search') && !isOverlaySidebarNavHidden('search', store.overlaySnapshot?.hiddenSidebarItems)"
|
|
190
|
+
type="button"
|
|
191
|
+
class="icon-button"
|
|
192
|
+
:aria-label="t('查找文档')"
|
|
193
|
+
:data-tooltip="t('查找文档')"
|
|
194
|
+
:data-tooltip-shortcut="shortcuts.findDocument"
|
|
195
|
+
:disabled="!workspace"
|
|
196
|
+
@click="showModal('search')"
|
|
197
|
+
>
|
|
198
|
+
<Search :size="16" :stroke-width="1.6" />
|
|
199
|
+
</button>
|
|
200
|
+
<button
|
|
201
|
+
v-if="store.workspaceSettings.showGraph && isVisible('graph') && !isOverlaySidebarNavHidden('graph', store.overlaySnapshot?.hiddenSidebarItems)"
|
|
202
|
+
type="button"
|
|
203
|
+
class="icon-button"
|
|
204
|
+
:aria-label="t('打开关系图谱')"
|
|
205
|
+
:data-tooltip="t('关系图谱')"
|
|
206
|
+
:aria-pressed="activeId === GRAPH_TAB_ID"
|
|
207
|
+
:disabled="!workspace"
|
|
208
|
+
@click="store.openGraphTab()"
|
|
209
|
+
>
|
|
210
|
+
<GitFork :size="16" :stroke-width="1.6" />
|
|
211
|
+
</button>
|
|
212
|
+
</template>
|
|
213
|
+
<template v-for="view in extensionViews" :key="`header-${view.id}`">
|
|
214
|
+
<component
|
|
215
|
+
:is="view.header"
|
|
216
|
+
v-if="
|
|
217
|
+
(view.scope === 'account' || store.workspaceSettings.showCollaborationViews) &&
|
|
218
|
+
view.header &&
|
|
219
|
+
isVisible(view.id)
|
|
220
|
+
"
|
|
221
|
+
:actions="viewActions[view.id]"
|
|
222
|
+
/>
|
|
223
|
+
</template>
|
|
224
|
+
</ButtonVisibilityGroup>
|
|
225
|
+
</div>
|
|
226
|
+
|
|
227
|
+
<SidebarNavigation
|
|
228
|
+
v-if="navigationContext === 'home'"
|
|
229
|
+
v-slot="{ isVisible, orderStyle }"
|
|
230
|
+
:items="sidebarNavigationItems"
|
|
231
|
+
:active="sidebar"
|
|
232
|
+
:overlay-hidden-ids="store.overlaySnapshot?.hiddenSidebarItems"
|
|
233
|
+
:overlay-order="store.overlaySnapshot?.sidebarOrder"
|
|
234
|
+
@open="closeButtonVisibilityMenus"
|
|
235
|
+
>
|
|
236
|
+
<button
|
|
237
|
+
v-if="isVisible('plan')"
|
|
238
|
+
type="button"
|
|
239
|
+
class="sidebar-navigation-button"
|
|
240
|
+
:style="orderStyle('plan')"
|
|
241
|
+
:aria-label="t('计划')"
|
|
242
|
+
:data-tooltip="t('计划')"
|
|
243
|
+
aria-controls="sidebar-plan-panel"
|
|
244
|
+
:aria-pressed="navigationModule === 'plan'"
|
|
245
|
+
@click="selectModule('plan')"
|
|
246
|
+
>
|
|
247
|
+
<CalendarDays :size="18" :stroke-width="1.6" aria-hidden="true" />
|
|
248
|
+
<span :aria-hidden="navigationModule !== 'plan'"><span>{{ t('计划') }}</span></span>
|
|
249
|
+
</button>
|
|
250
|
+
<button
|
|
251
|
+
v-if="mailEnabled && isVisible(MAIL_TAB_ID)"
|
|
252
|
+
type="button"
|
|
253
|
+
class="sidebar-navigation-button"
|
|
254
|
+
:style="orderStyle(MAIL_TAB_ID)"
|
|
255
|
+
:aria-label="t('邮箱')"
|
|
256
|
+
:data-tooltip="t('邮箱')"
|
|
257
|
+
:aria-controls="`sidebar-${MAIL_TAB_ID}`"
|
|
258
|
+
:aria-pressed="sidebarView === MAIL_TAB_ID"
|
|
259
|
+
@click="openMail()"
|
|
260
|
+
>
|
|
261
|
+
<Mail :size="18" :stroke-width="1.6" aria-hidden="true" />
|
|
262
|
+
<span :aria-hidden="sidebarView !== MAIL_TAB_ID"><span>{{ t('邮箱') }}</span></span>
|
|
263
|
+
</button>
|
|
264
|
+
<template v-for="view in extensionViews" :key="view.id">
|
|
265
|
+
<button
|
|
266
|
+
v-if="
|
|
267
|
+
store.workspaceSettings.showCollaborationViews && view.sidebar && isVisible(view.id)
|
|
268
|
+
"
|
|
269
|
+
type="button"
|
|
270
|
+
class="sidebar-navigation-button"
|
|
271
|
+
:style="orderStyle(view.id)"
|
|
272
|
+
:aria-label="view.label"
|
|
273
|
+
:data-tooltip="view.label"
|
|
274
|
+
:aria-controls="`sidebar-${view.id}`"
|
|
275
|
+
:aria-pressed="sidebarView === view.id"
|
|
276
|
+
@click="selectModule(view.id)"
|
|
277
|
+
>
|
|
278
|
+
<component :is="view.icon" :size="18" :stroke-width="1.6" aria-hidden="true" />
|
|
279
|
+
<span :aria-hidden="sidebarView !== view.id"><span>{{ view.label }}</span></span>
|
|
280
|
+
</button>
|
|
281
|
+
</template>
|
|
282
|
+
</SidebarNavigation>
|
|
283
|
+
|
|
284
|
+
<div v-show="navigationModule === 'workspace'" class="sidebar-view-header">
|
|
285
|
+
<WorkspaceViewSwitcher
|
|
286
|
+
:model-value="workspaceView"
|
|
287
|
+
@update:model-value="selectWorkspaceView"
|
|
288
|
+
:active="sidebar && !workspaceMenu && !modal && !settingsPanel"
|
|
289
|
+
@open="closeButtonVisibilityMenus"
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
<div
|
|
294
|
+
v-show="navigationModule === 'workspace' && sidebarView === 'repository'"
|
|
295
|
+
class="section-label workspace-root-header"
|
|
296
|
+
:class="{ 'drop-target': draggedEntry && dropFolder === '' }"
|
|
297
|
+
@dragover="fileDragOver('', $event)"
|
|
298
|
+
@dragleave="fileDragLeave('', $event)"
|
|
299
|
+
@drop="fileDrop('', $event)"
|
|
300
|
+
@contextmenu.self.prevent="openDirectoryContextMenu('', $event)"
|
|
301
|
+
>
|
|
302
|
+
<span
|
|
303
|
+
class="workspace-root-name"
|
|
304
|
+
:title="draggedEntry ? undefined : workspace?.name"
|
|
305
|
+
@contextmenu.prevent="openDirectoryContextMenu('', $event)"
|
|
306
|
+
>{{ draggedEntry ? t('放到工作区根目录') : (workspace?.name ?? '') }}</span
|
|
307
|
+
>
|
|
308
|
+
<ButtonVisibilityGroup
|
|
309
|
+
v-slot="{ isVisible }"
|
|
310
|
+
v-show="!draggedEntry"
|
|
311
|
+
:items="repositoryActionItems"
|
|
312
|
+
:active="sidebar && sidebarView === 'repository'"
|
|
313
|
+
preference-key="tano.preference.repositoryHiddenActions"
|
|
314
|
+
group-class="repository-actions"
|
|
315
|
+
:label="t('工作区按钮')"
|
|
316
|
+
:menu-label="t('工作区按钮显示设置')"
|
|
317
|
+
@open="closeButtonVisibilityMenus"
|
|
318
|
+
>
|
|
319
|
+
<button
|
|
320
|
+
v-if="isVisible('create')"
|
|
321
|
+
type="button"
|
|
322
|
+
class="icon-button"
|
|
323
|
+
:aria-label="t('新建文档')"
|
|
324
|
+
:data-tooltip="t('新建文档')"
|
|
325
|
+
:data-tooltip-shortcut="shortcuts.newDocument"
|
|
326
|
+
:disabled="!workspace || workspace.readOnly || busy"
|
|
327
|
+
@click="createNewDocument"
|
|
328
|
+
>
|
|
329
|
+
<SquarePen :size="15" :stroke-width="1.6" />
|
|
330
|
+
</button>
|
|
331
|
+
<button
|
|
332
|
+
v-if="isVisible('folder')"
|
|
333
|
+
type="button"
|
|
334
|
+
class="icon-button"
|
|
335
|
+
:aria-label="t('新建文件夹')"
|
|
336
|
+
:data-tooltip="t('新建文件夹')"
|
|
337
|
+
:disabled="!workspace || workspace.readOnly || busy"
|
|
338
|
+
@click="createNewEntry('folder')"
|
|
339
|
+
>
|
|
340
|
+
<FolderPlus :size="15" :stroke-width="1.6" />
|
|
341
|
+
</button>
|
|
342
|
+
</ButtonVisibilityGroup>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
<PluginExplorer v-if="sidebarView === 'plugin-views'" />
|
|
346
|
+
<PluginView
|
|
347
|
+
v-else-if="sidebarView.startsWith('plugin-sidebar:')"
|
|
348
|
+
:view-key="sidebarView.slice(15)"
|
|
349
|
+
/>
|
|
350
|
+
<div
|
|
351
|
+
v-show="sidebarView === 'repository'"
|
|
352
|
+
id="sidebar-repository-panel"
|
|
353
|
+
class="sidebar-content"
|
|
354
|
+
>
|
|
355
|
+
<div
|
|
356
|
+
v-scroll-fade
|
|
357
|
+
class="tree-scroll"
|
|
358
|
+
:class="{ 'drop-root': draggedEntry && dropFolder === '' && !dropPlaceholders.length }"
|
|
359
|
+
@contextmenu.self.prevent="openDirectoryContextMenu('', $event)"
|
|
360
|
+
@dragover.self="fileDragOver('', $event)"
|
|
361
|
+
@dragleave.self="fileDragLeave('', $event)"
|
|
362
|
+
@drop.self="fileDrop('', $event)"
|
|
363
|
+
>
|
|
364
|
+
<FileTree
|
|
365
|
+
:ref="setFileTree"
|
|
366
|
+
v-if="workspace || startupPending || filesPending"
|
|
367
|
+
:loading="filesPending"
|
|
368
|
+
:entries="treeFiles"
|
|
369
|
+
:folder-home-file-name="store.workspaceSettings.folderHomeFileName"
|
|
370
|
+
:revealed-home-id="revealedHomeId"
|
|
371
|
+
:document-icons="treeDocumentIcons"
|
|
372
|
+
:load-document-icon="loadTreeDocumentIcon"
|
|
373
|
+
:selected-ids="selectedEntryIds"
|
|
374
|
+
:context-selected="fileContextMenu?.file.id"
|
|
375
|
+
:dragged-id="draggedEntry?.file.id"
|
|
376
|
+
:drop-target="dropFolder"
|
|
377
|
+
:drop-preview="dropPlaceholders"
|
|
378
|
+
:can-drag="canDragEntry"
|
|
379
|
+
:renaming-id="treeRename?.fileId"
|
|
380
|
+
:rename-entry="renameTreeEntry"
|
|
381
|
+
@open="openTreeEntry"
|
|
382
|
+
@select="selectFileTreeEntry"
|
|
383
|
+
@prefetch="store.prefetchFile"
|
|
384
|
+
@context="openFileContextMenu"
|
|
385
|
+
@context-blank="openDirectoryContextMenu"
|
|
386
|
+
@drag-start="fileDragStart"
|
|
387
|
+
@drag-end="fileDragEnd"
|
|
388
|
+
@drag-over="fileDragOver"
|
|
389
|
+
@drag-leave="fileDragLeave"
|
|
390
|
+
@drop="fileDrop"
|
|
391
|
+
@rename-finished="finishTreeRename"
|
|
392
|
+
/>
|
|
393
|
+
<div
|
|
394
|
+
v-if="!filesPending && !noteCount"
|
|
395
|
+
class="tree-empty"
|
|
396
|
+
@contextmenu.prevent="openDirectoryContextMenu('', $event)"
|
|
397
|
+
>
|
|
398
|
+
{{ t('你的下一页,') }}<br />{{ t('从一个新文档开始。') }}
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
<SidebarAssistant
|
|
404
|
+
v-if="sidebarView === 'assistant'"
|
|
405
|
+
@open="compactPanes && (sidebar = false)"
|
|
406
|
+
/>
|
|
407
|
+
<SidebarPlan
|
|
408
|
+
v-show="sidebarView === 'plan' || sidebarView === 'events'"
|
|
409
|
+
:active="sidebar && (sidebarView === 'plan' || sidebarView === 'events')"
|
|
410
|
+
:workspace-only="navigationContext === 'workspace'"
|
|
411
|
+
id="sidebar-plan-panel"
|
|
412
|
+
:date="sidebarCalendarDate"
|
|
413
|
+
@select-date="openCalendar"
|
|
414
|
+
@select-event="showPlanEvent"
|
|
415
|
+
/>
|
|
416
|
+
<SidebarMail
|
|
417
|
+
v-if="mailEnabled && sidebarView === MAIL_TAB_ID"
|
|
418
|
+
:id="`sidebar-${MAIL_TAB_ID}`"
|
|
419
|
+
@open-mail="openMail"
|
|
420
|
+
/>
|
|
421
|
+
<template v-for="view in extensionViews" :key="view.id">
|
|
422
|
+
<div
|
|
423
|
+
v-if="view.sidebar"
|
|
424
|
+
v-show="sidebarView === view.id"
|
|
425
|
+
:id="`sidebar-${view.id}`"
|
|
426
|
+
class="extension-sidebar"
|
|
427
|
+
>
|
|
428
|
+
<component :is="view.sidebar" :actions="viewActions[view.id]" />
|
|
429
|
+
</div>
|
|
430
|
+
</template>
|
|
431
|
+
|
|
432
|
+
<div class="sidebar-bottom">
|
|
433
|
+
<WorkspacePickerMenu />
|
|
434
|
+
<component
|
|
435
|
+
:is="extensions.regions['sidebar-footer']"
|
|
436
|
+
v-if="extensions.regions['sidebar-footer']"
|
|
437
|
+
:actions="extensionActions"
|
|
438
|
+
/>
|
|
439
|
+
<component
|
|
440
|
+
:is="extensions.regions['local-menu-login']"
|
|
441
|
+
v-if="extensions.regions['local-menu-login']"
|
|
442
|
+
:actions="extensionActions"
|
|
443
|
+
/>
|
|
444
|
+
<SidebarUpdateButton
|
|
445
|
+
:enabled="native && !mobile && !isAuxiliaryWindow"
|
|
446
|
+
:state="updates.state"
|
|
447
|
+
@download="updates.download()"
|
|
448
|
+
@install="updates.install()"
|
|
449
|
+
>
|
|
450
|
+
<HelpLauncher
|
|
451
|
+
:context="helpContext"
|
|
452
|
+
:availability="helpAvailability"
|
|
453
|
+
:available="sidebar && !isAuxiliaryWindow"
|
|
454
|
+
:blocked="helpBlocked"
|
|
455
|
+
:scope="`${navigationContext}:${workspace?.id ?? 'home'}:${activeId}`"
|
|
456
|
+
:documentation-base-url="documentationBaseUrl"
|
|
457
|
+
:native="native"
|
|
458
|
+
@open="
|
|
459
|
+
workspaceMenu = false;
|
|
460
|
+
menu = false;
|
|
461
|
+
"
|
|
462
|
+
@settings="openSettings"
|
|
463
|
+
@documentation="openExternalUrl($event).catch(store.report)"
|
|
464
|
+
/>
|
|
465
|
+
</SidebarUpdateButton>
|
|
466
|
+
</div>
|
|
467
|
+
|
|
468
|
+
<div
|
|
469
|
+
v-if="!compactPanes && !switchingWorkspace"
|
|
470
|
+
class="sidebar-resize-handle"
|
|
471
|
+
role="separator"
|
|
472
|
+
:aria-label="t('调整侧栏宽度')"
|
|
473
|
+
:data-tooltip="t('拖动调宽,向左拖到底收起')"
|
|
474
|
+
:data-tooltip-shortcut="shortcuts.toggleSidebar"
|
|
475
|
+
data-tooltip-anchor="pointer"
|
|
476
|
+
data-tooltip-delay="700"
|
|
477
|
+
aria-orientation="vertical"
|
|
478
|
+
:aria-valuenow="sidebarWidth ?? defaultSidebarWidth()"
|
|
479
|
+
:aria-valuemin="SIDEBAR_MIN_WIDTH"
|
|
480
|
+
:aria-valuemax="sidebarWidthLimit()"
|
|
481
|
+
tabindex="0"
|
|
482
|
+
@pointerdown="startSidebarResize"
|
|
483
|
+
@keydown="resizeSidebarWithKeyboard"
|
|
484
|
+
/>
|
|
485
|
+
</WorkspaceSidebar>
|
|
486
|
+
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ASSISTANT_TAB_ID } from '../assistant/navigation';
|
|
2
|
+
import { isTableTab } from '../data-tables/data-tables';
|
|
3
|
+
import { GRAPH_TAB_ID } from '../documents/document-graph';
|
|
4
|
+
import { MAIL_TAB_ID } from '../mail/types';
|
|
5
|
+
import { CALENDAR_TAB_ID } from '../plans/calendar';
|
|
6
|
+
import { PLUGINS_TAB_ID } from '../plugins/workspace-plugins';
|
|
7
|
+
import { SETTINGS_TAB_ID } from '../settings/settings-tab';
|
|
8
|
+
import type { DocumentTab, OpenDocument } from '../stores/workspace-types';
|
|
9
|
+
|
|
10
|
+
export type PaneViewKind =
|
|
11
|
+
| 'graph'
|
|
12
|
+
| 'table'
|
|
13
|
+
| 'directory'
|
|
14
|
+
| 'calendar'
|
|
15
|
+
| 'assistant'
|
|
16
|
+
| 'extension'
|
|
17
|
+
| 'settings'
|
|
18
|
+
| 'mail'
|
|
19
|
+
| 'plugin-detail'
|
|
20
|
+
| 'plugin-view'
|
|
21
|
+
| 'plugins'
|
|
22
|
+
| 'document'
|
|
23
|
+
| 'attachment'
|
|
24
|
+
| 'empty';
|
|
25
|
+
|
|
26
|
+
export interface PaneViewMatchContext {
|
|
27
|
+
activeId: string;
|
|
28
|
+
hasWorkspace: boolean;
|
|
29
|
+
mailEnabled: boolean;
|
|
30
|
+
extensionViewIds: readonly string[];
|
|
31
|
+
tab?: DocumentTab;
|
|
32
|
+
document?: OpenDocument;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Declaratively resolves the active view kind for a workbench pane, replacing
|
|
37
|
+
* ad-hoc negative `v-else-if` chains across pane shells.
|
|
38
|
+
*/
|
|
39
|
+
export function resolvePaneViewKind(ctx: PaneViewMatchContext): PaneViewKind {
|
|
40
|
+
const { activeId, hasWorkspace, mailEnabled, extensionViewIds, tab, document } = ctx;
|
|
41
|
+
if (hasWorkspace && activeId === GRAPH_TAB_ID) return 'graph';
|
|
42
|
+
if (hasWorkspace && isTableTab(activeId)) return 'table';
|
|
43
|
+
if (hasWorkspace && tab?.directory) return 'directory';
|
|
44
|
+
if (hasWorkspace && activeId === CALENDAR_TAB_ID) return 'calendar';
|
|
45
|
+
if (activeId === ASSISTANT_TAB_ID) return 'assistant';
|
|
46
|
+
if (extensionViewIds.includes(activeId)) return 'extension';
|
|
47
|
+
if (activeId === SETTINGS_TAB_ID) return 'settings';
|
|
48
|
+
if (mailEnabled && activeId === MAIL_TAB_ID) return 'mail';
|
|
49
|
+
if (tab?.pluginDetail) return 'plugin-detail';
|
|
50
|
+
if (activeId.startsWith('plugin:')) return 'plugin-view';
|
|
51
|
+
if (hasWorkspace && activeId === PLUGINS_TAB_ID) return 'plugins';
|
|
52
|
+
if (document) return 'document';
|
|
53
|
+
if (hasWorkspace && activeId.startsWith('attachment:')) return 'attachment';
|
|
54
|
+
return 'empty';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function isEmptyPaneFallback(ctx: PaneViewMatchContext & { startupPending: boolean }): boolean {
|
|
58
|
+
if (!ctx.hasWorkspace && !ctx.startupPending) return false;
|
|
59
|
+
if (ctx.activeId === GRAPH_TAB_ID) return false;
|
|
60
|
+
if (ctx.activeId === PLUGINS_TAB_ID) return false;
|
|
61
|
+
if (ctx.activeId === CALENDAR_TAB_ID) return false;
|
|
62
|
+
if (ctx.activeId === SETTINGS_TAB_ID) return false;
|
|
63
|
+
if (ctx.mailEnabled && ctx.activeId === MAIL_TAB_ID) return false;
|
|
64
|
+
if (isTableTab(ctx.activeId)) return false;
|
|
65
|
+
if (ctx.activeId.startsWith('plugin:')) return false;
|
|
66
|
+
if (ctx.tab?.directory || ctx.tab?.pluginView) return false;
|
|
67
|
+
if (ctx.extensionViewIds.includes(ctx.activeId)) return false;
|
|
68
|
+
return true;
|
|
69
|
+
}
|