From 2e5abad7739288c6c3ccd5488dd28941da9982d2 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Tue, 18 Jun 2024 16:51:57 +0200 Subject: [PATCH] fix #645 yjs/y-utility#8 --- README.md | 1 - src/utils/UndoManager.js | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da7d827e..e19b9dc8 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,6 @@ are implemented in separate modules. | [Slate](https://github.com/ianstormtaylor/slate) | ✔ | [slate-yjs](https://github.com/bitphinix/slate-yjs) | [demo](https://bitphinix.github.io/slate-yjs-example) | | [BlockSuite](https://github.com/toeverything/blocksuite) | ✔ | (native) | [demo](https://blocksuite-toeverything.vercel.app/?init) | | [Lexical](https://lexical.dev/) | ✔ | (native) | [demo](https://lexical.dev/docs/collaboration/react#see-it-in-action) | - | [valtio](https://github.com/pmndrs/valtio) | | [valtio-yjs](https://github.com/dai-shi/valtio-yjs) | [demo](https://codesandbox.io/s/valtio-yjs-demo-ox3iy) | | [immer](https://github.com/immerjs/immer) | | [immer-yjs](https://github.com/sep2/immer-yjs) | [demo](https://codesandbox.io/s/immer-yjs-demo-6e0znb) | | React / Vue / Svelte / MobX | | [SyncedStore](https://syncedstore.org) | [demo](https://syncedstore.org/docs/react) | diff --git a/src/utils/UndoManager.js b/src/utils/UndoManager.js index 27023ecf..a3645cd8 100644 --- a/src/utils/UndoManager.js +++ b/src/utils/UndoManager.js @@ -118,12 +118,13 @@ const popStackItem = (undoManager, stack, eventType) => { }) _tr = transaction }, undoManager) - if (undoManager.currStackItem != null) { + const res = undoManager.currStackItem + if (res != null) { const changedParentTypes = _tr.changedParentTypes - undoManager.emit('stack-item-popped', [{ stackItem: undoManager.currStackItem, type: eventType, changedParentTypes, origin: undoManager }, undoManager]) + undoManager.emit('stack-item-popped', [{ stackItem: res, type: eventType, changedParentTypes, origin: undoManager }, undoManager]) undoManager.currStackItem = null } - return undoManager.currStackItem + return res } /**