Simple search box using the keyboard-driven-input Macro

60 views
Skip to first unread message

kebi

unread,
Mar 24, 2021, 8:41:28 AM3/24/21
to TiddlyWiki
Hello!

This is the page that explains the keyboard-driven-input macro with all the possible parameters.
I tried to create a simple search box with a search popup for the results, but I don't understand exactly which parameters I need and which temp search tiddlers to use.

Is there a post/tiddler which explains how the search temp variables are used?

Also, if anyone has some examples of simple search boxes made with a keyboard-driven-input macro, could you please send me the link/code?

Thank you in advance.

Btw, this is my actual code (keyboard navigation doesn't work):

SEARCH BOX TIDDLER

<$set name="searchTiddler" value="$:/temp/advancedsearch">
  <div class="tc-sidebar-search topbar-search">
    <$macrocall $name="keyboard-driven-input"
      tiddler=<<searchTiddler>>
      tag="input"
      type="search"
      focus={{$:/config/Search/AutoFocus}}
      focusPopup="$:/state/popup/search-dropdown"
      class="tc-popup-handle"
      placeholder=""
      default=""
    />
    <$button tooltip={{$:/language/Buttons/AdvancedSearch/Hint}} aria-label={{$:/language/Buttons/AdvancedSearch/Caption}} class="tc-btn-invisible tc-page-controls">
      <$action-navigate $to="$:/AdvancedSearch"/>
      {{$:/core/images/advanced-search-button}}
    </$button>

    <$reveal tag="div" class="tc-block-dropdown-wrapper" state="$:/state/popup/search-dropdown" type="nomatch" text="" default="">
      <$list filter="[<searchTiddler>get[text]minlength{$:/config/Search/MinLength}limit[1]]" emptyMessage="" variable="listItem">
        <div class="tc-block-dropdown tc-search-drop-down src-dropdown">
          {{$:/plugins/kebi/tiddlystudy/search/visualizer}}
        </div>
      </$list>
    </$reveal>
  </div>
</$set>

SEARCH RESULTS TIDDLER

\define search-text()
$(pattern)$(?i)
\end

<div class="tw-search-results">
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<$set name="pattern" value={{$:/temp/advancedsearch}}>
<$list filter="[regexp:title<search-text>limit[250]] -[has[parent]] -[is[system]] -[all[shadows]]">
{{!!title||$:/core/ui/ListItemTemplate}}
</$list>
</$set>
</$reveal>
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
<$set name="pattern" value={{$:/temp/advancedsearch}}>
<$list filter="[regexp:text<search-text>!sort[created]limit[250]] -[is[system]] -[all[shadows]] -[is[image]]">
<hr>
{{!!title||$:/core/ui/ListItemTemplate}}
<$context term=<<pattern>>/>
</$list>
</$set>
</$reveal>
</div>

Reply all
Reply to author
Forward
0 new messages