Skip to content

images.convertToInline() converts floating images to inline but preserves the original paragraph anchor, resulting in incorrect layout #3831

Description

@vbg-med

What happened?

What happened?

When converting floating images using editor.doc.images.convertToInline(), the API reports success and the image's placement changes from floating to inline.

However, the resulting layout does not match the expected inline flow.

Expected

A floating image converted to inline should appear as a normal inline image in the document flow, for example:

Paragraph A

[Image]

Paragraph B

or otherwise preserve Word's visual reading order.

Actual

The image is inserted into its original anchor paragraph, causing surrounding text to flow beside the image.

For example:

data data: Normal...

[Image]data data datas...

Right data data...

instead of

dat data dat: Normal...

[Image]

data data data data ...

Right datadata...

The API returns:

{
"success": true,
"image": {
"kind": "inline",
"nodeType": "image",
"nodeId": "...",
"placement": "inline"
}
}

and images.list() confirms the image placement is now "inline".

So the conversion succeeds, but the resulting layout is unexpected.

Steps to reproduce

Steps to reproduce
Open a DOCX containing floating images with square text wrapping.
Call:
const { items } = editor.doc.images.list();

for (const img of items) {
editor.doc.images.convertToInline({
imageId: img.sdImageId,
});
}
Observe the rendered document.

The image becomes inline but remains embedded in its original anchor paragraph, causing text to wrap beside it instead of appearing before and after the image.

SuperDoc version

1.43.2

Browser

Chrome

Additional context

Additional context

The image metadata before conversion is:

{
"properties": {
"placement": "floating",
"wrap": {
"type": "Square"
}
}
}

After conversion:

{
"success": true,
"image": {
"placement": "inline"
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions