1
0
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:
Eder is a nobody
2025-04-16 02:28:03 +08:00
committed by GitHub
parent 4aa16bb8b7
commit 701d5f320f
2 changed files with 10 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
'slate-history': patch
---
fix: add try/finally block in withoutSaving method to ensure state restoration

View File

@@ -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)
}
},
}