This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-dc69365b-1354-4963-8872-083f9032e136 XWIKI-25575 Open

Add a field for macro content source references in the Edit Macro dialog

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-20a4130e-7251-4490-88c3-9fd9576597c7 Charpentier Lucas created this issue on 23/Oct/26 16:15
 
Summary: Add a field for macro content source references in the Edit Macro dialog
Issue Type: cid:jira-generated-image-avatar-dc69365b-1354-4963-8872-083f9032e136 Improvement
Affects Versions: 17.10.14, 18.8.0
Assignee: Unassigned
Components: Rendering - Code Macro, Rendering - Context Macro, WYSIWYG Editor
Created: 23/Oct/26 16:15
Priority: cid:jira-generated-image-static-major-21e9ddac-70db-470a-a4f7-e7afcdc0fe46 Major
Reporter: Charpentier Lucas
Description:

The source parameter of the code and context macros is a reference to the content to use, written as "type:value", like page:Space.Page, attachment:Space.Page@file.txt or script:myvariable. It is declared with the MacroContentSourceReference type, which has no field in the Edit Macro dialog, so it falls back to a plain text field: the user has to know the types and the syntax of each reference, and gets no page or attachment picker where one applies.

The macros using this type:

The improvement is a field for this type in the Edit Macro dialog, an html_displayer template for macrocontentsourcereference: a select of the type, then a value input that is the page picker for the page and document types, the attachment picker for the attachment types, and a text field for the others. It needs design work first:

  • The type defines 11 types, string, script, url, file, entity, document, page, object_property, page_object_property, attachment and page_attachment, while each macro supports only some of them: the macro would need to declare which ones it accepts, or the field would offer types that fail at rendering with "Unsupported source type".
  • Some types, like script and string, cannot have a picker.

The office macro has a field for its own typed resource reference, officeresourcereference/edit.vm, which can serve as a starting point.

Related issues: XWIKI-25456, to offer the source and the content as alternatives, and XWIKI-25477, which improves the description of the source parameter of the context macro.

KOs covered

Macro Criterion Parameter Problem
code C4 input-assistance source A free text field for a typed reference, like "page:Page/SubPage" or "attachment:Space.Page@file.txt", with no page or attachment picker: the user has to know the syntax of the reference.
context C4 input-assistance source A free text field for a typed reference, with no picker for the types that could have one, like a page: the user has to know the syntax.

Impact found on macro fluidity

These 2 KOs come from the WYSIWYG usability audit of the macros, under the criterion C4 input-assistance of its usability criteria, which asks that each parameter uses an appropriate input, such as a picker. The page of each macro, linked in the table, has the full notes and the steps to reproduce.