Skip to content

Commit

Permalink
cheat-sheet: don't show nfc icons on empty search
Browse files Browse the repository at this point in the history
  • Loading branch information
rszyma committed May 30, 2023
1 parent 65f1697 commit 61a9c4d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cheat-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,19 @@ document.addEventListener('DOMContentLoaded', function () {
function searchGlyphs() {
let searchTerm = elementGlyphSearch.value;

let prefixSearchEnabled = true

if (searchTerm === "") {
// MiniSearch don't allow empty searches, so we search for "nf".
searchTerm = "nf";
prefixSearchEnabled = false;
}

// TODO: search suggestions

remainingSearchResults = miniSearch.search(searchTerm,
{
prefix: true,
prefix: prefixSearchEnabled,
combineWith: "AND",
boost: {id: 0.001},
boostDocument: ((documentId, term, storedFields) => {
Expand Down

0 comments on commit 61a9c4d

Please sign in to comment.