mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 20:49:01 +01:00
fix(export/share): search not working on root
This commit is contained in:
parent
4cc9ba824d
commit
a0b19ce526
@ -63,7 +63,7 @@ export default function setupSearch() {
|
|||||||
async function fetchResults(query: string): Promise<SearchResults> {
|
async function fetchResults(query: string): Promise<SearchResults> {
|
||||||
if ((window as any).glob.isStatic) {
|
if ((window as any).glob.isStatic) {
|
||||||
const linkHref = document.head.querySelector("link[rel=stylesheet]")?.getAttribute("href");
|
const linkHref = document.head.querySelector("link[rel=stylesheet]")?.getAttribute("href");
|
||||||
const rootUrl = linkHref?.split("/").slice(0, -2).join("/");
|
const rootUrl = linkHref?.split("/").slice(0, -2).join("/") || ".";
|
||||||
const searchIndex = await (await fetch(`${rootUrl}/search-index.json`)).json();
|
const searchIndex = await (await fetch(`${rootUrl}/search-index.json`)).json();
|
||||||
const Fuse = (await import("fuse.js")).default;
|
const Fuse = (await import("fuse.js")).default;
|
||||||
const fuse = new Fuse(searchIndex, {
|
const fuse = new Fuse(searchIndex, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user