我在 react 中使用 Slate js 创建了一个编辑器。我正在尝试在编辑器内容的末尾插入一个块。我遇到了一种在范围内插入块的方法。如何指定文档的范围,以便在内容末尾添加我的自定义块,但焦点停留在当前选择而不是文档末尾。
function insertFile(editor, src, target) {
editor.insertBlock({
type: 'file',
data: { src },
})
}
我的架构看起来像这样
const schema = {
blocks: {
file:{
isVoid: true
}
}
}