diff --git a/src/components/ShortcutsDialog.tsx b/src/components/ShortcutsDialog.tsx index 8cfdc7d5..bb4cf72a 100644 --- a/src/components/ShortcutsDialog.tsx +++ b/src/components/ShortcutsDialog.tsx @@ -56,50 +56,52 @@ const Shortcut = (props: { label: string; shortcuts: string[]; isOr: boolean; -}) => ( -
+}) => { + const isRTL = document.documentElement.getAttribute("dir") === "rtl"; + return (
-
- {props.label} -
- {props.shortcuts.map((shortcut, index) => ( - - {shortcut} - {props.isOr && - index !== props.shortcuts.length - 1 && - t("shortcutsDialog.or")} - - ))} +
+ {props.label} +
+
+ {props.shortcuts.map((shortcut, index) => ( + + {shortcut} + {props.isOr && + index !== props.shortcuts.length - 1 && + t("shortcutsDialog.or")} + + ))} +
-
-); + ); +}; Shortcut.defaultProps = { isOr: true, @@ -111,10 +113,14 @@ const ShortcutKey = (props: { children: React.ReactNode }) => ( wordBreak: "keep-all", border: `1px solid ${oc.gray[4]}`, padding: "2px 8px", - margin: "0 4px", + margin: "auto 4px", backgroundColor: oc.gray[2], borderRadius: "2px", fontSize: "0.8em", + minHeight: "26px", + boxSizing: "border-box", + display: "flex", + alignItems: "center", }} {...props} /> @@ -165,7 +171,7 @@ export const ShortcutsDialog = ({ onClose }: { onClose?: () => void }) => { return ( <> diff --git a/src/utils.ts b/src/utils.ts index 24753315..f0e7d711 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -158,14 +158,12 @@ export const getShortcutKey = (shortcut: string): string => { const isMac = /Mac|iPod|iPhone|iPad/.test(window.navigator.platform); if (isMac) { return `${shortcut - .replace("CtrlOrCmd+", "⌘") - .replace("Alt+", "⌥") - .replace("Ctrl+", "⌃") - .replace("Shift+", "⇧") - .replace("Del", "⌫") - .replace(/Enter|Return/, "↩")}`; + .replace(/CtrlOrCmd/i, "Cmd") + .replace(/Alt/i, "Option") + .replace(/Del/i, "Delete") + .replace(/Enter|Return/i, "Enter")}`; } - return `${shortcut.replace("CtrlOrCmd", "Ctrl")}`; + return `${shortcut.replace(/CtrlOrCmd/i, "Ctrl")}`; }; export function viewportCoordsToSceneCoords( { clientX, clientY }: { clientX: number; clientY: number },