@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
|
@@ -48,7 +48,6 @@ const props = defineProps<{
|
|
|
48
48
|
context: EditorSelectionContext;
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
source?: boolean;
|
|
51
|
-
enabledLevels?: readonly number[];
|
|
52
51
|
features?: DocumentFeatures;
|
|
53
52
|
compact?: boolean;
|
|
54
53
|
compactActions?: boolean;
|
|
@@ -160,7 +159,7 @@ const availableBlocks = computed(() => blockMenuGroups
|
|
|
160
159
|
.map(types => types
|
|
161
160
|
.map(type => blockTypes.find(item => item.type === type)!)
|
|
162
161
|
.filter(item => !insertionCommands.has(item.command)
|
|
163
|
-
&& commandEnabled(item.command, props.
|
|
162
|
+
&& commandEnabled(item.command, props.features)
|
|
164
163
|
&& (props.context.availableBlockCommands?.includes(item.command)
|
|
165
164
|
?? (props.context.canTransform || wrappingCommands.has(item.command)))))
|
|
166
165
|
.filter(items => items.length > 0)
|
|
@@ -171,7 +170,7 @@ const availableBlocks = computed(() => blockMenuGroups
|
|
|
171
170
|
}))),
|
|
172
171
|
);
|
|
173
172
|
const availableInline = computed(() =>
|
|
174
|
-
inlineTypes.map(item => ({ ...item, label: t(item.label) })).filter((item) => commandEnabled(item.command, props.
|
|
173
|
+
inlineTypes.map(item => ({ ...item, label: t(item.label) })).filter((item) => commandEnabled(item.command, props.features)),
|
|
175
174
|
);
|
|
176
175
|
const useCompactActions = computed(() => props.compact || props.compactActions);
|
|
177
176
|
const primaryInline = computed(() =>
|
|
@@ -280,7 +279,7 @@ function toggleBlockMenu() {
|
|
|
280
279
|
onMounted(() => window.addEventListener('click', outside));
|
|
281
280
|
onBeforeUnmount(() => window.removeEventListener('click', outside));
|
|
282
281
|
async function run(name: string, argument?: string) {
|
|
283
|
-
if (props.disabled || props.source || !commandEnabled(name, props.
|
|
282
|
+
if (props.disabled || props.source || !commandEnabled(name, props.features))
|
|
284
283
|
return;
|
|
285
284
|
open.value = false;
|
|
286
285
|
if (['link', 'mention', 'image', 'footnote', 'file', 'embed'].includes(name)) {
|
|
@@ -447,7 +446,7 @@ onBeforeUnmount(() => { for (const element of actionMotions.keys()) clearActionM
|
|
|
447
446
|
</button>
|
|
448
447
|
</template>
|
|
449
448
|
<select v-if="compact && context.block === 'Callout'" :aria-label="t('提示块类型')"
|
|
450
|
-
:disabled="disabled || !commandEnabled('callout',
|
|
449
|
+
:disabled="disabled || !commandEnabled('callout', features)"
|
|
451
450
|
@change="run('callout', ($event.target as HTMLSelectElement).value)">
|
|
452
451
|
<option disabled selected value="">{{ t('提示类型') }}</option>
|
|
453
452
|
<option value="NOTE">{{ t('备注') }}</option><option value="TIP">{{ t('提示') }}</option>
|
|
@@ -556,7 +555,7 @@ onBeforeUnmount(() => { for (const element of actionMotions.keys()) clearActionM
|
|
|
556
555
|
<TextStyleMenu
|
|
557
556
|
v-if="context.level === 'inline' || useCompactActions"
|
|
558
557
|
:more="useCompactActions"
|
|
559
|
-
:inline-math="useCompactActions && commandEnabled('math',
|
|
558
|
+
:inline-math="useCompactActions && commandEnabled('math', features)"
|
|
560
559
|
:text-color="context.textColor"
|
|
561
560
|
:background-color="context.backgroundColor"
|
|
562
561
|
:dragging="dragging"
|
|
@@ -591,7 +590,7 @@ onBeforeUnmount(() => { for (const element of actionMotions.keys()) clearActionM
|
|
|
591
590
|
</template>
|
|
592
591
|
</TextStyleMenu>
|
|
593
592
|
<button
|
|
594
|
-
v-if="!useCompactActions && context.level === 'block' && commandEnabled('reference',
|
|
593
|
+
v-if="!useCompactActions && context.level === 'block' && commandEnabled('reference', features)"
|
|
595
594
|
type="button"
|
|
596
595
|
class="icon-button"
|
|
597
596
|
:aria-label="t('引用对象或文档')"
|
|
@@ -603,7 +602,7 @@ onBeforeUnmount(() => { for (const element of actionMotions.keys()) clearActionM
|
|
|
603
602
|
<AtSign :size="17" />
|
|
604
603
|
</button>
|
|
605
604
|
<button
|
|
606
|
-
v-if="!useCompactActions && context.level === 'block' && commandEnabled('mention',
|
|
605
|
+
v-if="!useCompactActions && context.level === 'block' && commandEnabled('mention', features)"
|
|
607
606
|
type="button"
|
|
608
607
|
class="icon-button"
|
|
609
608
|
:aria-label="t('提及文档')"
|
|
@@ -617,7 +616,7 @@ onBeforeUnmount(() => { for (const element of actionMotions.keys()) clearActionM
|
|
|
617
616
|
<select
|
|
618
617
|
v-if="!compact && context.block === 'Callout'"
|
|
619
618
|
:aria-label="t('提示块类型')"
|
|
620
|
-
:disabled="disabled || !commandEnabled('callout',
|
|
619
|
+
:disabled="disabled || !commandEnabled('callout', features)"
|
|
621
620
|
@change="run('callout', ($event.target as HTMLSelectElement).value)"
|
|
622
621
|
>
|
|
623
622
|
<option disabled selected value="">{{ t('提示类型') }}</option>
|
|
@@ -21,7 +21,6 @@ const props = defineProps<{
|
|
|
21
21
|
editorElement?: HTMLElement;
|
|
22
22
|
context: EditorSelectionContext;
|
|
23
23
|
features?: DocumentFeatures;
|
|
24
|
-
enabledLevels?: readonly number[];
|
|
25
24
|
disabled?: boolean;
|
|
26
25
|
source?: boolean;
|
|
27
26
|
assistant?: boolean;
|
|
@@ -105,7 +104,7 @@ function positionPreview() {
|
|
|
105
104
|
panel.style.top = `${position.y}px`;
|
|
106
105
|
}
|
|
107
106
|
watch(
|
|
108
|
-
[drag, previewPanel, () => props.context, () => props.features
|
|
107
|
+
[drag, previewPanel, () => props.context, () => props.features],
|
|
109
108
|
positionPreview,
|
|
110
109
|
{ flush: 'post' },
|
|
111
110
|
);
|
|
@@ -149,7 +148,6 @@ async function changeMode(mode: ToolbarMode) {
|
|
|
149
148
|
:class="{ 'toolbar-being-dragged': drag }"
|
|
150
149
|
:context="context"
|
|
151
150
|
:features="features"
|
|
152
|
-
:enabled-levels="enabledLevels"
|
|
153
151
|
:disabled="disabled"
|
|
154
152
|
:source="source"
|
|
155
153
|
:dragging="!!drag"
|
|
@@ -177,7 +175,6 @@ async function changeMode(mode: ToolbarMode) {
|
|
|
177
175
|
:editor-element="editorElement"
|
|
178
176
|
:context="context"
|
|
179
177
|
:features="features"
|
|
180
|
-
:enabled-levels="enabledLevels"
|
|
181
178
|
:mode="mode"
|
|
182
179
|
:dragging="!!drag"
|
|
183
180
|
:assistant="assistant"
|
|
@@ -213,7 +210,6 @@ async function changeMode(mode: ToolbarMode) {
|
|
|
213
210
|
:class="{ 'switchable-toolbar': drag.target === 'fixed' }"
|
|
214
211
|
:context="context"
|
|
215
212
|
:features="features"
|
|
216
|
-
:enabled-levels="enabledLevels"
|
|
217
213
|
:disabled="disabled"
|
|
218
214
|
:source="source"
|
|
219
215
|
:assistant="assistant"
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, toRefs } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
ArrowDownToLine,
|
|
5
|
+
ArrowLeft,
|
|
6
|
+
ArrowRight,
|
|
7
|
+
ChevronRight,
|
|
8
|
+
List,
|
|
9
|
+
LockKeyhole,
|
|
10
|
+
MessageSquareDiff,
|
|
11
|
+
PanelLeftOpen,
|
|
12
|
+
Puzzle,
|
|
13
|
+
X,
|
|
14
|
+
} from 'lucide-vue-next';
|
|
15
|
+
import type { WorkspacePane } from '@tano/protocol';
|
|
16
|
+
import { isTableTab } from '../../data-tables/data-tables';
|
|
17
|
+
import { GRAPH_TAB_ID } from '../../documents/document-graph';
|
|
18
|
+
import { t } from '../../i18n/i18n';
|
|
19
|
+
import { CALENDAR_TAB_ID } from '../../plans/calendar';
|
|
20
|
+
import { mobile } from '../../platform/platform';
|
|
21
|
+
import { pluginPreviewStatus, pluginViewHeader } from '../../plugins/view-header';
|
|
22
|
+
import { PLUGINS_TAB_ID } from '../../plugins/workspace-plugins';
|
|
23
|
+
import type { DocumentTab, OpenDocument } from '../../stores/workspace-types';
|
|
24
|
+
import { shortcutAriaLabel, shortcutKeys } from '../shortcuts';
|
|
25
|
+
import {
|
|
26
|
+
workbenchDocumentsKey,
|
|
27
|
+
workbenchPrefsKey,
|
|
28
|
+
workbenchShellKey,
|
|
29
|
+
workbenchTreeMenusKey,
|
|
30
|
+
} from '../workbench-context';
|
|
31
|
+
import ButtonVisibilityGroup from './ButtonVisibilityGroup.vue';
|
|
32
|
+
import WorkspaceBreadcrumb from './WorkspaceBreadcrumb.vue';
|
|
33
|
+
import DocumentStatus from '../../documents/components/DocumentStatus.vue';
|
|
34
|
+
import DocumentActionMenu from '../../documents/components/DocumentActionMenu.vue';
|
|
35
|
+
import MarkdownRevealToggle from '../../documents/components/MarkdownRevealToggle.vue';
|
|
36
|
+
import SourceCodeIcon from '../../documents/components/SourceCodeIcon.vue';
|
|
37
|
+
import PluginViewHeader from '../../plugins/components/PluginViewHeader.vue';
|
|
38
|
+
import CalendarTopbarControls from '../../plans/components/CalendarTopbarControls.vue';
|
|
39
|
+
|
|
40
|
+
defineProps<{
|
|
41
|
+
pane: WorkspacePane;
|
|
42
|
+
active?: OpenDocument;
|
|
43
|
+
tab?: DocumentTab;
|
|
44
|
+
isAuxiliaryWindow: boolean;
|
|
45
|
+
}>();
|
|
46
|
+
|
|
47
|
+
const shell = inject(workbenchShellKey);
|
|
48
|
+
const prefs = inject(workbenchPrefsKey);
|
|
49
|
+
const documents = inject(workbenchDocumentsKey);
|
|
50
|
+
const treeMenus = inject(workbenchTreeMenusKey);
|
|
51
|
+
if (!shell || !prefs || !documents || !treeMenus) throw new Error('Workbench context is required');
|
|
52
|
+
|
|
53
|
+
const {
|
|
54
|
+
native,
|
|
55
|
+
workspace,
|
|
56
|
+
filesPending,
|
|
57
|
+
sidebar,
|
|
58
|
+
toggleSidebar,
|
|
59
|
+
store,
|
|
60
|
+
extensions,
|
|
61
|
+
extensionActions,
|
|
62
|
+
extensionViews,
|
|
63
|
+
settingsTabView,
|
|
64
|
+
mailEnabled,
|
|
65
|
+
mailTabView,
|
|
66
|
+
workspaceStatusLabel,
|
|
67
|
+
openEntry,
|
|
68
|
+
openBreadcrumbDirectory,
|
|
69
|
+
topbarVisibilityItems,
|
|
70
|
+
closeButtonVisibilityMenus,
|
|
71
|
+
canNavigatePage,
|
|
72
|
+
navigatePage,
|
|
73
|
+
paneButterflyScope,
|
|
74
|
+
touchLayout,
|
|
75
|
+
attachments,
|
|
76
|
+
calendarToolItems,
|
|
77
|
+
calendarPeriod,
|
|
78
|
+
calendarDate,
|
|
79
|
+
moveCalendarPeriod,
|
|
80
|
+
calendarModeOpen,
|
|
81
|
+
calendarModeLabel,
|
|
82
|
+
calendarModeOptions,
|
|
83
|
+
calendarMode,
|
|
84
|
+
selectCalendarMode,
|
|
85
|
+
openPlanArchive,
|
|
86
|
+
documentToolItems,
|
|
87
|
+
} = toRefs(shell);
|
|
88
|
+
const { tabsEnabled, shortcuts, revealMarkdown } = toRefs(prefs);
|
|
89
|
+
const {
|
|
90
|
+
paneDocumentStatus,
|
|
91
|
+
attachmentStatus,
|
|
92
|
+
currentAttachmentStatus,
|
|
93
|
+
showOutline,
|
|
94
|
+
touchOutlineOpen,
|
|
95
|
+
documentSuggestions,
|
|
96
|
+
editing,
|
|
97
|
+
suggestionModeBusy,
|
|
98
|
+
toggleSuggestionMode,
|
|
99
|
+
paneSource,
|
|
100
|
+
setPaneSource,
|
|
101
|
+
} = toRefs(documents);
|
|
102
|
+
const { treeDocumentIcons, loadTreeDocumentIcon } = toRefs(treeMenus);
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<template>
|
|
106
|
+
<ButtonVisibilityGroup
|
|
107
|
+
v-slot="{ isVisible }"
|
|
108
|
+
:items="topbarVisibilityItems(pane.activeId, !!active, pane.id === store.activePaneId)"
|
|
109
|
+
preference-key="tano.preference.documentHiddenTools"
|
|
110
|
+
tag="header"
|
|
111
|
+
:group-class="pane.activeId === GRAPH_TAB_ID ? 'topbar graph-topbar' : 'topbar'"
|
|
112
|
+
:label="pane.activeId === GRAPH_TAB_ID ? t('图谱顶部栏') : t('文档顶部栏')"
|
|
113
|
+
:menu-label="t('顶部栏显示设置')"
|
|
114
|
+
@open="closeButtonVisibilityMenus"
|
|
115
|
+
>
|
|
116
|
+
<div
|
|
117
|
+
v-if="
|
|
118
|
+
(native && !tabsEnabled && (isVisible('back') || isVisible('forward'))) ||
|
|
119
|
+
(!sidebar && !(native && !mobile && workspace))
|
|
120
|
+
"
|
|
121
|
+
class="topbar-navigation"
|
|
122
|
+
:data-surface-role="pane.activeId === GRAPH_TAB_ID ? 'card' : undefined"
|
|
123
|
+
role="group"
|
|
124
|
+
:aria-label="pane.activeId === GRAPH_TAB_ID ? t('图谱导航') : t('文档导航')"
|
|
125
|
+
>
|
|
126
|
+
<button
|
|
127
|
+
v-if="!sidebar && !(native && !mobile && workspace)"
|
|
128
|
+
type="button"
|
|
129
|
+
class="icon-button"
|
|
130
|
+
:aria-label="t('展开侧栏')"
|
|
131
|
+
:data-tooltip="t('展开侧栏')"
|
|
132
|
+
:data-tooltip-shortcut="shortcuts.toggleSidebar"
|
|
133
|
+
@click="toggleSidebar"
|
|
134
|
+
>
|
|
135
|
+
<PanelLeftOpen :size="16" :stroke-width="1.6" />
|
|
136
|
+
</button>
|
|
137
|
+
<button
|
|
138
|
+
v-if="native && !tabsEnabled && isVisible('back')"
|
|
139
|
+
type="button"
|
|
140
|
+
class="icon-button"
|
|
141
|
+
:aria-label="t('后退')"
|
|
142
|
+
:data-tooltip="t('后退')"
|
|
143
|
+
:disabled="!canNavigatePage(-1)"
|
|
144
|
+
@click="navigatePage(-1)"
|
|
145
|
+
>
|
|
146
|
+
<ArrowLeft :size="16" :stroke-width="1.6" />
|
|
147
|
+
</button>
|
|
148
|
+
<button
|
|
149
|
+
v-if="native && !tabsEnabled && isVisible('forward')"
|
|
150
|
+
type="button"
|
|
151
|
+
class="icon-button"
|
|
152
|
+
:aria-label="t('前进')"
|
|
153
|
+
:data-tooltip="t('前进')"
|
|
154
|
+
:disabled="!canNavigatePage(1)"
|
|
155
|
+
@click="navigatePage(1)"
|
|
156
|
+
>
|
|
157
|
+
<ArrowRight :size="16" :stroke-width="1.6" />
|
|
158
|
+
</button>
|
|
159
|
+
</div>
|
|
160
|
+
<WorkspaceBreadcrumb
|
|
161
|
+
:loading="filesPending"
|
|
162
|
+
:perch="{
|
|
163
|
+
id: `breadcrumb:${paneButterflyScope(pane.id, pane.activeId)}`,
|
|
164
|
+
scope: paneButterflyScope(pane.id, pane.activeId),
|
|
165
|
+
label: t('面包屑'),
|
|
166
|
+
kind: 'component',
|
|
167
|
+
}"
|
|
168
|
+
v-if="
|
|
169
|
+
isVisible('breadcrumb') &&
|
|
170
|
+
pane.activeId !== CALENDAR_TAB_ID &&
|
|
171
|
+
pane.activeId !== GRAPH_TAB_ID
|
|
172
|
+
"
|
|
173
|
+
:workspace-id="workspace?.id"
|
|
174
|
+
:workspace-name="workspace?.name ?? 'Tano'"
|
|
175
|
+
:workspace-icon="store.workspaceSettings.icon"
|
|
176
|
+
:workspace-mode="store.isDemo ? 'demo' : store.isWeb ? 'web' : 'local'"
|
|
177
|
+
:entries="workspace?.files ?? []"
|
|
178
|
+
:folder-home-file-name="store.workspaceSettings.folderHomeFileName"
|
|
179
|
+
:document-icons="treeDocumentIcons"
|
|
180
|
+
:load-document-icon="loadTreeDocumentIcon"
|
|
181
|
+
:path="tab?.path"
|
|
182
|
+
:directory="!!tab?.directory"
|
|
183
|
+
:demo-label="store.isDemo ? workspaceStatusLabel : undefined"
|
|
184
|
+
:read-only="workspace?.readOnly"
|
|
185
|
+
@open="(file) => { store.focusPane(pane.id); openEntry(file); }"
|
|
186
|
+
@open-directory="(path) => { store.focusPane(pane.id); void openBreadcrumbDirectory(path); }"
|
|
187
|
+
>
|
|
188
|
+
<template #status>
|
|
189
|
+
<DocumentStatus
|
|
190
|
+
v-if="tab?.pluginView && isVisible('document-status')"
|
|
191
|
+
:document-key="`${workspace?.id}:${tab.pluginView.pluginId}:${tab.pluginView.id}:${pluginViewHeader(store.pluginRuntime, tab.pluginView)?.title}`"
|
|
192
|
+
:items="pluginPreviewStatus(store.pluginRuntime, tab.pluginView)"
|
|
193
|
+
/>
|
|
194
|
+
<DocumentStatus
|
|
195
|
+
v-if="active && isVisible('document-status')"
|
|
196
|
+
:document-key="`${workspace?.id}:${active.id}`"
|
|
197
|
+
:items="paneDocumentStatus(active)"
|
|
198
|
+
>
|
|
199
|
+
<component
|
|
200
|
+
:is="extensions.regions['document-status-details']"
|
|
201
|
+
v-if="pane.id === store.activePaneId && extensions.regions['document-status-details']"
|
|
202
|
+
:actions="extensionActions"
|
|
203
|
+
/>
|
|
204
|
+
</DocumentStatus>
|
|
205
|
+
<DocumentStatus
|
|
206
|
+
v-else-if="tab?.attachment && isVisible('document-status')"
|
|
207
|
+
:document-key="`${workspace?.id}:${tab.attachment.id}`"
|
|
208
|
+
:items="attachmentStatus(pane.id, tab.attachment)"
|
|
209
|
+
>
|
|
210
|
+
<button
|
|
211
|
+
v-if="currentAttachmentStatus(pane.id, tab.attachment)?.retry"
|
|
212
|
+
:disabled="currentAttachmentStatus(pane.id, tab.attachment)?.retryDisabled"
|
|
213
|
+
@click="currentAttachmentStatus(pane.id, tab.attachment)?.retry?.()"
|
|
214
|
+
>
|
|
215
|
+
{{ t('重试') }}
|
|
216
|
+
</button>
|
|
217
|
+
</DocumentStatus>
|
|
218
|
+
</template>
|
|
219
|
+
<template v-if="tab?.pluginDetail">
|
|
220
|
+
<ChevronRight :size="12" /><Puzzle :size="14" /><span class="breadcrumb-current">{{ tab.pluginDetail.name }}</span>
|
|
221
|
+
</template>
|
|
222
|
+
<template v-if="tab?.pluginView">
|
|
223
|
+
<ChevronRight :size="12" /><Puzzle :size="14" /><span
|
|
224
|
+
class="breadcrumb-current"
|
|
225
|
+
:title="pluginViewHeader(store.pluginRuntime, tab.pluginView)?.title"
|
|
226
|
+
>{{ pluginViewHeader(store.pluginRuntime, tab.pluginView)?.title || tab.pluginView.label }}</span
|
|
227
|
+
>
|
|
228
|
+
</template>
|
|
229
|
+
<template v-if="pane.activeId === PLUGINS_TAB_ID">
|
|
230
|
+
<ChevronRight :size="12" /><Puzzle :size="14" /><span class="breadcrumb-current">{{ t('插件') }}</span>
|
|
231
|
+
</template>
|
|
232
|
+
<template
|
|
233
|
+
v-for="view in [...extensionViews, settingsTabView, ...(mailEnabled ? [mailTabView] : [])].filter(
|
|
234
|
+
(view) => view.id === pane.activeId,
|
|
235
|
+
)"
|
|
236
|
+
:key="view.id"
|
|
237
|
+
>
|
|
238
|
+
<component :is="view.icon" :size="14" /><span class="breadcrumb-current">{{ view.label }}</span>
|
|
239
|
+
</template>
|
|
240
|
+
</WorkspaceBreadcrumb>
|
|
241
|
+
<DocumentStatus
|
|
242
|
+
v-if="(active || tab?.attachment) && !isVisible('breadcrumb') && isVisible('document-status')"
|
|
243
|
+
:document-key="`${workspace?.id}:${active?.id ?? tab?.attachment?.id}`"
|
|
244
|
+
:items="active ? paneDocumentStatus(active) : attachmentStatus(pane.id, tab?.attachment)"
|
|
245
|
+
>
|
|
246
|
+
<component
|
|
247
|
+
v-if="active && pane.id === store.activePaneId && extensions.regions['document-status-details']"
|
|
248
|
+
:is="extensions.regions['document-status-details']"
|
|
249
|
+
:actions="extensionActions"
|
|
250
|
+
/>
|
|
251
|
+
<button
|
|
252
|
+
v-if="!active && currentAttachmentStatus(pane.id, tab?.attachment)?.retry"
|
|
253
|
+
:disabled="currentAttachmentStatus(pane.id, tab?.attachment)?.retryDisabled"
|
|
254
|
+
@click="currentAttachmentStatus(pane.id, tab?.attachment)?.retry?.()"
|
|
255
|
+
>
|
|
256
|
+
{{ t('重试') }}
|
|
257
|
+
</button>
|
|
258
|
+
</DocumentStatus>
|
|
259
|
+
<div class="topbar-right" :data-surface-role="pane.activeId === GRAPH_TAB_ID ? 'card' : undefined">
|
|
260
|
+
<PluginViewHeader
|
|
261
|
+
v-if="tab?.pluginView && workspace"
|
|
262
|
+
:view="tab.pluginView"
|
|
263
|
+
:workspace-id="workspace.id"
|
|
264
|
+
:runtime="store.pluginRuntime.find((item) => item.id === tab?.pluginView?.pluginId)"
|
|
265
|
+
:execute="store.interactWithPlugin"
|
|
266
|
+
/>
|
|
267
|
+
<button
|
|
268
|
+
v-if="active && touchLayout && showOutline"
|
|
269
|
+
type="button"
|
|
270
|
+
class="icon-button"
|
|
271
|
+
:aria-label="t('文档大纲')"
|
|
272
|
+
:aria-expanded="touchOutlineOpen"
|
|
273
|
+
@click="touchOutlineOpen = !touchOutlineOpen"
|
|
274
|
+
>
|
|
275
|
+
<List :size="18" />
|
|
276
|
+
</button>
|
|
277
|
+
<button
|
|
278
|
+
v-if="tab?.attachment && attachments && isVisible('attachment-export')"
|
|
279
|
+
type="button"
|
|
280
|
+
class="topbar-attachment-action"
|
|
281
|
+
:aria-label="t('导出附件')"
|
|
282
|
+
:data-tooltip="t('导出附件副本')"
|
|
283
|
+
@click="attachments.exportAttachment(workspace!.id, tab!.attachment.path).catch(store.report)"
|
|
284
|
+
>
|
|
285
|
+
<ArrowDownToLine :size="16" /><span>{{ t('导出') }}</span>
|
|
286
|
+
</button>
|
|
287
|
+
<div :id="`attachment-controls-${pane.id}`" class="attachment-controls-host" v-show="!!tab?.attachment" />
|
|
288
|
+
<component
|
|
289
|
+
:is="extensions.regions['editing-status']"
|
|
290
|
+
v-if="
|
|
291
|
+
isVisible('editing-status') &&
|
|
292
|
+
pane.id === store.activePaneId &&
|
|
293
|
+
extensions.regions['editing-status']
|
|
294
|
+
"
|
|
295
|
+
:actions="extensionActions"
|
|
296
|
+
/>
|
|
297
|
+
<span
|
|
298
|
+
v-if="
|
|
299
|
+
workspaceStatusLabel &&
|
|
300
|
+
(!store.isDemo ||
|
|
301
|
+
!isVisible('breadcrumb') ||
|
|
302
|
+
pane.activeId === CALENDAR_TAB_ID ||
|
|
303
|
+
pane.activeId === GRAPH_TAB_ID)
|
|
304
|
+
"
|
|
305
|
+
:class="store.isDemo ? 'demo-badge' : 'local-badge'"
|
|
306
|
+
:title="store.isDemo ? t('浏览器演示 · 数据仅保存在本浏览器') : undefined"
|
|
307
|
+
>
|
|
308
|
+
<LockKeyhole v-if="workspace?.readOnly" :size="14" />
|
|
309
|
+
{{ workspaceStatusLabel }}
|
|
310
|
+
</span>
|
|
311
|
+
<div
|
|
312
|
+
:id="`graph-controls-${pane.id}`"
|
|
313
|
+
v-show="pane.activeId === GRAPH_TAB_ID"
|
|
314
|
+
class="graph-toolbar-host"
|
|
315
|
+
/>
|
|
316
|
+
<div v-if="isTableTab(pane.activeId)" :id="`data-table-controls-${pane.id}`" />
|
|
317
|
+
<CalendarTopbarControls
|
|
318
|
+
v-if="pane.activeId === CALENDAR_TAB_ID && calendarToolItems.some((item) => isVisible(item.id))"
|
|
319
|
+
:is-visible="isVisible"
|
|
320
|
+
:calendar-period="calendarPeriod"
|
|
321
|
+
:calendar-mode="calendarMode"
|
|
322
|
+
:calendar-mode-label="calendarModeLabel"
|
|
323
|
+
:calendar-mode-options="calendarModeOptions"
|
|
324
|
+
:calendar-mode-open="calendarModeOpen"
|
|
325
|
+
@go-today="calendarDate = new Date()"
|
|
326
|
+
@move-period="moveCalendarPeriod"
|
|
327
|
+
@update:calendar-mode-open="calendarModeOpen = $event"
|
|
328
|
+
@select-mode="selectCalendarMode"
|
|
329
|
+
@open-archive="openPlanArchive"
|
|
330
|
+
/>
|
|
331
|
+
<div
|
|
332
|
+
v-if="active && documentSuggestions.get(active.id)?.mode && !editing.isManaging(active.id)"
|
|
333
|
+
class="suggestion-mode-badge"
|
|
334
|
+
role="status"
|
|
335
|
+
:aria-label="t('建议模式已开启')"
|
|
336
|
+
>
|
|
337
|
+
<MessageSquareDiff :size="14" /><span>{{ t('建议模式') }}</span>
|
|
338
|
+
<button
|
|
339
|
+
type="button"
|
|
340
|
+
:aria-label="t('退出建议模式')"
|
|
341
|
+
:data-tooltip="t('退出建议模式')"
|
|
342
|
+
:disabled="suggestionModeBusy || documentSuggestions.get(active.id)?.reviewing"
|
|
343
|
+
@click="toggleSuggestionMode(active.id)"
|
|
344
|
+
>
|
|
345
|
+
<X :size="14" />
|
|
346
|
+
</button>
|
|
347
|
+
</div>
|
|
348
|
+
<template v-if="active">
|
|
349
|
+
<div
|
|
350
|
+
v-if="documentToolItems.some((item) => isVisible(item.id))"
|
|
351
|
+
class="document-tool-buttons"
|
|
352
|
+
>
|
|
353
|
+
<MarkdownRevealToggle
|
|
354
|
+
v-if="isVisible('markdown-reveal')"
|
|
355
|
+
v-model="revealMarkdown"
|
|
356
|
+
:source="paneSource(pane.activeId)"
|
|
357
|
+
:shortcut="shortcuts.toggleMarkdownReveal"
|
|
358
|
+
/>
|
|
359
|
+
<button
|
|
360
|
+
v-if="isVisible('source-mode')"
|
|
361
|
+
type="button"
|
|
362
|
+
class="icon-button source-mode-button"
|
|
363
|
+
:class="{ active: paneSource(pane.activeId) }"
|
|
364
|
+
:disabled="
|
|
365
|
+
editing.isManaging(pane.activeId) ||
|
|
366
|
+
(pane.id === store.activePaneId && editing.activeBusy)
|
|
367
|
+
"
|
|
368
|
+
:aria-label="paneSource(pane.activeId) ? t('返回编辑') : t('切换源码模式')"
|
|
369
|
+
:aria-pressed="paneSource(pane.activeId)"
|
|
370
|
+
:aria-keyshortcuts="shortcutAriaLabel(shortcuts.toggleSource) || undefined"
|
|
371
|
+
:data-tooltip-shortcut="shortcutKeys(shortcuts.toggleSource)[0]"
|
|
372
|
+
:data-tooltip="
|
|
373
|
+
editing.isManaging(pane.activeId)
|
|
374
|
+
? t('当前编辑扩展不支持切换源码模式')
|
|
375
|
+
: paneSource(pane.activeId)
|
|
376
|
+
? t('返回编辑')
|
|
377
|
+
: t('切换源码模式')
|
|
378
|
+
"
|
|
379
|
+
@click="setPaneSource(pane.activeId, !paneSource(pane.activeId))"
|
|
380
|
+
>
|
|
381
|
+
<SourceCodeIcon :size="17" :off="!paneSource(pane.activeId)" />
|
|
382
|
+
</button>
|
|
383
|
+
</div>
|
|
384
|
+
<DocumentActionMenu
|
|
385
|
+
:pane-id="pane.id"
|
|
386
|
+
:pane-active-id="pane.activeId"
|
|
387
|
+
:active="active"
|
|
388
|
+
:is-auxiliary-window="isAuxiliaryWindow"
|
|
389
|
+
/>
|
|
390
|
+
</template>
|
|
391
|
+
</div>
|
|
392
|
+
</ButtonVisibilityGroup>
|
|
393
|
+
</template>
|
|
@@ -25,7 +25,6 @@ const props = defineProps<{
|
|
|
25
25
|
context: EditorSelectionContext;
|
|
26
26
|
editorElement?: HTMLElement;
|
|
27
27
|
features?: DocumentFeatures;
|
|
28
|
-
enabledLevels?: readonly number[];
|
|
29
28
|
mode?: Exclude<ToolbarMode, 'fixed'>;
|
|
30
29
|
dragging?: boolean;
|
|
31
30
|
assistant?: boolean;
|
|
@@ -383,7 +382,6 @@ onBeforeUnmount(() => {
|
|
|
383
382
|
@annotation="visible && emit('annotation')"
|
|
384
383
|
:context="context"
|
|
385
384
|
:features="features"
|
|
386
|
-
:enabled-levels="enabledLevels"
|
|
387
385
|
@dismiss="dismissAndFocus"
|
|
388
386
|
@command="(name, value) => visible && emit('command', name, value)"
|
|
389
387
|
>
|
|
@@ -28,39 +28,58 @@ import {
|
|
|
28
28
|
} from 'lucide-vue-next';
|
|
29
29
|
import ShortcutHint from '@tano/editor/shortcut-hint';
|
|
30
30
|
import { vSurfaceMotion } from '@tano/editor/surface-motion';
|
|
31
|
-
import {
|
|
31
|
+
import { isDataTableFilePath, isMarkdown, isWorkspaceInternalPath } from '@tano/protocol';
|
|
32
|
+
import { t } from '../../i18n/i18n';
|
|
33
|
+
import { mobile } from '../../platform/platform';
|
|
34
|
+
import {
|
|
35
|
+
workbenchDocumentsKey,
|
|
36
|
+
workbenchPrefsKey,
|
|
37
|
+
workbenchShellKey,
|
|
38
|
+
workbenchTreeMenusKey,
|
|
39
|
+
} from '../workbench-context';
|
|
32
40
|
import PageDisplayOptions from './PageDisplayOptions.vue';
|
|
33
41
|
import PluginMenu from '../../plugins/components/PluginMenu.vue';
|
|
34
42
|
|
|
35
|
-
const
|
|
36
|
-
|
|
43
|
+
const shell = inject(workbenchShellKey);
|
|
44
|
+
const prefs = inject(workbenchPrefsKey);
|
|
45
|
+
const documents = inject(workbenchDocumentsKey);
|
|
46
|
+
const treeMenus = inject(workbenchTreeMenusKey);
|
|
47
|
+
if (!shell || !prefs || !documents || !treeMenus) throw new Error('Workbench context is required');
|
|
48
|
+
|
|
37
49
|
const {
|
|
38
50
|
activeWindow,
|
|
39
51
|
workspace,
|
|
40
52
|
isAuxiliaryWindow,
|
|
41
|
-
t,
|
|
42
53
|
store,
|
|
43
|
-
mobile,
|
|
44
54
|
localNative,
|
|
45
55
|
busy,
|
|
46
56
|
switchingWorkspace,
|
|
57
|
+
attachments,
|
|
58
|
+
} = toRefs(shell);
|
|
59
|
+
const {
|
|
60
|
+
shortcutHint,
|
|
61
|
+
tabsEnabled,
|
|
62
|
+
workspaceLocked,
|
|
63
|
+
editorPreferences,
|
|
64
|
+
showPageTitle,
|
|
65
|
+
showDocumentProperties,
|
|
66
|
+
showAllLineNumbers,
|
|
67
|
+
toggleWorkspaceLock,
|
|
68
|
+
} = toRefs(prefs);
|
|
69
|
+
const { showOutline, paneSource, togglePageOption, outlineOnLeft, toggleOutlineSide } =
|
|
70
|
+
toRefs(documents);
|
|
71
|
+
const {
|
|
47
72
|
fileContextMenu,
|
|
48
73
|
multipleContextEntries,
|
|
49
74
|
contextEntries,
|
|
50
75
|
fileContextKeydown,
|
|
51
76
|
selectionDeleteDisabled,
|
|
52
77
|
fileContextAction,
|
|
53
|
-
shortcutHint,
|
|
54
78
|
contextFolderHome,
|
|
55
79
|
folderHomeContextAction,
|
|
56
80
|
fileMutationDisabled,
|
|
57
81
|
directoryHasManagedFile,
|
|
58
|
-
isMarkdown,
|
|
59
|
-
isDataTableFilePath,
|
|
60
|
-
attachments,
|
|
61
|
-
tabsEnabled,
|
|
62
82
|
canDuplicateEntry,
|
|
63
|
-
isWorkspaceInternalPath,
|
|
64
83
|
folderConversionIssue,
|
|
65
84
|
convertDocumentStructure,
|
|
66
85
|
revealedHomeId,
|
|
@@ -72,24 +91,16 @@ const {
|
|
|
72
91
|
directoryContextRenameDisabled,
|
|
73
92
|
directoryContextDeleteDisabled,
|
|
74
93
|
workspaceEntryContextMenu,
|
|
94
|
+
setWorkspaceEntryContextMenuElement,
|
|
75
95
|
workspaceEntryContextKeydown,
|
|
76
96
|
workspaceEntryContextAction,
|
|
77
97
|
pageContextMenu,
|
|
98
|
+
setPageContextMenuElement,
|
|
78
99
|
pageContextKeydown,
|
|
79
|
-
workspaceLocked,
|
|
80
|
-
editorPreferences,
|
|
81
|
-
showPageTitle,
|
|
82
|
-
showDocumentProperties,
|
|
83
|
-
showOutline,
|
|
84
|
-
showAllLineNumbers,
|
|
85
|
-
paneSource,
|
|
86
|
-
togglePageOption,
|
|
87
|
-
toggleWorkspaceLock,
|
|
88
100
|
outlineContextMenu,
|
|
101
|
+
setOutlineContextMenuElement,
|
|
89
102
|
outlineContextKeydown,
|
|
90
|
-
|
|
91
|
-
toggleOutlineSide,
|
|
92
|
-
} = toRefs(context);
|
|
103
|
+
} = toRefs(treeMenus);
|
|
93
104
|
</script>
|
|
94
105
|
|
|
95
106
|
<template>
|
|
@@ -491,7 +502,7 @@ const {
|
|
|
491
502
|
<div
|
|
492
503
|
v-surface-motion="'App:2'"
|
|
493
504
|
v-if="workspaceEntryContextMenu"
|
|
494
|
-
:ref="
|
|
505
|
+
:ref="setWorkspaceEntryContextMenuElement"
|
|
495
506
|
class="dropdown compact-action-menu file-context-menu workspace-entry-context-menu"
|
|
496
507
|
role="menu"
|
|
497
508
|
tabindex="-1"
|
|
@@ -524,7 +535,7 @@ const {
|
|
|
524
535
|
<div
|
|
525
536
|
v-surface-motion="'App:6'"
|
|
526
537
|
v-if="pageContextMenu && !switchingWorkspace"
|
|
527
|
-
:ref="
|
|
538
|
+
:ref="setPageContextMenuElement"
|
|
528
539
|
class="dropdown compact-action-menu page-context-menu workspace-options-menu"
|
|
529
540
|
role="menu"
|
|
530
541
|
:aria-label="t('页面显示选项')"
|
|
@@ -552,7 +563,7 @@ const {
|
|
|
552
563
|
<div
|
|
553
564
|
v-surface-motion="'App:7'"
|
|
554
565
|
v-if="outlineContextMenu && !switchingWorkspace"
|
|
555
|
-
:ref="
|
|
566
|
+
:ref="setOutlineContextMenuElement"
|
|
556
567
|
class="dropdown compact-action-menu page-context-menu outline-context-menu"
|
|
557
568
|
role="menu"
|
|
558
569
|
:aria-label="t('目录显示选项')"
|