interface FileActionData {
    default?: DefaultType;
    destructive?: boolean;
    displayName: ((files: Node[], view: View) => string);
    enabled?: ((files: Node[], view: View) => boolean);
    exec: ((file: Node, view: View, dir: string) => Promise<null | boolean>);
    execBatch?: ((files: Node[], view: View, dir: string) => Promise<(null | boolean)[]>);
    iconSvgInline: ((files: Node[], view: View) => string);
    id: string;
    inline?: ((file: Node, view: View) => boolean);
    order?: number;
    parent?: string;
    renderInline?: ((file: Node, view: View) => Promise<null | HTMLElement>);
    title?: ((files: Node[], view: View) => string);
}

Properties

default?: DefaultType

Make this action the default. If multiple actions are default, the first one will be used. The other ones will be put as first entries in the actions menu iff DefaultType.Hidden is not used. A DefaultType.Hidden action will never be shown in the actions menu even if another action takes its place as default.

destructive?: boolean

Set to true if this action is a destructive action, like "delete". This will change the appearance in the action menu more prominent (e.g. red colored)

displayName: ((files: Node[], view: View) => string)

Translatable string displayed in the menu

enabled?: ((files: Node[], view: View) => boolean)

Condition wether this action is shown or not

exec: ((file: Node, view: View, dir: string) => Promise<null | boolean>)

Function executed on single file action

Type declaration

    • (file, view, dir): Promise<null | boolean>
    • Parameters

      Returns Promise<null | boolean>

      true if the action was executed successfully, false otherwise and null if the action is silent/undefined.

Error if the action failed

execBatch?: ((files: Node[], view: View, dir: string) => Promise<(null | boolean)[]>)

Function executed on multiple files action

Type declaration

    • (files, view, dir): Promise<(null | boolean)[]>
    • Parameters

      Returns Promise<(null | boolean)[]>

      true if the action was executed successfully, false otherwise and null if the action is silent/undefined.

Error if the action failed

iconSvgInline: ((files: Node[], view: View) => string)

Svg as inline string.

id: string

Unique ID

inline?: ((file: Node, view: View) => boolean)

If true, the renderInline function will be called

order?: number

This action order in the list

parent?: string

This action's parent id in the list. If none found, will be displayed as a top-level action.

renderInline?: ((file: Node, view: View) => Promise<null | HTMLElement>)

If defined, the returned html element will be appended before the actions menu.

title?: ((files: Node[], view: View) => string)

Translatable title for of the action