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
improvement: improve download html/png title name to match the document
Myles Scolnick24eb20e414ac
diff --git a/frontend/src/components/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsxindex 6bf57f995b..8e332c73d3 100644--- a/frontend/src/components/editor/actions/useNotebookActions.tsx+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx@@ -42,7 +42,6 @@ import { useImperativeModal } from "@/components/modal/ImperativeModal";import { ShareStaticNotebookModal } from "@/components/static-html/share-modal";import { useRestartKernel } from "./useRestartKernel";import { createShareableLink } from "@/core/pyodide/share";-import { Paths } from "@/utils/paths";import { useChromeActions, useChromeState } from "../chrome/state";import { PANEL_ICONS, PANEL_TYPES } from "../chrome/types";import { startCase } from "lodash-es";@@ -136,7 +135,7 @@ export function useNotebookActions() {// Wait 2 seconds for the app to renderawait new Promise((resolve) => setTimeout(resolve, 2000));- await downloadHTMLAsImage(app, filename || "screenshot.png");+ await downloadHTMLAsImage(app, document.title);});toasted.dismiss();@@ -151,7 +150,7 @@ export function useNotebookActions() {const md = await exportAsMarkdown({ download: false });downloadBlob(new Blob([md], { type: "text/plain" }),- Filenames.toMarkdown(Paths.basename(filename || "notebook.py")),+ Filenames.toMarkdown(document.title),);},},@@ -162,7 +161,7 @@ export function useNotebookActions() {const code = await readCode();downloadBlob(new Blob([code.contents], { type: "text/plain" }),- Paths.basename(filename || "notebook.py"),+ Filenames.toPY(document.title),);},},diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsxindex 93fd05bd1a..13f3f8cf8c 100644--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx@@ -97,13 +97,12 @@ const ActionButtons: React.FC<{showCode: boolean;onToggleShowCode: () => void;}> = ({ canShowCode, showCode, onToggleShowCode }) => {- const [filename] = useFilename();const handleDownloadAsPNG = async () => {const app = document.getElementById("App");if (!app) {return;}- await downloadHTMLAsImage(app, filename || "screenshot.png");+ await downloadHTMLAsImage(app, document.title);};const handleDownloadAsHTML = async () => {@@ -111,7 +110,7 @@ const ActionButtons: React.FC<{if (!app) {return;}- await downloadAsHTML({ filename: filename || "app" });+ await downloadAsHTML({ filename: document.title });};return (diff --git a/frontend/src/utils/filenames.ts b/frontend/src/utils/filenames.tsindex ad4e351fed..fc24b618db 100644--- a/frontend/src/utils/filenames.ts+++ b/frontend/src/utils/filenames.ts@@ -9,6 +9,9 @@ export const Filenames = {toPNG: (filename: string): string => {return Filenames.replace(filename, "png");},+ toPY: (filename: string): string => {+ return Filenames.replace(filename, "py");+ },withoutExtension: (filename: string): string => {// Just remove the last extensionconst parts = filename.split(".");