Ok, after furiously fighting with my lack of skills for quite a while I 
finally made it. I have absolutely no scripting skills an no programming 
knowledge,so I am sure this not at all the correct way to do it and there 
are probably lots of mistakes and inneficiencies, but please bear with me.

So after using the fantastic new 5.1.13 for a while I am *absolutely loving* 
the new WikiText toolbar it is fantastic! Two small things have been 
frustrating me, though: the lack of ability to easily add external links, 
or the lack of ability to easily add external images.
So after some fumbling around I came up with this suggestion that I would 
eventually like to see in a future release of TiddlyWiki allowing adding 
external links using the same exact toolbar button and with only a few 
modifications to the dropdown tiddler in parallel to internal tiddlers.

So basically I modified the default $:/core/ui/EditorToolbar/link-dropdown 
tiddler to include an additional button that basically lets you insert 
whatever search string you are using as a link URL. Normally this would be 
restricted to internal tiddler links from the list bellow, but this one 
allows pasting or introducing any URL in the text box to use as link URL.

So basically I add a define a new button as a macro and then call it later, 
so we end up with a link dropdown tiddler 
$:/core/ui/EditorToolbar/link-dropdown that looks like

\define lingo-base() $:/language/Buttons/Link/

\define link-actions()
<$action-sendmessage
    $message="tm-edit-text-operation"
    $param="make-link"
    text={{$(linkTiddler)$}}
/>

<$action-deletetiddler
    $tiddler=<<dropdown-state>>
/>

<$action-deletetiddler
    $tiddler=<<searchTiddler>>
/>

<$action-deletetiddler
    $tiddler=<<linkTiddler>>
/>
\end

\define external-link()
<$button class="tc-btn-invisible" style="width: auto; display: 
inline-block; background-colour: inherit;">
<$action-sendmessage $message="tm-edit-text-operation" $param="make-link" 
text={{$(searchTiddler)$}}
/>
{{$:/core/images/chevron-right}}
<$action-deletetiddler
    $tiddler=<<dropdown-state>>
/>

<$action-deletetiddler
    $tiddler=<<searchTiddler>>
/>

<$action-deletetiddler
    $tiddler=<<linkTiddler>>
/>
</$button>
\end


\define body(config-title)
''<<lingo Hint>>''

<$vars searchTiddler="""$config-title$/search""" linkTiddler=
"""$config-title$/link""" linktext="" >

<$edit-text tiddler=<<searchTiddler>> type="search" tag="input" focus="true" 
placeholder={{$:/language/Search/Search}} default=""/>
<$reveal tag="span" state=<<searchTiddler>> type="nomatch" text="">
<<external-link>>
<$button class="tc-btn-invisible" style="width: auto; display: 
inline-block; background-colour: inherit;">
<$action-setfield $tiddler=<<searchTiddler>> text="" />
{{$:/core/images/close-button}}
</$button>
</$reveal>

<$reveal tag="div" state=<<searchTiddler>> type="nomatch" text="">

<$linkcatcher actions=<<link-actions>> to=<<linkTiddler>>>

{{$:/core/ui/SearchResults}}

</$linkcatcher>

</$reveal>

</$vars>

\end

<$macrocall $name="body" config-title=<<qualify "$:/state/Link/">>/>


While editing it functionally becomes like this:


<https://lh3.googleusercontent.com/-XyzQW_XV8s4/V6D1V8p_DQI/AAAAAAAAQic/kJCy78BpYjYWoSVVQnWNP83LTEpT-rknwCLcB/s1600/TiddlyWiki_ExternalLink.gif>


<https://lh3.googleusercontent.com/-XyzQW_XV8s4/V6D1V8p_DQI/AAAAAAAAQic/kJCy78BpYjYWoSVVQnWNP83LTEpT-rknwCLcB/s1600/TiddlyWiki_ExternalLink.gif>

<https://lh3.googleusercontent.com/-XyzQW_XV8s4/V6D1V8p_DQI/AAAAAAAAQic/kJCy78BpYjYWoSVVQnWNP83LTEpT-rknwCLcB/s1600/TiddlyWiki_ExternalLink.gif>


So eventually I'd like to do something similar for external images too, 
possibly combined with the existing insert image button or even as a 
different one, but I fear my ineptitude may get in my way. I will try it 
again later tonight, but it may be above my copy-pasting skills

Anyway, what do you guys think, is this worth it, is it useful?
Jeremy would you consider including something like this in a future 
release? Perhaps as a different button, or combined with the current ones?

-- 
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/2016cae3-f9e9-4b40-a3c0-b25da14d49ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to