nozer/quill-delta-to-html

<img> tag may need to be placed in a different group

Closed this issue · 1 comments

A plain text and image is placed in a same group. Is there a way to make img tag is wrapped with single wrapper such as P or DIV without any siblings?
Great works. Thanks.

nozer commented

There is no way to do that currently. However, you can put it inside one of those block elements (direction, alignment, indent, block quote, header). For example, you can select the image and click on H1 and it will put the image in an <h1> tag.

Or with align block, these ops:

   {insert: "text before\n"}, 
   {insert: {image: 'http://abc'}}, 
   {attributes: {align: "center"}, insert: "\n"}, 
   {insert: "text after\n"}

would produce these html:

<p>text before</p>
<p class="ql-align-center"><img class="ql-image" src="http://abc"/></p>
<p>text after</p>