I’m currently developing a plugin that performs actions on all files within a folder. While that part is working fine, I was curious about being able to apply that same action when multi-selecting files, so they don’t have to be in a folder.
The function I use is
this.app.workspace.on("file-menu", (menu, file, source) => {
if (file instanceof TFolder) {
//add menu
});
}
})
Initially I wanted to see if file
may turn into an array when selecting multiple files, so I used console.log({file})
before my if
statement to see what would happen. To my surprise, console.log
did not run when I right-clicked on a selection of multiple files. Why is this? Does the file-menu
event not run when right-clicking on a selection?