diff --git a/README.md b/README.md index 9682158..01b7141 100644 --- a/README.md +++ b/README.md @@ -257,4 +257,4 @@ Amit Haridas (amit.wh@gmail.com) ## Version -v4.9.4 +v4.9.5 diff --git a/UPDATES.md b/UPDATES.md index 766490b..4be42af 100644 --- a/UPDATES.md +++ b/UPDATES.md @@ -1,5 +1,21 @@ # PanConverter - Updates & Changelog +## Version 4.9.5 (2026-09-14) + +### Fixes +- **Flowchart Panel — rendered Mermaid SVG invisible at runtime**: v4.9.4 shipped with three interaction bugs that combined to make the Flow Chart panel look broken even though all the wiring was correct: + 1. **Render target had zero height.** `.flowchart-preview-render` only had `flex: 1; padding: 8px; overflow: auto;` — no `min-height`. When the parent flex column shrank (collapsed sidebar, normal sidebar width before the user clicks Maximize), the target collapsed to 0 height and the Mermaid-rendered SVG, though attached to the DOM, was clipped to nothing. + 2. **Dark-on-dark surfaces.** The canvas host and preview host inherited the project's `body.theme-concreteinfo` dark theme. Mermaid's `dark` theme was selected automatically in `src/renderer.js` based on the body class, producing near-black SVG fills on a near-black background. Node labels "Node" were barely legible. + 3. **Selection highlight invisible.** `.flowchart-node.selected` only set `stroke: var(--accent); stroke-width: 2;` against the rect's existing near-black fill — a thin accent stroke on a dark fill is effectively invisible at small sizes. + + Fix in three places: + - `src/styles-sidebar.css` — gave `.flowchart-preview-render` a `min-height: 120px` so the Mermaid SVG always has room to lay out. Added a `!important` light background (`#fafafa` / `#1f2328` text) to `.flowchart-canvas-host` and `.flowchart-preview-host` so the flowchart surface is readable regardless of the project's body theme. Forced explicit fills and strokes on `.flowchart-node rect` / `.flowchart-node polygon` / `.flowchart-node text` / `.flowchart-edge` (white fill, dark stroke, dark text). Selection now also changes the fill (`#e3f0ff`) and bumps `stroke-width` to 3 on both nodes and edges — the highlight is unmissable. + - `src/renderer.js:2443-2450` — the inline `renderFlowChartMermaid` now always initializes Mermaid with `theme: 'default'` (light) regardless of body class. Keeping this in sync with the CSS rule above is load-bearing: both are needed for the panel to be visible in any theme. +- **Tradeoff accepted**: the flowchart surface is now always light — diverges from the project's body theme. The user has been explicit that visibility and a working editor are the priority; theme consistency within this focused panel is sacrificed to guarantee the panel reads. + +### Tests +- `tests/flowchart-panel.test.js` — new `describe('flowchart-panel: render target sizing (v4.9.5 regression)')` block (3 tests) reading the shipped CSS to assert: (a) `.flowchart-preview-render` has a non-zero `min-height`, (b) `.flowchart-canvas-host` / `.flowchart-preview-host` carry a forced background declaration with `!important`, (c) `.flowchart-node.selected rect/polygon` carry an explicit fill and `stroke-width >= 3`. Reading the stylesheet directly mirrors what the runtime loads via `` and sidesteps jsdom's incomplete layout engine. + ## Version 4.9.4 (2026-09-14) ### Fixes diff --git a/package.json b/package.json index ab2f111..b6ab2ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "markdown-converter", - "version": "4.9.4", + "version": "4.9.5", "description": "Professional Markdown editor and universal file converter with PDF editing, batch processing, and syntax highlighting", "main": "src/main.js", "scripts": { diff --git a/src/renderer.js b/src/renderer.js index 54fd0dd..0f95043 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -2440,7 +2440,15 @@ document.addEventListener('DOMContentLoaded', async () => { const mermaidModule = require('mermaid'); window.mermaid = mermaidModule.default || mermaidModule; } - const theme = document.body.className.includes('theme-dark') ? 'dark' : 'default'; + // v4.9.5 — force the Mermaid theme to 'default' (light) regardless of the + // project's
. The flowchart preview lives next to + // the editor inside a sidebar that we deliberately render on a forced + // light surface (see .flowchart-canvas-host / .flowchart-preview-host in + // src/styles-sidebar.css). Mermaid's `dark` theme produces near-black + // SVG fills, which against a near-white background are unreadable and + // against a dark background completely invisible. Keep this in sync with + // the CSS rule above — both are needed. + const theme = 'default'; window.mermaid.initialize({ startOnLoad: false, theme, securityLevel: 'loose' }); window.mermaid .run({ nodes: [div] }) diff --git a/src/styles-sidebar.css b/src/styles-sidebar.css index f8a194e..e1b8b31 100644 --- a/src/styles-sidebar.css +++ b/src/styles-sidebar.css @@ -1089,19 +1089,55 @@ body[class*='dark'] .preview-content a.wiki-link { } .flowchart-preview-render { flex: 1; + /* Non-zero CSS height guarantees the Mermaid-rendered SVG has room to lay + * out — without this, flex children in a collapsed parent can compute to 0 + * height and mermaid's