mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: deselect on escape only if neither dragging nor finalizing an action
This commit is contained in:
parent
db9aca37b6
commit
63e748f147
1 changed files with 10 additions and 5 deletions
|
@ -3748,11 +3748,16 @@ class App extends React.Component<AppProps, AppState> {
|
|||
}
|
||||
|
||||
// remove selections on escape press
|
||||
if (event.key === KEYS.ESCAPE) {
|
||||
// Don't deselect text right after editing it
|
||||
if (isWritableElement(event.target)) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
event.key === KEYS.ESCAPE &&
|
||||
// unless we're dragging or finalizing an action
|
||||
!(
|
||||
this.state.draggingElement ||
|
||||
isWritableElement(event.target) ||
|
||||
this.state.editingElement ||
|
||||
["freedraw", "eraser"].includes(this.state.activeTool.type)
|
||||
)
|
||||
) {
|
||||
this.setState({
|
||||
selectedElementIds: {},
|
||||
selectedGroupIds: {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue