1. Source editor blank: Added ensureEditor() method with try-catch that
lazily creates the CodeMirror editor when setEditorContent is called
if the initial DOMContentLoaded creation failed or was skipped.
Replaced inline createEditor calls in createTabElements and
DOMContentLoaded with ensureEditor().
2. Export via pandoc failing: runPandocCmd parsed the full path
/bin/linux/pandoc as the command, then prepended it to args because
parsed.command !== 'pandoc'. This caused pandoc to receive its own
binary path as the first input file. Fix: use path.basename() to
check if the command ends with 'pandoc' (or 'pandoc.exe').
Amit Haridas
The main window uses nodeIntegration without preload, so window.electronAPI
was undefined. This caused the DOMContentLoaded handler to crash at:
await window.electronAPI.getAppVersion()
which prevented the CodeMirror editor from being created (blank source
window) and stopped renderer-ready from being sent (broken menu/options).
Fixes:
1. Add window.electronAPI shim at top of renderer.js wrapping ipcRenderer.
2. Update CSP meta tag to allow KaTeX CDN (style-src, script-src, font-src).
Amit Haridas
ModalManager.js is loaded via <script> tag in index.html, which
declares class ModalManager in the global script scope. renderer.js
was then doing 'let ModalManager;' which caused:
SyntaxError: Identifier 'ModalManager' has already been declared
This prevented renderer.js from executing at all, breaking tabs,
editor, file open, and preview rendering.
Fix: conditionally require ModalManager only if undefined, without
re-declaring. In sloppy mode this safely assigns to the existing global.
Amit Haridas
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 will help identify whether the issue is:
1. marked.parse returning a Promise instead of string
2. DOMPurify.sanitize failing
3. The preview element not existing
4. Libraries not being loaded
Amit Haridas
- Add missing updateUI() call at end of openFile() to set .active class
on tab content. Without this, the CSS rule .tab-content:not(.active)
{ display: none } kept newly opened files invisible.
- Add diagnostic logging to file-opened IPC handler and openFile()
to trace future file loading issues.
- Add diagnostic logging to openFileFromPath() in main process.
Amit Haridas
window.ModalManager was set unconditionally, causing "Identifier
'ModalManager' has already been declared" when script tag in HTML
also loaded ModalManager before renderer.js required it.
Now checks !window.ModalManager before setting.
Amit Haridas