DLynch has uploaded a new change for review.

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

Change subject: Add mediawiki-specific sequences to the command help dialog
......................................................................

Add mediawiki-specific sequences to the command help dialog

The extension registers a lot of sequences that don't apply to core
VisualEditor. Pretty much the opposite of the trigger situation, where
almost all are in core. So, merge them into the help dialog.

This relies on I21fd47f5809dce36d10edc483121ecbdc12071f6 being landed
on lib/ve.

Bug: T116013
Change-Id: I5ad2939c10140b954fb29e1e50414ab7d79aeab7
---
M modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js
1 file changed, 43 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/73/248373/1

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js
index 6c26e44..a655ffe 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWCommandHelpDialog.js
@@ -31,7 +31,49 @@
 ve.ui.MWCommandHelpDialog.static.getCommandGroups = function () {
        var commandGroups = 
ve.ui.MWCommandHelpDialog.super.static.getCommandGroups.call( this ),
                accessKeyPrefix = 
mw.util.tooltipAccessKeyPrefix.toUpperCase().replace( /-/g, ' + ' ),
-               save = ve.msg( 'accesskey-save' );
+               save = ve.msg( 'accesskey-save' ),
+               mergeGroups, i, groupName;
+
+       // Some commands need a sequence added in:
+       mergeGroups = {
+               textStyle: {
+                       'visualeditor-annotationbutton-link-tooltip': { 
sequence: [ 'wikitextLink' ] }
+               },
+               formatting: {
+                       'visualeditor-formatdropdown-format-blockquote': { 
sequence: [ 'wikitextDescription' ] },
+                       'visualeditor-listbutton-number-tooltip': { sequence: [ 
'numberHash' ] }
+               }
+       }
+       for ( groupName in mergeGroups ) {
+               for ( i = commandGroups[ groupName ].commands.length - 1; i >= 
0; i-- ) {
+                       if ( mergeGroups[ groupName ][ commandGroups[ groupName 
].commands[ i ].msg ] ) {
+                               if ( commandGroups[ groupName ].commands[ i 
].sequence ) {
+                                       commandGroups[ groupName ].commands[ i 
].sequence = commandGroups[ groupName ].commands[ i ].sequence.concat( 
mergeGroups[ groupName ][ commandGroups[ groupName ].commands[ i ].msg 
].sequence );
+                               } else {
+                                       commandGroups[ groupName ].commands[ i 
].sequence = mergeGroups[ groupName ][ commandGroups[ groupName ].commands[ i 
].msg ].sequence;
+                               }
+                       }
+               }
+       }
+
+       // Some commands need a new command added right after them:
+       for (i = commandGroups.formatting.commands.length - 1; i >= 0; i--) {
+               if ( commandGroups.formatting.commands[ i ].msg === 
'visualeditor-formatdropdown-format-heading-label' ) {
+                       commandGroups.formatting.commands.splice( i + 1, 0, {
+                               msg: 
'visualeditor-formatdropdown-format-heading2',
+                               sequence: [ 'wikitextHeading' ]
+                       } );
+                       break;
+               }
+       };
+
+       // And a few entirely new commands
+       commandGroups.other.commands.push(
+               {
+                       sequence: [ 'wikitextTemplate' ],
+                       msg: 'visualeditor-dialog-transclusion-add-template'
+               }
+       );
 
        if ( save !== '-' && save !== '' ) {
                commandGroups.other.commands.push(

-- 
To view, visit https://gerrit.wikimedia.org/r/248373
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ad2939c10140b954fb29e1e50414ab7d79aeab7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to