Hey @aarongilly
I was trying to make my own plugin to have a custom node item and add the same in the drop down menu. To start i wanted to add a new menu item in the dropdown menu of canvas edges so iItried to do the same thing you mentioned in a previous post (Creating an Event for Menus on Canvas Items).
Made some modifications based off the code in your plugin but it does not seem to work.
This is what i have
import { App, Menu, Notice, Plugin, PluginSettingTab, Setting, TFile, TFolder, TextFileView } from ‘obsidian’;
import { AllCanvasNodeData, CanvasData, CanvasEdgeData, CanvasFileData, CanvasGroupData, CanvasLinkData, CanvasNodeData, CanvasTextData, NodeSide } from ‘obsidian/canvas’;
export default class CustomCanvasNodePlugin extends Plugin {
async onload() {
this.registerEvent(
//@ts-expect-error - it works, despite TypeScript not seeing the 'canvas:' methods
this.app.workspace.on("canvas:edge-menu", (menu: Menu, edge: any) => {
menu.addItem((item) => {
item.setTitle("Test Menu") .setIcon("dice") .onClick(() => {
console.log({edge}) }) }) }))
console.log("Custom Canvas Node Plugin loaded!");
}
Would love some help with this if you can find the time!!