A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: Update HTML download functionality and fonts (#415)
Myles Scolnick1a9c5347b4bd
diff --git a/frontend/src/core/static/__tests__/__snapshots__/download-html.test.ts.snap b/frontend/src/core/static/__tests__/__snapshots__/download-html.test.ts.snapindex 4f19a4d87b..f2973f2820 100644--- a/frontend/src/core/static/__tests__/__snapshots__/download-html.test.ts.snap+++ b/frontend/src/core/static/__tests__/__snapshots__/download-html.test.ts.snap@@ -1,7 +1,8 @@// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.htmlexports[`download-html > should construct html correctly 1`] = `-"<html>+"<!DOCTYPE html>+<html><head><meta charset=\\"utf-8\\" /><link@@ -48,6 +49,13 @@ exports[`download-html > should construct html correctly 1`] = `resizeObserver.observe(obj.contentWindow.document.body);}</script>++ <link rel=\\"preconnect\\" href=\\"https://fonts.googleapis.com\\" />+ <link rel=\\"preconnect\\" href=\\"https://fonts.gstatic.com\\" crossorigin=\\"\\" />+ <link+ href=\\"https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&family=Lora&family=PT+Sans:wght@400;700&display=swap\\"+ rel=\\"stylesheet\\"+ /></head><body>diff --git a/frontend/src/core/static/download-html.ts b/frontend/src/core/static/download-html.tsindex 1086059ce3..f993d09f93 100644--- a/frontend/src/core/static/download-html.ts+++ b/frontend/src/core/static/download-html.ts@@ -174,7 +174,15 @@ export function constructHTML(opts: {doc.body.append(devScript);}- return doc.documentElement.outerHTML;+ doc.head.innerHTML = `+ ${doc.head.innerHTML}+ <link rel="preconnect" href="https://fonts.googleapis.com">+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>+ <link href="https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500;700&family=Lora&family=PT+Sans:wght@400;700&display=swap" rel="stylesheet">+ `.trim();++ // add DOCTYPE back in+ return `<!DOCTYPE html>\n${doc.documentElement.outerHTML}`;}function updateAssetUrl(existingUrl: string, assetBaseUrl: string) {diff --git a/frontend/src/css/fonts.css b/frontend/src/css/fonts.cssindex b42b1064f5..4d14f0aead 100644--- a/frontend/src/css/fonts.css+++ b/frontend/src/css/fonts.css@@ -1,3 +1,6 @@+/* This must be kept in sync with the fonts used in the static HTML download,+but instead use the Google Fonts CDN.+see frontend/src/core/static/download-html.ts */@font-face {font-family: Lora;font-style: normal;