feat(share): disable search if single note

This commit is contained in:
Elian Doran 2025-06-09 20:52:40 +03:00
parent 3b81d00de7
commit d68d0b5dd8
No known key found for this signature in database
2 changed files with 13 additions and 8 deletions

View File

@ -23,7 +23,10 @@ function buildResultItem(result: SearchResult) {
export default function setupSearch() {
const searchInput: HTMLInputElement = document.querySelector(".search-input")!;
const searchInput: HTMLInputElement | null = document.querySelector(".search-input");
if (!searchInput) {
return;
}
searchInput.addEventListener("keyup", debounce(async () => {
// console.log("CHANGE EVENT");

View File

@ -131,10 +131,12 @@ content = content.replaceAll(headingRe, (...match) => {
<svg class="light-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M6.993 12c0 2.761 2.246 5.007 5.007 5.007s5.007-2.246 5.007-5.007S14.761 6.993 12 6.993 6.993 9.239 6.993 12zM12 8.993c1.658 0 3.007 1.349 3.007 3.007S13.658 15.007 12 15.007 8.993 13.658 8.993 12 10.342 8.993 12 8.993zM10.998 19h2v3h-2zm0-17h2v3h-2zm-9 9h3v2h-3zm17 0h3v2h-3zM4.219 18.363l2.12-2.122 1.415 1.414-2.12 2.122zM16.24 6.344l2.122-2.122 1.414 1.414-2.122 2.122zM6.342 7.759 4.22 5.637l1.415-1.414 2.12 2.122zm13.434 10.605-1.414 1.414-2.122-2.122 1.414-1.414z"></path></svg>
</label>
</div>
<% if (hasTree) { %>
<div class="search-item">
<svg class="search-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z"></path></svg>
<input type="text" class="search-input" placeholder="Search...">
</div>
<% } %>
</div>
<% if (hasTree) { %>
<nav id="menu">