There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-5346eaa2-d731-4de3-98ee-d2f0325fd734 XWIKI-25569 Open

Put the cursor in the macro content after inserting a macro whose content is edited in place

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-fca23c1d-6e53-4571-bf48-cd94c2a0431b Changes by Charpentier Lucas on 23/Oct/26 16:18
 
Description: After a macro is inserted, from Quick Actions or by submitting the Edit Macro dialog, the WYSIWYG editor selects the whole macro widget instead of putting the cursor in its content. The user has to click in the content before typing, and text typed right away goes nowhere, or outside the macro: for an inline macro like footnote, it goes before the macro, so "XYZ" typed after inserting a footnote at the end of "A sentence" gives {{A sentence XYZ{{footnote}}My note{{/footnote}}}}.

The fix is done in the macro plugin of the editor, [plugin.js|https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins/src/main/webjar/xwiki-macro/plugin.js]:
* After inserting a macro whose content is edited in place, put the cursor in that content, at its end, whether the macro was inserted from Quick Actions or from the Edit Macro dialog, and whether its content is mandatory or not.
* When the content cannot be edited in place, put the cursor after the macro rather than leaving the widget selected.
* When the content is empty, show a placeholder in it that says what to type, like the focused-line placeholder that the editor already shows, so that an empty content is not just an empty line.

XWIKI-25563 asks for the same cursor placement for the Quick Actions of the macros whose content is mandatory; this issue extends it to every insertion.

Most macros below need their content to be edited in place first, see the Depends on column.

h2. Depends on
* XWIKI-25567, for the cache, container and context macros.
* XWIKI-19978, for the code macro.
* XRENDERING-831, for the comment macro.
* XRENDERING-830 and XWIKI-19954, for the footnote macro.
* XWIKI-25571 and XWIKI-23735, for the gallery macro.
* XWIKI-25570, for the tree macro.
* MATHJAX-40, for the mathjax macro.

h2. KOs covered
||Macro||Criterion||Problem||Depends on||
|[figureCaption|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/figureCaption/]|I4 cursor|After submitting the dialog, the macro widget is selected and the cursor is not in its content: text typed right away goes nowhere.| |
|[cache|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/cache/]|I4 cursor|After submitting the dialog the macro widget is selected and the cursor is not in the content: typed text changes nothing.|XWIKI-25567|
|[container|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/container/]|I4 cursor|After insertion from Quick Actions, the macro is a non-editable placeholder with no content area: typed text goes after the macro.|XWIKI-25567|
|[context|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/context/]|I4 cursor|After the insertion, the macro is a placeholder with no content area: the text typed next goes outside the macro.|XWIKI-25567|
|[code|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/code/]|I4 cursor|After submitting the dialog, the macro widget is selected and the cursor is not in its content: typed text goes nowhere.|XWIKI-19978|
|[comment|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/comment/]|I4 cursor|After submitting the dialog, the macro widget is selected and the cursor is not in its content.|XRENDERING-831|
|[footnote|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/footnote/]|I4 cursor|After submitting the dialog, the macro widget is selected, and text typed right away goes before the footnote number, not after it.|XRENDERING-830, XWIKI-19954|
|[gallery|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/gallery/]|I4 cursor|After submitting the dialog, the macro widget is selected and the cursor is not in its content.|XWIKI-25571, XWIKI-23735|
|[mathjax|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/mathjax/]|I4 cursor|After submitting the dialog, the macro widget is selected and the cursor is not in its content: typed text goes nowhere.|MATHJAX-40|
|[tree|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/tree/]|I4 cursor|After the Quick Actions insertion, a static tree has no content area: typed text goes outside the macro, and nodes are added only as a wiki syntax list in the Edit Macro dialog.|XWIKI-25570|
|[content|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/content/]|I2 zero-config|Minor. Inserted from Quick Actions or by the Edit Macro dialog with the default values, the macro is {{{{content}} {{/content}}}}: an empty content that renders nothing in view mode and only an empty line in the editor, with no placeholder saying what it is.| |

h2. Impact found on macro fluidity
These
10 11 KOs come from the [WYSIWYG usability audit of the macros|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Macros/], under the criterion criteria I4 cursor and I2 zero-config of its [usability criteria|https://design.xwiki.org/xwiki/bin/view/Proposal/WYSIWYGusabilityofXWikimacros/Usability%20criteria/], which asks ask that after insertion the cursor is in the macro content, so the user can keep typing without an extra click , and that inserting a macro with only default values gives a sensible result . The page of each macro, linked in the table, has the full notes and the steps to reproduce. This issue fixes figureCaption and content on its own; the other macros also need their content to be edited in place, which the issues listed under Depends on cover.