Skip to content

Commit b116f27

Browse files
authored
don't strip iframe url if target is html (#3207)
1 parent fc3a67c commit b116f27

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

workers/tasks/export/export.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ export const exportTask = async ({ exportId }: { exportId: string }) => {
3535
notesData,
3636
});
3737
} else {
38-
const staticHtml = await renderStaticHtml({
38+
const staticHtmlOptions = {
3939
pubDoc,
4040
notesData,
4141
pubMetadata,
42-
});
42+
pagedTarget,
43+
};
44+
const staticHtml = await renderStaticHtml(staticHtmlOptions);
4345
if (pagedTarget) {
4446
url = (await exportWithPaged(staticHtml)).url;
4547
} else {

workers/tasks/export/html.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,11 @@ type RenderStaticHtmlOptions = {
273273
pubDoc: DocJson;
274274
pubMetadata: PubMetadata;
275275
notesData: NotesData;
276+
pagedTarget: boolean;
276277
};
277278

278279
export const renderStaticHtml = async (options: RenderStaticHtmlOptions) => {
279-
const { pubDoc, pubMetadata, notesData } = options;
280+
const { pubDoc, pubMetadata, notesData, pagedTarget } = options;
280281
const { title, nodeLabels, citationInlineStyle } = pubMetadata;
281282
const { footnotes, citations, noteManager, renderedStructuredValues } = notesData;
282283

@@ -287,9 +288,13 @@ export const renderStaticHtml = async (options: RenderStaticHtmlOptions) => {
287288
renderedStructuredValues,
288289
});
289290

290-
const renderableNodes = [filterNonExportableNodes, addHrefsToNotes, blankIframes]
291-
.filter((x): x is (nodes: any) => any => !!x)
292-
.reduce((nodes, fn) => fn(nodes), pubDoc.content);
291+
const renderableNodes = pagedTarget
292+
? [filterNonExportableNodes, addHrefsToNotes, blankIframes]
293+
.filter((x): x is (nodes: any) => any => !!x)
294+
.reduce((nodes, fn) => fn(nodes), pubDoc.content)
295+
: [filterNonExportableNodes, addHrefsToNotes]
296+
.filter((x): x is (nodes: any) => any => !!x)
297+
.reduce((nodes, fn) => fn(nodes), pubDoc.content);
293298

294299
const docContent = renderStatic({
295300
schema: editorSchema,

0 commit comments

Comments
 (0)