Capture 'enter' keypress in a text box?

Techie question…

I am actively working on a site that does word searches on the TW5 open issues requests submitted to the TiddlyWiki Github issues database. The database is collected using the GitHub API.

Can view the site at https://tw5.poc2go.com. The site uses an express.js backend with TiddlyWiki as a front end.

Have been able to implement most of the intereface, but wish to be able to call a TiddlyWiki macro when the user presses ‘enter’ key on a text box. Right now, the user must enter the text in a text box, then press the ‘search’ button. How do I capture the ‘enter’ keypress on a text box and have it call a TW macro?

TIA

2 Likes

Surround the $edit-text widget with a $keyboard widget, like this:

<$keyboard key="enter" actions=<<someMacro>>>
   <$edit-text ... />
</$keyboard>

-e

2 Likes

Thanks Eric for the quick reply.

Figured was simple - didn’t know about $keyboard - opens a world of new possibilities. Thx!

1 Like

Lovely! Worth to be added as showcase!

Interesting. But if I search for eg: author:pmario I do get wrong results

I haven’t implemented searching by submitter yet - gave it an attempt - epic fail - so had to back it out and re-thinking it.

Site is in infancy at this point; and hoping to make into a TiddlyWiki knowledge base where user can drill down/refine the searches. Lot of valuable resources on GitHub if only could find it.

To do so would have to include the issue ‘comments’ in the search which I am not collecting from GitHub as of yet. But getting there - stay tuned!

But the foundation is there and still have a lot of work to reach my goals for the site. Thx for the input!

Well, wouldn’t go that far yet. Is a work-in-progress. Thx for the thumbs-up :slight_smile:

@pmario Just added ticket ‘users’ and ‘detail’ to the site. Again, is beta but would like any feedback - thx!

Could I use the keyboard widget to close a dialog? If not, what options do I have? I have a dialog with a multi-line select and close button (which closes the dialog). I want the user to have the ability (while the select control has focus) to close the dialog with an “Enter” key.

This example is an extract from a macro I have (not exactly what I have, but a simplified version):

<input type="checkbox" class="toggle" id="$id$$dialogid$">
<label class="cusbutton" for="$id$$dialogid$">Select $label$</label>
<dialog><center>
<$select class="select-option" multiple size='12' field='$field$'><$list filter='[tag[$tagger$] [all[current]each:list-item[$field$]] -[has[draft.of]] +[sort[title]]'><option><$view field='title'/></option>
</$list></$select>
<br/><br/>
<center><label class="cusbutton" for="$id$$dialogid$">Close</label></center></dialog>

The user clicks a “Select” label to open the dialog and the “Close” label to close it.