I’ve put together a quick prototype solution. I’m posting it here so maybe it can be useful to others. I haven’t tested it yet and it’s still a bit rough, so copy/paste with care:
const getNextFile = (canEditFile, files, filePosition) => {
const newFile = files[filePosition + 1]
if (!newFile) return null
if (canEditFile(newFile)) return newFile
return getNextFile(canEditFile, files, filePosition + 1)
}
uppy.on('files-added', () => {
hasNewFiles = true // This could be a react component's state for example
}
uppy.on('file-editor:complete', file => {
if (hasNewFiles) {
const dashboard = uppy.getPlugin('Dashboard')
const files = uppy.getFiles()
const currentFilePosition = files.findIndex(f => f.id == file.id)
const nextFile = getNextFile(dashboard.canEditFile, files, currentFilePosition)
if (!nextFile) {
hasNewFiles = false
} else {
dashboard.openFileEditor(nextFile)
}
}
}