Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25569

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

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 17.10.14, 18.8.0
    • CKEditor
    • None
    • Unknown

    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:

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

      Depends on

      KOs covered

      Macro Criterion Problem Depends on
      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 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 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 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 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 I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content. XRENDERING-831
      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 I4 cursor After submitting the dialog, the macro widget is selected and the cursor is not in its content. XWIKI-25571, XWIKI-23735
      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 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 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.  

      Impact found on macro fluidity

      These 11 KOs come from the WYSIWYG usability audit of the macros, under the criteria I4 cursor and I2 zero-config of its usability criteria, which 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Lucas C Charpentier Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: