fix: recover invalid editor block joins

This commit is contained in:
lucaronin
2026-05-23 17:36:55 +02:00
parent 12646d4e98
commit 2a3ecf7270
2 changed files with 19 additions and 3 deletions

View File

@@ -61,6 +61,9 @@ describe('isRecoverableEditorTransformError', () => {
expect(isRecoverableEditorTransformError(new RangeError(
'Invalid content for node blockContainer: <paragraph("Procedures are long-running"), blockGroup(blockContainer(bulletListItem("Step")))>',
))).toBe(true)
expect(isRecoverableEditorTransformError(transformError(
'Cannot join blockGroup onto blockContainer',
))).toBe(true)
expect(isRecoverableEditorTransformError(new RangeError(
'Inserted content deeper than insertion position',
))).toBe(true)
@@ -111,6 +114,13 @@ describe('installRichEditorTransformErrorRecovery', () => {
)
})
it('repairs invalid block joins after pull refreshes editor state', () => {
expectDocumentRepairRecovery(
transformError('Cannot join blockGroup onto blockContainer'),
'invalid_block_join',
)
})
it('recovers table selection transactions whose target row changed underneath BlockNote', () => {
expectDocumentRepairRecovery(
new RangeError('Index 1 out of range for <tableRow(tableCell(tableParagraph("A")))>'),