Skip to content

Commit

Permalink
inspect appendedTransaction for possible addToHistory: false meta…
Browse files Browse the repository at this point in the history
… to prevent transaction from appearing on undo stack. fixes yjs#141
  • Loading branch information
romansp authored and erwamartin committed Dec 11, 2023
1 parent 26e258e commit ec55f3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/sync-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ec55f3c

Please sign in to comment.