Benutzer:WikiSysop/common.js: Unterschied zwischen den Versionen

Aus Mediawiki Ferdinand Gruber
Zur Navigation springen Zur Suche springen
KKeine Bearbeitungszusammenfassung
KKeine Bearbeitungszusammenfassung
Zeile 10: Zeile 10:
tools: {
tools: {
math: {
math: {
label: 'Math',
label: 'InlineCode',
type: 'button',
type: 'button',
oouiIcon: 'mathematics',
oouiIcon: 'mathematics',
Zeile 16: Zeile 16:
type: 'encapsulate',
type: 'encapsulate',
options: {
options: {
pre: '<math>',
pre: '<tt>',
post: '</math>'
post: '</tt>'
}
}
}
}

Version vom 17. Dezember 2024, 23:57 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: 'InlineCode',
					type: 'button',
					oouiIcon: 'mathematics',
					action: {
						type: 'encapsulate',
						options: {
							pre: '<tt>',
							post: '</tt>'
						}
					}
				}
			}
			
		} );
	} );
}