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

Insert the code macro from Quick Actions without the Edit Macro dialog

    XMLWordPrintable

Details

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

    Description

      The "Code Snippet" Quick Action opens the Edit Macro dialog with an empty Content text area, and the code macro is only inserted after the code is typed there and the dialog submitted. The Quick Actions of the other wrapper macros, like warning, insert the macro right away with its content area, and XWIKI-25563 extends this to the macros whose content is their only mandatory field. The code macro has no mandatory field, but its Quick Action is declared to always open the dialog.

      The fix is done in the Quick Actions plugin of the editor, plugin.js, in the macro-code action, which runs the xwiki-macro command that opens the dialog: insert the macro directly instead, with an empty code area and the cursor in it, as soon as the code can be edited in place, see XWIKI-19978. The language can then be chosen from the macro, or from the Edit Macro dialog. An empty code macro, inserted from Quick Actions or by the Edit Macro dialog with the default values, must then show that empty code area, ready to be filled, rather than an empty grey frame.

      Depends on

      • XWIKI-19978, which makes the code of the code macro editable in place.

      KOs covered

      Macro Criterion Problem Depends on
      code I1 pattern The reference wrapper, warning, is inserted by its Quick Action without a dialog; the "Code Snippet" Quick Action opens the Edit Macro dialog. XWIKI-19978
      code I3 instant "/code" then Enter, entry "Code Snippet", opens the Edit Macro dialog with an empty Content text area; the macro is only inserted after submitting it. XWIKI-19978
      code I2 zero-config Submitting the Edit Macro dialog with the default values inserts {{code}}{{/code}}, which renders an empty grey box in the editor and in view mode: the user expects a code block and sees an empty frame. XWIKI-19978

      Impact found on macro fluidity

      These 3 KOs come from the WYSIWYG usability audit of the macros, under the criteria I1 pattern, I3 instant and I2 zero-config of its usability criteria, which check that a macro is inserted the same common way as the reference macro of its type, here warning, that the Quick Action inserts it right away, without the Edit Macro dialog, and that inserting it with only default values gives a sensible result. The page of the macro, linked in the table, has the full notes and the steps to reproduce.

      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: