Hi everyone,
I ran into the following error while attempting to add an image to a slate.js editor today:
The solution was to add a simple schema to my editor:
const schema = {
blocks: {
image: {
isVoid: true
}
}
};
spellCheck
autoFocus
ref={this.ref}
value={this.state.value}
onChange={this.onChange}
onKeyDown={this.onKeyDown}
onDrop={this.onDropOrPaste}
onPaste={this.onDropOrPaste}
renderNode={this.renderNode}
renderMark={this.renderMark}
className={classes.editor}
readOnly={readOnly}
onFocus={() => { this.setState({ changed: true }); }}
schema={schema}
There’s more on schemas in the official documentation: https://docs.slatejs.org/guides/schemas
