mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 18:25:49 +03:00
sort positions in Range constructor, so start always comes before end
This commit is contained in:
parent
65ddfc0a50
commit
48f1bf1816
1 changed files with 4 additions and 3 deletions
|
@ -15,10 +15,11 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
export default class Range {
|
||||
constructor(model, startPosition, endPosition = startPosition) {
|
||||
constructor(model, positionA, positionB = positionA) {
|
||||
this._model = model;
|
||||
this._start = startPosition;
|
||||
this._end = endPosition;
|
||||
const bIsLarger = positionA.compare(positionB) < 0;
|
||||
this._start = bIsLarger ? positionA : positionB;
|
||||
this._end = bIsLarger ? positionB : positionA;
|
||||
}
|
||||
|
||||
moveStart(delta) {
|
||||
|
|
Loading…
Reference in a new issue