JSON data back to HTML like a function


#1

Is there any way to use

DOMSerializer.fromSchema(Schema).serializeFragment(content, {"document": window.document}, target)

but use it as a function and every time I pass it some data get the HTML back without to reload the page and without using the react-prosemirror? is it possible?


#2

Your question is a little hard to interpret, but maybe the problem is that you’re using some visible target node? You can pass a newly created element as third argument to serializeFragment and the content won’t appear in the visible document. You can then take its innerHTML or similar to get the HTML string.