title: $:/core/macros/keyboard-driven-input tags: $:/tags/Macro \define change-input-tab(stateTitle,tag,beforeafter,defaultState,actions) \whitespace trim <$set name="tabsList" filter="[all[shadows+tiddlers]tag<__tag__>!has[draft.of]]"> <$let currentState={{{ [<__stateTitle__>!is[missing]get[text]] ~[<__defaultState__>] }}} firstTab={{{ [enlistnth[1]] }}} lastTab={{{ [enlistlast[]] }}} nextTab={{{ [all[shadows+tiddlers]tag<__tag__>!has[draft.of]$beforeafter$] ~[[$beforeafter$]removeprefix[after]suffix[]addprefix] ~[[$beforeafter$]removeprefix[before]suffix[]addprefix] }}}> <$action-setfield $tiddler=<<__stateTitle__>> text=<>/> $actions$ \end \define keyboard-input-actions() \whitespace trim <$list filter="[<__index__>match[]]"> <$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>get<__field__>] }}}/> <$list filter="[<__index__>!match[]]"> <$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>getindex<__index__>] }}}/> \end \define input-next-actions-inner() \whitespace trim <$list filter="[minlength[1]]" variable="ignore"> <$action-setfield $tiddler=<<__selectionStateTitle__>> text=<>/> <$list filter="[<__index__>match[]]"> <$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> <$list filter="[<__index__>!match[]]"> <$action-setfield $tiddler=<<__tiddler__>> $index=<<__index__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> <$action-setfield $tiddler=<<__refreshTitle__>> text="yes"/> \end \define input-next-actions(afterOrBefore:"after",reverse:"") \whitespace trim <$list filter="[<__storeTitle__>get[text]minlength<__filterMinLength__>] [<__filterMinLength__>match[0]] +[limit[1]]" variable="ignore"> <$let userInput={{{ [<__storeTitle__>get[text]] }}} selectedItem={{{ [<__selectionStateTitle__>get[text]] }}} configTiddler={{{ [subfilter<__configTiddlerFilter__>] }}} primaryListFilter={{{ [get<__firstSearchFilterField__>] }}} secondaryListFilter={{{ [get<__secondSearchFilterField__>] }}}> <$set name="filteredList" filter="[subfilteraddsuffix[-primaryList]] =[subfilteraddsuffix[-secondaryList]]"> <$let nextItem={{{ [enlist$afterOrBefore$] ~[enlist$reverse$nth[1]] }}} firstItem={{{ [enlistnth[1]] }}} lastItem={{{ [enlistlast[]] }}}> <$list filter="[match!match]" variable="ignore"> <$set name="nextItem" value={{{ [[$afterOrBefore$]match[before]thenaddsuffix[-userInput]] ~[] }}}> <> <$list filter="[match!match]" variable="ignore"> <$set name="nextItem" value={{{ [[$afterOrBefore$]match[after]thenaddsuffix[-userInput]] ~[] }}}> <> <$list filter="[matchmatch]" variable="ignore"> <$set name="nextItem" value={{{ [addsuffix[-userInput]] }}}> <> <$list filter="[!match!match]" variable="ignore"> <> \end \define keyboard-driven-input(tiddler,storeTitle,field:"text",index:"",tag:"input",type,focus:"",inputAcceptActions,inputAcceptVariantActions,inputCancelActions,placeholder:"",default:"",class,focusPopup,rows,minHeight,tabindex,size,autoHeight,filterMinLength:"0",refreshTitle,selectionStateTitle,cancelPopups:"",configTiddlerFilter,firstSearchFilterField:"first-search-filter",secondSearchFilterField:"second-search-filter") \whitespace trim <$keyboard key="((input-accept))" actions=<<__inputAcceptActions__>>> <$keyboard key="((input-accept-variant))" actions=<<__inputAcceptVariantActions__>>> <$keyboard key="((input-up))" actions=<>> <$keyboard key="((input-down))" actions=<>> <$keyboard key="((input-cancel))" actions=<<__inputCancelActions__>>> <$edit-text tiddler=<<__tiddler__>> field=<<__field__>> index=<<__index__>> inputActions=<> tag=<<__tag__>> class=<<__class__>> placeholder=<<__placeholder__>> default=<<__default__>> focusPopup=<<__focusPopup__>> focus=<<__focus__>> type=<<__type__>> rows=<<__rows__>> minHeight=<<__minHeight__>> tabindex=<<__tabindex__>> size=<<__size__>> autoHeight=<<__autoHeight__>> refreshTitle=<<__refreshTitle__>> cancelPopups=<<__cancelPopups__>>/> \end