Skip to content

fix(*): figures are pulled out of block tags

Dan Visel requested to merge xsweet-import-pull-out-inline-images into main

This is an adjustment to the upload logic: if there's a <figure> tag inside of a <p> or a <h1-6>, this pulls it out and puts it as a sibling element – going from this:

<p>This is some text ... <figure><img /></figure></p>

to this:

<p>This is some text ... <figure><img /></figure></p>
<figure><img /></figure>

The inline figure gets thrown out, as before, when it goes into the Wax schema, because <figure> can't appear within a block-level element. The second one comes out as a block-level element, which is fine.

This certainly fixes some cases – where there's an image that's technically inline in the Word doc that should be displayed at block-level. However: it's worth noting that there are inline images that are meant to be inline images – displaying these as block elements is not what the author intended. The argument for this MR is that with it, we're not throwing out data that we were throwing out before; it might not be what the author wanted, but the editor could theoretically rearrange.

A full fix for this problem would implement inline images in Wax. That would be a lot of work, though it is probably something that we want to have in the long run.

Merge request reports