mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 03:37:50 +01:00
fix issue with slicing content in attrMngr
This commit is contained in:
@@ -116,6 +116,7 @@ export {
|
||||
AbstractAttributionManager,
|
||||
iterateStructsByIdSet,
|
||||
createAttributionManagerFromDiff,
|
||||
DiffAttributionManager,
|
||||
createIdSet,
|
||||
mergeIdSets,
|
||||
cloneDoc
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
if (shouldRender || !deleted || s.attrs != null) {
|
||||
contents.push(new AttributedContent(c, deleted, s.attrs, shouldRender))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user