I am having real trouble understanding how to work with quill...
Saving the data is not a problem as that pretty straight forward :)
I am a little stuck on two points
can anyone offer any advice how to load the delta
{"ops":[{"insert":"this is a test bit of text\n"}]}
back into the quill editor and how to parse the output to create a page?
Thanks in advance for any replies!
Many options exist to get HTML content from Quill editor. You can try to convert Delta with a JavaScript library: Quill Delta to HTML Converter. Solutions on Stack Overflow.
Deltas are a simple, yet expressive format that can be used to describe Quill's contents and changes. The format is a strict subset of JSON, is human readable, and easily parsible by machines.
Learn how to use react-quill by viewing and forking example apps that make use of react-quill on CodeSandbox. Custom Toolbar with React Quill (Fully working)Quill test with a custom toolbar built with an HTML template. The toolbar includes custom font families, custom font sizes and a custom button.
Use setContents to insert a delta:
quill.setContents({
"ops":[
{"insert":"this is a test bit of text\n"}
]
});
http://codepen.io/anon/pen/VKWZLd
You can access the raw HTML with:
var html = document.querySelector(".ql-editor").innerHTML
If you are working with raw HTML, you need to sanitize it before you use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With