fix: if there is not element to modify, throw an error

This commit is contained in:
Nick the Sick
2025-12-19 17:11:56 +01:00
parent 7126035d1b
commit dfa2190cfa

View File

@@ -736,7 +736,11 @@ export class AbstractType {
} else if (delta.$deleteOp.check(op)) {
deleteText(transaction, currPos, op.delete)
} else if (delta.$modifyOp.check(op)) {
/** @type {ContentType} */ (currPos.right?.content).type.applyDelta(op.value)
if (currPos.right) {
/** @type {ContentType} */ (currPos.right.content).type.applyDelta(op.value)
} else {
error.unexpectedCase()
}
currPos.formatText(transaction, /** @type {any} */ (this), 1, op.format || {})
} else {
error.unexpectedCase()