2026-03-11 22:14:20 +01:00
|
|
|
import type React from 'react'
|
2026-03-31 17:48:52 +02:00
|
|
|
import { useCallback, useRef, useEffect } from 'react'
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
import type { VaultEntry, NoteStatus } from '../types'
|
|
|
|
|
import type { useCreateBlockNote } from '@blocknote/react'
|
|
|
|
|
import { DiffView } from './DiffView'
|
|
|
|
|
import { BreadcrumbBar } from './BreadcrumbBar'
|
2026-03-16 04:46:28 +01:00
|
|
|
import { TitleField } from './TitleField'
|
2026-03-17 22:42:55 +01:00
|
|
|
import { NoteIcon } from './NoteIcon'
|
2026-03-03 01:37:25 +01:00
|
|
|
import { TrashedNoteBanner } from './TrashedNoteBanner'
|
2026-03-03 02:31:10 +01:00
|
|
|
import { ArchivedNoteBanner } from './ArchivedNoteBanner'
|
2026-03-19 09:51:06 +01:00
|
|
|
import { ConflictNoteBanner } from './ConflictNoteBanner'
|
2026-03-02 18:38:25 +01:00
|
|
|
import { RawEditorView } from './RawEditorView'
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
import { countWords } from '../utils/wikilinks'
|
|
|
|
|
import { SingleEditorView } from './SingleEditorView'
|
2026-03-17 22:42:55 +01:00
|
|
|
import { isEmoji } from '../utils/emoji'
|
2026-03-30 13:04:04 +02:00
|
|
|
import { useEditorTheme } from '../hooks/useTheme'
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
|
|
|
|
|
interface Tab {
|
|
|
|
|
entry: VaultEntry
|
|
|
|
|
content: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface EditorContentProps {
|
|
|
|
|
activeTab: Tab | null
|
|
|
|
|
isLoadingNewTab: boolean
|
|
|
|
|
entries: VaultEntry[]
|
|
|
|
|
editor: ReturnType<typeof useCreateBlockNote>
|
|
|
|
|
diffMode: boolean
|
|
|
|
|
diffContent: string | null
|
|
|
|
|
diffLoading: boolean
|
|
|
|
|
onToggleDiff: () => void
|
2026-03-02 18:38:25 +01:00
|
|
|
rawMode: boolean
|
|
|
|
|
onToggleRaw: () => void
|
|
|
|
|
onRawContentChange?: (path: string, content: string) => void
|
|
|
|
|
onSave?: () => void
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
activeStatus: NoteStatus
|
|
|
|
|
showDiffToggle: boolean
|
|
|
|
|
showAIChat?: boolean
|
|
|
|
|
onToggleAIChat?: () => void
|
|
|
|
|
inspectorCollapsed: boolean
|
|
|
|
|
onToggleInspector: () => void
|
|
|
|
|
onNavigateWikilink: (target: string) => void
|
|
|
|
|
onEditorChange?: () => void
|
2026-04-02 14:44:23 +02:00
|
|
|
onToggleFavorite?: (path: string) => void
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
onTrashNote?: (path: string) => void
|
|
|
|
|
onRestoreNote?: (path: string) => void
|
2026-03-03 01:37:25 +01:00
|
|
|
onDeleteNote?: (path: string) => void
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
onArchiveNote?: (path: string) => void
|
|
|
|
|
onUnarchiveNote?: (path: string) => void
|
2026-02-28 21:31:47 +01:00
|
|
|
vaultPath?: string
|
2026-03-11 22:14:20 +01:00
|
|
|
/** Ref updated by RawEditorView on every keystroke with the latest doc. */
|
|
|
|
|
rawLatestContentRef?: React.MutableRefObject<string | null>
|
2026-03-16 04:46:28 +01:00
|
|
|
/** Called when the user edits the dedicated title field. */
|
|
|
|
|
onTitleChange?: (path: string, newTitle: string) => void
|
2026-03-17 22:42:55 +01:00
|
|
|
/** Called when user sets or changes an emoji icon via the picker. */
|
|
|
|
|
onSetNoteIcon?: (path: string, emoji: string) => void
|
|
|
|
|
/** Called when user removes an emoji icon. */
|
|
|
|
|
onRemoveNoteIcon?: (path: string) => void
|
2026-03-19 09:51:06 +01:00
|
|
|
/** Whether the active note has a merge conflict. */
|
|
|
|
|
isConflicted?: boolean
|
|
|
|
|
/** Resolve conflict by keeping the local version. */
|
|
|
|
|
onKeepMine?: (path: string) => void
|
|
|
|
|
/** Resolve conflict by keeping the remote version. */
|
|
|
|
|
onKeepTheirs?: (path: string) => void
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function EditorLoadingSkeleton() {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex flex-1 flex-col gap-3 p-8 animate-pulse" style={{ minHeight: 0 }}>
|
|
|
|
|
<div className="h-6 w-2/5 rounded bg-muted" />
|
|
|
|
|
<div className="h-4 w-4/5 rounded bg-muted" />
|
|
|
|
|
<div className="h-4 w-3/5 rounded bg-muted" />
|
|
|
|
|
<div className="h-4 w-4/5 rounded bg-muted" />
|
|
|
|
|
<div className="h-4 w-2/5 rounded bg-muted" />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DiffModeView({ diffContent, onToggleDiff }: { diffContent: string | null; onToggleDiff: () => void }) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex-1 overflow-auto">
|
|
|
|
|
<button
|
|
|
|
|
className="flex items-center gap-1.5 px-4 py-2 text-xs text-primary bg-muted border-b border-border cursor-pointer hover:bg-accent transition-colors w-full border-t-0 border-l-0 border-r-0"
|
|
|
|
|
onClick={onToggleDiff}
|
|
|
|
|
title="Back to editor"
|
|
|
|
|
>
|
|
|
|
|
<span style={{ fontSize: 14, lineHeight: 1 }}>←</span>
|
|
|
|
|
Back to editor
|
|
|
|
|
</button>
|
|
|
|
|
<DiffView diff={diffContent ?? ''} />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-02 18:38:25 +01:00
|
|
|
function RawModeEditorSection({
|
2026-03-31 18:15:17 +02:00
|
|
|
rawMode, activeTab, entries, onContentChange, onSave, latestContentRef, vaultPath,
|
2026-03-02 18:38:25 +01:00
|
|
|
}: {
|
|
|
|
|
rawMode: boolean
|
|
|
|
|
activeTab: Tab | null
|
|
|
|
|
entries: VaultEntry[]
|
|
|
|
|
onContentChange?: (path: string, content: string) => void
|
|
|
|
|
onSave?: () => void
|
2026-03-11 22:14:20 +01:00
|
|
|
latestContentRef?: React.MutableRefObject<string | null>
|
2026-03-31 18:15:17 +02:00
|
|
|
vaultPath?: string
|
2026-03-02 18:38:25 +01:00
|
|
|
}) {
|
|
|
|
|
if (!rawMode || !activeTab) return null
|
|
|
|
|
return (
|
|
|
|
|
<RawEditorView
|
|
|
|
|
key={activeTab.entry.path}
|
|
|
|
|
content={activeTab.content}
|
|
|
|
|
path={activeTab.entry.path}
|
|
|
|
|
entries={entries}
|
|
|
|
|
onContentChange={onContentChange ?? (() => {})}
|
|
|
|
|
onSave={onSave ?? (() => {})}
|
2026-03-11 22:14:20 +01:00
|
|
|
latestContentRef={latestContentRef}
|
2026-03-31 18:15:17 +02:00
|
|
|
vaultPath={vaultPath}
|
2026-03-02 18:38:25 +01:00
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
/** Bind an optional callback to a path, returning undefined if callback is absent */
|
|
|
|
|
function bindPath(cb: ((path: string) => void) | undefined, path: string) {
|
|
|
|
|
return cb ? () => cb(path) : undefined
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 17:48:52 +02:00
|
|
|
function ActiveTabBreadcrumb({ activeTab, barRef, props }: {
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
activeTab: Tab
|
2026-03-31 17:48:52 +02:00
|
|
|
barRef: React.RefObject<HTMLDivElement | null>
|
2026-03-03 01:37:25 +01:00
|
|
|
props: Omit<EditorContentProps, 'activeTab' | 'isLoadingNewTab' | 'entries' | 'editor' | 'onNavigateWikilink' | 'onEditorChange' | 'onRawContentChange' | 'onSave' | 'onDeleteNote'>
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
}) {
|
|
|
|
|
const wordCount = countWords(activeTab.content)
|
|
|
|
|
const path = activeTab.entry.path
|
|
|
|
|
return (
|
|
|
|
|
<BreadcrumbBar
|
|
|
|
|
entry={activeTab.entry}
|
|
|
|
|
wordCount={wordCount}
|
2026-03-31 17:48:52 +02:00
|
|
|
barRef={barRef}
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
showDiffToggle={props.showDiffToggle}
|
|
|
|
|
diffMode={props.diffMode}
|
|
|
|
|
diffLoading={props.diffLoading}
|
|
|
|
|
onToggleDiff={props.onToggleDiff}
|
2026-03-02 18:38:25 +01:00
|
|
|
rawMode={props.rawMode}
|
|
|
|
|
onToggleRaw={props.onToggleRaw}
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
showAIChat={props.showAIChat}
|
|
|
|
|
onToggleAIChat={props.onToggleAIChat}
|
|
|
|
|
inspectorCollapsed={props.inspectorCollapsed}
|
|
|
|
|
onToggleInspector={props.onToggleInspector}
|
2026-04-02 14:44:23 +02:00
|
|
|
onToggleFavorite={bindPath(props.onToggleFavorite, path)}
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
onTrash={bindPath(props.onTrashNote, path)}
|
|
|
|
|
onRestore={bindPath(props.onRestoreNote, path)}
|
|
|
|
|
onArchive={bindPath(props.onArchiveNote, path)}
|
|
|
|
|
onUnarchive={bindPath(props.onUnarchiveNote, path)}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function EditorContent({
|
|
|
|
|
activeTab, isLoadingNewTab, entries, editor,
|
|
|
|
|
diffMode, diffContent, onToggleDiff,
|
2026-03-02 18:38:25 +01:00
|
|
|
rawMode, onToggleRaw, onRawContentChange, onSave,
|
refactor: remove theming system entirely
Remove all theme switching, creation, and management functionality
from the app — backend (Rust theme module, Tauri commands, menu items,
startup tasks, vault seeding), frontend (useThemeManager, ThemePropertyEditor,
themeSchema, command palette Appearance group, settings panel appearance
section, isDarkTheme prop chain), mock data, and all related tests.
Editor styling via theme.json/EditorTheme.css is preserved (not user theming).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:57:58 +01:00
|
|
|
onNavigateWikilink, onEditorChange, vaultPath,
|
2026-03-16 04:46:28 +01:00
|
|
|
onDeleteNote, rawLatestContentRef, onTitleChange,
|
2026-03-17 22:42:55 +01:00
|
|
|
onSetNoteIcon, onRemoveNoteIcon,
|
2026-03-19 09:51:06 +01:00
|
|
|
isConflicted, onKeepMine, onKeepTheirs,
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
...breadcrumbProps
|
|
|
|
|
}: EditorContentProps) {
|
2026-03-20 22:36:59 +01:00
|
|
|
// Look up trashed/archived from the latest vault entries, not the tab snapshot,
|
|
|
|
|
// so the banner appears regardless of navigation context.
|
2026-03-30 13:04:04 +02:00
|
|
|
const { cssVars } = useEditorTheme()
|
2026-03-20 22:36:59 +01:00
|
|
|
const freshEntry = activeTab ? entries.find(e => e.path === activeTab.entry.path) : undefined
|
|
|
|
|
const isTrashed = freshEntry?.trashed ?? activeTab?.entry.trashed ?? false
|
|
|
|
|
const isArchived = freshEntry?.archived ?? activeTab?.entry.archived ?? false
|
feat: show all files in folder view, open text files in raw editor, gray out binary
Vault scanner now includes all files (not just .md). Each VaultEntry has a
fileKind field ("markdown", "text", or "binary") that controls how the
frontend handles it:
- Folder view shows all file kinds; other views (All Notes, type sections)
continue to show only markdown files
- Text files (.yml, .json, .txt, .py, etc.) open in the raw CodeMirror editor
- Binary files (.png, .jpg, .pdf, etc.) appear grayed out and are not clickable
- Non-markdown files use filename as title, skip frontmatter parsing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:38:09 +02:00
|
|
|
// Non-markdown text files always use the raw editor (no BlockNote)
|
|
|
|
|
const isNonMarkdownText = activeTab?.entry.fileKind === 'text'
|
|
|
|
|
const effectiveRawMode = rawMode || isNonMarkdownText
|
|
|
|
|
const showEditor = !diffMode && !effectiveRawMode
|
2026-03-17 22:42:55 +01:00
|
|
|
const entryIcon = activeTab?.entry.icon ?? null
|
|
|
|
|
const emojiIcon = entryIcon && isEmoji(entryIcon) ? entryIcon : null
|
|
|
|
|
|
2026-03-31 10:42:38 +02:00
|
|
|
const titleSectionRef = useRef<HTMLDivElement | null>(null)
|
2026-03-31 17:48:52 +02:00
|
|
|
const breadcrumbBarRef = useRef<HTMLDivElement | null>(null)
|
2026-03-31 10:42:38 +02:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const el = titleSectionRef.current
|
2026-03-31 17:48:52 +02:00
|
|
|
const bar = breadcrumbBarRef.current
|
|
|
|
|
if (!el || !bar) return
|
2026-03-31 10:42:38 +02:00
|
|
|
const observer = new IntersectionObserver(
|
2026-03-31 17:48:52 +02:00
|
|
|
([e]) => {
|
|
|
|
|
if (e.isIntersecting) bar.removeAttribute('data-title-hidden')
|
|
|
|
|
else bar.setAttribute('data-title-hidden', '')
|
|
|
|
|
},
|
2026-03-31 10:42:38 +02:00
|
|
|
{ threshold: 0 },
|
|
|
|
|
)
|
|
|
|
|
observer.observe(el)
|
2026-03-31 17:48:52 +02:00
|
|
|
return () => { observer.disconnect(); bar.removeAttribute('data-title-hidden') }
|
2026-03-31 10:42:38 +02:00
|
|
|
}, [activeTab?.entry.path, showEditor])
|
|
|
|
|
|
2026-03-17 22:42:55 +01:00
|
|
|
const handleSetIcon = useCallback((emoji: string) => {
|
|
|
|
|
if (activeTab) onSetNoteIcon?.(activeTab.entry.path, emoji)
|
|
|
|
|
}, [activeTab, onSetNoteIcon])
|
|
|
|
|
|
|
|
|
|
const handleRemoveIcon = useCallback(() => {
|
|
|
|
|
if (activeTab) onRemoveNoteIcon?.(activeTab.entry.path)
|
|
|
|
|
}, [activeTab, onRemoveNoteIcon])
|
2026-03-02 18:38:25 +01:00
|
|
|
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
return (
|
|
|
|
|
<div className="flex flex-1 flex-col min-w-0 min-h-0">
|
2026-03-02 18:38:25 +01:00
|
|
|
{activeTab && (
|
|
|
|
|
<ActiveTabBreadcrumb
|
|
|
|
|
activeTab={activeTab}
|
2026-03-31 17:48:52 +02:00
|
|
|
barRef={breadcrumbBarRef}
|
feat: show all files in folder view, open text files in raw editor, gray out binary
Vault scanner now includes all files (not just .md). Each VaultEntry has a
fileKind field ("markdown", "text", or "binary") that controls how the
frontend handles it:
- Folder view shows all file kinds; other views (All Notes, type sections)
continue to show only markdown files
- Text files (.yml, .json, .txt, .py, etc.) open in the raw CodeMirror editor
- Binary files (.png, .jpg, .pdf, etc.) appear grayed out and are not clickable
- Non-markdown files use filename as title, skip frontmatter parsing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:38:09 +02:00
|
|
|
props={{ diffMode, diffContent, onToggleDiff, rawMode: effectiveRawMode, onToggleRaw, ...breadcrumbProps }}
|
2026-03-02 18:38:25 +01:00
|
|
|
/>
|
|
|
|
|
)}
|
2026-03-03 01:37:25 +01:00
|
|
|
{activeTab && isTrashed && (
|
|
|
|
|
<TrashedNoteBanner
|
|
|
|
|
onRestore={() => breadcrumbProps.onRestoreNote?.(activeTab.entry.path)}
|
|
|
|
|
onDeletePermanently={() => onDeleteNote?.(activeTab.entry.path)}
|
|
|
|
|
/>
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
)}
|
2026-03-20 22:36:59 +01:00
|
|
|
{activeTab && isArchived && breadcrumbProps.onUnarchiveNote && (
|
2026-03-03 02:31:10 +01:00
|
|
|
<ArchivedNoteBanner onUnarchive={() => breadcrumbProps.onUnarchiveNote!(activeTab.entry.path)} />
|
|
|
|
|
)}
|
2026-03-19 09:51:06 +01:00
|
|
|
{activeTab && isConflicted && (
|
|
|
|
|
<ConflictNoteBanner
|
|
|
|
|
onKeepMine={() => onKeepMine?.(activeTab.entry.path)}
|
|
|
|
|
onKeepTheirs={() => onKeepTheirs?.(activeTab.entry.path)}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2026-03-18 21:32:03 +01:00
|
|
|
{diffMode && <DiffModeView diffContent={diffContent} onToggleDiff={onToggleDiff} />}
|
feat: show all files in folder view, open text files in raw editor, gray out binary
Vault scanner now includes all files (not just .md). Each VaultEntry has a
fileKind field ("markdown", "text", or "binary") that controls how the
frontend handles it:
- Folder view shows all file kinds; other views (All Notes, type sections)
continue to show only markdown files
- Text files (.yml, .json, .txt, .py, etc.) open in the raw CodeMirror editor
- Binary files (.png, .jpg, .pdf, etc.) appear grayed out and are not clickable
- Non-markdown files use filename as title, skip frontmatter parsing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:38:09 +02:00
|
|
|
<RawModeEditorSection rawMode={effectiveRawMode} activeTab={activeTab} entries={entries} onContentChange={onRawContentChange} onSave={onSave} latestContentRef={rawLatestContentRef} vaultPath={vaultPath} />
|
2026-03-18 21:32:03 +01:00
|
|
|
{showEditor && activeTab && (
|
2026-03-30 13:04:04 +02:00
|
|
|
<div className="editor-scroll-area" style={cssVars as React.CSSProperties}>
|
2026-03-31 10:42:38 +02:00
|
|
|
<div ref={titleSectionRef} className="title-section">
|
2026-03-30 15:16:55 +02:00
|
|
|
{!emojiIcon && (
|
|
|
|
|
<div className="title-section__add-icon">
|
|
|
|
|
<NoteIcon
|
|
|
|
|
icon={null}
|
|
|
|
|
editable={!isTrashed}
|
|
|
|
|
onSetIcon={handleSetIcon}
|
|
|
|
|
onRemoveIcon={handleRemoveIcon}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-30 15:35:43 +02:00
|
|
|
<div className={`title-section__row${emojiIcon ? '' : ' title-section__row--no-icon'}`}>
|
2026-03-30 15:16:55 +02:00
|
|
|
{emojiIcon && (
|
|
|
|
|
<NoteIcon
|
|
|
|
|
icon={emojiIcon}
|
|
|
|
|
editable={!isTrashed}
|
|
|
|
|
onSetIcon={handleSetIcon}
|
|
|
|
|
onRemoveIcon={handleRemoveIcon}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2026-03-29 14:31:35 +02:00
|
|
|
<TitleField
|
|
|
|
|
title={activeTab.entry.title}
|
|
|
|
|
filename={activeTab.entry.filename}
|
|
|
|
|
editable={!isTrashed}
|
2026-04-02 14:44:23 +02:00
|
|
|
notePath={activeTab.entry.path}
|
|
|
|
|
vaultPath={vaultPath}
|
2026-03-29 14:31:35 +02:00
|
|
|
onTitleChange={(newTitle) => onTitleChange?.(activeTab.entry.path, newTitle)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-03-18 21:32:03 +01:00
|
|
|
<div className="title-section__separator" />
|
|
|
|
|
</div>
|
refactor: remove theming system entirely
Remove all theme switching, creation, and management functionality
from the app — backend (Rust theme module, Tauri commands, menu items,
startup tasks, vault seeding), frontend (useThemeManager, ThemePropertyEditor,
themeSchema, command palette Appearance group, settings panel appearance
section, isDarkTheme prop chain), mock data, and all related tests.
Editor styling via theme.json/EditorTheme.css is preserved (not user theming).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:57:58 +01:00
|
|
|
<SingleEditorView editor={editor} entries={entries} onNavigateWikilink={onNavigateWikilink} onChange={onEditorChange} vaultPath={vaultPath} editable={!isTrashed} />
|
2026-03-18 21:32:03 +01:00
|
|
|
</div>
|
2026-03-16 04:46:28 +01:00
|
|
|
)}
|
2026-03-18 21:32:03 +01:00
|
|
|
{isLoadingNewTab && showEditor && <EditorLoadingSkeleton />}
|
refactor: decompose Editor.tsx, NoteList.tsx, Sidebar.tsx — CodeScene hotspots (#126)
* refactor: decompose Editor.tsx into focused subcomponents and hooks
Extract from the monolithic Editor component (cc=35, 213 LoC, score 7.82):
- useDiffMode hook: diff state + toggle/commit-diff handlers
- useEditorFocus hook: new-note focus event listener
- editorSchema: WikiLink spec + BlockNote schema (module-level)
- SingleEditorView: BlockNote editor + suggestion menus
- EditorContent: breadcrumb bar + diff/editor/loading views
- EditorRightPanel: AI chat / Inspector panel switching
- suggestionEnrichment util: shared enrichment logic (eliminates duplication)
Editor.tsx is now 10.0 code health (was 7.82). All 25 existing tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: extract standalone functions from NoteList and Sidebar to reduce cc
NoteList: extract createNoteStatusResolver and toggleSetMember from
NoteListInner (cc 13→8, score 9.04→9.38).
Sidebar: extract applyCustomization from Sidebar (cc 10→7, score 9.09→10.0).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add tests for useDiffMode, useEditorFocus, and suggestionEnrichment
Cover extracted hook/utility logic: diff toggle/reset, editor focus event
listener with adaptive timing, and suggestion item enrichment pipeline.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update architecture for editor decomposition and write .claude-done
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-27 15:27:25 +01:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|