User:NACGNOH/common.js: Difference between revisions
Jump to navigation
Jump to search
m WikiEditor/Toolbar customization TEST |
mNo edit summary |
||
Line 9: | Line 9: | ||
tools: { | tools: { | ||
AlignCenter: { | AlignCenter: { | ||
label: ' | label: 'Center', | ||
type: 'button', | type: 'button', | ||
oouiIcon: 'alignCenter', | oouiIcon: 'alignCenter', |
Revision as of 16:31, 14 October 2024
// 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: {
AlignCenter: {
label: 'Center',
type: 'button',
oouiIcon: 'alignCenter',
action: {
type: 'encapsulate',
options: {
pre: "<center>",
post: "</center>"
}
}
}
}
} );
} );
}