4

I want to save and load the rich text from a Quill editor. My plan is to call JSON.stringify(quill.getContents()) and save the resulting JSON. Then to load and display the rich text I would do:

quill.setContents(JSON.parse(myJson));
myDiv.innerHTML = quill.root.innerHTML;

My question: is it the case that regardless of the contents of the myJson string, the above will only render the standard HTML tags which Quill supports? i.e. is it impossible to pick the myJson string in a way that the resulting HTML does something which couldn't have been accomplished by using the Quill editor UI in the intended way?

For example - if I have configured Quill to not allow images, I wouldn't want it to be possible to create a JSON string which would result in the above code rendering an image.

fblundun
  • 987
  • 7
  • 19

0 Answers0