1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-27 09:04:31 +02:00

fix: lost redos when trigger set_selection (fix #3140) (#3176)

* fix: lost redos when trigger set_selection (fix #3140)

* Update with-history.ts
This commit is contained in:
Wee
2019-12-01 06:21:24 +08:00
committed by Ian Storm Taylor
parent f979332ea6
commit 72d78f5a69

View File

@@ -104,7 +104,9 @@ export const withHistory = (editor: Editor): Editor => {
undos.shift()
}
history.redos = []
if (shouldClear(op)) {
history.redos = []
}
}
}
@@ -172,3 +174,15 @@ const shouldOverwrite = (
return false
}
/**
* Check whether an operation should clear the redos stack.
*/
const shouldClear = (op: Operation): boolean => {
if (op.type === 'set_selection') {
return false
}
return true
}