User:Robinr78/common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
$textarea.wikiEditor( 'addToToolbar', { | $textarea.wikiEditor( 'addToToolbar', { | ||
section: 'main', | |||
groups: { | |||
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 */ | /* Your code goes here */ |
Revision as of 00:00, 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: 'main', groups: { 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 */ } ); } ); }