mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-11-14 17:54:47 +01:00
allow host app to control form factor and ui mode
This commit is contained in:
@@ -753,8 +753,16 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
const userAgentDescriptor = createUserAgentDescriptor(
|
const userAgentDescriptor = createUserAgentDescriptor(
|
||||||
typeof navigator !== "undefined" ? navigator.userAgent : "",
|
typeof navigator !== "undefined" ? navigator.userAgent : "",
|
||||||
);
|
);
|
||||||
|
// allow host app to control formFactor and desktopUIMode via props
|
||||||
this.editorInterface = updateObject(this.editorInterface, {
|
this.editorInterface = updateObject(this.editorInterface, {
|
||||||
desktopUIMode: storedDesktopUIMode ?? this.editorInterface.desktopUIMode,
|
desktopUIMode:
|
||||||
|
typeof props.desktopUIMode !== "undefined"
|
||||||
|
? props.desktopUIMode
|
||||||
|
: storedDesktopUIMode ?? this.editorInterface.desktopUIMode,
|
||||||
|
formFactor:
|
||||||
|
typeof props.formFactor !== "undefined"
|
||||||
|
? props.formFactor
|
||||||
|
: this.editorInterface.formFactor,
|
||||||
userAgent: userAgentDescriptor,
|
userAgent: userAgentDescriptor,
|
||||||
});
|
});
|
||||||
this.stylesPanelMode = deriveStylesPanelMode(this.editorInterface);
|
this.stylesPanelMode = deriveStylesPanelMode(this.editorInterface);
|
||||||
|
|||||||
@@ -691,6 +691,12 @@ export type AppProps = Merge<
|
|||||||
isCollaborating: boolean;
|
isCollaborating: boolean;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
aiEnabled: boolean;
|
aiEnabled: boolean;
|
||||||
|
/**
|
||||||
|
* Optionally control the editor form factor and desktop UI mode from the host app.
|
||||||
|
* If not provided, we will take care of it internally.
|
||||||
|
*/
|
||||||
|
formFactor?: EditorInterface["formFactor"];
|
||||||
|
desktopUIMode?: EditorInterface["desktopUIMode"];
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user