Skip to content

BrowserView

Extends

Properties

_children

_children: Component[]

Child Components attached to current component, will be unloaded on unloading parent component

Inherited from

ItemView._children


_events

_events: EventRef[]

Events that are attached to the current component, will be detached on unloading parent component

Inherited from

ItemView._events


_loaded

_loaded: boolean

Whether the component and its children are loaded

Inherited from

ItemView._loaded


actionsEl

actionsEl: HTMLElement

Container of actions for the view

Inherited from

ItemView.actionsEl


app

app: App

Inherited from

ItemView.app


backButtonEl

backButtonEl: HTMLButtonElement

Back button element for changing view history

Inherited from

ItemView.backButtonEl


canDropAnywhere

canDropAnywhere: boolean

Whether the view may be dropped anywhere in workspace

Inherited from

ItemView.canDropAnywhere


closeable

closeable: boolean

Whether the leaf may close the view

Inherited from

ItemView.closeable


containerEl

containerEl: HTMLElement

Inherited from

ItemView.containerEl


contentEl

contentEl: HTMLElement

Inherited from

ItemView.contentEl


forwardButtonEl

forwardButtonEl: HTMLButtonElement

Forward button element for changing view history

Inherited from

ItemView.forwardButtonEl


headerEl

headerEl: HTMLElement

Header bar container of view

Inherited from

ItemView.headerEl


icon

icon: string

Inherited from

ItemView.icon


iconEl

iconEl: HTMLElement

Icon element for the view (for dragging)

Inherited from

ItemView.iconEl


leaf

leaf: WorkspaceLeaf

Inherited from

ItemView.leaf


moreOptionsButtonEl

moreOptionsButtonEl: HTMLAnchorElement

Anchor button for revealing more view actions

Inherited from

ItemView.moreOptionsButtonEl


navigation: boolean

Whether or not the view is intended for navigation. If your view is a static view that is not intended to be navigated away, set this to false. (For example: File explorer, calendar, etc.) If your view opens a file or can be otherwise navigated, set this to true. (For example: Markdown editor view, Kanban view, PDF view, etc.)

Inherited from

ItemView.navigation


scope

scope: null | Scope

Assign an optional scope to your view to register hotkeys for when the view is in focus.

Example

this.scope = new Scope(this.app.scope);

Default

null
@public

Inherited from

ItemView.scope


titleContainerEl

titleContainerEl: HTMLElement

Container for the title of the view

Inherited from

ItemView.titleContainerEl


titleEl

titleEl: HTMLElement

Title element for the view

Inherited from

ItemView.titleEl


titleParentEl

titleParentEl: HTMLElement

Title of the parent

Inherited from

ItemView.titleParentEl

Methods

addAction()

addAction(icon, title, callback)

addAction(icon, title, callback): HTMLElement

Parameters

icon: string

title: string

callback

Returns

HTMLElement

Inherited from

ItemView.addAction

addAction(icon, title, callback)

addAction(icon, title, callback): HTMLElement

Adds an action button to the header of the view

Parameters

icon: string

The icon for the action

title: string

The title for the action

callback

Callback to execute on click

Returns

HTMLElement

Inherited from

ItemView.addAction


addChild()

addChild<T>(component): T

Adds a child component, loading it if this component is loaded

Type Parameters

T extends Component

Parameters

component: T

Returns

T

Inherited from

ItemView.addChild


close()

close(): Promise<void>

Closes the view

Returns

Promise<void>

Inherited from

ItemView.close


closeSearch()

closeSearch(): void

Returns

void


commitPageLoad()

commitPageLoad(): unknown

Returns

unknown


configureWebContents()

configureWebContents(): void

Returns

void


contextMenuItemsForImg()

contextMenuItemsForImg(e): unknown

Parameters

e: unknown

Returns

unknown


contextMenuItemsForLink(e, t): unknown

Parameters

e: unknown

t: unknown

Returns

unknown


contextMenuItemsForSelection()

contextMenuItemsForSelection(e, t): unknown

Parameters

e: unknown

t: unknown

Returns

unknown


displayBlank()

displayBlank(): void

Returns

void


displayContextMenu()

displayContextMenu(e): void

Parameters

e: unknown

Returns

void


displayErrorView()

displayErrorView(): void

Shows the error view

Returns

void


displayReaderView()

displayReaderView(): Promise<unknown>

Returns

Promise<unknown>


displayWebView()

displayWebView(): void

Shows the webview

Returns

void


