jenkins-bot has submitted this change and it was merged.
Change subject: Add excludeInsertion to translateRange()
......................................................................
Add excludeInsertion to translateRange()
This allow us to deviate from the default behavior of including an
insertion that occurred on the range's boundaries.
excludeInsertion=false would translate Foo|Bar|Baz to Foo|BarNew|Baz
excludeInsertion=true would translate Foo|Bar|Baz to Foo|Bar|NewBaz
Change-Id: I592d0025e58e81698a00699c9fa69c4fe31e60bc
---
M modules/ve/dm/ve.dm.Transaction.js
1 file changed, 5 insertions(+), 3 deletions(-)
Approvals:
Esanders: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/dm/ve.dm.Transaction.js
b/modules/ve/dm/ve.dm.Transaction.js
index 67e7639..f3bc85f 100644
--- a/modules/ve/dm/ve.dm.Transaction.js
+++ b/modules/ve/dm/ve.dm.Transaction.js
@@ -918,11 +918,13 @@
* @method
* @see #translateOffset
* @param {ve.Range} range Range in the linear model before the transaction
has been processed
+ * @param {boolean} [excludeInsertion] Do not grow the range to cover
insertions
+ * on the boundaries of the range.
* @returns {ve.Range} Translated range, as it will be after processing
transaction
*/
-ve.dm.Transaction.prototype.translateRange = function ( range ) {
- var start = this.translateOffset( range.start, true ),
- end = this.translateOffset( range.end, false );
+ve.dm.Transaction.prototype.translateRange = function ( range,
excludeInsertion ) {
+ var start = this.translateOffset( range.start, !excludeInsertion ),
+ end = this.translateOffset( range.end, excludeInsertion );
return range.isBackwards() ? new ve.Range( end, start ) : new ve.Range(
start, end );
};
--
To view, visit https://gerrit.wikimedia.org/r/124491
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I592d0025e58e81698a00699c9fa69c4fe31e60bc
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