fix: deleteText currPos left and right both null
Handle the case where both `currPos.left` and `currPos.right` are null in `YText::deleteText` to prevent error `Cannot read properties of null (reading 'parent')` . Fixes https://github.com/yjs/yjs/issues/504.
This commit is contained in:
parent
658c520b93
commit
34d70afadf
@ -498,8 +498,8 @@ const deleteText = (transaction, currPos, length) => {
|
||||
if (start) {
|
||||
cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes)
|
||||
}
|
||||
const parent = /** @type {AbstractType<any>} */ (/** @type {Item} */ (currPos.left || currPos.right).parent)
|
||||
if (parent._searchMarker) {
|
||||
const parent = /** @type {AbstractType<any>} */ (/** @type {Item} */ (currPos.left || currPos.right)?.parent)
|
||||
if (parent?._searchMarker) {
|
||||
updateMarkerChanges(parent._searchMarker, currPos.index, -startLength + length)
|
||||
}
|
||||
return currPos
|
||||
|
Loading…
x
Reference in New Issue
Block a user