mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 22:45:18 +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
|
if (!batch) return
|
||||||
|
|
||||||
editor.withoutSaving(() => {
|
editor.withoutSaving(() => {
|
||||||
|
editor.withoutNormalizing(() => {
|
||||||
// Replay the batch of operations.
|
// Replay the batch of operations.
|
||||||
batch.forEach(op => {
|
batch.forEach(op => {
|
||||||
const { type, properties } = op
|
const { type, properties } = op
|
||||||
@@ -94,6 +95,7 @@ Commands.redo = editor => {
|
|||||||
const newData = data.set('undos', undos).set('redos', redos)
|
const newData = data.set('undos', undos).set('redos', redos)
|
||||||
editor.setData(newData)
|
editor.setData(newData)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,6 +113,7 @@ Commands.undo = editor => {
|
|||||||
if (!batch) return
|
if (!batch) return
|
||||||
|
|
||||||
editor.withoutSaving(() => {
|
editor.withoutSaving(() => {
|
||||||
|
editor.withoutNormalizing(() => {
|
||||||
// Replay the inverse of the previous operations.
|
// Replay the inverse of the previous operations.
|
||||||
batch
|
batch
|
||||||
.slice()
|
.slice()
|
||||||
@@ -134,6 +137,7 @@ Commands.undo = editor => {
|
|||||||
const newData = data.set('undos', undos).set('redos', redos)
|
const newData = data.set('undos', undos).set('redos', redos)
|
||||||
editor.setData(newData)
|
editor.setData(newData)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user