Skip to content

Commit 47ee107

Browse files
committed
fix(files): stop markdown reflow on open by matching placeholder wrapping to the editor
1 parent 5718def commit 47ee107

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,10 +1198,12 @@ export function LoadedRichMarkdownEditor({
11981198
}}
11991199
/>
12001200
{showPlaceholder && placeholderHtml && (
1201-
// Instant read-only content while the collaborative doc seeds; the editor stays mounted-but-
1202-
// hidden below so it renders the seeded doc before the swap. Same layout box → no reflow.
1201+
// Instant read-only content while the collaborative doc seeds, swapped for the live editor
1202+
// once ready. The `ProseMirror` class is load-bearing: it gives the placeholder the same base
1203+
// text layout as the live editable (prosemirror-view sets `white-space: break-spaces` and
1204+
// disables ligatures), so a line wraps identically and never re-wraps on the swap.
12031205
<div
1204-
className='rich-markdown-prose mx-auto w-full max-w-[48rem] px-8 py-6'
1206+
className='ProseMirror rich-markdown-prose mx-auto w-full max-w-[48rem] px-8 py-6'
12051207
dangerouslySetInnerHTML={{ __html: placeholderHtml }}
12061208
/>
12071209
)}

0 commit comments

Comments
 (0)