mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "Calculate controls using sidebar selection"
This commit is contained in:
commit
7570742468
|
@ -381,18 +381,19 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.setPage = function ( name ) {
|
|||
*
|
||||
*/
|
||||
ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.refreshControls = function () {
|
||||
var pages = this.stackLayout.getItems(),
|
||||
page = this.getCurrentPage(),
|
||||
var partId = this.sidebar.findSelectedPartId(),
|
||||
pages = this.stackLayout.getItems(),
|
||||
page = this.getPage( partId ),
|
||||
index = pages.indexOf( page ),
|
||||
isParameter = page instanceof ve.ui.MWParameterPage,
|
||||
isPart = !!partId,
|
||||
canMoveUp, canMoveDown = false,
|
||||
canBeDeleted = !isParameter;
|
||||
canBeDeleted = isPart;
|
||||
|
||||
/* check if this is the first element and no parameter */
|
||||
canMoveUp = !isParameter && index > 0;
|
||||
canMoveUp = isPart && index > 0;
|
||||
|
||||
/* check if this is the last element and no parameter */
|
||||
if ( !isParameter ) {
|
||||
if ( isPart ) {
|
||||
for ( var i = index + 1; i < pages.length; i++ ) {
|
||||
if ( !( pages[ i ] instanceof ve.ui.MWParameterPage || pages[ i ] instanceof ve.ui.MWAddParameterPage ) ) {
|
||||
canMoveDown = true;
|
||||
|
|
Loading…
Reference in a new issue