Manages all Hook usage in Tidy 5e Sheets

Constructors

Methods

  • Something has been dropped on an item or container sheet. Return false to prevent default behavior.

    Parameters

    • item: any

      the target item

    • app: any

      the target item sheet

    • data: any

      the drop data

    Returns boolean

    false to prevent default behavior, else the result is discarded

  • The active effect context menu has established its options and is about to show.

    Parameters

    • effect: any

      The active effect document instance.

    • menuItems: ContextMenuEntry[]

      The menu items for this active effect.

    Returns boolean

    true to allow the menu to show, false to prevent the default menu from showing.

    Hooks.on('dnd5e.getActiveEffectContextOptions', (effect, menuItems) => {
    return true;
    });
  • The context menu for the advancements list has been constructed.

    Parameters

    • html: any

      The HTML element to which the context options are attached.

    • contextOptions: ContextMenuEntry[]

      The context menu entries.

    Returns boolean

    true to allow the menu to show, false to prevent the default menu from showing.

    Hooks.on('dnd5e.getItemAdvancementContext', (html, contextOptions) => {
    return true;
    });
  • The item context menu has established its options and is about to show.

    Parameters

    • item: any

      The item document instance.

    • menuItems: ContextMenuEntry[]

      The menu items for this item.

    Returns boolean

    true to allow the menu to show, false to prevent the default menu from showing.

    Hooks.on('dnd5e.getItemContextOptions', (item, menuItems) => {
    return true;
    });
  • The context menu is about to show for a given item on a sheet.

    Parameters

    • item: any

      The item document instance.

    • options: {
          event: Event;
      }

      The mouse event which triggered the context menu.

      • event: Event

    Returns void

    Hooks.on('tidy5e-sheet.actorItemUseContextMenu', (item, options) => {
    // Your code here
    });
  • An item is about to be used by an actor.

    Parameters

    • item: any

      The affected item document instance.

    • options: any

      Any options for the item use.

    Returns boolean

    true to allow the item use, false to prevent it.

    Hooks.on('tidy5e-sheet.actorPreUseItem', (item, config, options) => {
    return true;
    });
  • The group member context menu has established its options and is about to show.

    Parameters

    • group: Group5e

      The affected group document instance.

    • member: any

      The actor which is a member of the group.

    • contextOptions: ContextMenuEntry[]

      The menu items for this group member.

    Returns boolean

    true to allow the menu to show, false to prevent the default menu from showing.

  • A user has hovered off an item, typically from an item table row.

    Parameters

    • event: Event

      The triggering mouse event.

    • item: any

      The item which is no longer hovered.

    Returns void

    Hooks.on('tidy5e-sheet.itemHoverOff', (event, item) => {
    // Your code here
    });
  • A user has hovered over an item, typically on an item table row.

    Parameters

    • event: Event

      The triggering mouse event.

    • item: any

      The hovered-over item.

    Returns void

    Hooks.on('tidy5e-sheet.itemHoverOn', (event, item) => {
    // Your code here
    });
  • Sheet item/effect sections are about to be configured. Use this hook to inject additional items, sections, etc., or to adjust context data.

    Parameters

    • app: any

      The sheet application instance.

    • element: HTMLElement

      The sheet HTML element.

    • data: ContainerSheetClassicContext | CharacterSheetContext | NpcSheetContext

      The data context from getData().

    Returns void

    Hooks.on('tidy5e-sheet.preConfigureSections', (app, element, data) => {
    // Your code here
    });
  • An active effect is about to be created for an owning document. This was initiated specifically through Tidy 5e Sheets, whether directly by the user, or indirectly through some user interaction.

    Parameters

    • owner: any

      The owning document instance which will receive the created effect.

    • createData: object

      The data used to create it.

    • userId: string

      The user who initiated the creation.

    Returns boolean

    true to allow the effect creation, false to prevent it.

    Hooks.on('tidy5e-sheet.preCreateActiveEffect', (owner, createData, userId) => {
    return true;
    });
  • An item is about to be created for an owning document. This was initiated specifically through Tidy 5e Sheets, whether directly by the user, or indirectly through some user interaction.

    Parameters

    • owner: any

      The owning document instance which will receive the created item.

    • createData: object

      The data used to create it.

    • userId: string

      The user who initiated the creation.

    Returns boolean

    true to allow the item creation, false to prevent it.

    Hooks.on('tidy5e-sheet.preCreateItem', (owner, createData, userId) => {
    return true;
    });
  • The portrait picker is about to open.

    Parameters

    • context: ActorSheetContextV1 | ActorSheetContextV2

      The actor sheet data from getData().

    • event: MouseEvent & {
          currentTarget: EventTarget & HTMLElement;
      }

      The triggering event.

    Returns boolean

    true to allow the picker to open, false to prevent it.

    Hooks.on('tidy5e-sheet.preOpenActorPortraitFilePicker', (context, event) => {
    return true;
    });
  • The floating context menu's positioning is being determined.

    Parameters

    • positionInfo: ContextMenuPositionInfo

      Context menu positioning info, used for determining where to put the context menu.

    Returns boolean

    true to allow the menu to show, false to prevent the default menu from showing.

    Hooks.on('tidy5e-sheet.prepareFloatingContextMenuPosition', (positionInfo) => {
    return true;
    });
  • Resources have been prepared. Use this hook to adjust them and/or add new resources.

    Parameters

    • tidyResources: TidyResource[]

      The resources that have been prepared for the sheet.

    • actor: any

      The affected actor.

    Returns void

    Hooks.on('tidy5e-sheet.prepareResources', (tidyResources, actor) => {
    // Your code here
    });
  • A tab is about to be selected.

    Parameters

    • app: any

      The sheet application instance.

    • element: HTMLElement

      The sheet's HTML element.

    • data: {
          currentTab: any;
          newTab: string;
      }

      The current tab ID before selecting the new tab, and the new tab ID to be selected.

      • currentTab: any
      • newTab: string

    Returns boolean

    false to cancel tabbing.

    Hooks.on('tidy5e-sheet.preSelectTab', (app, element, data) => {
    return true;
    });
  • Tidy 5e Sheets is ready to be used and customized.

    Parameters

    • api: Tidy5eSheetsApi

      The Tidy 5e Sheets API, used for customizing and registering content with Tidy 5e Sheets.

    Returns void

    Hooks.on('tidy5e-sheet.ready', (api) => {
    // Your code here
    });
  • The actor sheet has rendered all content and registered custom content. Is called on partial and full renders.

    Parameters

    • app: any

      The sheet application instance.

    • element: HTMLElement

      The sheet's HTML element.

    • data: CharacterSheetContext | NpcSheetContext | VehicleSheetContext

      The data context from getData().

    • forced: boolean

      true when performing a full re-render; false when performing a partial re-render.

    Returns void

    Hooks.on('tidy5e-sheet.renderActorSheet', (app, element, data, forced) => {
    // Your code here
    });
  • The item sheet has rendered all content and registered custom content. Is called on partial and full renders.

    Parameters

    • app: any

      The target item sheet application class instance.

    • element: HTMLElement

      The item sheet's HTML element.

    • data: ItemSheetContext | ContainerSheetClassicContext

      The data context from getData().

    • forced: boolean

      true when performing a full re-render; false when performing a partial re-render.

    Returns void

    Hooks.on('tidy5e-sheet.renderItemSheet', (app, element, data, forced) => {
    // Your code here
    });

    This hook is now redundant for App V2 item and container sheets. It will be removed as of Tidy V8.

  • A tab has been selected on the sheet.

    Parameters

    • app: any

      The sheet application instance.

    • element: HTMLElement

      The sheet's HTML element.

    • newTabId: string

      The selected tab ID.

    Returns void

    Hooks.on('tidy5e-sheet.selectTab', (app, element, newTabId) => {
    // Your code here
    });