mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 19:57:45 +01:00
fix issue with slicing content in attrMngr
This commit is contained in:
@@ -116,6 +116,7 @@ export {
|
|||||||
AbstractAttributionManager,
|
AbstractAttributionManager,
|
||||||
iterateStructsByIdSet,
|
iterateStructsByIdSet,
|
||||||
createAttributionManagerFromDiff,
|
createAttributionManagerFromDiff,
|
||||||
|
DiffAttributionManager,
|
||||||
createIdSet,
|
createIdSet,
|
||||||
mergeIdSets,
|
mergeIdSets,
|
||||||
cloneDoc
|
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..
|
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.
|
// Retrieved item is never more fragmented than the newer item.
|
||||||
const prevItem = getItem(this._prevDocStore, createID(client, s.clock))
|
const prevItem = getItem(this._prevDocStore, createID(client, s.clock))
|
||||||
const originalContentLen = content.getLength()
|
|
||||||
content = prevItem.length > 1 ? prevItem.content.copy() : prevItem.content
|
content = prevItem.length > 1 ? prevItem.content.copy() : prevItem.content
|
||||||
// trim itemContent to the correct size.
|
// trim itemContent to the correct size.
|
||||||
const diffStart = s.clock - prevItem.id.clock
|
const diffStart = s.clock - prevItem.id.clock
|
||||||
@@ -348,9 +347,7 @@ export class DiffAttributionManager extends ObservableV2 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const c = content
|
const c = content
|
||||||
if (s.len < c.getLength()) {
|
|
||||||
content = c.splice(s.len)
|
content = c.splice(s.len)
|
||||||
}
|
|
||||||
if (shouldRender || !deleted || s.attrs != null) {
|
if (shouldRender || !deleted || s.attrs != null) {
|
||||||
contents.push(new AttributedContent(c, deleted, s.attrs, shouldRender))
|
contents.push(new AttributedContent(c, deleted, s.attrs, shouldRender))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user