getDisplayText()

abstract getDisplayText(): string

Returns

string

Inherited from

ItemView.getDisplayText


getEphemeralState()

getEphemeralState()

getEphemeralState(): Record<string, unknown>

Returns

Record<string, unknown>

Inherited from

ItemView.getEphemeralState

getEphemeralState()

getEphemeralState(): object

Gets the ephemeral (non-persistent) state of the editor

Returns

object

Inherited from

ItemView.getEphemeralState


getIcon()

getIcon()

getIcon(): string

Returns

string

Inherited from

ItemView.getIcon

getIcon()

getIcon(): string

Returns the icon name

Returns

string

Inherited from

ItemView.getIcon


getReaderModeContent()

getReaderModeContent(): Promise<unknown>

Returns

Promise<unknown>


getSideTooltipPlacement()

getSideTooltipPlacement(): undefined | "left" | "right"

Returns the placement of the tooltip

Returns

undefined | "left" | "right"

Inherited from

ItemView.getSideTooltipPlacement


getState()

getState()

getState(): Record<string, unknown>

Returns

Record<string, unknown>

Inherited from

ItemView.getState

getState()

getState(): object

Returns the current state of the view

Returns

object

Inherited from

ItemView.getState


getViewType()

getViewType(): "browser"

Get the current view type

Returns

"browser"

Overrides

ItemView.getViewType


handleCopy()

handleCopy(event): void

Handle copy event on metadata editor and serialize properties

Parameters

event: ClipboardEvent

Returns

void

Inherited from

ItemView.handleCopy


handleCut()

handleCut(event): void

Handle cut event on metadata editor and serialize and remove properties

Parameters

event: ClipboardEvent

Returns

void

Inherited from

ItemView.handleCut


handleDrop()

handleDrop(event, t, n): unknown

Parameters

event: DragEvent

t: unknown

n: unknown

Returns

unknown

Inherited from

ItemView.handleDrop


handlePaste()

handlePaste(event): void

Handle paste event of properties on metadata editor

Parameters

event: ClipboardEvent

Returns

void

Inherited from

ItemView.handlePaste


hideAll()

hideAll(): void

Returns

void


instantiateWebView()

instantiateWebView(): void

Setup the webview

Returns

void


load()

load(): void

Load this component and its children

Returns

void

Inherited from

ItemView.load


navigate(e, t): unknown

Parameters

e: unknown

t: unknown

Returns

unknown


onCheckboxClick()

