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"]