User:NACGNOH/common.js: Difference between revisions
Jump to navigation
Jump to search
WikiEditor/Toolbar customization Test |
m WikiEditor/Toolbar customization TEST |
||
Line 1: | Line 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. | |||
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: '居中', | |||
type: 'button', | |||
oouiIcon: 'alignCenter', | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "<center>", | |||
post: "</center>" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
} ); | |||
} | } |
Revision as of 17:20, 13 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: '居中',
type: 'button',
oouiIcon: 'alignCenter',
action: {
type: 'encapsulate',
options: {
pre: "<center>",
post: "</center>"
}
}
}
}
} );
} );
}