Neat. Hmmm. I guess if you know that you're always dragging/dropping from a
particular path then you could strip off one prefix and add another. That
allows you to create a relative path _canoncal_uri tiddler. Like this (for
just the macro part of your code) :
\define embedded-image-actions()
<$set name="tiddlercontent2" mode="inline" filter=
"[<actionTiddler>removeprefix[file:///C:/Users/Mark/Downloads/]]">
<$action-createtiddler $basetitle="New Image" _canonical_uri=<<
tiddlercontent2>> type="image/jpeg" $savetitle="Embed JPEG!!tiddlertitle"/>
<$action-navigate $to={{Embed JPEG!!tiddlertitle}}/>
</$set>
\end
This lets you drag and drop from a local directory (browsed in your
browser) into a local tw and instantly create a _canonical_uri tiddler. The
only thing that would be better is if you could drag from explorer or some
other file browser.
Thanks!
Mark
On Wednesday, May 23, 2018 at 1:40:27 PM UTC-7, [email protected] wrote:
>
> Hi,
>
> On Wednesday, May 16, 2018 at 1:32:08 AM UTC+2, Zachary Storer wrote:
>>
>>
>> I wish that there was a more intelligent [import] button that could link
>> to external images without the need
>> for manually inserting the _canonical_uri field.
>>
>
> With the following code, a JPEG image from a web location can be dragged
> into an area marked "Drop JPEG Image Here", and a tiddler containing the
> _canonical_uri of the image is automatically created:
>
> \define embedded-image-actions()
> <$wikify name="tiddlercontent2" mode="inline" text='<<actionTiddler>>'>
> <$action-createtiddler $basetitle="New Image"
> _canonical_uri=<<tiddlercontent2>> type="image/jpeg" $savetitle="Embed
> JPEG!!tiddlertitle"/>
> <$action-navigate $to={{Embed JPEG!!tiddlertitle}}/>
> </$wikify>
> \end
>
> <$droppable actions=<<embedded-image-actions>>>
> <div style="height:2em;">
> <div style="border:1px dotted;
> width:15em;padding:0.7em;border-radius:5px;text-align:center;">Drop JPEG
> Image Here</div></div>
> </$droppable>
>
> Downside: I believe that a separate tiddler/drop area needs to be created
> for other image types, e.g. PNG.
>
> Cheers,
>
> Stef
>
>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/3a6881c1-f65f-477c-92aa-e943ece9d8dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.