Skip to content

Commit 66a9c48

Browse files
committed
Fix bugs towards a better editor experience
1 parent 99ee838 commit 66a9c48

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

p5js/js/electron/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { app, BrowserWindow, globalShortcut, ipcMain } = require('electron');
33

44
const createWindow = () => {
55
const win = new BrowserWindow({
6+
show: false,
67
width: 400,
78
height: 400,
89
useContentSize: true,
@@ -45,5 +46,6 @@ app.whenReady().then(() => {
4546

4647
ipcMain.on("resize", (event, {width, height}) => {
4748
win.setSize(width, height);
49+
win.show();
4850
});
4951
});

p5js/src/main/kotlin/p5jsEditor.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
5858
val folder = sketch.folder
5959

6060
// Copy all Electron scaffolding mode’s `js` folder
61-
var electronFolder = mode?.getContentFile("js/electron")
62-
electronFolder?.copyTo(folder, true)
61+
var javascriptFolder = mode?.getContentFile("js")
62+
javascriptFolder?.resolve("electron")?.copyRecursively(folder.resolve("electron"), true)
6363

6464
// Only copy `package.json` and `pnpm-lock.yaml` if not existent
65-
mode?.getContentFile("js/package.json")?.copyTo(folder)
66-
mode?.getContentFile("js/pnpm-lock.yaml")?.copyTo(folder)
65+
javascriptFolder?.resolve("package.json")?.copyTo(folder.resolve("package.json"))
66+
javascriptFolder?.resolve("pnpm-lock.yaml")?.copyTo(folder.resolve("pnpm-lock.yaml"))
6767

6868
createIndexHtml()
6969

@@ -293,7 +293,7 @@ class p5jsEditor(base: Base, path: String?, state: EditorState?, mode: Mode?): E
293293
while (reader.readLine().also { line = it } != null) {
294294
// TODO: so much refactoring!
295295
// Only check for errors when running the sketch
296-
if (action.startsWith("npx") && line.startsWith("error")) {
296+
if (action == "pnpm sketch:start" && line.startsWith("error")) {
297297
// TODO: more robust data exchange, double-check with @Stef
298298
// TODO: `statusError` does not do anything with column of a SketchException
299299
val ( msgType, msgText, msgFile, msgLine, msgCol ) = line.split("|")

0 commit comments

Comments
 (0)