fix y-text

This commit is contained in:
Kevin Jahns
2019-03-30 01:08:09 +01:00
parent c188f813a4
commit 1bc1e88d6a
5 changed files with 351 additions and 192 deletions

View File

@@ -232,8 +232,12 @@ export class AbstractItem extends AbstractStruct {
}
transaction.added.add(this)
// @ts-ignore
if (parent._item.deleted) {
this.delete(transaction, false, true)
if (parent._item.deleted || (left !== null && parentSub !== null)) {
// delete if parent is deleted or if this is not the current attribute value of parent
this.delete(transaction)
} else if (parentSub !== null && left === null && right !== null) {
// this is the current attribute value of parent. delete right
right.delete(transaction)
}
}
@@ -391,13 +395,10 @@ export class AbstractItem extends AbstractStruct {
* Mark this Item as deleted.
*
* @param {Transaction} transaction
* @param {boolean} createDelete Whether to propagate a message that this
* Type was deleted.
* @param {boolean} [gcChildren]
*
* @private
*/
delete (transaction, createDelete = true, gcChildren) {
delete (transaction) {
if (!this.deleted) {
const parent = this.parent
// adjust the length of parent