Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: can not limit Chinese input lenth correctly (#947)

Qicb118149f3bd
diff --git a/packages/component/src/ui/input/Input.tsx b/packages/component/src/ui/input/Input.tsx
index 0b4610d86a..beeca9b5ef 100644
--- a/packages/component/src/ui/input/Input.tsx
+++ b/packages/component/src/ui/input/Input.tsx
@@ -19,7 +19,6 @@ type inputProps = {
onBlur?: FocusEventHandler<HTMLInputElement>;
onKeyDown?: KeyboardEventHandler<HTMLInputElement>;
};
-
export const Input = (props: inputProps) => {
const {
disabled,
@@ -35,15 +34,11 @@ export const Input = (props: inputProps) => {
} = props;
const [value, setValue] = useState<string>(valueProp || '');
const handleChange: InputHTMLAttributes<HTMLInputElement>['onChange'] = e => {
- if (
- (maxLength && e.target.value.length > maxLength) ||
- (minLength && e.target.value.length < minLength)
- ) {
- return;
- }
- setValue(e.target.value);
- onChange && onChange(e.target.value);
+ const { value } = e.target;
+ setValue(value);
+ onChange && onChange(value);
};
+
const handleBlur: InputHTMLAttributes<HTMLInputElement>['onBlur'] = e => {
onBlur && onBlur(e);
};