-
-
Notifications
You must be signed in to change notification settings - Fork 642
Description
Thanks for great lib. I encountered this bug in both 0.41.1 and 0.42.0 and resolved it with Codex via workaround,
but it seems this should be fixed in the lib itself. I asked Codex to write bug report, reproduction, workaround and fix suggestion. Hope this helps!
Issue Summary
Error: RangeError: No value supplied for attribute start when editor.tryParseMarkdownToBlocks() parses Markdown containing ordered lists. The exception bubbles out of packages/core/src/schema/blocks/internal.ts (propsToAttributes → ProseMirror NodeType.computeAttrs).
Root Cause: packages/core/src/blocks/ListItem/NumberedListItem/block.ts defines start with default: undefined. When Markdown produces
- …
Minimal Repro Markdown:
## Heading
1. First item
2. Second itemFeeding this into editor.tryParseMarkdownToBlocks reproduces the RangeError reliably.
Suggested Upstream Fix: Make start optional before it reaches ProseMirror—either give it a concrete default (default: 1) in NumberedListItem/block.ts, or map optional props to nullable PM attributes inside propsToAttributes.
Workaround (copy/paste ready): When building your schema, override only the numbered-list spec so start defaults to 1. Drop this into your editor setup:
import { BlockNoteSchema, createCodeBlockSpec } from '@blocknote/core'
import { defaultBlockSpecs } from '@blocknote/core/blocks'
// ...
const createSchema = () => {
const blockSpecs = {
...defaultBlockSpecs,
numberedListItem: {
...defaultBlockSpecs.numberedListItem,
config: {
...defaultBlockSpecs.numberedListItem.config,
propSchema: {
...defaultBlockSpecs.numberedListItem.config.propSchema,
start: {
...defaultBlockSpecs.numberedListItem.config.propSchema.start,
default: 1 as const,
},
},
},
},
codeBlock: createCodeBlockSpec({ /* your existing options */ }),
}
return BlockNoteSchema.create({ blockSpecs })
}
const editor = useCreateBlockNote({ schema: createSchema(), /* ... */ })That single override keeps BlockNote behavior identical while preventing the ProseMirror crash until the official fix lands.