There is 1 update, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-acecf36a-85de-4799-956f-40feef4bb4c4 XWIKI-24052 Open

Display Macro duplicates the content

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-17eeac80-2660-4396-b4a8-1f5c21c2e233 Changes by Clemens Robbenhaar on 24/Feb/26 12:50
 
Description: If the display macro is used with a space in front, and one edits the page in the WYSIWYG editor (no matter if in-place or edit-mode, real-time collaboration on or off), then on save the contents of the page that got referenced is included below the display macro
Example
``` {code:java}
{{display reference="Sandbox.TestPage1"/}}
``` {code}
Video of the bug:
[ https://private-user-images.githubusercontent.com/92780090/547878005-7bead2d3-b555-4f61-90d1-181871181692.mp4?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzE5MTcyNzcsIm5iZiI6MTc3MTkxNjk3NywicGF0aCI6Ii85Mjc4MDA5MC81NDc4NzgwMDUtN2JlYWQyZDMtYjU1NS00ZjYxLTkwZDEtMTgxODcxMTgxNjkyLm1wND9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjI0VDA3MDkzN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxMjMxMmY3ZWU3MjVlMzgxNTdjYTkyMWYxN2I3M2JkM2Q4MDI1NjFmOTk2NTYwYjA3MzI3NWUxMDFiZjlmY2UmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.04553Q8hLYMWgP-4FjdxiAikMK4sUKOY12KFj_XbGI8 ]
 
 

1 comment

 
cid:jira-generated-image-avatar-17eeac80-2660-4396-b4a8-1f5c21c2e233 Clemens Robbenhaar on 24/Feb/26 12:50
 

Thanks for filing the bug report - I guess I should have done that.

I think the problem is that the display macro (and this likely the include macro, too) displays block content (almost by definition - they include a complete page content, usually), and that is rendered in an inline context. The WYSIWYG-Editor then sanitizes the HTML and moved the macro output outside the current block in a separate block, this moving it outside the "macro markers".

I can think of two ways to fix the issue:

  • forbid inline use of the display macro - this might break backwards compatibility, especially if the macro is used in scripts where the macro is indented for better readability
  • let the macro renderer smell that it is user in edit mode and an inline context, and then do not display its contents (but maybe a notice why it's content is not displayed, though I am not sure how well this works in line mode.

Any other ideas?