fix replace with delete
This commit is contained in:
parent
7d0c048708
commit
61d9d96d15
@ -421,6 +421,13 @@ export class AbstractItem extends AbstractStruct {
|
|||||||
if (r.right !== null) {
|
if (r.right !== null) {
|
||||||
r.right.left = r
|
r.right.left = r
|
||||||
}
|
}
|
||||||
|
if (r.left === null) {
|
||||||
|
if (r.parentSub === null) {
|
||||||
|
r.parent._start = r
|
||||||
|
} else {
|
||||||
|
r.parent._map.set(r.parentSub, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
replaceStruct(y.store, this, r)
|
replaceStruct(y.store, this, r)
|
||||||
return r
|
return r
|
||||||
|
@ -12,7 +12,8 @@ import {
|
|||||||
YText,
|
YText,
|
||||||
YMap,
|
YMap,
|
||||||
YXmlFragment,
|
YXmlFragment,
|
||||||
YEvent, ItemDeleted, GC, AbstractStruct // eslint-disable-line
|
ItemDeleted,
|
||||||
|
YEvent, GC, AbstractStruct // eslint-disable-line
|
||||||
} from '../internals.js'
|
} from '../internals.js'
|
||||||
|
|
||||||
import { Observable } from 'lib0/observable.js'
|
import { Observable } from 'lib0/observable.js'
|
||||||
@ -121,7 +122,7 @@ export class Y extends Observable {
|
|||||||
if (deleteItem.clock + deleteItem.len < struct.id.clock) {
|
if (deleteItem.clock + deleteItem.len < struct.id.clock) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (struct.deleted && struct instanceof AbstractItem) {
|
if (struct.deleted && struct instanceof AbstractItem && (struct.constructor !== ItemDeleted || (struct.parent._item !== null && struct.parent._item.deleted))) {
|
||||||
// check if we can GC
|
// check if we can GC
|
||||||
replacedItems.add(struct.gc(this))
|
replacedItems.add(struct.gc(this))
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,17 @@ import * as text from './y-text.tests.js'
|
|||||||
import * as xml from './y-xml.tests.js'
|
import * as xml from './y-xml.tests.js'
|
||||||
|
|
||||||
import { runTests } from 'lib0/testing.js'
|
import { runTests } from 'lib0/testing.js'
|
||||||
import { isBrowser } from 'lib0/environment.js'
|
import { isBrowser, isNode } from 'lib0/environment.js'
|
||||||
import * as log from 'lib0/logging.js'
|
import * as log from 'lib0/logging.js'
|
||||||
|
|
||||||
if (isBrowser) {
|
if (isBrowser) {
|
||||||
log.createVConsole(document.body)
|
log.createVConsole(document.body)
|
||||||
}
|
}
|
||||||
runTests({ map, array, text, xml })
|
runTests({
|
||||||
|
map, array, text, xml
|
||||||
|
}).then(success => {
|
||||||
|
/* istanbul ignore next */
|
||||||
|
if (isNode) {
|
||||||
|
process.exit(success ? 0 : 1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user