There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-8856c482-e7d8-4a08-971b-c27e7d2f9461 XWIKI-25645 Open

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

 
View issue   ยท   Add comment
 

4 updates

 
cid:jira-generated-image-avatar-9c2b07be-d838-4422-a8e5-99fbbba0c9c5 Changes by Nicoleta Ciausu on 03/Nov/26 17:11
 
Version: 17.10.0
Version: 17.10.11
Description: h2. 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

h2. Expected result

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

h2. 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

h2. Cause

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

{code :java }
// @blocknote/core, handleFileInsertion
if (i !== "Files") return;
{code}

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.

h2. Notes

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


 
Attachment: Screencast_20261103_174453.mp4