aboutsummaryrefslogtreecommitdiff
path: root/src/client/util
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-02-23 01:53:52 -0500
committerbobzel <zzzman@gmail.com>2021-02-23 01:53:52 -0500
commit7035e2e6bdcb3efbfa3a4eca887b41eba87e6d6e (patch)
tree1ac91247a1276e54c10f836ae826d4393b34315d /src/client/util
parentf22163e9e4118df3faf06afc28045b84615fba0d (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')
-rw-r--r--src/client/util/CurrentUserUtils.ts2
-rw-r--r--src/client/util/DragManager.ts2
-rw-r--r--src/client/util/UndoManager.ts11
3 files changed, 9 insertions, 6 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts
index 288f75592..beced8c3c 100644
--- a/src/client/util/CurrentUserUtils.ts
+++ b/src/client/util/CurrentUserUtils.ts
@@ -558,7 +558,7 @@ export class CurrentUserUtils {
_width: 60,
_height: 60,
watchedDocuments,
- onClick: ScriptField.MakeScript(click, { scriptContext: "any" }), system: true
+ onClick: ScriptField.MakeScript(click, { scriptContext: "any" })
}));
const userDoc = menuBtns[menuBtns.length - 1];
userDoc.userDoc = doc;
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts
index 7b4d43793..19f1f8d15 100644
--- a/src/client/util/DragManager.ts
+++ b/src/client/util/DragManager.ts
@@ -13,7 +13,7 @@ import * as globalCssVariables from "../views/globalCssVariables.scss";
import { UndoManager } from "./UndoManager";
import { SnappingManager } from "./SnappingManager";
-export type dropActionType = "alias" | "copy" | "move" | "same" | "none" | undefined; // undefined = move
+export type dropActionType = "alias" | "copy" | "move" | "same" | "none" | undefined; // undefined = move, "same" = move but don't call removeDropProperties
export function SetupDrag(
_reference: React.RefObject<HTMLElement>,
docFunc: () => Doc | Promise<Doc> | undefined,
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) {