rxliuli / joplin-utils

Joplin-based community tool
https://joplin-utils.rxliuli.com/
MIT License
239 stars 38 forks source link

[Bug]: command "Upload Image from Clipboard" does nothing in VSCode on Linux Mint 21.2 #77

Closed thommi123 closed 11 months ago

thommi123 commented 1 year ago

Confirmation

The tool/kit where the error occurred

joplin-vscode-plugin

Describe the bug

Hi, thanks for the great joplin-vscode-plugin. I am using the plugin in VSCode 1.81.1 on Linux Mint 21.2 . Everything works great, but when I try to use the command "Upload Image from Clipboard" nothing happens (nothing is pasted in into the note). There is no error in the output.

Steps to reproduce the behavior

Open Joplin in VSCode. Create a new note , copy an image into the clipboard. Try to paste it into the note using the command "Upload Image from Clipboard".

What happens: nothing :-)

What should happen: a markdown text like ![1692471172877.png](:/e7bf37ae22b843108fcf64cfff0c15b8) should be placed into the note. And when the note is sent to Joplin (saved) then the image needs to be transferred to Joplin.

log file

Sorry, but I do not know how to execute the command "joplinnote.showlogfiledir"

Additional context

I had a look into the code of the extension and found that images are converted to a file using a shell script on Linux (~/.vscode/extensions/rxliuli.joplin-vscode-plugin-1.1.3/resources/clipboard/linux.sh) I am sorry, but I am not able to understand the whole typescript code and failed to debug it. I could not find the reason why the conversion fails. But I found a workaround by reducing the shellscript to:

xclip -selection clipboard -target image/png -o > $1 
echo $1 

After this change I can now successfully add images to the note using "Upload Image from Clipboard" and the images are successfully transferred to Joplin. Please let me know if you need further info.

And again, thank you very much for this great VSCode extension. It is brilliant.

rxliuli commented 1 year ago

Sorry, but I do not know how to execute the command "joplinnote.showlogfiledir"

  1. keymap ctrl+shift+p
  2. input "joplin log"
  3. enter open file manager
image image
thommi123 commented 1 year ago

Hi, thanks for the info about the log files. I had restored the old linux.sh script to your version and tried again. But there is no error in the Plugin- logs (see down below):

combined.log:

{"level":"info","message":"joplin config, baseUrl: http://localhost:41184, token: string","pluginVersion":"1.1.3"}
{"level":"info","message":"command execute: joplinNote.openNote","pluginVersion":"1.1.3"}
{"level":"info","message":"openNote start, id: 58006664e32348e1884c82e2d0ecaf7d, title: test2","pluginVersion":"1.1.3"}
{"level":"info","message":"openNote write tempFile: test2.md","pluginVersion":"1.1.3"}
{"level":"info","message":"openNote open tempFile","pluginVersion":"1.1.3"}
{"level":"info","message":"command execute: joplinNote.uploadImageFromClipboard","pluginVersion":"1.1.3"}
{"level":"info","message":"command execute: joplinNote.showLogFileDir","pluginVersion":"1.1.3"}

error.log is empty

rxliuli commented 11 months ago

It may be due to the lack of xclip or wl-clipboard. In the previous version, clearer error prompts were made, but I'm sorry for not replying.

ref: https://github.com/rxliuli/joplin-utils/releases/tag/joplin-vscode-plugin%401.3.1