SidebarDirectory

SidebarDirectory

A shared pattern for the sidebar directory which Actors, Items, and Scenes all use

Extends

Members

(static) collection :WorldCollection

The WorldCollection instance which this Sidebar Directory displays.

Type:

(static) defaultOptions

_original :SidebarTab

Overrides:

Denote whether or not this is the original version of the sidebar tab, or a pop-out variant

Type:

(protected) _popout :SidebarTab

Overrides:

A reference to the pop-out variant of this SidebarTab, if one exists

Type:

documentName :string

A reference to the named Document type that this Sidebar Directory instance displays

Type:
  • string

documentPartial :string

The path to the template partial which renders a single Document within this directory

Type:
  • string

documents :Array.<Document>

References to the set of Documents which are displayed in the Sidebar

Type:

folderPartial :string

The path to the template partial which renders a single Folder within this directory

Type:
  • string

folders :Array.<Folder>

Reference the set of Folders which exist in this Sidebar

Type:

tabName :string

Overrides:

The base name of this sidebar tab

Type:
  • string

Methods

(static) setupFolders(folders, documents) → {Object}

Given a Document type and a list of Document instances, set up the Folder tree

Parameters:
Name Type Description
folders Array.<Folder>

The Array of Folder objects to organize

documents Array.<Document>

The Array of Document objects to organize

Returns:

A tree structure containing the folders and documents

Type
Object

_canDragStart()

_contextMenu()

(protected) _getEntryContextOptions() → {Array.<object>}

Get the set of ContextMenu options which should be used for Documents in a SidebarDirectory

Returns:

The Array of context options passed to the ContextMenu instance

Type
Array.<object>

(protected) _getFolderContextOptions() → {Array.<object>}

Get the set of ContextMenu options which should be used for Folders in a SidebarDirectory

Returns:

The Array of context options passed to the ContextMenu instance

Type
Array.<object>

(async, protected) _handleDroppedDocument(target, data)

Handle Document data being dropped into the directory.

Parameters:
Name Type Description
target HTMLElement

The target element

data Object

The data being dropped

(async, protected) _handleDroppedFolder(target, data)

Handle Folder data being dropped into the directory.

Parameters:
Name Type Description
target HTMLElement

The target element

data Object

The data being dropped

(protected) _onClickDocumentName(event)

Handle clicking on a Document name in the Sidebar directory

Parameters:
Name Type Description
event Event

The originating click event

(async, protected) _onCreateDocument(event)

Handle new Document creation request

Parameters:
Name Type Description
event MouseEvent

The originating button click event

(protected) _onCreateFolder(event)

Create a new Folder in this SidebarDirectory

Parameters:
Name Type Description
event MouseEvent

The originating button click event

_onDragHighlight(event)

Highlight folders as drop targets when a drag event enters or exits their area

Parameters:
Name Type Description
event DragEvent

The DragEvent which is in progress

_onDragStart()

_onDrop()

_onLazyLoadImage(entries, observer)

Overrides:

Handle lazy loading for sidebar images to only load them once they become observed

Parameters:
Name Type Description
entries Array.<HTMLElement>

The entries which are now observed

observer IntersectionObserver

The intersection observer instance

_onSearchFilter()

(async) _render()

Overrides:

(async) _renderInner()

Overrides:

(protected) _toggleFolder(event)

Handle toggling the collapsed or expanded state of a folder within the directory tab

Parameters:
Name Type Description
event MouseEvent

The originating click event

activate()

Overrides:

Activate this SidebarTab, switching focus to it

activateListeners()

Activate event listeners triggered within the Actor Directory HTML

(async) close()

Inherited From:

collapseAll()

Collapse all subfolders in this directory

createPopout() → {SidebarTab}

Overrides:

Create a second instance of this SidebarTab class which represents a singleton popped-out container

Returns:

The popped out sidebar tab instance

Type
SidebarTab

(async) getData()

initialize()

Initialize the content of the directory by categorizing folders and documents into a hierarchical tree structure.

renderPopout()

Overrides:

Render the SidebarTab as a pop-out container