mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-01 07:36:18 +00:00
8b60cab6a2
* Update tag-picker.tid * rework kb-driven-input macro to procedures + new syntax * rework change-input-tab to procedure * fix * remove console log :) * replace defines with procedures * fix link-dropdown * fix focus-selector in new-field dropdown * revert changing the footpring of change-input-tab + make it work as procedure * update change-input-tab procedure * refactor change-input-tab procedure and keep tags/Macro tag * simplify complicated filter * add tags/Global tag * remove tags/Global tag * rename variable
98 lines
6.1 KiB
Plaintext
98 lines
6.1 KiB
Plaintext
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">
|
|
|
|
<$vars editTiddler="$:/temp/search" searchTiddler="$:/temp/search/input" searchListState=<<qualify "$:/state/search-list/selected-item">>>
|
|
<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="">
|
|
<$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible">
|
|
<<advanced-search-actions>>
|
|
{{$:/core/images/advanced-search-button}}
|
|
</$button>
|
|
<$button class="tc-btn-invisible">
|
|
<<cancel-search-actions>><$action-sendmessage $message="tm-focus-selector" $param=".tc-search input"/>
|
|
{{$:/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>
|