8000 Removed ESC from global shortcuts to locally handle it in dialog. · arduino/lab-micropython-editor@cc93543 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc93543

Browse files
committed
Removed ESC from global shortcuts to locally handle it in dialog.
Signed-off-by: ubi de feo <me@ubidefeo.com>
1 parent 187424b commit cc93543

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

backend/shortcuts.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module.exports = {
1111
CLEAR_TERMINAL: 'CommandOrControl+L',
1212
EDITOR_VIEW: 'CommandOrControl+Alt+1',
1313
FILES_VIEW: 'CommandOrControl+Alt+2',
14-
ESC: 'Escape'
1514
},
1615
menu: {
1716
CONNECT: 'CmdOrCtrl+Shift+C',

ui/arduino/store.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,11 +1447,11 @@ async function store(state, emitter) {
14471447
if (state.view != 'editor') return
14481448
emitter.emit('change-view', 'file-manager')
14491449
}
1450-
if (key === shortcuts.ESC) {
1451-
if (state.isConnectionDialogOpen) {
1452-
emitter.emit('close-connection-dialog')
1453-
}
1454-
}
1450+
// if (key === shortcuts.ESC) {
1451+
// if (state.isConnectionDialogOpen) {
1452+
// emitter.emit('close-connection-dialog')
1453+
// }
1454+
// }
14551455

14561456
})
14571457

ui/arduino/views/components/connection-dialog.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ function ConnectionDialog(state, emit) {
66
}
77
}
88

9+
function onKeyDown(e) {
10+
if (e.key.toLowerCase() === 'escape') {
11+
emit('close-connection-dialog')
12+
}
13+
}
14+
15+
// Add/remove event listener based on dialog state
16+
if (state.isConnectionDialogOpen) {
17+
document.addEventListener('keydown', onKeyDown)
18+
} else {
19+
document.removeEventListener('keydown', onKeyDown)
20+
}
21+
922
return html`
1023
<div id="dialog" class="${stateClass}" onclick=${onClick}>
1124
<div class="dialog-content">

0 commit comments

Comments
 (0)
0