Provides several methods to create documents, folders, and modify them through use of TJSDialog and a modal and non-draggable by default user experience.

Constructors

Methods

  • Change ownership of a document by rendering a dialog to alter the default and all user / player ownership.

    Parameters

    • document: object

      Document instance to modify.

    • Optionaloptions: any

      Rest of options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<object>

    The modified document or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Create a new Document of the type specified by documentCls by rendering a dialog window to provide basic creation details.

    Parameters

    • documentCls: object

      Document class to create.

    • Optionaldata: object

      Document data.

    • Optionalcontext: {
          options?: any;
          pack?: object;
          parent?: object;
          renderSheet?: boolean;
      }

      Additional context options or dialog positioning options.

      • Optionaloptions?: any

        Rest of options to pass to TJSDialog / Application.

      • Optionalpack?: object

        A Compendium pack identifier within which the Documents should be modified.

      • Optionalparent?: object

        A parent Document within which these Documents should be embedded.

      • OptionalrenderSheet?: boolean

        Render the sheet for the new document.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<object>

    The newly created document or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Shows a modal / non-draggable dialog to delete a document.

    Parameters

    • document: object

      Document to delete.

    • Optionalopts: {
          context?: object;
          options?: any;
      }

      Additional context options or dialog positioning options.

      • Optionalcontext?: object

        DocumentModificationContext.

      • Optionaloptions?: any

        Rest of options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<boolean | object>

    The document if deleted or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Create a new Folder by rendering a dialog window to provide basic creation details.

    Parameters

    • folderData: object

      Initial data with which to populate the creation form.

    • Optionaloptions: any

      Options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<object>

    The newly created Folder or null if the dialog is closed.

  • Deletes a folder and does delete subfolders / documents.

    Parameters

    • document: object

      Folder to delete.

    • Optionaloptions: any

      Options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<boolean | object>

    The deleted Folder or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Shows a modal / non-draggable dialog to export a folder to an eligible compendium pack.

    Parameters

    • document: object

      Folder to export.

    • Optionalopts: {
          keepId?: boolean;
          merge?: boolean;
          options?: any;
          pack?: string;
      }

      Additional options.

      • OptionalkeepId?: boolean

        Keep document IDs.

      • Optionalmerge?: boolean

        Update existing entries in the Compendium pack, matching by name

      • Optionaloptions?: any

        Rest of options to pass to TJSDialog / Application.

      • Optionalpack?: string

        The name of the compendium pack to provide an initial selection value in the dialog.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<boolean | object>

    The compendium collection the folder is exported to or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Removes a folder, but does not delete / remove sub-folders / documents.

    Parameters

    • document: object

      Folder to remove.

    • Optionaloptions: any

      Options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<boolean | object>

    The removed Folder or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Create a RollTable from the contents of the Folder.

    Parameters

    • document: object

      Folder to create roll table from...

    • Optionaloptions: any

      Options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<boolean | object>

    The newly created RollTable or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.

  • Updates an existing Folder by rendering a dialog window with basic details.

    Parameters

    • document: object

      The folder to edit.

    • Optionaloptions: any

      Options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<object>

    The modified Folder or null if the dialog is closed.

  • Render an import dialog for updating the data related to this Document through an exported JSON file

    Parameters

    • document: object

      The document to import JSON to...

    • Optionaloptions: any

      Options to pass to TJSDialog / Application.

    • OptionaldialogData: any

      Optional data to modify dialog.

    Returns Promise<boolean | object>

    The document after import completes or a falsy value; either 'false' for cancelling or 'null' if the user closed the dialog via <Esc> or the close header button.