diff --git a/src/plugins/sync-plugin.js b/src/plugins/sync-plugin.js index 49c1b38..b38f419 100644 --- a/src/plugins/sync-plugin.js +++ b/src/plugins/sync-plugin.js @@ -280,7 +280,7 @@ export class ProsemirrorBinding { }).filter(n => n !== null) const tr = this.prosemirrorView.state.tr.replace(0, this.prosemirrorView.state.doc.content.size, new PModel.Slice(new PModel.Fragment(fragmentContent), 0, 0)) this.prosemirrorView.dispatch(tr) - }) + }, ySyncPluginKey) }) } /** @@ -318,7 +318,7 @@ export class ProsemirrorBinding { this.doc.transact(() => { updateYFragment(this.doc, this.type, doc, this.mapping) this.beforeTransactionSelection = getRelativeSelection(this, this.prosemirrorView.state) - }) + }, ySyncPluginKey) }) } destroy () { @@ -398,7 +398,7 @@ export const createNodeFromYElement = (el, schema, mapping, snapshot, prevSnapsh // an error occured while creating the node. This is probably a result of a concurrent action. /** @type {Y.Doc} */ (el.doc).transact(transaction => { /** @type {Y.Item} */ (el._item).delete(transaction) - }) + }, ySyncPluginKey) mapping.delete(el) return null } @@ -430,7 +430,7 @@ export const createTextNodesFromYText = (text, schema, mapping, snapshot, prevSn // an error occured while creating the node. This is probably a result of a concurrent action. /** @type {Y.Doc} */ (text.doc).transact(transaction => { /** @type {Y.Item} */ (text._item).delete(transaction) - }) + }, ySyncPluginKey) return null } // @ts-ignore @@ -756,7 +756,7 @@ const updateYFragment = (y, yDomFragment, pNode, mapping) => { } yDomFragment.insert(left, ins) } - }) + }, ySyncPluginKey) } /** diff --git a/src/plugins/undo-plugin.js b/src/plugins/undo-plugin.js index 0ce665a..ccba645 100644 --- a/src/plugins/undo-plugin.js +++ b/src/plugins/undo-plugin.js @@ -29,7 +29,7 @@ export const yUndoPlugin = ({ protectedNodes = new Set(['paragraph']), trackedOr // TODO: check if plugin order matches and fix const ystate = ySyncPluginKey.getState(state) const undoManager = new UndoManager(ystate.type, { - trackedOrigins: new Set([null, ySyncPluginKey].concat(trackedOrigins)), + trackedOrigins: new Set([ySyncPluginKey].concat(trackedOrigins)), deleteFilter: item => !(item instanceof Item) || !(item.content instanceof ContentType) || !(item.content.type instanceof Text ||