mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: add composition checkout when input create workspace name, fixed… (#1035)
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
useState,
|
||||
FocusEventHandler,
|
||||
KeyboardEventHandler,
|
||||
HTMLAttributes,
|
||||
} from 'react';
|
||||
import { StyledInput } from './style';
|
||||
|
||||
@@ -18,20 +19,20 @@ type inputProps = {
|
||||
onChange?: (value: string) => void;
|
||||
onBlur?: FocusEventHandler<HTMLInputElement>;
|
||||
onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
|
||||
};
|
||||
export const Input = (props: inputProps) => {
|
||||
const {
|
||||
disabled,
|
||||
value: valueProp,
|
||||
placeholder,
|
||||
maxLength,
|
||||
minLength,
|
||||
height,
|
||||
width = 260,
|
||||
onChange,
|
||||
onBlur,
|
||||
onKeyDown,
|
||||
} = props;
|
||||
} & Omit<HTMLAttributes<HTMLInputElement>, 'onChange'>;
|
||||
export const Input = ({
|
||||
disabled,
|
||||
value: valueProp,
|
||||
placeholder,
|
||||
maxLength,
|
||||
minLength,
|
||||
height,
|
||||
width = 260,
|
||||
onChange,
|
||||
onBlur,
|
||||
onKeyDown,
|
||||
...otherProps
|
||||
}: inputProps) => {
|
||||
const [value, setValue] = useState<string>(valueProp || '');
|
||||
const handleChange: InputHTMLAttributes<HTMLInputElement>['onChange'] = e => {
|
||||
const { value } = e.target;
|
||||
@@ -61,6 +62,7 @@ export const Input = (props: inputProps) => {
|
||||
onBlur={handleBlur}
|
||||
onKeyDown={handleKeyDown}
|
||||
height={height}
|
||||
{...otherProps}
|
||||
></StyledInput>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user