mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
Fix v1.9.0 logo upload and add MiKTeX PATH support
This commit fixes the logo upload issue and adds MiKTeX to the app's PATH for LaTeX/PDF support. **Logo Upload Fix:** - Replaced file input with Browse button that uses dialog.showOpenDialog - Added browse-header-footer-logo IPC handler in main process - Now gets reliable file paths without depending on file.path property - Added browse-btn CSS styling **MiKTeX PATH Addition:** - Automatically adds MiKTeX bin directory to process.env.PATH on Windows - Enables XeLaTeX/PDFLaTeX for PDF exports with headers/footers - Logs PATH addition for debugging **Files Changed:** - src/main.js: Added MiKTeX PATH setup, browse logo IPC handler - src/renderer.js: Changed to browseForLogo() function, updated event listeners - src/index.html: Replaced file inputs with browse buttons - src/styles.css: Added .browse-btn styling **Testing Notes:** - Logo upload now works without "path undefined" errors - DOCX exports with headers/footers confirmed working - PDF exports should now use Pandoc+XeLaTeX with MiKTeX in PATH - Requires MiKTeX installation and PC restart for full functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
+6
-21
@@ -2658,23 +2658,9 @@ function saveHeaderFooterSettings() {
|
||||
closeHeaderFooterDialog();
|
||||
}
|
||||
|
||||
// Handle logo file selection
|
||||
function handleLogoSelection(position) {
|
||||
const input = document.getElementById(`${position}-logo`);
|
||||
|
||||
if (input.files && input.files[0]) {
|
||||
const file = input.files[0];
|
||||
// Use webUtils to get the real file path in Electron
|
||||
const filePath = file.path || (window.electron && window.electron.webUtils ? window.electron.webUtils.getPathForFile(file) : null);
|
||||
|
||||
if (!filePath) {
|
||||
alert('Error: Could not get file path. Please try again.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Send to main process to save
|
||||
ipcRenderer.send('save-header-footer-logo', { position, filePath });
|
||||
}
|
||||
// Handle logo browsing - ask main process to show open dialog
|
||||
function browseForLogo(position) {
|
||||
ipcRenderer.send('browse-header-footer-logo', position);
|
||||
}
|
||||
|
||||
// Handle logo saved confirmation
|
||||
@@ -2685,7 +2671,6 @@ ipcRenderer.on('header-footer-logo-saved', (event, { position, path }) => {
|
||||
// Clear logo
|
||||
function clearLogo(position) {
|
||||
ipcRenderer.send('clear-header-footer-logo', position);
|
||||
document.getElementById(`${position}-logo`).value = '';
|
||||
document.getElementById(`${position}-logo-preview`).textContent = '';
|
||||
}
|
||||
|
||||
@@ -2728,9 +2713,9 @@ document.querySelectorAll('.field-insert-btn').forEach(btn => {
|
||||
});
|
||||
});
|
||||
|
||||
// Logo file inputs
|
||||
document.getElementById('header-logo').addEventListener('change', () => handleLogoSelection('header'));
|
||||
document.getElementById('footer-logo').addEventListener('change', () => handleLogoSelection('footer'));
|
||||
// Logo browse buttons
|
||||
document.getElementById('header-logo-browse').addEventListener('click', () => browseForLogo('header'));
|
||||
document.getElementById('footer-logo-browse').addEventListener('click', () => browseForLogo('footer'));
|
||||
|
||||
// Logo clear buttons
|
||||
document.getElementById('header-logo-clear').addEventListener('click', () => clearLogo('header'));
|
||||
|
||||
Reference in New Issue
Block a user