open-file
Description
Fires when opening a fileThe action is triggered with a double-click on a file but you need to add the event handler to process the action (e.g., use the api.on() method) so that a file gets opened.
Usage
"open-file": ({
id: string
}) => boolean | void;
Parameters
The callback of the open-file action takes an object with the following parameters:
id- (required) the ID of a file
Example
import { getData, getDrive } from "./common/data";
import { Filemanager } from "@svar-ui/react-filemanager";
function App() {
const init = (api) => {
api.on("open-file", ({ id }) => {
console.log(`File ${id} is double-clicked`);
});
};
return (
<Filemanager data={getData()} drive={getDrive()} init={init} />
);
}
export default App;
Related articles: How to access File Manager API