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): integrate CodeMirror 6 and theme selection for Markdown source editor

tianma-if8eaa5b4495e7
diff --git a/apps/web/package.json b/apps/web/package.json
index 65b71df5..0e76fd33 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -4,9 +4,12 @@
"private": true,
"type": "module",
"dependencies": {
+ "@codemirror/lang-markdown": "^6.5.2",
"@fontsource-variable/noto-sans-sc": "^5.2.8",
"@tiptap/extension-code-block-lowlight": "3.27.1",
"@tiptap/pm": "3.27.1",
+ "@uiw/codemirror-themes-all": "^4.25.11",
+ "@uiw/react-codemirror": "^4.25.11",
"beautiful-mermaid": "^1.1.3",
"highlight.js": "^11.11.1",
"html-to-image": "^1.11.13",
diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx
index c30d4a4a..136aca35 100644
--- a/apps/web/src/components/EditorPane.tsx
+++ b/apps/web/src/components/EditorPane.tsx
@@ -93,7 +93,8 @@ import {
} from "./editor/NoteLinkSuggestion";
import { WeChatIcon } from "./WeChatIcon";
import { ThemeToggle } from "./ThemeToggle";
-import { useEditorTheme } from "./ThemeProvider";
+import { useEditorTheme, useMarkdownTheme } from "./ThemeProvider";
+import { MarkdownSourceEditor, type MarkdownSourceEditorRef } from "./editor/MarkdownSourceEditor";
import { sanitizeAndScopeCss } from "@/lib/css-sandbox";
import { RevisionHistoryDialog } from "./dialogs/RevisionHistoryDialog";
import { ExternalLinkDialog } from "./dialogs/ExternalLinkDialog";
@@ -751,6 +752,7 @@ const RichEditorPane = ({
}: RichEditorPaneProps) => {
const { t, i18n } = useTranslation();
const { customEditorTheme, editorTheme } = useEditorTheme();
+ const { markdownTheme } = useMarkdownTheme();
const queryClient = useQueryClient();
const isSelectionMode = Boolean(selectionActionBar);
const [title, setTitle] = useState("");
@@ -937,7 +939,7 @@ const RichEditorPane = ({
const noteSearchInputRef = useRef<HTMLInputElement | null>(null);
const noteReplaceInputRef = useRef<HTMLInputElement | null>(null);
const noteSearchAutoSelectionRef = useRef<{ editor: Editor; identity: string } | null>(null);
- const markdownTextAreaRef = useRef<HTMLTextAreaElement | null>(null);
+ const markdownSourceEditorRef = useRef<MarkdownSourceEditorRef | null>(null);
const openExternalLinkDialogRef = useRef<() => void>(() => undefined);
const slashCommandLabelsRef = useRef<SlashCommandLabels>({
menu: "",
@@ -1045,7 +1047,7 @@ const RichEditorPane = ({
const restoreScrollAfterModeChange = useCallback((targetMode: "markdown" | "rich", progress: number) => {
const restore = (attempt: number) => {
const target = targetMode === "markdown"
- ? markdownTextAreaRef.current
+ ? markdownSourceEditorRef.current?.getScrollContainer() ?? null
: editorScrollContainerRef.current;
if (restoreEditorScrollProgress(target, progress) || attempt >= 2) {
@@ -1474,9 +1476,9 @@ const RichEditorPane = ({
}
if (useMarkdownSourceEditor) {
- const textarea = markdownTextAreaRef.current;
- const start = textarea?.selectionStart ?? markdownSource.length;
- const end = textarea?.selectionEnd ?? start;
+ const selection = markdownSourceEditorRef.current?.getSelection() ?? { from: markdownSource.length, to: markdownSource.length };
+ const start = selection.from;
+ const end = selection.to;
const selected = markdownSource.slice(start, end);
const looksLikeUrl = /^(https?:\/\/\S+|www\.\S+)$/i.test(selected.trim());
setExternalLinkDraft({
@@ -1533,9 +1535,9 @@ const RichEditorPane = ({
}
if (useMarkdownSourceEditor) {
- const textarea = markdownTextAreaRef.current;
- const start = textarea?.selectionStart ?? markdownSource.length;
- const end = textarea?.selectionEnd ?? start;
+ const selection = markdownSourceEditorRef.current?.getSelection() ?? { from: markdownSource.length, to: markdownSource.length };
+ const start = selection.from;
+ const end = selection.to;
const selected = markdownSource.slice(start, end);
const label = selected.trim() ? selected : text;
const snippet = formatMarkdownLink(label, href);
@@ -1543,10 +1545,8 @@ const RichEditorPane = ({
setMarkdownSource(next);
markDirtyStatus();
window.requestAnimationFrame(() => {
- const node = markdownTextAreaRef.current;
- if (!node) return;
- node.focus();
- node.setSelectionRange(caret, caret);
+ markdownSourceEditorRef.current?.focus();
+ markdownSourceEditorRef.current?.setSelection(caret, caret);
});
return;
}
@@ -2154,8 +2154,9 @@ const RichEditorPane = ({
const contentMarkdown = source.slice(from, to).trim();
if (to > from && contentMarkdown) selection = { kind: "plain", from, to, contentMarkdown };
} else if (useMarkdownSourceEditor) {
- const from = markdownTextAreaRef.current?.selectionStart ?? 0;
- const to = markdownTextAreaRef.current?.selectionEnd ?? from;
+ const selectionPos = markdownSourceEditorRef.current?.getSelection() ?? { from: 0, to: 0 };
+ const from = selectionPos.from;
+ const to = selectionPos.to;
insertionTarget = { kind: "markdown", position: to };
const contentMarkdown = markdownSource.slice(from, to).trim();
if (to > from && contentMarkdown) selection = { kind: "markdown", from, to, contentMarkdown };
@@ -2181,7 +2182,7 @@ const RichEditorPane = ({
}
if (!anchor) {
const fallback = useMarkdownSourceEditor
- ? markdownTextAreaRef.current?.getBoundingClientRect()
+ ? markdownSourceEditorRef.current?.getSelectionCoordinates() ?? markdownSourceEditorRef.current?.getScrollContainer()?.getBoundingClientRect()
: useMobilePlainTextEditor
? mobileTextAreaRef.current?.getBoundingClientRect()
: editorScrollContainerRef.current?.getBoundingClientRect();
@@ -2231,8 +2232,8 @@ const RichEditorPane = ({
const { next, caret } = insertMarkdownSnippet(markdownSource, replacementDraft, aiSelection.from, aiSelection.to);
setMarkdownSource(next);
window.requestAnimationFrame(() => {
- markdownTextAreaRef.current?.focus();
- markdownTextAreaRef.current?.setSelectionRange(caret, caret);
+ markdownSourceEditorRef.current?.focus();
+ markdownSourceEditorRef.current?.setSelection(caret, caret);
});
} else if (aiSelection.kind === "rich" && isEditorReady(editor)) {
const maxPos = editor.state.doc.content.size;
@@ -2276,8 +2277,8 @@ const RichEditorPane = ({
const { next, caret } = insertAiDraftAtTextCursor(markdownSource, insertionDraft, aiInsertionTarget.position);
setMarkdownSource(next);
window.requestAnimationFrame(() => {
- markdownTextAreaRef.current?.focus();
- markdownTextAreaRef.current?.setSelectionRange(caret, caret);
+ markdownSourceEditorRef.current?.focus();
+ markdownSourceEditorRef.current?.setSelection(caret, caret);
});
} else if (isEditorReady(editor)) {
const position = Math.max(0, Math.min(aiInsertionTarget.position, editor.state.doc.content.size));
@@ -2717,7 +2718,7 @@ const RichEditorPane = ({
}
const scrollProgress = getEditorScrollProgress(
- isMarkdownMode ? markdownTextAreaRef.current : editorScrollContainerRef.current,
+ isMarkdownMode ? (markdownSourceEditorRef.current?.getScrollContainer() ?? null) : editorScrollContainerRef.current,
);
if (isMarkdownMode) {
@@ -4746,41 +4747,20 @@ const RichEditorPane = ({
</div>
</>
) : useMarkdownSourceEditor ? (
- // Absolute fill: native <textarea> often ignores flex-1 height; pin to the pane instead.
<div className="relative min-h-0 flex-1">
- <textarea
- ref={markdownTextAreaRef}
+ <MarkdownSourceEditor
+ ref={markdownSourceEditorRef}
value={markdownSource}
- onChange={(event) => handleMarkdownSourceChange(event.target.value)}
- onKeyDown={(event) => {
- if (!event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey && !event.nativeEvent.isComposing) {
- const caretPosition = event.currentTarget.selectionStart;
- const commandStart = getAiSlashCommandStart({
- caretPosition,
- insertedText: event.key,
- textBefore: event.currentTarget.value.slice(0, caretPosition),
- });
- if (commandStart !== null && event.currentTarget.selectionEnd === caretPosition) {
- event.preventDefault();
- const next = `${event.currentTarget.value.slice(0, commandStart)}${event.currentTarget.value.slice(caretPosition)}`;
- handleMarkdownSourceChange(next);
- window.requestAnimationFrame(() => {
- markdownTextAreaRef.current?.setSelectionRange(commandStart, commandStart);
- openAiAssistant();
- });
- return;
- }
- }
- if ((event.ctrlKey || event.metaKey) && !event.altKey && !event.shiftKey && event.key.toLowerCase() === "k") {
- event.preventDefault();
- openExternalLinkDialog();
- }
- }}
+ onChange={handleMarkdownSourceChange}
+ themeName={markdownTheme}
readOnly={effectiveReadOnly}
- spellCheck={false}
- aria-label={t("editor.markdownSourceAria")}
- className="absolute inset-0 h-full w-full resize-none border-0 bg-slate-950 px-4 py-3 font-mono text-sm leading-6 text-slate-100 outline-none placeholder:text-slate-500 sm:px-6"
placeholder={`# ${t("editor.placeholder")}`}
+ ariaLabel={t("editor.markdownSourceAria")}
+ onSlashCommandTrigger={() => {
+ openAiAssistant();
+ }}
+ onLinkShortcut={openExternalLinkDialog}
+ className="absolute inset-0 h-full w-full"
/>
</div>
) : (
diff --git a/apps/web/src/components/ThemeProvider.tsx b/apps/web/src/components/ThemeProvider.tsx
index 42798934..331d5153 100644
--- a/apps/web/src/components/ThemeProvider.tsx
+++ b/apps/web/src/components/ThemeProvider.tsx
@@ -51,6 +51,28 @@ export const MERMAID_THEME_PALETTES: Record<MermaidThemeName, MermaidThemePalett
"one-dark": { bg: "#282c34", fg: "#abb2bf", line: "#4b5263", accent: "#c678dd", muted: "#8f96a3" },
};
+export const MARKDOWN_THEME_NAMES = [
+ "github-light",
+ "github-dark",
+ "one-dark",
+ "tokyo-night",
+ "tokyo-night-storm",
+ "dracula",
+ "nord",
+ "monokai",
+ "solarized-light",
+ "solarized-dark",
+ "vscode-dark",
+ "xcode-light",
+ "sublime",
+ "duotone-light",
+ "duotone-dark",
+ "gruvbox-dark",
+] as const;
+export type MarkdownThemeName = (typeof MARKDOWN_THEME_NAMES)[number];
+export const MARKDOWN_THEME_PREFERENCES = ["auto", ...MARKDOWN_THEME_NAMES] as const;
+export type MarkdownThemePreference = (typeof MARKDOWN_THEME_PREFERENCES)[number];
+
export const EDITOR_THEME_NAMES = [
"default",
"minimal-emerald",
@@ -120,6 +142,12 @@ interface MermaidThemeContextValue {
setMermaidTheme: (theme: MermaidThemePreference) => void;
}
+interface MarkdownThemeContextValue {
+ markdownTheme: MarkdownThemeName;
+ markdownThemePreference: MarkdownThemePreference;
+ setMarkdownTheme: (theme: MarkdownThemePreference) => void;
+}
+
interface EditorThemeContextValue {
editorTheme: EditorThemeName;
setEditorTheme: (theme: EditorThemeName) => void;
@@ -135,6 +163,7 @@ interface ThemeProviderProps {
const THEME_STORAGE_KEY = "edgeever.theme";
const MERMAID_THEME_STORAGE_KEY = "edgeever.mermaid-theme";
+const MARKDOWN_THEME_STORAGE_KEY = "edgeever.markdown-theme";
const EDITOR_THEME_STORAGE_KEY = "edgeever.editor-theme";
const CUSTOM_EDITOR_THEME_STORAGE_KEY = "edgeever.custom-editor-theme";
const CUSTOM_EDITOR_THEMES_STORAGE_KEY = "edgeever.custom-editor-themes";
@@ -142,6 +171,7 @@ const LIGHT_THEME_COLOR = "#f8f9fa";
const DARK_THEME_COLOR = "#101311";
const AppearanceThemeContext = createContext<AppearanceThemeContextValue | null>(null);
const MermaidThemeContext = createContext<MermaidThemeContextValue | null>(null);
+const MarkdownThemeContext = createContext<MarkdownThemeContextValue | null>(null);
const EditorThemeContext = createContext<EditorThemeContextValue | null>(null);
const getSystemTheme = () =>
@@ -180,6 +210,21 @@ export const resolveMermaidTheme = (
? appearance === "dark" ? "zinc-dark" : "zinc-light"
: preference;
+export const getStoredMarkdownTheme = (): MarkdownThemePreference => {
+ const stored = readLocalStorageItem(MARKDOWN_THEME_STORAGE_KEY);
+ return MARKDOWN_THEME_PREFERENCES.includes(stored as MarkdownThemePreference)
+ ? (stored as MarkdownThemePreference)
+ : "tokyo-night";
+};
+
+export const resolveMarkdownTheme = (
+ preference: MarkdownThemePreference,
+ appearance: ResolvedTheme,
+): MarkdownThemeName =>
+ preference === "auto"
+ ? appearance === "dark" ? "tokyo-night" : "github-light"
+ : preference;
+
export const getStoredEditorTheme = (): string => {
return readLocalStorageItem(EDITOR_THEME_STORAGE_KEY) || "default";
};
@@ -269,6 +314,7 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
const [preference, setPreferenceState] = useState<ThemePreference>(getStoredThemePreference);
const [resolvedTheme, setResolvedTheme] = useState<ResolvedTheme>(() => resolveTheme(preference));
const [mermaidThemePreference, setMermaidThemePreference] = useState<MermaidThemePreference>(getStoredMermaidTheme);
+ const [markdownThemePreference, setMarkdownThemePreference] = useState<MarkdownThemePreference>(getStoredMarkdownTheme);
const [editorTheme, setEditorThemeState] = useState<string>(getStoredEditorTheme);
const [customEditorThemes, setCustomEditorThemesState] = useState<CustomEditorTheme[]>(getStoredCustomEditorThemes);
@@ -326,6 +372,13 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
window.localStorage.setItem(MERMAID_THEME_STORAGE_KEY, nextTheme);
}, []);
+ const markdownTheme = resolveMarkdownTheme(markdownThemePreference, resolvedTheme);
+
+ const setMarkdownTheme = useCallback((nextTheme: MarkdownThemePreference) => {
+ setMarkdownThemePreference(nextTheme);
+ window.localStorage.setItem(MARKDOWN_THEME_STORAGE_KEY, nextTheme);
+ }, []);
+
const setEditorTheme = useCallback((nextTheme: string) => {
setEditorThemeState(nextTheme);
window.localStorage.setItem(EDITOR_THEME_STORAGE_KEY, nextTheme);
@@ -349,6 +402,15 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
[mermaidTheme, mermaidThemePreference, setMermaidTheme]
);
+ const markdownValue = useMemo(
+ () => ({
+ markdownTheme,
+ markdownThemePreference,
+ setMarkdownTheme,
+ }),
+ [markdownTheme, markdownThemePreference, setMarkdownTheme]
+ );
+
const editorValue = useMemo(
() => ({
editorTheme,
@@ -364,9 +426,11 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
return (
<AppearanceThemeContext.Provider value={appearanceValue}>
<MermaidThemeContext.Provider value={mermaidValue}>
- <EditorThemeContext.Provider value={editorValue}>
- {children}
- </EditorThemeContext.Provider>
+ <MarkdownThemeContext.Provider value={markdownValue}>
+ <EditorThemeContext.Provider value={editorValue}>
+ {children}
+ </EditorThemeContext.Provider>
+ </MarkdownThemeContext.Provider>
</MermaidThemeContext.Provider>
</AppearanceThemeContext.Provider>
);
@@ -392,6 +456,16 @@ export const useMermaidTheme = () => {
return context;
};
+export const useMarkdownTheme = () => {
+ const context = useContext(MarkdownThemeContext);
+
+ if (!context) {
+ throw new Error("useMarkdownTheme must be used within ThemeProvider");
+ }
+
+ return context;
+};
+
export const useEditorTheme = () => {
const context = useContext(EditorThemeContext);
diff --git a/apps/web/src/components/editor/MarkdownSourceEditor.tsx b/apps/web/src/components/editor/MarkdownSourceEditor.tsx
new file mode 100644
index 00000000..2239a764
--- /dev/null
+++ b/apps/web/src/components/editor/MarkdownSourceEditor.tsx
@@ -0,0 +1,289 @@
+import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from "react";
+import CodeMirror, {
+ EditorView,
+ type ReactCodeMirrorRef,
+ type Extension,
+} from "@uiw/react-codemirror";
+import { markdown } from "@codemirror/lang-markdown";
+import {
+ githubLight,
+ githubDark,
+ atomone,
+ tokyoNight,
+ tokyoNightStorm,
+ dracula,
+ nord,
+ monokai,
+ solarizedLight,
+ solarizedDark,
+ vscodeDark,
+ xcodeLight,
+ sublime,
+ duotoneLight,
+ duotoneDark,
+ gruvboxDark,
+} from "@uiw/codemirror-themes-all";
+import type { MarkdownThemeName } from "../ThemeProvider";
+import { getAiSlashCommandStart } from "@/lib/editor-shortcuts";
+import { cn } from "@/lib/utils";
+
+export interface MarkdownSourceEditorRef {
+ getScrollContainer: () => HTMLElement | null;
+ getSelection: () => { from: number; to: number };
+ setSelection: (from: number, to: number) => void;
+ focus: () => void;
+ insertText: (text: string, from?: number, to?: number) => void;
+ getSelectionCoordinates: () => { top: number; left: number; bottom: number; right: number } | null;
+}
+
+export interface MarkdownSourceEditorProps {
+ value: string;
+ onChange: (value: string) => void;
+ themeName: MarkdownThemeName;
+ readOnly?: boolean;
+ placeholder?: string;
+ className?: string;
+ ariaLabel?: string;
+ onSlashCommandTrigger?: (commandStart: number) => void;
+ onLinkShortcut?: () => void;
+}
+
+export const CODE_MIRROR_THEME_MAP: Record<MarkdownThemeName, Extension> = {
+ "github-light": githubLight,
+ "github-dark": githubDark,
+ "one-dark": atomone,
+ "tokyo-night": tokyoNight,
+ "tokyo-night-storm": tokyoNightStorm,
+ dracula,
+ nord,
+ monokai,
+ "solarized-light": solarizedLight,
+ "solarized-dark": solarizedDark,
+ "vscode-dark": vscodeDark,
+ "xcode-light": xcodeLight,
+ sublime,
+ "duotone-light": duotoneLight,
+ "duotone-dark": duotoneDark,
+ "gruvbox-dark": gruvboxDark,
+};
+
+const baseEditorTheme = EditorView.theme({
+ "&": {
+ height: "100%",
+ width: "100%",
+ fontSize: "14px",
+ fontFamily:
+ 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
+ },
+ ".cm-scroller": {
+ overflow: "auto",
+ height: "100%",
+ lineHeight: "1.6",
+ fontFamily: "inherit",
+ },
+ ".cm-content": {
+ padding: "16px 24px 64px",
+ minHeight: "100%",
+ },
+ ".cm-line": {
+ padding: "0",
+ },
+ ".cm-gutters": {
+ borderRight: "1px solid rgba(128, 128, 128, 0.15)",
+ backgroundColor: "transparent",
+ },
+ "&.cm-focused": {
+ outline: "none",
+ },
+});
+
+export const MarkdownSourceEditor = forwardRef<MarkdownSourceEditorRef, MarkdownSourceEditorProps>(
+ (
+ {
+ value,
+ onChange,
+ themeName,
+ readOnly = false,
+ placeholder,
+ className,
+ ariaLabel,
+ onSlashCommandTrigger,
+ onLinkShortcut,
+ },
+ ref,
+ ) => {
+ const cmRef = useRef<ReactCodeMirrorRef | null>(null);
+
+ useImperativeHandle(
+ ref,
+ () => ({
+ getScrollContainer: () => {
+ return (
+ cmRef.current?.view?.scrollDOM ??
+ (cmRef.current?.editor?.querySelector(".cm-scroller") as HTMLElement | null)
+ );
+ },
+ getSelection: () => {
+ const view = cmRef.current?.view;
+ if (!view) return { from: 0, to: 0 };
+ const main = view.state.selection.main;
+ return { from: main.from, to: main.to };
+ },
+ setSelection: (from: number, to: number) => {
+ const view = cmRef.current?.view;
+ if (!view) return;
+ const safeFrom = Math.max(0, Math.min(from, view.state.doc.length));
+ const safeTo = Math.max(safeFrom, Math.min(to, view.state.doc.length));
+ view.dispatch({
+ selection: { anchor: safeFrom, head: safeTo },
+ scrollIntoView: true,
+ });
+ },
+ focus: () => {
+ cmRef.current?.view?.focus();
+ },
+ insertText: (text: string, from?: number, to?: number) => {
+ const view = cmRef.current?.view;
+ if (!view) return;
+ const main = view.state.selection.main;
+ const insertFrom = from ?? main.from;
+ const insertTo = to ?? main.to;
+ view.dispatch({
+ changes: { from: insertFrom, to: insertTo, insert: text },
+ selection: { anchor: insertFrom + text.length },
+ scrollIntoView: true,
+ });
+ },
+ getSelectionCoordinates: () => {
+ const view = cmRef.current?.view;
+ if (!view) return null;
+ const main = view.state.selection.main;
+ const coords = view.coordsAtPos(main.from);
+ if (!coords) return null;
+ return {
+ top: coords.top,
+ left: coords.left,
+ bottom: coords.bottom,
+ right: coords.right,
+ };
+ },
+ }),
+ [],
+ );
+
+ const activeThemeExtension = useMemo(() => {
+ return CODE_MIRROR_THEME_MAP[themeName] ?? tokyoNight;
+ }, [themeName]);
+
+ const extensions = useMemo(() => {
+ return [
+ markdown(),
+ EditorView.lineWrapping,
+ baseEditorTheme,
+ ];
+ }, []);
+
+ const handleKeyDown = useCallback(
+ (event: React.KeyboardEvent | KeyboardEvent) => {
+ // Link shortcut: Cmd+K / Ctrl+K
+ if (
+ (event.ctrlKey || event.metaKey) &&
+ !event.altKey &&
+ !event.shiftKey &&
+ event.key.toLowerCase() === "k"
+ ) {
+ event.preventDefault();
+ onLinkShortcut?.();
+ return;
+ }
+
+ // AI Slash Command check on single key press
+ if (
+ !event.ctrlKey &&
+ !event.metaKey &&
+ !event.altKey &&
+ !event.shiftKey &&
+ !(event as KeyboardEvent).isComposing
+ ) {
+ const view = cmRef.current?.view;
+ if (view) {
+ const main = view.state.selection.main;
+ if (main.empty) {
+ const caretPosition = main.head;
+ const textBefore = view.state.doc.sliceString(0, caretPosition);
+ const commandStart = getAiSlashCommandStart({
+ caretPosition,
+ insertedText: event.key,
+ textBefore,
+ });
+
+ if (commandStart !== null) {
+ event.preventDefault();
+ // Replace the trigger characters (e.g., "/a") with empty string and open AI Assistant
+ view.dispatch({
+ changes: { from: commandStart, to: caretPosition, insert: "" },
+ selection: { anchor: commandStart },
+ });
+ onSlashCommandTrigger?.(commandStart);
+ }
+ }
+ }
+ }
+ },
+ [onLinkShortcut, onSlashCommandTrigger],
+ );
+
+ const handleCodeMirrorChange = useCallback(
+ (val: string) => {
+ onChange(val);
+ },
+ [onChange],
+ );
+
+ return (
+ <div
+ className={cn(
+ "relative h-full w-full overflow-hidden edgeever-markdown-source-editor",
+ className,
+ )}
+ aria-label={ariaLabel}
+ >
+ <CodeMirror
+ ref={cmRef}
+ value={value}
+ theme={activeThemeExtension}
+ onChange={handleCodeMirrorChange}
+ onKeyDown={handleKeyDown}
+ extensions={extensions}
+ readOnly={readOnly}
+ editable={!readOnly}
+ placeholder={placeholder}
+ height="100%"
+ basicSetup={{
+ lineNumbers: false,
+ foldGutter: false,
+ highlightActiveLineGutter: false,
+ highlightActiveLine: false,
+ dropCursor: true,
+ allowMultipleSelections: false,
+ indentOnInput: true,
+ bracketMatching: true,
+ closeBrackets: true,
+ autocompletion: false,
+ rectangularSelection: false,
+ crosshairCursor: false,
+ highlightSelectionMatches: true,
+ closeBracketsKeymap: true,
+ searchKeymap: true,
+ foldKeymap: false,
+ completionKeymap: false,
+ lintKeymap: false,
+ }}
+ className="h-full w-full"
+ />
+ </div>
+ );
+ },
+);
+
+MarkdownSourceEditor.displayName = "MarkdownSourceEditor";
diff --git a/apps/web/src/components/settings/PreferenceCard.tsx b/apps/web/src/components/settings/PreferenceCard.tsx
index 5efd12c8..c768154a 100644
--- a/apps/web/src/components/settings/PreferenceCard.tsx
+++ b/apps/web/src/components/settings/PreferenceCard.tsx
@@ -1,4 +1,4 @@
-import { AlignHorizontalJustifyCenter, ChartNoAxesCombined, Image, Keyboard, Languages, MousePointerClick, Palette, RefreshCw, Sparkles } from "lucide-react";
+import { AlignHorizontalJustifyCenter, ChartNoAxesCombined, FileCode2, Image, Keyboard, Languages, MousePointerClick, Palette, RefreshCw, Sparkles } from "lucide-react";
import { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { writeSyncIntervalPreference, type EditorContentAlignment, type ShortcutSettings, type SyncIntervalPreference } from "@/lib/app-helpers";
@@ -32,8 +32,10 @@ import {
import { ShortcutSettingsItem } from "./ShortcutSettingsItem";
import { CustomEditorThemeDialog } from "./CustomEditorThemeDialog";
import {
+ MARKDOWN_THEME_PREFERENCES,
MERMAID_THEME_PREFERENCES,
useEditorTheme,
+ useMarkdownTheme,
useMermaidTheme,
DEFAULT_CUSTOM_LIGHT_COLORS,
DEFAULT_CUSTOM_DARK_COLORS,
@@ -69,6 +71,7 @@ export const PreferenceCard = ({
setEditorTheme,
} = useEditorTheme();
const { mermaidThemePreference, setMermaidTheme } = useMermaidTheme();
+ const { markdownThemePreference, setMarkdownTheme } = useMarkdownTheme();
const [customThemeDialogOpen, setCustomThemeDialogOpen] = useState(false);
const [editingTheme, setEditingTheme] = useState<CustomEditorTheme | null>(null);
const [activeLocalePreference, setActiveLocalePreference] = useState<AppLocalePreference>(() => getAppLocalePreference());
@@ -306,6 +309,30 @@ export const PreferenceCard = ({
</div>
</div>
+ <div className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
+ <div className="flex min-w-0 items-start gap-3">
+ <FileCode2 className="mt-0.5 h-4 w-4 shrink-0 text-emerald-700" />
+ <div className="min-w-0">
+ <div className="text-sm font-semibold text-slate-900">{t("settings.markdownThemeTitle")}</div>
+ <div className="mt-0.5 text-xs leading-4 text-slate-500">{t("settings.markdownThemeDescription")}</div>
+ </div>
+ </div>
+ <div className="w-full shrink-0 sm:w-80">
+ <Select value={markdownThemePreference} onValueChange={(value) => setMarkdownTheme(value as typeof markdownThemePreference)}>
+ <SelectTrigger aria-label={t("settings.markdownThemeTitle")} className="h-9 bg-white">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {MARKDOWN_THEME_PREFERENCES.map((theme) => (
+ <SelectItem key={theme} value={theme}>
+ {t(`settings.markdownThemes.${theme}`)}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+
<div className="flex min-h-16 flex-col items-start gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4">
<div className="flex min-w-0 items-start gap-3">
<ChartNoAxesCombined className="mt-0.5 h-4 w-4 shrink-0 text-emerald-700" />
diff --git a/apps/web/src/lib/markdown-theme.test.mjs b/apps/web/src/lib/markdown-theme.test.mjs
new file mode 100644
index 00000000..dc7b6415
--- /dev/null
+++ b/apps/web/src/lib/markdown-theme.test.mjs
@@ -0,0 +1,31 @@
+import { describe, expect, test } from "bun:test";
+import {
+ MARKDOWN_THEME_NAMES,
+ MARKDOWN_THEME_PREFERENCES,
+ resolveMarkdownTheme,
+} from "../components/ThemeProvider";
+import { CODE_MIRROR_THEME_MAP } from "../components/editor/MarkdownSourceEditor";
+
+describe("markdown theme contracts", () => {
+ test("automatic Markdown themes follow the resolved appearance", () => {
+ expect(resolveMarkdownTheme("auto", "light")).toBe("github-light");
+ expect(resolveMarkdownTheme("auto", "dark")).toBe("tokyo-night");
+ expect(resolveMarkdownTheme("dracula", "light")).toBe("dracula");
+ expect(resolveMarkdownTheme("nord", "dark")).toBe("nord");
+ expect(resolveMarkdownTheme("tokyo-night", "light")).toBe("tokyo-night");
+ });
+
+ test("all markdown theme preferences are correctly defined", () => {
+ expect(MARKDOWN_THEME_PREFERENCES[0]).toBe("auto");
+ for (const theme of MARKDOWN_THEME_NAMES) {
+ expect(MARKDOWN_THEME_PREFERENCES).toContain(theme);
+ }
+ });
+
+ test("every supported markdown theme has a CodeMirror extension mapped", () => {
+ for (const theme of MARKDOWN_THEME_NAMES) {
+ const extension = CODE_MIRROR_THEME_MAP[theme];
+ expect(extension).toBeDefined();
+ }
+ });
+});
diff --git a/bun.lock b/bun.lock
index ff4b70c9..94ea4c5e 100644
--- a/bun.lock
+++ b/bun.lock
@@ -88,7 +88,7 @@
},
"apps/desktop": {
"name": "@edgeever/desktop",
- "version": "1.26.0",
+ "version": "1.41.0",
"dependencies": {
"electron-updater": "^6.6.2",
},
@@ -201,9 +201,12 @@
"name": "@edgeever/web",
"version": "0.1.3",
"dependencies": {
+ "@codemirror/lang-markdown": "^6.5.2",
"@fontsource-variable/noto-sans-sc": "^5.2.8",
"@tiptap/extension-code-block-lowlight": "3.27.1",
"@tiptap/pm": "3.27.1",
+ "@uiw/codemirror-themes-all": "^4.25.11",
+ "@uiw/react-codemirror": "^4.25.11",
"beautiful-mermaid": "^1.1.3",
"highlight.js": "^11.11.1",
"html-to-image": "^1.11.13",
@@ -241,8 +244,8 @@
},
},
"patchedDependencies": {
},
"packages": {
"@adobe/css-tools": ["@adobe/[email protected]", "", {}, "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q=="],
@@ -573,6 +576,30 @@
"@cloudflare/workers-types": ["@cloudflare/[email protected]", "", {}, "sha512-fBnpQyFRS3Ce1l2IUd3k+aUxgy/7VMlVXF4F672/eSrpXFeezCy3Ha6Z2uTyGgqu9sGvQPOj8nqKBv2yeI+ciw=="],
+ "@codemirror/autocomplete": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-tlosUqb+3BbxCxZdu4tKeRghPFC+QM7q4X5YhKV2eCmPG+1r2F3f4AaSz5sCrFqUtX4Jh20VFTKecl16MgiV9g=="],
+
+ "@codemirror/commands": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.7.0", "@codemirror/view": "^6.27.0", "@lezer/common": "^1.1.0" } }, "sha512-/K4Rl5BN0OtTiPWmJCdqODu38XnDMsDxKY5rgrPnCkutPTJf2wVbkoixLfealF5Kwse/s8P8M5jAiURiwSwnFA=="],
+
+ "@codemirror/lang-css": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@lezer/common": "^1.0.2", "@lezer/css": "^1.1.7" } }, "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg=="],
+
+ "@codemirror/lang-html": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/lang-css": "^6.0.0", "@codemirror/lang-javascript": "^6.0.0", "@codemirror/language": "^6.4.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/css": "^1.1.0", "@lezer/html": "^1.3.12" } }, "sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w=="],
+
+ "@codemirror/lang-javascript": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/language": "^6.6.0", "@codemirror/lint": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0", "@lezer/javascript": "^1.0.0" } }, "sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A=="],
+
+ "@codemirror/lang-markdown": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/autocomplete": "^6.7.1", "@codemirror/lang-html": "^6.0.0", "@codemirror/language": "^6.3.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "@lezer/common": "^1.2.1", "@lezer/markdown": "^1.0.0" } }, "sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw=="],
+
+ "@codemirror/language": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.23.0", "@lezer/common": "^1.5.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0", "style-mod": "^4.0.0" } }, "sha512-1q4PaT+o6PbgpkJt4Q8Fv5XJxTy4FUZ4MWETtyiDw3J0Pyr9E2vqcKL+k9wcvjNTIsauxvE7OfmWj3FRPHQ76A=="],
+
+ "@codemirror/lint": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.42.0", "crelt": "^1.0.5" } }, "sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg=="],
+
+ "@codemirror/search": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.37.0", "crelt": "^1.0.5" } }, "sha512-uMe5UO6PamJtSHrXhhHOzSX3ReWtiJrva6GnPMwSOrZtiExb5X5eExhr2OUZQVvdxPsKpY3Ro2mFbQadpPWmHA=="],
+
+ "@codemirror/state": ["@codemirror/[email protected]", "", { "dependencies": { "@marijn/find-cluster-break": "^1.0.0" } }, "sha512-9QzNDgE4EYDnAHfrTlR2lwiPciiOymLtwKK+8yHQzCc7GXhAP9xdEbEJFy2IWB1j9UGUl9BsgMmTo/ImA02T7A=="],
+
+ "@codemirror/theme-one-dark": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "@lezer/highlight": "^1.0.0" } }, "sha512-NzBdIvEJmx6fjeremiGp3t/okrLPYT0d9orIc7AFun8oZcRk58aejkqhv6spnz4MLAevrKNPMQYXEWMg4s+sKA=="],
+
+ "@codemirror/view": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/state": "^6.7.0", "crelt": "^1.0.6", "style-mod": "^4.1.0", "w3c-keyname": "^2.2.4" } }, "sha512-sTuUzTpPMFebRhg6dawChoKKgndIwfjmJgKVxBefPElcU2NwQ6AFroupk0SFqEerQyZOGRfDNnSN8Dw/lMAsXw=="],
+
"@cspotcode/source-map-support": ["@cspotcode/[email protected]", "", { "dependencies": { "@jridgewell/trace-mapping": "0.3.9" } }, "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw=="],
"@devicefarmer/adbkit": ["@devicefarmer/[email protected]", "", { "dependencies": { "@devicefarmer/adbkit-logcat": "^2.1.2", "@devicefarmer/adbkit-monkey": "~1.2.1", "bluebird": "~3.7", "commander": "^9.1.0", "debug": "~4.3.1", "node-forge": "^1.3.1", "split": "~1.0.1" }, "bin": { "adbkit": "bin/adbkit" } }, "sha512-7rBLLzWQnBwutH2WZ0EWUkQdihqrnLYCUMaB44hSol9e0/cdIhuNFcqZO0xNheAU6qqHVA8sMiLofkYTgb+lmw=="],
@@ -895,10 +922,26 @@
"@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
+ "@lezer/common": ["@lezer/[email protected]", "", {}, "sha512-sxQE460fPZyU3sdc8lafxiPwJHBzZRy/udNFynGQky1SePYBdhkBl1kOagA9uT3pxR8K09bOrmTUqA9wb/PjSQ=="],
+
+ "@lezer/css": ["@lezer/[email protected]", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.3.0" } }, "sha512-YJE78Wcg+zX8f10hiHWQ4Az48Qr/c13eId0VtRQYLBpxHDmDeSrXIlkbl+fJGW42rWC/uoUco9mhBZeVWP/A1g=="],
+
+ "@lezer/highlight": ["@lezer/[email protected]", "", { "dependencies": { "@lezer/common": "^1.3.0" } }, "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g=="],
+
+ "@lezer/html": ["@lezer/[email protected]", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg=="],
+
+ "@lezer/javascript": ["@lezer/[email protected]", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.1.3", "@lezer/lr": "^1.3.0" } }, "sha512-vvYx3MhWqeZtGPwDStM2dwgljd5smolYD2lR2UyFcHfxbBQebqx8yjmFmxtJ/E6nN6u1D9srOiVWm3Rb4tmcUA=="],
+
+ "@lezer/lr": ["@lezer/[email protected]", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-rnCpTIBafOx4mRp43xOxDJbFipJm/c0cia/V5TiGlhmMa+wsSdoGmUN3w5Bqrks/09Q/D4tNAmWaT8p6NRi77A=="],
+
+ "@lezer/markdown": ["@lezer/[email protected]", "", { "dependencies": { "@lezer/common": "^1.5.0", "@lezer/highlight": "^1.0.0" } }, "sha512-iTkYvoVcKt3WkeL7qUDyXHONZEwLio4wj8KTNi2dnjQEXBZKMV63BpQrPqfsM+OkvuRbiSTAcycYAsQzLhRNoQ=="],
+
"@malept/cross-spawn-promise": ["@malept/[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.1" } }, "sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg=="],
"@malept/flatpak-bundler": ["@malept/[email protected]", "", { "dependencies": { "debug": "^4.1.1", "fs-extra": "^9.0.0", "lodash": "^4.17.15", "tmp-promise": "^3.0.2" } }, "sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q=="],
+ "@marijn/find-cluster-break": ["@marijn/[email protected]", "", {}, "sha512-Wy0V7+SGUjnF9/TkiM1hKVDPj7jKXduPNboMVtHTA8dySMURWqfg/JZ9E2Sq8JgSJmkl7k7Qe9FLeMSrSraWmQ=="],
+
"@mdn/browser-compat-data": ["@mdn/[email protected]", "", {}, "sha512-up6DsNsaPt3jq5d2TGx4UOXIqBKU0D86dxWwcVmmOOEYqP1rFaV1XcAcwHxMvb6bbtMfY5JpjUCszzy/aVc4yA=="],
"@mdx-js/mdx": ["@mdx-js/[email protected]", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdx": "^2.0.0", "acorn": "^8.0.0", "collapse-white-space": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "estree-util-scope": "^1.0.0", "estree-walker": "^3.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "markdown-extensions": "^2.0.0", "recma-build-jsx": "^1.0.0", "recma-jsx": "^1.0.0", "recma-stringify": "^1.0.0", "rehype-recma": "^1.0.0", "remark-mdx": "^3.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "source-map": "^0.7.0", "unified": "^11.0.0", "unist-util-position-from-estree": "^2.0.0", "unist-util-stringify-position": "^4.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-f6ZO2ifpwAQIpzGWaBQT2TXxPv6z3RBzQKpVftEWN78Vl/YweF1uwussDx8ECAXVtr3Rs89fKyG9YlzUs9DyGQ=="],
@@ -1455,6 +1498,84 @@
"@types/yauzl": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],
+ "@uiw/codemirror-extensions-basic-setup": ["@uiw/[email protected]", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-otyFa+n9IOYtEjaKOxPedHkj15fTPUF21wdR9pv0GpZPfuGl27cvmcv6+tognbRu9VvEcsHKE+ESoszeo3KfTw=="],
+
+ "@uiw/codemirror-theme-abcdef": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-kYf6Dcleo8eHJQrKOdfhueNZyYEMcG2AAlVnhfGS5mKQrJ+GYhtFNV7iLJ7g7BpaNwAtL5Jst0meXplBwtVe4g=="],
+
+ "@uiw/codemirror-theme-abyss": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-l6RPTg5NeY6YTyE2QeufN84SAVfrVwYtPVtRPVMZA18zjhNIWsJNWkzHkmde5/OSXhtqXZm79iqtPZSyyIcRZA=="],
+
+ "@uiw/codemirror-theme-androidstudio": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-uCglksGWaLfmGvTjFuBhtPq8IoKdXLalWDF3aXkENEYx/xHucWDp3moULuUFAVBya5peTnNhUZW9MBciBrjGjQ=="],
+
+ "@uiw/codemirror-theme-andromeda": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-ikKVA7ZswrC6hdVDqbC4Qer3EsIyDFc8VgU2updo1eaoTIxyrcBYeuOwxqt0PN4Qblb3x9GGwaU3W56U5sF7rg=="],
+
+ "@uiw/codemirror-theme-atomone": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-OnlFrWU57rSdgxf0PNX1knVWsJ/kcY6hrRWkWJ0tkNTwq2/EBEih/g/ds4QDB3MdJW1pZf57htC25wECu0lNPw=="],
+
+ "@uiw/codemirror-theme-aura": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-yxnegGqjbUxfI1C7lNzX7n+NRebTWcnRwFllDVfMqyovgoOOfRjP+LS+7EdpNdCsdXzt0eQtLjUf2WDeJazlLw=="],
+
+ "@uiw/codemirror-theme-basic": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-YGVUxlVi6kzoB2tW0TDUrcEFCs6acJSiqTI8+GyfiYtb10ikfaM8eh+n5u0p1rnhzgPCgA8PSdUvmMJ/MAtgDw=="],
+
+ "@uiw/codemirror-theme-bbedit": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-hVtkKp/AgZNJsB5gVDxhxEEm0WAHcHhWnJ613BXNjypBD8+VZMepA1ekEQcuQHlCeNWZGi9s9MXmTd+jdepZJg=="],
+
+ "@uiw/codemirror-theme-bespin": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-F4idCkLlVhh/sExZuZ//PeKesQ3mNp16gm1MrHJftTKRKtv+ez/usko8uGwLyG67sz3uB9KskwztXQxokoAyfg=="],
+
+ "@uiw/codemirror-theme-console": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-1CEBSL6RoSNXgV61S3wBRfPn83eXoxKkfgSdJA3RfElEsneoE8vRmXLw/VXUJTeGI/99psUyBWifwjCaSUeBnQ=="],
+
+ "@uiw/codemirror-theme-copilot": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-nqz880YSTfgqPXicEqYDj/8TyFg7UjP6iGFo6dp3t6x13BC9JEvGoNhC9+4eVWTxS8l6bYJCSz9ljoIvoYErgg=="],
+
+ "@uiw/codemirror-theme-darcula": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-Srj3/7SPvN2SlweDL+y+/E7S0OJmkTLy/ubA8+LwuwZK0MVTFFh1q0oxFcfHMkNQaTwQuGzJ4bfVLF6pGs5bqg=="],
+
+ "@uiw/codemirror-theme-dracula": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-pbgp5vRjUGF7+BpB33tycJHGlMV5lrTPQDRN3JRvJ/Uz9yqe2rT10iTIai46zMd3dmXE6Gsa5vY4KpcpPzb1Mg=="],
+
+ "@uiw/codemirror-theme-duotone": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-d2QAuBP/biE54QkQ9TL2OdvQ+vD5anMxtW2szJefrct93hpvKy8CsiKnZff36SUp6q47nxe6KYJVpVLz3q0QoQ=="],
+
+ "@uiw/codemirror-theme-eclipse": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-+Ow3nii09Ac0Y9Qy9xNChojq1fKf9Uv5T5FRL0oM9kI1r114+uY+VAvFb57p3J5k6BveAXhrfVvOATsEtaW23A=="],
+
+ "@uiw/codemirror-theme-github": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-3s0LK3gX2mvGI996z3G0tEHZqshbeJRly+QMRsKGAI1Tfr1V475bfaW9NvnoDdINuQHt+RB+ri6q57+WWF8d+A=="],
+
+ "@uiw/codemirror-theme-gruvbox-dark": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-sQtBCtTbW5xgCYuHSEW8FOBd2ErHm6sn6NhPRHmQX5Ht/XnINXEYosjA/09QCSyN0G0V8N8BlkicneUQnHrjlw=="],
+
+ "@uiw/codemirror-theme-kimbie": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-AWT1tyrtG4LA02kyMc0T34lnikn63dvDYb97Dd+HzYfKPMJ2JXUAbtfeHJpdqIpaPQ5M5kldKKiL4h4TpwN2eg=="],
+
+ "@uiw/codemirror-theme-material": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-IzmMs10z6PtaDifv1ZJr2UzN4z/VFibfeIG1EJXacoI3ChbqrEgn9WGFwZb8jP93fMsndKvrAIsa25BatcnMag=="],
+
+ "@uiw/codemirror-theme-monokai": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-nOhIc0zJPBJpdSoFt6VJd9JOxQFMyECWgGlyNTJCZEUZ90cuKPdJQ9HYhPljS0KeF9pAobnsBxF69eXaF+R7XA=="],
+
+ "@uiw/codemirror-theme-monokai-dimmed": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-+EYJ9i4B2q+fEvEw0mlmlR7Ij+0mJUszYtLmhwOdr/Xd6RV3V+I0gKLXnUdaiLKsvQlbh4vkyjtHp8DavQyPvA=="],
+
+ "@uiw/codemirror-theme-noctis-lilac": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-bu3ZxRmjsQH4JpKCt5epJBPB8TEk2brG8EerY4Tnitp5mFEHYOmGWzGzjbt7xCIwyWb4L5SS4kQkjJfpKxjUYg=="],
+
+ "@uiw/codemirror-theme-nord": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-VSR97OBk5F+2GovZOJ9iLFLRog/bcvd3F9hHOLQYD2TBq+m94lO0a2BJWE6l55QP73mM07Izdxbqtyuk1E3Vpg=="],
+
+ "@uiw/codemirror-theme-okaidia": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-IZKx7jPOxdIN0YIQjL7vlFfrlNbLHTDsbLTO8tPAwpxw9P8E9kBCDmq6YDR5qKn84NDcKwWevXVB5KIwZsPodQ=="],
+
+ "@uiw/codemirror-theme-quietlight": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-Ro5JjFbNjUdl2dFV/fQ3iQh4dHsbpPUxhLnOnnOKvy8X/Ozkr2ZR+xyFHniDf/rdJWO1/m/WDsQUXQHfXm5aBA=="],
+
+ "@uiw/codemirror-theme-red": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-1XdVQJQr+e4fi4G1ApuGiLA9CbNMQu1NCZkeLIbHQaQbE4byz8nxWeGkVd8vBX4Re7zihKeLygEEz29rEWtzAQ=="],
+
+ "@uiw/codemirror-theme-solarized": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-GyyAqYyhB5jibvlADblcNTMvnHitqA/Vr7o86tIEqzNCAlR4R6X4LhVkDkarfu8QKawrPydSnNa2iM5346wnYw=="],
+
+ "@uiw/codemirror-theme-sublime": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-r+RwH4Te7dO48ANqGkr4bYQ1gnGBck0a37d5FWJ2EygC87XeLnU2kHx3OnKYDohHfcRFkPkMzSZV1gL+aOhjqA=="],
+
+ "@uiw/codemirror-theme-tokyo-night": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-rLKWsrbW+rxufaHFstNIz26avlvSqsn+Oxmo7N9vAQARh9lojwAgZ0u16RTWsqgwdMHB6e4cg6PnHOJrA/ArDg=="],
+
+ "@uiw/codemirror-theme-tokyo-night-day": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-5GlD3cJVtG3rk/4kpjCwAxR0FygEYCX5e4xxAm4wMKSiH+eATaKOD8mG5lG6cWKzI1RgG4se1aCpMFeFr4F7bA=="],
+
+ "@uiw/codemirror-theme-tokyo-night-storm": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-Okg2d2XrmOyEyFRK+0l5pS3+8ASHQJ4jDFlbnQ75eAzB3HXYO9YfO4RWdayDBHzp/AfWA4RMFtHyhoKe2XKiQg=="],
+
+ "@uiw/codemirror-theme-tomorrow-night-blue": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-0dY5cGc6OhaJBap0fjLMdktjbI3IFZdSE3TCAJkuR7y7iUUZ76M6U11bb0pQkYcy5KOwEqUHHKWXFBxfVIH4Qw=="],
+
+ "@uiw/codemirror-theme-vscode": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-fTQ5676L9iV3Y6UyDBDd8Wt9Gewh55aC5rqnCtIpwyVFb6zJEHJScI4g43lzAD2IKhY7HlozB1ucrS3UqBFNEQ=="],
+
+ "@uiw/codemirror-theme-white": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-8tr6B3skKq3m9DEfJx3xyHi/zODGP4tSfRNULQAul0N2hlhvoRKchBoubX+tuQ2zD6HJW3yRUWL+j4c7CdWzRg=="],
+
+ "@uiw/codemirror-theme-xcode": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-themes": "4.25.11" } }, "sha512-aUttSVchR3yxqCqj1s2BSc6zF+1bKaHga1MXVbcCkMAz7KR41tt/9gIEOhSKlgKYsnSEkEUb9llzVB5SJMts6Q=="],
+
+ "@uiw/codemirror-themes": ["@uiw/[email protected]", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-SBNCOgRsCtewGNocRbmjbCkltGXlFcPJsvhxQ351VynQjnWUiPbUrFcEU/haQ3HanROdAAjWXZJPk5bMBxl2jw=="],
+
+ "@uiw/codemirror-themes-all": ["@uiw/[email protected]", "", { "dependencies": { "@uiw/codemirror-theme-abcdef": "4.25.11", "@uiw/codemirror-theme-abyss": "4.25.11", "@uiw/codemirror-theme-androidstudio": "4.25.11", "@uiw/codemirror-theme-andromeda": "4.25.11", "@uiw/codemirror-theme-atomone": "4.25.11", "@uiw/codemirror-theme-aura": "4.25.11", "@uiw/codemirror-theme-basic": "4.25.11", "@uiw/codemirror-theme-bbedit": "4.25.11", "@uiw/codemirror-theme-bespin": "4.25.11", "@uiw/codemirror-theme-console": "4.25.11", "@uiw/codemirror-theme-copilot": "4.25.11", "@uiw/codemirror-theme-darcula": "4.25.11", "@uiw/codemirror-theme-dracula": "4.25.11", "@uiw/codemirror-theme-duotone": "4.25.11", "@uiw/codemirror-theme-eclipse": "4.25.11", "@uiw/codemirror-theme-github": "4.25.11", "@uiw/codemirror-theme-gruvbox-dark": "4.25.11", "@uiw/codemirror-theme-kimbie": "4.25.11", "@uiw/codemirror-theme-material": "4.25.11", "@uiw/codemirror-theme-monokai": "4.25.11", "@uiw/codemirror-theme-monokai-dimmed": "4.25.11", "@uiw/codemirror-theme-noctis-lilac": "4.25.11", "@uiw/codemirror-theme-nord": "4.25.11", "@uiw/codemirror-theme-okaidia": "4.25.11", "@uiw/codemirror-theme-quietlight": "4.25.11", "@uiw/codemirror-theme-red": "4.25.11", "@uiw/codemirror-theme-solarized": "4.25.11", "@uiw/codemirror-theme-sublime": "4.25.11", "@uiw/codemirror-theme-tokyo-night": "4.25.11", "@uiw/codemirror-theme-tokyo-night-day": "4.25.11", "@uiw/codemirror-theme-tokyo-night-storm": "4.25.11", "@uiw/codemirror-theme-tomorrow-night-blue": "4.25.11", "@uiw/codemirror-theme-vscode": "4.25.11", "@uiw/codemirror-theme-white": "4.25.11", "@uiw/codemirror-theme-xcode": "4.25.11", "@uiw/codemirror-themes": "4.25.11" } }, "sha512-kkXaaKfJSVnyjGPFzjlENxCpQ58vJwcuxHIEmSaD9PhooeltTKpnM4tDmeXv2DEclD96booNIKW4cy70wZuLKw=="],
+
+ "@uiw/react-codemirror": ["@uiw/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.6", "@codemirror/commands": "^6.1.0", "@codemirror/state": "^6.1.1", "@codemirror/theme-one-dark": "^6.0.0", "@uiw/codemirror-extensions-basic-setup": "4.25.11", "codemirror": "^6.0.0" }, "peerDependencies": { "@codemirror/view": ">=6.0.0", "react": ">=17.0.0", "react-dom": ">=17.0.0" } }, "sha512-DYVFAKLX+F/4JS9N/7xexh+TICrlncwkX9HKKInrP1bwO0tSfc3k0GB6oawTYhelVKh20cX3TuRx+NJSkVXuMw=="],
+
"@ungap/structured-clone": ["@ungap/[email protected]", "", {}, "sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA=="],
"@upsetjs/venn.js": ["@upsetjs/[email protected]", "", { "optionalDependencies": { "d3-selection": "^3.0.0", "d3-transition": "^3.0.1" } }, "sha512-WbBhLrooyePuQ1VZxrJjtLvTc4NVfpOyKx0sKqioq9bX1C1m7Jgykkn8gLrtwumBioXIqam8DLxp88Adbue6Hw=="],
@@ -1739,6 +1860,8 @@
"cmdk": ["[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "^1.1.1", "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-id": "^1.1.0", "@radix-ui/react-primitive": "^2.0.2" }, "peerDependencies": { "react": "^18 || ^19 || ^19.0.0-rc", "react-dom": "^18 || ^19 || ^19.0.0-rc" } }, "sha512-Vsv7kFaXm+ptHDMZ7izaRsP70GgrW9NBNGswt9OZaVBLlE0SNpDq8eu/VGXyF9r7M0azK3Wy7OlYXsuyYLFzHg=="],
+ "codemirror": ["[email protected]", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw=="],
+
"collapse-white-space": ["[email protected]", "", {}, "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw=="],
"color": ["[email protected]", "", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="],
@@ -1793,6 +1916,8 @@
"cose-base": ["[email protected]", "", { "dependencies": { "layout-base": "^1.0.0" } }, "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg=="],
+ "crelt": ["[email protected]", "", {}, "sha512-aK6BbWfhf4U/wCcLHKPJl/xa6VkVstRaPywWtMKGwuOLc/wZTyQYuoxgvZnNsBvv7Kg3YTBQYYBCggcviQczuA=="],
+
"cross-dirname": ["[email protected]", "", {}, "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q=="],
"cross-fetch": ["[email protected]", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q=="],
@@ -3593,6 +3718,8 @@
"stubborn-utils": ["[email protected]", "", {}, "sha512-zOh9jPYI+xrNOyisSelgym4tolKTJCQd5GBhK0+0xJvcYDcwlOoxF/rnFKQ2KRZknXSG9jWAp66fwP6AxN9STg=="],
+ "style-mod": ["[email protected]", "", {}, "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ=="],
+
"style-to-js": ["[email protected]", "", { "dependencies": { "style-to-object": "1.0.14" } }, "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ=="],
"style-to-object": ["[email protected]", "", { "dependencies": { "inline-style-parser": "0.2.7" } }, "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw=="],
diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts
index 6baab70a..d443f01c 100644
--- a/packages/shared/src/i18n/en-US.ts
+++ b/packages/shared/src/i18n/en-US.ts
@@ -204,6 +204,8 @@ export const enUS = {
syncIntervals: { "30s": "Every 30 seconds", "5m": "Every 5 minutes", "15m": "Every 15 minutes", "30m": "Every 30 minutes", "1h": "Every hour", "2h": "Every 2 hours" },
mermaidThemeTitle: "Diagram theme",
mermaidThemeDescription: "Follow the app appearance or choose a fixed visual theme for diagrams.",
+ markdownThemeTitle: "Markdown source theme",
+ markdownThemeDescription: "Choose a syntax highlighting and color theme for Markdown source editing mode.",
editorThemeTitle: "Editor theme",
editorThemeDescription: "Choose a writing style for the note editor. Saved in this browser.",
editorContentAlignmentTitle: "Note content layout",
@@ -258,6 +260,25 @@ export const enUS = {
"solarized-dark": "Solarized Dark",
"one-dark": "One Dark",
},
+ markdownThemes: {
+ auto: "Follow app appearance",
+ "github-light": "GitHub Light",
+ "github-dark": "GitHub Dark",
+ "one-dark": "One Dark",
+ "tokyo-night": "Tokyo Night",
+ "tokyo-night-storm": "Tokyo Night Storm",
+ dracula: "Dracula",
+ nord: "Nord",
+ monokai: "Monokai",
+ "solarized-light": "Solarized Light",
+ "solarized-dark": "Solarized Dark",
+ "vscode-dark": "VS Code Dark",
+ "xcode-light": "Xcode Light",
+ sublime: "Sublime",
+ "duotone-light": "Duotone Light",
+ "duotone-dark": "Duotone Dark",
+ "gruvbox-dark": "Gruvbox Dark",
+ },
themeTitle: "Interface theme",
themeDescription: "Choose light, dark, or follow your system setting.",
themeSystem: "Follow system",
diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts
index c0e9f077..6dacbb76 100644
--- a/packages/shared/src/i18n/zh-CN.ts
+++ b/packages/shared/src/i18n/zh-CN.ts
@@ -204,6 +204,8 @@ export const zhCN = {
syncIntervals: { "30s": "每 30 秒", "5m": "每 5 分钟", "15m": "每 15 分钟", "30m": "每 30 分钟", "1h": "每 1 小时", "2h": "每 2 小时" },
mermaidThemeTitle: "图表主题",
mermaidThemeDescription: "跟随应用外观,或为笔记图表选择固定主题。",
+ markdownThemeTitle: "Markdown 源码主题",
+ markdownThemeDescription: "为 Markdown 源码编辑模式选择代码高亮与配色方案。",
editorThemeTitle: "编辑器主题",
editorThemeDescription: "选择正文编辑区的排版风格,偏好会保存在当前浏览器中。",
editorContentAlignmentTitle: "笔记正文布局",
@@ -258,6 +260,25 @@ export const zhCN = {
"solarized-dark": "Solarized 深色",
"one-dark": "One Dark",
},
+ markdownThemes: {
+ auto: "跟随应用外观",
+ "github-light": "GitHub 浅色",
+ "github-dark": "GitHub 深色",
+ "one-dark": "One Dark",
+ "tokyo-night": "Tokyo Night",
+ "tokyo-night-storm": "Tokyo Night Storm",
+ dracula: "Dracula",
+ nord: "Nord",
+ monokai: "Monokai",
+ "solarized-light": "Solarized 浅色",
+ "solarized-dark": "Solarized 深色",
+ "vscode-dark": "VS Code 深色",
+ "xcode-light": "Xcode 浅色",
+ sublime: "Sublime",
+ "duotone-light": "Duotone 浅色",
+ "duotone-dark": "Duotone 深色",
+ "gruvbox-dark": "Gruvbox 深色",
+ },
themeTitle: "界面主题",
themeDescription: "选择浅色、深色,或跟随系统设置。",
themeSystem: "跟随系统",