NomarCub / obsidian-copy-url-in-preview

Image Context Menus - Obsidian.md image context menus: copy, open in default app, show in system explorer, reveal in navigation context menu. Also Open PDF externally context menu.
MIT License
66 stars 9 forks source link

adds copy images (local and remote) #2

Closed luckman212 closed 3 years ago

luckman212 commented 3 years ago

feature add: right click to copy image to clipboard

image

This is some very hacky code. 😱 I'm sorry.

Notes

Related research links:

thank you: https://stackoverflow.com/questions/17124053/node-js-get-image-from-web-and-encode-with-base64

luckman212 commented 3 years ago

Hi @NomarCub -- I have been working on this for a bit. Please help me clean this up if you have any ideas!

NomarCub commented 3 years ago

Hi! I'd also like to have this feature, but I don't have much free time for this now, and this is not within my expertise. But I'll help as I can. Before merging the following should be addressed:

The plugin doesn't load for me on Android, here's the error:

Plugin failure: copy-url-in-preview TypeError: Cannot destructure property 'clipboard' of 'require(...)' as it is undefined.
    at anonymous (eval at <anonymous> (app.js:1), <anonymous>:10:9)
    at t.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at s (app.js:1)
luckman212 commented 3 years ago

Ok @NomarCub I'll try to clean those up a bit. This was more of a POC to see if copy image was possible. I don't have an Android device to test with but I will see if I get the same errors on iOS and try to fix.

luckman212 commented 3 years ago

I think I'm on the right path but I'm hitting a wall on this and have posted to the Developers/API forum asking for some help. I'm continuing to try!

Fixing right click → copy image function in plugin - Developers & API - Obsidian Forum

luckman212 commented 3 years ago

Update: rewritten PR #3 is up... should be quite a bit better than the ugliness above (thanks @sissilab)