mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-24 16:02:55 +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:
committed by
Ian Storm Taylor
parent
0ab70fd1af
commit
2632c82228
@@ -80,7 +80,7 @@ class History extends new Record(DEFAULTS) {
|
|||||||
|
|
||||||
save(operation, options = {}) {
|
save(operation, options = {}) {
|
||||||
let history = this
|
let history = this
|
||||||
let { undos } = history
|
let { undos, redos } = history
|
||||||
let { merge, skip } = options
|
let { merge, skip } = options
|
||||||
const prevBatch = undos.peek()
|
const prevBatch = undos.peek()
|
||||||
const prevOperation = prevBatch && prevBatch[prevBatch.length - 1]
|
const prevOperation = prevBatch && prevBatch[prevBatch.length - 1]
|
||||||
@@ -118,7 +118,9 @@ class History extends new Record(DEFAULTS) {
|
|||||||
undos = undos.take(100)
|
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
|
return history
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user