Convert Quill Delta to HTML

Not very elegant, but this is how I had to do it.

function quillGetHTML(inputDelta) {
    var tempCont = document.createElement("div");
    (new Quill(tempCont)).setContents(inputDelta);
    return tempCont.getElementsByClassName("ql-editor")[0].innerHTML;
}

Obviously this needs quill.js.


If I've understood you correctly, there's a quill thread of discussion here, with the key information you're after.

I've quoted what should be of most value to you below:

Quill has always used Deltas as a more consistent and easier to use (no parsing) data structure. There's no reason for Quill to reimplement DOM APIs in addition to this. quill.root.innerHTML or document.querySelector(".ql-editor").innerHTML works just fine (quill.container.firstChild.innerHTML is a bit more brittle as it depends on child ordering) and the previous getHTML implementation did little more than this.


I guess you want the HTML inside it. Its fairly simple.

quill.root.innerHTML

Simple, solution is here: https://www.scalablepath.com/blog/using-quill-js-build-wysiwyg-editor-website/

The main code is:

console.log(quill.root.innerHTML);

Tags:

Quill