Page MenuHomePhabricator

Be able to insert horizontal rules (<hr> or ----)
Closed, ResolvedPublic

Description

Since T52770, we have been able to delete existing horizontal rules, but we still can't insert them. There is no item in the Insert menu for it. If you type the wikitext (----), the code gets nowiki'd. It should be possible to insert a horizontal rule on a page.

Event Timeline

Change 448067 had a related patch set uploaded (by DLynch; owner: DLynch):
[VisualEditor/VisualEditor@master] Add Horizontal Rules to the insert menu

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

Change 448068 had a related patch set uploaded (by DLynch; owner: DLynch):
[VisualEditor/VisualEditor@master] Clean up after sequence insertion

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

Change 448074 had a related patch set uploaded (by DLynch; owner: DLynch):
[mediawiki/extensions/VisualEditor@master] Add horizontal rule sequence (----)

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

Are we happy to add this to an already crowded insert menu? Is there a common use case on namespaces that use VE?

CC @Deskana

According to https://en.wikipedia.org/wiki/MOS:----, horizontal rules should not be used in articles. I don't know if such a rule is codified in other wikis, but this is definitely a common convention on Wikipedias.

We might want to make it a "secret" feature in MW (e.g. only allow inserting via a ---- sequence), or disable it in some namespaces (similar to how we handle signatures).

The old toolbar has a discouraging "Horizontal line (use sparingly)" as tooltip, WikiEditor doesn't have it at all. But I think as a sequence-only command (without tool in the toolbar) it does make sense, though you might want to limit the sequence to take only effect at the start of a paragraph and not inside the text (as that's how it works in wikitext).

Are we happy to add this to an already crowded insert menu?

No, and figuring out another way of doing this sensibly isn't a priority given that it's rarely used in the main namespaces on our largest projects.

Current version of the patches only implements inserting horizontal rules by typing ----. I think that's an uncontroversial improvement, and it is easy to support in the future (comparable to the {| sequence to insert a table that we already have), so I'm going to merge them.

Change 448067 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Add Horizontal Rule insert command

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

Change 448068 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Clean up after sequence insertion

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

Change 449794 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (3c30cac86)

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

Change 449794 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (3c30cac86)

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

Change 448074 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Add horizontal rule sequence (----)

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

Current version of the patches only implements inserting horizontal rules by typing ----. I think that's an uncontroversial improvement, and it is easy to support in the future (comparable to the {| sequence to insert a table that we already have), so I'm going to merge them.

Typing ---- is adding horizontal rule now. But copy-pasting isn't. Would that be a separate implementation?

It's the same as how pasting * doesn't make it become a list item. Which maybe it should? Not sure.

Yes, "sequences" are only triggered if you actually type them (or at least the last character). I consider them in the same class a keyboard shortcuts, so for me that makes sense.

Yes, "sequences" are only triggered if you actually type them (or at least the last character). I consider them in the same class a keyboard shortcuts, so for me that makes sense.

Got it.

Yes, "sequences" are only triggered if you actually type them (or at least the last character). I consider them in the same class a keyboard shortcuts, so for me that makes sense.

The ve.ui.Sequence constructor actually does have a checkOnPaste option, but as you said, this isn't normally used, only for magic links (see ve.ui.MWLinkAction.js).

That's enough. Figuring out a way to add it into the menu is out of scope.