implemented undo 🙌

This commit is contained in:
Kevin Jahns
2017-10-30 11:33:00 +01:00
parent c545118637
commit 0208d83f91
16 changed files with 302 additions and 109 deletions

View File

@@ -52,6 +52,19 @@ export default class Item {
this._parentSub = null
this._deleted = false
}
/**
* Copy the effect of struct
*/
_copy () {
let struct = new this.constructor()
struct._origin = this._left
struct._left = this._left
struct._right = this
struct._right_origin = this
struct._parent = this._parent
struct._parentSub = this._parentSub
return struct
}
get _lastId () {
return new ID(this._id.user, this._id.clock + this._length - 1)
}
@@ -83,6 +96,7 @@ export default class Item {
del._integrate(y, true)
}
transactionTypeChanged(y, this._parent, this._parentSub)
y._transaction.deletedStructs.add(this)
}
/**
* This is called right before this struct receives any children.