gavvvr / obsidian-imgur-plugin

Pastes images right to imgur.com
MIT License
218 stars 58 forks source link

Feature Request - Command Palette Entry to upload image #22

Open mahadevan opened 2 years ago

mahadevan commented 2 years ago

There is no way to attach an image other than "drag & drop" image onto Obsidian. A Ctrl+P, Command Palette entry would be awesome. Users can attach images directly from obsidian by Command or shortcut instead of dragging & dropping them into the note.

gavvvr commented 2 years ago

Hi @mahadevan

Thanks for sharing your idea about Command palette entry.

First I would like to correct you:

There is no way to attach an image other than "drag & drop" image onto Obsidian

That's not quite right. The primary way to paste an image is to press Cmd/Ctrl+V actually. In this case the source of image is obviously the current content of your clipboard. Drag'n'Drop is also supported as you mentioned.

Now, let's get back to your idea of having a palette command. What would be the source of image, when you trigger a palette command to upload at Imgur? I can imagine the situation that you might want to upload a current local image under your cursor with palette command to avoid touching the mouse, but the upload of local images (#7) is not yet implemented unfortunately. Let me know if this is what you meant. If I got you right, that's a good idea, I like the command what will free a user from using the mouse.

The most difficult part here will be to implement the upload of local image. I already have a POC in a upload-existing-image-POC branch. The upload is working, but I also want to implement removal of local image and replacement of an old link to a local image in the whole Vault with a just created Imgur link (that's the most difficult part for now, because it will require a significant amount of time from me. There is no public API for such a batch replacement and to find such code in private API you need to debug uglified JavaScript code)

gavvvr commented 6 days ago

Hi @mahadevan. There is now a command palette entry to upload existing local image under cursor to Imgur. Is that what you initially meant by this feature request? There is also an option to do the same by right-clicking embedded local image and choosing "Upload to Imgur" context menu item.