diff --git a/resources/modules/ve-cm/ve.ui.CodeMirror.init.js b/resources/modules/ve-cm/ve.ui.CodeMirror.init.js index 557a4ebe..43518d08 100644 --- a/resources/modules/ve-cm/ve.ui.CodeMirror.init.js +++ b/resources/modules/ve-cm/ve.ui.CodeMirror.init.js @@ -1,10 +1,16 @@ mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () { mw.libs.ve.targetLoader.addPlugin( function () { var target = ve.init.mw.DesktopArticleTarget; - if ( target ) { - var index = target.static.actionGroups[ 1 ].include.indexOf( 'changeDirectionality' ); - target.static.actionGroups[ 1 ].include.splice( index, 0, 'codeMirror' ); + var groups = target.static.toolbarGroups.concat( target.static.actionGroups ); + groups.some( function ( group ) { + if ( group.name === 'pageMenu' ) { + var index = group.include.indexOf( 'changeDirectionality' ); + group.include.splice( index, 0, 'codeMirror' ); + return true; + } + return false; + } ); } } ); } );