Page MenuHomePhabricator

Show sequence shortcuts in the help dialog (CommandHelpDialog)
Closed, ResolvedPublic8 Estimated Story Points

Description

The help dialog currently uses the trigger registry to help list keyboard shortcuts. We should do a similar thing for the sequence registry so we can output a listing like:

#<space>Numbered list
*<space>Bullet list
==Heading

Things to consider:

  1. Do we need to indicate which sequences must match the start of a paragraph first (e..g list, but not links)
  2. How to generate the descriptions and key sequence labels. Should be easy for the simple ones above for some are regex based.
  3. Some sequences probably shouldn't be listed, e.g. all the auto-linking sequences (http://, ISBN) and the wikitext warning sequences
  4. VE-MW has many more sequences than VE-core so test in both.

Event Timeline

Esanders raised the priority of this task from to Needs Triage.
Esanders updated the task description. (Show Details)
Esanders added a project: VisualEditor.
Esanders subscribed.
Esanders set Security to None.

Potentially some of these can be merged with their existing entries in the CommandHelpDialog, e.g.

Link - CTRL + K, or type [[

Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF edited a custom field.
Jdforrester-WMF moved this task from To Triage to TR0: Interrupt on the VisualEditor board.

Change 248370 had a related patch set uploaded (by DLynch):
Include sequences in the command help dialog

https://gerrit.wikimedia.org/r/248370

Change 248373 had a related patch set uploaded (by DLynch):
Add mediawiki-specific sequences to the command help dialog

https://gerrit.wikimedia.org/r/248373

Following a bunch of feedback, it now looks like:

pasted_file (621×923 px, 79 KB)

This has changed the rendering of existing shortcuts, to use a key-border and to always have a + between the keys to emphasize that they need to be pressed all at once. (Regardless of platform -- the + was always there on PC.)

So there's another group of sequences that we haven't considered here which are extensions' sequences, e.g. "<ref" for citations, or "<syntax" for a code block.

This may affect our design for sequences as putting 7 characters in a box may be too long. We also need a way of extensions registering shortcuts with the dialog (either using the existing sequence registry, or another sequence help registry).

Currently these sequences exist in:

  • Cite & Citoid
  • Math
  • Syntaxhighligh_GeSHi
  • Score
  • wikihiero

Something like <section does indeed turn out a bit long:

pasted_file (89×209 px, 4 KB)

Seems like there's two options:

  1. Have the MWCommandHelpDialog know about them and try to register them, and account for the possibility they're not registered. This is conveniently centralized, but does make it difficult for third-party extensions to ever get in on this action.
  2. Provide some sort of registration call. This is mostly a pain if we want to allow fairly arbitrary positioning of the registered sequences / triggers -- my existing patch is jumping through various hoops to do things like "place the heading sequence immediately after the heading trigger in the list". If we just wanted to drop anything registered into the end of the "other" section it'd be really simple, or even just at the end of any particular named section.

I think extensions can be shows in their own group in an arbitrary order. I'd rather not have references to extensions in VE.

On reflection I think the 'key' styling doesn't quite work for sequences though, because it suggests (partly by using text-transform uppercase which is misleading here) that just pressing the key is what you need to do to trigger the sequence, when in fact it is that you have to type a string into the editor, which is subtly different.

I think if we drop the key styling from sequences the fact we have it on triggers helps distinguish the two better.

Here's a potential styling difference:

pasted_file (631×925 px, 83 KB)

Change 248370 merged by jenkins-bot:
[BREAKING CHANGE] Include sequences in the command help dialog

https://gerrit.wikimedia.org/r/248370

Change 248373 merged by jenkins-bot:
Add mediawiki-specific sequences to the command help dialog

https://gerrit.wikimedia.org/r/248373