| | |
| | | |
| | | // If search is active, then we will render the first result and display accordingly |
| | | if (!container.classList.contains("active")) return |
| | | if (e.key === "Enter") { |
| | | if (e.key === "Enter" && !e.isComposing) { |
| | | // If result has focus, navigate to that one, otherwise pick first result |
| | | if (results.contains(document.activeElement)) { |
| | | const active = document.activeElement as HTMLInputElement |
| | |
| | | itemTile.classList.add("result-card") |
| | | itemTile.id = slug |
| | | itemTile.href = resolveUrl(slug).toString() |
| | | itemTile.innerHTML = `<h3>${title}</h3>${htmlTags}${ |
| | | enablePreview && window.innerWidth > 600 ? "" : `<p>${content}</p>` |
| | | }` |
| | | itemTile.innerHTML = ` |
| | | <h3 class="card-title">${title}</h3> |
| | | ${htmlTags} |
| | | <p class="card-description">${content}</p> |
| | | ` |
| | | itemTile.addEventListener("click", (event) => { |
| | | if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return |
| | | hideSearch() |