Skip to content

fix(files): stop markdown reflow on open by matching placeholder wrapping to the editor - #6285

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/files-markdown-placeholder-reflow
Aug 5, 2026
Merged

fix(files): stop markdown reflow on open by matching placeholder wrapping to the editor#6285
waleedlatif1 merged 1 commit into
stagingfrom
fix/files-markdown-placeholder-reflow

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the flicker where a line's word-wrap shifts on first open/refresh of a markdown file (e.g. "…shook only a little" starts on one line, then "little" jumps down as the doc settles).
  • Root cause: collaborative files render a static placeholderHtml while the Yjs doc seeds, then swap to the live TipTap editor. The placeholder was .rich-markdown-prose only (browser-default white-space: normal), but the live editable is .ProseMirror.rich-markdown-prose, and prosemirror-view sets white-space: break-spaces and disables ligatures on .ProseMirror. Different wrapping model → identical text wraps at a different point → the visible re-wrap on the swap.
  • Fix: give the placeholder the same ProseMirror class as the live editable, so both share the exact base text layout and wrap identically. One class added; no width/scrollbar/font changes.

Type of Change

  • Bug fix

Testing

  • Traced empirically, no guesswork: confirmed prosemirror-view/style/prosemirror.css sets white-space: break-spaces + font-variant-ligatures: none on .ProseMirror, and the placeholder lacked both. Both render sites already share width (max-w-[48rem] px-8), ruling out container width; ruled out scrollbar (macOS overlay scrollbars take no layout width) and font-swap (the bug repros on refresh with the font cached).
  • Cross-checked prior art (TipTap docs/issues + inkeep/open-knowledge): inkeep's warm-HTML fallback avoids swap reflow precisely by reusing the live editor's exact classes — this mirrors that. No UX downside: the placeholder was already read-only; only its wrap model now matches the editor.
  • Visual confirmation on staging recommended after deploy.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 5, 2026 6:01am

Request Review

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit 47ee107. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds the ProseMirror class to the collaborative markdown placeholder so its whitespace and ligature behavior matches the live editor during document seeding.

  • Aligns placeholder and editor text-wrapping behavior.
  • Updates the inline comment to document why the class is required.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The placeholder receives the intended ProseMirror text-layout styles while the hidden live editor continues to seed normally, and no current selector or interaction path is disrupted by the additional class.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.tsx Adds the live editor’s base ProseMirror styling class to the temporary read-only placeholder; no actionable regression was identified.

Reviews (1): Last reviewed commit: "fix(files): stop markdown reflow on open..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 0fce535 into staging Aug 5, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/files-markdown-placeholder-reflow branch August 5, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant