Skip to content

Commit

Permalink
fix #509
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Aug 24, 2023
1 parent 2e3ba0f commit 97c09a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/UndoManager.js
Expand Up @@ -15,6 +15,7 @@ import {

import * as time from 'lib0/time'
import * as array from 'lib0/array'
import * as logging from 'lib0/logging'
import { Observable } from 'lib0/observable'

export class StackItem {
Expand Down Expand Up @@ -169,6 +170,7 @@ export class UndoManager extends Observable {
* @type {Array<AbstractType<any>>}
*/
this.scope = []
this.doc = doc
this.addToScope(typeScope)
this.deleteFilter = deleteFilter
trackedOrigins.add(this)
Expand All @@ -189,7 +191,6 @@ export class UndoManager extends Observable {
*/
this.undoing = false
this.redoing = false
this.doc = doc
this.lastChange = 0
this.ignoreRemoteMapChanges = ignoreRemoteMapChanges
this.captureTimeout = captureTimeout
Expand Down Expand Up @@ -263,6 +264,7 @@ export class UndoManager extends Observable {
ytypes = array.isArray(ytypes) ? ytypes : [ytypes]
ytypes.forEach(ytype => {
if (this.scope.every(yt => yt !== ytype)) {
if (ytype.doc !== this.doc) logging.warn('[yjs#509] Not same Y.Doc') // use MultiDocUndoManager instead. also see https://github.com/yjs/yjs/issues/509
this.scope.push(ytype)
}
})
Expand Down

0 comments on commit 97c09a6

Please sign in to comment.