diff options
author | bobzel <zzzman@gmail.com> | 2021-02-23 01:53:52 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-02-23 01:53:52 -0500 |
commit | 7035e2e6bdcb3efbfa3a4eca887b41eba87e6d6e (patch) | |
tree | 1ac91247a1276e54c10f836ae826d4393b34315d /src/client/util/UndoManager.ts | |
parent | f22163e9e4118df3faf06afc28045b84615fba0d (diff) |
fixed backspace to delete text items in treeViews. simplified UndoRunInTempBatch. fixed clicking on sort line for treeView to only recognize actual clicks. fixed stayInCollection with DocDecorations to not create a giant gray square. prevent server crash when db has bad data somehow.
Diffstat (limited to 'src/client/util/UndoManager.ts')
-rw-r--r-- | src/client/util/UndoManager.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts index 569ad8ab4..05fb9f378 100644 --- a/src/client/util/UndoManager.ts +++ b/src/client/util/UndoManager.ts @@ -148,12 +148,15 @@ export namespace UndoManager { } }); - export function ClearTempBatch() { - tempEvents = undefined; - } export function RunInTempBatch<T>(fn: () => T) { tempEvents = []; - return runInAction(fn); + try { + const success = runInAction(fn); + if (!success) UndoManager.UndoTempBatch(); + return success; + } finally { + tempEvents = undefined; + } } //TODO Make this return the return value export function RunInBatch<T>(fn: () => T, batchName: string) { |