allow starting a range with both positions known already

we'll need this to start a range for the selection
This commit is contained in:
Bruno Windels 2019-09-03 16:00:50 +02:00
parent eb87301855
commit 0d02ab59d6

View file

@ -394,11 +394,12 @@ export default class EditorModel {
/**
* Starts a range, which can span across multiple parts, to find and replace text.
* @param {DocumentPosition} position where to start the range
* @param {DocumentPosition} positionA a boundary of the range
* @param {DocumentPosition?} positionB the other boundary of the range, optional
* @return {Range}
*/
startRange(position) {
return new Range(this, position);
startRange(positionA, positionB = positionA) {
return new Range(this, positionA, positionB);
}
//mostly internal, called from Range.replace