generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from chhoumann/v1.3.0
- Loading branch information
Showing
10 changed files
with
75 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"plugins": [ | ||
["obsidian", { "dir": "./dist", "zip": true }] | ||
], | ||
"owner": "chhoumann", | ||
"repo": "MetaEdit", | ||
"name": "Christian B. B. Houmann", | ||
"email": "christian@bagerbach.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type MetaEdit from "../main"; | ||
import {Menu, TFile} from "obsidian"; | ||
|
||
export class LinkMenu { | ||
private targetFile: TFile; | ||
|
||
constructor(private plugin: MetaEdit) { | ||
this.registerEvent(); | ||
} | ||
|
||
registerEvent(): void { | ||
this.plugin.registerEvent( | ||
this.plugin.app.workspace.on('file-menu', (menu, file, source) => { | ||
if (source === "link-context-menu" && file instanceof TFile) { | ||
this.targetFile = file; | ||
this.addOptions(menu); | ||
} | ||
}) | ||
) | ||
} | ||
|
||
private addOptions(menu: Menu) { | ||
menu.addItem(item => { | ||
item.setIcon('pencil'); | ||
item.setTitle("Edit Meta"); | ||
item.onClick(async evt => { | ||
await this.plugin.runMetaEditForFile(this.targetFile); | ||
}) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters