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: fix download as PNG using app-chrome (#131)
Myles Scolnickb6a2a917c3a1
diff --git a/frontend/index.html b/frontend/index.htmlindex 5e81e365b4..7ddc735ae2 100644--- a/frontend/index.html+++ b/frontend/index.html@@ -26,7 +26,6 @@<title>{{ title }}</title></head><body>- <noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="module" src="/src/main.tsx"></script></body>diff --git a/frontend/src/css/common.css b/frontend/src/css/common.cssindex 07cdd46416..a59e0c66a1 100644--- a/frontend/src/css/common.css+++ b/frontend/src/css/common.css@@ -21,13 +21,12 @@To hide an element on print, add the class `no-print` to it.When printing, the class `printing` is added to the body element to enable this rule. */body.printing .no-print {- visibility: hidden !important;+ display: none !important;}-body.printing,-body.printing #root {+body.printing #App {/* Full screen print */- height: 100% !important;+ height: fit-content !important;}/* When printing the output of a cell, this unset the max-height set by the notebook to capture the full output */diff --git a/frontend/src/editor/actions/useNotebookActions.tsx b/frontend/src/editor/actions/useNotebookActions.tsxindex 8ce6ce0eec..e2d2eb5c27 100644--- a/frontend/src/editor/actions/useNotebookActions.tsx+++ b/frontend/src/editor/actions/useNotebookActions.tsx@@ -31,7 +31,11 @@ export function useNotebookActions(opts: { filename?: string | null }) {label: "Export to PNG",handle: async () => {await runDuringPresentMode(() => {- downloadHTMLAsImage(document.body, filename || "screenshot.png");+ const app = document.getElementById("App");+ if (!app) {+ return;+ }+ downloadHTMLAsImage(app, filename || "screenshot.png");});},},diff --git a/frontend/src/editor/chrome/wrapper/app-chrome.tsx b/frontend/src/editor/chrome/wrapper/app-chrome.tsxindex 4985eccfc6..bf6f2cffe7 100644--- a/frontend/src/editor/chrome/wrapper/app-chrome.tsx+++ b/frontend/src/editor/chrome/wrapper/app-chrome.tsx@@ -48,7 +48,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {const resizeHandle = (<PanelResizeHandleclassName={cn(- "border-border",+ "border-border no-print",isOpen ? "resize-handle" : "resize-handle-collapsed",panelLocation === "left" ? "vertical" : "horizontal")}@@ -62,7 +62,7 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {key={`helper-${panelLocation}`}collapsedSize={0}collapsible={true}- className="bg-[var(--sage-1)]"+ className="bg-[var(--sage-1)] no-print"minSize={10}// We can't make the default size greater than 0, otherwise it will start opendefaultSize={0}diff --git a/frontend/src/editor/chrome/wrapper/footer.tsx b/frontend/src/editor/chrome/wrapper/footer.tsxindex d66ee5e495..b35de21d91 100644--- a/frontend/src/editor/chrome/wrapper/footer.tsx+++ b/frontend/src/editor/chrome/wrapper/footer.tsx@@ -10,7 +10,7 @@ export const Footer: React.FC = () => {const { openApplication, changePanelLocation } = useChromeActions();return (- <footer className="h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-6 border-t border-border select-none">+ <footer className="h-10 py-2 bg-background flex items-center text-muted-foreground text-md px-6 border-t border-border select-none no-print">{/* <FooterItemselected={selectedPanel === "errors"}onClick={() => openApplication("errors")}