Delete all children of ItemType when it is deleted
This commit is contained in:
@@ -425,6 +425,7 @@ export class AbstractItem extends AbstractStruct {
|
||||
* @private
|
||||
*/
|
||||
gc (transaction, store) {
|
||||
this.delete(transaction)
|
||||
let r
|
||||
if (this.parent._item !== null && this.parent._item.deleted) {
|
||||
r = new GC(this.id, this.length)
|
||||
|
||||
@@ -100,9 +100,21 @@ export class ItemType extends AbstractItem {
|
||||
* @private
|
||||
*/
|
||||
delete (transaction) {
|
||||
super.delete(transaction)
|
||||
transaction.changed.delete(this.type)
|
||||
transaction.changedParentTypes.delete(this.type)
|
||||
if (!this.deleted) {
|
||||
super.delete(transaction)
|
||||
let item = this.type._start
|
||||
while (item !== null) {
|
||||
if (!item.deleted) {
|
||||
item.delete(transaction)
|
||||
}
|
||||
item = item.right
|
||||
}
|
||||
this.type._map.forEach(item => {
|
||||
item.delete(transaction)
|
||||
})
|
||||
transaction.changed.delete(this.type)
|
||||
transaction.changedParentTypes.delete(this.type)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user