1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-22 06:53:25 +02:00

Fix hasUndos and hasRedos (#1053)

* tiny fix for hasUndos/hasRedos computed values

* clear redos when saving while redos are on the history stack

* Update history.js
This commit is contained in:
Ryan Yurkanin
2017-09-06 14:51:18 -04:00
committed by Ian Storm Taylor
parent 0ab70fd1af
commit 2632c82228

View File

@@ -80,7 +80,7 @@ class History extends new Record(DEFAULTS) {
save(operation, options = {}) {
let history = this
let { undos } = history
let { undos, redos } = history
let { merge, skip } = options
const prevBatch = undos.peek()
const prevOperation = prevBatch && prevBatch[prevBatch.length - 1]
@@ -118,7 +118,9 @@ class History extends new Record(DEFAULTS) {
undos = undos.take(100)
}
history = history.set('undos', undos)
// Clear the redos and update the history.
redos = redos.clear()
history = history.set('undos', undos).set('redos', redos)
return history
}