mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 10:00:17 +05:30
fix(renderer): prevent welcome screen from overwriting opened markdown files
The welcome tab setup awaited getAppVersion() inside DOMContentLoaded. While yielding, the renderer-ready timeout fired, file-opened was processed, and openFile rendered the markdown. When the welcome setup resumed, it overwrote tab.content and preview.innerHTML with the welcome screen, leaving the preview blank. Fix: only show the welcome screen if the tab is still empty (no filePath and no content) when the async setup resumes. Amit Haridas
This commit is contained in:
+2
-1
@@ -1730,7 +1730,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
const welcomeHtml = getCreateWelcomeContent()(recentFiles, appVersion);
|
||||
|
||||
const tab = tabManager.tabs.get(tabManager.activeTabId);
|
||||
if (tab) {
|
||||
// Only show welcome if no file was opened while we were awaiting
|
||||
if (tab && !tab.filePath && tab.content === '') {
|
||||
tab.title = 'Welcome';
|
||||
tab.content = '';
|
||||
const preview = document.getElementById(`preview-${tab.id}`);
|
||||
|
||||
Reference in New Issue
Block a user