fix basic inserd & delete bug

This commit is contained in:
Kevin Jahns 2021-11-19 17:14:24 +01:00
parent a77221ffd2
commit 8b82c573c4
2 changed files with 4 additions and 1 deletions

View File

@ -127,8 +127,9 @@ const findPosition = (transaction, parent, index) => {
const currentAttributes = new Map()
if (parent._searchMarker) {
return useSearchMarker(transaction, parent, index, listIter => {
// @todo this should simply split if .rel > 0
const pos = new ItemTextListPosition(listIter.left, listIter.right, listIter.index, currentAttributes)
return findNextPosition(transaction, pos, index - listIter.index)
return findNextPosition(transaction, pos, index - listIter.index + listIter.rel)
})
} else {
const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes)

View File

@ -126,6 +126,7 @@ export class ListIterator {
len -= item.length
if (len < 0) {
this.rel = item.length + len
len = 0
break
}
} else if (item.content.constructor === ContentMove && item.moved === this.currMove) {
@ -176,6 +177,7 @@ export class ListIterator {
len -= item.length
if (len < 0) {
this.rel = item.length + len
len = 0
break
}
} else if (item.content.constructor === ContentMove && item.moved === this.currMove) {