dendron icon indicating copy to clipboard operation
dendron copied to clipboard

Support WSL setup for paste image command

Open dionysuzx opened this issue 3 years ago • 6 comments

Please select if your request is either something new or an enhancement

  • [x] Enhancement of an existing Feature.
  • [ ] Request of a new feature.

Please select the area your request applies to. (Multiple selections are Possible. You can leave blank if you're not sure.)

  • [ ] Workspace - VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
  • [ ] Lookup - Dendron's Lookup Command
  • [ ] Views - Dendron Preview, Tree View, Side Panels in the UI
  • [ ] Schema - Dendron Schemas
  • [ ] Pod - Data import from / export to Dendron
  • [ ] Publish - External Site Publish
  • [ ] Markdown - Markdown features, such as syntax support and features

Is your feature request related to a problem? Please describe

So my current setup is running a dendron workspace inside of WSL. When trying to paste an image, it will look for xclip on ubuntu, so I installed that. Then, when I tried to paste the image, it said no image on clipboard. That is because the image is on my windows clipboard, not in the ubuntu instance.

Describe the solution you'd like

I want to be able to have an image on the windows clipboard, and then execute the Paste Image command, and see that the image gets stored in the assets folder inside the Dendron workspace (which would be on the ~/ ubuntu mount, not the windows /mnt/c/Users//...), and then create the link.

Essentially I want this to behave as expected in this setup.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Reach out to me if you need any additional context.

dionysuzx avatar Jan 30 '22 04:01 dionysuzx

thanks for the issue. marking it as a consideration for a future crop

kevinslin avatar Jan 30 '22 23:01 kevinslin

@icedwater Here's a temporary workaround (with a minor annoyance):

  1. Install Paste Image from local pc by sakamoto66 (I don't have Dendron Paste Image installed).
  2. Afterwards, and this is crucial, in pasteImage.path config settings, you have to include the entire path including wsl$ -- do not use the variable offered by the extension such as ${projectRoot}. As an example, this is the path for me: \\wsl$\Ubuntu\home\kndshein\<my_folder>\Dendron\vault\assets\images.
  3. (Optional) Turn off pastImage.showFilePath 🤷‍♂️

Now you can paste your image either through your command palette or w/ Ctrl + Alt + V. You will now notice the minor annoyance I mentioned earlier. The pasted link in markdown will have that entire path you added in Settings, but it won't work. So you have to delete anything before whatever your dirname is. IOW, mine would be assets/images/...

Good luck!

kndshein avatar May 04 '22 05:05 kndshein

Another extension that also solves paste image in wsl environment is this one: https://github.com/telesoho/vscode-markdown-paste-image . Wish it also could paste image from copied image file not only copied image data. Seem to be more actively supported than sakamoto66's extension.

jokaro avatar May 04 '22 07:05 jokaro

@icedwater Here's a temporary workaround (with a minor annoyance):

1. Install `Paste Image from local pc` by `sakamoto66` (I don't have Dendron Paste Image installed).

2. Afterwards, and this is crucial, in `pasteImage.path` config settings, you have to include the _entire_ path including `wsl$` -- _do not_ use the variable offered by the extension such as `${projectRoot}`. As an example, this is the path for me: `\\wsl$\Ubuntu\home\kndshein\<my_folder>\Dendron\vault\assets\images`.

3. (Optional) Turn off `pastImage.showFilePath` 🤷‍♂️

Now you can paste your image either through your command palette or w/ Ctrl + Alt + V. You will now notice the minor annoyance I mentioned earlier. The pasted link in markdown will have that entire path you added in Settings, but it won't work. So you have to delete anything before whatever your dirname is. IOW, mine would be assets/images/...

Good luck!

I do use WSL, but I don't recall why I was tagged here... did I volunteer to pick this up at some point?

icedwater avatar May 05 '22 02:05 icedwater

@icedwater Oh yikes, that's my bad. I meant to tag @dweisiger.

kndshein avatar May 05 '22 18:05 kndshein

Need to see this feature enabled

chinmayrozekar avatar Jul 21 '22 06:07 chinmayrozekar