Report a bug
After inserting an inline block that has IsVoid in the schema, moving the selection on to the block throws an "unable to find DOM node" error. The inline component does have its incoming attributes prop spread and the schema also has IsVoid set to true. The problem does not reproduce if the button is changed to insertBlock instead of insertInline.
Image component
import React from "react";
export default class Image extends React.Component {
render() {
return (
<img {...this.props.attributes} src={this.props.node.data.get("src")} />
);
}
}
Schema
{
blocks: {
image: {
isVoid: true
}
}
}

The editor shouldn't crash and should allow selection.
In my case I am inserting a @mention inline node like this.
`
change.insertInline({
type: 'Mention',
data: {
Name: selectedUser.Name,
Id: selectedUser._id,
Type: selectedUser.Kind
},
isVoid: true
}).moveToEndOfInline().focus().insertText(" ..... ")
`
the text .... is not inserted anymore.
@saravanan10393 I think the isVoid has to be defined in schema now
@rfeltis you inserted the image using insertInlinebut your schema is basically setting image only as a blocks. if you change your schema to
{
inlines: {
image: {
isVoid: true
}
}
}
or use insertBlock as your image then it should be good.
@ianstormtaylor not sure if we want to put this as a bug. It's more like the isVoid check through schema is not explained enough on the documentation. Same issue as https://github.com/ianstormtaylor/slate/issues/2219
That fixed it! You are likely right that the docs could help point in the right direction. The schemas guide doesn't mention that there is an inlines section. The only time it comes up is at the top of the schemas reference guide. I honestly didn't even remember typing in blocks for the section. I thought it was nodes all this time.
@rfeltis documentation is at https://github.com/ianstormtaylor/slate/blob/8dd919dc3457c62ea2aa72f31b83faf42cbaba72/docs/reference/slate/schema.md linked at the end of the custom normalizer section https://docs.slatejs.org/guides/schemas#custom-normalizers
Most helpful comment
@rfeltis you inserted the image using
insertInlinebut your schema is basically setting image only as a blocks. if you change your schema toor use
insertBlockas your image then it should be good.@ianstormtaylor not sure if we want to put this as a bug. It's more like the
isVoidcheck through schema is not explained enough on the documentation. Same issue as https://github.com/ianstormtaylor/slate/issues/2219