telesoho / vscode-markdown-paste-image

Smartly paste for Markdown.
MIT License
135 stars 41 forks source link

Implement Support for copying files and file references #57

Open vezaynk opened 2 years ago

vezaynk commented 2 years ago

We first need to figure out how to get the file path on Windows and Linux.

I have the Windows one already:

> [System.Windows.Forms.Clipboard]::GetFileDropList()
C:\Users\slava\Pictures\0.jfif
telesoho commented 2 years ago

@knyzorg I have try following tests on Ubuntu 20.

  1. Select file & folder from vscode and 'Copy': image

List targets:

$ xclip -selection clipboard -target TARGETS -o
TIMESTAMP
TARGETS
SAVE_TARGETS
MULTIPLE
code/file-list

Get file list:

$ xclip -selection clipboard -target code/file-list -o
file:///home/telesoho/prjs/vscode-markdown-paste-image/test
file:///home/telesoho/prjs/vscode-markdown-paste-image/.gitignore
  1. Select file & folder from "File exploer", right click and select "Copy" menu. image

list target:

$ xclip -selection clipboard -target TARGETS -o
TIMESTAMP
TARGETS
MULTIPLE
x-special/gnome-copied-files
text/uri-list
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain

Get file list:

$ xclip -selection clipboard -o -target STRING
/home/telesoho/installodoo/odoo-staging
/home/telesoho/installodoo/README.md

Copy file from diffrent application will get diffrent clipboard content. It is a problem how to get the correct file list.

Sebastian-Jung commented 2 years ago

I'm just here to tell you that this would be a great feature! Especially being able to copy and paste multiple images from the file explorer (in my case - nautilus) and having the option to save (or copy in this case) these images to the configured output folder (In the same way as Images in the clipboard are created in a specific folder) would be a great addition!