refactor: remove tab bar — single note open at a time
Replace the multi-tab model with single-note navigation. One note is open at a time; clicking any note (sidebar, wikilink, relationship) replaces the current note in the editor. Back/Forward history still works via Cmd+[/]. Removed: TabBar component, useClosedTabHistory, tab reorder/close/ reopen logic, Cmd+W/Cmd+Shift+T shortcuts, Close Tab and Reopen Closed Tab menu items, tabLayout utility, and all related tests. Simplified: useTabManagement (single-note), useAppNavigation (no tab lookup), useKeyboardNavigation (note nav only), useNoteCreation (no close-tab cleanup), useDeleteActions (deselect instead of close tab), Editor (no TabBar render), Rust menu (removed 2 menu items). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,10 +34,8 @@ function makeHandlers(): MenuEventHandlers {
|
||||
onViewChanges: vi.fn(),
|
||||
onInstallMcp: vi.fn(),
|
||||
onReloadVault: vi.fn(),
|
||||
onReopenClosedTab: vi.fn(),
|
||||
onOpenInNewWindow: vi.fn(),
|
||||
activeTabPathRef: { current: '/vault/test.md' } as React.MutableRefObject<string | null>,
|
||||
handleCloseTabRef: { current: vi.fn() } as React.MutableRefObject<(path: string) => void>,
|
||||
activeTabPath: '/vault/test.md',
|
||||
}
|
||||
}
|
||||
@@ -87,19 +85,6 @@ describe('dispatchMenuEvent', () => {
|
||||
expect(h.onSave).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('file-close-tab closes the active tab', () => {
|
||||
const h = makeHandlers()
|
||||
dispatchMenuEvent('file-close-tab', h)
|
||||
expect(h.handleCloseTabRef.current).toHaveBeenCalledWith('/vault/test.md')
|
||||
})
|
||||
|
||||
it('file-close-tab does nothing when no active tab', () => {
|
||||
const h = makeHandlers()
|
||||
h.activeTabPathRef = { current: null }
|
||||
dispatchMenuEvent('file-close-tab', h)
|
||||
expect(h.handleCloseTabRef.current).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('app-settings triggers open settings', () => {
|
||||
const h = makeHandlers()
|
||||
dispatchMenuEvent('app-settings', h)
|
||||
@@ -301,13 +286,6 @@ describe('dispatchMenuEvent', () => {
|
||||
expect(h.onReloadVault).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// File menu: reopen closed tab
|
||||
it('file-reopen-closed-tab triggers reopen closed tab', () => {
|
||||
const h = makeHandlers()
|
||||
dispatchMenuEvent('file-reopen-closed-tab', h)
|
||||
expect(h.onReopenClosedTab).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// Note: open in new window
|
||||
it('note-open-in-new-window triggers open in new window', () => {
|
||||
const h = makeHandlers()
|
||||
|
||||
Reference in New Issue
Block a user