@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,168 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject, toRefs } from 'vue';
|
|
3
|
+
import { List, ListTree, Pin, Puzzle, Search, X } from 'lucide-vue-next';
|
|
4
|
+
import { t } from '../../i18n/i18n';
|
|
5
|
+
import { vOutlineMotion } from '../outline-motion';
|
|
6
|
+
import { workbenchDocumentsKey, workbenchShellKey } from '../../shell/workbench-context';
|
|
7
|
+
import PluginSurface from '../../plugins/components/PluginSurface.vue';
|
|
8
|
+
import DocumentOutline from './DocumentOutline.vue';
|
|
9
|
+
|
|
10
|
+
const shell = inject(workbenchShellKey);
|
|
11
|
+
const documents = inject(workbenchDocumentsKey);
|
|
12
|
+
if (!shell || !documents) throw new Error('Workbench context is required');
|
|
13
|
+
const { workspace, store, touchLayout } = toRefs(shell);
|
|
14
|
+
const {
|
|
15
|
+
touchOutlineOpen,
|
|
16
|
+
outlineOnLeft,
|
|
17
|
+
hoverOutline,
|
|
18
|
+
outlinePinned,
|
|
19
|
+
outlinePosition,
|
|
20
|
+
openOutlineContextMenu,
|
|
21
|
+
releaseOutlinePointerFocus,
|
|
22
|
+
outlineAutoCollapse,
|
|
23
|
+
outlineSearchOpen,
|
|
24
|
+
setOutlineSearchInput,
|
|
25
|
+
toggleOutlineSearch,
|
|
26
|
+
toggleOutlinePin,
|
|
27
|
+
outlineSearch,
|
|
28
|
+
visibleOutline,
|
|
29
|
+
jumpToHeading,
|
|
30
|
+
outline,
|
|
31
|
+
activeHeading,
|
|
32
|
+
} = toRefs(documents);
|
|
33
|
+
|
|
34
|
+
const documentSidebarViews = computed(() =>
|
|
35
|
+
store.value.pluginViews.filter((view) => view.location === 'documentSidebar'),
|
|
36
|
+
);
|
|
37
|
+
const activeDocumentSidebarView = computed(() =>
|
|
38
|
+
documentSidebarViews.value.find((view) => view.key === store.value.activeDocumentPluginSidebar),
|
|
39
|
+
);
|
|
40
|
+
function selectDocumentPluginSidebar(key: string) {
|
|
41
|
+
store.value.activeDocumentPluginSidebar = key;
|
|
42
|
+
const view = documentSidebarViews.value.find((item) => item.key === key);
|
|
43
|
+
if (view) {
|
|
44
|
+
try {
|
|
45
|
+
store.value.openPluginView(view.pluginId, view.id);
|
|
46
|
+
} catch {
|
|
47
|
+
/* Ignore if workspace is switching. */
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<aside
|
|
55
|
+
v-outline-motion
|
|
56
|
+
class="inspector"
|
|
57
|
+
:style="!activeDocumentSidebarView ? outlinePosition : undefined"
|
|
58
|
+
:class="{
|
|
59
|
+
'inspector-outline': !activeDocumentSidebarView,
|
|
60
|
+
'inspector-outline-left': !activeDocumentSidebarView && outlineOnLeft,
|
|
61
|
+
'inspector-hover-outline':
|
|
62
|
+
!activeDocumentSidebarView && !touchLayout && hoverOutline && !outlinePinned,
|
|
63
|
+
'inspector-activity': !!activeDocumentSidebarView,
|
|
64
|
+
}"
|
|
65
|
+
:aria-label="
|
|
66
|
+
activeDocumentSidebarView
|
|
67
|
+
? `${activeDocumentSidebarView.pluginName} · ${activeDocumentSidebarView.label}`
|
|
68
|
+
: t('文档目录')
|
|
69
|
+
"
|
|
70
|
+
@contextmenu="openOutlineContextMenu"
|
|
71
|
+
@pointerleave="releaseOutlinePointerFocus"
|
|
72
|
+
>
|
|
73
|
+
<div class="inspector-surface">
|
|
74
|
+
<div v-if="activeDocumentSidebarView || documentSidebarViews.length" class="inspector-tabs">
|
|
75
|
+
<button
|
|
76
|
+
:class="{ active: !activeDocumentSidebarView }"
|
|
77
|
+
@click="store.activeDocumentPluginSidebar = ''"
|
|
78
|
+
>
|
|
79
|
+
<List :size="14" />{{ t('大纲') }}
|
|
80
|
+
</button>
|
|
81
|
+
<button
|
|
82
|
+
v-for="docView in documentSidebarViews"
|
|
83
|
+
:key="docView.key"
|
|
84
|
+
:class="{ active: activeDocumentSidebarView?.key === docView.key }"
|
|
85
|
+
@click="selectDocumentPluginSidebar(docView.key)"
|
|
86
|
+
>
|
|
87
|
+
<Puzzle :size="14" />{{ docView.label }}
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
<PluginSurface
|
|
91
|
+
v-if="activeDocumentSidebarView && workspace"
|
|
92
|
+
:key="`${workspace.id}:${activeDocumentSidebarView.key}`"
|
|
93
|
+
:view="activeDocumentSidebarView"
|
|
94
|
+
:workspace-id="workspace.id"
|
|
95
|
+
:runtime="store.pluginRuntime.find((rt) => rt.id === activeDocumentSidebarView!.pluginId)"
|
|
96
|
+
:execute="store.interactWithPlugin"
|
|
97
|
+
compact
|
|
98
|
+
/>
|
|
99
|
+
<template v-else>
|
|
100
|
+
<div class="outline-controls">
|
|
101
|
+
<span>{{ t('文档大纲') }}</span>
|
|
102
|
+
<button
|
|
103
|
+
v-if="touchLayout"
|
|
104
|
+
type="button"
|
|
105
|
+
class="outline-control"
|
|
106
|
+
:aria-label="t('关闭文档大纲')"
|
|
107
|
+
@click="touchOutlineOpen = false"
|
|
108
|
+
>
|
|
109
|
+
<X :size="18" />
|
|
110
|
+
</button>
|
|
111
|
+
<button
|
|
112
|
+
class="outline-control"
|
|
113
|
+
:class="{ active: outlineAutoCollapse }"
|
|
114
|
+
type="button"
|
|
115
|
+
:aria-label="t('自动折叠大纲')"
|
|
116
|
+
:data-tooltip="t('自动折叠大纲')"
|
|
117
|
+
:aria-pressed="outlineAutoCollapse"
|
|
118
|
+
@click="outlineAutoCollapse = !outlineAutoCollapse"
|
|
119
|
+
>
|
|
120
|
+
<ListTree :size="15" />
|
|
121
|
+
</button>
|
|
122
|
+
<button
|
|
123
|
+
class="outline-control"
|
|
124
|
+
:class="{ active: outlineSearchOpen }"
|
|
125
|
+
type="button"
|
|
126
|
+
:aria-label="t('搜索大纲标题')"
|
|
127
|
+
:data-tooltip="t('搜索大纲标题')"
|
|
128
|
+
:aria-expanded="outlineSearchOpen"
|
|
129
|
+
@click="toggleOutlineSearch"
|
|
130
|
+
>
|
|
131
|
+
<Search :size="15" />
|
|
132
|
+
</button>
|
|
133
|
+
<button
|
|
134
|
+
v-if="hoverOutline"
|
|
135
|
+
class="outline-control"
|
|
136
|
+
:class="{ active: outlinePinned }"
|
|
137
|
+
type="button"
|
|
138
|
+
:aria-label="outlinePinned ? t('取消固定大纲') : t('固定大纲')"
|
|
139
|
+
:data-tooltip="outlinePinned ? t('取消固定大纲') : t('固定大纲')"
|
|
140
|
+
:aria-pressed="outlinePinned"
|
|
141
|
+
@click="toggleOutlinePin"
|
|
142
|
+
>
|
|
143
|
+
<Pin :size="15" :fill="outlinePinned ? 'currentColor' : 'none'" />
|
|
144
|
+
</button>
|
|
145
|
+
</div>
|
|
146
|
+
<div v-if="outlineSearchOpen" class="outline-search">
|
|
147
|
+
<Search :size="14" aria-hidden="true" />
|
|
148
|
+
<input
|
|
149
|
+
:ref="setOutlineSearchInput"
|
|
150
|
+
v-model="outlineSearch"
|
|
151
|
+
type="search"
|
|
152
|
+
:aria-label="t('搜索当前文档标题')"
|
|
153
|
+
:placeholder="t('搜索标题')"
|
|
154
|
+
autocomplete="off"
|
|
155
|
+
@keydown.enter="visibleOutline[0] && jumpToHeading(visibleOutline[0].index, true)"
|
|
156
|
+
@keydown.esc.stop.prevent="toggleOutlineSearch"
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
<DocumentOutline
|
|
160
|
+
:items="visibleOutline"
|
|
161
|
+
:has-headings="!!outline.length"
|
|
162
|
+
:active-index="activeHeading"
|
|
163
|
+
@select="jumpToHeading($event, true)"
|
|
164
|
+
/>
|
|
165
|
+
</template>
|
|
166
|
+
</div>
|
|
167
|
+
</aside>
|
|
168
|
+
</template>
|
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, inject, toRefs } from 'vue';
|
|
3
|
+
import { AlertTriangle, ArrowUpRight, ListTodo } from 'lucide-vue-next';
|
|
4
|
+
import { defaultSelectionContext } from '@tano/editor/selection-context';
|
|
5
|
+
import { safeRemoteImage, type WorkspacePane } from '@tano/protocol';
|
|
6
|
+
import { isFeatureEnabled } from '../../features';
|
|
7
|
+
import { t } from '../../i18n/i18n';
|
|
8
|
+
import type { OpenDocument } from '../../stores/workspace-types';
|
|
9
|
+
import { shortcutAriaLabel, shortcutKeys } from '../../shell/shortcuts';
|
|
10
|
+
import { createEditorPluginAdapters } from '../../plugins/editor-plugin-adapters';
|
|
11
|
+
import {
|
|
12
|
+
CalloutIconPicker,
|
|
13
|
+
DocumentComments,
|
|
14
|
+
EditorTools,
|
|
15
|
+
MarkdownEditor,
|
|
16
|
+
SourceEditor,
|
|
17
|
+
} from '../../shell/workbench-async-components';
|
|
18
|
+
import {
|
|
19
|
+
workbenchDocumentsKey,
|
|
20
|
+
workbenchModalsKey,
|
|
21
|
+
workbenchPrefsKey,
|
|
22
|
+
workbenchShellKey,
|
|
23
|
+
} from '../../shell/workbench-context';
|
|
24
|
+
import AssistantLauncher from '../../assistant/components/AssistantLauncher.vue';
|
|
25
|
+
import ButtonVisibilityGroup from '../../shell/components/ButtonVisibilityGroup.vue';
|
|
26
|
+
import LayoutDocumentChrome from '../../shell/components/LayoutDocumentChrome.vue';
|
|
27
|
+
import PageSearch from '../../shell/components/PageSearch.vue';
|
|
28
|
+
import PluginDocumentSlot from '../../plugins/components/PluginDocumentSlot.vue';
|
|
29
|
+
import DocumentScrollbar from './DocumentScrollbar.vue';
|
|
30
|
+
import DocumentStarter from './DocumentStarter.vue';
|
|
31
|
+
import DocumentSuggestions from './DocumentSuggestions.vue';
|
|
32
|
+
import DocumentTitle from './DocumentTitle.vue';
|
|
33
|
+
import MarkdownRevealToggle from './MarkdownRevealToggle.vue';
|
|
34
|
+
import SourceCodeIcon from './SourceCodeIcon.vue';
|
|
35
|
+
|
|
36
|
+
defineProps<{
|
|
37
|
+
pane: WorkspacePane;
|
|
38
|
+
active: OpenDocument;
|
|
39
|
+
isAuxiliaryWindow: boolean;
|
|
40
|
+
}>();
|
|
41
|
+
|
|
42
|
+
const shell = inject(workbenchShellKey);
|
|
43
|
+
const prefs = inject(workbenchPrefsKey);
|
|
44
|
+
const documents = inject(workbenchDocumentsKey);
|
|
45
|
+
const modals = inject(workbenchModalsKey);
|
|
46
|
+
if (!shell || !prefs || !documents || !modals) throw new Error('Workbench context is required');
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
workspace,
|
|
50
|
+
store,
|
|
51
|
+
assistant,
|
|
52
|
+
extensions,
|
|
53
|
+
extensionActions,
|
|
54
|
+
paneButterflyScope,
|
|
55
|
+
documentToolItems,
|
|
56
|
+
closeButtonVisibilityMenus,
|
|
57
|
+
attachments,
|
|
58
|
+
touchLayout,
|
|
59
|
+
openReference,
|
|
60
|
+
} = toRefs(shell);
|
|
61
|
+
const {
|
|
62
|
+
shortcuts,
|
|
63
|
+
shortcutHint,
|
|
64
|
+
toolbarMode,
|
|
65
|
+
appearance,
|
|
66
|
+
revealMarkdown,
|
|
67
|
+
selectedVisualFontFamily,
|
|
68
|
+
visualFontSize,
|
|
69
|
+
sourceFontSize,
|
|
70
|
+
limitPageWidth,
|
|
71
|
+
showPageTitle,
|
|
72
|
+
editorPreferences,
|
|
73
|
+
showAllLineNumbers,
|
|
74
|
+
showDocumentProperties,
|
|
75
|
+
showDocumentDiscussion,
|
|
76
|
+
} = toRefs(prefs);
|
|
77
|
+
const {
|
|
78
|
+
openAssistant,
|
|
79
|
+
assistantTaskActive,
|
|
80
|
+
setPaneSearch,
|
|
81
|
+
paneSource,
|
|
82
|
+
setPaneSource,
|
|
83
|
+
paneSourceEditors,
|
|
84
|
+
paneEditors,
|
|
85
|
+
paneReadonly,
|
|
86
|
+
paneSearchRevisions,
|
|
87
|
+
setPaneElement,
|
|
88
|
+
scheduleActiveHeading,
|
|
89
|
+
editing,
|
|
90
|
+
beginSelectionTodo,
|
|
91
|
+
paneComments,
|
|
92
|
+
paneEditorScrolls,
|
|
93
|
+
paneSelections,
|
|
94
|
+
showSourceTodo,
|
|
95
|
+
openPageContextMenu,
|
|
96
|
+
uploadFile,
|
|
97
|
+
resourceRevision,
|
|
98
|
+
sessionBlocksFileMutation,
|
|
99
|
+
renameDocumentTitle,
|
|
100
|
+
insertBlockBelowTitle,
|
|
101
|
+
commentAnchors,
|
|
102
|
+
paneEditorReady,
|
|
103
|
+
paneSourceSelections,
|
|
104
|
+
insertSourceFiles,
|
|
105
|
+
setPaneEditor,
|
|
106
|
+
openDocumentLink,
|
|
107
|
+
openWikiLink,
|
|
108
|
+
openBlankBlockAssistant,
|
|
109
|
+
startDocumentDraft,
|
|
110
|
+
quickInitialize,
|
|
111
|
+
chooseInitialTemplate,
|
|
112
|
+
setPaneComments,
|
|
113
|
+
discussWithAssistant,
|
|
114
|
+
capturePaneCommentSelection,
|
|
115
|
+
focusPaneComment,
|
|
116
|
+
paneCommentGeometry,
|
|
117
|
+
paneScrolls,
|
|
118
|
+
} = toRefs(documents);
|
|
119
|
+
const { selectedDiff, showModal } = toRefs(modals);
|
|
120
|
+
|
|
121
|
+
const documentEditorPreferences = computed(() =>
|
|
122
|
+
isFeatureEnabled('markdownSpacingAutocomplete')
|
|
123
|
+
? editorPreferences.value
|
|
124
|
+
: { ...editorPreferences.value, completeTextSpacing: false },
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const {
|
|
128
|
+
editorPluginSlashCommands,
|
|
129
|
+
editorPluginDecorations,
|
|
130
|
+
editorPluginCodeBlockRenderers,
|
|
131
|
+
} = createEditorPluginAdapters(
|
|
132
|
+
() => store.value,
|
|
133
|
+
() => workspace.value,
|
|
134
|
+
);
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<template>
|
|
138
|
+
<PageSearch
|
|
139
|
+
:shortcuts="shortcuts"
|
|
140
|
+
:key="`search:${active.id}`"
|
|
141
|
+
:ref="(el) => setPaneSearch(pane.id, el)"
|
|
142
|
+
:editor="
|
|
143
|
+
paneSource(pane.activeId)
|
|
144
|
+
? paneSourceEditors.get(pane.id)
|
|
145
|
+
: paneEditors.get(pane.id)
|
|
146
|
+
"
|
|
147
|
+
:content="active.content"
|
|
148
|
+
:readonly="paneReadonly(active)"
|
|
149
|
+
:revision="paneSearchRevisions[pane.id]"
|
|
150
|
+
/>
|
|
151
|
+
<div :key="active.id" class="document-scroll-shell" :class="{ 'has-assistant-launcher': assistant.available }">
|
|
152
|
+
<div
|
|
153
|
+
:id="`document-scroll-${pane.id}`"
|
|
154
|
+
:ref="(el) => setPaneElement('scroll', pane.id, el)"
|
|
155
|
+
class="document-layout"
|
|
156
|
+
:data-toolbar-dock="
|
|
157
|
+
pane.id === store.activePaneId &&
|
|
158
|
+
!paneSource(pane.activeId) &&
|
|
159
|
+
!paneReadonly(active)
|
|
160
|
+
? toolbarMode
|
|
161
|
+
: undefined
|
|
162
|
+
"
|
|
163
|
+
@scroll.passive="scheduleActiveHeading"
|
|
164
|
+
>
|
|
165
|
+
<main class="document-main">
|
|
166
|
+
<LayoutDocumentChrome :layout="appearance.layout" :path="active.path" />
|
|
167
|
+
<EditorTools
|
|
168
|
+
:shortcuts="shortcuts"
|
|
169
|
+
v-model:mode="toolbarMode"
|
|
170
|
+
:assistant="assistant.available"
|
|
171
|
+
:assistant-disabled="assistantTaskActive()"
|
|
172
|
+
@assistant="openAssistant(pane.id, active.id)"
|
|
173
|
+
annotation
|
|
174
|
+
:todo="
|
|
175
|
+
store.capabilities.features.objectReferences &&
|
|
176
|
+
!paneReadonly(active) &&
|
|
177
|
+
!editing.isManaging(active.id)
|
|
178
|
+
"
|
|
179
|
+
@todo="beginSelectionTodo(pane.id, active.id)"
|
|
180
|
+
@annotation="paneComments.get(pane.id)?.beginAnnotation()"
|
|
181
|
+
:active="pane.id === store.activePaneId"
|
|
182
|
+
:editor-element="paneEditorScrolls.get(pane.id)"
|
|
183
|
+
:features="store.capabilities.features"
|
|
184
|
+
:context="paneSelections[pane.id] ?? defaultSelectionContext"
|
|
185
|
+
:source="paneSource(pane.activeId)"
|
|
186
|
+
:disabled="paneReadonly(active)"
|
|
187
|
+
@command="(name, value) => paneEditors.get(pane.id)?.command(name, value)"
|
|
188
|
+
>
|
|
189
|
+
<template v-if="isAuxiliaryWindow || showSourceTodo(pane.id, active)" #trailing>
|
|
190
|
+
<button
|
|
191
|
+
v-if="showSourceTodo(pane.id, active)"
|
|
192
|
+
type="button"
|
|
193
|
+
class="icon-button"
|
|
194
|
+
:aria-label="t('从选区创建任务或事件')"
|
|
195
|
+
:data-tooltip="t('从选区创建任务或事件')"
|
|
196
|
+
@mousedown.prevent
|
|
197
|
+
@click="beginSelectionTodo(pane.id, active.id)"
|
|
198
|
+
>
|
|
199
|
+
<ListTodo :size="17" />
|
|
200
|
+
</button>
|
|
201
|
+
<ButtonVisibilityGroup
|
|
202
|
+
v-if="isAuxiliaryWindow"
|
|
203
|
+
v-slot="{ isVisible }"
|
|
204
|
+
:items="documentToolItems"
|
|
205
|
+
preference-key="tano.preference.documentHiddenTools"
|
|
206
|
+
group-class="detached-editor-actions document-tool-buttons"
|
|
207
|
+
:label="t('文档工具')"
|
|
208
|
+
:menu-label="t('文档工具按钮显示设置')"
|
|
209
|
+
@open="closeButtonVisibilityMenus"
|
|
210
|
+
>
|
|
211
|
+
<MarkdownRevealToggle
|
|
212
|
+
v-if="isVisible('markdown-reveal')"
|
|
213
|
+
v-model="revealMarkdown"
|
|
214
|
+
:source="paneSource(pane.activeId)"
|
|
215
|
+
:shortcut="shortcuts.toggleMarkdownReveal"
|
|
216
|
+
/>
|
|
217
|
+
<button
|
|
218
|
+
v-if="isVisible('source-mode')"
|
|
219
|
+
type="button"
|
|
220
|
+
class="icon-button"
|
|
221
|
+
:class="{ active: paneSource(pane.activeId) }"
|
|
222
|
+
:disabled="!!editing.active || editing.activeBusy"
|
|
223
|
+
:aria-label="paneSource(pane.activeId) ? t('返回编辑') : t('切换源码模式')"
|
|
224
|
+
:aria-pressed="paneSource(pane.activeId)"
|
|
225
|
+
:aria-keyshortcuts="shortcutAriaLabel(shortcuts.toggleSource) || undefined"
|
|
226
|
+
:data-tooltip-shortcut="shortcutKeys(shortcuts.toggleSource)[0]"
|
|
227
|
+
:data-tooltip="paneSource(pane.activeId) ? t('返回编辑') : t('切换源码模式')"
|
|
228
|
+
@click="setPaneSource(pane.activeId, !paneSource(pane.activeId))"
|
|
229
|
+
>
|
|
230
|
+
<SourceCodeIcon :size="17" :off="!paneSource(pane.activeId)" />
|
|
231
|
+
</button>
|
|
232
|
+
</ButtonVisibilityGroup>
|
|
233
|
+
</template>
|
|
234
|
+
</EditorTools>
|
|
235
|
+
|
|
236
|
+
<component
|
|
237
|
+
:is="extensions.regions['editing-panel']"
|
|
238
|
+
v-if="pane.id === store.activePaneId && extensions.regions['editing-panel']"
|
|
239
|
+
:actions="extensionActions"
|
|
240
|
+
/>
|
|
241
|
+
<p v-if="active.creating && !active.error" class="creation-status" role="status">
|
|
242
|
+
{{ t('正在创建… 可以继续编辑') }}
|
|
243
|
+
</p>
|
|
244
|
+
<div v-if="active.conflict" class="conflict-banner" role="alert">
|
|
245
|
+
<AlertTriangle :size="19" />
|
|
246
|
+
<div>
|
|
247
|
+
<strong>{{ t('这一页有两份新的想法') }}</strong>
|
|
248
|
+
<p>
|
|
249
|
+
{{ t('外部修改与你的修改重叠。你的内容已保存为 conflict 副本,原文件保留外部版本。') }}
|
|
250
|
+
</p>
|
|
251
|
+
<button @click="store.resolveConflict(active, true)">
|
|
252
|
+
{{ t('打开我的副本') }} <ArrowUpRight :size="14" /></button
|
|
253
|
+
><button @click="store.resolveConflict(active, false)">
|
|
254
|
+
{{ t('载入磁盘版本') }}
|
|
255
|
+
</button>
|
|
256
|
+
<button
|
|
257
|
+
@click="
|
|
258
|
+
selectedDiff = {
|
|
259
|
+
title: active.path,
|
|
260
|
+
before: active.conflict.disk.content,
|
|
261
|
+
after: active.content,
|
|
262
|
+
beforeLabel: t('磁盘版本'),
|
|
263
|
+
afterLabel: t('我的副本'),
|
|
264
|
+
}
|
|
265
|
+
"
|
|
266
|
+
>
|
|
267
|
+
{{ t('比较两个版本') }}
|
|
268
|
+
</button>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
<div
|
|
272
|
+
v-else-if="active.missing || active.error"
|
|
273
|
+
class="conflict-banner"
|
|
274
|
+
role="alert"
|
|
275
|
+
>
|
|
276
|
+
<AlertTriangle :size="19" />
|
|
277
|
+
<div>
|
|
278
|
+
<strong>{{
|
|
279
|
+
active.missing
|
|
280
|
+
? t('文件已在工作文件夹中移除')
|
|
281
|
+
: active.creating
|
|
282
|
+
? t('文档尚未创建成功')
|
|
283
|
+
: t('这次保存没有完成')
|
|
284
|
+
}}</strong>
|
|
285
|
+
<p>
|
|
286
|
+
{{
|
|
287
|
+
active.error ?? t('编辑器中的内容仍然保留,你可以把它另存为一个新文档。')
|
|
288
|
+
}}
|
|
289
|
+
</p>
|
|
290
|
+
<button @click="showModal('saveAs')">
|
|
291
|
+
{{ t('另存副本') }} <ArrowUpRight :size="14" /></button
|
|
292
|
+
><button v-if="!active.missing" @click="store.flush()">{{ t('重试保存') }}</button>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
<div
|
|
296
|
+
:ref="(el) => setPaneElement('editor', pane.id, el)"
|
|
297
|
+
class="editor-scroll"
|
|
298
|
+
:style="{
|
|
299
|
+
'--tano-prose-font-family': selectedVisualFontFamily,
|
|
300
|
+
'--tano-prose-font-size': `${visualFontSize}px`,
|
|
301
|
+
'--tano-source-font-size': `${sourceFontSize}px`,
|
|
302
|
+
}"
|
|
303
|
+
:class="{
|
|
304
|
+
'source-view': paneSource(pane.activeId),
|
|
305
|
+
'conflicted-editor': active.conflict,
|
|
306
|
+
'width-unlimited': !limitPageWidth,
|
|
307
|
+
}"
|
|
308
|
+
tabindex="-1"
|
|
309
|
+
@mousedown.self="
|
|
310
|
+
!paneSource(pane.activeId) &&
|
|
311
|
+
paneEditors.get(pane.id)?.focusTrailingParagraph($event)
|
|
312
|
+
"
|
|
313
|
+
@contextmenu="openPageContextMenu"
|
|
314
|
+
>
|
|
315
|
+
<DocumentSuggestions
|
|
316
|
+
v-slot="suggestions"
|
|
317
|
+
:document="active"
|
|
318
|
+
:readonly="paneReadonly(active)"
|
|
319
|
+
:source="paneSource(pane.activeId)"
|
|
320
|
+
:managed="!!editing.active"
|
|
321
|
+
:author="extensions.commentAuthor?.() ?? { id: 'local', name: t('本机用户') }"
|
|
322
|
+
>
|
|
323
|
+
<PluginDocumentSlot
|
|
324
|
+
v-if="workspace && pane.id === store.activePaneId"
|
|
325
|
+
location="documentHeader"
|
|
326
|
+
:views="store.pluginViews"
|
|
327
|
+
:runtimes="store.pluginRuntime"
|
|
328
|
+
:workspace-id="workspace.id"
|
|
329
|
+
:execute="store.interactWithPlugin"
|
|
330
|
+
/>
|
|
331
|
+
<DocumentTitle
|
|
332
|
+
v-if="workspace && showPageTitle"
|
|
333
|
+
:key="`${workspace.id}:${active.id}`"
|
|
334
|
+
:workspace-id="workspace.id"
|
|
335
|
+
:document-id="active.id"
|
|
336
|
+
:path="store.displayPath(active)"
|
|
337
|
+
:title-source="store.workspaceSettings.pageTitleSource"
|
|
338
|
+
:model-value="suggestions.content"
|
|
339
|
+
:files="workspace.files"
|
|
340
|
+
:mode="store.isDemo ? 'demo' : store.isWeb ? 'web' : 'local'"
|
|
341
|
+
:resolve-image="(reference) => attachments ? attachments.imageUrl(workspace, active.path, reference) : safeRemoteImage(reference)"
|
|
342
|
+
:upload-cover="attachments && !store.isDemo ? (file) => uploadFile(file, true, active) : undefined"
|
|
343
|
+
:resource-revision="resourceRevision"
|
|
344
|
+
:readonly="
|
|
345
|
+
suggestions.readonly ||
|
|
346
|
+
suggestions.suggesting ||
|
|
347
|
+
active.missing ||
|
|
348
|
+
sessionBlocksFileMutation(active.id) ||
|
|
349
|
+
editing.activeBusy
|
|
350
|
+
"
|
|
351
|
+
:rename="renameDocumentTitle"
|
|
352
|
+
@update:model-value="suggestions.edit($event)"
|
|
353
|
+
@enter="insertBlockBelowTitle"
|
|
354
|
+
@comment="paneComments.get(pane.id)?.showDiscussion()"
|
|
355
|
+
/>
|
|
356
|
+
<SourceEditor
|
|
357
|
+
:reference-targets="store.referenceTargets"
|
|
358
|
+
:capabilities="store.capabilities"
|
|
359
|
+
:preferences="documentEditorPreferences"
|
|
360
|
+
:suggestion-marks="suggestions.sourceMarks"
|
|
361
|
+
:translate="t"
|
|
362
|
+
:show-all-line-numbers="showAllLineNumbers"
|
|
363
|
+
v-if="paneSource(pane.activeId)"
|
|
364
|
+
:key="active.id"
|
|
365
|
+
:content-revision="suggestions.viewKey"
|
|
366
|
+
:ref="(el) => setPaneElement('source', pane.id, el)"
|
|
367
|
+
:model-value="suggestions.content"
|
|
368
|
+
:readonly="suggestions.readonly"
|
|
369
|
+
:local-native="!!attachments && !suggestions.suggesting"
|
|
370
|
+
:comment-anchors="commentAnchors[active.id]"
|
|
371
|
+
@ready="paneEditorReady(pane.id, active.id, true)"
|
|
372
|
+
@selection-change="paneSourceSelections[pane.id] = $event"
|
|
373
|
+
@update:model-value="suggestions.edit($event)"
|
|
374
|
+
@files="
|
|
375
|
+
(files, requireImage, position) =>
|
|
376
|
+
insertSourceFiles(files, position, requireImage, active, pane.id)
|
|
377
|
+
"
|
|
378
|
+
/>
|
|
379
|
+
<MarkdownEditor
|
|
380
|
+
:shortcut-hints="{
|
|
381
|
+
delete: shortcutHint('deleteBlock'),
|
|
382
|
+
'move-up': shortcutHint('moveBlockUp'),
|
|
383
|
+
'move-down': shortcutHint('moveBlockDown'),
|
|
384
|
+
indent: shortcutHint('indentBlock'),
|
|
385
|
+
outdent: shortcutHint('outdentBlock'),
|
|
386
|
+
}"
|
|
387
|
+
:suggestion-marks="suggestions.richMarks"
|
|
388
|
+
:transform-change="suggestions.transformChange"
|
|
389
|
+
v-else
|
|
390
|
+
:custom-callout-icon="CalloutIconPicker"
|
|
391
|
+
:slash-commands="editorPluginSlashCommands(active.id)"
|
|
392
|
+
:decorations="editorPluginDecorations(active.id)"
|
|
393
|
+
:code-block-renderers="editorPluginCodeBlockRenderers(active.id)"
|
|
394
|
+
:content-revision="suggestions.viewKey"
|
|
395
|
+
:key="`${active.id}:${active.id === store.active?.id ? (editing.active?.key ?? 'local') : 'local'}`"
|
|
396
|
+
:ref="(el) => setPaneEditor(pane.id, el)"
|
|
397
|
+
:document-id="active.id"
|
|
398
|
+
:readonly="suggestions.readonly"
|
|
399
|
+
:open-links-on-tap="touchLayout"
|
|
400
|
+
:reveal-markdown="suggestions.suggesting ? false : revealMarkdown"
|
|
401
|
+
:show-document-properties="showDocumentProperties"
|
|
402
|
+
:capabilities="store.capabilities"
|
|
403
|
+
:reference-targets="store.referenceTargets"
|
|
404
|
+
:preferences="documentEditorPreferences"
|
|
405
|
+
:translate="t"
|
|
406
|
+
:extension="active.id === store.active?.id ? editing.active?.extension : undefined"
|
|
407
|
+
:model-value="suggestions.content"
|
|
408
|
+
:table-layouts="active.tableLayout?.file.tables"
|
|
409
|
+
:comment-anchors="commentAnchors[active.id]"
|
|
410
|
+
:resolve-image="
|
|
411
|
+
(reference) =>
|
|
412
|
+
attachments
|
|
413
|
+
? attachments.imageUrl(workspace, active.path, reference)
|
|
414
|
+
: safeRemoteImage(reference)
|
|
415
|
+
"
|
|
416
|
+
:resource-revision="resourceRevision"
|
|
417
|
+
:import-file="
|
|
418
|
+
attachments && !suggestions.suggesting ? (file, image) => uploadFile(file, image, active) : undefined
|
|
419
|
+
"
|
|
420
|
+
@update:model-value="suggestions.edit($event)"
|
|
421
|
+
@table-layout-change="!suggestions.suggesting && store.editTableLayout(active.id, $event)"
|
|
422
|
+
@error="store.report"
|
|
423
|
+
@ready="paneEditorReady(pane.id, active.id, false)"
|
|
424
|
+
@search-change="paneSearchRevisions[pane.id] = (paneSearchRevisions[pane.id] ?? 0) + 1"
|
|
425
|
+
@open-link="(reference, newTab) => openDocumentLink(reference, newTab, active.path)"
|
|
426
|
+
@open-wiki-link="openWikiLink"
|
|
427
|
+
@open-reference="openReference"
|
|
428
|
+
@edit-source="setPaneSource(pane.activeId, true)"
|
|
429
|
+
@selection-change="paneSelections[pane.id] = $event"
|
|
430
|
+
@blank-block-ai="openBlankBlockAssistant(pane.id, active.id)"
|
|
431
|
+
>
|
|
432
|
+
<template
|
|
433
|
+
v-if="!suggestions.suggesting && !active.missing && !active.conflict && !active.error"
|
|
434
|
+
#empty-document
|
|
435
|
+
>
|
|
436
|
+
<DocumentStarter
|
|
437
|
+
:assistant="assistant.available"
|
|
438
|
+
:assistant-busy="assistant.busy || assistant.applying || assistant.loading"
|
|
439
|
+
@draft="startDocumentDraft(pane.id, active.id)"
|
|
440
|
+
@initialize="quickInitialize(pane.id, active.id, $event)"
|
|
441
|
+
@template="chooseInitialTemplate(pane.id, active.id)"
|
|
442
|
+
/>
|
|
443
|
+
</template>
|
|
444
|
+
</MarkdownEditor>
|
|
445
|
+
<PluginDocumentSlot
|
|
446
|
+
v-if="workspace && pane.id === store.activePaneId"
|
|
447
|
+
location="documentFooter"
|
|
448
|
+
:views="store.pluginViews"
|
|
449
|
+
:runtimes="store.pluginRuntime"
|
|
450
|
+
:workspace-id="workspace.id"
|
|
451
|
+
:execute="store.interactWithPlugin"
|
|
452
|
+
/>
|
|
453
|
+
<DocumentComments
|
|
454
|
+
v-if="workspace"
|
|
455
|
+
v-model:discussion-visible="showDocumentDiscussion"
|
|
456
|
+
:ref="(el) => setPaneComments(pane.id, el)"
|
|
457
|
+
:workspace-id="workspace.id"
|
|
458
|
+
:document="active"
|
|
459
|
+
:assistant="assistant.available"
|
|
460
|
+
@assistant="discussWithAssistant(pane.id, active.id, $event)"
|
|
461
|
+
:readonly="suggestions.readonly"
|
|
462
|
+
:author="extensions.commentAuthor?.() ?? { id: 'local', name: t('本机用户') }"
|
|
463
|
+
:capture-selection="() => capturePaneCommentSelection(pane.id, active.id)"
|
|
464
|
+
:focus-anchor="(anchor) => focusPaneComment(pane.id, active.id, anchor)"
|
|
465
|
+
:editor-element="paneEditorScrolls.get(pane.id)"
|
|
466
|
+
:geometry="(anchors) => paneCommentGeometry(pane.id, active.id, anchors)"
|
|
467
|
+
@annotations="commentAnchors[active.id] = $event"
|
|
468
|
+
/>
|
|
469
|
+
</DocumentSuggestions>
|
|
470
|
+
</div>
|
|
471
|
+
</main>
|
|
472
|
+
</div>
|
|
473
|
+
<DocumentScrollbar v-if="!touchLayout" :scroll-element="paneScrolls.get(pane.id)" />
|
|
474
|
+
<AssistantLauncher
|
|
475
|
+
v-if="assistant.available && !assistant.opened"
|
|
476
|
+
:scope="paneButterflyScope(pane.id, active.id)"
|
|
477
|
+
:shortcut="shortcuts.toggleAssistant"
|
|
478
|
+
:busy="assistant.busy || assistant.applying"
|
|
479
|
+
@open="openAssistant(pane.id, active.id, { forcePanel: true })"
|
|
480
|
+
/>
|
|
481
|
+
</div>
|
|
482
|
+
</template>
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { mergeText } from '@tano/markdown';
|
|
3
|
-
import { documentLinkDetails, internalReferenceDefinitions } from '@tano/editor/document-links';
|
|
4
|
-
|
|
5
|
-
export function mergeDescription(base: string, local: string, remote: string): string | null {
|
|
6
|
-
const atomic = [...documentLinkDetails(base).filter(link => link.kind === 'markdown' && parseReferenceUrl(link.target)),
|
|
7
|
-
...internalReferenceDefinitions(base)];
|
|
8
|
-
return mergeText(base, local, remote, atomic);
|
|
9
|
-
}
|
|
1
|
+
export { mergeDescription } from '@tano/editor/workspace-objects';
|