Skip to content

Commit efb420b

Browse files
authored
feat: make callback return value optional in forEachBlock (#1081)
1 parent 06217a3 commit efb420b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/pages/docs/editor-api/manipulating-blocks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Use `forEachBlock` to traverse all blocks in the editor depth-first, and execute
9191

9292
```typescript
9393
forEachBlock(
94-
callback: (block: Block) => boolean,
94+
callback: (block: Block) => boolean | undefined,
9595
reverse: boolean = false
9696
): void;
9797

packages/core/src/editor/BlockNoteEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ export class BlockNoteEditor<
561561
blockArray: Block<BSchema, ISchema, SSchema>[]
562562
): boolean {
563563
for (const block of blockArray) {
564-
if (!callback(block)) {
564+
if (callback(block) === false) {
565565
return false;
566566
}
567567

0 commit comments

Comments
 (0)