diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-complete.png b/.playwright-mcp/.playwright-mcp/dark-mode-complete.png new file mode 100644 index 0000000..2a48cd2 Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-complete.png differ diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-editor-fix.png b/.playwright-mcp/.playwright-mcp/dark-mode-editor-fix.png new file mode 100644 index 0000000..37c9915 Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-editor-fix.png differ diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-final.png b/.playwright-mcp/.playwright-mcp/dark-mode-final.png new file mode 100644 index 0000000..37c9915 Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-final.png differ diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-preview-update.png b/.playwright-mcp/.playwright-mcp/dark-mode-preview-update.png new file mode 100644 index 0000000..989a81d Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-preview-update.png differ diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-text-fix.png b/.playwright-mcp/.playwright-mcp/dark-mode-text-fix.png new file mode 100644 index 0000000..40118ff Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-text-fix.png differ diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-white-text.png b/.playwright-mcp/.playwright-mcp/dark-mode-white-text.png new file mode 100644 index 0000000..6212885 Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-white-text.png differ diff --git a/.playwright-mcp/.playwright-mcp/dark-mode-with-preview.png b/.playwright-mcp/.playwright-mcp/dark-mode-with-preview.png new file mode 100644 index 0000000..16c7c1f Binary files /dev/null and b/.playwright-mcp/.playwright-mcp/dark-mode-with-preview.png differ diff --git a/.playwright-mcp/compose-darkmode-preview.png b/.playwright-mcp/compose-darkmode-preview.png new file mode 100644 index 0000000..1919b44 Binary files /dev/null and b/.playwright-mcp/compose-darkmode-preview.png differ diff --git a/.playwright-mcp/dark-mode-full-preview.png b/.playwright-mcp/dark-mode-full-preview.png new file mode 100644 index 0000000..05191e5 Binary files /dev/null and b/.playwright-mcp/dark-mode-full-preview.png differ diff --git a/.playwright-mcp/dark-mode-preview-after.png b/.playwright-mcp/dark-mode-preview-after.png new file mode 100644 index 0000000..83b4639 Binary files /dev/null and b/.playwright-mcp/dark-mode-preview-after.png differ diff --git a/.playwright-mcp/preview-area.png b/.playwright-mcp/preview-area.png new file mode 100644 index 0000000..25d4414 Binary files /dev/null and b/.playwright-mcp/preview-area.png differ diff --git a/src/lib/components/ZettelEditor.svelte b/src/lib/components/ZettelEditor.svelte index 869030f..7ce2b3c 100644 --- a/src/lib/components/ZettelEditor.svelte +++ b/src/lib/components/ZettelEditor.svelte @@ -61,6 +61,9 @@ let generatedEvents = $state(null); let contentType = $state<"article" | "scattered-notes" | "none">("none"); + // Dark mode state + let isDarkMode = $state(false); + // Note: updateEditorContent() is only called manually when needed // The automatic effect was causing feedback loops with user typing @@ -786,6 +789,36 @@ outline: "none", }, }), + // Override background and text to match preview (gray-800 bg, gray-100 text) + ...(isDarkMode ? [EditorView.theme({ + "&": { + backgroundColor: "#1f2937", + color: "#f3f4f6", + }, + ".cm-content": { + color: "#f3f4f6", + }, + ".cm-line": { + color: "#f3f4f6", + }, + ".cm-gutters": { + backgroundColor: "#1f2937", + borderColor: "#374151", + color: "#9ca3af", + }, + ".cm-activeLineGutter": { + backgroundColor: "#374151", + }, + ".cm-cursor": { + borderLeftColor: "#f3f4f6", + }, + ".cm-selectionBackground, ::selection": { + backgroundColor: "#374151 !important", + }, + "&.cm-focused .cm-selectionBackground, &.cm-focused ::selection": { + backgroundColor: "#4b5563 !important", + }, + }, { dark: true })] : []), ], }); @@ -813,9 +846,41 @@ // Mount CodeMirror when component mounts onMount(() => { + // Initialize dark mode state + isDarkMode = document.documentElement.classList.contains('dark'); createEditor(); + // Watch for dark mode changes + const observer = new MutationObserver(() => { + const newDarkMode = document.documentElement.classList.contains('dark'); + if (newDarkMode !== isDarkMode) { + isDarkMode = newDarkMode; + // Recreate editor with new theme + if (editorView) { + const currentContent = editorView.state.doc.toString(); + editorView.destroy(); + createEditor(); + // Restore content + if (editorView && currentContent !== content) { + editorView.dispatch({ + changes: { + from: 0, + to: editorView.state.doc.length, + insert: currentContent, + }, + }); + } + } + } + }); + + observer.observe(document.documentElement, { + attributes: true, + attributeFilter: ['class'], + }); + return () => { + observer.disconnect(); if (editorView) { editorView.destroy(); } @@ -951,7 +1016,7 @@ : 'w-full'} flex flex-col" >
@@ -977,7 +1042,7 @@
-
+
{#if !content.trim()}
{#each tTags as tag} #{tag[1]} @@ -1101,7 +1166,7 @@
{#each tTags as tag} #{tag[1]} @@ -1230,7 +1295,7 @@
Event Boundary @@ -1242,7 +1307,7 @@
Event Count: {#if generatedEvents}