Commit Graph

10 Commits

Author SHA1 Message Date
39761b4ce7 fix: lock sidebar width and add rendered markdown preview
Sidebar overflowed horizontally on long file/folder names, which broke
vertical scrolling too — locked width with min/max-width plus
overflow-x: hidden, and truncate folder names with ellipsis.

Documents now open in a rendered preview (marked + DOMPurify) by
default, with an 编辑/预览 toggle to switch to the CodeMirror source view.
2026-08-01 18:30:50 +08:00
954b9bede4 fix: add image preview and replace Monaco with CodeMirror 6
Markdown and image previews were rendering blank because
@monaco-editor/react loads its core assets from cdn.jsdelivr.net at
runtime, which the deployment server's network can't reach. Switching
to @uiw/react-codemirror removes the CDN dependency entirely (all
assets ship in the build) and cuts bundle size from ~2.5MB to ~770KB.

Also add proper image/* content-type detection so images render via
<img> instead of being force-decoded as editor text.
2026-08-01 18:12:19 +08:00
542361c63a fix: natural-sort file tree, indent nested folders, fix editor layout
Also add a reindex endpoint and button to rebuild the Meilisearch
index from files already on disk, without needing to re-upload them.
2026-08-01 17:32:32 +08:00
4a6fdaf994 feat: support uploading entire folders
Adds a folder picker (webkitdirectory) and drag-and-drop directory
support (File System Entries API), preserving relative paths via
a new optional relative_path field on the upload endpoint.
2026-08-01 16:30:29 +08:00
9ef22f9f0a Fix wave 2: CORS default, path traversal, delete UI, shared clients, bucket check
- Default CORS_ORIGINS to http://localhost:5173 instead of "*" (still overridable)
- Reject ".." and leading "/" in document keys/paths across get/save/delete/upload,
  mapped to HTTP 400 via new InvalidPathError
- Add a delete button to DocumentEditor wired to deleteDocument + onDeleted,
  giving the existing DELETE API an actual UI entry point
- Share a single lru_cache'd Meilisearch (and Minio) SDK client instance instead
  of constructing duplicates in dependencies.py
- Add a startup check that creates the MinIO bucket if missing, tolerating
  MinIO being unreachable at boot without crashing the app
2026-08-01 09:15:16 +08:00
7e218b5738 fix: repair build, preserve unsaved edits on save failure, fix search/upload UX gaps
- client.test.ts: use globalThis.fetch instead of global.fetch and drop the
  unused describe import, fixing the broken `npm run build`
- DocumentEditor: separate load-error (replaces view) from save-error (shown
  inline, editor and unsaved content stay mounted so a failed save no longer
  destroys in-progress edits); expose dirty state via onDirtyChange
- App: prompt via window.confirm before switching documents while dirty;
  increment a refreshKey on successful upload so FileExplorer re-fetches the
  tree; track isSearching so the "no results" overlay doesn't flash during
  the search debounce window
- FileExplorer: accept a refreshKey prop to force a root-listing re-fetch
- SearchBar: convert to a controlled component (value prop) so App can clear
  the input after jumping to a search result, fixing input/state desync
- UploadButton: surface upload failures inline instead of swallowing the
  rejected promise, and keep the modal open for retry
2026-08-01 08:59:49 +08:00
90f3784ffa feat: add UploadButton with click-to-select and drag-and-drop 2026-08-01 02:54:05 +08:00
10b2b575d9 feat: add debounced SearchBar and highlighted SearchResults 2026-08-01 02:51:55 +08:00
e341a56fb2 feat: add DocumentEditor with dirty tracking and save 2026-08-01 02:47:29 +08:00
020ddac994 feat: add FileExplorer with lazy-loaded folder tree 2026-08-01 02:45:35 +08:00