Merge "Editbutton for math"

This commit is contained in:
jenkins-bot 2014-04-07 09:33:56 +00:00 committed by Gerrit Code Review
commit ea48a4442f
4 changed files with 32 additions and 0 deletions

View File

@ -270,4 +270,14 @@ class MathHooks {
return true;
}
/**
*
* @global type $wgOut
* @param type $toolbar
*/
static function onEditPageBeforeEditToolbar( &$toolbar ) {
global $wgOut;
$wgOut->addModules( array( 'ext.math.editbutton.enabler' ) );
}
}

View File

@ -163,6 +163,7 @@ $wgHooks['LoadExtensionSchemaUpdates'][] = 'MathHooks::onLoadExtensionSchemaUpda
$wgHooks['ParserTestTables'][] = 'MathHooks::onParserTestTables';
$wgHooks['UnitTestsList'][] = 'MathHooks::onRegisterUnitTests';
$wgHooks['PageRenderingHash'][] = 'MathHooks::onPageRenderingHash';
$wgHooks['EditPageBeforeEditToolbar'][] = 'MathHooks::onEditPageBeforeEditToolbar';
$dir = __DIR__ . '/';
$wgAutoloadClasses['MathHooks'] = $dir . 'Math.hooks.php';
@ -419,6 +420,14 @@ $moduleTemplate = array(
'remoteExtPath' => 'Math/modules',
);
$wgResourceModules['ext.math.editbutton.enabler'] = array(
'scripts' => 'ext.math.editbutton.js',
'messages' => array(
'math_tip',
'math_sample',
),
) + $moduleTemplate;
$wgResourceModules['ext.math.visualEditor'] = array(
'scripts' => array(
'VisualEditor/ve.dm.MWMathNode.js',

BIN
images/button_math.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

View File

@ -0,0 +1,13 @@
( function ( mw ) {
if ( mw.toolbar ) {
var iconPath = mw.config.get( 'wgExtensionAssetsPath' ) + '/Math/images/';
mw.toolbar.addButton( {
imageFile: iconPath + 'button_math.png',
speedTip: mw.msg( 'math_tip' ),
tagOpen: '<math>',
tagClose: '</math>',
sampleText: mw.msg( 'math_sample' ),
imageId: 'mw-editbutton-math'
} );
}
} ( mediaWiki ) );