Skip to content

WorkspaceLeaf

Extends

Extended by

Constructors

new WorkspaceLeaf()

new WorkspaceLeaf(): WorkspaceLeaf

Returns

WorkspaceLeaf

Inherited from

WorkspaceItem.constructor

Properties

_

_: Record<string, EventsEntry[]>

Inherited from

WorkspaceItem._


activeTime?

optional activeTime: number


app

app: App

Inherited from

WorkspaceItem.app


component

component: Component

Inherited from

WorkspaceItem.component


containerEl

containerEl: HTMLDivElement

Inherited from

WorkspaceItem.containerEl


dimension

dimension: null | number

Inherited from

WorkspaceItem.dimension


id

id: string

Inherited from

WorkspaceItem.id


parent

parent: WorkspaceMobileDrawer | WorkspaceTabs

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

Inherited from

WorkspaceItem.parentSplit


resizeHandleEl

resizeHandleEl: HTMLHRElement

Inherited from

WorkspaceItem.resizeHandleEl


tabHeaderEl

tabHeaderEl: HTMLElement


tabHeaderInnerIconEl

tabHeaderInnerIconEl: HTMLElement


tabHeaderInnerTitleEl

tabHeaderInnerTitleEl: HTMLElement


type

type: string

Inherited from

WorkspaceItem.type


view

view: View

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


workspace

workspace: Workspace

Inherited from

WorkspaceItem.workspace

Accessors

isDeferred

get isDeferred(): boolean

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

Returns

void

Overrides

WorkspaceItem.detach


getContainer()

getContainer(): WorkspaceContainer

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

Returns

WorkspaceContainer

Inherited from

WorkspaceItem.getContainer


getDisplayText()

getDisplayText(): string

Returns

string


getEphemeralState()

getEphemeralState(): any

Returns

any


getIcon()

getIcon(): string

Returns

string

Overrides

WorkspaceItem.getIcon


getRoot()

getRoot(): WorkspaceItem

Returns

WorkspaceItem

Inherited from

WorkspaceItem.getRoot


getViewState()

getViewState(): ViewState

Returns

ViewState


loadIfDeferred()

loadIfDeferred(): Promise<void>

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

Parameters

name: string

callback

Returns

void

Inherited from

WorkspaceItem.off


offref()

offref(ref): void

Parameters

ref: EventRef

Returns

void

Inherited from

WorkspaceItem.offref


on()

on(name, callback, ctx)

on(name, callback, ctx?): EventRef

Parameters

name: "pinned-change"

callback

ctx?: any

Returns

EventRef

Inherited from

WorkspaceItem.on

on(name, callback, ctx)

on(name, callback, ctx?): EventRef

Parameters

name: "group-change"

callback

ctx?: any

Returns

EventRef

Inherited from

WorkspaceItem.on

on(name, callback, ctx)

on(name, callback, ctx?): EventRef

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

Parameters

name: "history-change"

callback

ctx?: unknown

Returns

EventRef

Inherited from

WorkspaceItem.on

on(name, callback, ctx)

on(name, callback, ctx?): EventRef

Triggers when context menu action is executed on the leaf

Parameters

name: "leaf-menu"

callback

ctx?: unknown

Returns

EventRef

Inherited from

WorkspaceItem.on


onResize()

onResize(): void

Returns

void


onResizeStart()

onResizeStart(evt): void

Parameters

evt: MouseEvent

Returns

void

Inherited from

WorkspaceItem.onResizeStart


open()

open(view): Promise<View>

Parameters

view: View

Returns

Promise<View>


openFile()

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

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

Parameters

file: TFile

openState?: OpenViewState

Returns

Promise<void>


serialize()

serialize(): SerializedWorkspaceItem

Returns

SerializedWorkspaceItem

Inherited from

WorkspaceItem.serialize


setDimension()

setDimension(flexgrow?): void

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?: null | number

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

Returns

void

Inherited from

WorkspaceItem.setDimension


setEphemeralState()

setEphemeralState(state): void

Parameters

state: any

Returns

void


setGroup()

setGroup(group): void

Parameters

group: string

Returns

void


setGroupMember()

setGroupMember(other): void

Parameters

other: WorkspaceLeaf

Returns

void


setParent()

setParent(parent): void

Parameters

parent: WorkspaceParent

Returns

void

Inherited from

WorkspaceItem.setParent


setPinned()

setPinned(pinned): void

Parameters

pinned: boolean

Returns

void


setViewState()

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

Parameters

viewState: ViewState

eState?: any

Returns

Promise<void>


togglePinned()

togglePinned(): void

Returns

void


trigger()

trigger(name, …data): void

Parameters

name: string

• …data: unknown[]

Returns

void

Inherited from

WorkspaceItem.trigger


tryTrigger()

tryTrigger(evt, args): void

Parameters

evt: EventRef

args: unknown[]

Returns

void

Inherited from

WorkspaceItem.tryTrigger