diff --git a/packages/tldraw/src/components/tldraw/tldraw.tsx b/packages/tldraw/src/components/tldraw/tldraw.tsx index 2c037b55d..17b8f8f08 100644 --- a/packages/tldraw/src/components/tldraw/tldraw.tsx +++ b/packages/tldraw/src/components/tldraw/tldraw.tsx @@ -17,6 +17,8 @@ import { StylePanel } from '~components/style-panel' import { ToolsPanel } from '~components/tools-panel' import { PagePanel } from '~components/page-panel' import { Menu } from '~components/menu' +import { breakpoints, iconButton } from '~components' +import { DotFilledIcon } from '@radix-ui/react-icons' // Selectors const isInSelectSelector = (s: Data) => s.appState.activeTool === 'select' @@ -115,11 +117,9 @@ function InnerTldraw({ }) { const { tlstate, useSelector } = useTLDrawContext() - const rTheme = React.useRef(null) - const rWrapper = React.useRef(null) - useThemeEffect(rTheme) + useThemeEffect(rWrapper) const page = useSelector(pageSelector) @@ -180,9 +180,9 @@ function InnerTldraw({ }, [currentPageId, tlstate]) return ( -
-
- +
+
+ - {!isFocusMode && ( + {isFocusMode ? ( +
+ +
+ ) : ( <>
@@ -259,13 +265,19 @@ function InnerTldraw({ } const OneOff = React.memo( - ({ rWrapper, autofocus }: { autofocus?: boolean; rWrapper: React.RefObject }) => { - useKeyboardShortcuts(rWrapper) + ({ + focusableRef, + autofocus, + }: { + autofocus?: boolean + focusableRef: React.RefObject + }) => { + useKeyboardShortcuts(focusableRef) useCustomFonts() React.useEffect(() => { if (autofocus) { - rWrapper.current?.focus() + focusableRef.current?.focus() } }, [autofocus]) @@ -315,3 +327,17 @@ const menuButtons = css({ display: 'flex', gap: 8, }) + +const unfocusButton = css({ + opacity: 1, + zIndex: 100, + backgroundColor: 'transparent', + + '& svg': { + color: '$muted', + }, + + '&:hover svg': { + color: '$text', + }, +})