From 73f165ff07cf521b239a648ca91c9965d8d1dce7 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 31 May 2025 21:00:30 +0200 Subject: [PATCH] fix issue with slicing content in attrMngr --- src/index.js | 1 + src/utils/AttributionManager.js | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 691e3efc..ad41361b 100644 --- a/src/index.js +++ b/src/index.js @@ -116,6 +116,7 @@ export { AbstractAttributionManager, iterateStructsByIdSet, createAttributionManagerFromDiff, + DiffAttributionManager, createIdSet, mergeIdSets, cloneDoc diff --git a/src/utils/AttributionManager.js b/src/utils/AttributionManager.js index 9073396a..d8ab2f37 100644 --- a/src/utils/AttributionManager.js +++ b/src/utils/AttributionManager.js @@ -339,7 +339,6 @@ export class DiffAttributionManager extends ObservableV2 { if (content.getLength() === 0 || (content instanceof ContentDeleted && (s.attrs != null || shouldRender) && !this.inserts.has(client, s.clock))) { // @todo possibly remove this.inserts.. // Retrieved item is never more fragmented than the newer item. const prevItem = getItem(this._prevDocStore, createID(client, s.clock)) - const originalContentLen = content.getLength() content = prevItem.length > 1 ? prevItem.content.copy() : prevItem.content // trim itemContent to the correct size. const diffStart = s.clock - prevItem.id.clock @@ -348,9 +347,7 @@ export class DiffAttributionManager extends ObservableV2 { } } const c = content - if (s.len < c.getLength()) { - content = c.splice(s.len) - } + content = c.splice(s.len) if (shouldRender || !deleted || s.attrs != null) { contents.push(new AttributedContent(c, deleted, s.attrs, shouldRender)) }