aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/GlobalKeyHandler.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-11-22 01:01:33 -0500
committerbobzel <zzzman@gmail.com>2020-11-22 01:01:33 -0500
commit650ca6166548a6ea1554064c98a2927f0450942a (patch)
tree40ccd1258769f5472fd22be724ea53a00ec251a3 /src/client/views/GlobalKeyHandler.ts
parent4835cefd9cab01de2ffd9f9ceb0962dc99b00928 (diff)
extended clusters to support user groups. made clusters select contents on click. made send to back/ bring to front apply to entire selection.
Diffstat (limited to 'src/client/views/GlobalKeyHandler.ts')
-rw-r--r--src/client/views/GlobalKeyHandler.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts
index 522900fd2..33c6af266 100644
--- a/src/client/views/GlobalKeyHandler.ts
+++ b/src/client/views/GlobalKeyHandler.ts
@@ -26,6 +26,7 @@ import { DocumentView } from "./nodes/DocumentView";
import { PDFMenu } from "./pdf/PDFMenu";
import { SnappingManager } from "../util/SnappingManager";
import { SearchBox } from "./search/SearchBox";
+import { random } from "lodash";
const modifiers = ["control", "meta", "shift", "alt"];
type KeyHandler = (keycode: string, e: KeyboardEvent) => KeyControlInfo | Promise<KeyControlInfo>;
@@ -85,7 +86,15 @@ export class KeyManager {
private unmodified = action((keyname: string, e: KeyboardEvent) => {
switch (keyname) {
- case "a": DragManager.CanEmbed = true;
+ case "g":
+ if (document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA") {
+ return { stopPropagation: false, preventDefault: false };
+ }
+
+ const groupings = SelectionManager.SelectedDocuments().slice();
+ const randomGroup = random(0, 1000);
+ UndoManager.RunInBatch(() => groupings.map(dv => dv.layoutDoc.group = randomGroup), "delete");
+ SelectionManager.DeselectAll();
break;
case " ":
// MarqueeView.DragMarquee = !MarqueeView.DragMarquee; // bcz: this needs a better disclosure UI