onCheckboxClick(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onClose()

onClose(): Promise<void>

Returns

Promise<void>

Inherited from

ItemView.onClose


onExternalLinkClick()

onExternalLinkClick(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onExternalLinkRightClick()

onExternalLinkRightClick(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onFoldChange()

onFoldChange(): void

Returns

void


onGroupChange()

onGroupChange(): void

Returns

void

Inherited from

ItemView.onGroupChange


onHeaderMenu()

onHeaderMenu(e): void

Parameters

e: unknown

Returns

void

Inherited from

ItemView.onHeaderMenu


onInternalLinkClick()

onInternalLinkClick(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onInternalLinkDrag()

onInternalLinkDrag(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onInternalLinkMouseover()

onInternalLinkMouseover(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onInternalLinkRightClick()

onInternalLinkRightClick(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onload()

onload(): void

Override this to load your component

Returns

void

Inherited from

ItemView.onload


onMoreOptions()

onMoreOptions(event): void

Parameters

event: Event

Returns

void

Inherited from

ItemView.onMoreOptions


onMoreOptionsMenu()

onMoreOptionsMenu(e): void

Parameters

e: unknown

Returns

void

Inherited from

ItemView.onMoreOptionsMenu


onOpen()

onOpen(): Promise<void>

Returns

Promise<void>

Inherited from

ItemView.onOpen


onPaneMenu()

onPaneMenu(menu, source): void

Populates the pane menu.

(Replaces the previously removed onHeaderMenu and onMoreOptionsMenu)

Parameters

menu: Menu

source: string

Returns

void

Inherited from

ItemView.onPaneMenu


onReaderModeContextMenu()

onReaderModeContextMenu(e): void

Parameters

e: unknown

Returns

void


onRenderComplete()

onRenderComplete(): void

Returns

void


onResize()

onResize(): void

Called when the size of this view is changed.

Returns

void

Inherited from

ItemView.onResize


onScroll()

onScroll(): void

Returns

void


onTabMenu()

onTabMenu(menu): void

Adds the menu items to the menu

Parameters

menu: Menu

the menu to fill

Returns

void

Inherited from

ItemView.onTabMenu


onTagClick()

onTagClick(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


onunload()

onunload(): void

Override this to unload your component

Returns

void

Inherited from

ItemView.onunload


open()

open(parentEl): Promise<void>

Opens the view

Parameters

parentEl: Node

The node the view get attached to

Returns

Promise<void>

Inherited from

ItemView.open


postProcess()

postProcess(e, t, n): void

Parameters

e: unknown

t: unknown

n: unknown

Returns

void


pushViewStackHistory()

pushViewStackHistory(e): void

Parameters

e: unknown

Returns

void


register()

register(cb): void

Registers a callback to be called when unloading

Parameters

cb

Returns

void

Inherited from

ItemView.register


registerDomEvent()

registerDomEvent(el, type, callback, options)

registerDomEvent<K>(el, type, callback, options?): void

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof WindowEventMap

Parameters

el: Window

type: K

callback

options?: boolean | AddEventListenerOptions

Returns

void

Inherited from

ItemView.registerDomEvent

registerDomEvent(el, type, callback, options)

registerDomEvent<K>(el, type, callback, options?): void

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof DocumentEventMap

Parameters

el: Document

type: K

callback

options?: boolean | AddEventListenerOptions

Returns

void

Inherited from

ItemView.registerDomEvent

registerDomEvent(el, type, callback, options)

registerDomEvent<K>(el, type, callback, options?): void

Registers an DOM event to be detached when unloading

Type Parameters

K extends keyof HTMLElementEventMap

Parameters

el: HTMLElement

type: K

callback

options?: boolean | AddEventListenerOptions

Returns

void

Inherited from

ItemView.registerDomEvent


registerEvent()

registerEvent(eventRef): void

Registers an event to be detached when unloading

Parameters

eventRef: EventRef

Returns

void

Inherited from

ItemView.registerEvent


registerInterval()

registerInterval(id): number

Registers an interval (from setInterval) to be cancelled when unloading Use setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API

Parameters

id: number

Returns

number

Inherited from

ItemView.registerInterval


registerScopeEvent()

registerScopeEvent(keymapEventHandler): void

Parameters

keymapEventHandler: KeymapEventHandler

Returns

void

Inherited from

ItemView.registerScopeEvent


removeChild()

removeChild<T>(component): T

Removes a child component, unloading it

Type Parameters

T extends Component

Parameters

component: T

Returns

T

Inherited from

ItemView.removeChild


reportPageLoad()

reportPageLoad(url, title, navigate): void

Parameters

url: string

title: string

navigate: unknown

Returns

void


saveAsMarkdown()

saveAsMarkdown(): Promise<unknown>

Returns

Promise<unknown>


selectFavicon()

selectFavicon(e): unknown

Parameters

e: unknown

Returns

unknown


setEphemeralState()

setEphemeralState(state)

setEphemeralState(state): void

Parameters

state: unknown

Returns

void

Inherited from

ItemView.setEphemeralState

setEphemeralState(state)

setEphemeralState(state): void

Set the ephemeral (non-persistent) state of the editor

Parameters

state: any

Returns

void

Inherited from

ItemView.setEphemeralState


setFavicon()

setFavicon(e): unknown

Parameters

e: unknown

Returns

unknown


setState()

setState(state, result)

setState(state, result): Promise<void>

Parameters

state: unknown

result: ViewStateResult

Returns

Promise<void>

Inherited from

ItemView.setState

setState(state, result)

setState(state, result): Promise<void>

Parameters

state: any

result: ViewStateResult

Returns

Promise<void>

Inherited from

ItemView.setState


showSearch()

showSearch(): void

Returns

void


storeCurrentPageTitle()

storeCurrentPageTitle(): Promise<unknown>

Stores the title of the current webview

Returns

Promise<unknown>


toggleReaderMode()

toggleReaderMode(): void

Toggles the reader mode

Returns

void


unload()

unload(): void

Unload this component and its children

Returns

void

Inherited from

ItemView.unload


updateNavButtons()

updateNavButtons(): void

Updates the navigation buttons depending on the history

Returns

void

Inherited from

ItemView.updateNavButtons


zoomIn()

zoomIn(): void

Zoom in the webview

Returns

void


zoomOut()

zoomOut(): void

Zoom out the webview

Returns

void


zoomReset()

zoomReset(): void

Resets the zoom factor of the webview

Returns

void