Skip to content

Commit dffd5f6

Browse files
committed
Fix write file api bug
1 parent 78b5376 commit dffd5f6

File tree

9 files changed

+31
-10
lines changed

9 files changed

+31
-10
lines changed

.changeset/modern-stamps-learn.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@pulse-editor/shared-utils": patch
3+
"@pulse-editor/react-api": patch
4+
---
5+
6+
Fix platformAPI for FS

.changeset/pre.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"large-moose-tap",
4141
"lazy-zebras-mate",
4242
"mighty-ghosts-crash",
43+
"modern-stamps-learn",
4344
"odd-hounds-enjoy",
4445
"petite-memes-fix",
4546
"polite-lines-dance",

npm-packages/react-api/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# @pulse-editor/react-api
22

3+
## 0.1.1-alpha.49
4+
5+
### Patch Changes
6+
7+
- Fix platformAPI for FS
8+
- Updated dependencies
9+
- @pulse-editor/shared-utils@0.1.1-alpha.49
10+
311
## 0.1.1-alpha.48
412

513
### Patch Changes

npm-packages/react-api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pulse-editor/react-api",
3-
"version": "0.1.1-alpha.48",
3+
"version": "0.1.1-alpha.49",
44
"main": "dist/main.js",
55
"files": [
66
"dist"
@@ -38,7 +38,7 @@
3838
"typescript-eslint": "^8.30.1"
3939
},
4040
"peerDependencies": {
41-
"@pulse-editor/shared-utils": "0.1.1-alpha.48",
41+
"@pulse-editor/shared-utils": "0.1.1-alpha.49",
4242
"react": "^19.0.0",
4343
"react-dom": "^19.0.0"
4444
}

npm-packages/react-api/src/hooks/editor/use-theme.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export default function useTheme() {
2525
imc
2626
?.sendMessage(IMCMessageTypeEnum.EditorAppRequestTheme)
2727
.then((result) => {
28-
console.log("Received theme from main app:", result);
2928
setTheme((prev) => result);
3029
});
3130
}

npm-packages/shared-utils/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @pulse-editor/shared-utils
22

3+
## 0.1.1-alpha.49
4+
5+
### Patch Changes
6+
7+
- Fix platformAPI for FS
8+
39
## 0.1.1-alpha.48
410

511
### Patch Changes

npm-packages/shared-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pulse-editor/shared-utils",
3-
"version": "0.1.1-alpha.48",
3+
"version": "0.1.1-alpha.49",
44
"main": "dist/main.js",
55
"files": [
66
"dist"

npm-packages/shared-utils/src/imc/inter-module-communication.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ export class InterModuleCommunication {
7676
const message = event.data;
7777
if (message.from !== undefined) {
7878
console.log(
79-
`Module ${this.thisWindowId} received message from module ${
80-
message.from
81-
}:\n ${JSON.stringify(message)}`
79+
`Module ${this.thisWindowId} received message from module ${message.from}:\n ${message}`
8280
);
8381
}
8482

web/components/app-loaders/sandbox-app-loader.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,13 @@ export default function SandboxAppLoader({
218218
abortSignal?: AbortSignal,
219219
) => {
220220
if (message.payload) {
221-
const { uri, content }: { uri: string; content: string } =
221+
const { uri, file }: { uri: string; file: File | undefined } =
222222
message.payload;
223223

224+
if (!file) {
225+
throw new Error("File is undefined.");
226+
}
227+
224228
const projectPath =
225229
editorContext?.persistSettings?.projectHomePath +
226230
"/" +
@@ -232,8 +236,7 @@ export default function SandboxAppLoader({
232236
"Cannot write to path outside the project directory.",
233237
);
234238
}
235-
const newFile = new File([content], uri);
236-
await platformApi?.writeFile(newFile, content);
239+
await platformApi?.writeFile(file, uri);
237240
}
238241
},
239242
);

0 commit comments

Comments
 (0)