On Wednesday, May 20, 2020 at 12:16:38 PM UTC-3, Gordan Nia wrote:
>
> Hello,
>
> does it possible to get _canonical_uri value of external photo in a
> tiddler by drag&drop (or import as a tiddler with _canonical_uri)? I
> don't want import photo as a new tiddler, but only reference to the photo (
> _canonical_uri).
> How to make it, any idea?
>
>
Hi Gordan,
I don't know of a generic built-in way but you can create a macro to have
an area (the tag image in this case) defined as a droppable zone that
generates a tiddler (transparently in the background ... look in Resent
tab) for you when you drag a URL over and drop it on the area. The
mime-type text/html seemed the most generic to handle most URLs that you'd
drag over but it puts a big frame around the embedded stuff. If you can
change that to something more specific to allow TiddlyWiki to treat the
external resource in a more integrated manner.
Just cut and past the following into your own wiki and adapt as needed.
\define droppable-canonical()
<$fieldmangler tiddler=<<actionTiddler>>>
<$action-setfield $tiddler=<<actionTiddler>> $field="_canonical_uri" $value
=<<actionTiddler>>/>
<$action-setfield $tiddler=<<actionTiddler>> $field="type" $value="text/html"/>
</$fieldmangler>
\end
''Usage:'' This a small macro to add a droppable area in a tiddler to
import externally dragged URLs into TiddlyWiki as a canonical-url
externally stored resource.
Droppable Image (drag a URL ontop of the image):
<$droppable actions=<<droppable-canonical>>>
{{$:/core/images/new-here-button}}
</$droppable>
Enjoy,
/Mike
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/4f859bc0-35d3-411e-a199-568d36928cd6%40googlegroups.com.