User:Robinr78/common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 9: | Line 9: | ||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
section: 'advanced', | section: 'advanced', | ||
groups: { | groups: {advanced | ||
list: { | list: { | ||
tools: { | tools: { |
Revision as of 00:05, 31 December 2022
// 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', { /* Your code goes here */ $textarea.wikiEditor( 'addToToolbar', { section: 'advanced', groups: {advanced list: { tools: { templates: { label: 'Templates', type: 'select', list: { 'Ping-button': { label: '{{Ping}}', action: { type: 'encapsulate', options: { pre: '{{Ping|', post: '}}' } } }, 'Clear-button': { label: 'Clear', action: { type: 'encapsulate', options: { pre: '{{Clear}}' } } }, 'Done-button': { label: 'Done', action: { type: 'encapsulate', options: { pre: '{{Done}}' } } } } } } } } } ); /* Your code goes here */ } ); } ); }