diff --git a/src/langs/json/en.json b/src/langs/json/en.json index bccad5605..484fbec88 100644 --- a/src/langs/json/en.json +++ b/src/langs/json/en.json @@ -324,7 +324,8 @@ "grid": "Pages", "notes": "Notes", "annotating": "Annotate", - "redacting": "Redact" + "redacting": "Redact", + "search": "Search" }, "zoom": { "zoom": "Zoom", diff --git a/src/lib/components/viewer/ReadingToolbar.svelte b/src/lib/components/viewer/ReadingToolbar.svelte index 5e429f15e..6481e5453 100644 --- a/src/lib/components/viewer/ReadingToolbar.svelte +++ b/src/lib/components/viewer/ReadingToolbar.svelte @@ -59,6 +59,7 @@ Assumes it's a child of a ViewerContext ["text", $_("mode.text")], ["grid", $_("mode.grid")], ["notes", $_("mode.notes")], + ["search", $_("mode.search")], ]); const writeModes: Map = new Map([ diff --git a/src/lib/components/viewer/ViewerContext.svelte b/src/lib/components/viewer/ViewerContext.svelte index 83b5136e2..bf4ae6c84 100644 --- a/src/lib/components/viewer/ViewerContext.svelte +++ b/src/lib/components/viewer/ViewerContext.svelte @@ -189,7 +189,7 @@ layouts, stories, and tests. } $currentMode = mode; $currentNote = $currentDoc.notes?.find(noteMatchingPageHash) ?? null; - if (shouldPaginate(mode) && $currentPage !== hashPage) { + if (shouldPaginate(mode) && (hashPage || 0) > 1) { scrollToHash(hash); } }); diff --git a/src/routes/(app)/documents/[id]-[slug]/annotations/[note_id]/+page.ts b/src/routes/(app)/documents/[id]-[slug]/annotations/[note_id]/+page.ts new file mode 100644 index 000000000..dbbf72015 --- /dev/null +++ b/src/routes/(app)/documents/[id]-[slug]/annotations/[note_id]/+page.ts @@ -0,0 +1,16 @@ +// this route was sometimes generated by old embeds and should redirect + +import { redirect } from "@sveltejs/kit"; +import { EMBED_URL } from "@/config/config.js"; + +export function load({ params }) { + const { id, note_id } = params; + + // the embed route can handle errors + const url = new URL( + `/documents/${id}/annotations/${note_id}/?embed=1`, + EMBED_URL, + ); + + return redirect(302, url); +} diff --git a/src/routes/(app)/documents/[id]-[slug]/pages/[page]/+page.ts b/src/routes/(app)/documents/[id]-[slug]/pages/[page]/+page.ts new file mode 100644 index 000000000..0c176df64 --- /dev/null +++ b/src/routes/(app)/documents/[id]-[slug]/pages/[page]/+page.ts @@ -0,0 +1,13 @@ +// this route was sometimes generated by old embeds and should redirect + +import { redirect } from "@sveltejs/kit"; +import { EMBED_URL } from "@/config/config.js"; + +export function load({ params }) { + const { id, page } = params; + + // if this is a 404, the embed route will handle it + const url = new URL(`/documents/${id}/pages/${page}/?embed=1`, EMBED_URL); + + return redirect(302, url); +} diff --git a/src/routes/embed/documents/[id]/pages/[page]/+page.svelte b/src/routes/embed/documents/[id]/pages/[page]/+page.svelte index 314e90710..cb38a9ca5 100644 --- a/src/routes/embed/documents/[id]/pages/[page]/+page.svelte +++ b/src/routes/embed/documents/[id]/pages/[page]/+page.svelte @@ -100,13 +100,13 @@
{$_("embedPage.pageOf", informSize(elem)} + on:load={() => informSize(elem)} /> @@ -138,7 +138,7 @@ note={active} {slugId} {page} - on:close={(e) => (active = null)} + on:close={() => (active = null)} /> {/if} @@ -169,7 +169,7 @@ or