test: 暂存
This commit is contained in:
@@ -4,7 +4,7 @@ import { clsx } from 'clsx';
|
||||
|
||||
type Props = {
|
||||
value?: string;
|
||||
onChange?: (evn: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
||||
onChange?: (data: string) => void;
|
||||
readonly?: boolean;
|
||||
className?: string;
|
||||
};
|
||||
@@ -13,14 +13,19 @@ export const TextArea = (props: Props) => {
|
||||
useEffect(() => {
|
||||
setCode(props.value || '');
|
||||
}, []);
|
||||
const _onChange = (value: string) => {
|
||||
setCode(value);
|
||||
props.onChange && props.onChange(value);
|
||||
};
|
||||
return (
|
||||
<div className={clsx('min-h-16 max-h-52 overflow-scroll p-1')}>
|
||||
<div className={clsx('min-h-16 max-h-52 overflow-scroll p-1 ', props.className)}>
|
||||
<CodeEditor
|
||||
value={code}
|
||||
language='js'
|
||||
className='border rounded-sm'
|
||||
readOnly={props.readonly}
|
||||
placeholder='Please enter JS code.'
|
||||
onChange={(evn) => setCode(evn.target.value)}
|
||||
onChange={(evn) => _onChange(evn.target.value)}
|
||||
padding={10}
|
||||
style={{
|
||||
backgroundColor: '#f5f5f5',
|
||||
|
||||
Reference in New Issue
Block a user