mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Don't produce an invalid range
I know this code is still being worked on but I felt like I should put this in anyway, it might save the person working on it some work Change-Id: I1535399b3798cd8de2fc5334cd1eac64b71e8821
This commit is contained in:
parent
ef0c551b79
commit
7f97520af2
|
@ -668,9 +668,15 @@ return;
|
|||
} );
|
||||
|
||||
// Create range surrounding the entire sourceNode and remove
|
||||
var range = new ve.Range();
|
||||
/*var range = new ve.Range();
|
||||
range.from = this.documentView.getDocumentNode().getOffsetFromNode( sourceNode )
|
||||
range.to = range.from + sourceNode.model.getOuterLength();
|
||||
range.to = range.from + sourceNode.model.getOuterLength();*/
|
||||
// Just setting .from and .to produces an invalid range with .start and .end unset --Roan
|
||||
var from = this.documentView.getDocumentNode().getOffsetFromNode( sourceNode ),
|
||||
range = new ve.Range(
|
||||
from,
|
||||
from + sourceNode.model.getOuterLength()
|
||||
);
|
||||
tx = ve.dm.Transaction.newFromRemoval( this.documentView.model, range );
|
||||
this.model.transact( tx );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue