mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fixes in Shortcuts dialog and minor refactor (#1297)
This commit is contained in:
parent
e4c154f43e
commit
0c3d34261e
11 changed files with 96 additions and 82 deletions
|
@ -6,7 +6,7 @@ import { hasBackground, hasStroke, hasText, getTargetElement } from "../scene";
|
|||
import { t } from "../i18n";
|
||||
import { SHAPES } from "../shapes";
|
||||
import { ToolButton } from "./ToolButton";
|
||||
import { capitalizeString, getShortcutKey, setCursorForShape } from "../utils";
|
||||
import { capitalizeString, setCursorForShape } from "../utils";
|
||||
import Stack from "./Stack";
|
||||
import useIsMobile from "../is-mobile";
|
||||
|
||||
|
@ -94,9 +94,9 @@ export function ShapesSwitcher({
|
|||
<>
|
||||
{SHAPES.map(({ value, icon }, index) => {
|
||||
const label = t(`toolBar.${value}`);
|
||||
const shortcut = getShortcutKey(
|
||||
`${capitalizeString(value)[0]}, ${index + 1}`,
|
||||
);
|
||||
const shortcut = `${capitalizeString(value)[0]} ${t(
|
||||
"shortcutsDialog.or",
|
||||
)} ${index + 1}`;
|
||||
return (
|
||||
<ToolButton
|
||||
key={value}
|
||||
|
@ -104,10 +104,11 @@ export function ShapesSwitcher({
|
|||
icon={icon}
|
||||
checked={elementType === value}
|
||||
name="editor-current-shape"
|
||||
title={`${capitalizeString(label)} ${shortcut}`}
|
||||
title={`${capitalizeString(label)} — ${shortcut}`}
|
||||
keyBindingLabel={`${index + 1}`}
|
||||
aria-label={capitalizeString(label)}
|
||||
aria-keyshortcuts={`${label[0]} ${index + 1}`}
|
||||
data-testid={value}
|
||||
onChange={() => {
|
||||
setAppState({
|
||||
elementType: value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue