Skip to content

Commit

Permalink
style: 类型风格变更
Browse files Browse the repository at this point in the history
  • Loading branch information
defaultjacky committed Dec 20, 2024
1 parent 43d7651 commit 5320f28
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions components/sender/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ function Sender(props: SenderProps, ref: React.Ref<HTMLDivElement>) {
value,
});

const triggerValueChange = (nextValue: string, e?: React.ChangeEvent<HTMLTextAreaElement>) => {
const triggerValueChange: SenderProps['onChange'] = (nextValue, event) => {
setInnerValue(nextValue);

if (onChange) {
onChange(nextValue, e);
onChange(nextValue, event);
}
};

Expand Down Expand Up @@ -300,10 +300,11 @@ function Sender(props: SenderProps, ref: React.Ref<HTMLDivElement>) {
className={classnames(inputCls, contextConfig.classNames.input, classNames.input)}
autoSize={{ maxRows: 8 }}
value={innerValue}
onChange={(e) => {
if (e.target instanceof HTMLTextAreaElement) {
triggerValueChange(e.target.value, e as React.ChangeEvent<HTMLTextAreaElement>);
}
onChange={(event) => {
triggerValueChange(
(event.target as HTMLTextAreaElement).value,
event as React.ChangeEvent<HTMLTextAreaElement>,
);
triggerSpeech(true);
}}
onPressEnter={onInternalKeyPress}
Expand Down

0 comments on commit 5320f28

Please sign in to comment.