Class: AppTree

AppTree~module:AppTree~AppTree

The application tree handler for Real Media Library.

Constructor

new AppTree(id, attachmentsBrowseropt, isModalopt, initopt)

Initialize properties and state for AIOTree component. Also handles the responsiveness.
Parameters:
Name Type Attributes Default Description
id string The HTML id (needed to localStorage support)
attachmentsBrowser object <optional>
The attachments browser (for media grid view)
isModal boolean <optional>
false If true the given app tree is a modal dialog
init module:AppTree~AppTree~init <optional>
Source:
See:

Extends

  • React.Component

Quick reference

Members

_handleDetails

Handle the details meta box.
Source:

handleReload

Handle refesh of content.
Source:

handleResize

When resizing the container set ideal width for attachments.
Source:

onTreeNodeRender

A node item should be an observer (mobx).
Source:

renderCreatables

Source:

renderToolbarButtons

Source:

Methods

_handleBackboneFilterSelection(idopt)

Set the attachments browser location.
Parameters:
Name Type Attributes Default Description
id int <optional>
Current selected id The id
Source:

_handleRenameNode()

Handle rename node states (helper).
Source:

_handleSortNode()

Handle the sort node button.
Source:

_isMobile() → {boolean}

Checks if the current window size is mobile.
Source:
Returns:
Type
boolean

_updateCreatableButtons(selectedCreatableType)

Update the creatable buttons regarding the selected type.
Parameters:
Name Type Description
selectedCreatableType int
Source:

componentDidMount()

Initiate draggable and droppable
Source:

componentDidUpdate()

When the component updates the droppable zone is reinitialized. Also the toolbar buttons gets disabled or enabled depending on selected node.
Source:

componentWillMount()

Fetch initial tree.
Source:

componentWillUnmount()

Remove resize handler.
Source:

(async) fetchCounts(counts)

Update the folder count. If you pass no argument the folder count is requested from server.
Parameters:
Name Type Description
counts object Key value map of folder and count
Source:

(async) fetchTree()

Fetch folder tree.
Source:

getBackboneFilter()

Return the backbone filter view for the given attachments browser.
Source:
Returns:
object

getSelectedId() → {string|int}

Get the selected node id.
Source:
Returns:
Type
string | int

getTreeItemById(idopt, excludeStaticopt) → {object}

Get tree item by id.
Parameters:
Name Type Attributes Default Description
id string | int <optional>
Current
excludeStatic boolean <optional>
true
Source:
Returns:
Tree node
Type
object

handleAddClose()

Handle add close and remove the new node.
Source:

handleCreatableClick()

Handles the creatable click and creates a new node depending on the selected one.
Source:

handleOrderCancel()

Handle order cancel.
Source:

handleOrderClick()

Handle order click.
Source:

handleRenameCancel()

Handle rename cancel.
Source:

handleRenameClick()

Handle rename click and enable the input field if necessery.
Source:

handleRenameClose()

Handle rename close and depending on the save state create the new node.
Source:

handleSelect()

A node gets selected. Depending on the fast mode the page gets reloaded or the wp list table gets reloaded.
Source:

handleSort()

Handle categories sorting and update the tree so the changes are visible. If sorting is cancelled the old tree gets restored.
Source:

handleTrash()

Handle trashing of a category. If the category has subcategories the trash is forbidden.
Source:

handleWindowResize()

Handle responsiveness on window resize.
Source:

render()

Render AIO tree with tax switcher.
Source:

resolveStateRef() → {object}

Resolve single state ref key.
Source:
Returns:
Type
object

resolveStateRefs() → {object}

Iterates all available values in an object and resolve it with the available this::stateRefs.
Source:
Returns:
Type
object

(async) updateCreateNode(callback)

Updates the create node. That's the node without id and the input field.
Parameters:
Name Type Description
callback function The callback with one argument (node draft) and should return the new node.
Source:

updateTreeItemById(callback, idopt)

Update a tree item by id.
Parameters:
Name Type Attributes Default Description
callback function | array The callback with one argument (node draft) and should return the new node.
id string | int <optional>
Current The id which should be updated
Source:

Type Definitions

init(state, tree) → {object}

Called on initialzation and allows you to modify the init state.
Parameters:
Name Type Description
state object The default state
tree AppTree The AppTree component instance
Source:
Returns:
The new state
Type
object