Skip to content

WorkspaceLeaf

Defined in: obsidian.d.ts:5009

Extends

Extended by

Constructors

new WorkspaceLeaf()

new WorkspaceLeaf(): WorkspaceLeaf

Returns

WorkspaceLeaf

Inherited from

WorkspaceItem.constructor

Properties

_

_: Record<string, EventsEntry[]>

Defined in: src/obsidian/augmentations/Events.d.ts:5

Inherited from

WorkspaceItem._


activeTime?

optional activeTime: number

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:5


app

app: App

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:5

Inherited from

WorkspaceItem.app


component

component: Component

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:6

Inherited from

WorkspaceItem.component


containerEl

containerEl: HTMLDivElement

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:7

Inherited from

WorkspaceItem.containerEl


dimension

dimension: null | number

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:8

Inherited from

WorkspaceItem.dimension


id

id: string

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:9

Inherited from

WorkspaceItem.id


parent

parent: WorkspaceMobileDrawer | WorkspaceTabs

Defined in: obsidian.d.ts:5021

The direct parent of the leaf.

On desktop, a leaf is always a child of a WorkspaceTabs component. On mobile, a leaf might be a child of a WorkspaceMobileDrawer. Perform an instanceof check before making an assumption about the parent.

Overrides

WorkspaceItem.parent


parentSplit?

readonly optional parentSplit: WorkspaceParent

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:10

Inherited from

WorkspaceItem.parentSplit


resizeHandleEl

resizeHandleEl: HTMLHRElement

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:11

Inherited from

WorkspaceItem.resizeHandleEl


tabHeaderEl

tabHeaderEl: HTMLElement

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:6


tabHeaderInnerIconEl

tabHeaderInnerIconEl: HTMLElement

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:7


tabHeaderInnerTitleEl

tabHeaderInnerTitleEl: HTMLElement

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:8


type

type: string

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:12

Inherited from

WorkspaceItem.type


view

view: View

Defined in: obsidian.d.ts:5028

The view associated with this leaf. Do not attempt to cast this to your custom View without first checking instanceof.


workspace

workspace: Workspace

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:13

Inherited from

WorkspaceItem.workspace

Accessors

isDeferred

Get Signature

get isDeferred(): boolean

Defined in: node_modules/obsidian/obsidian.d.ts:5058

Returns true if this leaf is currently deferred because it is in the background. A deferred leaf will have a DeferredView as its view, instead of the View that it should normally have for its type (like MarkdownView for the markdown type).

Since

1.7.2

Returns

boolean

Methods

detach()

detach(): void

Defined in: obsidian.d.ts:5093

Returns

void

Overrides

WorkspaceItem.detach


getContainer()

getContainer(): WorkspaceContainer

Defined in: obsidian.d.ts:5002

Get the root container parent item, which can be one of:

Returns

WorkspaceContainer

Inherited from

WorkspaceItem.getContainer


getDisplayText()

getDisplayText(): string

Defined in: obsidian.d.ts:5102

Returns

string


getEphemeralState()

getEphemeralState(): any

Defined in: obsidian.d.ts:5069

Returns

any


getIcon()

getIcon(): string

Defined in: obsidian.d.ts:5098

Returns

string

Overrides

WorkspaceItem.getIcon


getRoot()

getRoot(): WorkspaceItem

Defined in: obsidian.d.ts:4995

Returns

WorkspaceItem

Inherited from

WorkspaceItem.getRoot


getViewState()

getViewState(): ViewState

Defined in: obsidian.d.ts:5046

Returns

ViewState


loadIfDeferred()

loadIfDeferred(): Promise<void>

Defined in: obsidian.d.ts:5064

If this view is currently deferred, load it and await that it has fully loaded.

Returns

Promise<void>

Since

1.7.2


off()

off(name, callback): void

Defined in: obsidian.d.ts:1441

Parameters

name

string

callback

(…data) => unknown

Returns

void

Inherited from

WorkspaceItem.off


offref()

offref(ref): void

Defined in: obsidian.d.ts:1445

Parameters

ref

EventRef

Returns

void

Inherited from

WorkspaceItem.offref


on()

Call Signature

on(name, callback, ctx?): EventRef

