From 9f7a1e51c4c9d9fb053f1795c265b2fadc704108 Mon Sep 17 00:00:00 2001 From: Moritz Schubotz Date: Sun, 26 Jan 2014 00:09:06 +0100 Subject: [PATCH] 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 --- Math.hooks.php | 10 ++++++++++ Math.php | 9 +++++++++ images/button_math.png | Bin 0 -> 617 bytes modules/ext.math.editbutton.js | 13 +++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 images/button_math.png create mode 100644 modules/ext.math.editbutton.js diff --git a/Math.hooks.php b/Math.hooks.php index 2a1827b..0be3970 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -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' ) ); + } } diff --git a/Math.php b/Math.php index b2a5847..27f934d 100644 --- a/Math.php +++ b/Math.php @@ -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', diff --git a/images/button_math.png b/images/button_math.png new file mode 100644 index 0000000000000000000000000000000000000000..507e4b51f56b56eeedf6b7edaa6a49d60731acf0 GIT binary patch literal 617 zcmV-v0+#)WP)$#mZ@uYhGcGio2$WG zW^*(-KtM-OS72;jXm=SLAgH_5qqff~E;XgN(lt9nTxN8nx6l$57lDwZm#D#ch?@Wa z0EU&SqqfjuZGB;Ee4w+<1_lRpgOwT`A)m3zPFG}}vCEyX$s{N)Fg8A%ugN1QEt;*y ze~zOJ4G(5=gF#7DS!8p4jG>yX$7yzm1Ox?wlBi^GfmL5^kfFM6dybc?!(VHAc!ryo zs>GJ5!xtJJJVQ<>Ei{s(y_2TER$_4h0RmKCZjhtBj-a|IEj5jxxrUgrb%>*Y;h~8D z000SaNLh0L002k;002k;M#*bF0001_Nkl-G5Cx~n5F*IV``^&5iUBmk z&sb*T+ssr~CwY-_K&m3w|M*LD3ASw#70vj(Z5mZvrce8xxMuq2tofO)L@&>UH<|7r zKzldde(5j-Som7QF^bd)w+FvojxtK^!5Qy3gY1W5sG)x(-kYjmEgHu01YlgSMC;`l zB*3k=dp5rRC#AFL*GJRHqh', + tagClose: '', + sampleText: mw.msg( 'math_sample' ), + imageId: 'mw-editbutton-math' + } ); + } +} ( mediaWiki ) );