# Get the Active Editor Instance in Obsidian With API ## Metadata **Status**:: #x **Zettel**:: #zettel/fleeting **Created**:: [[2022-09-20]] **Parent**:: [[Obsidian API for Plugins]] ## Notes ```javascript const leaf = app.workspace.activeLeaf; if (!leaf || !leaf.view || !leaf.view.editor) { new Notice("🔴error: no active editor"); return; } const editor = leaf.view.editor; ```