Using dangerouslyPasteHTML keeps adding \n before a <ul>
and after </ul>
See https://jsfiddle.net/lidbanger/pyo5ekub/
Quill initially loads with the content <p>Hello World!</p><ul><li>Apples</li><li>Pears</li><li>Oranges</li></ul>
Click the "Get HTML" button [ document.getElementById("editor").childNodes[0].innerHTML
]
Click the "Set HTML" button [ quill.clipboard.dangerouslyPasteHTML(0, sHTML)
]
Repeat.
A <p><br></p>
is prepended and appended to the after each use of the aptly named dangerouslyPasteHTML.
I'd expect quill to respect the HTML markup and not add the <p><br></p>
Google Chrome: 56.0.2924.87
Quill.version:1.2.0
Do not set the content of Quill directly with HTML. Use the API instead !
// Set HTML content and API content (ops) as form values
// e.g. to POST it to a database:
myForm.content.value = document.querySelector('.ql-editor').innerHTML;
var ops = Editor.getContents().ops;
theForm.content_raw.value = JSON.stringify(ops);
This way you have HTML content to show on your website and raw content to load in your Quill:
// Load content into Quill
var editContent = JSON.parse(content_raw); // e.g. from a db query
Editor.setContents(editContent);