Getting the name of an html link dragged over to a TW

Hello,

I am working on handling an html link dragged over from some other website to TW.

There is no issue getting the URL in the href. Is the other descriptive text contained in the anchor available in a droppable/dropzone widget? I see the descriptive text behind the cursor while I am dragging the link but all that gets passed through TW is the URL in the actionTiddler variable.

Looking at the description of the draggable widget, I have tried the variable dom-textContent, dom-innerText and dom-innerHTML but those don’t seem to be set in the context of the droppable widget or not set by the browser for external links.

Any guidance would be helpful.

Thanks,
/Mike

1 Like

There’s a workaround:
1 Drag your links to somewhere onto your computer: desktop, folder, etc. It will become a shortcut with page title and link.
2 Then drag that shortcut or import it to a TiddlyWiki.
3 Drag that import link into a New Tiddler text area. You’ll get the descriptive text you’re looking for with a link to the imported tiddler.
4 Drag the original saved shortcut to the New Tiddler text area. You’ll now get the link URL.
OR
5 repeat step #3 and replace the [[]]s with {{}}s.

Buy me a superyacht.

1 Like

Unfortunately this is often dependant on the location of the link, the browser in use, and the destination.

Not only that the link so created may not behave the way you want it to for example;
[[New Tiddler|file:///T:/!Working/test-cm6-in-26.html#New Tiddler]] will always open in a new tab.

I created the above using a pretty permalink button I just remade. To support pretty links to permalinks. TiddlyWiki to TiddlyWiki.

Buttons_permalink2.json (1.9 KB)

Note: if you drag the above link to a tiddlywiki;

It will import an untitled tiddler containing;
https://talk.tiddlywiki.org/uploads/short-url/xLj5CseY9uYjV7Iby9lsvGPUXll.json Buttons_permalink2.json

Or if dropped in a text field, only the link
However I have made similar buttons to generate html a record links. Installed browser extensions that allow r-click copy as markdown link and more.

The address bar in a browser is a link that does not come with a pretty version.

Another complication is encoding, in some cases you need to use encodeURI and other times you do not, if you then need to decode to make it look readable it is yet another step.

You can craft bookmarklets to capture an address then use a process to generate or extract a pretty title from the address.

I am not saying there is not a solution but it need a broad knowledge of the circumstances and use cases.

[Edited] I now include a version to create a permalink to a tiddler in the markdown form for here in talk.tiddlywiki and markdown tiddlers. Posted here shortly I am getting some inconsistencies

eg; Widget Attributes