Closed sheeshmohsin closed 7 years ago
You can use the construction APIs to create a Delta in general, but parsing, sanitizing and interpreting HTML is outside the scope of this project. You will have to use another third party library for that in conjunction with the construction APIs.
What about using Clipboard.convert ?
https://github.com/quilljs/quill/blob/master/modules/clipboard.js
This seems to work:
quill.setContents(quill.clipboard.convert(html));
I know this is an old issue but it strikes me as an odd oversight that Quill doesn't support this in any sort of documented way and the only way to do it is essentially a hack.
What is the recommended approach from Quill designers if I want to make some rich content editable more than once but also want to make the content renderable as simple HTML (as in the editor but just for display)?
AFAICT the easiest way to support this use-case is to store the content twice: once as Delta and once as HTML. Otherwise you're left rolling your own parser to convert HTML to Delta (if you store it as HTML) or Delta to HTML (for rendering outside an editor context).
Surely I'm missing something here?
I store it as HTML and delta as well so I can render without parsing each time. I think there should be a setHtmlContents()
convenience method as well though. Is this not supported because Quill is a superset of HTML and doing so may alter results, or vice versa?
I have seen examples of conversion of delta to html format, but no where its explained to convert html to delta format. Is there anyway to do that?