Skip to main content

delete-files

Description

Fires when deleting a file or folder

Usage

"delete-files": ({ ids: string [] }) => void | boolean;

Parameters

The callback of the delete-files action takes an object with the following parameters:

  • ids - (required) an array with IDs of files or folders that are deleted

Returning false from the event handler will block the operation, which you can do via the api.intercept() method.

Example

import { useCallback } from "react";
import { Filemanager } from "@svar-ui/react-filemanager";
import { getData, getDrive } from "./common/data";

export default function App() {
const init = useCallback((api) => {
api.on("delete-files", ({ ids }) => {
console.log(`${ids.join(", ")} were deleted`);
});
}, []);

return (
<Filemanager
init={init}
data={getData()}
drive={getDrive()}
/>
);
}

Related articles: How to access File Manager API