@@ -7,7 +7,8 @@ import _ from 'es-toolkit/compat';
77import Preview from './Preview' ;
88import Editor from './Editor' ;
99import SyncStatus from '@tdev-components/SyncStatus' ;
10- import { mdiCircleEditOutline , mdiClose , mdiLoading } from '@mdi/js' ;
10+ import RequestFullscreen from '@tdev-components/shared/RequestFullscreen' ;
11+ import { mdiCircleEditOutline , mdiClose , mdiFullscreen , mdiFullscreenExit , mdiLoading } from '@mdi/js' ;
1112import clsx from 'clsx' ;
1213import Button from '@tdev-components/shared/Button' ;
1314import type { LibraryItems } from '@excalidraw/excalidraw/types' ;
@@ -17,6 +18,7 @@ import PermissionsPanel from '@tdev-components/PermissionsPanel';
1718import { useDocument } from '@tdev-hooks/useDocument' ;
1819import { useClientLib } from '@tdev-hooks/useClientLib' ;
1920import { MetaInit , ModelMeta } from '@tdev/excalidoc/model/ModelMeta' ;
21+ import { useStore } from '@tdev-hooks/useStore' ;
2022
2123export const DEFAULT_HEIGHT = '600px' as const ;
2224export const mdiExcalidraw =
@@ -62,11 +64,13 @@ export const ExcalidocComponent = observer(
6264 }
6365 ) => {
6466 const [ edit , setEdit ] = React . useState ( false ) ;
67+ const viewStore = useStore ( 'viewStore' ) ;
6568 const Lib = useClientLib < typeof ExcalidrawLib > (
6669 ( ) => import ( '@excalidraw/excalidraw' ) ,
6770 '@excalidraw/excalidraw'
6871 ) ;
6972 const doc = useDocument < 'excalidoc' > ( props . documentId ) ;
73+ const id = React . useId ( ) ;
7074 const onEdit = React . useCallback (
7175 ( edit : boolean ) => {
7276 setEdit ( edit ) ;
@@ -100,7 +104,8 @@ export const ExcalidocComponent = observer(
100104 return (
101105 < div
102106 style = { { height : props . height || DEFAULT_HEIGHT , width : '100%' } }
103- className = { clsx ( styles . excalidraw ) }
107+ className = { clsx ( styles . excalidraw , viewStore . isFullscreenTarget ( id ) && styles . fullscreen ) }
108+ id = { id }
104109 >
105110 < div className = { styles . actions } >
106111 < SyncStatus model = { doc } />
@@ -116,14 +121,18 @@ export const ExcalidocComponent = observer(
116121 />
117122 ) }
118123 { edit && (
119- < Button
120- onClick = { ( ) => {
121- onEdit ( false ) ;
122- } }
123- icon = { mdiClose }
124- color = "red"
125- title = "Bearbeitung beenden"
126- />
124+ < >
125+ < RequestFullscreen targetId = { id } />
126+ < Button
127+ onClick = { ( ) => {
128+ onEdit ( false ) ;
129+ viewStore . exitFullscreen ( ) ;
130+ } }
131+ icon = { mdiClose }
132+ color = "red"
133+ title = "Bearbeitung beenden"
134+ />
135+ </ >
127136 ) }
128137 </ div >
129138 < Editor
0 commit comments