Reputation: 137
I have created an editor using Slate js in react. I am trying to insert a block at the end of the editor content. I came across a method to insert block at the range. How to specify the range of the document such that my custom blocks gets added at the end of the content but focus stays at the current selection and not at the end of the document.
function insertFile(editor, src, target) {
editor.insertBlock({
type: 'file',
data: { src },
})
}
My schema looks like this
const schema = {
blocks: {
file:{
isVoid: true
}
}
}
Upvotes: 2
Views: 1625