Exit edit mode when selection input is up, re-enter when it's not. (#2306)
This commit is contained in:
@ -7,6 +7,7 @@ import {
|
|||||||
getSelectionType,
|
getSelectionType,
|
||||||
getSelectionTypeDisplayText,
|
getSelectionTypeDisplayText,
|
||||||
} from 'lib/selections'
|
} from 'lib/selections'
|
||||||
|
import { kclManager } from 'lib/singletons'
|
||||||
import { modelingMachine } from 'machines/modelingMachine'
|
import { modelingMachine } from 'machines/modelingMachine'
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
@ -50,6 +51,14 @@ function CommandBarSelectionInput({
|
|||||||
inputRef.current?.focus()
|
inputRef.current?.focus()
|
||||||
}, [selection, inputRef])
|
}, [selection, inputRef])
|
||||||
|
|
||||||
|
// Exit engine's edit mode when this input step is active,
|
||||||
|
// and re-enter it when it's not.
|
||||||
|
// In future the engine's edit mode will go away and this will be handled differently.
|
||||||
|
useEffect(() => {
|
||||||
|
kclManager.exitEditMode()
|
||||||
|
return () => kclManager.enterEditMode()
|
||||||
|
}, [])
|
||||||
|
|
||||||
// Fast-forward through this arg if it's marked as skippable
|
// Fast-forward through this arg if it's marked as skippable
|
||||||
// and we have a valid selection already
|
// and we have a valid selection already
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Reference in New Issue
Block a user