fix: prevent nodes from being unintentionally deleted by pressing the backspace key. (#21023)

This commit is contained in:
kurokobo
2025-06-17 17:11:30 +09:00
committed by GitHub
parent 19339c3de1
commit df6451076b
3 changed files with 5 additions and 2 deletions

View File

@@ -165,6 +165,7 @@ const ComponentPicker = ({
isSupportFileVar={isSupportFileVar} isSupportFileVar={isSupportFileVar}
onClose={handleClose} onClose={handleClose}
onBlur={handleClose} onBlur={handleClose}
autoFocus={false}
/> />
</div> </div>
) )

View File

@@ -61,7 +61,7 @@ export const useShortcuts = (): void => {
return !showFeaturesPanel && !isEventTargetInputArea(e.target as HTMLElement) return !showFeaturesPanel && !isEventTargetInputArea(e.target as HTMLElement)
}, [workflowStore]) }, [workflowStore])
useKeyPress(['delete', 'backspace'], (e) => { useKeyPress(['delete'], (e) => {
if (shouldHandleShortcut(e)) { if (shouldHandleShortcut(e)) {
e.preventDefault() e.preventDefault()
handleNodesDelete() handleNodesDelete()

View File

@@ -260,6 +260,7 @@ type Props = {
maxHeightClass?: string maxHeightClass?: string
onClose?: () => void onClose?: () => void
onBlur?: () => void onBlur?: () => void
autoFocus?: boolean
} }
const VarReferenceVars: FC<Props> = ({ const VarReferenceVars: FC<Props> = ({
hideSearch, hideSearch,
@@ -271,6 +272,7 @@ const VarReferenceVars: FC<Props> = ({
maxHeightClass, maxHeightClass,
onClose, onClose,
onBlur, onBlur,
autoFocus = true,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const [searchText, setSearchText] = useState('') const [searchText, setSearchText] = useState('')
@@ -323,7 +325,7 @@ const VarReferenceVars: FC<Props> = ({
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
onClear={() => setSearchText('')} onClear={() => setSearchText('')}
onBlur={onBlur} onBlur={onBlur}
autoFocus autoFocus={autoFocus}
/> />
</div> </div>
<div className='relative left-[-4px] h-[0.5px] bg-black/5' style={{ <div className='relative left-[-4px] h-[0.5px] bg-black/5' style={{