tldraw/hooks/useSafariFocusOutFix.ts
Steve Ruiz 74ff10bfd5 Various fixes
- Changes the brush color in dark mode
- Fixes the paste button
- Fixes a bug with pasting on mobile
- Adds a Sign Out button to the menu
- Hides the status bar in production
- Adds debug mode to preferences
- Refactors style panel
- Hides keyboard shortcuts when not on mobile
2021-07-11 13:51:01 +01:00

22 lines
529 B
TypeScript

import isMobile from 'ismobilejs'
import { useEffect } from 'react'
import state from 'state'
// Send event on iOS when a user presses the "Done" key while editing
// a text element.
function handleFocusOut() {
state.send('BLURRED_EDITING_SHAPE')
}
export default function useSafariFocusOutFix(): void {
useEffect(() => {
if (isMobile().apple) {
document.addEventListener('focusout', handleFocusOut)
return () => {
document.removeEventListener('focusout', handleFocusOut)
}
}
}, [])
}