1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Update Customising search results.tid (#5225)

This commit is contained in:
Simon Huber 2020-12-07 11:22:02 +01:00 committed by GitHub
parent c3e34b469c
commit 5df0225356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,3 +29,21 @@ Here is an example of an alternative visualisation that displays results in reve
<<searchResults>>
```
<<.from-version 5.1.23>> The sidebar search introduces a more sophisticated search-mechanism which makes it possible to navigate the search results using the keyboard shortcuts <kbd><<displayshortcuts ((input-down))>></kbd> and <kbd><<displayshortcuts ((input-up))>></kbd>. To add that mechanism to your own custom search results follow these simple steps:
# Your tiddler tagged <<tag-pill "$:/tags/SearchResults">>is accessible through the <<.var configTiddler>> variable
# The user-input in the search field is accessible through the <<.var userInput>> variable
# Use the fields <<.field first-search-filter>> and <<.field second-search-filter>> to store the filters used for your search results. See the tiddler $:/core/ui/DefaultSearchResultList for details
# Use the following form so that navigated search-results are highlighted, modify it to match your needs:
```
<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter={{{ [<configTiddler>get[first-search-filter]] }}}>
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
</span>
</$list>
</$list>
```
<$macrocall $name=".tip" _="Note that the <<.var searchTiddler>> variable still contains the name of the tiddler that is used for sorting the search results. The <<.var editTiddler>> variable contains the name of the tiddler that is being edited."/>