Defined in: obsidian.d.ts:5112

Parameters
name

"pinned-change"

callback

(pinned) => any

ctx?

any

Returns

EventRef

Inherited from

WorkspaceItem.on

Call Signature

on(name, callback, ctx?): EventRef

Defined in: obsidian.d.ts:5116

Parameters
name

"group-change"

callback

(group) => any

ctx?

any

Returns

EventRef

Inherited from

WorkspaceItem.on

Call Signature

on(name, callback, ctx?): EventRef

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:14

Triggers when the leaf’s history gets updated (e.g. when new file is opened, or moving through history)

Parameters
name

"history-change"

callback

() => void

ctx?

unknown

Returns

EventRef

Inherited from

WorkspaceItem.on

Call Signature

on(name, callback, ctx?): EventRef

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:18

Triggers when context menu action is executed on the leaf

Parameters
name

"leaf-menu"

callback

(menu, leaf) => void

ctx?

unknown

Returns

EventRef

Inherited from

WorkspaceItem.on


onResize()

onResize(): void

Defined in: obsidian.d.ts:5107

Returns

void


onResizeStart()

onResizeStart(evt): void

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:17

Parameters

evt

MouseEvent

Returns

void

Inherited from

WorkspaceItem.onResizeStart


open()

open(view): Promise<View>

Defined in: obsidian.d.ts:5041

Parameters

view

View

Returns

Promise<View>


openFile()

openFile(file, openState?): Promise<void>

Defined in: obsidian.d.ts:5036

By default, openFile will also make the leaf active. Pass in { active: false } to override.

Parameters

file

TFile

openState?

OpenViewState

Returns

Promise<void>


openLinkText()

openLinkText(linktext, sourcePath, openViewState?): Promise<void>

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:25

Open a link in the current leaf

Parameters

linktext

string

The link text to open

sourcePath

string

The path of the source file

openViewState?

OpenViewState

The view state to open the link in

Returns

Promise<void>


serialize()

serialize(): SerializedWorkspaceItem

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:18

Returns

SerializedWorkspaceItem

Inherited from

WorkspaceItem.serialize


setDimension()

setDimension(flexgrow?): void

Defined in: src/obsidian/augmentations/WorkspaceLeaf.d.ts:35

Set the vertical height a leaf may occupy if it is in a split. The height is not set directly, but by setting the flex-grow (css) of the element. This means to predictably affect the height, you also need to use setDimension on the other leafs of the column. (The flex-grow values of every leaf work basically like a ratio, e.g. 1:2 meaning the first leaf takes 33% of the height, and the second 67%.)

Parameters

flexgrow?

Sets the flex-grow of the leaf. (0-100)

null | number

Returns

void

Inherited from

WorkspaceItem.setDimension


setEphemeralState()

setEphemeralState(state): void

Defined in: obsidian.d.ts:5073

Parameters

state

any

Returns

void


setGroup()

setGroup(group): void

Defined in: obsidian.d.ts:5089

Parameters

group

string

Returns

void


setGroupMember()

setGroupMember(other): void

Defined in: obsidian.d.ts:5085

Parameters

other

WorkspaceLeaf

Returns

void


setParent()

setParent(parent): void

Defined in: src/obsidian/augmentations/WorkspaceItem.d.ts:20

Parameters

parent

WorkspaceParent

Returns

void

Inherited from

WorkspaceItem.setParent


setPinned()

setPinned(pinned): void

Defined in: obsidian.d.ts:5081

Parameters

pinned

boolean

Returns

void


setViewState()

setViewState(viewState, eState?): Promise<void>

Defined in: obsidian.d.ts:5050

Parameters

viewState

ViewState

eState?

any

Returns

Promise<void>


togglePinned()

togglePinned(): void

Defined in: obsidian.d.ts:5077

Returns

void


trigger()

trigger(name, …data): void

Defined in: obsidian.d.ts:1449

Parameters

name

string

data

unknown[]

Returns

void

Inherited from

WorkspaceItem.trigger


tryTrigger()

tryTrigger(evt, args): void

Defined in: obsidian.d.ts:1453

Parameters

evt

EventRef

args

unknown[]

Returns

void

Inherited from

WorkspaceItem.tryTrigger