From d2fab56be965577395fabb341443ddb0698bda36 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Sat, 11 Oct 2025 12:57:52 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20critical=20double-click=20file=20opening?= =?UTF-8?q?=20bug=20(v1.7.4)=20CRITICAL=20BUG=20FIX:=20Files=20opened=20vi?= =?UTF-8?q?a=20double-click=20were=20not=20rendering=20in=20the=20applicat?= =?UTF-8?q?ion.=20Root=20Cause:=20-=20The=20openFileFromPath()=20function?= =?UTF-8?q?=20was=20sending=20IPC=20'file-opened'=20message=20WITHOUT=20ch?= =?UTF-8?q?ecking=20if=20rendererReady=20was=20true=20-=20When=20files=20w?= =?UTF-8?q?ere=20double-clicked=20before=20renderer=20initialization,=20th?= =?UTF-8?q?e=20IPC=20message=20was=20sent=20but=20lost=20-=20The=20comment?= =?UTF-8?q?=20"Always=20try=20to=20send,=20the=20renderer=20will=20handle?= =?UTF-8?q?=20it=20when=20ready"=20was=20incorrect=20The=20Fix=20(src/main?= =?UTF-8?q?.js:1586):=20-=20Added=20rendererReady=20check=20to=20the=20con?= =?UTF-8?q?ditional:=20if=20(mainWindow=20&&=20mainWindow.webContents=20&&?= =?UTF-8?q?=20rendererReady)=20-=20Now=20properly=20stores=20file=20in=20a?= =?UTF-8?q?pp.pendingFile=20when=20renderer=20is=20not=20ready=20-=20File?= =?UTF-8?q?=20is=20opened=20correctly=20when=20renderer-ready=20signal=20a?= =?UTF-8?q?rrives=20Flow:=201.=20File=20double-clicked=20=E2=86=92=20openF?= =?UTF-8?q?ileFromPath()=20called=202.=20If=20renderer=20NOT=20ready=20?= =?UTF-8?q?=E2=86=92=20store=20in=20app.pendingFile=203.=20When=20renderer?= =?UTF-8?q?=20sends=20'renderer-ready'=20=E2=86=92=20openFileFromPath(app.?= =?UTF-8?q?pendingFile)=20is=20called=204.=20This=20time=20renderer=20IS?= =?UTF-8?q?=20ready=20=E2=86=92=20file=20opens=20successfully=20Version:?= =?UTF-8?q?=201.7.4=20-=20Updated=20package.json=20version=20to=201.7.4=20?= =?UTF-8?q?-=20Updated=20About=20dialog=20version=20to=201.7.4=20?= =?UTF-8?q?=F0=9F=A4=96=20Generated=20with=20[Claude=20Code](https://claud?= =?UTF-8?q?e.com/claude-code)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/main.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 501c3d4..93eb969 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pan-converter", - "version": "1.7.3", + "version": "1.7.4", "description": "Cross-platform Markdown editor and converter using Pandoc", "main": "src/main.js", "scripts": { diff --git a/src/main.js b/src/main.js index 472f2bb..98428a1 100644 --- a/src/main.js +++ b/src/main.js @@ -410,7 +410,7 @@ function createMenu() { type: 'info', title: 'About PanConverter', message: 'PanConverter', - detail: 'A cross-platform Markdown editor and converter using Pandoc.\n\nVersion: 1.7.3\nAuthor: Amit Haridas\nEmail: amit.wh@gmail.com\nLicense: MIT\n\nFeatures:\n• Modern glassmorphism UI with gradient backgrounds\n• Comprehensive PDF Editor (merge, split, compress, rotate, watermark, encrypt)\n• Universal File Converter (LibreOffice, ImageMagick, FFmpeg, Pandoc)\n• Windows Explorer context menu integration\n• Tabbed interface for multiple files\n• Advanced markdown editing with live preview\n• Real-time preview updates while typing\n• Full toolbar markdown editing functions\n• Enhanced PDF export with built-in Electron fallback\n• File association support for .md files\n• Command-line interface for batch conversion\n• Advanced export options with templates and metadata\n• Batch file conversion with progress tracking\n• Improved preview typography and spacing\n• Adjustable font sizes via menu (Ctrl+Shift+Plus/Minus)\n• Complete theme support including Monokai fixes\n• Find & replace with match highlighting\n• Line numbers and auto-indentation\n• Export to multiple formats via Pandoc\n• PowerPoint & presentation export\n• Export tables to Excel/ODS spreadsheets\n• Document import & conversion\n• Table creation helper\n• 22 beautiful themes (including Dracula, Nord, Tokyo Night, Gruvbox, Ayu, Concrete, and more)\n• Undo/redo functionality\n• Live word count and statistics', + detail: 'A cross-platform Markdown editor and converter using Pandoc.\n\nVersion: 1.7.4\nAuthor: Amit Haridas\nEmail: amit.wh@gmail.com\nLicense: MIT\n\nFeatures:\n• Modern glassmorphism UI with gradient backgrounds\n• Comprehensive PDF Editor (merge, split, compress, rotate, watermark, encrypt)\n• Universal File Converter (LibreOffice, ImageMagick, FFmpeg, Pandoc)\n• Windows Explorer context menu integration\n• Tabbed interface for multiple files\n• Advanced markdown editing with live preview\n• Real-time preview updates while typing\n• Full toolbar markdown editing functions\n• Enhanced PDF export with built-in Electron fallback\n• File association support for .md files\n• Command-line interface for batch conversion\n• Advanced export options with templates and metadata\n• Batch file conversion with progress tracking\n• Improved preview typography and spacing\n• Adjustable font sizes via menu (Ctrl+Shift+Plus/Minus)\n• Complete theme support including Monokai fixes\n• Find & replace with match highlighting\n• Line numbers and auto-indentation\n• Export to multiple formats via Pandoc\n• PowerPoint & presentation export\n• Export tables to Excel/ODS spreadsheets\n• Document import & conversion\n• Table creation helper\n• 22 beautiful themes (including Dracula, Nord, Tokyo Night, Gruvbox, Ayu, Concrete, and more)\n• Undo/redo functionality\n• Live word count and statistics', buttons: ['OK'] }); } @@ -1583,12 +1583,12 @@ function openFileFromPath(filePath) { if (fs.existsSync(filePath)) { currentFile = filePath; const content = fs.readFileSync(filePath, 'utf-8'); - if (mainWindow && mainWindow.webContents) { - console.log('Attempting to open file:', filePath, 'rendererReady:', rendererReady); - // Always try to send, the renderer will handle it when ready + if (mainWindow && mainWindow.webContents && rendererReady) { + console.log('Opening file (renderer ready):', filePath); mainWindow.webContents.send('file-opened', { path: filePath, content }); } else { - // Store file to open after window is created + console.log('Renderer not ready, storing file:', filePath); + // Store file to open after renderer is ready app.pendingFile = filePath; } } else {