🐛 fix sessions
This commit is contained in:
@@ -226,7 +226,10 @@ export function MarkdownEditor(): JSX.Element {
|
|||||||
parent: editorRef.current
|
parent: editorRef.current
|
||||||
})
|
})
|
||||||
viewRef.current = view
|
viewRef.current = view
|
||||||
const handleBlur = (): void => flushSession()
|
const handleBlur = (): void => {
|
||||||
|
const s = sessionRef.current
|
||||||
|
if (s && Date.now() - s.lastKeystroke >= IDLE_MS) flushSession()
|
||||||
|
}
|
||||||
window.addEventListener('blur', handleBlur)
|
window.addEventListener('blur', handleBlur)
|
||||||
return () => {
|
return () => {
|
||||||
flushSession()
|
flushSession()
|
||||||
|
|||||||
Reference in New Issue
Block a user