mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-07 06:58:25 +00:00
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.
This commit is contained in:
+5
-1
@@ -388,7 +388,11 @@ export default class EditorModel {
|
|||||||
currentOffset += partLen;
|
currentOffset += partLen;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
return new DocumentPosition(index, totalOffset - currentOffset);
|
if (index === -1) {
|
||||||
|
return this.getPositionAtEnd();
|
||||||
|
} else {
|
||||||
|
return new DocumentPosition(index, totalOffset - currentOffset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user