mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-27 17:09:53 +02:00
* fix: lost redos when trigger set_selection (fix #3140) * Update with-history.ts
This commit is contained in:
@@ -104,9 +104,11 @@ export const withHistory = (editor: Editor): Editor => {
|
||||
undos.shift()
|
||||
}
|
||||
|
||||
if (shouldClear(op)) {
|
||||
history.redos = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply(op)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user