Virtual whiteboard for sketching hand-drawn like diagrams
Add keybindings for shapes (#648)
Christopher Chedeauf8a41cee1608
diff --git a/src/components/ToolButton.tsx b/src/components/ToolButton.tsxindex 6e401a027b..120a3f83f7 100644--- a/src/components/ToolButton.tsx+++ b/src/components/ToolButton.tsx@@ -13,6 +13,7 @@ type ToolButtonBaseProps = {name?: string;id?: string;size?: ToolIconSize;+ keyBindingLabel?: string;};type ToolButtonProps =@@ -63,7 +64,12 @@ export const ToolButton = React.forwardRef(function(checked={props.checked}ref={innerRef}/>- <div className="ToolIcon__icon">{props.icon}</div>+ <div className="ToolIcon__icon">+ {props.icon}+ {props.keyBindingLabel && (+ <span className="ToolIcon__keybinding">{props.keyBindingLabel}</span>+ )}+ </div></label>);});diff --git a/src/components/ToolIcon.scss b/src/components/ToolIcon.scssindex 5f05450424..c1281843a1 100644--- a/src/components/ToolIcon.scss+++ b/src/components/ToolIcon.scss@@ -83,3 +83,12 @@box-shadow: none;}}++.ToolIcon__keybinding {+ position: absolute;+ bottom: 2px;+ right: 3px;+ font-size: 0.5em;+ color: #adb5bd; // OC GRAY 5+ font-family: Arial, Helvetica, sans-serif;+}diff --git a/src/index.tsx b/src/index.tsxindex 2d46022cd5..55cc28bc26 100644--- a/src/index.tsx+++ b/src/index.tsx@@ -374,7 +374,6 @@ export class App extends React.Component<any, AppState> {} else if (shapesShortcutKeys.includes(event.key.toLowerCase()) &&!event.ctrlKey &&- !event.shiftKey &&!event.altKey &&!event.metaKey &&this.state.draggingElement === null@@ -564,6 +563,7 @@ export class App extends React.Component<any, AppState> {title={`${capitalizeString(label)} — ${capitalizeString(value)[0]}, ${index + 1}`}+ keyBindingLabel={`${index + 1}`}aria-label={capitalizeString(label)}aria-keyshortcuts={`${label[0]} ${index + 1}`}onChange={() => {