diff --git a/main.ts b/main.ts index f8f9630..e7915fb 100644 --- a/main.ts +++ b/main.ts @@ -17,6 +17,21 @@ export default class ProjektkontextPlugin extends Plugin { this.registerView(VIEW_TYPE_PROJECT_DETAILS_VIEW, (leaf) => new ProjectDetailsView(leaf)); this.registerView(VIEW_TYPE_COLLECTION_VIEW, (leaf) => new CollectionView(leaf)); + this.registerObsidianProtocolHandler("projektkontext", async (params) => { + const project = params.project; + if (!project) { + await this.activateProjectView(); + return; + } + const leaf = this.app.workspace.getLeaf(false); + await leaf.setViewState({ + type: VIEW_TYPE_PROJECT_DETAILS_VIEW, + active: true, + state: { project }, + }); + this.app.workspace.revealLeaf(leaf); + }); + this.addRibbonIcon(RIBBON_ICON, "Projekte", () => { void this.activateProjectView(); });