mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
fix(app): add Vite dev workflow, fix onLayout prop, fix icon path, allow Google Fonts CSP
The v5.0.0 React UI redesign shipped without a working dev workflow — `npm start` only ran `electron .` which loaded the source index.html that references raw .tsx files. The browser couldn't execute them, so the app rendered an empty #root and the user saw 'lot of errors'. This commit restores a real dev workflow: 1. **Vite dev server wired into npm scripts** — added `concurrently` + `wait-on` as devDeps. `npm run dev` now runs Vite (port 5173) and Electron together with `wait-on tcp:5173` so Electron only starts after the dev server is ready. 2. **Main process loads Vite URL in dev, dist/ in prod** — window module now checks `process.env.VITE_DEV_SERVER_URL` and `app.isPackaged` to decide what to load. Production still loads the built `dist/renderer/index.html`. 3. **Fixed ReferenceError: app is not defined** — window module referenced `app.isPackaged` but only imported `BrowserWindow`. Added `app` to the destructured import. 4. **Fixed wrong icon path** — window creation used `../../assets/icon.png` from src/main/window/ which resolved to `src/assets/icon.png` (doesn't exist). Icon lives at project root, so path is now `../../../assets/icon.png`. 5. **Allowed Google Fonts in CSP** — the strict CSP (`font-src 'self' data:`, `connect-src 'self'`) blocked the preconnect/css link to fonts.googleapis.com / .gstatic.com. Added both domains so Plus Jakarta Sans loads. 6. **Renamed onLayout → onLayoutChange** in AppShell — react-resizable-panels v4 renamed the prop. The v1 name was being spread to a DOM div and React logged 'Unknown event handler property' warnings. Test mock updated for parity. 7. **show: false → show: true** — ready-to-show was hanging on this Wayland/container combo. Now the window is shown immediately on create. Verified end-to-end: - 305/305 vitest tests pass - Vite dev server starts on :5173 - Electron loads localhost:5173 and React mounts - Header 'MarkdownConverter' + sidebar with 'No files open' visible - No onLayout warnings after HMR - All blocked errors resolved
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self';">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob:; font-src 'self' data: https://fonts.gstatic.com; connect-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com;">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>MarkdownConverter</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
|
||||
Reference in New Issue
Block a user