diff options
| author | Aubrey Li <Aubrey-Li> | 2021-10-26 17:16:16 -0400 | 
|---|---|---|
| committer | Aubrey Li <Aubrey-Li> | 2021-10-26 17:16:16 -0400 | 
| commit | 34ce1ba0275406aff180a49f99d333ffa0d86e3b (patch) | |
| tree | 25e8ae29b145e5e1e33c59e285f3b29f5a481dc5 /src/client/views/GlobalKeyHandler.ts | |
| parent | 3c1b393732ef9dc704a2f40b103c37b3f8370ba7 (diff) | |
| parent | 48d5e650ddc8caa8252561bbc91961f2f4677d6e (diff) | |
Merge branch 'master' into trails-aubrey
Diffstat (limited to 'src/client/views/GlobalKeyHandler.ts')
| -rw-r--r-- | src/client/views/GlobalKeyHandler.ts | 18 | 
1 files changed, 10 insertions, 8 deletions
diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts index f66c9c788..364bf05e2 100644 --- a/src/client/views/GlobalKeyHandler.ts +++ b/src/client/views/GlobalKeyHandler.ts @@ -10,10 +10,11 @@ import { Cast, PromiseValue } from "../../fields/Types";  import { GoogleAuthenticationManager } from "../apis/GoogleAuthenticationManager";  import { DocServer } from "../DocServer";  import { DocumentType } from "../documents/DocumentTypes"; -import { DictationManager } from "../util/DictationManager"; +import { CurrentUserUtils } from "../util/CurrentUserUtils";  import { DragManager } from "../util/DragManager";  import { GroupManager } from "../util/GroupManager";  import { SelectionManager } from "../util/SelectionManager"; +import { SettingsManager } from "../util/SettingsManager";  import { SharingManager } from "../util/SharingManager";  import { SnappingManager } from "../util/SnappingManager";  import { undoBatch, UndoManager } from "../util/UndoManager"; @@ -27,8 +28,6 @@ import { LightboxView } from "./LightboxView";  import { MainView } from "./MainView";  import { DocumentLinksButton } from "./nodes/DocumentLinksButton";  import { AnchorMenu } from "./pdf/AnchorMenu"; -import { CurrentUserUtils } from "../util/CurrentUserUtils"; -import { SettingsManager } from "../util/SettingsManager";  const modifiers = ["control", "meta", "shift", "alt"];  type KeyHandler = (keycode: string, e: KeyboardEvent) => KeyControlInfo | Promise<KeyControlInfo>; @@ -142,7 +141,7 @@ export class KeyManager {              case "delete":              case "backspace":                  if (document.activeElement?.tagName !== "INPUT" && document.activeElement?.tagName !== "TEXTAREA") { -                    const selected = SelectionManager.Views().slice(); +                    const selected = SelectionManager.Views().filter(dv => !dv.topMost);                      UndoManager.RunInBatch(() => {                          SelectionManager.DeselectAll();                          selected.map(dv => !dv.props.Document._stayInCollection && dv.props.removeDocument?.(dv.props.Document)); @@ -222,10 +221,13 @@ export class KeyManager {                  PromiseValue(Cast(Doc.UserDoc()["tabs-button-tools"], Doc)).then(pv => pv && (pv.onClick as ScriptField).script.run({ this: pv }));                  break;              case "f": -                const searchBtn = Doc.UserDoc().searchBtn as Doc; - -                if (searchBtn) { -                    MainView.Instance.selectMenu(searchBtn); +                if (SelectionManager.Views().length === 1 && SelectionManager.Views()[0].ComponentView?.search) { +                    SelectionManager.Views()[0].ComponentView?.search?.("", false, false); +                } else { +                    const searchBtn = Doc.UserDoc().searchBtn as Doc; +                    if (searchBtn) { +                        MainView.Instance.selectMenu(searchBtn); +                    }                  }                  break;              case "o":  | 
