Kaldari has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/364324 )
Change subject: Make sure enhanced editing toolbar is loaded before adding button ...................................................................... Make sure enhanced editing toolbar is loaded before adding button Bug: T169943 Change-Id: Id8828b0d49ecec5124430d15445739d73795d164 --- M resources/ext.CodeMirror.js 1 file changed, 10 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeMirror refs/changes/24/364324/1 diff --git a/resources/ext.CodeMirror.js b/resources/ext.CodeMirror.js index 81c7506..eb7c7be 100644 --- a/resources/ext.CodeMirror.js +++ b/resources/ext.CodeMirror.js @@ -434,15 +434,20 @@ } } - /* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */ + // If view is in edit mode, add the button to the toolbar. if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) { + // Check if the user is using the enhanced editing toolbar (supplied by the + // WikiEditor extension) or the default editing toolbar (supplied by core). if ( wikiEditorToolbarEnabled ) { - // Add our button - $( addCodeMirrorToWikiEditor ); + // They are using the enhanced editing toolbar. + mw.loader.using( 'ext.wikiEditor.toolbar', function () { + // Add CodeMirror button to the enhanced editing toolbar. + $( addCodeMirrorToWikiEditor ); + } ); } else { - // Load wikiEditor's toolbar and add our button + // They are using the default editing toolbar. mw.loader.using( 'mediawiki.toolbar', function () { - // If WikiEditor isn't enabled, add CodeMirror button to the default wiki editor toolbar + // Add CodeMirror button to the default editing toolbar. mw.toolbar.addButton( { speedTip: mw.msg( 'codemirror-toggle-label' ), imageId: 'mw-editbutton-codemirror', -- To view, visit https://gerrit.wikimedia.org/r/364324 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id8828b0d49ecec5124430d15445739d73795d164 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CodeMirror Gerrit-Branch: master Gerrit-Owner: Kaldari <rkald...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits