mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Merge remote-tracking branch 'origin/release' into danieljgeiger-mathjax
This commit is contained in:
commit
59e74f94e6
41 changed files with 1066 additions and 612 deletions
|
@ -294,15 +294,12 @@ const deviceContextInitialValue = {
|
|||
};
|
||||
const DeviceContext = React.createContext<Device>(deviceContextInitialValue);
|
||||
DeviceContext.displayName = "DeviceContext";
|
||||
export const useDevice = () => useContext<Device>(DeviceContext);
|
||||
|
||||
export const ExcalidrawContainerContext = React.createContext<{
|
||||
container: HTMLDivElement | null;
|
||||
id: string | null;
|
||||
}>({ container: null, id: null });
|
||||
ExcalidrawContainerContext.displayName = "ExcalidrawContainerContext";
|
||||
export const useExcalidrawContainer = () =>
|
||||
useContext(ExcalidrawContainerContext);
|
||||
|
||||
const ExcalidrawElementsContext = React.createContext<
|
||||
readonly NonDeletedExcalidrawElement[]
|
||||
|
@ -320,7 +317,9 @@ ExcalidrawAppStateContext.displayName = "ExcalidrawAppStateContext";
|
|||
|
||||
const ExcalidrawSetAppStateContext = React.createContext<
|
||||
React.Component<any, AppState>["setState"]
|
||||
>(() => {});
|
||||
>(() => {
|
||||
console.warn("unitialized ExcalidrawSetAppStateContext context!");
|
||||
});
|
||||
ExcalidrawSetAppStateContext.displayName = "ExcalidrawSetAppStateContext";
|
||||
|
||||
const ExcalidrawActionManagerContext = React.createContext<ActionManager>(
|
||||
|
@ -328,6 +327,9 @@ const ExcalidrawActionManagerContext = React.createContext<ActionManager>(
|
|||
);
|
||||
ExcalidrawActionManagerContext.displayName = "ExcalidrawActionManagerContext";
|
||||
|
||||
export const useDevice = () => useContext<Device>(DeviceContext);
|
||||
export const useExcalidrawContainer = () =>
|
||||
useContext(ExcalidrawContainerContext);
|
||||
export const useExcalidrawElements = () =>
|
||||
useContext(ExcalidrawElementsContext);
|
||||
export const useExcalidrawAppState = () =>
|
||||
|
@ -586,8 +588,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||
this.scene.getNonDeletedElements(),
|
||||
this.state,
|
||||
);
|
||||
const { onCollabButtonClick, renderTopRightUI, renderCustomStats } =
|
||||
this.props;
|
||||
const { renderTopRightUI, renderCustomStats } = this.props;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@ -629,7 +630,6 @@ class App extends React.Component<AppProps, AppState> {
|
|||
setAppState={this.setAppState}
|
||||
actionManager={this.actionManager}
|
||||
elements={this.scene.getNonDeletedElements()}
|
||||
onCollabButtonClick={onCollabButtonClick}
|
||||
onLockToggle={this.toggleLock}
|
||||
onPenModeToggle={this.togglePenMode}
|
||||
onInsertElements={(elements) =>
|
||||
|
@ -655,6 +655,8 @@ class App extends React.Component<AppProps, AppState> {
|
|||
id={this.id}
|
||||
onImageAction={this.onImageAction}
|
||||
renderWelcomeScreen={
|
||||
!this.state.isLoading &&
|
||||
this.props.UIOptions.welcomeScreen &&
|
||||
this.state.showWelcomeScreen &&
|
||||
this.state.activeTool.type === "selection" &&
|
||||
!this.scene.getElementsIncludingDeleted().length
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue