From 7f5f9e1c626e61ec476087212b22ee9ff86538e4 Mon Sep 17 00:00:00 2001 From: nabbydude Date: Wed, 14 May 2025 15:01:55 -0400 Subject: [PATCH] Fix certain undos undoing more than they should (#5866) * prevent false positives for history batch merging * add changeset --- .changeset/friendly-socks-divide.md | 5 +++++ packages/slate-history/src/with-history.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/friendly-socks-divide.md diff --git a/.changeset/friendly-socks-divide.md b/.changeset/friendly-socks-divide.md new file mode 100644 index 000000000..04d6a5e71 --- /dev/null +++ b/.changeset/friendly-socks-divide.md @@ -0,0 +1,5 @@ +--- +'slate-history': patch +--- + +Fix certain undos undoing more than they should diff --git a/packages/slate-history/src/with-history.ts b/packages/slate-history/src/with-history.ts index 8b1fa083e..444121810 100644 --- a/packages/slate-history/src/with-history.ts +++ b/packages/slate-history/src/with-history.ts @@ -83,7 +83,7 @@ export const withHistory = (editor: T) => { if (merge == null) { if (lastBatch == null) { merge = false - } else if (operations.length !== 0) { + } else if (operations.includes(lastOp)) { merge = true } else { merge = shouldMerge(op, lastOp)