Extension:WikiEditor/Toolbar customization/Library

To use these snippets, you need to paste them in your common.js page, inside a wikiEditor.toolbarReady hook handler (as described in the basic setup section).

Snippets requiring no customization edit

Strikethrough button edit

This puts the button in the "Advanced" section of the toolbar. To put it in the top section of the toolbar instead, replace 'advanced' with 'main'.

	$textarea.wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			"strikethrough": {
				label: 'Strike',
				type: 'button',
				oouiIcon: 'strikethrough',
				action: {
					type: 'encapsulate',
					options: {
						pre: "<s>",
						post: "</s>"
					}
				}
			}
		}
	} );

Horizontal line button edit

This puts the button in the "Advanced" section of the toolbar. To put it in the top section of the toolbar instead, replace 'advanced' with 'main'. The button uses the old toolbar's horizontal line image; to change this, change the URL after icon:.

	$textarea.wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			hline: {
				label: 'Horizontal line',
				type: 'button',
				icon: 'https://upload.wikimedia.org/wikipedia/commons/a/a4/H-line_icon.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '----',
						ownline: true
					}
				}
			}
		}
	} );

Comment button edit

	$textarea.wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			comment: {
				label: 'Comment',
				type: 'button',
				icon: 'https://upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<!-- ',
						post: ' -->'
					}
				}
			}
		}
	} );

Math button edit

	$textarea.wikiEditor( 'addToToolbar', {
		section: 'advanced',
		group: 'format',
		tools: {
			math: {
				label: 'Math',
				type: 'button',
				oouiIcon: 'mathematics',
				action: {
					type: 'encapsulate',
					options: {
						pre: '<math>',
						post: '</math>'
					}
				}
			}
		}
	} );


See also edit