Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste image from clipboard directly #1115

Open
maple3142 opened this issue Jan 6, 2025 · 2 comments
Open

Paste image from clipboard directly #1115

maple3142 opened this issue Jan 6, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@maple3142
Copy link

maple3142 commented Jan 6, 2025

Motivation

vscode support pasting images into markdown using ctrl-c and ctrl-v.

The paste action can be explicitly invoked using Paste As command when your clipboard contains raw image data

image

But currently I can'd do the same to typ files. A simple workaround is to switch vscode to markdown mode when opening typ files.

Description

When clipboard contains raw image data, ctrl-v (or other paste hotkeys) should create image.png in workspace root, and insert #image("image.png"). (similar to markdown.link.image)

Example: https://files.catbox.moe/p5au03.mp4

Examples/Questions

A real examples using this feature would be right-click an image in browser and ctrl-v into vscode typ file.

However, to make this feature actually useful, typst also need to support renaming files referenced by typ using "rename symbol" action (e.g. on Windows it is F2 key). This is also shown in the video above.

I think it might be a bit complicated to implement because image file type detection is also needed.

I believe this feature in vscode markdown is added by https://code.visualstudio.com/updates/v1_79#_copy-external-media-files-into-workspace-on-drop-or-paste-for-markdown , and it have another example showing that it is also possible to drag and drop image into markdown directly, but I think this need to be another feature request so I am not requesting this in this issue.

@Myriad-Dreamin
Copy link
Owner

Myriad-Dreamin commented Jan 6, 2025

This an internal feature of the vscode so we cannot do it in typst as well. The related customization handler currently only available in vscode insider.

@Myriad-Dreamin Myriad-Dreamin added the enhancement New feature or request label Jan 14, 2025
@SylvanFranklin
Copy link
Contributor

This seems like a useful feature for the other editor integrations, but like @Myriad-Dreamin said it would come down to internal editor work. I will try to get this behavior working in vim but it might not be initially core to tinymist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants