The typeahead requests /_search via htmx (debounced, newer requests replace in-flight ones) and gets rendered rows with the match highlighting done in Go. Rows are links, so picking in the header is plain navigation; the editor's link dialog reads data-name instead. The editor's [[ autocomplete keeps the JSON response. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 lines
777 B
HTML
9 lines
777 B
HTML
{{/* Search typeahead dropdown (/_search, htmx requests). Rows are links, so a
|
|
pick in the header is plain navigation; the editor's link dialog intercepts
|
|
the click and reads data-name. Empty output closes the dropdown. */}}
|
|
{{define "suggest"}}{{if .Show}}<table class="data-table"><tbody>
|
|
{{range .Results}}<tr class="suggest-row" data-name="{{.Name}}"><td><a class="suggest-link" href="{{.URL}}" tabindex="-1"><span class="suggest-name">{{.Highlighted}}</span><span class="suggest-path">/{{.Path}}</span></a></td></tr>
|
|
{{else}}<tr class="is-empty"><td>No matches</td></tr>
|
|
{{end}}{{if .AllURL}}<tr class="suggest-row suggest-footer"><td><a class="suggest-link" href="{{.AllURL}}" tabindex="-1">Show all {{.Total}} matches</a></td></tr>
|
|
{{end}}</tbody></table>{{end}}{{end}}
|