Skip to main content

Workspace

Extends Events

Constructor#

constructor();

Properties#

leftSplit#

leftSplit: WorkspaceSidedock | WorkspaceMobileDrawer

rightSplit#

rightSplit: WorkspaceSidedock | WorkspaceMobileDrawer

leftRibbon#

leftRibbon: WorkspaceRibbon

rightRibbon#

rightRibbon: WorkspaceRibbon

rootSplit#

rootSplit: WorkspaceSplit

activeLeaf#

activeLeaf: WorkspaceLeaf

containerEl#

containerEl: HTMLElement

layoutReady#

layoutReady: boolean

requestSaveLayout#

requestSaveLayout: () => void

requestSaveHistory#

requestSaveHistory: () => void

Methods#

onLayoutReady#

onLayoutReady(callback: () => any): void;

Runs the callback function right away if layout is already ready, or push it to a queue to be called later when layout is ready.

changeLayout#

changeLayout(workspace: any): Promise<void>;

getLayout#

getLayout(): any;

createLeafInParent#

createLeafInParent(parent: WorkspaceSplit, index: number): WorkspaceLeaf;

splitLeaf#

splitLeaf(source: WorkspaceItem, newLeaf: WorkspaceItem, direction?: SplitDirection, before?: boolean): void;

createLeafBySplit#

createLeafBySplit(leaf: WorkspaceLeaf, direction?: SplitDirection, before?: boolean): WorkspaceLeaf;

splitActiveLeaf#

splitActiveLeaf(direction?: SplitDirection): WorkspaceLeaf;

splitLeafOrActive#

splitLeafOrActive(leaf?: WorkspaceLeaf, direction?: SplitDirection): WorkspaceLeaf;

duplicateLeaf#

duplicateLeaf(leaf: WorkspaceLeaf, direction?: SplitDirection): Promise<WorkspaceLeaf>;

getUnpinnedLeaf#

getUnpinnedLeaf(type?: string): WorkspaceLeaf;

getLeaf#

getLeaf(newLeaf?: boolean): WorkspaceLeaf;

openLinkText#

openLinkText(linktext: string, sourcePath: string, newLeaf?: boolean, openViewState?: OpenViewState): Promise<void>;

setActiveLeaf#

setActiveLeaf(leaf: WorkspaceLeaf, pushHistory?: boolean, focus?: boolean): void;

Sets the active leaf

getLeafById#

getLeafById(id: string): WorkspaceLeaf;

getGroupLeaves#

getGroupLeaves(group: string): WorkspaceLeaf[];

getMostRecentLeaf#

getMostRecentLeaf(): WorkspaceLeaf;

getLeftLeaf#

getLeftLeaf(split: boolean): WorkspaceLeaf;

getRightLeaf#

getRightLeaf(split: boolean): WorkspaceLeaf;

getActiveViewOfType#

getActiveViewOfType<T extends View>(type: Constructor<T>): T | null;

getActiveFile#

getActiveFile(): TFile | null;

iterateRootLeaves#

iterateRootLeaves(callback: (leaf: WorkspaceLeaf) => any): void;

iterateAllLeaves#

iterateAllLeaves(callback: (leaf: WorkspaceLeaf) => any): void;

getLeavesOfType#

getLeavesOfType(viewType: string): WorkspaceLeaf[];

detachLeavesOfType#

detachLeavesOfType(viewType: string): void;

revealLeaf#

revealLeaf(leaf: WorkspaceLeaf): void;

getLastOpenFiles#

getLastOpenFiles(): string[];

updateOptions#

updateOptions(): void;

Calling this function will update/reconfigure the options of all markdown panes. It is fairly expensive, so it should not be called frequently.

iterateCodeMirrors#

iterateCodeMirrors(callback: (cm: CodeMirror.Editor) => any): void;

on#

on(name: 'quick-preview', callback: (file: TFile, data: string) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'resize', callback: () => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'click', callback: (evt: MouseEvent) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'active-leaf-change', callback: (leaf: WorkspaceLeaf | null) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'file-open', callback: (file: TFile | null) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'layout-change', callback: () => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'css-change', callback: () => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'file-menu', callback: (menu: Menu, file: TAbstractFile, source: string, leaf?: WorkspaceLeaf) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'editor-menu', callback: (menu: Menu, editor: Editor, view: MarkdownView) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'editor-change', callback: (editor: Editor, markdownView: MarkdownView) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'editor-paste', callback: (evt: ClipboardEvent, editor: Editor, markdownView: MarkdownView) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'editor-drop', callback: (evt: DragEvent, editor: Editor, markdownView: MarkdownView) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'codemirror', callback: (cm: CodeMirror.Editor) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.

on#

on(name: 'quit', callback: (tasks: Tasks) => any, ctx?: any): EventRef;

Triggered when the CSS of the app has changed. Triggered when the user opens the context menu on a file. Triggered when the user opens the context menu on an editor. Triggered when changes to an editor has been applied, either programmatically or from a user event. Triggered when the editor receives a paste event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the editor receives a drop event. Check for evt.defaultPrevented before attempting to handle this event, and return if it has been already handled. Use evt.preventDefault() to indicate that you've handled the event. Triggered when the app is about to quit. Not guaranteed to actually run. Perform some best effort cleanup here.