mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Use generic "outline item selected" event for top-level parts
This also means we have to move the declaration/documentation of the event up one level into the generic "part" widget. Change-Id: I1b803201f8955b58136ee7f37c04c01edcd47395
This commit is contained in:
parent
ee7a398ffc
commit
60b69c575e
|
@ -33,8 +33,8 @@ ve.ui.MWTransclusionOutlinePartWidget = function VeUiMWTransclusionOutlinePartWi
|
||||||
this.header = new ve.ui.MWTransclusionOutlineButtonWidget( config )
|
this.header = new ve.ui.MWTransclusionOutlineButtonWidget( config )
|
||||||
.connect( this, {
|
.connect( this, {
|
||||||
keyPressed: 'onHeaderKeyPressed',
|
keyPressed: 'onHeaderKeyPressed',
|
||||||
// The array syntax is a way to call `this.emit( 'transclusionPartSelected', … )`.
|
// The array syntax is a way to call `this.emit( 'transclusionOutlineItemSelected', … )`.
|
||||||
click: [ 'emit', 'transclusionPartSelected', part.getId() ]
|
click: [ 'emit', 'transclusionOutlineItemSelected', part.getId() ]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( config.ariaDescriptionUnselected ) {
|
if ( config.ariaDescriptionUnselected ) {
|
||||||
|
@ -81,11 +81,14 @@ OO.inheritClass( ve.ui.MWTransclusionOutlinePartWidget, OO.ui.Widget );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "Hard" selection with enter or mouse click.
|
* Triggered when the user interacts with any sidebar element in a meaningful way, and that should
|
||||||
|
* be reflected in the content pane of the dialog. This includes e.g. selecting something that was
|
||||||
|
* already selected.
|
||||||
*
|
*
|
||||||
* @event transclusionPartSelected
|
* @event transclusionOutlineItemSelected
|
||||||
* @param {string} pageName Unique id of the {@see OO.ui.BookletLayout} page, e.g. something like
|
* @param {string} pageName Unique id of the {@see OO.ui.BookletLayout} page, e.g. something like
|
||||||
* "part_1" or "part_1/param1".
|
* "part_1" or "part_1/param1".
|
||||||
|
* @param {boolean} [soft] If true, focus should stay in the sidebar. Defaults to false.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Methods */
|
/* Methods */
|
||||||
|
|
|
@ -58,13 +58,6 @@ OO.inheritClass( ve.ui.MWTransclusionOutlineTemplateWidget, ve.ui.MWTransclusion
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
|
|
||||||
/**
|
|
||||||
* @event transclusionOutlineItemSelected
|
|
||||||
* @param {string} pageName Unique id of the {@see OO.ui.BookletLayout} page, e.g. something like
|
|
||||||
* "part_1" or "part_1/param1".
|
|
||||||
* @param {boolean} [soft] If true, focus should stay in the sidebar. Defaults to false.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggered when the user uses the search widget at the top to filter the list of parameters.
|
* Triggered when the user uses the search widget at the top to filter the list of parameters.
|
||||||
*
|
*
|
||||||
|
|
|
@ -97,7 +97,6 @@ ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, new
|
||||||
widget.connect( this, {
|
widget.connect( this, {
|
||||||
// We can forward these events as is. The parameter's unique ids are reused as page
|
// We can forward these events as is. The parameter's unique ids are reused as page
|
||||||
// names in {@see ve.ui.MWTemplateDialog.onAddParameter}.
|
// names in {@see ve.ui.MWTemplateDialog.onAddParameter}.
|
||||||
transclusionOutlineItemSelected: [ 'emit', 'sidebarItemSelected' ],
|
|
||||||
filterParametersById: 'onFilterParametersByName'
|
filterParametersById: 'onFilterParametersByName'
|
||||||
} );
|
} );
|
||||||
} else if ( part instanceof ve.dm.MWTemplatePlaceholderModel ) {
|
} else if ( part instanceof ve.dm.MWTemplatePlaceholderModel ) {
|
||||||
|
@ -108,7 +107,7 @@ ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, new
|
||||||
|
|
||||||
widget.connect( this, {
|
widget.connect( this, {
|
||||||
transclusionPartSoftSelected: 'onTransclusionPartSoftSelected',
|
transclusionPartSoftSelected: 'onTransclusionPartSoftSelected',
|
||||||
transclusionPartSelected: [ 'emit', 'sidebarItemSelected' ]
|
transclusionOutlineItemSelected: [ 'emit', 'sidebarItemSelected' ]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
this.partWidgets[ part.getId() ] = widget;
|
this.partWidgets[ part.getId() ] = widget;
|
||||||
|
|
Loading…
Reference in a new issue