@@ -90,6 +90,12 @@ export const ModelInput: FC = ({
const [types, setTypes] = React.useState([])
const [typeVersions, setTypeVersions] = React.useState({})
const [internalValue, setInternalValue] = React.useState('')
+ const hasAttachInput =
+ typeVersions &&
+ Object.entries(typeVersions).some(([type, versions]) => {
+ if (type === 'text') return false
+ return Array.isArray(versions) && (versions.length === 0 || versions.includes(currentVersion))
+ })
// Используем внешнее значение если оно передано, иначе внутреннее
const value = externalValue !== undefined ? externalValue : internalValue
@@ -224,9 +230,7 @@ export const ModelInput: FC = ({
)}
- {typeVersions['image'] &&
- (typeVersions['image'].length === 0 ||
- typeVersions['image'].includes(currentVersion)) && (
+ {hasAttachInput && (
<>
{!blocked && (
e.stopPropagation()}
onMouseDown={(e) => e.stopPropagation()}
onKeyDown={(e) => {
+ // Иначе MUI MenuList перехватывает печатные клавиши (typeahead) и перескакивает на другую опцию
+ if (e.key !== 'Escape') {
+ e.stopPropagation()
+ }
if (e.key === 'Enter') {
e.preventDefault()
- e.stopPropagation()
if (isMediaVoice(item)) void commitRename(item)
}
}}
+ onKeyUp={(e) => {
+ if (e.key !== 'Escape') {
+ e.stopPropagation()
+ }
+ }}
aria-label='Название голоса'
autoFocus
/>