This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-f94ce9cd-8a83-4936-8b24-0a41ad46c856 XWIKI-25645 Open

Images included in pasted HTML are not uploaded as attachments, and inline ones are lost

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-9c61f61b-e1ef-4ea6-bd48-a3343c4d84ad Nicoleta Ciausu created this issue on 03/Nov/26 17:01
 
Summary: Images included in pasted HTML are not uploaded as attachments, and inline ones are lost
Issue Type: cid:jira-generated-image-avatar-f94ce9cd-8a83-4936-8b24-0a41ad46c856 Bug
Affects Versions: 17.10.11
Assignee: Unassigned
Components: BlockNote
Created: 03/Nov/26 17:01
Priority: cid:jira-generated-image-static-major-22a14dce-d665-460b-9f39-3eb741ac9f48 Major
Reporter: Nicoleta Ciausu
Description:

Steps to reproduce

  • create a page A, attach an image to it and insert that image in its content
  • add a second paragraph to page A containing an image inline inside the text
  • save page A and view it
  • open a page B in edit mode, with the BlockNote editor
  • in page A's view mode, select everything and copy
  • paste into the BlockNote editor of page B
  • save page B

Expected result

  • both images are attached to page B and referenced from its content as [[image:image.png]]

Actual result

  • the block-level image is inserted as an external URL image, still pointing at page A's attachment. Nothing is attached to page B, so page A has no way of knowing that another page references its attachment, and the image breaks as soon as page A or its attachment is removed.
  • the inline image is silently dropped: no image, no external URL image, no warning

Cause

BlockNote only calls the uploadFile callback when the clipboard or the drop carries a Files entry:

// @blocknote/core, handleFileInsertion
if (i !== "Files") return;

Content copied from a web page arrives as text/html, so that path is never taken and the <img src> of the pasted HTML is inserted as-is. The uploadFile callback added by XWIKI-24758 only ever sees the files dropped from the file manager or pasted from a screenshot tool.

Attaching the referenced images needs a pass over the pasted HTML that fetches each external image, attaches it to the edited page and rewrites the reference.

The inline images are lost for a different reason: BlockNote's embed blocks (image, file, audio, video) are block-level only, so an image that cannot become a standalone block has nowhere to go and is discarded.

Notes

  • This is the BlockNote counterpart of XWIKI-20350 and XWIKI-22611, which fixed the same problem for CKEditor.
  • Reproduced on master as well.