Skip to content

Commit

Permalink
clean up fullscreen dialogs on unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
ibastawisi committed Aug 7, 2024
1 parent 3c5d1ac commit 570a7bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/editor/plugins/ToolbarPlugin/Dialogs/GraphDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ function GraphDialog({ editor, node }: { editor: LexicalEditor, node: GraphNode
closeDialog();
}

useEffect(() => {
return () => {
document.body.classList.remove('fullscreen');
}
}, []);

return <Dialog open fullScreen onClose={handleClose} disableEscapeKeyDown
TransitionProps={{
onEntered() { document.body.classList.add('fullscreen'); },
Expand Down
6 changes: 6 additions & 0 deletions src/editor/plugins/ToolbarPlugin/Dialogs/Sketch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ function SketchDialog({ editor, node }: { editor: LexicalEditor, node: ImageNode

const loading = !excalidrawAPI;

useEffect(() => {
return () => {
document.body.classList.remove('fullscreen');
}
}, []);

return <Dialog open fullScreen={true} onClose={handleClose} disableEscapeKeyDown
TransitionProps={{
onEntered() { document.body.classList.add('fullscreen') },
Expand Down

0 comments on commit 570a7bc

Please sign in to comment.