mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Restore scrolling parameters into view with(out) sticky header
This is a partial revert of Ide45141. Now the scrolling always happens (again), but properly considers the presence of the sticky header. It was also not correctly initialized on construction time. This is a candidate for a backport. The patch is intentionally as small as possible because of this. Code cleanup will be done in a later patch. Bug: T312926 Change-Id: I06425b42566bfb2087846636055ee75e98a05029
This commit is contained in:
parent
c626f93a1f
commit
0b28414dff
|
@ -129,7 +129,7 @@ ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.setActiveParameter =
|
||||||
* @inheritDoc OO.ui.SelectWidget
|
* @inheritDoc OO.ui.SelectWidget
|
||||||
*/
|
*/
|
||||||
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.highlightItem = function ( item ) {
|
ve.ui.MWTransclusionOutlineParameterSelectWidget.prototype.highlightItem = function ( item ) {
|
||||||
if ( item && this.stickyHeaderHeight ) {
|
if ( item ) {
|
||||||
item.ensureVisibilityBelowStickyHeader( this.stickyHeaderHeight );
|
item.ensureVisibilityBelowStickyHeader( this.stickyHeaderHeight );
|
||||||
}
|
}
|
||||||
ve.ui.MWTransclusionOutlineParameterSelectWidget.super.prototype.highlightItem.call( this, item );
|
ve.ui.MWTransclusionOutlineParameterSelectWidget.super.prototype.highlightItem.call( this, item );
|
||||||
|
|
|
@ -31,8 +31,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget = function VeUiMWTransclusionOutlineTe
|
||||||
remove: 'onParameterRemovedFromTemplateModel'
|
remove: 'onParameterRemovedFromTemplateModel'
|
||||||
} );
|
} );
|
||||||
|
|
||||||
this.toggleFilters();
|
var canFilter = this.shouldFiltersBeShown(),
|
||||||
var canFilter = !!this.toggleUnusedWidget,
|
|
||||||
initiallyHideUnused = canFilter && !replacesPlaceholder && !this.transclusionModel.isSingleTemplate();
|
initiallyHideUnused = canFilter && !replacesPlaceholder && !this.transclusionModel.isSingleTemplate();
|
||||||
|
|
||||||
var parameterNames = this.getRelevantTemplateParameters( initiallyHideUnused ? 'used' : 'all' );
|
var parameterNames = this.getRelevantTemplateParameters( initiallyHideUnused ? 'used' : 'all' );
|
||||||
|
@ -46,6 +45,7 @@ ve.ui.MWTransclusionOutlineTemplateWidget = function VeUiMWTransclusionOutlineTe
|
||||||
this.$element.append( this.$noParametersNote );
|
this.$element.append( this.$noParametersNote );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.toggleFilters();
|
||||||
if ( initiallyHideUnused ) {
|
if ( initiallyHideUnused ) {
|
||||||
// This is only to update the label of the "Hide unused" button
|
// This is only to update the label of the "Hide unused" button
|
||||||
this.toggleUnusedWidget.toggleUnusedParameters( false );
|
this.toggleUnusedWidget.toggleUnusedParameters( false );
|
||||||
|
@ -340,10 +340,19 @@ ve.ui.MWTransclusionOutlineTemplateWidget.prototype.onParameterWidgetListChanged
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.toggleFilters = function () {
|
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.shouldFiltersBeShown = function () {
|
||||||
var numParams = this.getRelevantTemplateParameters().length,
|
var numParams = this.getRelevantTemplateParameters().length,
|
||||||
visible = numParams >= this.constructor.static.searchableParameterCount;
|
visible = numParams >= this.constructor.static.searchableParameterCount;
|
||||||
|
return visible;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ve.ui.MWTransclusionOutlineTemplateWidget.prototype.toggleFilters = function () {
|
||||||
|
var visible = this.shouldFiltersBeShown();
|
||||||
if ( this.searchWidget ) {
|
if ( this.searchWidget ) {
|
||||||
this.searchWidget.toggle( visible );
|
this.searchWidget.toggle( visible );
|
||||||
this.toggleUnusedWidget.toggle( visible );
|
this.toggleUnusedWidget.toggle( visible );
|
||||||
|
|
Loading…
Reference in a new issue