diff --git a/src/components/DiffView.tsx b/src/components/DiffView.tsx
new file mode 100644
index 00000000..e8aff793
--- /dev/null
+++ b/src/components/DiffView.tsx
@@ -0,0 +1,45 @@
+import { cn } from '@/lib/utils'
+
+interface DiffViewProps {
+ diff: string
+}
+
+export function DiffView({ diff }: DiffViewProps) {
+ if (!diff) {
+ return (
+
+ No changes to display
+
+ )
+ }
+
+ const lines = diff.split('\n')
+
+ return (
+
+ {lines.map((line, i) => {
+ let lineClass = 'text-secondary-foreground'
+ if (line.startsWith('+') && !line.startsWith('+++')) {
+ lineClass = 'bg-[rgba(76,175,80,0.12)] text-[#4caf50]'
+ } else if (line.startsWith('-') && !line.startsWith('---')) {
+ lineClass = 'bg-[rgba(244,67,54,0.12)] text-[#f44336]'
+ } else if (line.startsWith('@@')) {
+ lineClass = 'bg-[rgba(33,150,243,0.08)] text-primary italic'
+ } else if (line.startsWith('diff') || line.startsWith('index') || line.startsWith('---') || line.startsWith('+++') || line.startsWith('new file')) {
+ lineClass = 'bg-muted text-muted-foreground font-semibold'
+ }
+
+ return (
+
+
+ {i + 1}
+
+
+ {line || '\u00A0'}
+
+
+ )
+ })}
+
+ )
+}
diff --git a/src/components/Editor.tsx b/src/components/Editor.tsx
index f08cbe91..f2e83fe0 100644
--- a/src/components/Editor.tsx
+++ b/src/components/Editor.tsx
@@ -6,6 +6,7 @@ import { BlockNoteView } from '@blocknote/mantine'
import '@blocknote/mantine/style.css'
import type { VaultEntry, GitCommit } from '../types'
import { Inspector, type FrontmatterValue } from './Inspector'
+import { DiffView } from './DiffView'
import { ResizeHandle } from './ResizeHandle'
import { useEditorTheme } from '../hooks/useTheme'
import { cn } from '@/lib/utils'
@@ -145,45 +146,7 @@ function expandWikilinksInContent(content: any[]): any[] {
return result
}
-function DiffView({ diff }: { diff: string }) {
- if (!diff) {
- return (
-
- No changes to display
-
- )
- }
-
- const lines = diff.split('\n')
-
- return (
-
- {lines.map((line, i) => {
- let lineClass = 'text-secondary-foreground'
- if (line.startsWith('+') && !line.startsWith('+++')) {
- lineClass = 'bg-[rgba(76,175,80,0.12)] text-[#4caf50]'
- } else if (line.startsWith('-') && !line.startsWith('---')) {
- lineClass = 'bg-[rgba(244,67,54,0.12)] text-[#f44336]'
- } else if (line.startsWith('@@')) {
- lineClass = 'bg-[rgba(33,150,243,0.08)] text-primary italic'
- } else if (line.startsWith('diff') || line.startsWith('index') || line.startsWith('---') || line.startsWith('+++') || line.startsWith('new file')) {
- lineClass = 'bg-muted text-muted-foreground font-semibold'
- }
-
- return (
-
-
- {i + 1}
-
-
- {line || '\u00A0'}
-
-
- )
- })}
-
- )
-}
+// DiffView extracted to ./DiffView.tsx
/** Inner component that creates/manages BlockNote for a single tab */
function BlockNoteTab({ content, entries, onNavigateWikilink }: { content: string; entries: VaultEntry[]; onNavigateWikilink: (target: string) => void }) {