fix basic inserd & delete bug
This commit is contained in:
parent
a77221ffd2
commit
8b82c573c4
@ -127,8 +127,9 @@ const findPosition = (transaction, parent, index) => {
|
|||||||
const currentAttributes = new Map()
|
const currentAttributes = new Map()
|
||||||
if (parent._searchMarker) {
|
if (parent._searchMarker) {
|
||||||
return useSearchMarker(transaction, parent, index, listIter => {
|
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)
|
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 {
|
} else {
|
||||||
const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes)
|
const pos = new ItemTextListPosition(null, parent._start, 0, currentAttributes)
|
||||||
|
@ -126,6 +126,7 @@ export class ListIterator {
|
|||||||
len -= item.length
|
len -= item.length
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
this.rel = item.length + len
|
this.rel = item.length + len
|
||||||
|
len = 0
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if (item.content.constructor === ContentMove && item.moved === this.currMove) {
|
} else if (item.content.constructor === ContentMove && item.moved === this.currMove) {
|
||||||
@ -176,6 +177,7 @@ export class ListIterator {
|
|||||||
len -= item.length
|
len -= item.length
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
this.rel = item.length + len
|
this.rel = item.length + len
|
||||||
|
len = 0
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else if (item.content.constructor === ContentMove && item.moved === this.currMove) {
|
} else if (item.content.constructor === ContentMove && item.moved === this.currMove) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user