From dbfe12edbf9bc861b52ffecd386e8219eac9a476 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 5 Jun 2021 11:28:36 +1000 Subject: [PATCH] use different toolbar size on Mac see discussion on https://github.com/ankitects/anki/commit/984ab9b6feb63464986b7715d61b2294641a1742 --- ts/editor/EditorToolbar.svelte | 3 ++- ts/lib/platform.ts | 9 +++++++++ ts/lib/shortcuts.ts | 9 ++------- 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 ts/lib/platform.ts diff --git a/ts/editor/EditorToolbar.svelte b/ts/editor/EditorToolbar.svelte index d1a990858..946b4e545 100644 --- a/ts/editor/EditorToolbar.svelte +++ b/ts/editor/EditorToolbar.svelte @@ -30,6 +30,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html diff --git a/ts/lib/platform.ts b/ts/lib/platform.ts new file mode 100644 index 000000000..bdb341284 --- /dev/null +++ b/ts/lib/platform.ts @@ -0,0 +1,9 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + +export function isApplePlatform(): boolean { + return ( + window.navigator.platform.startsWith("Mac") || + window.navigator.platform.startsWith("iP") + ); +} diff --git a/ts/lib/shortcuts.ts b/ts/lib/shortcuts.ts index 078212ca0..c6afa9e09 100644 --- a/ts/lib/shortcuts.ts +++ b/ts/lib/shortcuts.ts @@ -1,16 +1,11 @@ // Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + import * as tr from "./i18n"; +import { isApplePlatform } from "./platform"; export type Modifier = "Control" | "Alt" | "Shift" | "Meta"; -function isApplePlatform(): boolean { - return ( - window.navigator.platform.startsWith("Mac") || - window.navigator.platform.startsWith("iP") - ); -} - // how modifiers are mapped const platformModifiers = isApplePlatform() ? ["Meta", "Alt", "Shift", "Control"]