Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Quill Delta to HTML

Tags:

quill

How do I convert Deltas to pure HTML? I'm using Quill as a rich text editor, but I'm not sure how I would display the existing Deltas in a HTML context. Creating multiple Quill instances wouldn't be reasonable, but I couldn't come up with anything better yet.

I did my research, and I didn't find any way to do this.

like image 206
km6 Avatar asked Sep 15 '16 20:09

km6


People also ask

How do I get the Quill editor in HTML?

I just use - $("#form"). find('#quill-editor . ql-editor'). html();

What is Delta in Quill?

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.

How do you use the quill in react?

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.


1 Answers

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.

like image 179
km6 Avatar answered Sep 20 '22 04:09

km6