mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 10:48:42 +00:00
Fix off-by-one error in TransclusionModel when moving items
The error occurs when moving an item down (increasing index) which removes the item, adjusts the index and then inserts the item. The index shouldn't be adjusted when moving one down, however, because once removed everything shifts and the +1 index set initially to move it is still good. Change-Id: I44bd2b3eb4bbbef58a6ac181e75969ec7c2cab6f
This commit is contained in:
parent
315f10cea4
commit
3edad8d0da
|
@ -117,7 +117,7 @@ ve.dm.MWTransclusionModel.prototype.process = function ( queue ) {
|
|||
existing = ve.indexOf( item.add, this.parts );
|
||||
if ( existing !== -1 ) {
|
||||
this.removePart( item.add );
|
||||
if ( index && index > existing ) {
|
||||
if ( index && existing + 1 < index ) {
|
||||
index--;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue