Remove all active selections on pressing ESC key

This commit is contained in:
Jawahar 2022-10-03 19:29:05 +05:30 committed by Andrew Aquino
parent b7babe554b
commit 935c24f887

View file

@ -3747,6 +3747,17 @@ class App extends React.Component<AppProps, AppState> {
}, 100); }, 100);
} }
// remove selections on escape press
if (event.key === "Escape") {
this.setState({
selectedElementIds: {},
selectedGroupIds: {},
editingGroupId: null,
});
event.preventDefault();
return;
}
// prevent browser zoom in input fields // prevent browser zoom in input fields
if (event[KEYS.CTRL_OR_CMD] && isWritableElement(event.target)) { if (event[KEYS.CTRL_OR_CMD] && isWritableElement(event.target)) {
if (event.code === CODES.MINUS || event.code === CODES.EQUAL) { if (event.code === CODES.MINUS || event.code === CODES.EQUAL) {