8000 Clear state properties for selectedFiles and itemActionMenu. · arduino/lab-micropython-editor@af741cb · GitHub
[go: up one dir, main page]

Skip to content

Commit af741cb

Browse files
committed
Clear state properties for selectedFiles and itemActionMenu.
Signed-off-by: ubi de feo <me@ubidefeo.com>
1 parent bffb265 commit af741cb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ui/arduino/store.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,14 @@ async function store(state, emitter) {
105105
emitter.on('change-view', (view) => {
106106

107107
if (state.view === 'file-manager') {
108+
// Clicking the file manager button has the useful side effect
109+
// of refreshing the files, so we don't want to clear the selection
108110
if (view != state.view) {
109111
state.selectedFiles = []
110112
}
111113
emitter.emit('refresh-files')
114+
} else {
115+
state.itemActionMenu = null
112116
}
113117
state.view = view
114118
emitter.emit('render')
@@ -1138,6 +1142,7 @@ async function store(state, emitter) {
11381142
})
11391143

11401144
emitter.on('file-context-menu', (file, source, event) => {
1145+
state.selectedFiles = []
11411146
let parentFolder = source == 'board' ? state.boardNavigationPath : state.diskNavigationPath
11421147
log('file-contextual-menu', file, source, event)
11431148
let itemIndex = state.selectedFiles.findIndex((f) => {
@@ -1431,6 +1436,7 @@ async function store(state, emitter) {
14311436
state.boardNavigationPath,
14321437
folder
14331438
)
1439+
state.itemActionMenu = null
14341440
emitter.emit('refresh-files')
14351441
emitter.emit('render')
14361442
})
@@ -1440,6 +1446,7 @@ async function store(state, emitter) {
14401446
state.boardNavigationPath,
14411447
'..'
14421448
)
1449+
state.itemActionMenu = null
14431450
emitter.emit('refresh-files')
14441451
emitter.emit('render')
14451452
})

0 commit comments

Comments
 (0)
0