mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-04-14 16:40:58 -04:00
Handle escape keybinding (#49)
This commit is contained in:
parent
0d75b78374
commit
8a43ed691d
1 changed files with 8 additions and 4 deletions
|
@ -374,10 +374,14 @@ class App extends React.Component<{}, AppState> {
|
|||
};
|
||||
|
||||
private onKeyDown = (event: KeyboardEvent) => {
|
||||
if (
|
||||
event.key === "Backspace" &&
|
||||
(event.target as HTMLElement).nodeName !== "INPUT"
|
||||
) {
|
||||
if ((event.target as HTMLElement).nodeName === "INPUT") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === "Escape") {
|
||||
clearSelection();
|
||||
drawScene();
|
||||
} else if (event.key === "Backspace") {
|
||||
deleteSelectedElements();
|
||||
drawScene();
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Add table
Reference in a new issue