diff --git a/examples/with-script-in-browser/components/ExampleApp.tsx b/examples/with-script-in-browser/components/ExampleApp.tsx index 7b5e192c90..365460a68b 100644 --- a/examples/with-script-in-browser/components/ExampleApp.tsx +++ b/examples/with-script-in-browser/components/ExampleApp.tsx @@ -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[], diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index 6392098640..e9b9df184b 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -2967,6 +2967,7 @@ class App extends React.Component { if (this.props.scrollConstraints) { restoredAppState = { ...restoredAppState, + scrollConstraints: this.props.scrollConstraints, ...calculateConstrainedScrollCenter(this.state, restoredAppState), }; } else if (initialData?.scrollToContent) { diff --git a/packages/excalidraw/index.tsx b/packages/excalidraw/index.tsx index c935f31468..1ce2f50d60 100644 --- a/packages/excalidraw/index.tsx +++ b/packages/excalidraw/index.tsx @@ -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}