user3587411
user3587411

Reputation: 205

Including styles in Quill setHTML

I am attempting to insert HTML into quill editor. The HTML can contain custom styles in style tags.

Quill is replacing all style tags with span tags in the HTML, for example a test in this jsfiddle : http://jsfiddle.net/f1L4z2py/

var testStr = "";
testStr += "<html><head><style type=\"text/css\">.testcss { background-color: black; }</style></head><body class=\"testcss\">test</body></html>"

quill.setHTML(testStr);

Does Quill support custom styles in its' editor HTML?

I looked at the Quill documentation : http://quilljs.com/docs/api/ , however I saw nothing about support for custom styles in the HTML except for maybe SetContents, however I would like to avoid extracting the style from the given HTML if I can avoid it.

Is the switching out of style tags for span tags a bug with Quill? Is the only way to support custom styling for setting HTML in Quill to manually extract the styles from given HTML first and then applying the HTML into Quill editor?

Thanks

Upvotes: 1

Views: 2289

Answers (1)

jhchen
jhchen

Reputation: 14767

No Quill does not support arbitrary HTML. Anything it does not recognize will be converted (strong tag to b tag) when possible or removed when not possible.

Upvotes: 1

Related Questions