jump to search init

This commit is contained in:
Salihu
2026-08-28 23:05:14 +01:00
parent cd9c166927
commit 70c8c6cfda
8 changed files with 101 additions and 11 deletions
+13 -1
View File
@@ -30,6 +30,7 @@ export const buildPageUrl = (
pageSlugId: string,
pageTitle?: string,
anchorId?: string,
searchString?: string
): string => {
let url: string;
if (spaceName === undefined) {
@@ -37,6 +38,11 @@ export const buildPageUrl = (
} else {
url = `/s/${spaceName}/p/${buildPageSlug(pageSlugId, pageTitle)}`;
}
if (searchString) {
url += `?q=${encodeURIComponent(searchString)}`;
}
return anchorId ? `${url}#${anchorId}` : url;
};
@@ -45,13 +51,19 @@ export const buildSharedPageUrl = (opts: {
pageSlugId: string;
pageTitle?: string;
anchorId?: string;
searchString?: string
}): string => {
const { shareId, pageSlugId, pageTitle, anchorId } = opts;
const { shareId, pageSlugId, pageTitle, anchorId, searchString } = opts;
let url: string;
if (!shareId) {
url = `/share/p/${buildPageSlug(pageSlugId, pageTitle)}`;
} else {
url = `/share/${shareId}/p/${buildPageSlug(pageSlugId, pageTitle)}`;
}
if (searchString) {
url += `?q=${encodeURIComponent(searchString)}`;
}
return anchorId ? `${url}#${anchorId}` : url;
};