[go: up one dir, main page]

Page MenuHomePhabricator

WikiEditor: Provide some basic formatting and action keyboard shortcut commands
Closed, ResolvedPublicFeature

Description

CTRL/CMD+B for bolding highlighted text
CTRL/CMD+I for italicising highlighted text
CTRL/CMD+U for underline highlighted text

CTRL+1,2,3 for H1,H2, H3, etc

CTRL/CMD+K for linking highlighted text


Version: master
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:59 AM
bzimport set Reference to bz60928.
bzimport added a subscriber: Unknown Object (MLST).

Moving to WikiEditor; we're probably going to kill the difference between the two, but for now…

I think it is very unlikely this will ever be added to WikiEditor (2010), now that we have VisualEditor-MediaWiki-2017WikitextEditor providing this functionality.

In the meantime, https://ru.wikipedia.org/wiki/Участник:Stjn/wikiEditorShortcuts.js provides similar functionality. But I do think that all modes of editing need to have the same keyboard shortcuts (at least where that makes sense) for a better user experience.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:23 PM

I'm about to implement the shortcuts in Convenient-Discussions as this is requested by users and I would rather not implement this apart from WikiEditor which Convenient Discussions employs. But if there is no activity in this task, I will have to.

I think it is very unlikely this will ever be added to WikiEditor (2010), now that we have VisualEditor-MediaWiki-2017WikitextEditor providing this functionality.

As time has shown, the majority of users didn't migrate to that.

Change #1077335 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/WikiEditor@master] Keyboard shortcuts for formatting tools in WikiEditor 2010

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

Change #1077335 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Keyboard shortcuts for formatting tools in WikiEditor 2010

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

The currently merged patch is a step in the good direction, but it doesn’t contain any indication for editors that they can press certain shortcuts to press the buttons. Would be good to add that.

@SD0001 also, just as a note, is Ctrl+1/2/3/4/5 not being a thing intentional? Those are available in the visual editor and seem very useful to have.

Change #1078939 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/extensions/WikiEditor@master] Revert "Keyboard shortcuts for formatting tools in WikiEditor 2010"

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

Submitted the revert above because the patch basically makes it impossible for me to copy/paste things, since it hijacks Ctrl+C and Ctrl+V on dvorak keyboards (and possibly other layouts too?). The revert commit message has suggestions for how to fix this.

Change #1078960 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/WikiEditor@master] shortcuts: Use KeyboardEvent.key instead of KeyboardEvent.code

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

AFAIK he new provided patch and the suggestion would make it impossible to use this feature for people on non-Latin keyboards (since e.key for K doesn’t match to K or k on a Russian keyboard, it would match to Л or л), therefore reducing the usability of this tremendously. I understand the concern with Dvorak keyboards, but maybe there are better ways to resolve this than this.

AFAIK he new provided patch and the suggestion would make it impossible to use this feature for people on non-Latin keyboards (since e.key for K doesn’t match to K or k on a Russian keyboard, it would match to Л or л), therefore reducing the usability of this tremendously. I understand the concern with Dvorak keyboards, but maybe there are better ways to resolve this than this.

Did you test this? My understanding is that when Cmd/Ctrl modifiers are held pressed, e.key will be k even on a non-Latin keyboard. Caps lock also doesn't make a difference with Cmd/Ctrl pressed, e.key is always in lowercase.

Only like this:

$( '#wpTextbox1' ).on( 'keydown', ( e ) => {
	console.log( e.key );
} );

image.png (243×506 px, 4 KB)

Restating my comment on the gerrit changeset, I'd suggest that we revert first and try again after. Is that okay @SD0001?

Change #1078939 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Revert "Keyboard shortcuts for formatting tools in WikiEditor 2010"

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

Noting that I am now unable to copy/paste in the editor since I use Dvorak. It looks like this will be reverted by next Thursday, but any workaround in the meantime?

Workaround is to turn on syntax highlighting. The shortcuts don't work with CodeMirror enabled.

Workaround is to turn on syntax highlighting. The shortcuts don't work with CodeMirror enabled.

That seems like another issue to fix if this gets re-added, btw. https://ru.wikipedia.org/wiki/Участник:Stjn/wikiEditorShortcuts.js#L-132 shows how.

@Leijurv @jhsoby as Dvorak keyboard users, can you tell us if this problem is also present in VisualEditor? https://en.wikipedia.org/w/index.php?title=Draft:Sandbox&veaction=edit (visual mode) or https://en.wikipedia.org/w/index.php?title=Draft:Sandbox&veaction=editsource (source mode)

If it is, it might be good to create/use a JS solution to solve a separate issue for all editing environments. There is also a possibility that people with QWERTZ layout (German) might be confused when Ctrl+Z/Ctrl+Y work differently. I’ve found some attempts from people to solve this, though maybe it is already solved in VE: https://stackoverflow.com/questions/70211837/keyboard-shortcuts-commands-on-non-latin-alphabet-keyboards-javascript

Both of those links work fine! The only issue for me is in the normal editor ("action=edit"), when syntax highlighting is off.

Change #1078960 abandoned by SD0001:

[mediawiki/extensions/WikiEditor@master] shortcuts: Use KeyboardEvent.key instead of KeyboardEvent.code

Reason:

KeyboardEvent.key is no good either, will

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

Change #1079588 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/WikiEditor@master] Retry adding keyboard shortcuts for formatting tools in WikiEditor 2010

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

This is quite frustrating for dvorak users ... any timeframe for it being reverted / help pointing out how to turn syntax highlighting on? Surprised this wasn't mentioned in yesterday's Tech News.

To turn on syntax highlighting, click the highlighter icon in the toolbar.

Screenshot 2024-10-16 at 12.05.10 AM.png (456×1 px, 75 KB)

To turn on syntax highlighting, click the highlighter icon in the toolbar.

Screenshot 2024-10-16 at 12.05.10 AM.png (456×1 px, 75 KB)

Aah, thanks! That workaround does work well.

Change #1080802 had a related patch set uploaded (by SD0001; author: SD0001):

[mediawiki/extensions/CodeMirror@master] CodeMirror support for WikiEditor keyboard shortcuts

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

Change #1079588 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Retry adding keyboard shortcuts for formatting tools in WikiEditor 2010

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

Change #1080802 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirror support for WikiEditor keyboard shortcuts

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

SD0001 claimed this task.
SD0001 added a project: User-notice.

Suggested blurb: The 2010 wikitext editor now supports common keyboard shortcuts such Ctrl-B for bold and Ctrl-I for italics. (?) Full list of shortcuts: mw:Help:Extension:WikiEditor#Keyboard_shortcuts.

I still think Ctrl+1/2/3/4/5/6 should’ve been also added. It was also in the task description. I don’t think resolving this task without it is satisfactory enough.

You can file a separate task for that – those are more controversial as they conflict with browser shortcuts for navigating between tabs on Windows. This ticket is for "basic formatting and action keyboard shortcut commands". (Not to mention being harder to implement as the VE behaviour is to use Control key instead of Cmd on Mac.)

I disagree that those are not basic action keyboard shortcuts, especially as they were mentioned in the task description, but nonetheless created T380087: WikiEditor: Provide all useful shortcuts from visual editor.