From ee7c189fdcb53fcd7dfcdfdc70aec906ed912d2a Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Mon, 8 Feb 2021 11:45:26 +0100 Subject: [PATCH] fix formatting issue #275 #277 --- src/types/YText.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/types/YText.js b/src/types/YText.js index 638846fa..a38dc867 100644 --- a/src/types/YText.js +++ b/src/types/YText.js @@ -164,13 +164,12 @@ const insertNegatedAttributes = (transaction, parent, currPos, negatedAttributes } const doc = transaction.doc const ownClientId = doc.clientID - let left = currPos.left + let nextFormat = currPos.left const right = currPos.right negatedAttributes.forEach((val, key) => { - left = new Item(createID(ownClientId, getState(doc.store, ownClientId)), left, left && left.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)) - left.integrate(transaction, 0) - currPos.currentAttributes.set(key, val) - updateCurrentAttributes(currPos.currentAttributes, /** @type {ContentFormat} */ (left.content)) + nextFormat = new Item(createID(ownClientId, getState(doc.store, ownClientId)), nextFormat, nextFormat && nextFormat.lastId, right, right && right.id, parent, null, new ContentFormat(key, val)) + nextFormat.integrate(transaction, 0) + currPos.right = nextFormat }) }