snapshot of https://github.com/excalidraw/excalidraw.git (master, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Tests / test (push) Failing after 15s
Some checks failed
Tests / test (push) Failing after 15s
This commit is contained in:
19
packages/excalidraw/shortcut.ts
Normal file
19
packages/excalidraw/shortcut.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { isDarwin } from "@excalidraw/common";
|
||||
|
||||
import { t } from "./i18n";
|
||||
|
||||
export const getShortcutKey = (shortcut: string): string =>
|
||||
shortcut
|
||||
.replace(
|
||||
/\b(Opt(?:ion)?|Alt)\b/i,
|
||||
isDarwin ? t("keys.option") : t("keys.alt"),
|
||||
)
|
||||
.replace(/\bShift\b/i, t("keys.shift"))
|
||||
.replace(/\b(Enter|Return)\b/i, t("keys.enter"))
|
||||
.replace(
|
||||
/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,
|
||||
isDarwin ? t("keys.cmd") : t("keys.ctrl"),
|
||||
)
|
||||
.replace(/\b(Esc(?:ape)?)\b/i, t("keys.escape"))
|
||||
.replace(/\b(Space(?:bar)?)\b/i, t("keys.spacebar"))
|
||||
.replace(/\b(Del(?:ete)?)\b/i, t("keys.delete"));
|
||||
Reference in New Issue
Block a user