Plugin class
Signature:
export abstract class Plugin extends Component
Extends: Component
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(app, manifest) | Constructs a new instance of the Plugin class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
app | App | ||
manifest | PluginManifest |
Methods
Method | Modifiers | Description |
---|---|---|
addChild(component) | Adds a child component, loading it if this component is loaded (Inherited from Component) | |
addCommand(command) | Register a command globally. Registered commands will be available from the @{link https://help.md/Plugins/Command+palette Command palette}. The command id and name will be automatically prefixed with this plugin’s id and name. | |
addRibbonIcon(icon, title, callback) | Adds a ribbon icon to the left bar. | |
addSettingTab(settingTab) | Register a settings tab, which allows users to change settings. | |
addStatusBarItem() | Adds a status bar item to the bottom of the app. Not available on mobile. | |
load() | Load this component and its children (Inherited from Component) | |
loadData() | Load settings data from disk. Data is stored in data.json in the plugin folder. | |
onExternalSettingsChange()? | (Optional) Called when the Implement this method to reload plugin settings when they have changed externally. | |
onload() | ||
onunload() | Override this to unload your component (Inherited from Component) | |
onUserEnable() | Perform any initial setup code. The user has explicitly interacted with the plugin so its safe to engage with the user. If your plugin registers a custom view, you can open it here. | |
register(cb) | Registers a callback to be called when unloading (Inherited from Component) | |
registerDomEvent(el, type, callback, options) | Registers an DOM event to be detached when unloading (Inherited from Component) | |
registerDomEvent(el, type, callback, options) | Registers an DOM event to be detached when unloading (Inherited from Component) | |
registerDomEvent(el, type, callback, options) | Registers an DOM event to be detached when unloading (Inherited from Component) | |
registerEditorExtension(extension) | Registers a CodeMirror 6 extension. To reconfigure cm6 extensions for a plugin on the fly, an array should be passed in, and modified dynamically. Once this array is modified, calling Workspace.updateOptions() will apply the changes. | |
registerEditorSuggest(editorSuggest) | Register an EditorSuggest which can provide live suggestions while the user is typing. | |
registerEvent(eventRef) | Registers an event to be detached when unloading (Inherited from Component) | |
registerExtensions(extensions, viewType) | ||
registerHoverLinkSource(id, info) | Registers a view with the ‘Page preview’ core plugin as an emitter of the ‘hover-link’ event. | |
registerInterval(id) | Registers an interval (from setInterval) to be cancelled when unloading Use instead of to avoid TypeScript confusing between NodeJS vs Browser API (Inherited from Component) | |
registerMarkdownCodeBlockProcessor(language, handler, sortOrder) | Register a special post processor that handles fenced code given a language and a handler. This special post processor takes care of removing the <pre><code> and create a <div> that will be passed to the handler, and is expected to be filled with custom elements. | |
registerMarkdownPostProcessor(postProcessor, sortOrder) | Registers a post processor, to change how the document looks in reading mode. | |
registerObsidianProtocolHandler(action, handler) | Register a handler for obsidian:// URLs. | |
registerView(type, viewCreator) | ||
removeChild(component) | Removes a child component, unloading it (Inherited from Component) | |
removeCommand(commandId) | Manually remove a command from the list of global commands. This should not be needed unless your plugin registers commands dynamically. | |
saveData(data) | Write settings data to disk. Data is stored in data.json in the plugin folder. | |
unload() | Unload this component and its children (Inherited from Component) |