mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 03:11:44 +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:
@@ -120,7 +120,10 @@ export const HistoryEditor = {
|
||||
withoutSaving(editor: HistoryEditor, fn: () => void): void {
|
||||
const prev = HistoryEditor.isSaving(editor)
|
||||
SAVING.set(editor, false)
|
||||
fn()
|
||||
SAVING.set(editor, prev)
|
||||
try {
|
||||
fn()
|
||||
} finally {
|
||||
SAVING.set(editor, prev)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user