Plugins
const withImages = editor => {
const { exec, isVoid } = editor
editor.exec = command => {
if (command.type === 'insert_image') {
const { url } = command
const element = { type: 'image', url, children: [{ text: '' }] }
Transforms.insertNodes(editor, element)
} else {
exec(command)
}
}
editor.isVoid = element => {
return element.type === 'image' ? true : isVoid(editor)
}
return editor
}Helpers Functions
Last updated