Skip to content

Commit

Permalink
Merge branch 'main' into allanlasser/issue909
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Dec 3, 2024
2 parents d6e32ba + 77cf79d commit 62b0ecc
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"];

/**
Expand Down
4 changes: 2 additions & 2 deletions src/config/production.js
Original file line number Diff line number Diff line change
@@ -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";
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/common/TipOfDay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
.message {
flex: 1 1 auto;
line-height: 1.5;
max-width: 48rem;
max-width: 80rem;
padding: 0 1.5rem;
}
.close {
Expand Down
34 changes: 22 additions & 12 deletions src/lib/components/layouts/DocumentBrowser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>
13 changes: 13 additions & 0 deletions src/routes/(app)/documents/[id]/annotations/[note_id]/+page.ts
Original file line number Diff line number Diff line change
@@ -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);
}
13 changes: 13 additions & 0 deletions src/routes/(app)/documents/[id]/pages/[page]/+page.ts
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 62b0ecc

Please sign in to comment.