5.8 KiB
ByteDraft
ByteDraft is a specialized, performance-oriented editor designed for viewing, editing, and formatting structured data files. Built with Electron, a React/TypeScript frontend, and a Rust core (byte_draft), it provides a lightweight, Notepads-inspired IDE experience for developers who need to quickly work with JSON, YAML, TOML, XML, Markdown, and source files.
Features
- Tabs in Title Bar: Minimal Notepads-style chrome — tabs live directly in the title bar for maximum content space.
- Embedded Menu: App menu (
≡) replaces the native OS menu bar, giving a consistent cross-platform look. - Multi-Document Interface: Draggable, reorderable tabs with dirty-file indicators.
- Syntax Highlighting: Full token-level highlighting via CodeMirror 6 for Rust, Python, JS/TS, Go, JSON, YAML, TOML, XML, Markdown, Shell, CSS, HTML, C/C++, Java, and more.
- Markdown Live Preview: Split source/preview or preview-only mode with scroll synchronisation.
- Hex Viewer: Built-in binary/hex viewer for non-text files.
- Workspace Explorer: Folder tree sidebar with file-type icons and keyboard navigation.
- Theme System: Six built-in colour presets (Notepads Dark default, One Dark, Dracula, GitHub Dark, Solarized Dark, Gruvbox Dark) with per-colour customisation in Preferences.
- Advanced Find/Replace: Regex and case-sensitive search with match highlighting.
- Command Palette:
⌘Pfuzzy launcher for files and actions. - Session Persistence: Remembers open tabs, workspace, and theme between launches.
Getting Started
Prerequisites
- Rust 1.75+ — rustup.rs
- Node.js 20+ and npm
- Linux (Electron runtime): GTK and related libraries (typical desktop Electron deps; see Electron docs for your distro).
Development
Install UI dependencies:
cd ui && npm install
Install root and E2E dependencies (from repo root):
npm install
cd e2e && npm install && cd ..
Run the desktop app (Vite + Electron):
npm run electron:dev
Build a packaged app (Rust CLI release + Vite + Electron Forge):
npm run electron:build
Run UI unit tests:
cd ui && npm test
Version bump
The app version is shared across the Rust workspace (Cargo.toml [workspace.package]), root package.json, and ui/package.json. Bump all of them in one step:
npm run version:set -- 0.4.0
Release workflow artifacts are named bytedraft-<platform>-<major>.<minor>.<run_number> (see .gitea/workflows/release-builds.yml).
Hotkeys
| Command | macOS | Windows/Linux |
|---|---|---|
| New Tab | ⌘T |
Ctrl+T |
| Open File | ⌘O |
Ctrl+O |
| Save | ⌘S |
Ctrl+S |
| Save As | ⌘⇧S |
Ctrl+Shift+S |
| Close Tab | ⌘W |
Ctrl+W |
| Find/Replace | ⌘F |
Ctrl+F |
| Toggle Sidebar | ⌘B |
Ctrl+B |
| Command Palette | ⌘P |
Ctrl+P |
| Preferences | ⌘, |
Ctrl+, |
| App Menu | click ≡ in title bar |
click ≡ in title bar |
Architecture
┌──────────────────────────────────────────────┐
│ React 19 + Vite (ui/) │
│ ├─ TitleBar tabs + drag region + menu │
│ ├─ AppMenu embedded hamburger menu │
│ ├─ Editor CodeMirror 6 │
│ ├─ FileTree workspace sidebar + icons │
│ ├─ MarkdownPreview split / preview mode │
│ ├─ StatusBar language · encoding · pos │
│ └─ Preferences theme + editor settings │
│ Zustand stores: editorStore, uiStore, │
│ sessionStore │
└────────────────────────────────────────────┘
↓ window.api (contextBridge)
┌──────────────────────────────────────────────┐
│ Electron main + preload (electron/) │
│ Native dialogs, window chrome, IPC bridge │
└────────────────────────────────────────────┘
↓ JSON subprocess (stdin/stdout)
┌──────────────────────────────────────────────┐
│ byte_draft_desktop CLI (Rust) │
│ File · session · workspace · editor ops │
└────────────────────────────────────────────┘
↓
┌──────────────────────────────────────────────┐
│ byte_draft core (encoding, language, I/O) │
└────────────────────────────────────────────┘
Troubleshooting
Linux / WSL: File Dialogs Not Appearing
Install a portal backend and restart where applicable:
sudo apt install xdg-desktop-portal-gtk
wsl --shutdown # WSL only
macOS: Window Dragging
The title bar uses data-electron-drag-region zones. Drag from the blank strips next to the menu button or before the right-side controls (not on tabs or buttons).
Security & Auditing
audit.toml/deny.toml: Prevent insecure Rust dependencies.- Security Scan:
scripts/security-scan.ps1(PowerShell) for local audits.
License
MIT OR Apache-2.0, at your option.