Update MermaidBlock component to automatically adapt to light/dark theme
changes, ensuring diagrams remain visually consistent with the app theme.
Changes:
- Add MutationObserver to watch for data-theme attribute changes
- Map app themes to Mermaid themes (default-dark → dark, others → default)
- Re-render diagrams automatically when theme switches
- Maintain proper TypeScript typing for Mermaid theme values
The component now responds instantly to theme changes, providing a seamless
user experience when switching between light and dark modes or using
"Sync with system" option.
Add support for rendering Mermaid diagrams in memo content using standard
GFM/CommonMark syntax with fenced code blocks.
Changes:
- Add MermaidBlock component for rendering Mermaid diagrams
- Update CodeBlock to detect and delegate mermaid language blocks
- Use mermaid library (already in dependencies) for diagram rendering
- Support standard syntax: ```mermaid...```
The implementation follows industry standards:
- Uses fenced code blocks with 'mermaid' language identifier
- Renders diagrams with error fallback to code display
- Maintains security with strict mode rendering
- Seamless integration with existing markdown pipeline
Example usage:
```mermaid
graph TD
A[Start] --> B[Process]
B --> C[End]
```
- Removed the `nodes` field from the `Memo` interface in `memo_service.ts`.
- Updated the `createBaseMemo` function and the `Memo` message functions to reflect the removal of `nodes`.
- Cleaned up the serialization and deserialization logic accordingly.
chore: remove code-inspector-plugin from Vite configuration
- Deleted the `codeInspectorPlugin` from the Vite configuration in `vite.config.mts`.
- Simplified the plugins array to include only `react` and `tailwindcss`.
* fix#4257 fixed ui for mermaid diagrams in dark mode
* fixed linting issues
* added dynamic color theme for mermaid diagrams
* now mermaid block uses theme according to the system as well when 'follow system' is selected
* refactored code for mermaid theme logic
* refactored mermaid code to use const instead of function call
---------
Co-authored-by: root <root@DESKTOP-G3MCU14>