如何从编辑器js手动渲染数据



我第一次使用editor.js,我被这部分卡住了:从我的图库中选择图像后,我想用新图像重新渲染编辑器js:这是我目前的代码

let url = `/${this.selectedImg.image.id}/${this.selectedImg.image.name}`
this.editor.configuration.data.blocks.push({
data: {
caption: "",
file: {url: url},
stretched: false,
withBackground: false,
withBorder: false,
},
type: "image"
})
console.log(this.editor,'editor')
this.editor.render()

但是this.editor.render()不起作用,我缺少什么?这是console.log屏幕截图

如果有任何帮助,我将不胜感激!

editor.save().then((data) => {
data.blocks.push({
type: "image",
data: {
caption: "",
file: {url: url},
stretched: false,
withBackground: false,
withBorder: false,
},
})
this.editor.render(data)
this.$emit('close', true)
})

这是答案,我误读了文件:(

最新更新