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:
app.commands
Register and execute commands
app.events
Subscribe to application events
app.vault
Access files in the vault
app.modals
Show dialogs and prompts
app.hotkeys
Register keyboard shortcuts
app.editor
Interact with the text editor
app.theme
Access and modify themes
Quick Reference
| API | Common Methods |
|---|---|
app.commands | addCommand(), execute() |
app.events | on(), trigger() |
app.vault | read(), create(), getFiles() |
app.modals | alert(), confirm(), prompt(), select() |
app.hotkeys | register() |
app.editor | insertText(), getContent(), getSelectedText() |
app.theme | getTheme(), 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);
})
);
}
}