File-Menu when Selecting Multiple Files at Once?

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"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?

1 Like

Any update here? I would also be interested in this.

@FEZ & @ahackel

There is an documented function for this:

// @ts-ignore (files-menu event exists)"files-menu", (menu: menu, files: TFile[]) => {
	// ...
1 Like

We should probably add that to the public API… good point.

1 Like