Skip to content

WebviewerView

Unofficial

obsidian#View that renders an embedded web browser for browsing web pages within Obsidian.

Import:

import type { WebviewerView } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface WebviewerView extends ItemView

Extends: ItemView

Constructor

new WebviewerView(leaf: WorkspaceLeaf, browserPluginInstance: WebviewerPluginInstance)

Constructor.

Properties

PropertyTypeDescription
actionsElHTMLElementContainer of actions for the view.
(Inherited from ItemView)
appAppThe Obsidian app instance.
(Inherited from ItemView)
backButtonElHTMLButtonElementBack button element for changing view history.
(Inherited from ItemView)
canDropAnywherebooleanWhether the view may be dropped anywhere in workspace.
(Inherited from ItemView)
closeablebooleanWhether the leaf may close the view.
(Inherited from ItemView)
containerElHTMLElementThe container HTML element for the component.
(Inherited from ItemView)
contentElHTMLElementThe parent element of the content.
(Inherited from ItemView)
forwardButtonElHTMLButtonElementForward button element for changing view history.
(Inherited from ItemView)
headerElHTMLElementHeader bar container of view.
(Inherited from ItemView)
iconIconNameThe icon of the view.
(Inherited from ItemView)
iconElHTMLElementIcon element for the view (for dragging).
(Inherited from ItemView)
leafWorkspaceLeafThe leaf of the view.
(Inherited from ItemView)
leftSidebarToggleElHTMLElement | nullToggle button for the left sidebar, shown on mobile. null on desktop.
(Inherited from ItemView)
moreOptionsButtonElHTMLAnchorElementAnchor button for revealing more view actions.
(Inherited from ItemView)
navigationbooleanWhether 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)
scopenull | ScopeAssign an optional scope to your view to register hotkeys for when the view is in focus.
(Inherited from ItemView)
titleContainerElHTMLElementContainer for the title of the view.
(Inherited from ItemView)
titleElHTMLElementTitle element for the view.
(Inherited from ItemView)
titleParentElHTMLElementTitle of the parent.
(Inherited from ItemView)

Methods

MethodReturnsDescription
addAction(icon, title, callback)HTMLElementAdd an action to the item view.
(Inherited from ItemView)
close()Promise<void>Closes the view.
(Inherited from ItemView)
closeSearch()voidClose the in-page search bar.
commitPageLoad()unknownFinalize and commit the current page load.
configureWebContents()voidConfigure the web contents settings for the webview.
contextMenuItemsForImg(e)unknownBuild context menu items for an image element.
contextMenuItemsForLink(e, t)unknownBuild context menu items for a link element.
contextMenuItemsForSelection(e, t)unknownBuild context menu items for selected text.
displayBlank()voidDisplay a blank page in the webview.
displayContextMenu(e)voidDisplay a context menu at the given position.
displayErrorView()voidShows the error view.
displayReaderView()Promise<unknown>Display the page content in reader mode.
displayWebView()voidShows the webview.
getDisplayText()stringGet the display text of the view.
(Inherited from ItemView)
getEphemeralState()Record<string, unknown>Get the ephemeral state of the view.
(Inherited from ItemView)
getIcon()IconNameGet the icon of the view.
(Inherited from ItemView)
getReaderModeContent()Promise<unknown>Get the parsed content for reader mode.
getSideTooltipPlacement()'left' | 'right' | undefinedReturns the placement of the tooltip.
(Inherited from ItemView)
getState()Record<string, unknown>Get the state of the view.
(Inherited from ItemView)
getViewType()typeof ViewType.WebviewerGet the current view type.
handleCopy(event)voidHandle copy event on metadata editor and serialize properties.
(Inherited from ItemView)
handleCut(event)voidHandle cut event on metadata editor and serialize and remove properties.
(Inherited from ItemView)
handleDrop(event, draggable, isOver)DropResult | nullHandle a drop event on this view.
(Inherited from ItemView)
handlePaste(event)voidHandle paste event of properties on metadata editor.
(Inherited from ItemView)
hideAll()voidHide all view content (webview, reader, error).
instantiateWebView()voidSetup the webview.
navigate(e, t)unknownNavigate the webview to a URL.
onCheckboxClick(e, t, n)voidHandle a checkbox click in reader mode.
onClose()Promise<void>Called when the view is closed.
(Inherited from ItemView)
onExternalLinkClick(e, t, n)voidHandle a click on an external link.
onExternalLinkRightClick(e, t, n)voidHandle a right-click on an external link.
onFoldChange()voidHandle a fold/collapse state change in reader mode.
onGroupChange()voidHandle a linked group change event.
(Inherited from ItemView)
onHeaderMenu(e)voidCalled when the header context menu is triggered.
(Inherited from ItemView)
onInternalLinkClick(e, t, n)voidHandle a click on an internal (vault) link.
onInternalLinkDrag(e, t, n)voidHandle dragging an internal link.
onInternalLinkMouseover(e, t, n)voidHandle mouseover on an internal link for preview.
onInternalLinkRightClick(e, t, n)voidHandle a right-click on an internal link.
onMoreOptions(event)voidHandle the 'more options' button click event.
(Inherited from ItemView)
onMoreOptionsMenu(e)voidHandle the 'more options' context menu event.
(Inherited from ItemView)
onOpen()Promise<void>Called when the view is opened.
(Inherited from ItemView)
onPaneMenu(menu, source)voidPopulates the pane menu.

(Replaces the previously removed onHeaderMenu and onMoreOptionsMenu)
(Inherited from ItemView)
onReaderModeContextMenu(e)voidHandle a context menu event in reader mode.
onRenderComplete()voidCalled when the reader mode rendering is complete.
onResize()voidCalled when the size of this view is changed.
(Inherited from ItemView)
onScroll()voidHandle scroll events in the webview.
onTabMenu(menu)voidAdds the menu items to the menu.
(Inherited from ItemView)
onTagClick(e, t, n)voidHandle a click on a tag in reader mode.
open(parentEl)Promise<void>Opens the view.
(Inherited from ItemView)
postProcess(e, t, n)voidPost-process rendered content in reader mode.
pushViewStackHistory(e)voidPush the current page to the view navigation history stack.
reportPageLoad(url, title, navigate)voidReport a page load event to the history database.
saveAsMarkdown()Promise<unknown>Save the current page content as a Markdown file.
selectFavicon(e)unknownSelect the appropriate favicon for the current page.
setEphemeralState(state)voidSet the ephemeral state of the view.
(Inherited from ItemView)
setFavicon(e)unknownSet the favicon for the current page.
setState(state, result)Promise<void>Set the state of the view.
(Inherited from ItemView)
showSearch()voidShow the in-page search bar.
storeCurrentPageTitle()Promise<unknown>Stores the title of the current webview.
toggleReaderMode()voidToggles the reader mode.
updateNavButtons()voidUpdate the state of the back/forward navigation buttons.
(Inherited from ItemView)
zoomIn()voidZoom in the webview.
zoomOut()voidZoom out the webview.
zoomReset()voidResets the zoom factor of the webview.

Links to this page: