Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367882 )

Change subject: Generator heading1-6 commands in a loop
......................................................................

Generator heading1-6 commands in a loop

Change-Id: I0f6af5deb4258786907e4419f8002c4d285e64a5
---
M src/ui/ve.ui.CommandRegistry.js
1 file changed, 11 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/82/367882/1

diff --git a/src/ui/ve.ui.CommandRegistry.js b/src/ui/ve.ui.CommandRegistry.js
index 759d693..b9940f8 100644
--- a/src/ui/ve.ui.CommandRegistry.js
+++ b/src/ui/ve.ui.CommandRegistry.js
@@ -205,42 +205,17 @@
                { args: [ 'paragraph' ], supportedSelections: [ 'linear' ] }
        )
 );
-ve.ui.commandRegistry.register(
-       new ve.ui.Command(
-               'heading1', 'format', 'convert',
-               { args: [ 'heading', { level: 1 } ], supportedSelections: [ 
'linear' ] }
-       )
-);
-ve.ui.commandRegistry.register(
-       new ve.ui.Command(
-               'heading2', 'format', 'convert',
-               { args: [ 'heading', { level: 2 } ], supportedSelections: [ 
'linear' ] }
-       )
-);
-ve.ui.commandRegistry.register(
-       new ve.ui.Command(
-               'heading3', 'format', 'convert',
-               { args: [ 'heading', { level: 3 } ], supportedSelections: [ 
'linear' ] }
-       )
-);
-ve.ui.commandRegistry.register(
-       new ve.ui.Command(
-               'heading4', 'format', 'convert',
-               { args: [ 'heading', { level: 4 } ], supportedSelections: [ 
'linear' ] }
-       )
-);
-ve.ui.commandRegistry.register(
-       new ve.ui.Command(
-               'heading5', 'format', 'convert',
-               { args: [ 'heading', { level: 5 } ], supportedSelections: [ 
'linear' ] }
-       )
-);
-ve.ui.commandRegistry.register(
-       new ve.ui.Command(
-               'heading6', 'format', 'convert',
-               { args: [ 'heading', { level: 6 } ], supportedSelections: [ 
'linear' ] }
-       )
-);
+( function () {
+       var level;
+       for ( level = 1; level <= 6; level++ ) {
+               ve.ui.commandRegistry.register(
+                       new ve.ui.Command(
+                               'heading' + level, 'format', 'convert',
+                               { args: [ 'heading', { level: level } ], 
supportedSelections: [ 'linear' ] }
+                       )
+               );
+       }
+}() );
 ve.ui.commandRegistry.register(
        new ve.ui.Command(
                'preformatted', 'format', 'convert',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f6af5deb4258786907e4419f8002c4d285e64a5
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

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

Reply via email to