mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 06:01:24 +02:00
undo and redo operations are now wrapped with withoutNormalizing call to prevent normalizing occuring in between application or reversal of batched operations (#2462)
This commit is contained in:
committed by
Ian Storm Taylor
parent
287875b9e3
commit
5395931680
@@ -75,6 +75,7 @@ Commands.redo = editor => {
|
||||
if (!batch) return
|
||||
|
||||
editor.withoutSaving(() => {
|
||||
editor.withoutNormalizing(() => {
|
||||
// Replay the batch of operations.
|
||||
batch.forEach(op => {
|
||||
const { type, properties } = op
|
||||
@@ -94,6 +95,7 @@ Commands.redo = editor => {
|
||||
const newData = data.set('undos', undos).set('redos', redos)
|
||||
editor.setData(newData)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,6 +113,7 @@ Commands.undo = editor => {
|
||||
if (!batch) return
|
||||
|
||||
editor.withoutSaving(() => {
|
||||
editor.withoutNormalizing(() => {
|
||||
// Replay the inverse of the previous operations.
|
||||
batch
|
||||
.slice()
|
||||
@@ -134,6 +137,7 @@ Commands.undo = editor => {
|
||||
const newData = data.set('undos', undos).set('redos', redos)
|
||||
editor.setData(newData)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user