> Hey BTC,
>
> Keeboord is now partly in the core, and the rest has merged into the 
> Navigator plugin? Is this correct? I'm interested in trying to use this in 
> conjunction with Thomas's simple search popup bar.
>
> Thanks,
> Diego
>
>
Hi Diego, yes the Navigator plugin is the current successor. For the search 
bar Thomas has made you need only a subset of its features, but the easiest 
way is to get the whole thing

The plugin comes with a macro that makes an input field which is already 
prepared to be selectable like the tags-input and the sidebar search on 
burningtreec.github.io/TW5-navigator

The macro is called "selectable-dropdown-input" but it doesn't create a 
dropdown and it works with or without a dropdown

It's a big macro but not that difficult to integrate. Basically it just 
replaces an <$edit-text .../>

The input is created within the macro
The actions for going up/down through a list and clearing the input are 
defined within the macro
The actions for what to do when hitting enter are configurable outside

The macro accepts the following attributes

editTiddler
             the tiddler to edit
inputTag:"input"
            the tag for the edit-text widget, in your case "input" which is 
default
inputDefault
           a default text for the input, see the edit-text widget docs
inputPlaceHolder
          same, this is just the placeholder attribute for the edit-text 
widget
inputPopup
          the focusPopup attribute for the edit-text widget
inputClass
          the class attribute for the edit-text widget
inputFocus:"no"
          the focus attribute for the edit-text widget

These are attributes needed for the mechanism that refreshes the input with 
the selection made by up/down

saveTiddler
        a second tiddler where user input gets written to. necessary for 
the mechanism to work
                 quick explanation: when we write in the input field the 
editTiddler and the saveTiddler are written with the user input
                                                      when we select 
entries from the dropdown the editTiddler gets written with the selection 
which causes the refresh mechanism to update the text in the input with the 
selection
                                                      but the dropdown list 
is always sorted by the saveTiddler content which doesn't change when we 
make selections, it only changes when we change the text in the input field 
by typing
refreshTiddler
       this tiddler must change in order to trigger a refresh
       provide a temp tiddler name - this tiddler stores the selected entry
refreshCondition
       the value of this must be "true" so that the mechanism refreshes the 
input
       just use 
refreshCondition="""[<__refreshTiddler__>get[refresh-qualifier]removeprefix<__refreshQualifier__>suffix[]addprefix[true]]
 
~[[false]]"""
       the macro handles that internally to determine the input that 
corresponds to the refreshTiddler
refreshQualifier
       provide a qualifier using the qualify macro: 
refreshQualifier=<<qualify $:/temp/coolsearch>>
refreshAction
       this can be one of a set of strings that tells the edit-text widget 
how to refresh
       just provide refreshAction="focus-update"
       this updates the input text to show the selection and keeps focus 
within the input

filterTiddler
       this is the most important tiddler in order for the macro to work
       provide a tiddler name, you'll use that tiddler to tell the macro 
which filters are used and what actions to perform when you hit enter or 
escape
       you can also provide actions and keys for up to two additional 
keyboard widgets if you want to add a shortcut that does a custom action 
like "open all found tiddlers" or "create a tiddler with that title" or 
whatever
filterMinLength:"0"
       provide a number, in the search-input I use the default 
filterMinLength={{$:/config/Search/MinLength}}

you don't need these, but if you want the input to cancel other popups when 
you click within it or when it gets focus, set cancelPopups="yes"
tabIndex:""
cancelPopups:""


Configuring the filterTiddler:

It needs a field "dropdown-filter-1" with the filter used for the first 
list of the search results
If there's a second list it also needs "dropdown-filter-2" with the filter 
used for the second list
Thomas uses this filter for the first list: 
[!is[system]search:caption,title{$(searchTiddler)$}sort[caption]limit[250]]
and this for the second: 
[!is[system]search:{{$:/plugins/telmiger/simple-search/filter-other}}{$(searchTiddler)$}sort[title]limit[250]]
 
(he's wikifying this, we'll use a simpler thing)
you need to adjust these filters a bit, but results will be the same
         use <userInput> instead of {$(searchTiddler)$} ... userInput is a 
variable within the macro, it's nothing else than what's stored within the 
saveTiddler. the filters are used within the macro, where the variable is 
defined
         dropdown-filter-1: 
[!is[system]search:caption,title<userInput>sort[caption]limit[250]]
         dropdown-filter-2: 
[!is[system]search<userInput>sort[title]limit[250]] 
-[!is[system]search:caption,title<userInput>sort[caption]limit[250]]
         the new "subfilter" filter operator available since 5.1.18 offers 
more elegant ways to handle such filters which would make this easier
It needs a field "clear-input-empty-actions", just put this inside: 
<$action-deletetiddler $tiddler=<<__editTiddler__>>/><$action-deletetiddler 
$tiddler=<<__saveTiddler__>>/><$action-deletetiddler 
$tiddler=<<__refreshTiddler__>>/>
It needs a field "accept-actions", I use this: <$list 
filter="[<selectedDropDownItem>!is[shadow]!is[missing]] 
[<selectedDropDownItem>is[shadow]]" emptyMessage="""<$action-sendmessage 
$message="tm-edit-tiddler" 
$param=<<selectedDropDownItem>>/>"""><$action-navigate 
$to=<<selectedDropDownItem>>/></$list>
         the selectedDropDownItem is the selected entry in the list (or 
your input) - the variable is defined in the macro
         this opens the entry if it's an existing tiddler and navigates to 
it in the river
         if it's not an existing tiddler it creates it, opens it for 
editing and navigates to it in the river

Adding your own shortcuts

you can add 2 additional shortcuts for your own custom actions
use these fields in your filterTiddler for that:

keyboard-action-1-key
keyboard-action-1
keyboard-action-2-key
keyboard-action-2

keyboard-action-1-key: alt-shift-1 (or a shortcut reference like 
((my-shortcut))  where you just need to create 
$:/config/ShortcutInfo/my-shortcut and configure it in the Control Panel)
keyboard-action-1: <$action-setfield $tiddler="bla" 
text=<<selectedDropDownItem>>/><$action-do-something 
with=<<selectedDropDownItem>>/>

same for the second


Ok, now I'll try if I can make this work using my instructions and Thomas' 
plugin

BTC

-- 
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/0360ce01-81a9-4678-9220-529e1a030cdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to