forward scrollConstraints prop from Excalidraw to App + fixed example app
This commit is contained in:
@@ -178,7 +178,7 @@ export default function ExampleApp({
|
|||||||
const newElement = cloneElement(
|
const newElement = cloneElement(
|
||||||
Excalidraw,
|
Excalidraw,
|
||||||
{
|
{
|
||||||
excalidrawAPI: (api: ExcalidrawImperativeAPI) => setExcalidrawAPI(api),
|
onExcalidrawAPI: (api: ExcalidrawImperativeAPI | null) => setExcalidrawAPI(api),
|
||||||
initialData: initialStatePromiseRef.current.promise,
|
initialData: initialStatePromiseRef.current.promise,
|
||||||
onChange: (
|
onChange: (
|
||||||
elements: NonDeletedExcalidrawElement[],
|
elements: NonDeletedExcalidrawElement[],
|
||||||
|
|||||||
@@ -2967,6 +2967,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
if (this.props.scrollConstraints) {
|
if (this.props.scrollConstraints) {
|
||||||
restoredAppState = {
|
restoredAppState = {
|
||||||
...restoredAppState,
|
...restoredAppState,
|
||||||
|
scrollConstraints: this.props.scrollConstraints,
|
||||||
...calculateConstrainedScrollCenter(this.state, restoredAppState),
|
...calculateConstrainedScrollCenter(this.state, restoredAppState),
|
||||||
};
|
};
|
||||||
} else if (initialData?.scrollToContent) {
|
} else if (initialData?.scrollToContent) {
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
|||||||
aiEnabled,
|
aiEnabled,
|
||||||
showDeprecatedFonts,
|
showDeprecatedFonts,
|
||||||
renderScrollbars,
|
renderScrollbars,
|
||||||
|
scrollConstraints,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const canvasActions = props.UIOptions?.canvasActions;
|
const canvasActions = props.UIOptions?.canvasActions;
|
||||||
@@ -208,6 +209,7 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
|
|||||||
aiEnabled={aiEnabled !== false}
|
aiEnabled={aiEnabled !== false}
|
||||||
showDeprecatedFonts={showDeprecatedFonts}
|
showDeprecatedFonts={showDeprecatedFonts}
|
||||||
renderScrollbars={renderScrollbars}
|
renderScrollbars={renderScrollbars}
|
||||||
|
scrollConstraints={scrollConstraints}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</App>
|
</App>
|
||||||
|
|||||||
Reference in New Issue
Block a user