From ec55f3c08b86e951c795230eefc5d6de9dfb19af Mon Sep 17 00:00:00 2001 From: Raman Paulau Date: Wed, 13 Sep 2023 10:22:43 -0700 Subject: [PATCH] inspect `appendedTransaction` for possible `addToHistory: false` meta to prevent transaction from appearing on undo stack. fixes #141 --- src/plugins/sync-plugin.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/sync-plugin.js b/src/plugins/sync-plugin.js index 3e3b6aa..1fcf5f5 100644 --- a/src/plugins/sync-plugin.js +++ b/src/plugins/sync-plugin.js @@ -126,7 +126,8 @@ export const ySyncPlugin = (yXmlFragment, { pluginState[key] = change[key] } } - pluginState.addToHistory = tr.getMeta('addToHistory') !== false + const appended = tr.getMeta('appendedTransaction') + pluginState.addToHistory = tr.getMeta('addToHistory') !== false && !(appended && appended.getMeta('addToHistory') === false) // always set isChangeOrigin. If undefined, this is not change origin. pluginState.isChangeOrigin = change !== undefined && !!change.isChangeOrigin