Page MenuHomePhabricator

Add new 'secondary' section to far end of toolbar
Open, Needs TriagePublic1 Estimated Story Points

Description

Currently, to add a new toolbar button something like the following is done:

mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
	$textarea.wikiEditor( 'addToToolbar', {
		'section': 'main',
		'group': 'insert',
		'tools': {
			'newtool': {
				/* … */
			}
		}
	} );
} );

It is possible to add a new section in an expandable tab, or a new group to an existing section (including the top level main section), but it's not possible to have a new top-level section.

toolbar-sections.png (98×1 px, 16 KB)

This is a proposal to add a new secondary section, that is the same as the main section but located at the right-hand (or left-hand for RTL) end of the toolbar.

Currently, the Wikisource, ProofreadPage, and VisualEditor extensions add widgets to this end of the toolbar, and they do it by injecting into the DOM manually and styling the position themselves.

By default, this section would be empty (but the up-coming real-time preview will be building an optional Preview button into WikiEditor, which will appear in this location).

Event Timeline

Samwilson renamed this task from Add new section to far end of toolbar to Add new 'auxiliary' section to far end of toolbar.Thu, Nov 25, 9:09 AM
Samwilson updated the task description. (Show Details)

Change 742836 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/WikiEditor@master] Add new 'secondary' toolbar section

https://gerrit.wikimedia.org/r/742836

Samwilson renamed this task from Add new 'auxiliary' section to far end of toolbar to Add new 'secondary' section to far end of toolbar.Wed, Dec 1, 3:22 AM
Samwilson updated the task description. (Show Details)
Samwilson set the point value for this task to 1.

Change 742836 merged by jenkins-bot:

[mediawiki/extensions/WikiEditor@master] Add new 'secondary' toolbar section

https://gerrit.wikimedia.org/r/742836

I've updated the docs at https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization#Default_sections

There's nothing much to QA here, because nothing is added to the new section yet. It is being used in the preview button patch, and it can be tested with a user script something like the following:

	mw.hook( 'wikiEditor.toolbarReady' ).add( function ( $textarea ) {
		$textarea.wikiEditor( 'addToToolbar', {
			section: 'secondary',
			group: 'default',
			tools: {
				testtool: {
					type: 'button',
					label: 'Lorem',
					oouiIcon: 'info'
				}
			}
		} );
	} );