Skip to content

feat(superdoc): support fixed-height container embedding with contained mode (SD-2242)#2423

Open
caio-pizzol wants to merge 13 commits intomainfrom
caio/sd-2242-support-fixed-height-container-embedding-with-scrolling
Open

feat(superdoc): support fixed-height container embedding with contained mode (SD-2242)#2423
caio-pizzol wants to merge 13 commits intomainfrom
caio/sd-2242-support-fixed-height-container-embedding-with-scrolling

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

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

@linear
Copy link
Copy Markdown

linear bot commented Mar 17, 2026

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e2b4498c7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@caio-pizzol caio-pizzol force-pushed the caio/sd-2242-support-fixed-height-container-embedding-with-scrolling branch from a1ced4d to 811b739 Compare March 18, 2026 09:42
…ed 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
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.
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.
…ewers

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.
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.
… 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.
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.
@caio-pizzol caio-pizzol force-pushed the caio/sd-2242-support-fixed-height-container-embedding-with-scrolling branch from 40e805b to f6212e6 Compare March 26, 2026 10:04
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant