Benutzer:WikiSysop/common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K |
K |
||
Zeile 1: | Zeile 1: | ||
// Check if we're editing a page. | // Check if we're editing a page. | ||
− | if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { | + | if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { |
// Add a hook handler. | // Add a hook handler. | ||
mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { | ||
// Configure a new toolbar entry on the given $textarea jQuery object. | // Configure a new toolbar entry on the given $textarea jQuery object. | ||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
− | section: ' | + | |
− | group: ' | + | section: 'advanced', |
+ | group: 'format', | ||
tools: { | tools: { | ||
− | + | math: { | |
− | + | label: 'Math', | |
− | + | type: 'button', | |
− | + | oouiIcon: 'mathematics', | |
− | + | action: { | |
− | + | type: 'encapsulate', | |
− | + | options: { | |
− | + | pre: '<math>', | |
− | + | post: '</math>' | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | } | ||
− | |||
} | } | ||
} | } | ||
} | } | ||
+ | |||
} ); | } ); | ||
} ); | } ); | ||
} | } |
Version vom 17. Dezember 2024, 23:56 Uhr
// Check if we're editing a page. if ( [ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' ) ) !== -1 ) { // Add a hook handler. mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) { // Configure a new toolbar entry on the given $textarea jQuery object. $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', group: 'format', tools: { math: { label: 'Math', type: 'button', oouiIcon: 'mathematics', action: { type: 'encapsulate', options: { pre: '<math>', post: '</math>' } } } } } ); } ); }