Skip to content

Tree

Defined in: src/obsidian/internals/Tree.d.ts:10

Type Parameters

T

Properties

activeDom

activeDom: null | TreeNode<T>

Defined in: src/obsidian/internals/Tree.d.ts:14

Currently active item in tree view


app

app: App

Defined in: src/obsidian/internals/Tree.d.ts:18

Reference to App


containerEl

containerEl: HTMLElement

Defined in: src/obsidian/internals/Tree.d.ts:22

Container element of the tree view


focusedItem

focusedItem: null | TreeNode<T>

Defined in: src/obsidian/internals/Tree.d.ts:26

Currently focused item in tree view


handleCollapseAll()

handleCollapseAll: () => void

Defined in: src/obsidian/internals/Tree.d.ts:30

Handle collapsing of all nodes

Returns

void


handleRenameFocusedItem()

handleRenameFocusedItem: () => void

Defined in: src/obsidian/internals/Tree.d.ts:34

Handle renaming of focused item

Returns

void


id

id: string

Defined in: src/obsidian/internals/Tree.d.ts:38

ID of the view the tree is associated with


isAllCollapsed

isAllCollapsed: boolean

Defined in: src/obsidian/internals/Tree.d.ts:44

Whether all items in the tree are collapsed


prefersCollapsed

prefersCollapsed: boolean

Defined in: src/obsidian/internals/Tree.d.ts:48

Whether tree items should default to collapsed state


requestSaveFolds()

requestSaveFolds: () => void

Defined in: src/obsidian/internals/Tree.d.ts:52

Request saving of the current fold states

Returns

void


scope

scope: Scope

Defined in: src/obsidian/internals/Tree.d.ts:56

Key scope for tree view


selectedDoms

selectedDoms: Set<TreeNode<T>>

Defined in: src/obsidian/internals/Tree.d.ts:60

Currently selected items in tree view


view

view: View

Defined in: src/obsidian/internals/Tree.d.ts:64

The view the tree is associated with

Accessors

root

Get Signature

get root(): TreeNode<T>

Defined in: src/obsidian/internals/Tree.d.ts:68

Root item of the tree view

Returns

TreeNode<T>

Methods

changeFocusedItem()

changeFocusedItem(direction): void

Defined in: src/obsidian/internals/Tree.d.ts:73

Change the focused item to the next item in specified direction

Parameters

direction

"forwards" | "backwards"

Returns

void


clearSelectedDoms()

clearSelectedDoms(): void

Defined in: src/obsidian/internals/Tree.d.ts:77

Unselect all selected items in the tree view

Returns

void


deselectItem()

deselectItem(node): void

Defined in: src/obsidian/internals/Tree.d.ts:81

Mark tree item as deselected

Parameters

node

TreeNode<T>

Returns

void


getFoldKey()

getFoldKey(): string

Defined in: src/obsidian/internals/Tree.d.ts:85

Get the local storage key for the saved tree view folds

Returns

string


getNodeId()

getNodeId(node): undefined | string

Defined in: src/obsidian/internals/Tree.d.ts:89

Gets the ID of a tree item given its Node

Parameters

node

TreeNode<T>

Returns

undefined | string


handleDeleteSelectedItems()

handleDeleteSelectedItems(event): Promise<void>

Defined in: src/obsidian/internals/Tree.d.ts:93

Handle deletion of selected nodes

Parameters

event

KeyboardEvent

Returns

Promise<void>


handleItemSelection()

handleItemSelection(event, node): void

Defined in: src/obsidian/internals/Tree.d.ts:97

Handle selection of tree item via keyboard event

Parameters

event

MouseEvent

node

TreeNode<T>

Returns

void


isItem()

isItem(node): boolean

Defined in: src/obsidian/internals/Tree.d.ts:103

Check whether item is a valid tree item

Parameters

node

undefined | TreeNode<T>

Returns

boolean


loadFolds()

loadFolds(): void

Defined in: src/obsidian/internals/Tree.d.ts:107

Load the saved fold states of the tree view from local storage

Returns

void


onKeyArrowDown()

onKeyArrowDown(event): void

Defined in: src/obsidian/internals/Tree.d.ts:111

Handle keyboard event for moving/selecting tree item below

Parameters

event

KeyboardEvent

Returns

void


onKeyArrowLeft()

onKeyArrowLeft(event): void

Defined in: src/obsidian/internals/Tree.d.ts:115

Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding)

Parameters

event

KeyboardEvent

Returns

void


onKeyArrowRight()

onKeyArrowRight(event): void

Defined in: src/obsidian/internals/Tree.d.ts:119

Handle keyboard event for moving through the hierarchy of tree items (and/or folding/unfolding)

Parameters

event

KeyboardEvent

Returns

void


onKeyArrowUp()

onKeyArrowUp(event): void

Defined in: src/obsidian/internals/Tree.d.ts:123

Handle keyboard event for moving/selecting tree item above

Parameters

event

KeyboardEvent

Returns

void


onKeyOpen()

onKeyOpen(event): void

Defined in: src/obsidian/internals/Tree.d.ts:127

Handle keyboard event for opening tree item

Parameters

event

KeyboardEvent

Returns

void


saveFolds()

saveFolds(): void

Defined in: src/obsidian/internals/Tree.d.ts:133

Save the current fold states of the tree view to local storage

Returns

void


selectItem()

selectItem(node): void

Defined in: src/obsidian/internals/Tree.d.ts:137

Mark tree item as selected

Parameters

node

TreeNode<T>

Returns

void


setCollapseAll()

setCollapseAll(collapse): void

Defined in: src/obsidian/internals/Tree.d.ts:141

Set all items in the tree view to be collapsed or expanded

Parameters

collapse

boolean

Returns

void


setFocusedItem()

setFocusedItem(node, scrollIntoView?): void

Defined in: src/obsidian/internals/Tree.d.ts:145

Set the focused item in the tree view

Parameters

node

TreeNode<T>

scrollIntoView?

boolean

Returns

void


toggleCollapseAll()

toggleCollapseAll(): void

Defined in: src/obsidian/internals/Tree.d.ts:149

(Un)Collapse all items in the tree view

Returns

void