forward scrollConstraints prop from Excalidraw to App + fixed example app

This commit is contained in:
barnabasmolnar
2026-04-08 00:04:20 +02:00
parent fe3ba884f6
commit 6021adab73
3 changed files with 4 additions and 1 deletions
@@ -178,7 +178,7 @@ export default function ExampleApp({
const newElement = cloneElement(
Excalidraw,
{
excalidrawAPI: (api: ExcalidrawImperativeAPI) => setExcalidrawAPI(api),
onExcalidrawAPI: (api: ExcalidrawImperativeAPI | null) => setExcalidrawAPI(api),
initialData: initialStatePromiseRef.current.promise,
onChange: (
elements: NonDeletedExcalidrawElement[],
+1
View File
@@ -2967,6 +2967,7 @@ class App extends React.Component<AppProps, AppState> {
if (this.props.scrollConstraints) {
restoredAppState = {
...restoredAppState,
scrollConstraints: this.props.scrollConstraints,
...calculateConstrainedScrollCenter(this.state, restoredAppState),
};
} else if (initialData?.scrollToContent) {
+2
View File
@@ -98,6 +98,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
aiEnabled,
showDeprecatedFonts,
renderScrollbars,
scrollConstraints,
} = props;
const canvasActions = props.UIOptions?.canvasActions;
@@ -208,6 +209,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
aiEnabled={aiEnabled !== false}
showDeprecatedFonts={showDeprecatedFonts}
renderScrollbars={renderScrollbars}
scrollConstraints={scrollConstraints}
>
{children}
</App>