Merge pull request #453 from Cargo/main
Allow updating captureTimeout on UndoManager instances
This commit is contained in:
commit
8fb73edd97
@ -192,6 +192,7 @@ export class UndoManager extends Observable {
|
|||||||
this.doc = doc
|
this.doc = doc
|
||||||
this.lastChange = 0
|
this.lastChange = 0
|
||||||
this.ignoreRemoteMapChanges = ignoreRemoteMapChanges
|
this.ignoreRemoteMapChanges = ignoreRemoteMapChanges
|
||||||
|
this.captureTimeout = captureTimeout
|
||||||
/**
|
/**
|
||||||
* @param {Transaction} transaction
|
* @param {Transaction} transaction
|
||||||
*/
|
*/
|
||||||
@ -223,7 +224,7 @@ export class UndoManager extends Observable {
|
|||||||
})
|
})
|
||||||
const now = time.getUnixTime()
|
const now = time.getUnixTime()
|
||||||
let didAdd = false
|
let didAdd = false
|
||||||
if (now - this.lastChange < captureTimeout && stack.length > 0 && !undoing && !redoing) {
|
if (now - this.lastChange < this.captureTimeout && stack.length > 0 && !undoing && !redoing) {
|
||||||
// append change to last stack op
|
// append change to last stack op
|
||||||
const lastOp = stack[stack.length - 1]
|
const lastOp = stack[stack.length - 1]
|
||||||
lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet])
|
lastOp.deletions = mergeDeleteSets([lastOp.deletions, transaction.deleteSet])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user