From f8eab068b0541351b140a5189d162c68bc4b9e46 Mon Sep 17 00:00:00 2001 From: amitwh Date: Mon, 1 Sep 2025 21:05:01 +0530 Subject: [PATCH] Fix v1.3.1: File associations and 50/50 pane layout - Enhanced file association handling for double-clicking .md files - Added proper file associations in package.json build config - Fixed preview/source pane layout to be equally distributed 50/50 - Updated CSS for tab-content structure with proper flex layout - Added theme support for new pane selectors - Improved command line argument processing for file opening - Updated version to 1.3.1 with file association feature --- package.json | 18 +++++++++++++++++- src/main.js | 13 ++++++++----- src/styles.css | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 444b9a9..e7a8b20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pan-converter", - "version": "1.3.0", + "version": "1.3.1", "description": "Cross-platform Markdown editor and converter using Pandoc", "main": "src/main.js", "scripts": { @@ -47,6 +47,22 @@ "node_modules/**/*", "package.json" ], + "fileAssociations": [ + { + "ext": "md", + "name": "Markdown Document", + "description": "Markdown Document", + "mimeType": "text/markdown", + "role": "Editor" + }, + { + "ext": "markdown", + "name": "Markdown Document", + "description": "Markdown Document", + "mimeType": "text/markdown", + "role": "Editor" + } + ], "mac": { "category": "public.app-category.productivity", "icon": "assets/icon.icns" diff --git a/src/main.js b/src/main.js index fd644fc..2f62010 100644 --- a/src/main.js +++ b/src/main.js @@ -171,7 +171,7 @@ function createMenu() { type: 'info', title: 'About PanConverter', message: 'PanConverter', - detail: 'A cross-platform Markdown editor and converter using Pandoc.\n\nVersion: 1.3.0\nAuthor: Amit Haridas\nEmail: amit.wh@gmail.com\nLicense: MIT\n\nFeatures:\n• Tabbed interface for multiple files\n• Advanced markdown editing with live preview\n• Enhanced PDF export with LaTeX engines\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• Multiple themes support\n• Undo/redo functionality', + detail: 'A cross-platform Markdown editor and converter using Pandoc.\n\nVersion: 1.3.1\nAuthor: Amit Haridas\nEmail: amit.wh@gmail.com\nLicense: MIT\n\nFeatures:\n• Tabbed interface for multiple files\n• Advanced markdown editing with live preview\n• Enhanced PDF export with LaTeX engines\n• File association support for .md files\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• Multiple themes support\n• Undo/redo functionality', buttons: ['OK'] }); } @@ -453,10 +453,13 @@ app.whenReady().then(() => { createWindow(); // Handle file association on app startup - if (process.argv.length > 1) { - const filePath = process.argv.find(arg => arg.endsWith('.md') || arg.endsWith('.markdown')); - if (filePath && fs.existsSync(filePath)) { - openFileFromPath(filePath); + // Process all command line arguments except the first two (node and script path) + const fileArgs = process.argv.slice(2); + for (const arg of fileArgs) { + if ((arg.endsWith('.md') || arg.endsWith('.markdown')) && fs.existsSync(arg)) { + // Store the file to open after window is ready + app.pendingFile = arg; + break; } } }); diff --git a/src/styles.css b/src/styles.css index 7126ea6..8a10aa5 100644 --- a/src/styles.css +++ b/src/styles.css @@ -152,8 +152,36 @@ body { .pane { flex: 1; overflow: auto; + min-width: 0; } +.pane:first-child { + border-right: 1px solid #ddd; +} + +.editor-textarea { + width: 100%; + height: 100%; + padding: 20px; + font-family: 'SF Mono', Monaco, 'Courier New', monospace; + font-size: 14px; + line-height: 1.6; + border: none; + outline: none; + resize: none; +} + +.pane:last-child { + padding: 20px; + background: #fff; +} + +.preview-content { + max-width: 800px; + margin: 0 auto; +} + +/* Legacy support for old selectors */ #editor-pane { border-right: 1px solid #ddd; } @@ -356,6 +384,20 @@ body.theme-dark .toolbar-separator { background: #3e3e42; } +body.theme-dark .pane:first-child { + border-right-color: #3e3e42; +} + +body.theme-dark .editor-textarea { + background: #1e1e1e; + color: #d4d4d4; +} + +body.theme-dark .pane:last-child { + background: #252526; +} + +/* Legacy support */ body.theme-dark #editor-pane { border-right-color: #3e3e42; } @@ -574,6 +616,15 @@ body.theme-github .status-bar { } /* Hide preview pane by default */ +.pane.hidden { + display: none; +} + +.pane.full-width { + border-right: none; +} + +/* Legacy support */ #preview-pane.hidden { display: none; }