jenkins-bot has submitted this change and it was merged.
Change subject: Exclude insertions in ve.dm.SurfaceFragment#isolateAndUnwrap
......................................................................
Exclude insertions in ve.dm.SurfaceFragment#isolateAndUnwrap
In cases where the separators we insert are adjacent to the range
we're isolating, we don't want the range to grow to include these
separators, as that breaks the subsequent unwrap.
This range growth doesn't usually happen, because the typical situation is:
[</list><list>]<li>|<p>Foo</p>|</li>[</list><list>]
(i.e. the list is being split but the listItem is not), but it's possible to
get:
[</list><list>]<li>|<p>Foo</p>|[</li></list><list><li>]<list><li>...
when converting a list item that contains a nested list, in which case the
listItem does get split.
Bug: 63209
Change-Id: Iec3fecccf5d4ad545164f36ee73b7285f29c0e55
---
M modules/ve/dm/ve.dm.SurfaceFragment.js
1 file changed, 9 insertions(+), 1 deletion(-)
Approvals:
Esanders: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/dm/ve.dm.SurfaceFragment.js
b/modules/ve/dm/ve.dm.SurfaceFragment.js
index 7e440c9..a570a4f 100644
--- a/modules/ve/dm/ve.dm.SurfaceFragment.js
+++ b/modules/ve/dm/ve.dm.SurfaceFragment.js
@@ -886,7 +886,7 @@
return this;
}
var nodes, startSplitNode, endSplitNode,
- startOffset, endOffset,
+ startOffset, endOffset, oldExclude,
outerDepth = 0,
factory = ve.dm.nodeFactory,
allowedParents = factory.getSuggestedParentNodeTypes(
isolateForType ),
@@ -948,6 +948,12 @@
}
}
+ // We have to exclude insertions while doing splits, because we want
the range to be
+ // exactly what we're isolating, we don't want it to grow to include
the separators
+ // we're inserting (which would happen if one of them is immediately
adjacent to the range)
+ oldExclude = this.willExcludeInsertions();
+ this.setExcludeInsertions( true );
+
if ( startSplitRequired ) {
createSplits( startSplitNodes, true );
}
@@ -956,6 +962,8 @@
createSplits( endSplitNodes, false );
}
+ this.setExcludeInsertions( oldExclude );
+
this.unwrapNodes( outerDepth, 0 );
return this;
--
To view, visit https://gerrit.wikimedia.org/r/124493
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iec3fecccf5d4ad545164f36ee73b7285f29c0e55
Gerrit-PatchSet: 3
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits