2026-03-08 22:15:08 +01:00
|
|
|
import { useRef, useEffect, useCallback, memo } from 'react'
|
2026-03-18 15:42:48 +01:00
|
|
|
import { useEditorTabSwap } from '../hooks/useEditorTabSwap'
|
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 { useCreateBlockNote } from '@blocknote/react'
|
2026-02-15 19:14:55 +01:00
|
|
|
import '@blocknote/mantine/style.css'
|
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 { uploadImageFile } from '../hooks/useImageDrop'
|
2026-02-24 15:54:24 +01:00
|
|
|
import type { VaultEntry, GitCommit, NoteStatus } from '../types'
|
2026-03-04 19:53:46 +01:00
|
|
|
import type { NoteListItem } from '../utils/ai-context'
|
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 { FrontmatterValue } from './Inspector'
|
2026-02-17 11:03:23 +01:00
|
|
|
import { ResizeHandle } from './ResizeHandle'
|
2026-02-20 19:57:03 +01:00
|
|
|
import { TabBar } from './TabBar'
|
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 { useDiffMode } from '../hooks/useDiffMode'
|
2026-03-02 18:38:25 +01:00
|
|
|
import { useRawMode } from '../hooks/useRawMode'
|
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 { useEditorFocus } from '../hooks/useEditorFocus'
|
|
|
|
|
import { EditorRightPanel } from './EditorRightPanel'
|
|
|
|
|
import { EditorContent } from './EditorContent'
|
|
|
|
|
import { schema } from './editorSchema'
|
2026-02-14 18:22:42 +01:00
|
|
|
import './Editor.css'
|
2026-02-16 08:04:06 +01:00
|
|
|
import './EditorTheme.css'
|
2026-02-14 18:22:42 +01:00
|
|
|
|
2026-02-14 20:15:44 +01:00
|
|
|
interface Tab {
|
|
|
|
|
entry: VaultEntry
|
2026-02-14 20:07:23 +01:00
|
|
|
content: string
|
2026-02-14 20:15:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface EditorProps {
|
|
|
|
|
tabs: Tab[]
|
|
|
|
|
activeTabPath: string | null
|
2026-02-15 19:50:23 +01:00
|
|
|
entries: VaultEntry[]
|
2026-02-14 20:15:44 +01:00
|
|
|
onSwitchTab: (path: string) => void
|
|
|
|
|
onCloseTab: (path: string) => void
|
2026-02-21 17:24:01 +01:00
|
|
|
onReorderTabs?: (fromIndex: number, toIndex: number) => void
|
2026-02-14 20:30:45 +01:00
|
|
|
onNavigateWikilink: (target: string) => void
|
2026-02-15 12:58:00 +01:00
|
|
|
onLoadDiff?: (path: string) => Promise<string>
|
2026-02-21 22:27:18 +01:00
|
|
|
onLoadDiffAtCommit?: (path: string, commitHash: string) => Promise<string>
|
2026-02-24 15:54:24 +01:00
|
|
|
getNoteStatus?: (path: string) => NoteStatus
|
2026-02-17 11:03:23 +01:00
|
|
|
onCreateNote?: () => void
|
|
|
|
|
inspectorCollapsed: boolean
|
|
|
|
|
onToggleInspector: () => void
|
|
|
|
|
inspectorWidth: number
|
|
|
|
|
onInspectorResize: (delta: number) => void
|
|
|
|
|
inspectorEntry: VaultEntry | null
|
|
|
|
|
inspectorContent: string | null
|
|
|
|
|
gitHistory: GitCommit[]
|
|
|
|
|
onUpdateFrontmatter?: (path: string, key: string, value: FrontmatterValue) => Promise<void>
|
|
|
|
|
onDeleteProperty?: (path: string, key: string) => Promise<void>
|
|
|
|
|
onAddProperty?: (path: string, key: string, value: FrontmatterValue) => Promise<void>
|
2026-03-11 21:24:57 +01:00
|
|
|
onCreateAndOpenNote?: (title: string) => Promise<boolean>
|
2026-02-20 16:06:51 +01:00
|
|
|
showAIChat?: boolean
|
|
|
|
|
onToggleAIChat?: () => void
|
2026-02-21 10:07:02 +01:00
|
|
|
vaultPath?: string
|
2026-03-04 19:53:46 +01:00
|
|
|
noteList?: NoteListItem[]
|
|
|
|
|
noteListFilter?: { type: string | null; query: string }
|
2026-02-21 17:37:15 +01:00
|
|
|
onTrashNote?: (path: string) => void
|
|
|
|
|
onRestoreNote?: (path: string) => void
|
2026-03-03 01:37:25 +01:00
|
|
|
onDeleteNote?: (path: string) => void
|
2026-02-21 18:45:25 +01:00
|
|
|
onArchiveNote?: (path: string) => void
|
|
|
|
|
onUnarchiveNote?: (path: string) => void
|
2026-02-21 19:22:44 +01:00
|
|
|
onRenameTab?: (path: string, newTitle: string) => void
|
2026-02-23 14:48:21 +01:00
|
|
|
onContentChange?: (path: string, content: string) => void
|
2026-03-02 18:38:25 +01:00
|
|
|
onSave?: () => void
|
2026-03-18 15:42:48 +01:00
|
|
|
/** Called when the user edits the title in TitleField. */
|
2026-02-28 10:57:30 +01:00
|
|
|
onTitleSync?: (path: string, newTitle: string) => void
|
2026-02-25 19:39:12 +01:00
|
|
|
canGoBack?: boolean
|
|
|
|
|
canGoForward?: boolean
|
|
|
|
|
onGoBack?: () => void
|
|
|
|
|
onGoForward?: () => void
|
2026-02-28 20:19:03 +01:00
|
|
|
leftPanelsCollapsed?: boolean
|
2026-03-02 11:53:31 +01:00
|
|
|
isDarkTheme?: boolean
|
2026-03-02 18:38:25 +01:00
|
|
|
/** Mutable ref that Editor registers its raw-mode toggle into, for command palette access. */
|
|
|
|
|
rawToggleRef?: React.MutableRefObject<() => void>
|
2026-03-03 02:00:48 +01:00
|
|
|
/** Mutable ref that Editor registers its diff-mode toggle into, for command palette access. */
|
|
|
|
|
diffToggleRef?: React.MutableRefObject<() => void>
|
2026-03-05 12:12:12 +01:00
|
|
|
onFileCreated?: (relativePath: string) => void
|
|
|
|
|
onFileModified?: (relativePath: string) => void
|
2026-03-07 14:19:41 +01:00
|
|
|
onVaultChanged?: () => void
|
2026-03-17 22:42:55 +01:00
|
|
|
/** Called when user sets an emoji icon on a note. */
|
|
|
|
|
onSetNoteIcon?: (path: string, emoji: string) => void
|
|
|
|
|
/** Called when user removes an emoji icon from a note. */
|
|
|
|
|
onRemoveNoteIcon?: (path: string) => void
|
2026-03-02 18:38:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function useEditorModeExclusion({
|
2026-03-03 02:00:48 +01:00
|
|
|
diffMode, rawMode, handleToggleDiff, handleToggleRaw, rawToggleRef, diffToggleRef,
|
2026-03-02 18:38:25 +01:00
|
|
|
}: {
|
|
|
|
|
diffMode: boolean
|
|
|
|
|
rawMode: boolean
|
|
|
|
|
handleToggleDiff: () => void | Promise<void>
|
|
|
|
|
handleToggleRaw: () => void
|
|
|
|
|
rawToggleRef?: React.MutableRefObject<() => void>
|
2026-03-03 02:00:48 +01:00
|
|
|
diffToggleRef?: React.MutableRefObject<() => void>
|
2026-03-02 18:38:25 +01:00
|
|
|
}) {
|
|
|
|
|
const handleToggleDiffExclusive = useCallback(async () => {
|
|
|
|
|
if (!diffMode && rawMode) handleToggleRaw()
|
|
|
|
|
await handleToggleDiff()
|
|
|
|
|
}, [diffMode, rawMode, handleToggleDiff, handleToggleRaw])
|
|
|
|
|
|
|
|
|
|
const handleToggleRawExclusive = useCallback(() => {
|
|
|
|
|
if (!rawMode && diffMode) handleToggleDiff()
|
|
|
|
|
handleToggleRaw()
|
|
|
|
|
}, [rawMode, diffMode, handleToggleDiff, handleToggleRaw])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (rawToggleRef) rawToggleRef.current = handleToggleRawExclusive
|
|
|
|
|
}, [rawToggleRef, handleToggleRawExclusive])
|
|
|
|
|
|
2026-03-03 02:00:48 +01:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (diffToggleRef) diffToggleRef.current = handleToggleDiffExclusive
|
|
|
|
|
}, [diffToggleRef, handleToggleDiffExclusive])
|
|
|
|
|
|
2026-03-02 18:38:25 +01:00
|
|
|
return { handleToggleDiffExclusive, handleToggleRawExclusive }
|
2026-02-14 20:07:23 +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
|
|
|
function EditorEmptyState() {
|
2026-02-15 19:14:55 +01:00
|
|
|
return (
|
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 className="flex flex-1 flex-col items-center justify-center gap-2 text-center text-muted-foreground">
|
|
|
|
|
<p className="m-0 text-[15px]">Select a note to start editing</p>
|
|
|
|
|
<span className="text-xs text-muted-foreground">Cmd+P to search · Cmd+N to create</span>
|
2026-02-15 19:14:55 +01:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 12:07:33 +01:00
|
|
|
interface EditorSetupParams {
|
|
|
|
|
tabs: Tab[]
|
|
|
|
|
activeTabPath: string | null
|
|
|
|
|
vaultPath?: string
|
|
|
|
|
onContentChange?: (path: string, content: string) => void
|
|
|
|
|
onLoadDiff?: (path: string) => Promise<string>
|
|
|
|
|
onLoadDiffAtCommit?: (path: string, commitHash: string) => Promise<string>
|
|
|
|
|
getNoteStatus?: (path: string) => NoteStatus
|
|
|
|
|
rawToggleRef?: React.MutableRefObject<() => void>
|
|
|
|
|
diffToggleRef?: React.MutableRefObject<() => void>
|
|
|
|
|
}
|
2026-02-28 10:57:30 +01:00
|
|
|
|
2026-03-17 12:07:33 +01:00
|
|
|
function useRawModeWithFlush(
|
|
|
|
|
activeTabPath: string | null,
|
|
|
|
|
onContentChange?: (path: string, content: string) => void,
|
|
|
|
|
) {
|
2026-03-11 22:14:20 +01:00
|
|
|
const rawLatestContentRef = useRef<string | null>(null)
|
|
|
|
|
|
|
|
|
|
const handleBeforeRawEnd = useCallback(() => {
|
|
|
|
|
if (rawLatestContentRef.current != null && activeTabPath) {
|
|
|
|
|
onContentChange?.(activeTabPath, rawLatestContentRef.current)
|
|
|
|
|
}
|
|
|
|
|
rawLatestContentRef.current = null
|
|
|
|
|
}, [activeTabPath, onContentChange])
|
|
|
|
|
|
|
|
|
|
const { rawMode, handleToggleRaw } = useRawMode({
|
|
|
|
|
activeTabPath, onBeforeRawEnd: handleBeforeRawEnd,
|
|
|
|
|
})
|
|
|
|
|
|
2026-03-17 11:41:35 +01:00
|
|
|
// Flush raw editor content when switching tabs while raw mode stays active.
|
|
|
|
|
const prevTabPathRef = useRef(activeTabPath)
|
|
|
|
|
const onContentChangeRef = useRef(onContentChange)
|
|
|
|
|
useEffect(() => { onContentChangeRef.current = onContentChange }, [onContentChange])
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const prev = prevTabPathRef.current
|
|
|
|
|
prevTabPathRef.current = activeTabPath
|
2026-03-17 12:07:33 +01:00
|
|
|
const hasUnflushedContent = prev && prev !== activeTabPath && rawMode && rawLatestContentRef.current != null
|
|
|
|
|
if (hasUnflushedContent) {
|
|
|
|
|
onContentChangeRef.current?.(prev, rawLatestContentRef.current!)
|
2026-03-17 11:41:35 +01:00
|
|
|
rawLatestContentRef.current = null
|
|
|
|
|
}
|
|
|
|
|
}, [activeTabPath, rawMode])
|
|
|
|
|
|
2026-03-17 12:07:33 +01:00
|
|
|
return { rawMode, handleToggleRaw, rawLatestContentRef }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function useEditorSetup({
|
2026-03-18 15:42:48 +01:00
|
|
|
tabs, activeTabPath, vaultPath, onContentChange,
|
|
|
|
|
onLoadDiff, onLoadDiffAtCommit, getNoteStatus,
|
2026-03-17 12:07:33 +01:00
|
|
|
rawToggleRef, diffToggleRef,
|
|
|
|
|
}: EditorSetupParams) {
|
|
|
|
|
const vaultPathRef = useRef(vaultPath)
|
|
|
|
|
useEffect(() => { vaultPathRef.current = vaultPath }, [vaultPath])
|
|
|
|
|
|
|
|
|
|
const editor = useCreateBlockNote({
|
|
|
|
|
schema,
|
|
|
|
|
uploadFile: (file: File) => uploadImageFile(file, vaultPathRef.current),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const activeTab = tabs.find((t) => t.entry.path === activeTabPath) ?? null
|
|
|
|
|
|
|
|
|
|
const { rawMode, handleToggleRaw, rawLatestContentRef } = useRawModeWithFlush(
|
|
|
|
|
activeTabPath, onContentChange,
|
|
|
|
|
)
|
|
|
|
|
|
2026-02-28 10:57:30 +01:00
|
|
|
const { handleEditorChange, editorMountedRef } = useEditorTabSwap({
|
2026-03-18 15:42:48 +01:00
|
|
|
tabs, activeTabPath, editor, onContentChange, rawMode,
|
2026-02-28 10:57:30 +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
|
|
|
useEditorFocus(editor, editorMountedRef)
|
2026-02-17 17:38:57 +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
|
|
|
const { diffMode, diffContent, diffLoading, handleToggleDiff, handleViewCommitDiff } = useDiffMode({
|
|
|
|
|
activeTabPath, onLoadDiff, onLoadDiffAtCommit,
|
|
|
|
|
})
|
2026-03-02 18:38:25 +01:00
|
|
|
|
|
|
|
|
const { handleToggleDiffExclusive, handleToggleRawExclusive } = useEditorModeExclusion({
|
2026-03-03 02:00:48 +01:00
|
|
|
diffMode, rawMode, handleToggleDiff, handleToggleRaw, rawToggleRef, diffToggleRef,
|
2026-03-02 18:38:25 +01:00
|
|
|
})
|
|
|
|
|
|
2026-02-17 17:32:57 +01:00
|
|
|
const isLoadingNewTab = activeTabPath !== null && !activeTab
|
2026-02-24 15:54:24 +01:00
|
|
|
const activeStatus = activeTab ? getNoteStatus?.(activeTab.entry.path) ?? 'clean' : 'clean'
|
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 showDiffToggle = !!(activeTab && (diffMode || activeStatus === 'modified'))
|
2026-02-17 11:03:23 +01:00
|
|
|
|
2026-03-17 12:07:33 +01:00
|
|
|
return {
|
|
|
|
|
editor, activeTab, rawLatestContentRef,
|
|
|
|
|
rawMode, diffMode, diffContent, diffLoading,
|
|
|
|
|
handleToggleDiffExclusive, handleToggleRawExclusive,
|
2026-03-18 15:42:48 +01:00
|
|
|
handleEditorChange, handleViewCommitDiff,
|
2026-03-17 12:07:33 +01:00
|
|
|
isLoadingNewTab, activeStatus, showDiffToggle,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const Editor = memo(function Editor(props: EditorProps) {
|
|
|
|
|
const {
|
|
|
|
|
tabs, activeTabPath, entries, onSwitchTab, onCloseTab, onReorderTabs, onNavigateWikilink,
|
|
|
|
|
getNoteStatus, onCreateNote,
|
|
|
|
|
inspectorCollapsed, onToggleInspector, inspectorWidth, onInspectorResize,
|
|
|
|
|
inspectorEntry, inspectorContent, gitHistory,
|
|
|
|
|
onUpdateFrontmatter, onDeleteProperty, onAddProperty, onCreateAndOpenNote,
|
|
|
|
|
showAIChat, onToggleAIChat,
|
|
|
|
|
vaultPath, noteList, noteListFilter,
|
|
|
|
|
onTrashNote, onRestoreNote, onDeleteNote, onArchiveNote, onUnarchiveNote,
|
|
|
|
|
onContentChange, onSave, onTitleSync,
|
|
|
|
|
canGoBack, canGoForward, onGoBack, onGoForward, leftPanelsCollapsed,
|
|
|
|
|
isDarkTheme, onFileCreated, onFileModified, onVaultChanged,
|
2026-03-17 22:42:55 +01:00
|
|
|
onSetNoteIcon, onRemoveNoteIcon,
|
2026-03-17 12:07:33 +01:00
|
|
|
} = props
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
editor, activeTab, rawLatestContentRef,
|
|
|
|
|
rawMode, diffMode, diffContent, diffLoading,
|
|
|
|
|
handleToggleDiffExclusive, handleToggleRawExclusive,
|
2026-03-18 15:42:48 +01:00
|
|
|
handleEditorChange, handleViewCommitDiff,
|
2026-03-17 12:07:33 +01:00
|
|
|
isLoadingNewTab, activeStatus, showDiffToggle,
|
|
|
|
|
} = useEditorSetup({
|
2026-03-18 15:42:48 +01:00
|
|
|
tabs, activeTabPath, vaultPath, onContentChange,
|
|
|
|
|
onLoadDiff: props.onLoadDiff,
|
2026-03-17 12:07:33 +01:00
|
|
|
onLoadDiffAtCommit: props.onLoadDiffAtCommit, getNoteStatus,
|
|
|
|
|
rawToggleRef: props.rawToggleRef, diffToggleRef: props.diffToggleRef,
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-17 11:03:23 +01:00
|
|
|
return (
|
2026-02-17 11:31:23 +01:00
|
|
|
<div className="editor flex flex-col min-h-0 overflow-hidden bg-background text-foreground">
|
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
|
|
|
<TabBar
|
|
|
|
|
tabs={tabs}
|
|
|
|
|
activeTabPath={activeTabPath}
|
|
|
|
|
getNoteStatus={getNoteStatus}
|
|
|
|
|
onSwitchTab={onSwitchTab}
|
|
|
|
|
onCloseTab={onCloseTab}
|
|
|
|
|
onCreateNote={onCreateNote}
|
|
|
|
|
onReorderTabs={onReorderTabs}
|
2026-03-18 15:42:48 +01:00
|
|
|
onRenameTab={props.onRenameTab}
|
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
|
|
|
canGoBack={canGoBack}
|
|
|
|
|
canGoForward={canGoForward}
|
|
|
|
|
onGoBack={onGoBack}
|
|
|
|
|
onGoForward={onGoForward}
|
2026-02-28 20:19:03 +01:00
|
|
|
leftPanelsCollapsed={leftPanelsCollapsed}
|
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-02-17 11:03:23 +01:00
|
|
|
<div className="flex flex-1 min-h-0">
|
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
|
|
|
{tabs.length === 0
|
|
|
|
|
? <EditorEmptyState />
|
|
|
|
|
: <EditorContent
|
|
|
|
|
activeTab={activeTab}
|
|
|
|
|
isLoadingNewTab={isLoadingNewTab}
|
|
|
|
|
entries={entries}
|
|
|
|
|
editor={editor}
|
|
|
|
|
diffMode={diffMode}
|
|
|
|
|
diffContent={diffContent}
|
|
|
|
|
diffLoading={diffLoading}
|
2026-03-02 18:38:25 +01:00
|
|
|
onToggleDiff={handleToggleDiffExclusive}
|
|
|
|
|
rawMode={rawMode}
|
|
|
|
|
onToggleRaw={handleToggleRawExclusive}
|
|
|
|
|
onRawContentChange={onContentChange}
|
|
|
|
|
onSave={onSave}
|
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={activeStatus}
|
|
|
|
|
showDiffToggle={showDiffToggle}
|
|
|
|
|
showAIChat={showAIChat}
|
|
|
|
|
onToggleAIChat={onToggleAIChat}
|
|
|
|
|
inspectorCollapsed={inspectorCollapsed}
|
|
|
|
|
onToggleInspector={onToggleInspector}
|
|
|
|
|
onNavigateWikilink={onNavigateWikilink}
|
|
|
|
|
onEditorChange={handleEditorChange}
|
|
|
|
|
onTrashNote={onTrashNote}
|
|
|
|
|
onRestoreNote={onRestoreNote}
|
2026-03-03 01:37:25 +01:00
|
|
|
onDeleteNote={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
|
|
|
onArchiveNote={onArchiveNote}
|
|
|
|
|
onUnarchiveNote={onUnarchiveNote}
|
2026-02-28 21:31:47 +01:00
|
|
|
vaultPath={vaultPath}
|
2026-03-02 11:53:31 +01:00
|
|
|
isDarkTheme={isDarkTheme}
|
2026-03-11 22:14:20 +01:00
|
|
|
rawLatestContentRef={rawLatestContentRef}
|
2026-03-16 04:46:28 +01:00
|
|
|
onTitleChange={onTitleSync}
|
2026-03-17 22:42:55 +01:00
|
|
|
onSetNoteIcon={onSetNoteIcon}
|
|
|
|
|
onRemoveNoteIcon={onRemoveNoteIcon}
|
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-03 01:37:25 +01:00
|
|
|
{(showAIChat || !inspectorCollapsed) && <ResizeHandle onResize={onInspectorResize} />}
|
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
|
|
|
<EditorRightPanel
|
|
|
|
|
showAIChat={showAIChat}
|
|
|
|
|
inspectorCollapsed={inspectorCollapsed}
|
|
|
|
|
inspectorWidth={inspectorWidth}
|
|
|
|
|
inspectorEntry={inspectorEntry}
|
|
|
|
|
inspectorContent={inspectorContent}
|
|
|
|
|
entries={entries}
|
|
|
|
|
gitHistory={gitHistory}
|
2026-03-01 19:49:58 +01:00
|
|
|
vaultPath={vaultPath ?? ''}
|
2026-03-04 12:15:06 +01:00
|
|
|
openTabs={tabs.map(t => t.entry)}
|
2026-03-04 19:53:46 +01:00
|
|
|
noteList={noteList}
|
|
|
|
|
noteListFilter={noteListFilter}
|
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
|
|
|
onToggleInspector={onToggleInspector}
|
|
|
|
|
onToggleAIChat={onToggleAIChat}
|
|
|
|
|
onNavigateWikilink={onNavigateWikilink}
|
|
|
|
|
onViewCommitDiff={handleViewCommitDiff}
|
|
|
|
|
onUpdateFrontmatter={onUpdateFrontmatter}
|
|
|
|
|
onDeleteProperty={onDeleteProperty}
|
|
|
|
|
onAddProperty={onAddProperty}
|
2026-03-11 21:24:57 +01:00
|
|
|
onCreateAndOpenNote={onCreateAndOpenNote}
|
2026-02-28 22:21:42 +01:00
|
|
|
onOpenNote={onNavigateWikilink}
|
2026-03-05 12:12:12 +01:00
|
|
|
onFileCreated={onFileCreated}
|
|
|
|
|
onFileModified={onFileModified}
|
2026-03-07 14:19:41 +01:00
|
|
|
onVaultChanged={onVaultChanged}
|
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-02-17 11:03:23 +01:00
|
|
|
</div>
|
2026-02-14 18:22:42 +01:00
|
|
|
</div>
|
|
|
|
|
)
|
2026-02-17 17:14:43 +01:00
|
|
|
})
|