diff --git a/src/scripts/modules/search.ts b/src/scripts/modules/search.ts index f9c362da5..c3a3c4e7a 100644 --- a/src/scripts/modules/search.ts +++ b/src/scripts/modules/search.ts @@ -27,10 +27,10 @@ export default function setupSearch() { searchInput.addEventListener("keyup", debounce(async () => { // console.log("CHANGE EVENT"); - const current = document.body.dataset.noteId; + const ancestor = document.body.dataset.ancestorNoteId; const query = searchInput.value; if (query.length < 3) return; - const resp = await fetch(`api/search/${current}?query=${query}`); + const resp = await fetch(`api/notes?search=${query}&ancestorNoteId=${ancestor}`); const json = await resp.json() as SearchResults; const results = json.results.slice(0, 5); const lines = [`
`]; diff --git a/src/templates/page.ejs b/src/templates/page.ejs index afbded51a..f006bd86d 100644 --- a/src/templates/page.ejs +++ b/src/templates/page.ejs @@ -43,7 +43,7 @@ const customServerYml = `- url: "{protocol}://{domain}:{port}/etapi" dom_id: "#content", responseInterceptor: resp => { if (resp.url !== `<%= note.getLabelValue("shareSwagger") %>`) return resp; - resp.text = resp.text.replace("37740", "37840"); + resp.text = resp.text.replace("- url: http://localhost:37740/etapi", "- url: http://localhost:37840/etapi"); resp.text = resp.text.replace(`- url: http://localhost:8080/etapi`, customServerYml); return resp; } @@ -64,21 +64,21 @@ const customServerYml = `- url: "{protocol}://{domain}:{port}/etapi" <% } %> <%- header %> - <%= note.title %><% if (note.noteId !== subRoot.noteId) { %> - <%= subRoot.title %><% } %> + <%= note.title %><% if (note.noteId !== subRoot.note.noteId) { %> - <%= subRoot.note.title %><% } %> - + "> - + "> @@ -98,10 +98,10 @@ content = content.replaceAll(headingRe, (...match) => {
- <% if (subRoot.hasRelation("shareLogo")) { %> - /logo.svg" alt="Logo" /> + <% if (subRoot.note.hasRelation("shareLogo")) { %> + /logo.svg" alt="Logo" /> <% } %> - <%= subRoot.title %> + <%= subRoot.note.title %>
@@ -110,10 +110,10 @@ content = content.replaceAll(headingRe, (...match) => {