我想把HTML字符串显示给editorJS,你有什么想法吗?
从<h1>The video src attribute</h1><video width="320" height="240" controls src="movie.ogg">Yourbrowser does not support the video tag.</video><p><b>Note:</b> The .ogg fileformat is not supported in old IE and Safari.</p>
开始
变成了这样
"time" : 1616822242088,
"blocks" : [
{
"type" : "image",
"data" : {
"file" : {
"url" : "https://codex.so/public/app/img/external/codex2x.png"
},
"caption" : "",
"withBorder" : false,
"stretched" : false,
"withBackground" : false
}
}
],
"version" : "2.19.3"
}```
1条答案
按热度按时间lrpiutwd1#
您可以使用与创建此JSON对象块相同的editorsjs。EditorJs库有一个函数-
renderFromHtml()
,用于将HTML块转换回JSON对象块。