Skip to content

Commit

Permalink
Remove responsive option from embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Nov 26, 2024
1 parent ab2ea47 commit f7d2437
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 61 deletions.
6 changes: 3 additions & 3 deletions src/langs/json/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@
"respOff": "Off",
"respOffHelp": "The document will fit the sizes specified below",
"width": "Width",
"widthAuto": "Will fill the available space if the document is set to responsive, otherwise defaults to 700px",
"widthFixed": "Set a maximum width if the document is responsive, or set a fixed size if not responsive",
"widthAuto": "Will fill the available space",
"widthFixed": "Set a maximum width, in pixels",
"height": "Height",
"heightAuto": "The height is based on the size of the document, with no maximum size. If responsive, will be set to the height of the browser window minus 100px",
"heightAuto": "The height is based on the size of the document, with no maximum size",
"sidebarBehavior": "Sidebar behavior",
"sbResponsive": "Responsive",
"sbResponsiveHelp": "Show sidebar automatically on large screens and hide on mobile devices. In embed mode, the sidebar will be hidden",
Expand Down
32 changes: 0 additions & 32 deletions src/lib/components/documents/Share.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
let permalink: URL;
let embedSrc: URL;
let iframe: string;
// let wpShortcode: string; is broken in WordPress
let customizeEmbedOpen = false;
let editOpen = false;
Expand All @@ -82,14 +81,6 @@
embedSrc = embedUrl(document, embedUrlParams);
iframe = `<iframe src="${embedSrc.href}"`;
/*
wpShortcode = `[documentcloud url="${embedSrc.href}" ${Array.from(
embedUrlParams,
)
.slice(1)
.map(([key, value]) => `${key}="${value}"`)
.join(" ")}]`;
*/
if ($embedSettings.width) {
iframe += ` width="${$embedSettings.width}"`;
}
Expand All @@ -103,7 +94,6 @@
embedSrc = canonicalPageUrl(document, page);
embedSrc.searchParams.set("embed", "1");
iframe = `<iframe src="${embedSrc.href}" />`;
// wpShortcode = `[documentcloud url="${embedSrc}"]`;
break;
case "note":
const noteObject = document.notes?.find(
Expand All @@ -114,7 +104,6 @@
embedSrc = canonicalNoteUrl(document, noteObject);
embedSrc.searchParams.set("embed", "1");
iframe = `<iframe src="${embedSrc.href}" />`;
// wpShortcode = `[documentcloud url="${embedSrc}"]`;
}
break;
}
Expand Down Expand Up @@ -222,27 +211,6 @@
--font-size="var(--font-sm)"
/>
</Field>
<!-- wp shortcode is broken at the moment
<Field>
<FieldLabel>
WordPress Shortcode
<Button
slot="action"
size="small"
ghost mode="primary"
on:click={() => copy(wpShortcode)}
disabled={!navigator.clipboard}
>
<Copy16 /> Copy
</Button>
</FieldLabel>
<Text
value={wpShortcode}
--font-family="var(--font-mono)"
--font-size="var(--font-sm)"
/>
</Field>
-->

<Field>
<FieldLabel>
Expand Down
7 changes: 4 additions & 3 deletions src/lib/utils/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface EmbedSettingConfig {
}

export let settings = {
responsive: null,
// responsive: null,
width: null,
height: null,
sidebar: null,
Expand All @@ -42,7 +42,7 @@ export let settings = {
export type EmbedSettings = Record<keyof typeof settings, null | number>;

export const defaultSettings: EmbedSettings = {
responsive: 1,
// responsive: 1,
width: null,
height: null,
sidebar: null,
Expand Down Expand Up @@ -88,7 +88,7 @@ function truthy(
}

export const settingsConfig: Record<keyof EmbedSettings, EmbedSettingConfig> = {
responsive: {
/* responsive: {
storageIndex: 8, // out-of-order because added later
defaultValue: 1,
field: {
Expand All @@ -108,6 +108,7 @@ export const settingsConfig: Record<keyof EmbedSettings, EmbedSettingConfig> = {
],
},
},
*/
width: {
storageIndex: 1,
defaultValue: null,
Expand Down
20 changes: 0 additions & 20 deletions src/lib/utils/tests/__snapshots__/embed.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,6 @@ exports[`embed settings > settingsConfig 1`] = `
},
"storageIndex": 4,
},
"responsive": {
"defaultValue": 1,
"field": {
"label": "dialogDocumentEmbedDialog.responsive",
"options": [
{
"help": "dialogDocumentEmbedDialog.respOnHelp",
"label": "dialogDocumentEmbedDialog.respOn",
"value": 1,
},
{
"help": "dialogDocumentEmbedDialog.respOffHelp",
"label": "dialogDocumentEmbedDialog.respOff",
"value": 0,
},
],
"type": "toggle",
},
"storageIndex": 8,
},
"sidebar": {
"defaultValue": null,
"field": {
Expand Down
4 changes: 1 addition & 3 deletions src/lib/utils/tests/embed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ describe("embed settings", () => {
});

test("createEmbedSearchParams", () => {
expect(createEmbedSearchParams({ responsive: null }).toString()).toEqual(
"",
);
expect(createEmbedSearchParams({ title: null }).toString()).toEqual("");
});

test("getEmbedSettings", () => {
Expand Down

0 comments on commit f7d2437

Please sign in to comment.