Don't update the current attributes in case of delete

This commit is contained in:
nimishclickup 2023-02-04 20:28:39 -08:00
parent f215866429
commit 4c19fef998

View File

@ -55,6 +55,26 @@ export class ItemTextListPosition {
this.currentAttributes = currentAttributes this.currentAttributes = currentAttributes
} }
/**
* Don't update the attributes if it is going to be deleted
*/
forwardWithOutUpdatingAttributes () {
if (this.right === null) {
error.unexpectedCase()
}
switch (this.right.content.constructor) {
case ContentFormat:
break
default:
if (!this.right.deleted) {
this.index += this.right.length
}
break
}
this.left = this.right
this.right = this.right.right
}
/** /**
* Only call this if you know that this.right is defined * Only call this if you know that this.right is defined
*/ */
@ -488,7 +508,7 @@ const deleteText = (transaction, currPos, length) => {
break break
} }
} }
currPos.forward() currPos.forwardWithOutUpdatingAttributes()
} }
if (start) { if (start) {
cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes) cleanupFormattingGap(transaction, start, currPos.right, startAttrs, currPos.currentAttributes)