Quill: dangerouslyPasteHTML to inject <table>

Created on 20 Jan 2017  路  3Comments  路  Source: quilljs/quill

I have an email template as this:

Expected behavior:

quill.clipboard.dangerouslyPasteHTML(/* HTML content paste before */);

To look like in the jsfiddle.

Actual behavior:

Every <table> and <td> are translated to <p>, css background image does not appears, ... does not like https://jsfiddle.net/kumbt47p/ at all.

Platforms:

Chrome v55

Version:

Quill 1.1.10

Most helpful comment

@jhchen @justinpincar any update on this?

All 3 comments

As noted in the documentation: "The snippet is interpreted by Clipboard matchers, which may not produce the exactly input HTML"

Since tables are not defined in Quill by default and I'm assuming you did not implement and define it separately, conversion to a paragraph is the expected behavior.

@jhchen, thanks for the explanation. It makes sense, but this was definitely not the expected behavior as a developer: the naming is confusing (dangerouslyPasteHTML) as other libraries use similar methods without any sanitization. I assume the rationale is because quill's internal delta models need to be generated?

Is there any workaround to make a "raw" html paste or something like that? We recently upgraded to 1.x from a 0.x release of quill and now everything that had tables it in will be wiped and lose the formatting if the user makes any edits.

@jhchen @justinpincar any update on this?

Was this page helpful?
0 / 5 - 0 ratings