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.

    • Optional options: SvelteApplicationOptions

      Rest of options to pass to TJSDialog / Application.

    • Optional dialogData: TJSDialogOptions

      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.

    • Optional data: object

      Document data.

    • Optional context: {
          options?: SvelteApplicationOptions;
          pack?: object;
          parent?: object;
          renderSheet?: boolean;
      }

      Additional context options or dialog positioning options.

      • Optional options?: SvelteApplicationOptions

        Rest of options to pass to TJSDialog / Application.

      • Optional pack?: object

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

      • Optional parent?: object

        A parent Document within which these Documents should be embedded.

      • Optional renderSheet?: boolean

        Render the sheet for the new document.

    • Optional dialogData: TJSDialogOptions

      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.

    • Optional opts: {
          context?: object;
          options?: SvelteApplicationOptions;
      }

      Additional context options or dialog positioning options.

      • Optional context?: object

        DocumentModificationContext.

      • Optional options?: SvelteApplicationOptions

        Rest of options to pass to TJSDialog / Application.

    • Optional dialogData: TJSDialogOptions

      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.

    • Optional options: SvelteApplicationOptions

      Options to pass to TJSDialog / Application.

    • Optional dialogData: TJSDialogOptions

      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

    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.

    • Optional opts: {
          keepId?: boolean;
          merge?: boolean;
          options?: SvelteApplicationOptions;
          pack?: string;
      }

      Additional options.

      • Optional keepId?: boolean

        Keep document IDs.

      • Optional merge?: boolean

        Update existing entries in the Compendium pack, matching by name

      • Optional options?: SvelteApplicationOptions

        Rest of options to pass to TJSDialog / Application.

      • Optional pack?: string

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

    • Optional dialogData: TJSDialogOptions

      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

    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...

    • Optional options: SvelteApplicationOptions

      Options to pass to TJSDialog / Application.

    • Optional dialogData: TJSDialogOptions

      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

    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...

    • Optional options: SvelteApplicationOptions

      Options to pass to TJSDialog / Application.

    • Optional dialogData: TJSDialogOptions

      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.