2026-04-11 01:24:35 +08:00
|
|
|
# Project Discussion
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
## Requirements
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
1. **Two-column layout**: Note list on the left, editor/preview on the right
|
|
|
|
|
2. **SQLite storage**: Using libsql client
|
|
|
|
|
3. **Markdown support**: Render Markdown content
|
|
|
|
|
4. **Glow-like effect**: Terminal Markdown rendering
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
## Technical Issues and Solutions
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
### OpenTUI Markdown Component Issue
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Problem**: OpenTUI's `<markdown>` component could not render styles correctly (tried multiple methods, all failed)
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Solution**: Implement a custom Markdown parser using OpenTUI's `<text>` components for manual rendering
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
### Textarea Wrap Issue
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Problem**: Default wrapMode in textarea React types is missing
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Solution**: Make textarea usable by setting `focused` attribute, access EditBufferRenderable's wrapMode option through underlying access
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
### Preview Mode Line Break Issue
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Problem**: Line breaks from edit mode not showing in preview
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Solution**: Handle empty lines in `renderMarkdown` function, add `<text>{" "}</text>`
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
### Code Block Rendering
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Problem**: Indentation rendering issues inside ``` code blocks
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Solution**: Implement code block detection and rendering logic, render each code line separately
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
### Multi-select Feature
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Problem**: OpenTUI's `onMouseDown` event doesn't include ctrlKey/shiftKey modifier info, and `useKeyboard` couldn't capture modifier keys
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Solution**:
|
|
|
|
|
- Tried using `useKeyboard` to listen for modifier keys but failed (terminal may not send separate modifier key events)
|
|
|
|
|
- Switched to double-click "selection mode" approach: double-click any note to toggle selection mode, click to multi-select in selection mode
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
### Cross-platform Database Path
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Problem**: Hardcoded database path not compatible across platforms
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
**Solution**: Implement `getDbPath()` function to use `~/.config/mio/cache.db` for all platforms
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
## Unresolved Issues
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
1. **Multi-select feature**: Double-click selection mode experience is not ideal, keyboard modifier key approach couldn't be implemented
|
|
|
|
|
2. **TypeScript type errors**: Some type errors in NoteEditor (bold attribute doesn't exist, etc.)
|
2026-04-11 01:24:17 +08:00
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
## Build Instructions
|
2026-04-11 01:24:17 +08:00
|
|
|
|
|
|
|
|
```bash
|
2026-04-11 01:24:35 +08:00
|
|
|
npm run dev # Development mode
|
|
|
|
|
npm run build # Build to mio.exe
|
2026-04-11 01:24:17 +08:00
|
|
|
```
|
|
|
|
|
|
2026-04-11 01:24:35 +08:00
|
|
|
Database location: `~/.config/mio/cache.db`
|