mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
#34 made local comment form uploads
This commit is contained in:
parent
f45e34f330
commit
051b199d5d
14 changed files with 422 additions and 189 deletions
|
@ -6,7 +6,7 @@ import React, {
|
|||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
useState
|
||||
} from 'react';
|
||||
import classNames from 'classnames';
|
||||
import autosize from 'autosize';
|
||||
|
@ -59,14 +59,21 @@ const Textarea = memo<IProps>(
|
|||
const onFocus = useCallback(() => setFocused(true), [setFocused]);
|
||||
const onBlur = useCallback(() => setFocused(false), [setFocused]);
|
||||
|
||||
useEffect(() => {
|
||||
const target = ref?.current;
|
||||
if (!target) return;
|
||||
|
||||
autosize(target);
|
||||
setRef(target);
|
||||
|
||||
return () => autosize.destroy(target);
|
||||
}, [ref, setRef]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!ref.current) return;
|
||||
|
||||
autosize(ref.current);
|
||||
setRef(ref.current);
|
||||
|
||||
return () => autosize.destroy(ref.current);
|
||||
}, [ref.current]);
|
||||
autosize.update(ref.current);
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
@ -89,7 +96,7 @@ const Textarea = memo<IProps>(
|
|||
onFocus={onFocus}
|
||||
onBlur={onBlur}
|
||||
style={{
|
||||
maxHeight: maxRows * 20,
|
||||
// maxHeight: maxRows * 20,
|
||||
minHeight: minRows * 20,
|
||||
}}
|
||||
{...props}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue