mushanshitiancai / vscode-paste-image

paste image from clipboard to markdown/asciidoc directly!
MIT License
419 stars 126 forks source link

Fallback to regular paste when no image in clipboard #87

Closed riccardoferretti closed 2 years ago

riccardoferretti commented 3 years ago

Hi, I really like the extension, thanks for your work. The only thing I found less intuitive was the different keyboard shortcut, cmd+alt+v

I was curious to map the command to cmd+v, but couldn't do it because when there is text and not an image in the clipboard, instead of pasting I get a notification.

Would it be possible to have Paste Image:

This way we wouldn't need to remember a second key-combo, wdyt?

hmalphettes commented 3 years ago

@riccardoferretti, also a fan of the extension and so are my colleagues.

Great idea and I think it is possible.

If that is helpful, you can get a good idea of where the external script in charge of findin data in the Clipboard and how it communicates with the javascript side of the plugin by staring at my pull request: https://github.com/mushanshitiancai/vscode-paste-image/pull/85/files

So on windows for example the current powershell returns:

$img = [Windows.Clipboard]::GetImage()
if ($img -eq $null) {
    "no image"
    Exit 1
}

We would need to tweak this so we know when to fall back to the standard Paste. We would need to do the same for each OS and their own external script.

riccardoferretti commented 3 years ago

hey @hmalphettes, I was wondering if you could use the vscode editor.action.clipboardPasteAction command instead and have it deal with the OS specific implementation, wdyt?

vezaynk commented 2 years ago

Hi @riccardoferretti

This repository has not seen any activity in over 3 years. There is an actively maintained fork here: https://github.com/telesoho/vscode-markdown-paste-image

With that said, I considered implementing the feature you are asking for and decided against it for the following reasons:

I recommend treating ctrl+v as simple paste and ctrl+alt+v as rich paste.

riccardoferretti commented 2 years ago

Thanks for the reply @knyzorg - you are bringing up good points