Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

feat(web): refine document outline navigation

tianma-ifeb2f03e1c4b2
diff --git a/apps/web/src/components/EditorOutline.tsx b/apps/web/src/components/EditorOutline.tsx
index 43a876cc..8a037f49 100644
--- a/apps/web/src/components/EditorOutline.tsx
+++ b/apps/web/src/components/EditorOutline.tsx
@@ -1,20 +1,17 @@
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import type { Editor } from "@tiptap/react";
-import { ChevronDown, ListTree } from "lucide-react";
+import { ChevronDown, ChevronRight, ListTree } from "lucide-react";
import { useTranslation } from "react-i18next";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
+import { buildOutlineTree, type OutlineItem, type OutlineTreeItem } from "@/lib/editor-outline";
import { cn } from "@/lib/utils";
import { EDITOR_OUTLINE_WIDTH } from "@/lib/workspace-ui";
-type OutlineItem = {
- level: number;
- pos: number;
- text: string;
-};
-
type EditorOutlineProps = {
editor: Editor | null;
scrollContainer: HTMLDivElement | null;
collapsed: boolean;
+ shortcutLabel: string;
onCollapsedChange: (collapsed: boolean) => void;
};
@@ -50,10 +47,13 @@ const sameOutlineItems = (left: OutlineItem[], right: OutlineItem[]) =>
return other?.level === item.level && other.pos === item.pos && other.text === item.text;
});
-export const EditorOutline = ({ editor, scrollContainer, collapsed, onCollapsedChange }: EditorOutlineProps) => {
+export const EditorOutline = ({ editor, scrollContainer, collapsed, shortcutLabel, onCollapsedChange }: EditorOutlineProps) => {
const { t } = useTranslation();
const [items, setItems] = useState<OutlineItem[]>([]);
const [activePos, setActivePos] = useState<number | null>(null);
+ const [collapsedPositions, setCollapsedPositions] = useState<Set<number>>(() => new Set());
+ const scrollTrackingPausedUntilRef = useRef(0);
+ const tree = useMemo(() => buildOutlineTree(items), [items]);
const refresh = useCallback(() => {
if (!editor || editor.isDestroyed) {
@@ -98,12 +98,24 @@ export const EditorOutline = ({ editor, scrollContainer, collapsed, onCollapsedC
updateActiveItem();
}, [updateActiveItem]);
+ useEffect(() => {
+ const availablePositions = new Set(items.map((item) => item.pos));
+ setCollapsedPositions((current) => {
+ const next = new Set([...current].filter((pos) => availablePositions.has(pos)));
+ return next.size === current.size ? current : next;
+ });
+ }, [items]);
+
useEffect(() => {
if (!scrollContainer || items.length === 0) {
return;
}
const updateFromScroll = () => {
+ if (Date.now() < scrollTrackingPausedUntilRef.current) {
+ return;
+ }
+
const threshold = scrollContainer.getBoundingClientRect().top + 96;
let activeItem: OutlineItem | null = null;
@@ -130,6 +142,12 @@ export const EditorOutline = ({ editor, scrollContainer, collapsed, onCollapsedC
return;
}
+ // Keep the clicked heading active while smooth scrolling. Without this
+ // guard, intermediate scroll positions can briefly reactivate an earlier
+ // heading and make two rows appear selected (active + hovered).
+ scrollTrackingPausedUntilRef.current = Date.now() + 800;
+ setActivePos(item.pos);
+
let domElement: HTMLElement | null = null;
const domNode = editor.view.nodeDOM(item.pos);
if (domNode instanceof HTMLElement) {
@@ -158,83 +176,142 @@ export const EditorOutline = ({ editor, scrollContainer, collapsed, onCollapsedC
} catch {
// ignore selection positioning error
}
+ };
- setActivePos(item.pos);
+ const toggleItem = (pos: number) => {
+ setCollapsedPositions((current) => {
+ const next = new Set(current);
+ if (next.has(pos)) {
+ next.delete(pos);
+ } else {
+ next.add(pos);
+ }
+ return next;
+ });
};
+ const renderItems = (treeItems: OutlineTreeItem[], depth = 0) => (
+ <ol className={cn("space-y-0.5", depth > 0 && "py-0.5")}>
+ {treeItems.map((item) => {
+ const isActive = activePos === item.pos;
+ const hasChildren = item.children.length > 0;
+ const itemCollapsed = collapsedPositions.has(item.pos);
+ const displayText = stripLeadingEmoji(item.text);
+ const toggleLabel = t(itemCollapsed ? "editor.expandOutlineHeading" : "editor.collapseOutlineHeading", { name: item.text });
+
+ return (
+ <li key={item.pos}>
+ <div
+ className={cn(
+ "group flex min-h-8 items-center rounded-[6px] pr-2 text-[13px] leading-5 transition-colors duration-150",
+ isActive
+ ? "bg-slate-100 text-[#262626]"
+ : "text-[#3f3f3f] hover:bg-slate-50/70 hover:text-[#262626]"
+ )}
+ style={{
+ marginLeft: `${depth * -24}px`,
+ paddingLeft: `${depth * 24}px`,
+ width: `calc(100% + ${depth * 24}px)`,
+ }}
+ >
+ {hasChildren ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ className="flex h-7 w-6 shrink-0 items-center justify-center rounded text-slate-400 transition-colors hover:bg-slate-200/70 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/60"
+ onClick={() => toggleItem(item.pos)}
+ aria-label={toggleLabel}
+ aria-expanded={!itemCollapsed}
+ >
+ {itemCollapsed ? (
+ <ChevronRight className="h-3.5 w-3.5" aria-hidden="true" />
+ ) : (
+ <ChevronDown className="h-3.5 w-3.5" aria-hidden="true" />
+ )}
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="top">{toggleLabel}</TooltipContent>
+ </Tooltip>
+ ) : (
+ <span className="h-7 w-6 shrink-0" aria-hidden="true" />
+ )}
+
+ <button
+ type="button"
+ className="min-w-0 flex-1 truncate py-1 text-left font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/60"
+ onClick={() => jumpToHeading(item)}
+ aria-current={isActive ? "location" : undefined}
+ >
+ {displayText}
+ </button>
+ </div>
+
+ {hasChildren && !itemCollapsed && (
+ <div className="ml-3 border-l border-slate-200/90 pl-3">
+ {renderItems(item.children, depth + 1)}
+ </div>
+ )}
+ </li>
+ );
+ })}
+ </ol>
+ );
+
if (items.length === 0) {
return null;
}
+ const outlineToggleLabel = `${t(collapsed ? "editor.showOutline" : "editor.hideOutline")} (${shortcutLabel})`;
+
return (
- <aside
- className={cn(
- "select-none overflow-x-hidden",
- collapsed
- ? "absolute right-2 top-6 z-10 h-8 w-8 overflow-hidden"
- : "sticky top-6 h-fit max-h-[calc(100vh-8rem)] shrink-0 overflow-y-auto py-2"
- )}
- style={!collapsed ? { width: EDITOR_OUTLINE_WIDTH } : undefined}
- aria-label={t("editor.outline")}
- >
- <div className={cn("flex", collapsed ? "justify-center" : "mb-3 justify-between")}>
- <button
- type="button"
- className={cn(
- "group flex items-center text-left text-[11px] font-bold uppercase tracking-wider text-slate-400 transition-colors hover:text-slate-600",
- collapsed ? "h-7 w-7 justify-center rounded-md hover:bg-slate-100" : "gap-1.5"
- )}
- onClick={() => onCollapsedChange(!collapsed)}
- aria-expanded={!collapsed}
- aria-label={t(collapsed ? "editor.showOutline" : "editor.hideOutline")}
- title={t(collapsed ? "editor.showOutline" : "editor.hideOutline")}
- >
- {collapsed ? (
- <ListTree className="h-4 w-4 text-slate-400 group-hover:text-slate-600" aria-hidden="true" />
- ) : (
- <>
- <span>{t("editor.outline")}</span>
- <ChevronDown className="h-3 w-3 text-slate-400 transition-transform duration-200 group-hover:text-slate-600" aria-hidden="true" />
- </>
- )}
- </button>
- </div>
-
- {!collapsed && (
- <nav className="relative pl-3.5" aria-label={t("editor.outline")}>
- <div className="absolute left-0 top-0 bottom-0 w-[1px] bg-slate-200/80" aria-hidden="true" />
- <ol className="space-y-1.5">
- {items.map((item) => {
- const isActive = activePos === item.pos;
- const displayText = stripLeadingEmoji(item.text);
- return (
- <li key={item.pos} className="relative flex items-center">
- {isActive && (
- <span
- className="absolute left-0 top-0.5 bottom-0.5 w-[2px] -translate-x-[0.5px] rounded-full bg-sky-500 transition-all duration-200"
- aria-hidden="true"
- />
- )}
- <button
- type="button"
- className={cn(
- "block w-full truncate text-left text-[13px] leading-snug transition-colors duration-150 py-0.5",
- isActive
- ? "font-medium text-slate-900"
- : "text-slate-500 hover:text-slate-800"
- )}
- style={{ paddingLeft: `${Math.max(0, item.level - 1) * 12}px` }}
- onClick={() => jumpToHeading(item)}
- title={item.text}
- >
- {displayText}
- </button>
- </li>
- );
- })}
- </ol>
- </nav>
- )}
- </aside>
+ <TooltipProvider delayDuration={350} skipDelayDuration={100}>
+ <aside
+ className={cn(
+ "select-none overflow-x-hidden",
+ collapsed
+ ? "absolute right-2 top-6 z-10 h-8 w-8 overflow-hidden"
+ : "sticky top-6 h-fit max-h-[calc(100vh-8rem)] shrink-0 overflow-y-auto py-2"
+ )}
+ style={{
+ ...(!collapsed ? { width: EDITOR_OUTLINE_WIDTH } : {}),
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif',
+ }}
+ aria-label={t("editor.outline")}
+ >
+ <div className={cn("flex", collapsed ? "justify-center" : "mb-3 justify-between px-1")}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ className={cn(
+ "group flex items-center text-left text-[11px] font-bold uppercase tracking-wider text-slate-400 transition-colors hover:text-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/60",
+ collapsed ? "h-7 w-7 justify-center rounded-md hover:bg-slate-100" : "gap-1.5 rounded-sm"
+ )}
+ onClick={() => onCollapsedChange(!collapsed)}
+ aria-expanded={!collapsed}
+ aria-label={outlineToggleLabel}
+ >
+ {collapsed ? (
+ <ListTree className="h-4 w-4 text-slate-400 group-hover:text-slate-600" aria-hidden="true" />
+ ) : (
+ <>
+ <span>{t("editor.outline")}</span>
+ <ChevronDown className="h-3 w-3 text-slate-400 transition-transform duration-200 group-hover:text-slate-600" aria-hidden="true" />
+ </>
+ )}
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="left">{outlineToggleLabel}</TooltipContent>
+ </Tooltip>
+ </div>
+
+ {!collapsed && (
+ <nav className="pr-2" aria-label={t("editor.outline")}>
+ {renderItems(tree)}
+ </nav>
+ )}
+ </aside>
+ </TooltipProvider>
);
};
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index 08934e6f..a21c4db7 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -663,6 +663,7 @@ type EditorPaneProps = {
saveAndSyncToken: number;
readingProtectionToggleToken: number;
editorModeToggleToken: number;
+ outlineToggleToken: number;
shortcutSettings: ShortcutSettings;
onSyncRequested: () => Promise<void>;
documentActionRequest?: MemoDocumentActionRequest | null;
@@ -736,6 +737,7 @@ const RichEditorPane = ({
saveAndSyncToken,
readingProtectionToggleToken,
editorModeToggleToken,
+ outlineToggleToken,
shortcutSettings,
onSyncRequested,
documentActionRequest,
@@ -834,6 +836,7 @@ const RichEditorPane = ({
const handledSaveAndSyncTokenRef = useRef(saveAndSyncToken);
const handledReadingProtectionToggleTokenRef = useRef(readingProtectionToggleToken);
const handledEditorModeToggleTokenRef = useRef(editorModeToggleToken);
+ const handledOutlineToggleTokenRef = useRef(outlineToggleToken);
const handledAiAssistantOpenTokenRef = useRef(aiAssistantOpenToken);
const noteLinkModifier = useMemo(
() => typeof navigator !== "undefined" && /mac|iphone|ipad|ipod/i.test(navigator.platform) ? "⌘" : "Ctrl",
@@ -3225,6 +3228,19 @@ const RichEditorPane = ({
handleMarkdownModeChange();
}, [editorModeToggleToken, editorShortcutBlocked, handleMarkdownModeChange, useMobilePlainTextEditor]);
+ useEffect(() => {
+ if (handledOutlineToggleTokenRef.current === outlineToggleToken) {
+ return;
+ }
+
+ handledOutlineToggleTokenRef.current = outlineToggleToken;
+ if (editorShortcutBlocked || isMobileViewport || useMobilePlainTextEditor || useMarkdownSourceEditor) {
+ return;
+ }
+
+ setEditorOutlineCollapsed((current) => !current);
+ }, [editorShortcutBlocked, isMobileViewport, outlineToggleToken, useMarkdownSourceEditor, useMobilePlainTextEditor]);
+
useEffect(() => {
if (handledSaveAndSyncTokenRef.current === saveAndSyncToken || saveMutationPending) {
return;
@@ -4793,6 +4809,7 @@ const RichEditorPane = ({
editor={editor}
scrollContainer={editorScrollContainer}
collapsed={editorOutlineCollapsed}
+ shortcutLabel={formatShortcutBinding(shortcutSettings.toggleOutline)}
onCollapsedChange={setEditorOutlineCollapsed}
/>
)}
diff --git a/apps/web/src/components/WorkspaceApp.tsx b/apps/web/src/components/WorkspaceApp.tsx
index c56cea59..f46ed11b 100644
--- a/apps/web/src/components/WorkspaceApp.tsx
+++ b/apps/web/src/components/WorkspaceApp.tsx
@@ -805,6 +805,7 @@ export const WorkspaceApp = ({
const [noteSaveAndSyncToken, setNoteSaveAndSyncToken] = useState(0);
const [noteReadingProtectionToggleToken, setNoteReadingProtectionToggleToken] = useState(0);
const [noteEditorModeToggleToken, setNoteEditorModeToggleToken] = useState(0);
+ const [noteOutlineToggleToken, setNoteOutlineToggleToken] = useState(0);
const [search, setSearch] = useState("");
const [memoFilterMode, setMemoFilterMode] = useState<MemoFilterMode>("all");
const [memoSortMode, setMemoSortMode] = useState<MemoSortMode>("updated-desc");
@@ -2605,6 +2606,7 @@ export const WorkspaceApp = ({
|| action === "saveAndSync"
|| action === "toggleReadingProtection"
|| action === "toggleEditorMode"
+ || action === "toggleOutline"
|| action === "openPreviousMemo"
|| action === "openNextMemo"
) {
@@ -2624,6 +2626,8 @@ export const WorkspaceApp = ({
setNoteReadingProtectionToggleToken((value) => value + 1);
} else if (action === "toggleEditorMode") {
setNoteEditorModeToggleToken((value) => value + 1);
+ } else if (action === "toggleOutline") {
+ setNoteOutlineToggleToken((value) => value + 1);
} else {
const targetMemoId = action === "openPreviousMemo" ? previousMemoId : nextMemoId;
if (targetMemoId) {
@@ -3127,6 +3131,7 @@ export const WorkspaceApp = ({
saveAndSyncToken={noteSaveAndSyncToken}
readingProtectionToggleToken={noteReadingProtectionToggleToken}
editorModeToggleToken={noteEditorModeToggleToken}
+ outlineToggleToken={noteOutlineToggleToken}
shortcutSettings={shortcutSettings}
onSyncRequested={syncMemosManually}
documentActionRequest={memoDocumentActionRequest}
diff --git a/apps/web/src/lib/app-helpers.test.mjs b/apps/web/src/lib/app-helpers.test.mjs
index 7438cd0d..c6ba8786 100644
--- a/apps/web/src/lib/app-helpers.test.mjs
+++ b/apps/web/src/lib/app-helpers.test.mjs
@@ -270,6 +270,12 @@ describe("workspace shortcut preferences", () => {
shift: false,
alt: false,
});
+ expect(DEFAULT_SHORTCUT_SETTINGS.toggleOutline).toEqual({
+ key: "1",
+ ctrlOrMeta: true,
+ shift: true,
+ alt: false,
+ });
});
test("migrates the unreleased reading protection shortcut without replacing custom bindings", () => {
@@ -308,6 +314,7 @@ describe("workspace shortcut preferences", () => {
expect(settings.saveAndSync).toEqual(DEFAULT_SHORTCUT_SETTINGS.saveAndSync);
expect(settings.toggleReadingProtection).toEqual(DEFAULT_SHORTCUT_SETTINGS.toggleReadingProtection);
expect(settings.toggleEditorMode).toEqual(DEFAULT_SHORTCUT_SETTINGS.toggleEditorMode);
+ expect(settings.toggleOutline).toEqual(DEFAULT_SHORTCUT_SETTINGS.toggleOutline);
});
test("recognizes Ctrl and Command variants for the new actions", () => {
@@ -352,5 +359,9 @@ describe("workspace shortcut preferences", () => {
keyboardEvent("/", { metaKey: true }),
DEFAULT_SHORTCUT_SETTINGS,
)).toBe("toggleEditorMode");
+ expect(getShortcutActionForEvent(
+ keyboardEvent("!", { code: "Digit1", ctrlKey: true, shiftKey: true }),
+ DEFAULT_SHORTCUT_SETTINGS,
+ )).toBe("toggleOutline");
});
});
diff --git a/apps/web/src/lib/app-helpers.ts b/apps/web/src/lib/app-helpers.ts
index 57e773da..166850ad 100644
--- a/apps/web/src/lib/app-helpers.ts
+++ b/apps/web/src/lib/app-helpers.ts
@@ -25,7 +25,8 @@ export type ShortcutAction =
| "openAiAssistant"
| "saveAndSync"
| "toggleReadingProtection"
- | "toggleEditorMode";
+ | "toggleEditorMode"
+ | "toggleOutline";
export type ShortcutBinding = {
key: string;
ctrlOrMeta: boolean;
@@ -239,6 +240,11 @@ export const getShortcutActionOptions = (
label: t("shortcuts.actions.toggleEditorMode.label"),
description: t("shortcuts.actions.toggleEditorMode.description"),
},
+ {
+ value: "toggleOutline",
+ label: t("shortcuts.actions.toggleOutline.label"),
+ description: t("shortcuts.actions.toggleOutline.description"),
+ },
];
export const DEFAULT_SHORTCUT_SETTINGS: ShortcutSettings = {
@@ -254,6 +260,7 @@ export const DEFAULT_SHORTCUT_SETTINGS: ShortcutSettings = {
saveAndSync: { key: "s", ctrlOrMeta: true, shift: false, alt: false },
toggleReadingProtection: { key: "e", ctrlOrMeta: true, shift: false, alt: false },
toggleEditorMode: { key: "/", ctrlOrMeta: true, shift: false, alt: false },
+ toggleOutline: { key: "1", ctrlOrMeta: true, shift: true, alt: false },
};
const LEGACY_READING_PROTECTION_SHORTCUT: ShortcutBinding = {
@@ -280,6 +287,7 @@ const SHORTCUT_ACTION_VALUES: ShortcutAction[] = [
"saveAndSync",
"toggleReadingProtection",
"toggleEditorMode",
+ "toggleOutline",
];
export const isDefaultMemoTitle = (title: string | null | undefined) => title?.trim() === DEFAULT_MEMO_TITLE;
@@ -517,7 +525,8 @@ export const formatShortcutBinding = (binding: ShortcutBinding) => {
};
export const shortcutBindingFromKeyboardEvent = (event: KeyboardEvent): ShortcutBinding | null => {
- const key = normalizeShortcutKey(event.key);
+ const digitKey = typeof event.code === "string" ? /^Digit([0-9])$/.exec(event.code)?.[1] : undefined;
+ const key = digitKey ?? normalizeShortcutKey(event.key);
if (["control", "meta", "shift", "alt", "escape"].includes(key)) {
return null;
diff --git a/apps/web/src/lib/editor-outline.test.mjs b/apps/web/src/lib/editor-outline.test.mjs
new file mode 100644
index 00000000..0ee8d0fd
--- /dev/null
+++ b/apps/web/src/lib/editor-outline.test.mjs
@@ -0,0 +1,32 @@
+import { describe, expect, test } from "bun:test";
+import { buildOutlineTree } from "./editor-outline";
+
+const heading = (level, pos, text) => ({ level, pos, text });
+
+describe("editor outline hierarchy", () => {
+ test("nests headings beneath the closest preceding shallower heading", () => {
+ const tree = buildOutlineTree([
+ heading(1, 0, "Project"),
+ heading(2, 10, "Plan"),
+ heading(3, 20, "Draft"),
+ heading(2, 30, "Review"),
+ heading(1, 40, "Archive"),
+ ]);
+
+ expect(tree.map((item) => item.text)).toEqual(["Project", "Archive"]);
+ expect(tree[0]?.children.map((item) => item.text)).toEqual(["Plan", "Review"]);
+ expect(tree[0]?.children[0]?.children.map((item) => item.text)).toEqual(["Draft"]);
+ });
+
+ test("keeps skipped heading levels attached to the nearest valid ancestor", () => {
+ const tree = buildOutlineTree([
+ heading(2, 0, "Standalone"),
+ heading(4, 10, "Detail"),
+ heading(3, 20, "Sibling detail"),
+ heading(2, 30, "Next section"),
+ ]);
+
+ expect(tree.map((item) => item.text)).toEqual(["Standalone", "Next section"]);
+ expect(tree[0]?.children.map((item) => item.text)).toEqual(["Detail", "Sibling detail"]);
+ });
+});
diff --git a/apps/web/src/lib/editor-outline.ts b/apps/web/src/lib/editor-outline.ts
new file mode 100644
index 00000000..c6d02f1c
--- /dev/null
+++ b/apps/web/src/lib/editor-outline.ts
@@ -0,0 +1,33 @@
+export type OutlineItem = {
+ level: number;
+ pos: number;
+ text: string;
+};
+
+export type OutlineTreeItem = OutlineItem & {
+ children: OutlineTreeItem[];
+};
+
+export const buildOutlineTree = (items: OutlineItem[]): OutlineTreeItem[] => {
+ const roots: OutlineTreeItem[] = [];
+ const ancestors: OutlineTreeItem[] = [];
+
+ for (const item of items) {
+ const treeItem: OutlineTreeItem = { ...item, children: [] };
+
+ while (ancestors.length > 0 && ancestors[ancestors.length - 1]!.level >= item.level) {
+ ancestors.pop();
+ }
+
+ const parent = ancestors[ancestors.length - 1];
+ if (parent) {
+ parent.children.push(treeItem);
+ } else {
+ roots.push(treeItem);
+ }
+
+ ancestors.push(treeItem);
+ }
+
+ return roots;
+};
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 540a7941..8398cd29 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -742,6 +742,10 @@ export const enUS = {
label: "Switch editor mode",
description: "Switch between Markdown source and rich text editing.",
},
+ toggleOutline: {
+ label: "Show/hide document outline",
+ description: "Show or hide the current note's document outline on desktop.",
+ },
},
},
quickSwitcher: {
@@ -1170,6 +1174,8 @@ export const enUS = {
outline: "Outline",
showOutline: "Show outline",
hideOutline: "Hide outline",
+ collapseOutlineHeading: "Collapse {{name}}",
+ expandOutlineHeading: "Expand {{name}}",
},
sharing: {
action: "Share note",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index 6e9b214e..b0c7c9aa 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -742,6 +742,10 @@ export const zhCN = {
label: "切换编辑模式",
description: "在 Markdown 源码与富文本编辑模式之间切换。",
},
+ toggleOutline: {
+ label: "显示/隐藏文档大纲",
+ description: "在桌面端显示或隐藏当前笔记的文档大纲。",
+ },
},
},
quickSwitcher: {
@@ -1168,6 +1172,8 @@ export const zhCN = {
outline: "文档大纲",
showOutline: "显示文档大纲",
hideOutline: "隐藏文档大纲",
+ collapseOutlineHeading: "收起 {{name}}",
+ expandOutlineHeading: "展开 {{name}}",
},
sharing: {
action: "分享笔记",