Commit eec3c35
authored
fix(files): render the file-viewer placeholder through the live node views (#6379)
* fix(files): render the file-viewer placeholder through the live node views
The collaborative markdown viewer painted a static generateHTML placeholder while
the Yjs doc seeded, then swapped to the live editor. generateHTML runs only schema
renderHTML — never the React node views or the ProseMirror decoration plugins — so
every node whose live appearance comes from a node view or a decoration rendered
differently in the placeholder and visibly repainted on the swap: syntax highlighting
popped in, mention-chip icons shifted their labels, mermaid blocks jumped from source
to diagram, and media embeds appeared out of nowhere.
Render the placeholder through a read-only editor that shares the live editor's
extension set instead. It uses the same node views and decoration plugins, so the
placeholder is pixel-identical to the live editor and the swap neither repaints nor
reflows — highlighting, mention icons, images, mermaid (via its existing SVG cache),
and embeds (which already reserve their aspect-ratio box) all render up front. The
placeholder editor carries no Collaboration extension, Y.Doc, or awareness, so it
structurally cannot write to the shared document, preserving the seed-only-on-server
invariant; editable={false} disables every editing affordance.
* fix(files): address review on the placeholder editor
- Give ReadOnlyPlaceholder a named props interface (repo component convention).
- Render the placeholder synchronously (immediatelyRender: true) so it paints
instantly like the static HTML it replaced instead of blanking for a frame
while the editor mounts — safe because this surface is client-only, never SSR'd.
- Hoist the editor reading-column classes into a shared EDITOR_SURFACE_CLASS so
the placeholder and live editor stay geometrically identical (drop the now
redundant placeholderContent term from the live editor's hidden class).1 parent 3f743d4 commit eec3c35
1 file changed
Lines changed: 47 additions & 23 deletions
File tree
- apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor
Lines changed: 47 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
84 | 122 | | |
85 | 123 | | |
86 | 124 | | |
| |||
332 | 370 | | |
333 | 371 | | |
334 | 372 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
340 | 376 | | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
| 377 | + | |
| 378 | + | |
345 | 379 | | |
346 | 380 | | |
347 | 381 | | |
| |||
1197 | 1231 | | |
1198 | 1232 | | |
1199 | 1233 | | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
| 1234 | + | |
| 1235 | + | |
1209 | 1236 | | |
1210 | 1237 | | |
1211 | 1238 | | |
1212 | | - | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
| 1239 | + | |
1216 | 1240 | | |
1217 | 1241 | | |
1218 | 1242 | | |
| |||
0 commit comments