Editbutton for math

Move the code that creates the Editbutton for math from core,
where it is removed in Ib17aa47c7d647e1ed293541adbdd1aa77e25e59e.

Imported button image from:
ssh://gerrit.wikimedia.org:29418/mediawiki/core.git/skins/common/button_math.png

We don't need to vary the icon per language, because there is not a
single language that has a non default icon.

Bug: 60471
Change-Id: I3d126c1c252c27fa65ab8fb42ffab66a2d99cfa8
This commit is contained in:
Moritz Schubotz 2014-01-26 00:09:06 +01:00 committed by Moritz Schubotz (Physikerwelt)
parent 24f2ed2c5e
commit 9f7a1e51c4
4 changed files with 32 additions and 0 deletions

View File

@ -269,4 +269,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

@ -153,6 +153,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';
@ -403,6 +404,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 ) );