be more forgiving with offset that don't have atNodeEnd=true
if index is not found, it means the last position should be returned if there is any. We still return -1 for empty documents, as index should always point to a valid part if positive.pull/21833/head
parent
42c37d8293
commit
037ac29c57
|
@ -388,7 +388,11 @@ export default class EditorModel {
|
|||
currentOffset += partLen;
|
||||
return false;
|
||||
});
|
||||
return new DocumentPosition(index, totalOffset - currentOffset);
|
||||
if (index === -1) {
|
||||
return this.getPositionAtEnd();
|
||||
} else {
|
||||
return new DocumentPosition(index, totalOffset - currentOffset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue