Fixes in Shortcuts dialog and minor refactor (#1297)
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user