mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Merge "Fix indent action when acting on multiple list items"
This commit is contained in:
commit
2dddb90731
|
@ -55,7 +55,7 @@ ve.IndentationAction.prototype.increase = function () {
|
||||||
for ( i = 0; i < groups.length; i++ ) {
|
for ( i = 0; i < groups.length; i++ ) {
|
||||||
group = groups[i];
|
group = groups[i];
|
||||||
if ( group.grandparent && group.grandparent.getType() === 'list' ) {
|
if ( group.grandparent && group.grandparent.getType() === 'list' ) {
|
||||||
fragments.push( surfaceModel.getFragment( group.parent.getOuterRange(), true ) );
|
fragments.push( surfaceModel.getFragment( group.parent.getRange(), true ) );
|
||||||
increased = true;
|
increased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ ve.IndentationAction.prototype.increase = function () {
|
||||||
// Process each fragment (their ranges are automatically adjusted on change)
|
// Process each fragment (their ranges are automatically adjusted on change)
|
||||||
for ( i = 0; i < fragments.length; i++ ) {
|
for ( i = 0; i < fragments.length; i++ ) {
|
||||||
this.indentListItem(
|
this.indentListItem(
|
||||||
documentModel.getNodeFromOffset( fragments[i].getRange().start + 1 )
|
documentModel.getNodeFromOffset( fragments[i].getRange().start )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ function runIndentationChangeTest( assert, range, method, expectedSelection, exp
|
||||||
surface.destroy();
|
surface.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.test( 'decrease', 2, function ( assert ) {
|
QUnit.test( 'increase/decrease', 2, function ( assert ) {
|
||||||
var i,
|
var i,
|
||||||
cases = [
|
cases = [
|
||||||
{
|
{
|
||||||
|
@ -70,6 +70,16 @@ QUnit.test( 'decrease', 2, function ( assert ) {
|
||||||
delete data[12].internal;
|
delete data[12].internal;
|
||||||
},
|
},
|
||||||
'msg': 'decrease indentation on Items 1 & 2'
|
'msg': 'decrease indentation on Items 1 & 2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'range': new ve.Range( 3, 19 ),
|
||||||
|
'method': 'increase',
|
||||||
|
'expectedSelection': new ve.Range( 5, 21 ),
|
||||||
|
'expectedData': function ( data ) {
|
||||||
|
data.splice( 0, 0, { 'type': 'list', 'attributes': { 'style': 'bullet' } }, { 'type': 'listItem' } );
|
||||||
|
data.splice( 23, 0, { 'type': '/list' }, { 'type': '/listItem' } );
|
||||||
|
},
|
||||||
|
'msg': 'increase indentation on Items 1 & 2'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue