Hi,
I want to call a custom function on before opening folders Filemanager. Is there any solution?
Hello @greget84,
In onInit
though the getState()
you can track every move:
app => {
const state = app.getState();
state.$observe("path", v => {
alert(v)
});
}
In this way the function will be called when the any folder would be opend.
Please, check out the snippet: Code Snippet
Or you can customize list
and cards
by adding a new logic:
function MyHandler(items){
if (items.length === 1) {
const item = items[0];
if (item.type === "folder")
alert("Folder: "+ item.id);
}
}
and override fileManager throuth the new Map([]):
override: new Map([
[fileManager.views.list, MyList],
[fileManager.views.cards, MyCards]
])
With this customization, the function will work only with folders placed in list: Code Snippet