1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-06 10:06:19 +00:00
TiddlyWiki5/core/ui/SideBarSegments/search.tid
Simon Huber 0d2df34c58
Keyboard-driven dropdown inputs (#4725)
* Add shortcut descriptions to Misc.multids

* Update framed.js

* Update simple.js

* Add inputActions and refreshTitle to factory.js

* Add inputActions and refreshTitle to edit.js

* Update DefaultSearchResultList.tid

* Update search.tid

* Update ShortcutInfo.multids

* Update shortcuts.multids

* Create keyboard-driven-input.tid

* Update tag-picker.tid

* Create keyboard-driven-input_Macro.tid

* Update EditTextWidget.tid

* Update EditWidget.tid

* Update engine.js

* Update base.tid

* Use primaryListFilter, secondaryListFilter, primaryList and secondaryList

* Update tag-picker.tid

* Update search.tid

* Update DefaultSearchResultList.tid

* Update keyboard-driven-input_Macro.tid

* Fix typo udpate -> update

* Update framed.js
2020-07-13 17:42:55 +01:00

80 lines
3.4 KiB
Plaintext

title: $:/core/ui/SideBarSegments/search
tags: $:/tags/SideBarSegment
\whitespace trim
\define count-popup-button()
\whitespace trim
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$set name="searchTerm" value={{{ [<searchTiddler>get[text]] }}}>
<$set name="resultCount" value="""<$count filter="[!is[system]search<searchTerm>]"/>""">
{{$:/language/Search/Matches}}
</$set>
</$set>
</$list>
</$button>
\end
\define search-results-list()
\whitespace trim
<$list filter="[{$(searchTiddler)$}minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
{{$:/core/ui/SearchResults}}
</$list>
\end
\define delete-state-tiddlers() <$action-deletetiddler $filter="[[$:/temp/search]] [<searchTiddler>] [<searchListState>]"/>
\define cancel-search-actions() <$action-deletetiddler $filter="[<__storeTitle__>] [<__tiddler__>] [<__selectionStateTitle__>]"/>
\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>
\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
<div class="tc-sidebar-lists tc-sidebar-search">
<$vars searchTiddler="$:/temp/search/input" searchListState=<<qualify "$:/state/search-list/selected-item">> titleSearchFilter="[!is[system]search:title<userInput>sort[title]limit[250]]" allSearchFilter="[!is[system]search<userInput>sort[title]limit[250]]">
<div class="tc-search">
<$macrocall $name="keyboard-driven-input" tiddler="$:/temp/search" storeTitle=<<searchTiddler>>
selectionStateTitle=<<searchListState>> refreshTitle="$:/temp/search/refresh" type="search"
tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify "$:/state/popup/search-dropdown">>
class="tc-popup-handle" primaryListFilter=<<titleSearchFilter>> secondaryListFilter=<<allSearchFilter>>
filterMinLength={{$:/config/Search/MinLength}} inputCancelActions=<<cancel-search-actions>>
inputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> cancelPopups="yes" />
<$reveal state=<<searchTiddler>> type="nomatch" text="">
<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
<$action-setfield $tiddler="$:/temp/advancedsearch" text={{$:/temp/search}}/>
<<delete-state-tiddlers>>
<$action-navigate $to="$:/AdvancedSearch"/>
{{$:/core/images/advanced-search-button}}
</$button>
<$button class="tc-btn-invisible">
<<delete-state-tiddlers>>
{{$:/core/images/close-button}}
</$button>
<<count-popup-button>>
</$reveal>
<$reveal state=<<searchTiddler>> type="match" text="">
<$button to="$:/AdvancedSearch" tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
{{$:/core/images/advanced-search-button}}
</$button>
</$reveal>
</div>
<$reveal tag="div" class="tc-block-dropdown-wrapper" state=<<searchTiddler>> type="nomatch" text="">
<$reveal tag="div" class="tc-block-dropdown tc-search-drop-down tc-popup-handle" state=<<qualify "$:/state/popup/search-dropdown">> type="nomatch" text="" default="">
<<search-results-list>>
</$reveal>
</$reveal>
</$vars>
</div>