feat(files): smarter bullet delete/indent and untitled-file title sync#5971
feat(files): smarter bullet delete/indent and untitled-file title sync#5971mzxchandra wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Serialize fix — Untitled files — While the name still matches Reviewed by Cursor Bugbot for commit f9b2f9b. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR improves Markdown list editing and derives filenames from headings for untitled files.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/keymap.ts | Adds context-aware list-item clearing and outdenting behavior for Backspace and Enter. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/markdown-fidelity.ts | Removes nested empty list markers that can corrupt Markdown round trips while preserving safe structures. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.tsx | Debounces leading-heading extraction and forwards it to the filename derivation callback while the file remains untitled. |
| apps/sim/app/workspace/[workspaceId]/files/files.tsx | Wires heading-based automatic renaming and centralizes unique untitled Markdown filename generation. |
| apps/sim/app/workspace/[workspaceId]/files/untitled-title.ts | Defines untitled-name recognition, sanitized Markdown filename derivation, and collision handling. |
Reviews (4): Last reviewed commit: "fix(files): drop the name-to-heading see..." | Re-trigger Greptile
8a904f1 to
c2357d6
Compare
…llet heading corruption Backspace at the start of a list item now outdents a nested item or clears a top-level item to a paragraph in place instead of deleting the row and jumping the caret to the previous block; Enter on an empty nested item outdents. Empty non-trailing top-level items still collapse cleanly since they cannot round-trip as a lifted paragraph. Also strips nested empty list-item marker lines on serialize: a nested empty bullet re-parsed as a Setext heading underline, silently turning its parent line into an H2 and dropping the bullet. Top-level empty items are preserved.
While a file is still named untitled(.md), typing a leading heading auto-renames the file after it (debounced), and renaming the file first seeds a leading H1 from the new name. One-shot: coupling stops once the file has a real name, and the heading seed always prepends so existing content is never clobbered.
c2357d6 to
b5b30f6
Compare
…ck items on Backspace Addresses review findings on the list Backspace logic: - Emptiness now uses the caret block's content.size (counts inline images/mentions), not textContent, so a bullet holding only a non-text atom is no longer treated as empty and deleted. - An empty first block whose item has sibling blocks removes only that block instead of lifting the whole item out of the list.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2d39f67. Configure here.
…me during editor load The parent captures the file name at mount (before content/session finish loading) and passes it as the transition baseline, so a rename that lands in the loading window is still seen as an untitled to named transition and the leading heading seed is not skipped.
|
@cursor review |
Removes the effect that inserted a leading H1 when an untitled file was renamed. On the collaborative Files page every open client observed the untitled-to-named transition and inserted into the shared doc, producing duplicate headings; it could also re-insert a heading a user had just deleted while a rename was in flight. Seeding document content from an async rename transition is the wrong model on a shared editor. The primary direction — typing a leading heading renames a still-untitled file — is unaffected (it never mutates the doc).
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f9b2f9b. Configure here.
Summary
Two files-module improvements to the markdown editor. Based on
realtime-rooms(notstaging) so it integrates directly with the live co-editing work and lands together with it — the only overlap was additive prop wiring infiles.tsx/file-viewer.tsx/rich-markdown-editor.tsx, resolved here so that branch inherits these fixes conflict-free.Bullet delete/indent + round-trip fix (
improvement)-) serialized directly under a parent's text and re-parsed as a Setext heading underline, silently turning the parent line into an H2 and dropping the bullet. Serialize now strips nested empty list-item lines only; top-level empty items (placeholders, imported blanks) are preserved and round-trip faithfully.Untitled file → filename sync (
feat)untitled(.md), typing a leading heading auto-renames the file after it (debounced 600ms). One-shot: coupling stops once the file has a real name.Test Coverage
Round-trip-verified unit tests for every list Backspace/Enter branch and every
stripEmptyListItemLinesrule, plus the untitled→filename derivation helpers. New/updated:keymap.test.ts,markdown-fidelity.test.ts,untitled-title.test.ts,title-heading.test.ts. Full files-feature + editor-consumer suite: 652 tests pass on the rebasedrealtime-roomsbase. Typecheck + Biome clean.Review
Greptile 5/5. Cursor Bugbot findings across rounds — all resolved:
isEmptycounted only text, so a bullet holding an inline atom could be deleted → now uses the caret block'scontent.size.Test plan
realtime-roomsbase