TypedWorkspaceLeaf<TView>
Unofficial
A workspace leaf with a strongly typed view.
Import:
import type { TypedWorkspaceLeaf } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export interface TypedWorkspaceLeaf<TView extends View> extends WorkspaceLeafExtends: WorkspaceLeaf
Constructor
new TypedWorkspaceLeaf(app: App, id?: string | undefined)Constructor.
To get the constructor instance, use getWorkspaceLeafConstructor from obsidian-typings/implementations.
Properties
| Property | Type | Description | |
|---|---|---|---|
| _ | Record<string, EventsEntry[]> | Internal storage of registered event handlers by event name. (Inherited from WorkspaceLeaf) | |
| _empty | View | The cached empty-state view shown when the leaf has no file open. (Inherited from WorkspaceLeaf) | |
| activeTime | number | Timestamp of when this leaf was last activated. (Inherited from WorkspaceLeaf) | |
| app | App | Reference to the app instance. (Inherited from WorkspaceLeaf) | |
| component | Component | The component managing the lifecycle of this workspace item. (Inherited from WorkspaceLeaf) | |
| containerEl | HTMLDivElement | Container element for this workspace item. (Inherited from WorkspaceLeaf) | |
| dimension | null | number | The flex-grow dimension of this item within its parent split. (Inherited from WorkspaceLeaf) | |
| group | null | string | The linked group this leaf belongs to, or null if ungrouped.(Inherited from WorkspaceLeaf) | |
| height | number | Current height of the leaf in pixels. (Inherited from WorkspaceLeaf) | |
| history | WorkspaceLeafHistory | Navigation history for this leaf (back/forward). (Inherited from WorkspaceLeaf) | |
| hoverPopover | HoverPopover | null | The hover popover associated with this leaf. (Inherited from WorkspaceLeaf) | |
| id | string | Unique identifier for this workspace item. (Inherited from WorkspaceLeaf) | |
| 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.(Inherited from WorkspaceLeaf) | |
| pinned | boolean | Whether this leaf is pinned (prevented from being navigated away). (Inherited from WorkspaceLeaf) | |
| resizeHandleEl | HTMLHRElement | The resize handle element used for adjusting item dimensions. (Inherited from WorkspaceLeaf) | |
| resizeObserver | null | ResizeObserver | Observer that tracks size changes of this leaf. (Inherited from WorkspaceLeaf) | |
| tabHeaderCloseEl | HTMLDivElement | null | Close button element in the tab header. (Inherited from WorkspaceLeaf) | |
| tabHeaderEl | HTMLElement | The tab header element for this leaf. (Inherited from WorkspaceLeaf) | |
| tabHeaderInnerIconEl | HTMLElement | Icon element inside the tab header. (Inherited from WorkspaceLeaf) | |
| tabHeaderInnerTitleEl | HTMLElement | Title element inside the tab header. (Inherited from WorkspaceLeaf) | |
| tabHeaderStatusContainerEl | HTMLDivElement | null | Container element for tab header status indicators. (Inherited from WorkspaceLeaf) | |
| tabHeaderStatusLinkEl | HTMLDivElement | null | Status element indicating linked group membership in the tab header. (Inherited from WorkspaceLeaf) | |
| tabHeaderStatusPinEl | HTMLDivElement | null | Status element indicating pinned state in the tab header. (Inherited from WorkspaceLeaf) | |
| type | 'leaf' | The workspace item type identifier for this leaf. (Inherited from WorkspaceLeaf) | |
| view | MaybeDeferredView<TView> | The typed view attached to this leaf. | |
| width | number | Current width of the leaf in pixels. (Inherited from WorkspaceLeaf) | |
| working | boolean | Whether this leaf is currently loading or processing. (Inherited from WorkspaceLeaf) | |
| workspace | Workspace | Reference to the workspace this item belongs to. (Inherited from WorkspaceLeaf) |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| canNavigate() | boolean | Check whether this leaf can be navigated to a different view. (Inherited from WorkspaceLeaf) | |
| canPin() | boolean | Checks whether this leaf can be pinned (i.e. its parent is a tab group). (Inherited from WorkspaceLeaf) | |
| detach() | void | Detach this leaf from its parent. (Inherited from WorkspaceLeaf) | |
| getContainer() | WorkspaceContainer | Get the root container parent item, which can be one of:. - WorkspaceRoot - WorkspaceWindow (Inherited from WorkspaceLeaf) | |
| getDisplayText() | string | Get the display text of this leaf. (Inherited from WorkspaceLeaf) | |
| getEphemeralState() | any | Get the ephemeral state of this leaf. (Inherited from WorkspaceLeaf) | |
| getHistoryState() | WorkspaceLeafHistoryState | Get the current navigation history state of this leaf. (Inherited from WorkspaceLeaf) | |
| getIcon() | IconName | Get the icon of this leaf. (Inherited from WorkspaceLeaf) | |
| getRoot() | WorkspaceItem | Get the root item. (Inherited from WorkspaceLeaf) | |
| getViewState() | ViewState | Get the view state of this leaf. (Inherited from WorkspaceLeaf) | |
| handleDrop(event, draggable, isOver) | DropResult | null | Handle a drop event on this leaf. (Inherited from WorkspaceLeaf) | |
| highlight() | void | Highlight this leaf's tab header. (Inherited from WorkspaceLeaf) | |
| isVisible() | boolean | Check whether this leaf is currently visible in the workspace. (Inherited from WorkspaceLeaf) | |
| loadIfDeferred() | Promise<void> | If this view is currently deferred, load it and await that it has fully loaded. (Inherited from WorkspaceLeaf) | |
| off(name, callback) | void | Remove an event listener. (Inherited from WorkspaceLeaf) | |
| offref(ref) | void | Remove an event listener by reference. (Inherited from WorkspaceLeaf) | |
| on('pinned-change', callback, ctx?) | EventRef | Handle the pinned-change event. (Inherited from WorkspaceLeaf) | |
| on('group-change', callback, ctx?) | EventRef | Handle the group-change event. (Inherited from WorkspaceLeaf) | |
| on('history-change', callback, ctx?) | EventRef | Triggers when the leaf's history gets updated (e.g. when new file is opened, or moving through history). (Inherited from WorkspaceLeaf) | |
| on('leaf-menu', callback, ctx?) | EventRef | Triggers when context menu action is executed on the leaf. (Inherited from WorkspaceLeaf) | |
| on(name, callback, ctx?) | EventRef | Add an event listener. (Inherited from WorkspaceLeaf) | |
| onOpenTabHeaderMenu(evt, parentEl) | void | Handle opening the context menu on this leaf's tab header. (Inherited from WorkspaceLeaf) | |
| onResize() | void | Handle the resize event. (Inherited from WorkspaceLeaf) | |
| onResizeStart(evt) | void | Handle the start of a resize operation on this item. (Inherited from WorkspaceLeaf) | |
| open(view) | Promise<View> | Open a view in this leaf. (Inherited from WorkspaceLeaf) | |
| openFile(file, openState?) | Promise<void> | Open a file in this leaf. (Inherited from WorkspaceLeaf) | |
| openLinkText(linktext, sourcePath, openViewState?) | Promise<void> | Open a link in the current leaf. (Inherited from WorkspaceLeaf) | |
| rebuildView() | Promise<void> | Rebuild the view associated with this leaf. (Inherited from WorkspaceLeaf) | |
| recordHistory(state) | void | Record a state entry in this leaf's navigation history. (Inherited from WorkspaceLeaf) | |
| serialize() | SerializedWorkspaceItem | Serialize this workspace item's state for persistence. (Inherited from WorkspaceLeaf) | |
| 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%.). (Inherited from WorkspaceLeaf) | |
| setDimension(dimension) | void | Set the flex-grow dimension of this item within its parent split. (Inherited from WorkspaceLeaf) | |
| setEphemeralState(state) | void | Set the ephemeral state of this leaf. (Inherited from WorkspaceLeaf) | |
| setGroup(group) | void | Set the group of this leaf. (Inherited from WorkspaceLeaf) | |
| setGroupMember(other) | void | Set another leaf as a group member of this leaf. (Inherited from WorkspaceLeaf) | |
| setParent(parent) | void | Set the parent split for this workspace item. (Inherited from WorkspaceLeaf) | |
| setPinned(pinned) | void | Set the pinned state of this leaf. (Inherited from WorkspaceLeaf) | |
| setViewState(viewState, eState?) | Promise<void> | Set the view state of this leaf. (Inherited from WorkspaceLeaf) | |
| togglePinned() | void | Toggle the pinned state of this leaf. (Inherited from WorkspaceLeaf) | |
| trigger(name, data?) | void | Trigger an event, executing all the listeners in order even if some of them throw an error. (Inherited from WorkspaceLeaf) | |
| tryTrigger(evt, args) | void | Try to trigger an event, executing all the listeners in order even if some of them throw an error. (Inherited from WorkspaceLeaf) | |
| unhighlight() | void | Remove highlight from this leaf's tab header. (Inherited from WorkspaceLeaf) | |
| updateHeader() | void | Update the tab header display (icon, title, status indicators). (Inherited from WorkspaceLeaf) |
Links to this page: