FileItem

Describes an item that allows the plugin to control clicking on the specified file type. It does not work with the files that already have some actions.

Parameters
Name Description Type Example
Defines the file extension. If several plugins have the same extension, the last plugin from this list is taken. string ".drawio"
Defines a function that takes the File object with the file data as an argument. This function can be asynchronous. It will be executed when the user clicks on a file with the required extension. func async (item: File) => {}
Defines the types of users who have the access to the current item. Currently the following user types are available: owner, docSpaceAdmin, roomAdmin, collaborator, user. If this parameter is not specified, then the current item will be available for all user types. array of UsersType [UsersType.owner, UsersType.docSpaceAdmin, UsersType.roomAdmin]
Defines the types of devices where the current item will be available. At the moment the following device types are available: mobile, tablet, desktop. If this parameter is not specified, then the current item will be available in any device types. array of Devices [Devices.desktop]
Defines a file type which is displayed in the list (for example, Document/Folder). string "Diagram"
Defines a file icon which is displayed in the table format. The preferred icon size is 32x32 px. string "drawio-32.svg"
Defines a file icon which is displayed in the tile format. The preferred icon size is 96x96 px. string "drawio-96.svg"
Example
import {IFileItem, File} from "@onlyoffice/docspace-plugin-sdk";

export const drawIoItem: IFileItem = {
    "extension": ".drawio",
    "fileTypeName": "Diagram",
    "fileRowIcon": "drawio-32.svg",
    "fileTileIcon": "drawio-96.svg",
    "onClick": async (item: File) => {},
};