aboutsummaryrefslogtreecommitdiff
path: root/src/client/util
diff options
context:
space:
mode:
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) {