Help Integrating with new url context menu of editor in preview mode

Hello everyone,

I’ve developed an Obsidian plugin that adds custom options to the right-click menu in preview mode. With Obsidian’s recent update, their new default right-click menu for external links now overlaps with my custom menu, causing both to appear separately.

I’m looking for guidance on integrating my plugin’s menu options into Obsidian’s default context menu to ensure a seamless user experience.

Attempts & Challenges:

  • Using contextmenu event doesn’t prevent the two menus from appearing separately.
  • I haven’t found API documentation regarding modifying the new context menu of preview mode.

Does anyone have experience or suggestions on how to achieve this integration? Any advice would be greatly appreciated!

螢幕擷取畫面 2024-03-17 081741

I found this Workspace.on('url-menu') method from on('url-menu') - Developer Documentation. Not sure if this is the right solution, however, I tried to test it but got the following error message Argument of type '"url-menu"' is not assignable to parameter of type '"quit"'.