How to paste an image link as an image tiddler using Ctrl+V?

Hi, guys! I know tiddlywiki has a DragAndDropMechanism, it means when we copy something into the clipboard, and then press ctrl+v onto the tiddlywiki, the content of the clipboard will be imported to the $:/import tiddler.

In this context, I want to implement such a workflow:

  • Firstly I copy an image link into my clipboard.
  • When I press ctrl+v onto the tiddlywiki, the pasted text will be checked to see if it is an image link.
  • There will be a kind of transform button if it is.
  • After press the button, the link will be transformed into an external image tiddler which has a _canonical_uri field and its value will be the link of this image.
  • In addition, I can also perform actions such as setting title of this external image tiddler.

I’ve read the related wikis in tiddlywiki, to be honest, I’m kind of lost in it.
Firstly, how can I get the pasted text ? I don’t find related system or shadow tiddlers about actions which will be performed when we press ctrl+v.

Ctrl-V will paste into an edit(or) at the position of the cursor and if none-available will trigger the import dialogue.

Knowing this you will need to determine if what is being pasted is a link to an image, then build an alternate mechanism.

  • As a result it may make more sense to look at others ways of importing images and externalising them and this depends on your wiki, server or platform.

The simplest approach may be to enhance the import dialogue to allow a checkbox to indicate import as canonical url?

Hi @uzvg the challenge is that browsers do not provide a link to the image when pasting. The only thing that is available is the image data itself.

TiddlyDesktop with the “External Attachments” plugin gets around this problem by using a custom embedded browser that does provide a link.

Firstly, there is a difference between pasting an image and pasting an image link into TW. In Windows, you can right click on an image and choose “copy image” or “copy image link”.

If you mean the former, then it’s as per Jeremy’s response. Most requests wanted to copy and save an image into local storage, and insert the local image link into TW.

If you mean the latter, then a local image link such as “C:\Downloads\Screenshot 2024-03-06.png”, or a web image link such as “https://talk.tiddlywiki.org/tiddlycat.svg”, is imported into TW. I’m working on bulk import of file links at the moment, so I can go half way to offer a tiddler put togther from pieces I already have. This tiddler ( CreateImgTiddlersFromLinks.json (2.9 KB), drag this json into your TW to import it) uses it’s own dropzone to create canonical image tiddlers from dropped file links. Will leave it to you to figure out how to integrate it into TW Import mechanism if that’s what you need.