@@ -38,6 +38,7 @@ function SuperDocEditorInner(props: SuperDocEditorProps, ref: ForwardedRef<Super
3838 id,
3939 renderLoading,
4040 hideToolbar = false ,
41+ contained = false ,
4142 className,
4243 style,
4344 // Callbacks (stored in ref to avoid triggering rebuilds)
@@ -149,6 +150,7 @@ function SuperDocEditorInner(props: SuperDocEditorProps, ref: ForwardedRef<Super
149150 ...( ! hideToolbar && toolbarContainerRef . current ? { toolbar : `#${ CSS . escape ( toolbarId ) } ` } : { } ) ,
150151 documentMode,
151152 role,
153+ contained,
152154 ...( documentProp != null ? { document : documentProp } : { } ) ,
153155 ...( user ? { user } : { } ) ,
154156 ...( users ? { users } : { } ) ,
@@ -224,17 +226,26 @@ function SuperDocEditorInner(props: SuperDocEditorProps, ref: ForwardedRef<Super
224226 // initial values - use getInstance() methods to change them at runtime.
225227 // Note: restProps is intentionally excluded to avoid rebuilds on every render.
226228 // documentMode is handled separately via setDocumentMode() for efficiency.
227- } , [ documentProp , user , users , modules , role , hideToolbar , containerId , toolbarId ] ) ;
229+ } , [ documentProp , user , users , modules , role , hideToolbar , contained , containerId , toolbarId ] ) ;
228230
229231 const wrapperClassName = [ 'superdoc-wrapper' , className ] . filter ( Boolean ) . join ( ' ' ) ;
230232 const hideWhenLoading : CSSProperties | undefined = isLoading ? { display : 'none' } : undefined ;
231233
234+ const wrapperStyle : CSSProperties = {
235+ ...style ,
236+ ...( contained && { display : 'flex' , flexDirection : 'column' as const } ) ,
237+ } ;
238+
232239 return (
233- < div className = { wrapperClassName } style = { style } >
240+ < div className = { wrapperClassName } style = { wrapperStyle } >
234241 { ! hideToolbar && (
235242 < div ref = { toolbarContainerRef } id = { toolbarId } className = 'superdoc-toolbar-container' style = { hideWhenLoading } />
236243 ) }
237- < div id = { containerId } className = 'superdoc-editor-container' style = { hideWhenLoading } />
244+ < div
245+ id = { containerId }
246+ className = 'superdoc-editor-container'
247+ style = { { ...hideWhenLoading , ...( contained && { flex : 1 , minHeight : 0 } ) } }
248+ />
238249 { isLoading && ! hasError && renderLoading && < div className = 'superdoc-loading-container' > { renderLoading ( ) } </ div > }
239250 { hasError && < div className = 'superdoc-error-container' > Failed to load editor. Check console for details.</ div > }
240251 </ div >
0 commit comments