mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-27 17:50:44 +00:00
Revert "Keyboard shortcuts for formatting tools in WikiEditor 2010"
This reverts commit 250a2a3ff3
.
Reason for revert: For me (I use the Dvorak keyboard), this makes Ctrl+C and Ctrl+V to copy/paste completely unusable. My "c" key is physically the "I" key (`KeyI`), and the "V" key is physically the "." key (`Period`).
When dealing with shortcuts like this, one should use `KeyboardEvent.key`, not `KeyboardEvent.code`.
Bug: T62928
Change-Id: I64f625e0f32bd699790417d0d74a14251ac7dc36
This commit is contained in:
parent
250a2a3ff3
commit
b937a0afc6
|
@ -246,7 +246,6 @@
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"mediawiki.cookie",
|
"mediawiki.cookie",
|
||||||
"jquery.client",
|
|
||||||
"jquery.textSelection",
|
"jquery.textSelection",
|
||||||
"jquery.ui",
|
"jquery.ui",
|
||||||
"mediawiki.api",
|
"mediawiki.api",
|
||||||
|
|
|
@ -42,8 +42,7 @@ module.exports = {
|
||||||
action: {
|
action: {
|
||||||
type: 'dialog',
|
type: 'dialog',
|
||||||
module: 'insert-link'
|
module: 'insert-link'
|
||||||
},
|
}
|
||||||
hotkey: 'KeyK'
|
|
||||||
},
|
},
|
||||||
file: {
|
file: {
|
||||||
label: mw.msg( 'wikieditor-toolbar-tool-file' ),
|
label: mw.msg( 'wikieditor-toolbar-tool-file' ),
|
||||||
|
|
|
@ -45,8 +45,7 @@ toolbarConfig = {
|
||||||
peri: mw.msg( 'wikieditor-toolbar-tool-bold-example' ),
|
peri: mw.msg( 'wikieditor-toolbar-tool-bold-example' ),
|
||||||
post: "'''"
|
post: "'''"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hotkey: 'KeyB'
|
|
||||||
},
|
},
|
||||||
italic: {
|
italic: {
|
||||||
section: 'main',
|
section: 'main',
|
||||||
|
@ -62,8 +61,7 @@ toolbarConfig = {
|
||||||
peri: mw.msg( 'wikieditor-toolbar-tool-italic-example' ),
|
peri: mw.msg( 'wikieditor-toolbar-tool-italic-example' ),
|
||||||
post: "''"
|
post: "''"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hotkey: 'KeyI'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -208,8 +206,7 @@ toolbarConfig = {
|
||||||
peri: mw.msg( 'wikieditor-toolbar-tool-nowiki-example' ),
|
peri: mw.msg( 'wikieditor-toolbar-tool-nowiki-example' ),
|
||||||
post: '</nowiki>'
|
post: '</nowiki>'
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hotkey: 'Backslash'
|
|
||||||
},
|
},
|
||||||
newline: {
|
newline: {
|
||||||
label: mw.msg( 'wikieditor-toolbar-tool-newline' ),
|
label: mw.msg( 'wikieditor-toolbar-tool-newline' ),
|
||||||
|
@ -263,8 +260,7 @@ toolbarConfig = {
|
||||||
peri: mw.msg( 'wikieditor-toolbar-tool-superscript-example' ),
|
peri: mw.msg( 'wikieditor-toolbar-tool-superscript-example' ),
|
||||||
post: '</sup>'
|
post: '</sup>'
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hotkey: 'Period'
|
|
||||||
},
|
},
|
||||||
subscript: {
|
subscript: {
|
||||||
label: mw.msg( 'wikieditor-toolbar-tool-subscript' ),
|
label: mw.msg( 'wikieditor-toolbar-tool-subscript' ),
|
||||||
|
@ -277,8 +273,7 @@ toolbarConfig = {
|
||||||
peri: mw.msg( 'wikieditor-toolbar-tool-subscript-example' ),
|
peri: mw.msg( 'wikieditor-toolbar-tool-subscript-example' ),
|
||||||
post: '</sub>'
|
post: '</sub>'
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hotkey: 'Comma'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -359,9 +359,6 @@ var toolbarModule = {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
if ( 'hotkey' in tool ) {
|
|
||||||
toolbarModule.fn.ctrlShortcuts[ tool.hotkey ] = tool;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $button;
|
return $button;
|
||||||
case 'select':
|
case 'select':
|
||||||
|
@ -789,21 +786,6 @@ var toolbarModule = {
|
||||||
// Use hook for attaching new toolbar tools to avoid race conditions
|
// Use hook for attaching new toolbar tools to avoid race conditions
|
||||||
mw.hook( 'wikiEditor.toolbarReady' ).fire( context.$textarea );
|
mw.hook( 'wikiEditor.toolbarReady' ).fire( context.$textarea );
|
||||||
} );
|
} );
|
||||||
toolbarModule.fn.setupShortcuts( context );
|
|
||||||
},
|
|
||||||
ctrlShortcuts: {},
|
|
||||||
setupShortcuts: function ( context ) {
|
|
||||||
var platform = $.client.profile().platform;
|
|
||||||
var modifierKey = platform === 'mac' ? 'metaKey' : 'ctrlKey';
|
|
||||||
|
|
||||||
context.$textarea.on( 'keydown', function ( e ) {
|
|
||||||
// Check if modifier key is pressed and hotkey is recognised
|
|
||||||
var target = e[ modifierKey ] && toolbarModule.fn.ctrlShortcuts[ e.code ];
|
|
||||||
if ( target ) {
|
|
||||||
e.preventDefault();
|
|
||||||
toolbarModule.fn.doAction( context, target.action );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
},
|
},
|
||||||
handleKeyDown: function ( $element, event, $parent ) {
|
handleKeyDown: function ( $element, event, $parent ) {
|
||||||
var $currentItem = $element.find( '.wikiEditor-character-highlighted' ),
|
var $currentItem = $element.find( '.wikiEditor-character-highlighted' ),
|
||||||
|
|
Loading…
Reference in a new issue