Optional
options: any = {}Options that configure the behavior of the FilePicker
Track the active source tab which is being browsed
A button controlling the display of the picker UI
A callback function to trigger once a file has been selected
The display mode of the FilePicker UI
The current set of file extensions which are being filtered upon
The target HTML element this file picker is bound to
Application instance configuration options.
The current position of the application with respect to the window.document.body.
The full requested path given by the user
The latest set of results browsed from the server
The file sources available for browsing
If this Application uses tabbed navigation groups, this mapping is updated whenever the changeTab method is called.
Reports the active tab for each group, with a value of null
indicating no tab is active.
Subclasses may override this property to define default tabs for each group.
The general file type which controls the set of extensions which will be accepted
Static
Internal
_appAn incrementing integer Application ID.
Static
Internal
_maxZThe current maximum z-index of any displayed Application.
Static
BASE_Designates which upstream Application class in this class' inheritance chain is the base application. Any DEFAULT_OPTIONS of super-classes further upstream of the BASE_APPLICATION are ignored. Hook events for super-classes further upstream of the BASE_APPLICATION are not dispatched.
Static
DEFAULT_Static
DISPLAY_Enumerate the allowed FilePicker display modes
Static
emittedStatic
FILE_The allowed values for the type of this FilePicker instance.
Static
LAST_Record the last-browsed directory path so that re-opening a different FilePicker instance uses the same target
Static
LAST_Record the last-configured display mode so that re-opening a different FilePicker instance uses the same mode.
Static
LAST_Record the last-configured tile size which can automatically be applied to new FilePicker instances
Static
PARTSStatic
RENDER_The sequence of rendering states that describe the Application life-cycle.
Static
S3_Cache the names of S3 buckets which can be used
Static
TABSWhether the current user is able to create folders.
Whether the current use is able to upload file content.
The CSS class list of this Application instance
The HTMLElement which renders this Application into the DOM.
Get favorite folders for quick access
Does this Application have a top-level form element?
Does this Application instance render within an outer window frame?
The HTML element ID of this Application instance.
This provides a readonly view into the internal ID used by this application.
This getter should not be overridden by subclasses, which should instead configure the ID in DEFAULT_OPTIONS
or
by defining a uniqueId
during _initializeApplicationOptions
.
Is this Application instance currently minimized?
Is this Application instance currently rendered?
Return the source object for the currently active source
The current render state of the Application.
Return the target directory for the currently active source
Convenience references to window header elements.
Static
implementationRetrieve the configured FilePicker implementation.
Static
uploadURLReturn the upload URL to which the FilePicker should post uploaded files
Internal
Wait for a CSS transition to complete for an element.
The element which is transitioning
A timeout in milliseconds in case the transitionend event does not occur
Internal
Perform an event in the application life-cycle. Await an internal life-cycle method defined by the class. Optionally dispatch an event for any registered listeners.
A handler function to call
Options which configure event handling
Optional
async?: booleanAwait the result of the handler function?
Optional
debugText?: stringDebugging text to log for the event
Optional
eventName?: stringAn event name to dispatch for registered listeners
Optional
handlerArgs?: any[]Arguments passed to the handler function
Optional
hookArgs?: any[]Arguments passed to the requested hook function
Optional
hookName?: stringA hook name to dispatch for this and all parent classes
Optional
hookResponse?: booleanAdd the handler response to hookArgs
Optional
parentClassHooks?: booleanCall hooks for parent classes in the inheritance chain?
A promise which resoles once the handler is complete if async is true
Abstract
_renderHTMLRender an HTMLElement for the Application. An Application subclass must implement this method in order for the Application to be renderable.
Context data for the render operation
Options which configure application rendering behavior
The result of HTML rendering may be implementation specific. Whatever value is returned here is passed to _replaceHTML
Add a new event listener for a certain type of event.
The type of event being registered for
The listener function called when the event occurs
Optional
options: { once?: boolean } = {}Options which configure the event listener
Optional
once?: booleanShould the event only be responded to once and then removed
Bring this Application window to the front of the rendering stack by increasing its z-index. Once ApplicationV1 is deprecated we should switch from _maxZ to ApplicationV2#maxZ We should also eliminate ui.activeWindow in favor of only ApplicationV2#frontApp
Browse to a specific location for this FilePicker instance
Optional
target: string = ...The target within the currently active source location.
Optional
options: object = {}Browsing options
Close the Application, removing it from the DOM.
Optional
options: Partial<ApplicationClosingOptions> = {}Options which modify how the application is closed.
A Promise which resolves to the closed Application instance
Dispatch an event on this target.
The Event to dispatch
Was default behavior for the event prevented?
Restore the Application to its original dimensions.
Minimize the Application, collapsing it to a minimal header.
Remove an event listener for a certain type of event.
The type of event being removed
The listener function being removed
Update the Application element position using provided data which is merged with the prior position.
Optional
position: Partial<ApplicationPosition>New Application positioning data
The updated application position
Programmatically submit an ApplicationV2 instance which implements a single top-level form.
Optional
submitOptions: object = {}Arbitrary options which are supported by and provided to the configured form submission handler.
A promise that resolves to the returned result of the form submission handler, if any.
Toggle display of the Application controls menu. Only applicable to window Applications.
Optional
expanded: booleanSet the controls visibility to a specific state. Otherwise, the visible state is toggled from its current value
Optional
options: { animate?: boolean } = {}Options to configure the toggling behavior.
Optional
animate?: booleanAnimate the controls toggling.
A Promise which resolves once the control expansion animation is complete
Protected
_attachProtected
Attach event listeners to the Application frame.
Protected
_canProtected
Test whether this Application is allowed to be rendered.
Provided render options
Return false to prevent rendering
Protected
_configureProtected
Modify the provided options passed to a render request.
Options which configure application rendering behavior
Protected
_createProtected
Create a ContextMenu instance used in this Application.
A handler function that provides initial context options
A CSS selector to which the ContextMenu will be bound
Optional
options: { container?: HTMLElement; hookName?: string; parentClassHooks?: boolean } = {}Additional options which affect ContextMenu construction
Optional
container?: HTMLElementA parent HTMLElement which contains the selector target
Optional
hookName?: stringThe hook name
Optional
parentClassHooks?: booleanWhether to call hooks for the parent classes in the inheritance chain.
A created ContextMenu or null if no menu items were defined
Protected
_getProtected
Configure the array of header control menu options
Protected
_getProtected
Get the configuration for a tabs group.
The ID of a tabs group
Protected
_headerProtected
Iterate over header control buttons, filtering for controls which are visible for the current client.
Protected
_inferProtected
Given a current file path, determine the directory to which it belongs.
The currently requested target path
A tuple of the inferred source and target directory path
Protected
_initializeProtected
Initialize configuration options for the Application instance. The default behavior of this method is to intelligently merge options for each class with those of their parents.
Options provided directly to the constructor
Configured options for the application instance
Protected
_insertProtected
Insert the application HTML element into the DOM. Subclasses may override this method to customize how the application is inserted.
The element to insert
Protected
_onProtected
Handle changes to an input element within the form.
The form configuration for which this handler is bound
An input change event within the form
Protected
_onProtected
Handle changes to the tile size.
The triggering event.
Protected
_onProtected
A generic event handler for action clicks which can be extended by subclasses. Action handlers defined in DEFAULT_OPTIONS are called first. This method is only called for actions which have no defined handler.
The originating click event
The capturing HTML element which defined a [data-action]
Protected
_onProtected
Handle click events on a tab within the Application.
Protected
_onProtected
Actions performed after closing the Application. Post-close steps are not awaited by the close process.
Provided render options
Protected
_onProtected
Actions performed after a first render of the Application.
Prepared context data
Provided render options
Protected
_onProtected
Actions performed after the Application is re-positioned.
The requested application position
Protected
_onProtected
Search among shown directories and files.
The triggering event
The search input value
Protected
_onProtected
Handle submission for an Application which uses the form element.
The form configuration for which this handler is bound
The form submission event
Protected
_postProtected
Perform post-render finalization actions.
Prepared context data.
Provided render options.
Protected
_preProtected
Actions performed before closing the Application. Pre-close steps are awaited by the close process.
Provided render options
Protected
_preProtected
Actions performed before a first render of the Application.
Prepared context data
Provided render options
Protected
_preProtected
Actions performed before the Application is re-positioned. Pre-position steps are not awaited because setPosition is synchronous.
The requested application position
Protected
_preProtected
Actions performed before any render of the Application. Pre-render steps are awaited by the render process.
Prepared context data
Provided render options
Protected
_removeProtected
Remove the application HTML element from the DOM. Subclasses may override this method to customize how the application element is removed.
The element to be removed
Protected
_renderProtected
Render the outer framing HTMLElement which wraps the inner HTML of the Application.
Options which configure application rendering behavior
Protected
_renderProtected
Render a header control button.
Protected
_replaceHTMLProtected
Replace the HTML of the application with the result provided by the rendering backend. An Application subclass should implement this method in order for the Application to be renderable.
The result returned by the application rendering backend
The content element into which the rendered result must be inserted
Options which configure application rendering behavior
Protected
_updateProtected
When the Application is rendered, optionally update aspects of the window frame.
Options provided at render-time
Protected
_updateProtected
Translate a requested application position updated into a resolved allowed position for the Application. Subclasses may override this method to implement more advanced positioning behavior.
Requested Application positioning data
Resolved Application positioning data
Static
browseBrowse files for a certain directory location
The source location in which to browse: see FilePicker#sources for details.
The target within the source location
Optional arguments
Optional
bucket?: stringA bucket within which to search if using the S3 source
Optional
extensions?: string[]An Array of file extensions to filter on
Optional
wildcard?: booleanThe requested dir represents a wildcard path
A Promise that resolves to the directories and files contained in the location
Static
configureConfigure metadata settings regarding a certain file system path
The source location in which to browse: see FilePicker#sources for details.
The target within the source location
Optional arguments modifying the request
Static
createCreate a subdirectory within a given source. The requested subdirectory path must not already exist.
The source location in which to browse. See FilePicker#sources for details
The target within the source location
Optional arguments which modify the request
Static
fromBind the file picker to a new target field. Assumes the user will provide a HTMLButtonElement which has the data-target and data-type attributes The data-target attribute should provide the name of the input field which should receive the selected file The data-type attribute is a string in ["image", "audio"] which sets the file extensions which will be accepted
The button element
Static
inheritanceIterate over the inheritance chain of this Application. The chain includes this Application itself and all parents until the base application is encountered.
Static
matchTest a URL to see if it matches a well known s3 key pattern
An input URL to test
A regular expression match
Static
parseCSSDimensionParse a CSS style rule into a number of pixels which apply to that dimension.
The CSS style rule
The relevant dimension of the parent element
The parsed style dimension in pixels
Static
requestRequest wildcard token images from the server and return them.
The actor whose prototype token contains the wildcard image path.
Optional
options: { pack?: string } = {}Optional
pack?: stringThe ID of the compendium the actor is in.
Static
uploadDispatch a POST request to the server containing a directory path and a file to upload
The data source to which the file should be uploaded
The destination path
The File object to upload
Optional
body: object = {}Additional file upload options sent in the POST body
Optional
options: { notify?: boolean } = {}Additional options to configure how the method behaves
Optional
notify?: booleanDisplay a UI notification when the upload is processed
The response object
Static
uploadA convenience function that uploads a file to a given package's persistent /storage/ directory
The id of the package to which the file should be uploaded. Only supports Systems and Modules.
The relative destination path in the package's storage directory
The File object to upload
Optional
body: object = {}Additional file upload options sent in the POST body
Optional
options: { notify?: boolean } = {}Additional options to configure how the method behaves
Optional
notify?: booleanDisplay a UI notification when the upload is processed
The response object
Static
waitWait for any images in the given element to load.
The element.
The FilePicker application renders contents of the server-side public directory. This app allows for navigating and uploading files to the public path.
Mixes
HandlebarsApplication