mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-30 18:39:51 +02:00
fix: add try/finally block in withoutSaving method to ensure state restoration (#5837)
Co-authored-by: ederjiang <eder@57blocks.com>
This commit is contained in:
5
.changeset/rotten-poems-collect.md
Normal file
5
.changeset/rotten-poems-collect.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-history': patch
|
||||
---
|
||||
|
||||
fix: add try/finally block in withoutSaving method to ensure state restoration
|
@@ -120,7 +120,10 @@ export const HistoryEditor = {
|
||||
withoutSaving(editor: HistoryEditor, fn: () => void): void {
|
||||
const prev = HistoryEditor.isSaving(editor)
|
||||
SAVING.set(editor, false)
|
||||
try {
|
||||
fn()
|
||||
} finally {
|
||||
SAVING.set(editor, prev)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user