@marimo-team/islands 0.19.7-dev23 → 0.19.7-dev24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js
CHANGED
|
@@ -72913,7 +72913,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
|
|
|
72913
72913
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
72914
72914
|
}
|
|
72915
72915
|
}
|
|
72916
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.7-
|
|
72916
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.7-dev24"), showCodeInRunModeAtom = atom(true);
|
|
72917
72917
|
atom(null);
|
|
72918
72918
|
var import_compiler_runtime$89 = require_compiler_runtime();
|
|
72919
72919
|
function useKeydownOnElement(e, r) {
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { JSX } from "react";
|
|
4
4
|
import { FilenameInput } from "@/components/editor/header/filename-input";
|
|
5
5
|
import { useUpdateFilename } from "@/core/saving/filename";
|
|
6
|
+
import { useSaveNotebook } from "@/core/saving/save-component";
|
|
6
7
|
import { Paths } from "@/utils/paths";
|
|
7
8
|
|
|
8
9
|
export const FilenameForm = ({
|
|
@@ -10,14 +11,26 @@ export const FilenameForm = ({
|
|
|
10
11
|
}: {
|
|
11
12
|
filename: string | null;
|
|
12
13
|
}): JSX.Element => {
|
|
13
|
-
const
|
|
14
|
+
const updateFilename = useUpdateFilename();
|
|
15
|
+
const { saveNotebook } = useSaveNotebook();
|
|
16
|
+
|
|
17
|
+
const handleNameChange = (newFilename: string) => {
|
|
18
|
+
const wasUnnamed = filename === null;
|
|
19
|
+
updateFilename(newFilename).then((name) => {
|
|
20
|
+
// When creating a new file (was unnamed), also save the content
|
|
21
|
+
if (name !== null && wasUnnamed) {
|
|
22
|
+
saveNotebook(name, true);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
14
27
|
return (
|
|
15
28
|
<FilenameInput
|
|
16
29
|
placeholderText={
|
|
17
30
|
filename ? Paths.basename(filename) : "untitled marimo notebook"
|
|
18
31
|
}
|
|
19
32
|
initialValue={filename}
|
|
20
|
-
onNameChange={
|
|
33
|
+
onNameChange={handleNameChange}
|
|
21
34
|
flexibleWidth={true}
|
|
22
35
|
resetOnBlur={true}
|
|
23
36
|
data-testid="filename-input"
|
|
@@ -109,6 +109,7 @@ const renderWithProvider = <T>(hook: () => T) => {
|
|
|
109
109
|
// Shared mock setup
|
|
110
110
|
const mockSaveOrNameNotebook = vi.fn();
|
|
111
111
|
const mockSaveIfNotebookIsPersistent = vi.fn();
|
|
112
|
+
const mockSaveNotebook = vi.fn();
|
|
112
113
|
const mockRunCell = vi.fn();
|
|
113
114
|
const mockCopyCell = vi.fn();
|
|
114
115
|
const mockPasteCell = vi.fn();
|
|
@@ -156,6 +157,7 @@ describe("useCellNavigationProps", () => {
|
|
|
156
157
|
mockUseSaveNotebook.mockReturnValue({
|
|
157
158
|
saveOrNameNotebook: mockSaveOrNameNotebook,
|
|
158
159
|
saveIfNotebookIsPersistent: mockSaveIfNotebookIsPersistent,
|
|
160
|
+
saveNotebook: mockSaveNotebook,
|
|
159
161
|
});
|
|
160
162
|
mockUseCellActions.mockReturnValue(
|
|
161
163
|
mockCellActions as unknown as CellActions,
|