From a650af3ff6f42804c130b9141dd178125a3cc4ce Mon Sep 17 00:00:00 2001 From: Chris Amico <eyeseast@gmail.com> Date: Tue, 26 Nov 2024 21:28:00 -0500 Subject: [PATCH 1/6] Production URLs --- src/config/production.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/production.js b/src/config/production.js index a02b4c6fc..eb68020f2 100644 --- a/src/config/production.js +++ b/src/config/production.js @@ -1,6 +1,6 @@ export const DC_BASE = "https://api.www.documentcloud.org"; -export const APP_URL = "https://next.www.documentcloud.org/"; -export const EMBED_URL = "https://next.www.documentcloud.org/"; +export const APP_URL = "https://www.documentcloud.org/"; +export const EMBED_URL = "https://embed.documentcloud.org/"; export const SQUARELET_BASE = "https://accounts.muckrock.com"; export const STAFF_ONLY_S3_URL = "https://s3.console.aws.amazon.com/s3/buckets/s3.documentcloud.org?region=us-east-1&prefix=documents/$$ID$$/&showversions=false"; From c752435cf816724e8bc46536b1eeec5de6034a97 Mon Sep 17 00:00:00 2001 From: Chris Amico <eyeseast@gmail.com> Date: Tue, 3 Dec 2024 10:39:34 -0500 Subject: [PATCH 2/6] Wider tip of the day, allow p tags --- src/config/config.js | 2 +- src/lib/components/common/TipOfDay.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config/config.js b/src/config/config.js index 1917e7504..b0481fd53 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -61,7 +61,7 @@ export const CSRF_HEADER_NAME = "X-CSRFToken"; export const POLL_INTERVAL = 5000; -export const ALLOWED_TAGS = ["a", "strong", "em", "b", "i"]; +export const ALLOWED_TAGS = ["a", "strong", "em", "b", "i", "code", "p"]; export const ALLOWED_ATTR = ["href"]; /** diff --git a/src/lib/components/common/TipOfDay.svelte b/src/lib/components/common/TipOfDay.svelte index 9437524d1..db85e698b 100644 --- a/src/lib/components/common/TipOfDay.svelte +++ b/src/lib/components/common/TipOfDay.svelte @@ -63,7 +63,7 @@ .message { flex: 1 1 auto; line-height: 1.5; - max-width: 48rem; + max-width: 80rem; padding: 0 1.5rem; } .close { From f5c3d398174bbd7652bf78aeac979d7b091a7844 Mon Sep 17 00:00:00 2001 From: Chris Amico <eyeseast@gmail.com> Date: Tue, 3 Dec 2024 10:44:19 -0500 Subject: [PATCH 3/6] snaps --- .../addons/tests/__snapshots__/AddOnListItem.test.ts.snap | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/components/addons/tests/__snapshots__/AddOnListItem.test.ts.snap b/src/lib/components/addons/tests/__snapshots__/AddOnListItem.test.ts.snap index 2607bfb9c..8f02edca4 100644 --- a/src/lib/components/addons/tests/__snapshots__/AddOnListItem.test.ts.snap +++ b/src/lib/components/addons/tests/__snapshots__/AddOnListItem.test.ts.snap @@ -195,7 +195,9 @@ exports[`AddOnListItem 2`] = ` <div class="description svelte-1sp09hk" > - This Add-On uses Azure’s Document Intelligence API to OCR documents. The document(s) must be public to be processed. This Add-On uses 1 AI Credit per page. + <p> + This Add-On uses Azure’s Document Intelligence API to OCR documents. The document(s) must be public to be processed. This Add-On uses 1 AI Credit per page. + </p> </div> </div> </a> From 27266b797d73862f249f8bae2ca3cf866f758862 Mon Sep 17 00:00:00 2001 From: Allan Lasser <lasser.allan@gmail.com> Date: Tue, 3 Dec 2024 11:54:37 -0500 Subject: [PATCH 4/6] Hide search tip on mobile Fixes #914 --- .../components/layouts/DocumentBrowser.svelte | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/lib/components/layouts/DocumentBrowser.svelte b/src/lib/components/layouts/DocumentBrowser.svelte index a1d0102a0..eb43fc887 100644 --- a/src/lib/components/layouts/DocumentBrowser.svelte +++ b/src/lib/components/layouts/DocumentBrowser.svelte @@ -78,10 +78,11 @@ search: "common.search", }; - let width: number; + let headerToolbarWidth: number; + let footerToolbarWidth: number; $: BREAKPOINTS = { - HIDE_COUNT: width < remToPx(26), + HIDE_COUNT: footerToolbarWidth < remToPx(26), }; $: searchResults = documents.then((r) => excludeDeleted($deleted, r.data)); @@ -151,17 +152,16 @@ </Button> </div> {/if} - <PageToolbar> + <PageToolbar bind:width={headerToolbarWidth}> <Flex slot="right"> <div style:flex="1 1 auto"> - <Search name="q" {query} placeholder={$_(uiText.search)}> - <span slot="help"> - {@html $_("search.help")} - <a target="_blank" href="/help/search/"> - {$_("search.more")} - </a> - </span> - </Search> + <Search name="q" {query} placeholder={$_(uiText.search)} /> + <p class="help" class:hide={headerToolbarWidth < remToPx(38)}> + {@html $_("search.help")} + <a target="_blank" href="/help/search/"> + {$_("search.more")} + </a> + </p> </div> </Flex> </PageToolbar> @@ -203,7 +203,7 @@ {/await} <svelte:fragment slot="footer"> {#if !embed} - <div class="toolbar" bind:clientWidth={width}> + <div class="toolbar" bind:clientWidth={footerToolbarWidth}> <Flex align="center"> <SidebarItem> <label class="select-all"> @@ -309,4 +309,14 @@ min-width: 7rem; margin: 0.25rem 0; } + .help { + flex: 1 1 100%; + font-size: var(--font-xs); + margin: 0.25rem; + color: var(--gray-4); + text-align: left; + } + .hide { + display: none; + } </style> From 6c5d5a3ef234239f7169bd9a31483863f97114e3 Mon Sep 17 00:00:00 2001 From: Chris Amico <eyeseast@gmail.com> Date: Tue, 3 Dec 2024 13:04:30 -0500 Subject: [PATCH 5/6] Redirect old note permalinks to embeds --- .../documents/[id]/annotations/[note_id]/+page.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts diff --git a/src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts b/src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts new file mode 100644 index 000000000..3174414f1 --- /dev/null +++ b/src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts @@ -0,0 +1,13 @@ +import { redirect } from "@sveltejs/kit"; + +import { EMBED_URL } from "@/config/config.js"; + +// redirect to embed route +export function load({ url }) { + const u = new URL(url); + + u.searchParams.set("embed", "1"); + u.hostname = EMBED_URL; + + return redirect(302, u); +} From 5147167396ff220f94b3df82a4778a7e1cbc9aed Mon Sep 17 00:00:00 2001 From: Chris Amico <eyeseast@gmail.com> Date: Tue, 3 Dec 2024 13:11:34 -0500 Subject: [PATCH 6/6] Redirect page endpoints to embed --- .../(app)/documents/[id]/pages/[page]/+page.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/routes/(app)/documents/[id]/pages/[page]/+page.ts diff --git a/src/routes/(app)/documents/[id]/pages/[page]/+page.ts b/src/routes/(app)/documents/[id]/pages/[page]/+page.ts new file mode 100644 index 000000000..3174414f1 --- /dev/null +++ b/src/routes/(app)/documents/[id]/pages/[page]/+page.ts @@ -0,0 +1,13 @@ +import { redirect } from "@sveltejs/kit"; + +import { EMBED_URL } from "@/config/config.js"; + +// redirect to embed route +export function load({ url }) { + const u = new URL(url); + + u.searchParams.set("embed", "1"); + u.hostname = EMBED_URL; + + return redirect(302, u); +}