WorkspaceLeaf
Extends
Extended by
Constructors
new WorkspaceLeaf()
new WorkspaceLeaf():
WorkspaceLeaf
Returns
Inherited from
Properties
_
_:
Record
<string
,EventsEntry
[]>
Inherited from
activeTime?
optional
activeTime:number
app
app:
App
Inherited from
component
component:
Component
Inherited from
containerEl
containerEl:
HTMLDivElement
Inherited from
dimension
dimension:
null
|number
Inherited from
id
id:
string
Inherited from
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
parentSplit?
readonly
optional
parentSplit:WorkspaceParent
Inherited from
resizeHandleEl
resizeHandleEl:
HTMLHRElement
Inherited from
tabHeaderEl
tabHeaderEl:
HTMLElement
tabHeaderInnerIconEl
tabHeaderInnerIconEl:
HTMLElement
tabHeaderInnerTitleEl
tabHeaderInnerTitleEl:
HTMLElement
type
type:
string
Inherited from
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
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
getContainer()
getContainer():
WorkspaceContainer
Get the root container parent item, which can be one of:
Returns
Inherited from
getDisplayText()
getDisplayText():
string
Returns
string
getEphemeralState()
getEphemeralState():
any
Returns
any
getIcon()
getIcon():
string
Returns
string
Overrides
getRoot()
getRoot():
WorkspaceItem
Returns
Inherited from
getViewState()
getViewState():
ViewState
Returns
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
offref()
offref(
ref
):void
Parameters
• ref: EventRef
Returns
void
Inherited from
on()
on(name, callback, ctx)
on(
name
,callback
,ctx
?):EventRef
Parameters
• name: "pinned-change"
• callback
• ctx?: any
Returns
Inherited from
on(name, callback, ctx)
on(
name
,callback
,ctx
?):EventRef
Parameters
• name: "group-change"
• callback
• ctx?: any
Returns
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
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
Inherited from
WorkspaceItem.on
onResize()
onResize():
void
Returns
void
onResizeStart()
onResizeStart(
evt
):void
Parameters
• evt: MouseEvent
Returns
void
Inherited from
open()
Parameters
• view: View
Returns
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
Inherited from
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
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
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
tryTrigger()
tryTrigger(
evt
,args
):void
Parameters
• evt: EventRef
• args: unknown
[]
Returns
void