Skip to content

Commit 72d01d6

Browse files
erictliclaudecursoragent
authored
Refactor footer and improve commit UX (#6)
* Refactor footer and improve commit UX. - Move GitStatus to Footer component with full commit workflow - Add inline commit input (similar to search pattern) - Fix markdown syntax displaying in note titles - Place commit button next to settings for better organization - Resolve "0" rendering bug when no uncommitted changes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Improve commit UX and fix UI flickering. - Add helpful placeholder text to commit input (shows Enter/Esc shortcuts) - Replace clear button with submit button in commit input - Make commit button toggle input open/closed - Make settings shortcut (⌘,) toggle settings page - Move push button to right side with action buttons - Add grayed CloudCheck icon when synced with remote - Simplify changes text (remove confusing count) - Fix status flickering during git operations (stale-while-revalidate pattern) - Add React.memo to Footer to prevent unnecessary re-renders Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Enhance command palette, add image support, and refactor settings. Command palette improvements: add icons to commands, display first letter of note titles in serif font, conditionally show note-specific commands only when a note is selected, and remove non-working git commit command from palette (available in footer). Add image handling: support pasting images from clipboard and inserting images from disk, with automatic copying to assets folder and proper Tauri asset URL handling. Convert link editor styling from CSS classes to inline Tailwind for better maintainability. Refactor settings page: consolidate appearance and git settings into a unified editor settings section with Select component. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Add toast notifications, delete confirmations, and improve UX. - Add Sonner toast notifications with theme integration - Add delete confirmation dialogs using Radix AlertDialog - Fix copy functionality to use Tauri clipboard-manager API - Simplify git commit with automatic "Quick commit from Scratch" message - Remove commit input UI from footer for cleaner interface - Fix nbsp; display issue in command palette previews - Configure toasts with neutral theme colors at bottom-right - Add success/error toasts for copy, commit, and push operations Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * Styling General Settings * Settings and dark mode styling * Fix editor performance and note switching race conditions - Fix listener leak in file watcher causing performance degradation - Replace auto-reload with manual refresh for external changes (Cmd+R) - Add debounced refreshNotes to prevent sidebar blocking typing - Fix content saving to wrong note during flush on note switch - Fix note switching not loading new content after save - Add content comparison to distinguish rename from switch - Remove isDirty state to eliminate extra render cycles Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Address code review feedback: security, error handling, and accessibility fixes - Add re-entry guard to prevent duplicate commits in Footer - Fix markdown image/link regex order in utils.ts - Restrict assetProtocol scope in tauri.conf.json for security - Add async error handling to delete operations in CommandPalette and NoteList - Add validated numeric input handling with clamping in EditorSettingsSection - Add FileReader onerror handler and URL scheme validation in Editor - Replace direct Tauri plugin calls with invoke commands in GeneralSettingsSection - Add new Tauri commands: open_folder_dialog, reveal_in_file_manager, open_url_safe - Fix Tab navigation in Settings by removing tabIndex from Input component - Scope Tab trap to notes view only in App.tsx for accessibility - Update README and CLAUDE.md with additional keyboard shortcuts and commands Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Improve search: Tantivy for command palette, index external changes, strip markdown in preview - Add Tantivy full-text search to command palette (local state, doesn't affect sidebar) - Update file watcher to index external file changes in Tantivy - Fix fallback search to search full content, not just title/preview - Strip markdown formatting from note preview (headers, bold, italic, links, etc.) - Fix regex panic by removing unsupported look-around assertions - Add keyboard navigation improvements (stopPropagation) to command palette - Disable spellcheck/autocorrect on command palette input - Add regex dependency for markdown stripping Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove command counts from documentation Makes the documentation more maintainable by not requiring count updates when commands are added or removed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix async blocking and add cross-platform file manager support - open_folder_dialog: Wrap blocking_pick_folder in spawn_blocking to avoid blocking the async runtime - reveal_in_file_manager: Add platform-specific implementations for macOS (open -R), Windows (explorer /select), and Linux (xdg-open) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update remote instructions copy * Add guards and improve cross-platform labels - save_clipboard_image: Guard against empty base64 payloads and zero-byte decoded data to prevent creating empty files - handleAddRemote: Add isAddingRemote check to prevent concurrent submissions when user double-clicks or presses Enter multiple times - Change "Open in Finder" to platform-neutral "Open Folder" label Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix list marker regex and use async file I/O in fallback search - Add '*' to list marker regex pattern (previously only matched '-' and '+') - Convert fallback_search to async using tokio::fs::read_to_string - Update search_notes to async, properly dropping mutex before await - Adjust editor top padding Co-authored-by: Cursor <cursoragent@cursor.com> * Update Readme * Update app icon image --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 40a0e81 commit 72d01d6

38 files changed

Lines changed: 2891 additions & 1165 deletions

CLAUDE.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ scratch/
6666
│ └── main.tsx # React root & providers
6767
├── src-tauri/ # Rust backend
6868
│ ├── src/
69-
│ │ ├── lib.rs # 19 Tauri commands, state, file watcher, search
69+
│ │ ├── lib.rs # Tauri commands, state, file watcher, search
7070
│ │ └── git.rs # Git CLI wrapper (8 commands)
7171
│ ├── capabilities/default.json # Tauri permissions config
7272
│ └── Cargo.toml # Rust dependencies
@@ -92,7 +92,7 @@ All backend operations go through Tauri commands defined in `src-tauri/src/lib.r
9292
The settings page provides UI for:
9393

9494
- Theme mode (light/dark/system)
95-
- Editor typography (font family, size, bold weight)
95+
- Editor typography (font family, size, line height, bold weight)
9696
- Git integration (optional)
9797

9898
Power users can edit the settings JSON directly to customize colors.
@@ -137,7 +137,7 @@ TipTap editor with extensions and features:
137137
- `NoteList` - Scrollable list with context menu and smart date formatting
138138
- `SettingsPage` - Tabbed settings (General, Appearance, Git)
139139

140-
### Tauri Commands (19 total)
140+
### Tauri Commands
141141

142142
**Note Management:** `list_notes`, `read_note`, `save_note`, `delete_note`, `create_note`
143143

@@ -149,7 +149,9 @@ TipTap editor with extensions and features:
149149

150150
**Git:** `git_is_available`, `git_get_status`, `git_init_repo`, `git_commit`, `git_push`, `git_add_remote`, `git_push_with_upstream`
151151

152-
**Utilities:** `copy_to_clipboard`
152+
**Utilities:** `copy_to_clipboard`, `copy_image_to_assets`, `save_clipboard_image`
153+
154+
**UI Helpers:** `open_folder_dialog`, `reveal_in_file_manager`, `open_url_safe` (URL scheme validated)
153155

154156
### Search Implementation
155157

@@ -183,6 +185,9 @@ Current capabilities include:
183185
- `Cmd+N` - New note
184186
- `Cmd+P` - Command palette
185187
- `Cmd+K` - Add/edit link (when in editor)
188+
- `Cmd+R` - Reload current note (pull external changes)
189+
- `Cmd+,` - Toggle settings
190+
- `Cmd+\` - Toggle sidebar
186191
- `Cmd+B/I` - Bold/Italic
187192
- Arrow keys - Navigate note list (when focused)
188193

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
# Scratch
22

3+
<img src="docs/app-icon.png" alt="Scratch" width="128" height="128" style="border-radius: 22px; margin-bottom: 8px;">
4+
35
A minimalist, offline-first markdown note-taking app for Mac.
46

5-
![Scratch](https://img.shields.io/badge/platform-macOS-lightgrey)
7+
![macOS](https://img.shields.io/badge/platform-macOS-lightgrey)
68

79
## Features
810

911
- **Offline-first** - No cloud, no account, no internet required
1012
- **Markdown-based** - Notes stored as plain `.md` files you own
1113
- **WYSIWYG editing** - Rich text editing that saves as markdown
12-
- **Works with AI agents** - Live-syncing markdown files perfect for external editing
14+
- **Works with AI agents** - Detects external file changes and refreshes on demand
1315
- **Full-text search** - Fast search with command palette
1416
- **Git integration** - Optional version control for your notes
1517
- **Customizable** - Theme (light/dark/system) and editor typography settings
1618

19+
## Screenshot
20+
21+
![Screenshot](docs/screenshot.png)
22+
1723
## Installation
1824

1925
### From Source
@@ -45,13 +51,16 @@ The built app will be in `src-tauri/target/release/bundle/`.
4551

4652
Scratch is designed to be usable without a mouse. Here are the essentials to get started:
4753

48-
| Shortcut | Action |
49-
| --------- | --------------- |
50-
| `Cmd+N` | New note |
51-
| `Cmd+P` | Command palette |
52-
| `Cmd+K` | Add/edit link |
53-
| `Cmd+B/I` | Bold/Italic |
54-
| `↑/↓` | Navigate notes |
54+
| Shortcut | Action |
55+
| --------- | ------------------- |
56+
| `Cmd+N` | New note |
57+
| `Cmd+P` | Command palette |
58+
| `Cmd+K` | Add/edit link |
59+
| `Cmd+R` | Reload current note |
60+
| `Cmd+,` | Open settings |
61+
| `Cmd+\` | Toggle sidebar |
62+
| `Cmd+B/I` | Bold/Italic |
63+
| `↑/↓` | Navigate notes |
5564

5665
Many more shortcuts and features are available in the app—explore via the command palette (`Cmd+P`).
5766

docs/app-icon.png

237 KB
Loading

docs/screenshot.png

492 KB
Loading

package-lock.json

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
"tauri": "tauri"
1111
},
1212
"dependencies": {
13+
"@radix-ui/react-alert-dialog": "^1.1.15",
1314
"@radix-ui/react-dropdown-menu": "^2.1.16",
1415
"@radix-ui/react-tooltip": "^1.2.8",
1516
"@tauri-apps/api": "^2",
17+
"@tauri-apps/plugin-clipboard-manager": "^2.3.2",
1618
"@tauri-apps/plugin-dialog": "^2.6.0",
1719
"@tauri-apps/plugin-opener": "^2",
1820
"@tiptap/extension-image": "^3.18.0",
@@ -28,6 +30,7 @@
2830
"clsx": "^2.1.1",
2931
"react": "^19.1.0",
3032
"react-dom": "^19.1.0",
33+
"sonner": "^2.0.7",
3134
"tailwind-merge": "^3.4.0",
3235
"tippy.js": "^6.3.7"
3336
},

src-tauri/Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
1313
tauri-build = { version = "2", features = [] }
1414

1515
[dependencies]
16-
tauri = { version = "2", features = [] }
16+
tauri = { version = "2", features = ["protocol-asset"] }
1717
tauri-plugin-opener = "2"
1818
tauri-plugin-fs = "2"
1919
tauri-plugin-dialog = "2"
@@ -24,3 +24,7 @@ anyhow = "1"
2424
notify = "6"
2525
tantivy = "0.22"
2626
tokio = { version = "1", features = ["fs", "sync"] }
27+
base64 = "0.22"
28+
url = "2"
29+
open = "5"
30+
regex = "1"

src-tauri/capabilities/default.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"core:default",
88
"core:window:allow-start-dragging",
99
"opener:default",
10+
"opener:allow-open-url",
11+
"opener:allow-reveal-item-in-dir",
1012
"fs:default",
1113
"fs:allow-read",
1214
"fs:allow-write",

0 commit comments

Comments
 (0)