Add editor theme extension based on theme in App.tsx

This commit is contained in:
2026-03-12 15:58:51 +01:00
parent 41393e59bb
commit 7bbdab340c

View File

@@ -381,6 +381,29 @@ export default function App() {
const trimmed = ollamaUrl.trim();
return (trimmed || DEFAULT_OLLAMA_URL).replace(/\/+$/, "");
}, [ollamaUrl]);
const editorThemeExtension = useMemo(
() =>
EditorView.theme(
{
".cm-content, .cm-scroller": {
caretColor: theme === "dark" ? "#f5f5f5" : "#1f1f1f"
},
"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor": {
borderLeftColor: theme === "dark" ? "#f5f5f5" : "#1f1f1f",
borderLeftWidth: "1.6px"
},
".cm-dropCursor": {
borderLeftColor: theme === "dark" ? "#f5f5f5" : "#1f1f1f",
borderLeftWidth: "1.6px"
},
".cm-fatCursor": {
background: theme === "dark" ? "rgba(245, 245, 245, 0.45)" : "rgba(31, 31, 31, 0.28)"
}
},
{ dark: theme === "dark" }
),
[theme]
);
const folderById = useMemo(() => {
const map = new Map<string, Folder>();