Skip to content

Commit

Permalink
fixup! Use Pagefind's UI for the full search
Browse files Browse the repository at this point in the history
  • Loading branch information
dscho committed Sep 15, 2024
1 parent ed6f8b5 commit f6d2292
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions static/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,10 @@ var Search = {

const language = this.getQueryValue('language');

new PagefindUI({
const ui = new PagefindUI({
element: "#search-div",
showSubResults: true,
showImages: false,
language,
ranking: {
pageLength: 0.1, // boost longer pages
Expand All @@ -378,8 +379,8 @@ var Search = {

const searchTerm = this.getQueryValue('search');
if (searchTerm) {
// TODO: figure out how to use `trigger()` instead of `[0].dispatchEvent()`
$("#search-div input").val(searchTerm)[0].dispatchEvent(new Event("input"))
$("#search-div input").val(searchTerm)
ui.triggerSearch(searchTerm);
}
}
}
Expand Down

0 comments on commit f6d2292

Please sign in to comment.