Skip to content

App

Constructors

new App()

new App(): App

Returns

App

Properties

appId

appId: string

ID that uniquely identifies the vault


commands

commands: Commands

Contains all registered commands


customCss

customCss: CustomCSS

Custom CSS (snippets/themes) applied to the application


dom

dom: ObsidianDOM

References to important DOM elements of the application


embedRegistry

embedRegistry: EmbedRegistry

Registry that manages the creation of generic media type embeds


fileManager

fileManager: FileManager


hotkeyManager

hotkeyManager: HotkeyManager

Manages global hotkeys


internalPlugins

internalPlugins: InternalPlugins

Manager of internal ‘core’ plugins


isMobile

isMobile: boolean

Whether the application is currently running on mobile


keymap

keymap: Keymap


lastEvent

lastEvent: null | UserEvent

The last known user interaction event, to help commands find out what modifier keys are pressed.


loadProgress

loadProgress: LoadProgress


metadataCache

metadataCache: MetadataCache


metadataTypeManager

metadataTypeManager: MetadataTypeManager

Manages the frontmatter properties of the vault and the rendering of the properties


mobileTabSwitcher

mobileTabSwitcher: null | MobileTabSwitcher


plugins

plugins: Plugins

Manages loading and enabling of community (non-core) plugins


scope

scope: Scope


setting

setting: AppSetting

Manages the settings modal and its tabs


title

title: string

Name of the vault with version suffix


vault

vault: Vault


viewRegistry

viewRegistry: ViewRegistry

Manages the construction of appropriate views when opening a file of a certain type


workspace

workspace: Workspace

Methods

changeTheme()

changeTheme(theme): void

Sets the accent color of the application (light/dark mode)

Parameters

theme: "moonstone" | "obsidian"

Returns

void


copyObsidianUrl()

copyObsidianUrl(file): void

Copies Obsidian URI of given file to clipboard

Parameters

file: TFile

File to generate URI for

Returns

void


debugMode()

debugMode(isEnabled): void

Toggles debug mode

Parameters

isEnabled: boolean

Whether to enable or disable debug mode

Returns

void


disableCssTransition()

disableCssTransition(): void

Disables all CSS transitions in the vault (until manually re-enabled)

Returns

void


emulateMobile()

emulateMobile(emulate): void

Restarts Obsidian and renders workspace in mobile mode

Parameters

emulate: boolean

Returns

void


enableCssTransition()

enableCssTransition(): void

Enables all CSS transitions in the vault

Returns

void


fixFileLinks(element): void

Manually fix all file links pointing towards image/audio/video resources in element

Parameters

element: HTMLElement

Element to fix links in

Returns

void


garbleText()

garbleText(): void

Applies an obfuscation font to all text characters in the vault

Returns

void


getAccentColor()

getAccentColor(): string

Get the accent color of the application

Returns

string


getAppTitle()

getAppTitle(): string

Get the current title of the application

Returns

string


getObsidianUrl()

getObsidianUrl(file): string

Get the URI for opening specified file in Obsidian

Parameters

file: TFile

Returns

string


getSpellcheckLanguages()

getSpellcheckLanguages(): string[]

Get currently active spellcheck languages

Returns

string[]


getTheme()

getTheme(): "moonstone" | "obsidian"

Get the current color scheme of the application

Returns

"moonstone" | "obsidian"


importAttachments()

importAttachments(imports, folder): Promise<void>

Import attachments into specified folder

Parameters

imports: ImportedAttachments[]

folder: null | TFolder

Returns

Promise<void>


isVimEnabled()

isVimEnabled(): boolean

Returns

boolean


loadLocalStorage()

loadLocalStorage(key): unknown

Load a value from the localstorage given key

Parameters

key: string

Key of value to load

Returns

unknown


on()

on(): void

Returns

void


openHelp()

openHelp(): void

Open the help vault (or site if mobile)

Returns

void


openVaultChooser()

openVaultChooser(): void

Open the vault picker

Returns

void


openWithDefaultApp()

openWithDefaultApp(path): void

Open the file with OS defined default file browser application

Parameters

path: string

Returns

void


saveLocalStorage()

saveLocalStorage(key, value): void

Save a value to the localstorage given key

Parameters

key: string

Key of value to save

value: unknown

Value to save

Returns

void


setAccentColor()

setAccentColor(color): void

Set the accent color of the application

Parameters

color: string

Returns

void


setAttachmentFolder()

setAttachmentFolder(path): void

Set the path where attachments should be stored

Parameters

path: string

Returns

void


setSpellcheckLanguages()

setSpellcheckLanguages(languages): void

Set the spellcheck languages

Parameters

languages: string[]

Returns

void


setTheme()

setTheme(theme): void

Set the current color scheme of the application and reload the CSS

Parameters

theme: "moonstone" | "obsidian"

Returns

void


showInFolder()

showInFolder(path): void

Open the OS file picker at path location

Parameters

path: string

Returns

void


showReleaseNotes()

showReleaseNotes(version?): void

Show the release notes for provided version as a new leaf

Parameters

version?: string

Version to show release notes for (defaults to current version)

Returns

void


updateAccentColor()

updateAccentColor(): void

Updates the accent color and reloads the CSS

Returns

void


updateFontFamily()

updateFontFamily(): void

Update the font family of the application and reloads the CSS

Returns

void


updateFontSize()

updateFontSize(): void

Update the font size of the application and reloads the CSS

Returns

void


updateInlineTitleDisplay()

updateInlineTitleDisplay(): void

Update the inline title rendering in notes

Returns

void


updateRibbonDisplay()

updateRibbonDisplay(): void

Returns

void


updateTheme()

updateTheme(): void

Update the color scheme of the application and reloads the CSS

Returns

void


updateViewHeaderDisplay()

updateViewHeaderDisplay(): void

Update the view header display in notes

Returns

void