We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import React, { useMemo, useRef } from 'react'; import { Form, InputGroup } from 'react-bootstrap'; import type { FC } from 'react'; import { useTranslation } from 'react-i18next'; interface CustomFileInputProps { value: string; onChange: React.ChangeEventHandler<HTMLInputElement>; isValid?: boolean; isInvalid?: boolean; } const CustomFileInput: FC<CustomFileInputProps> = ({ onChange, value, ...rest }) => { const { t } = useTranslation('translation', { keyPrefix: 'editor' }); const fileName = useMemo(() => { return value ?? t('file_upload.text'); }, [value]); const fileRef = useRef<HTMLInputElement>(null); return ( <Form.Group> <Form.Control type="file" id="custom-file" onChange={onChange} style={{ zIndex: -1, position: 'absolute' }} // 隐藏默认控件 ref={fileRef} {...rest} /> <InputGroup className="mb-3"> <InputGroup.Text id="basic-addon1"> {t('file_upload.text')} </InputGroup.Text> <Form.Control type="text" readOnly value={fileName} aria-label={t('file_upload.text')} placeholder={t('file_upload.placeholder')} aria-describedby="basic-addon1" onClick={() => { fileRef?.current?.click?.(); }} /> </InputGroup> </Form.Group> ); }; export default CustomFileInput;
<CustomFileInput value={link.value} onChange={onUpload} isInvalid={currentTab === 'localImage' && link.isInvalid} /> {/* <Form.Control type="file" placeholder="123" prefix="234" title="title" onChange={onUpload} isInvalid={currentTab === 'localImage' && link.isInvalid} /> */}
The text was updated successfully, but these errors were encountered:
Maybe you need to reload the page after changing the language.
Sorry, something went wrong.
This is official and it seems to have a problem. You can try more times. The solution I provided above should resolve the issue.show code
No branches or pull requests
The text was updated successfully, but these errors were encountered: