jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/367882 )

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


Generate heading1-6 commands in a loop

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

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



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: merged
Gerrit-Change-Id: I0f6af5deb4258786907e4419f8002c4d285e64a5
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to