Commit 91feebf
authored
feat(superdoc): support fixed-height container embedding with contained mode (SD-2242) (#2423)
* feat(superdoc): support fixed-height container embedding with contained mode
SD-2242: Add `contained` option that enables SuperDoc to scroll within a
fixed-height parent container. When `contained: true`, height propagates
through the DOM chain and `.super-editor-container` becomes the scroll
container with `overflow: auto`.
Key changes:
- New `contained` boolean in Config type and React props
- CSS height chain: .superdoc--contained → layers → document → sub-document
- .super-editor-container.contained becomes scroll container (overflow: auto)
- .super-editor overflow changed from hidden to visible in contained mode
- CommentsLayer switched to position: absolute with pointer-events: none
in contained mode to avoid blocking scroll and taking flow space
- React wrapper conditionally sets height: 100% on editor container
* docs: add contained mode configuration to SuperDoc and React docs
Document the new `contained` option in both the vanilla SuperDoc
configuration page and the React component configuration page,
with usage examples showing fixed-height container embedding.
* fix(react): use flex layout for contained mode to account for toolbar
When contained mode is active with a visible toolbar, height: 100%
on the editor container would overflow. Switch to flex layout so
toolbar and editor share the fixed-height wrapper properly.
* feat(superdoc): add contained mode scroll support for PDF and HTML viewers
The sub-document container gets overflow: auto in contained mode so
PDF and HTML documents scroll within fixed-height containers, not
just DOCX. SuperEditor already manages its own scroll container.
* fix(react): resolve type-check error for contained prop access
The contained property is defined via JSDoc in superdoc's types and
may not appear in generated .d.ts files. Use a type assertion instead
of accessing restProps.contained directly.
* chore: add pre-commit type-check hook for React package
* fix(superdoc): restore pointer-events on comment anchors in contained mode
The comments layer has pointer-events: none in contained mode to let
scroll events pass through, but this also disables comment highlight
clicks. Re-enable pointer-events on .sd-comment-anchor so comments
remain interactive.
* docs: update AGENTS.md and docs snippet to use contained mode
Add contained mode section to AGENTS.md for AI agent consumers.
Simplify the docs embed component by replacing manual CSS height/
overflow hacks with contained: true.
* docs: add contained mode section to CLAUDE.md
* docs(create): add contained option to AGENTS.md config table
* docs(react): add contained mode section to AGENTS.md and CLAUDE.md
* refactor(react): make contained an explicit React prop
Instead of accessing contained through restProps with an unsafe cast,
add it to ReactProps interface and destructure it like hideToolbar.
This gives TypeScript users autocomplete and removes the cast.
* fix(react): resolve type-check error from empty @types/minimatch
The root node_modules/@types/minimatch is an empty shell with no .d.ts
files. TypeScript auto-discovers all @types/* packages and fails on it.
Set explicit types in tsconfig to only include react and react-dom.
* fix(react): address review findings for contained prop
- Pass contained unconditionally (always boolean, no need for spread)
- Add contained to useEffect dep array so toggling triggers rebuild1 parent d34ec3f commit 91feebf
14 files changed
Lines changed: 167 additions & 16 deletions
File tree
- apps
- create/src
- docs
- core
- react
- superdoc
- snippets/components
- packages
- react
- src
- super-editor/src/editors/v1/components
- superdoc
- src
- assets/styles/elements
- core/types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
81 | 98 | | |
82 | 99 | | |
83 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
398 | 434 | | |
399 | 435 | | |
400 | 436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 155 | + | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | 160 | | |
168 | 161 | | |
169 | 162 | | |
170 | 163 | | |
171 | 164 | | |
172 | 165 | | |
173 | | - | |
174 | 166 | | |
175 | 167 | | |
176 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
48 | 63 | | |
49 | 64 | | |
50 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| 153 | + | |
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
| |||
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
227 | | - | |
| 229 | + | |
228 | 230 | | |
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
232 | 239 | | |
233 | | - | |
| 240 | + | |
234 | 241 | | |
235 | 242 | | |
236 | 243 | | |
237 | | - | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
238 | 249 | | |
239 | 250 | | |
240 | 251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
139 | 143 | | |
140 | 144 | | |
141 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
1264 | 1268 | | |
1265 | 1269 | | |
1266 | 1270 | | |
1267 | | - | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
1268 | 1276 | | |
1269 | 1277 | | |
1270 | 1278 | | |
| |||
1403 | 1411 | | |
1404 | 1412 | | |
1405 | 1413 | | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
1406 | 1430 | | |
0 commit comments