mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 10:00:17 +05:30
CRITICAL FIX: Print preview and file loading - complete rewrite of timing logic
Print Preview Fix:
- Changed to hide only editor-pane instead of entire editor-container
- Preview was inside editor-container, so hiding it hid the preview too!
- Now correctly shows preview-pane-{tabId} with print-mode class
- Hide all dialogs including find-dialog during print
- Preview now displays correctly for printing
File Loading Fix - Completely Rewritten:
- Root cause: renderer-ready was sent BEFORE theme was applied
- Solution: Moved renderer-ready signal INTO theme-changed handler
- Now waits 1500ms AFTER theme is applied before signaling ready
- Main process delay increased to 500ms for extra safety
- Ensures complete UI render cycle: DOMContentLoaded -> theme request -> theme applied -> wait -> renderer-ready -> file opens
- Files now load and render properly on first double-click
Technical Flow:
1. DOMContentLoaded fires, TabManager initializes
2. get-theme request sent to main
3. theme-changed received, theme applied to body
4. After 1500ms delay, renderer-ready sent
5. Main process waits 500ms more, then sends file-opened
6. Total delay: ~2 seconds ensures rock-solid first-load rendering
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
+2
-2
@@ -1669,10 +1669,10 @@ function openFileFromPath(filePath) {
|
||||
const content = fs.readFileSync(filePath, 'utf-8');
|
||||
if (mainWindow && mainWindow.webContents && rendererReady) {
|
||||
// Add delay to ensure renderer is fully prepared to display the file
|
||||
// Increased delay for first-time load when UI is still initializing
|
||||
// Give extra time for theme application and preview pane setup
|
||||
setTimeout(() => {
|
||||
mainWindow.webContents.send('file-opened', { path: filePath, content });
|
||||
}, 300);
|
||||
}, 500);
|
||||
} else {
|
||||
// Store file to open after renderer is ready
|
||||
app.pendingFile = filePath;
|
||||
|
||||
Reference in New Issue
Block a user