Vandrite Docs

API Reference

Complete reference for the Vandrite Plugin API

API Reference

This section provides detailed documentation for all available Vandrite Plugin APIs.

Available APIs

The app object provides access to all Vandrite APIs:

Quick Reference

APICommon Methods
app.commandsaddCommand(), execute()
app.eventson(), trigger()
app.vaultread(), create(), getFiles()
app.modalsalert(), confirm(), prompt(), select()
app.hotkeysregister()
app.editorinsertText(), getContent(), getSelectedText()
app.themegetTheme(), setTheme()

Using APIs in Your Plugin

All APIs are available through this.app in your plugin:

import { Plugin } from "@vandrite/plugin-api";

export default class MyPlugin extends Plugin {
  async onload() {
    // Commands API
    this.addCommand({
      id: "my-command",
      name: "Do Something",
      callback: () => {
        // Modals API
        this.app.modals.alert("Hello!", "This is a message");
      },
    });

    // Events API
    this.registerEvent(
      this.app.events.on("file-open", (file) => {
        // Vault API
        const content = this.app.vault.read(file.path);
      })
    );
  }
}

On this page