User:Robinr78/common.js: Difference between revisions

From Robin's SM-201 Website
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


$textarea.wikiEditor( 'addToToolbar', {
$textarea.wikiEditor( 'addToToolbar', {
section: 'main',
section: 'advanced',
groups: {
groups: {
list: {
list: {

Revision as of 00:04, 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: {
		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 */
		} );
	} );
}