dustinho61 downloadsAdds a 'Copy Embed Code' option to right-click context menu for images. Works in Live Preview and Reading Mode, including nested embeds.
An Obsidian plugin that adds a "Copy Embed Code" option to the right-click context menu for images.
![[filename.png]]Obsidian's standard editor-menu API relies on cursor position, but clicking an image doesn't always move the cursor—especially when the image is inside an embed (transclusion), or nested multiple levels deep.
contextmenu listener (capture phase) detects the click<img> elementThe plugin uses DOM-based detection rather than cursor position:
Document
└── contextmenu listener (capture phase)
└── Walks up DOM tree from evt.target
└── Finds <img> regardless of nesting depth
This means an image 5 levels deep (blockquote → embed → callout → embed → image) works identically to a top-level image.
| Context | Method |
|---|---|
| Edit mode | Hooks into Obsidian's editor-menu event |
| Reading mode / nested embeds | Injects directly into .menu DOM element |
main.js and manifest.json from the releases<vault>/.obsidian/plugins/copy-embed-url/npm install
npm run build
MIT