editer
This commit is contained in:
1 parent
ad987111a3
commit
c9e61f38c5
89 files changed
+11775
-3155
No files matched your search
@@ -0,0 +1,73 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* 编辑区右侧抽屉(P3-4):承载「大纲 / 双链」。
|
||||
*
|
||||
* 为什么把它们从侧栏挪出来:侧栏描述的是「去哪找文件」,而大纲与双链描述的是
|
||||
* **当前文档**。混在一起会让侧栏在「导航」与「文档信息」两种语义之间摇摆。
|
||||
*/
|
||||
import { Link2, ListTree, Share2, X } from '@lucide/vue'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { SegmentedNav } from '@/components/common'
|
||||
import MarkdownOutline from './MarkdownOutline.vue'
|
||||
import BacklinksPanel from './BacklinksPanel.vue'
|
||||
import LinkGraph from './LinkGraph.vue'
|
||||
import { useEditorStore } from '@/stores/editorStore'
|
||||
|
||||
const props = defineProps<{
|
||||
mode: 'outline' | 'links' | 'graph'
|
||||
/** 编辑器当前光标行(大纲高亮用) */
|
||||
cursorLine: number
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:mode': [mode: 'outline' | 'links' | 'graph']
|
||||
close: []
|
||||
jump: [from: number]
|
||||
open: [relPath: string]
|
||||
create: []
|
||||
}>()
|
||||
|
||||
const store = useEditorStore()
|
||||
|
||||
const NAV_ITEMS = [
|
||||
{ value: 'outline', label: '大纲', icon: ListTree },
|
||||
{ value: 'links', label: '双链', icon: Link2 },
|
||||
{ value: 'graph', label: '图谱', icon: Share2 }
|
||||
]
|
||||
|
||||
function setMode(mode: string): void {
|
||||
if (mode === 'links' || mode === 'graph') emit('update:mode', mode)
|
||||
else emit('update:mode', 'outline')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="flex h-full min-h-0 w-64 shrink-0 flex-col border-l border-border">
|
||||
<div class="flex h-11 shrink-0 items-center gap-1 border-b border-border px-2">
|
||||
<SegmentedNav
|
||||
:model-value="props.mode"
|
||||
:items="NAV_ITEMS"
|
||||
block
|
||||
@update:model-value="setMode"
|
||||
/>
|
||||
<Button variant="ghost" size="icon-sm" title="关闭抽屉" @click="emit('close')">
|
||||
<X class="size-3.5" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<MarkdownOutline
|
||||
v-if="props.mode === 'outline'"
|
||||
class="min-h-0 flex-1"
|
||||
:cursor-line="props.cursorLine"
|
||||
@jump="emit('jump', $event)"
|
||||
/>
|
||||
<BacklinksPanel
|
||||
v-else-if="props.mode === 'links'"
|
||||
class="min-h-0 flex-1"
|
||||
:rel-path="store.currentRelPath"
|
||||
@open="emit('open', $event)"
|
||||
@create="emit('create')"
|
||||
/>
|
||||
<LinkGraph v-else class="min-h-0 flex-1" @open="emit('open', $event)" />
|
||||
</aside>
|
||||
</template>
|
||||
Reference in new issue
Block a user