feat(ui): open non-md files as plain text in editor#2
Open
hoiyada7-maker wants to merge 15 commits into
Open
Conversation
- Right-click on sidebar items now shows Copy Path and Copy Relative Path - Added hide/show titlebar toggle button in breadcrumb bar - Moved reading mode and theme buttons from titlebar to breadcrumb - Extracted ThemeButton as a standalone reusable component - Added visual separator (border-left) between view controls and file actions - Fixed MSVC build environment via .cargo/config.toml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove TAURI_SIGNING_PRIVATE_KEY requirement - Disable createUpdaterArtifacts at build time via node one-liner - Add workflow_dispatch input so release can be triggered manually - Bump actions/checkout and actions/cache to v4 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file had hardcoded Windows CC/CXX/AR/LIB paths that broke Linux and macOS CI builds. Added to .gitignore so it stays locally for dev but never reaches CI runners (which auto-detect MSVC or use system toolchain). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New Tauri command `reveal_in_file_manager`: Windows: opens parent folder for files, folder itself for dirs macOS: `open -R` to reveal in Finder Linux: xdg-open on parent dir - Context menu shows Reveal in Explorer for both files and folders Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1. Explorer panel — sidebar header renamed to EXPLORER, single rootPath replaced with a persisted multi-folder list. Existing single-folder session is auto-migrated on first load. 2. Add/close folders — FolderPlus button in header opens a folder picker and appends to the list. Each root-folder section has an X button (hover-revealed) that removes it from the panel. 3. Star icon on files — each .md file row gets a star button to the right of the stage button. Click toggles favorites, filled star when active. State persisted to localStorage. 4. Favorites section — starred files appear at the top of the panel in a collapsible Favorites section with drag-to-reorder support. New files: root-folder.tsx, favorites.tsx Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a sidebar file fails extension validation but is plain text (not binary, not oversized), the error toast now shows two actions: - "open in default app" — existing behaviour - "open as text" — loads content into editor, activates editor-only mode (preview hidden) so the file is shown like Notepad Implementation: - files.ts: extract checkBinaryAndSize helper, add validatePlainTextFile that skips extension check - LoadError: add canOpenAsText? flag set when plain-text fallback is safe - use-file-session: add loadPlainTextFile that bypasses extension guard - toast.tsx: add secondAction? prop for a second action button - app.tsx: wire "open as text" → loadPlainTextFile + setEditorOnly(true) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
e1d6250 to
ad63cd3
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… mode Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Read relative img src paths via tauri-plugin-fs and convert to base64 data URIs so images stored alongside the markdown file are visible in the preview pane. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a user clicks a non-.md file in the sidebar (e.g.
.txt,.js,.py), instead of showing only "open in default app", the error toast now offers two choices:Binary files (PDF, images, executables) still show only "open in default app" with no second option.
How it works
validatePlainTextFile— new helper that checks binary signatures + file size but ignores extensionLoadError.canOpenAsText— flag set when a refused file passes the plain-text checkloadPlainTextFile— new hook function that loads any text file bypassing extension validationToast.secondAction— new prop for a second action buttonTest plan
.txtfile → toast shows both "open in default app" and "open as text".png/.pdf→ toast shows only "open in default app" (no second option)🤖 Generated with Claude Code