diff --git a/packages/slate/src/create-editor.ts b/packages/slate/src/create-editor.ts index b1a903b5eb6..f6f2a36de18 100644 --- a/packages/slate/src/create-editor.ts +++ b/packages/slate/src/create-editor.ts @@ -227,7 +227,16 @@ export const createEditor = (): Editor => { // other inline nodes, or parent blocks that only contain inlines and // text. if (isInlineOrText !== shouldHaveInlines) { - Transforms.removeNodes(editor, { at: path.concat(n), voids: true }) + // eslint-disable-next-line no-console + console.warn( + `Removing ${ + isInlineOrText ? 'inline' : 'block' + } node at path ${path.concat(n)} because parent expects ${ + shouldHaveInlines ? 'inline' : 'block' + } children` + ) + const removePath = path.concat(n) + Transforms.removeNodes(editor, { at: removePath, voids: true }) n-- } else if (Element.isElement(child)) { // Ensure that inline nodes are surrounded by text nodes.