fix: keep note windows editable

This commit is contained in:
lucaronin
2026-05-01 18:36:48 +02:00
parent 6e41328f21
commit f92efd72df
2 changed files with 5 additions and 4 deletions

View File

@@ -372,9 +372,9 @@ vi.mock('@blocknote/core/extensions', () => ({
vi.mock('@blocknote/react', () => ({
createReactBlockSpec: () => () => ({}),
createReactInlineContentSpec: () => ({ render: () => null }),
BlockNoteViewRaw: ({ children }: { children?: ReactNode }) => (
<div data-testid="blocknote-view">
<div contentEditable suppressContentEditableWarning data-testid="mock-editor">
BlockNoteViewRaw: ({ children, editable }: { children?: ReactNode; editable?: boolean }) => (
<div data-testid="blocknote-view" data-editable={editable !== false ? 'true' : 'false'}>
<div contentEditable={editable !== false} suppressContentEditableWarning data-testid="mock-editor">
mock editor
</div>
{children}
@@ -578,6 +578,7 @@ describe('App', () => {
await waitFor(() => expect(getNoteContent).toHaveBeenCalled())
expect(getNoteContent).toHaveBeenCalledWith({ path: '/vault/project/test.md', vaultPath: '/vault' })
await waitFor(() => expect(window.__laputaTest?.activeTabPath).toBe('/vault/project/test.md'))
expect(screen.getByTestId('blocknote-view')).toHaveAttribute('data-editable', 'true')
expect(listVault).not.toHaveBeenCalled()
})

View File

@@ -1690,7 +1690,7 @@ function App() {
tabs={notes.tabs}
activeTabPath={notes.activeTabPath}
isVaultLoading={isVaultContentLoading}
entries={vault.entries}
entries={noteWindowParams && activeTab ? [activeTab.entry] : vault.entries}
onNavigateWikilink={notes.handleNavigateWikilink}
onLoadDiff={vault.loadDiff}
onLoadDiffAtCommit={vault.loadDiffAtCommit}