1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-01 15:46:18 +00:00
TiddlyWiki5/core/ui/SideBarSegments/search.tid

98 lines
6.1 KiB
Plaintext
Raw Normal View History

2018-08-02 12:22:21 +00:00
title: $:/core/ui/SideBarSegments/search
tags: $:/tags/SideBarSegment
\whitespace trim
\procedure count-popup-button()
\whitespace trim
<$button popup=<<qualify "$:/state/popup/search-dropdown">> class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<$list filter="[<searchTiddler>get[text]minlength{$:/config/Search/MinLength}limit[1]]" variable="listItem">
<$vars userInput={{{ [<searchTiddler>get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}] }}} replaceRegexp="limit\[\d+\]">
<$vars primaryListFilter={{{ [<configTiddler>get[first-search-filter]search-replace:g:regexp<replaceRegexp>,[]] }}} secondaryListFilter={{{ [<configTiddler>get[second-search-filter]search-replace:g:regexp<replaceRegexp>,[]] }}}>
<$set name="resultCount" value="""<$count filter="[subfilter<primaryListFilter>] [subfilter<secondaryListFilter>]"/>""">
{{$:/language/Search/Matches}}
</$set>
</$vars>
</$vars>
</$list>
</$button>
\end
\procedure search-results-list()
\whitespace trim
<$vars userInput={{{ [<searchTiddler>get[text]] }}} configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}] }}}>
<$list filter="[<userInput>minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="""<div class="tc-search-results">{{$:/language/Search/Search/TooShort}}</div>""" variable="listItem">
<$tiddler tiddler=<<configTiddler>>>
{{$:/core/ui/SearchResults}}
</$tiddler>
</$list>
</$vars>
\end
\procedure cancel-search-actions() <$list filter="[<searchTiddler>get[text]!match{$:/temp/search}]" emptyMessage="""<$action-deletetiddler $filter="[[$:/temp/search]] [<searchTiddler>] [<searchListState>]"/>"""><$action-setfield $tiddler="$:/temp/search" text={{{ [<searchTiddler>get[text]] }}}/><$action-setfield $tiddler="$:/temp/search/refresh" text="yes"/></$list>
\procedure input-accept-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<tiddler>get[text]!is[missing]] :else[<tiddler>get[text]is[shadow]]"><$action-navigate $to={{{ [<tiddler>get[text]] }}}/></$list>"""><$action-navigate $to={{{ [<tiddler>get[text]] }}}/></$list>
\procedure input-accept-variant-actions() <$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]" emptyMessage="""<$list filter="[<tiddler>get[text]!is[missing]] :else[<tiddler>get[text]is[shadow]]"><$list filter="[<tiddler>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<tiddler>get[text]] }}}/></$list></$list>"""><$list filter="[<tiddler>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<tiddler>get[text]] }}}/></$list></$list>
\procedure set-next-input-tab() <$transclude $variable="change-input-tab" stateTitle="$:/state/tab/search-results/sidebar" tag="$:/tags/SearchResults" beforeafter="after" defaultState={{$:/config/SearchResults/Default}} actions="""<$action-setfield $tiddler="$:/state/search/currentTab" text=<<nextTab>>/>"""/>
\procedure set-previous-input-tab() <$transclude $variable="change-input-tab" stateTitle="$:/state/tab/search-results/sidebar" tag="$:/tags/SearchResults" beforeafter="before" defaultState={{$:/config/SearchResults/Default}} actions="""<$action-setfield $tiddler="$:/state/search/currentTab" text=<<nextTab>>/>"""/>
\procedure advanced-search-actions() <$action-setfield $tiddler="$:/temp/advancedsearch" text={{$:/temp/search/input}}/><$action-setfield $tiddler="$:/temp/advancedsearch/input" text={{$:/temp/search/input}}/><<delete-state-tiddlers>><$action-navigate $to="$:/AdvancedSearch"/><$action-setfield $tiddler="$:/temp/advancedsearch/refresh" text="yes"/><$action-sendmessage $message="tm-focus-selector" $param="""[data-tiddler-title="$:/AdvancedSearch"] .tc-search input""" preventScroll="true"/><$action-deletetiddler $filter="$:/temp/search $:/temp/search/input $:/temp/search/refresh [<searchListState>]"/>
<div class="tc-sidebar-lists tc-sidebar-search">
2018-08-02 12:22:21 +00:00
<$vars editTiddler="$:/temp/search" searchTiddler="$:/temp/search/input" searchListState=<<qualify "$:/state/search-list/selected-item">>>
2018-08-02 12:22:21 +00:00
<div class="tc-search">
<$keyboard key="((input-tab-right))" actions=<<set-next-input-tab>>>
<$keyboard key="((input-tab-left))" actions=<<set-previous-input-tab>>>
<$keyboard key="((advanced-search-sidebar))" actions=<<advanced-search-actions>>>
<form class="tc-form-inline">
<$transclude $variable="keyboard-driven-input" tiddler=<<editTiddler>> storeTitle=<<searchTiddler>>
selectionStateTitle=<<searchListState>> refreshTitle="$:/temp/search/refresh" type="search"
tag="input" focus={{$:/config/Search/AutoFocus}} focusPopup=<<qualify "$:/state/popup/search-dropdown">>
class="tc-tiny-gap-right tc-popup-handle" filterMinLength={{$:/config/Search/MinLength}} inputCancelActions=<<cancel-search-actions>>
inputAcceptActions=<<input-accept-actions>> inputAcceptVariantActions=<<input-accept-variant-actions>> cancelPopups="yes"
configTiddlerFilter="[[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}]"/>
</form>
</$keyboard>
</$keyboard>
</$keyboard>
<$reveal state=<<searchTiddler>> type="nomatch" text="">
2018-08-02 12:22:21 +00:00
<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
<<advanced-search-actions>>
2018-08-02 12:22:21 +00:00
{{$:/core/images/advanced-search-button}}
</$button>
<$button class="tc-btn-invisible">
<<cancel-search-actions>><$action-sendmessage $message="tm-focus-selector" $param=".tc-search input"/>
2018-08-02 12:22:21 +00:00
{{$:/core/images/close-button}}
</$button>
<<count-popup-button>>
2018-08-02 12:22:21 +00:00
</$reveal>
<$reveal state=<<searchTiddler>> type="match" text="">
2018-08-02 12:22:21 +00:00
<$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="">
2018-08-02 12:22:21 +00:00
<$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>>
2018-08-02 12:22:21 +00:00
</$reveal>
</$reveal>
</$vars>
2018-08-02 12:22:21 +00:00
</div>