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,7 +104,9 @@ export const withHistory = (editor: Editor): Editor => {
|
|||||||
undos.shift()
|
undos.shift()
|
||||||
}
|
}
|
||||||
|
|
||||||
history.redos = []
|
if (shouldClear(op)) {
|
||||||
|
history.redos = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,3 +174,15 @@ const shouldOverwrite = (
|
|||||||
|
|
||||||
return false
|
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