Skip to main content

FileTreeView

Import :

const FileTreeView = brackets.getModule("project/FileTreeView")

Preact

This is the view layer (template) for the file tree in the sidebar. It takes a FileTreeViewModel and renders it to the given element using Preact. User actions are signaled via an ActionCreator (in the Flux sense).

Kind: global variable

componentDidMount()

When this component is displayed, we scroll it into view and select the portion of the filename that excludes the extension.

Kind: global function

getInitialState()

Ensures that we always have a state object.

Kind: global function

componentDidMount()

When this component is displayed, we scroll it into view and select the folder name.

Kind: global function

shouldComponentUpdate()

Need to re-render if the sort order or the contents change.

Kind: global function

componentDidUpdate()

When the component has updated in the DOM, reposition it to where the currently selected node is located now.

Kind: global function

componentDidUpdate()

When the component has updated in the DOM, reposition it to where the currently selected node is located now.

Kind: global function

shouldComponentUpdate()

Update for any change in the tree data or directory sorting preference.

Kind: global function

handleDragOver()

Allow the Drop

Kind: global function

render(element, viewModel, projectRoot, actions, forceRender, platform)

Renders the file tree to the given element.

Kind: global function

ParamTypeDescription
elementDOMNode | jQueryElement in which to render this file tree
viewModelFileTreeViewModelthe data container
projectRootDirectoryDirectory object from which the fullPath of the project root is extracted
actionsActionCreatorobject with methods used to communicate events that originate from the user
forceRenderbooleanRun render on the entire tree (useful if an extension has new data that it needs rendered)
platformstringmac, win, linux

addIconProvider(callback, [priority])

Adds an icon provider. The callback is invoked before each working set item is created, and can return content to prepend to the item if it supports the icon.

Kind: global function

ParamTypeDefaultDescription
callbackfunctionReturn a string representing the HTML, a jQuery object or DOM node, or undefined. If undefined, nothing is prepended to the list item and the default or an available icon will be used.
[priority]number0optional priority. 0 being lowest. The icons with the highest priority wins if there are multiple callback providers attached. icon providers of the same priority first valid response wins.

addClassesProvider(callback, [priority])

Adds a CSS class provider, invoked before each working set item is created or updated. When called to update an existing item, all previously applied classes have been cleared.

Kind: global function

ParamTypeDefaultDescription
callbackfunctionReturn a string containing space-separated CSS class(es) to add, or undefined to leave CSS unchanged.
[priority]number0optional priority. 0 being lowest. The class with the highest priority wins if there are multiple callback classes attached. class providers of the same priority will be appended.