import { useStore } from '../../store'; import { TiptapEditor } from './TiptapEditor'; import { MoreActions } from './MoreActions'; import { BookOpen } from 'lucide-react'; import type { SaveState } from '../../store'; function saveLabel(s: SaveState): string { if (s === 'saving') return '保存中…'; if (s === 'error') return '保存失败'; return '已保存'; } export function Editor() { const currentPath = useStore(s => s.currentPath); const title = useStore(s => s.title); const saveState = useStore(s => s.saveState); if (!currentPath) { // B档-8:空状态引导 return (
从左侧选择一篇笔记,或新建文档开始
支持 Markdown · 代码高亮 · 公式 · 知识图谱
); } return (
{title} {currentPath}
{saveLabel(saveState)}
); }