rework and document api

This commit is contained in:
Kevin Jahns
2019-05-07 13:44:23 +02:00
parent 77687d94e6
commit 8c36f67f0b
33 changed files with 622 additions and 427 deletions

View File

@@ -116,10 +116,10 @@ export class UndoManager {
this._undoing = false
this._redoing = false
this._lastTransactionWasUndo = false
const y = scope._y
this.y = y
const doc = scope.doc
this.y = doc
let bindingInfos
y.on('beforeTransaction', (y, transaction, remote) => {
doc.on('beforeTransaction', (y, transaction, remote) => {
if (!remote) {
// Store binding information before transaction is executed
// By restoring the binding information, we can make sure that the state
@@ -130,7 +130,7 @@ export class UndoManager {
})
}
})
y.on('afterTransaction', (y, transaction, remote) => {
doc.on('afterTransaction', (y, transaction, remote) => {
if (!remote && transaction.changedParentTypes.has(scope)) {
let reverseOperation = new ReverseOperation(y, transaction, bindingInfos)
if (!this._undoing) {
@@ -200,3 +200,4 @@ export class UndoManager {
return performedRedo
}
}
}