mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-14 18:15:19 +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 )
|
||||
.connect( this, {
|
||||
keyPressed: 'onHeaderKeyPressed',
|
||||
// The array syntax is a way to call `this.emit( 'transclusionPartSelected', … )`.
|
||||
click: [ 'emit', 'transclusionPartSelected', part.getId() ]
|
||||
// The array syntax is a way to call `this.emit( 'transclusionOutlineItemSelected', … )`.
|
||||
click: [ 'emit', 'transclusionOutlineItemSelected', part.getId() ]
|
||||
} );
|
||||
|
||||
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
|
||||
* "part_1" or "part_1/param1".
|
||||
* @param {boolean} [soft] If true, focus should stay in the sidebar. Defaults to false.
|
||||
*/
|
||||
|
||||
/* Methods */
|
||||
|
|
|
@ -58,13 +58,6 @@ OO.inheritClass( ve.ui.MWTransclusionOutlineTemplateWidget, ve.ui.MWTransclusion
|
|||
|
||||
/* 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.
|
||||
*
|
||||
|
|
|
@ -97,7 +97,6 @@ ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, new
|
|||
widget.connect( this, {
|
||||
// We can forward these events as is. The parameter's unique ids are reused as page
|
||||
// names in {@see ve.ui.MWTemplateDialog.onAddParameter}.
|
||||
transclusionOutlineItemSelected: [ 'emit', 'sidebarItemSelected' ],
|
||||
filterParametersById: 'onFilterParametersByName'
|
||||
} );
|
||||
} else if ( part instanceof ve.dm.MWTemplatePlaceholderModel ) {
|
||||
|
@ -108,7 +107,7 @@ ve.ui.MWTransclusionOutlineWidget.prototype.addPartWidget = function ( part, new
|
|||
|
||||
widget.connect( this, {
|
||||
transclusionPartSoftSelected: 'onTransclusionPartSoftSelected',
|
||||
transclusionPartSelected: [ 'emit', 'sidebarItemSelected' ]
|
||||
transclusionOutlineItemSelected: [ 'emit', 'sidebarItemSelected' ]
|
||||
} );
|
||||
|
||||
this.partWidgets[ part.getId() ] = widget;
|
||||
|
|
Loading…
Reference in a new issue