@tano.page/workbench 0.14.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 +50 -16
- package/src/App.vue +82 -752
- 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/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/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +425 -8
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/connection-actions.ts +237 -0
- package/src/assistant/document-mentions.ts +1 -33
- package/src/assistant/engine.ts +1 -532
- package/src/assistant/execution.ts +6 -33
- package/src/assistant/files.ts +5 -13
- package/src/assistant/hash.ts +1 -4
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/language.ts +10 -37
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/plugin-bridge-builder.ts +146 -0
- package/src/assistant/prompts.ts +1 -58
- package/src/assistant/proposal-actions.ts +336 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +167 -327
- package/src/assistant/structures.ts +1 -155
- package/src/assistant/tasks.ts +8 -96
- package/src/assistant/tool-rules.ts +1 -7
- 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-help.ts +177 -0
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-lifecycle.ts +249 -0
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-settings.ts +185 -0
- package/src/composables/use-workbench-shortcuts.ts +40 -1021
- package/src/composables/use-workbench-views.ts +325 -0
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentActionMenu.vue +279 -0
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- 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/features.ts +1 -0
- package/src/files/components/FileMetadataPanel.vue +49 -15
- 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/locale-catalogs.ts +7 -6
- package/src/i18n/locale-registry.ts +8 -6
- package/src/i18n/locales/de-DE.json +371 -3
- package/src/i18n/locales/en-US.json +371 -2
- package/src/i18n/locales/es-ES.json +371 -3
- package/src/i18n/locales/ja-JP.json +370 -2
- package/src/i18n/locales/zh-TW.json +370 -2
- package/src/mail/components/MailAccountDialog.vue +450 -0
- package/src/mail/components/MailComposerDialog.vue +326 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +821 -0
- package/src/mail/components/SidebarMail.vue +134 -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/content-references.ts +6 -56
- package/src/objects/wiki-links.ts +1 -48
- package/src/objects/workspace-objects.ts +3 -4
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +65 -9
- package/src/plans/components/CalendarAgendaView.vue +165 -0
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- 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 +264 -748
- package/src/plans/components/CalendarYearView.vue +138 -0
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanConnectionsDialog.vue +1 -1
- 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/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/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 +136 -57
- package/src/plugins/components/PluginDeveloperArea.vue +192 -0
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +21 -25
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +273 -288
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +37 -34
- package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +112 -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/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/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-data.ts +2 -3
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-rpc-router.ts +558 -0
- package/src/plugins/plugin-sdk.ts +1 -94
- package/src/plugins/plugin-ui-dialogs.ts +167 -0
- 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 +1 -73
- 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/view-header.ts +2 -7
- 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 +103 -4
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- 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/components/settings-search.ts +2 -3
- 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/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +58 -34
- package/src/shell/components/WorkbenchModals.vue +47 -62
- package/src/shell/components/WorkbenchPanes.vue +371 -1342
- package/src/shell/components/WorkbenchSidebar.vue +486 -0
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- 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 +531 -1153
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/shell/workbench-context.ts +30 -3
- 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-document-io.ts +807 -0
- package/src/stores/workspace-file-ops.ts +1 -1
- package/src/stores/workspace-knowledge.ts +2 -114
- package/src/stores/workspace-lifecycle.ts +459 -0
- package/src/stores/workspace-plugins-state.ts +254 -259
- package/src/stores/workspace-session.ts +287 -0
- package/src/stores/workspace-tabs-layout.ts +6 -44
- package/src/stores/workspace-types.ts +50 -0
- package/src/stores/workspace.ts +184 -1363
- 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 +0 -1
- package/src/tabs/components/DesktopTabs.vue +19 -14
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- 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/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +30 -7
- package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/assistant/locales/de-DE.json +0 -126
- package/src/assistant/locales/en-US.json +0 -126
- package/src/assistant/locales/es-ES.json +0 -126
- package/src/assistant/locales/ja-JP.json +0 -126
- package/src/assistant/locales/zh-CN.json +0 -126
- package/src/assistant/locales/zh-TW.json +0 -126
- package/src/assistant/task-prompts.json +0 -39
- 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,599 @@
|
|
|
1
|
+
import { computed, type Ref } from 'vue';
|
|
2
|
+
import { storeToRefs } from 'pinia';
|
|
3
|
+
import { defaultSelectionContext, type EditorSelectionContext } from '@tano/editor/selection-context';
|
|
4
|
+
import type { FileEntry } from '@tano/protocol';
|
|
5
|
+
import type { useAssistantStore } from '../assistant/store';
|
|
6
|
+
import type { DocumentExportFormat } from '../documents/document-export';
|
|
7
|
+
import { t } from '../i18n/i18n';
|
|
8
|
+
import { mobile } from '../platform/platform';
|
|
9
|
+
import type { WorkbenchExtensions } from '../runtime';
|
|
10
|
+
import type { SettingsPageId } from '../settings/settings-window';
|
|
11
|
+
import type { useUpdatesStore } from '../stores/updates';
|
|
12
|
+
import type { useWorkspaceStore } from '../stores/workspace';
|
|
13
|
+
import { native } from '../workspace/adapter';
|
|
14
|
+
import { editorPaletteCommands, type WorkbenchCommand } from './command-palette';
|
|
15
|
+
import type { ShortcutBindings } from './shortcuts';
|
|
16
|
+
import type { MarkdownEditor } from './workbench-async-components';
|
|
17
|
+
|
|
18
|
+
export interface WorkbenchCommandsDeps {
|
|
19
|
+
store: ReturnType<typeof useWorkspaceStore>;
|
|
20
|
+
assistant: ReturnType<typeof useAssistantStore>;
|
|
21
|
+
updates: ReturnType<typeof useUpdatesStore>;
|
|
22
|
+
extensions: WorkbenchExtensions;
|
|
23
|
+
editing: WorkbenchExtensions['editing'];
|
|
24
|
+
isAuxiliaryWindow: boolean;
|
|
25
|
+
sidebar: Ref<boolean>;
|
|
26
|
+
sidebarView: Ref<string>;
|
|
27
|
+
navigationContext: Ref<'home' | 'workspace'>;
|
|
28
|
+
shortcuts: Ref<ShortcutBindings>;
|
|
29
|
+
updateLock: Ref<boolean>;
|
|
30
|
+
editorReadonly: Ref<boolean>;
|
|
31
|
+
source: Ref<boolean>;
|
|
32
|
+
revealMarkdown: Ref<boolean>;
|
|
33
|
+
pageLocked: Ref<boolean>;
|
|
34
|
+
workspaceLocked: Ref<boolean>;
|
|
35
|
+
limitPageWidth: Ref<boolean>;
|
|
36
|
+
pageWidthWritable: Ref<boolean>;
|
|
37
|
+
showOutline: Ref<boolean>;
|
|
38
|
+
showDocumentProperties: Ref<boolean>;
|
|
39
|
+
editor: Ref<InstanceType<typeof MarkdownEditor> | undefined>;
|
|
40
|
+
paneSelections: Record<string, EditorSelectionContext>;
|
|
41
|
+
documentUndoAvailable: Ref<boolean>;
|
|
42
|
+
documentRedoAvailable: Ref<boolean>;
|
|
43
|
+
exportBusy: Ref<boolean>;
|
|
44
|
+
printBusy: Ref<boolean>;
|
|
45
|
+
historyPanel: Ref<boolean>;
|
|
46
|
+
historyPage: Ref<'versions' | 'updates'>;
|
|
47
|
+
showModal: (kind: 'newTab' | 'search' | 'delete' | 'saveAs', target?: FileEntry) => void;
|
|
48
|
+
createNewDocument: () => Promise<void>;
|
|
49
|
+
createNewEntry: (kind: 'document' | 'folder' | 'table', parent?: string) => Promise<void>;
|
|
50
|
+
detachTab: (id: string) => Promise<void>;
|
|
51
|
+
openImport: () => void;
|
|
52
|
+
openTemplateLibrary: () => void;
|
|
53
|
+
exportDocument: (format: DocumentExportFormat) => Promise<void>;
|
|
54
|
+
printActiveDocument: () => Promise<void>;
|
|
55
|
+
openPaneSearch: (id?: string, replace?: boolean) => void;
|
|
56
|
+
undoDocument: () => void;
|
|
57
|
+
redoDocument: () => void;
|
|
58
|
+
toggleAssistant: () => void;
|
|
59
|
+
togglePageLock: () => void;
|
|
60
|
+
setLimitPageWidth: (value: boolean) => void;
|
|
61
|
+
openDocumentDiscussion: () => unknown;
|
|
62
|
+
toggleSidebar: () => void;
|
|
63
|
+
selectContext: (context: 'home' | 'workspace') => void;
|
|
64
|
+
toggleWorkspaceMenu: () => void;
|
|
65
|
+
selectModule: (id: string) => void;
|
|
66
|
+
openCalendar: (date?: Date) => void;
|
|
67
|
+
openSettings: (page?: SettingsPageId) => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Unified command runner shared by the status bar pinned-commands rail and
|
|
72
|
+
* command palette: resolves built-in workbench commands first, then falls back
|
|
73
|
+
* to registered workspace plugin commands.
|
|
74
|
+
*/
|
|
75
|
+
export function runWorkbenchCommandOrPlugin(
|
|
76
|
+
commandId: string,
|
|
77
|
+
commands: readonly WorkbenchCommand[],
|
|
78
|
+
store: ReturnType<typeof useWorkspaceStore>,
|
|
79
|
+
) {
|
|
80
|
+
const builtin = commands.find((item) => item.id === commandId);
|
|
81
|
+
if (builtin) {
|
|
82
|
+
void builtin.run();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const ws = store.workspace;
|
|
86
|
+
if (!ws) return;
|
|
87
|
+
const cmd = store.pluginCommands.find(
|
|
88
|
+
(item) => `${item.pluginId}:${item.id}` === commandId || item.id === commandId,
|
|
89
|
+
);
|
|
90
|
+
if (!cmd) return;
|
|
91
|
+
void store
|
|
92
|
+
.interactWithPlugin({
|
|
93
|
+
workspaceId: ws.id,
|
|
94
|
+
pluginId: cmd.pluginId,
|
|
95
|
+
instanceId: cmd.instanceId,
|
|
96
|
+
kind: 'command',
|
|
97
|
+
name: cmd.id,
|
|
98
|
+
payload: {
|
|
99
|
+
workspaceId: ws.id,
|
|
100
|
+
...(store.active?.id ? { fileId: store.active.id } : {}),
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
.catch(() => {});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function useWorkbenchCommands(deps: WorkbenchCommandsDeps) {
|
|
107
|
+
const {
|
|
108
|
+
store,
|
|
109
|
+
assistant,
|
|
110
|
+
updates,
|
|
111
|
+
extensions,
|
|
112
|
+
editing,
|
|
113
|
+
isAuxiliaryWindow,
|
|
114
|
+
sidebar,
|
|
115
|
+
sidebarView,
|
|
116
|
+
navigationContext,
|
|
117
|
+
shortcuts,
|
|
118
|
+
updateLock,
|
|
119
|
+
editorReadonly,
|
|
120
|
+
source,
|
|
121
|
+
revealMarkdown,
|
|
122
|
+
pageLocked,
|
|
123
|
+
workspaceLocked,
|
|
124
|
+
limitPageWidth,
|
|
125
|
+
pageWidthWritable,
|
|
126
|
+
showOutline,
|
|
127
|
+
showDocumentProperties,
|
|
128
|
+
editor,
|
|
129
|
+
paneSelections,
|
|
130
|
+
documentUndoAvailable,
|
|
131
|
+
documentRedoAvailable,
|
|
132
|
+
exportBusy,
|
|
133
|
+
printBusy,
|
|
134
|
+
historyPanel,
|
|
135
|
+
historyPage,
|
|
136
|
+
showModal,
|
|
137
|
+
createNewDocument,
|
|
138
|
+
createNewEntry,
|
|
139
|
+
detachTab,
|
|
140
|
+
openImport,
|
|
141
|
+
openTemplateLibrary,
|
|
142
|
+
exportDocument,
|
|
143
|
+
printActiveDocument,
|
|
144
|
+
openPaneSearch,
|
|
145
|
+
undoDocument,
|
|
146
|
+
redoDocument,
|
|
147
|
+
toggleAssistant,
|
|
148
|
+
togglePageLock,
|
|
149
|
+
setLimitPageWidth,
|
|
150
|
+
openDocumentDiscussion,
|
|
151
|
+
toggleSidebar,
|
|
152
|
+
selectContext,
|
|
153
|
+
toggleWorkspaceMenu,
|
|
154
|
+
selectModule,
|
|
155
|
+
openCalendar,
|
|
156
|
+
openSettings,
|
|
157
|
+
} = deps;
|
|
158
|
+
const { workspace, active, busy } = storeToRefs(store);
|
|
159
|
+
|
|
160
|
+
const workbenchCommands = computed<WorkbenchCommand[]>(() => {
|
|
161
|
+
const hasDocument = !!active.value;
|
|
162
|
+
const writableWorkspace =
|
|
163
|
+
!!workspace.value && !workspace.value.readOnly && !busy.value && !updateLock.value;
|
|
164
|
+
const standardEditor = hasDocument && !editing.active && !editing.activeBusy;
|
|
165
|
+
const editable = standardEditor && !editorReadonly.value && !active.value?.missing;
|
|
166
|
+
return [
|
|
167
|
+
{
|
|
168
|
+
id: 'workbench.search',
|
|
169
|
+
category: t('文档'),
|
|
170
|
+
get label() {
|
|
171
|
+
return t('查找文档');
|
|
172
|
+
},
|
|
173
|
+
shortcut: shortcuts.value.findDocument,
|
|
174
|
+
available: !busy.value,
|
|
175
|
+
run: () => showModal('search'),
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'workbench.open',
|
|
179
|
+
category: t('文档'),
|
|
180
|
+
get label() {
|
|
181
|
+
return t('打开文档');
|
|
182
|
+
},
|
|
183
|
+
shortcut: shortcuts.value.openDocument,
|
|
184
|
+
available: !busy.value,
|
|
185
|
+
run: () => showModal('newTab'),
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: 'workbench.new',
|
|
189
|
+
category: t('文档'),
|
|
190
|
+
get label() {
|
|
191
|
+
return t('新建文档');
|
|
192
|
+
},
|
|
193
|
+
shortcut: shortcuts.value.newDocument,
|
|
194
|
+
available: writableWorkspace,
|
|
195
|
+
run: createNewDocument,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 'workbench.new-window',
|
|
199
|
+
category: t('文档'),
|
|
200
|
+
get label() {
|
|
201
|
+
return t('新建窗口');
|
|
202
|
+
},
|
|
203
|
+
available:
|
|
204
|
+
native &&
|
|
205
|
+
!mobile &&
|
|
206
|
+
!isAuxiliaryWindow &&
|
|
207
|
+
!!workspace.value &&
|
|
208
|
+
!busy.value &&
|
|
209
|
+
!updateLock.value,
|
|
210
|
+
run: () => {
|
|
211
|
+
const id = store.createBlankTab();
|
|
212
|
+
if (id) return detachTab(id);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: 'workbench.reveal',
|
|
217
|
+
category: t('文档'),
|
|
218
|
+
get label() {
|
|
219
|
+
return t('在资源管理器中显示');
|
|
220
|
+
},
|
|
221
|
+
available: native && !mobile && !isAuxiliaryWindow && !!workspace.value && !store.isWeb,
|
|
222
|
+
run: () => store.reveal(),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: 'workbench.open-folder',
|
|
226
|
+
category: t('文档'),
|
|
227
|
+
get label() {
|
|
228
|
+
return t('打开文件夹');
|
|
229
|
+
},
|
|
230
|
+
available: !isAuxiliaryWindow && !busy.value && !updateLock.value,
|
|
231
|
+
run: () => store.openWorkspace(),
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: 'workbench.save',
|
|
235
|
+
category: t('文档'),
|
|
236
|
+
get label() {
|
|
237
|
+
return t('立即保存');
|
|
238
|
+
},
|
|
239
|
+
shortcut: shortcuts.value.save,
|
|
240
|
+
available: hasDocument && !busy.value && !updateLock.value,
|
|
241
|
+
run: () => store.flush(),
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
id: 'workbench.saveAs',
|
|
245
|
+
category: t('文档'),
|
|
246
|
+
get label() {
|
|
247
|
+
return t('另存副本');
|
|
248
|
+
},
|
|
249
|
+
available: standardEditor && writableWorkspace,
|
|
250
|
+
run: () => showModal('saveAs'),
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
id: 'workbench.folder',
|
|
254
|
+
category: t('文档'),
|
|
255
|
+
get label() {
|
|
256
|
+
return t('新建文件夹');
|
|
257
|
+
},
|
|
258
|
+
available: writableWorkspace,
|
|
259
|
+
run: () => createNewEntry('folder'),
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: 'workbench.table',
|
|
263
|
+
category: t('文档'),
|
|
264
|
+
get label() {
|
|
265
|
+
return t('新建数据表');
|
|
266
|
+
},
|
|
267
|
+
available: writableWorkspace,
|
|
268
|
+
run: () => createNewEntry('table'),
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'workbench.import',
|
|
272
|
+
category: t('文档'),
|
|
273
|
+
get label() {
|
|
274
|
+
return t('导入文档');
|
|
275
|
+
},
|
|
276
|
+
available: writableWorkspace,
|
|
277
|
+
run: openImport,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
id: 'workbench.templates',
|
|
281
|
+
category: t('文档'),
|
|
282
|
+
get label() {
|
|
283
|
+
return t('文档模板');
|
|
284
|
+
},
|
|
285
|
+
available: writableWorkspace,
|
|
286
|
+
run: openTemplateLibrary,
|
|
287
|
+
},
|
|
288
|
+
...(['markdown', 'docx', 'pdf', 'html', 'png'] as const).map((format) => ({
|
|
289
|
+
id: `workbench.export.${format}`,
|
|
290
|
+
category: t('导出'),
|
|
291
|
+
label: { markdown: 'Markdown', docx: 'Word', pdf: 'PDF', html: 'HTML', png: t('图片') }[
|
|
292
|
+
format
|
|
293
|
+
],
|
|
294
|
+
keywords: format,
|
|
295
|
+
available: hasDocument && !exportBusy.value,
|
|
296
|
+
run: () => exportDocument(format),
|
|
297
|
+
})),
|
|
298
|
+
{
|
|
299
|
+
id: 'workbench.print',
|
|
300
|
+
category: t('文档'),
|
|
301
|
+
get label() {
|
|
302
|
+
return t('打印文档');
|
|
303
|
+
},
|
|
304
|
+
shortcut: shortcuts.value.print,
|
|
305
|
+
available: hasDocument && !printBusy.value,
|
|
306
|
+
run: printActiveDocument,
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
id: 'workbench.find',
|
|
310
|
+
category: t('编辑'),
|
|
311
|
+
get label() {
|
|
312
|
+
return t('页内搜索');
|
|
313
|
+
},
|
|
314
|
+
shortcut: shortcuts.value.pageSearch,
|
|
315
|
+
available: standardEditor,
|
|
316
|
+
run: () => openPaneSearch(),
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
id: 'workbench.replace',
|
|
320
|
+
category: t('编辑'),
|
|
321
|
+
get label() {
|
|
322
|
+
return t('查找与替换');
|
|
323
|
+
},
|
|
324
|
+
shortcut: shortcuts.value.pageReplace,
|
|
325
|
+
available: editable,
|
|
326
|
+
run: () => openPaneSearch(store.activePaneId, true),
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: 'workbench.undo',
|
|
330
|
+
category: t('编辑'),
|
|
331
|
+
get label() {
|
|
332
|
+
return t('撤销');
|
|
333
|
+
},
|
|
334
|
+
available: editable && documentUndoAvailable.value,
|
|
335
|
+
run: undoDocument,
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: 'workbench.redo',
|
|
339
|
+
category: t('编辑'),
|
|
340
|
+
get label() {
|
|
341
|
+
return t('重做');
|
|
342
|
+
},
|
|
343
|
+
available: editable && documentRedoAvailable.value,
|
|
344
|
+
run: redoDocument,
|
|
345
|
+
},
|
|
346
|
+
...editorPaletteCommands({
|
|
347
|
+
editable: editable && !!editor.value,
|
|
348
|
+
source: source.value,
|
|
349
|
+
context: paneSelections[store.activePaneId] ?? defaultSelectionContext,
|
|
350
|
+
features: store.capabilities.features,
|
|
351
|
+
run: (name, value) => editor.value?.command(name, value),
|
|
352
|
+
}),
|
|
353
|
+
{
|
|
354
|
+
id: 'workbench.source',
|
|
355
|
+
category: t('视图'),
|
|
356
|
+
label: source.value ? t('返回可视化编辑') : t('切换源码模式'),
|
|
357
|
+
shortcut: shortcuts.value.toggleSource,
|
|
358
|
+
available: standardEditor,
|
|
359
|
+
keywords: 'Markdown source',
|
|
360
|
+
run: () => {
|
|
361
|
+
source.value = !source.value;
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
id: 'workbench.markdown-reveal',
|
|
366
|
+
category: t('视图'),
|
|
367
|
+
get label() {
|
|
368
|
+
return t('光标展开源码');
|
|
369
|
+
},
|
|
370
|
+
shortcut: shortcuts.value.toggleMarkdownReveal,
|
|
371
|
+
available: standardEditor && !source.value,
|
|
372
|
+
keywords: 'Markdown source cursor',
|
|
373
|
+
run: () => {
|
|
374
|
+
revealMarkdown.value = !revealMarkdown.value;
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
id: 'workbench.assistant',
|
|
379
|
+
category: t('视图'),
|
|
380
|
+
get label() {
|
|
381
|
+
return t('打开或关闭同页助手');
|
|
382
|
+
},
|
|
383
|
+
shortcut: shortcuts.value.toggleAssistant,
|
|
384
|
+
available: !!workspace.value && assistant.available,
|
|
385
|
+
run: toggleAssistant,
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
id: 'workbench.reading',
|
|
389
|
+
category: t('视图'),
|
|
390
|
+
label: pageLocked.value ? t('退出阅读模式') : t('进入阅读模式'),
|
|
391
|
+
available: hasDocument && !workspaceLocked.value,
|
|
392
|
+
keywords: t('锁定页面 解锁'),
|
|
393
|
+
run: togglePageLock,
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
id: 'workbench.width',
|
|
397
|
+
category: t('视图'),
|
|
398
|
+
label: limitPageWidth.value ? t('展开页面全宽') : t('限制页面宽度'),
|
|
399
|
+
available: hasDocument && pageWidthWritable.value,
|
|
400
|
+
run: () => setLimitPageWidth(!limitPageWidth.value),
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: 'workbench.outline',
|
|
404
|
+
category: t('视图'),
|
|
405
|
+
label: showOutline.value ? t('隐藏文档目录') : t('显示文档目录'),
|
|
406
|
+
available: hasDocument,
|
|
407
|
+
keywords: t('大纲'),
|
|
408
|
+
run: () => {
|
|
409
|
+
showOutline.value = !showOutline.value;
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: 'workbench.properties',
|
|
414
|
+
category: t('视图'),
|
|
415
|
+
label: showDocumentProperties.value ? t('隐藏文档属性') : t('显示文档属性'),
|
|
416
|
+
available: hasDocument,
|
|
417
|
+
run: () => {
|
|
418
|
+
showDocumentProperties.value = !showDocumentProperties.value;
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
id: 'workbench.discussion',
|
|
423
|
+
category: t('文档'),
|
|
424
|
+
get label() {
|
|
425
|
+
return t('发起讨论');
|
|
426
|
+
},
|
|
427
|
+
keywords: t('文档讨论 评论'),
|
|
428
|
+
available: editable,
|
|
429
|
+
run: openDocumentDiscussion,
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
id: 'workbench.sidebar',
|
|
433
|
+
category: t('视图'),
|
|
434
|
+
label: sidebar.value ? t('收起侧栏') : t('展开侧栏'),
|
|
435
|
+
shortcut: shortcuts.value.toggleSidebar,
|
|
436
|
+
available: !isAuxiliaryWindow,
|
|
437
|
+
run: toggleSidebar,
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
id: 'workbench.home',
|
|
441
|
+
category: t('导航'),
|
|
442
|
+
get label() {
|
|
443
|
+
return t('切换到主页');
|
|
444
|
+
},
|
|
445
|
+
available: !isAuxiliaryWindow,
|
|
446
|
+
run: () => {
|
|
447
|
+
selectContext('home');
|
|
448
|
+
sidebar.value = true;
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
id: 'workbench.switch-workspace',
|
|
453
|
+
category: t('导航'),
|
|
454
|
+
get label() {
|
|
455
|
+
return t('切换工作区');
|
|
456
|
+
},
|
|
457
|
+
available: !isAuxiliaryWindow,
|
|
458
|
+
run: () => {
|
|
459
|
+
sidebar.value = true;
|
|
460
|
+
toggleWorkspaceMenu();
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
...(extensions.commands ?? []),
|
|
464
|
+
{
|
|
465
|
+
id: 'workbench.repository',
|
|
466
|
+
category: t('工作区'),
|
|
467
|
+
get label() {
|
|
468
|
+
return t('打开仓库');
|
|
469
|
+
},
|
|
470
|
+
available: !isAuxiliaryWindow,
|
|
471
|
+
run: () => {
|
|
472
|
+
sidebar.value = true;
|
|
473
|
+
sidebarView.value = 'repository';
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
id: 'workbench.plan',
|
|
478
|
+
category: t('工作区'),
|
|
479
|
+
get label() {
|
|
480
|
+
return t('打开计划');
|
|
481
|
+
},
|
|
482
|
+
available: !isAuxiliaryWindow && store.workspaceSettings.showPlan,
|
|
483
|
+
run: () => {
|
|
484
|
+
sidebar.value = true;
|
|
485
|
+
selectModule('plan');
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
id: 'workbench.calendar',
|
|
490
|
+
category: t('工作区'),
|
|
491
|
+
get label() {
|
|
492
|
+
return t('打开日历');
|
|
493
|
+
},
|
|
494
|
+
available: store.workspaceSettings.showPlan,
|
|
495
|
+
run: () => openCalendar(),
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
id: 'workbench.graph',
|
|
499
|
+
category: t('工作区'),
|
|
500
|
+
get label() {
|
|
501
|
+
return t('打开关系图谱');
|
|
502
|
+
},
|
|
503
|
+
available: store.workspaceSettings.showGraph,
|
|
504
|
+
run: () => store.openGraphTab(),
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
id: 'workbench.plugins',
|
|
508
|
+
category: t('工作区'),
|
|
509
|
+
get label() {
|
|
510
|
+
return t('打开插件中心');
|
|
511
|
+
},
|
|
512
|
+
available: store.workspaceSettings.showPlugins,
|
|
513
|
+
run: () => store.openPluginsTab(),
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
id: 'workbench.updates',
|
|
517
|
+
category: t('历史'),
|
|
518
|
+
get label() {
|
|
519
|
+
return t('文档更新历史');
|
|
520
|
+
},
|
|
521
|
+
available: hasDocument,
|
|
522
|
+
run: () => {
|
|
523
|
+
historyPage.value = 'updates';
|
|
524
|
+
historyPanel.value = true;
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
id: 'workbench.versions',
|
|
529
|
+
category: t('历史'),
|
|
530
|
+
get label() {
|
|
531
|
+
return t('文档版本历史');
|
|
532
|
+
},
|
|
533
|
+
available: hasDocument && !!extensions.historyEnabled && !!extensions.historyView,
|
|
534
|
+
run: () => {
|
|
535
|
+
historyPage.value = 'versions';
|
|
536
|
+
historyPanel.value = true;
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
id: 'workbench.settings',
|
|
541
|
+
category: t('设置'),
|
|
542
|
+
get label() {
|
|
543
|
+
return t('外观设置');
|
|
544
|
+
},
|
|
545
|
+
keywords: t('打开设置'),
|
|
546
|
+
run: () => openSettings('appearance'),
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
id: 'workbench.settings.editing',
|
|
550
|
+
category: t('设置'),
|
|
551
|
+
get label() {
|
|
552
|
+
return t('编辑设置');
|
|
553
|
+
},
|
|
554
|
+
run: () => openSettings('editing'),
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
id: 'workbench.settings.shortcuts',
|
|
558
|
+
category: t('设置'),
|
|
559
|
+
get label() {
|
|
560
|
+
return t('快捷键');
|
|
561
|
+
},
|
|
562
|
+
run: () => openSettings('shortcuts'),
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
id: 'workbench.settings.workspace',
|
|
566
|
+
category: t('设置'),
|
|
567
|
+
get label() {
|
|
568
|
+
return t('工作区设置');
|
|
569
|
+
},
|
|
570
|
+
available: navigationContext.value === 'workspace' && !!workspace.value,
|
|
571
|
+
run: () => openSettings('workspace'),
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
id: 'workbench.settings.about',
|
|
575
|
+
category: t('设置'),
|
|
576
|
+
get label() {
|
|
577
|
+
return t('关于同页');
|
|
578
|
+
},
|
|
579
|
+
run: () => openSettings('about'),
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
id: 'workbench.check-updates',
|
|
583
|
+
category: t('设置'),
|
|
584
|
+
get label() {
|
|
585
|
+
return t('检查更新');
|
|
586
|
+
},
|
|
587
|
+
available: native && !mobile && !updateLock.value && !updates.state.busy,
|
|
588
|
+
run: () => {
|
|
589
|
+
openSettings('about');
|
|
590
|
+
return updates.check();
|
|
591
|
+
},
|
|
592
|
+
},
|
|
593
|
+
];
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
return {
|
|
597
|
+
workbenchCommands,
|
|
598
|
+
};
|
|
599
|
+
}
|