click elsewhere to close edit message window

This commit is contained in:
2023-07-27 10:42:17 +08:00
parent c84be818e9
commit 196e12a4fd

View File

@@ -110,25 +110,31 @@ export default function Message(props: Props) {
className={ className={
"absolute bg-black bg-opacity-50 w-full h-full top-0 left-0 pt-5 px-5 pb-20 rounded z-10" "absolute bg-black bg-opacity-50 w-full h-full top-0 left-0 pt-5 px-5 pb-20 rounded z-10"
} }
onClick={() => setShowEdit(false)}
> >
<textarea <div className="w-full h-full z-20">
className={"relative w-full h-full"} <textarea
value={chat.content} className={"w-full h-full"}
onChange={(event: any) => { value={chat.content}
chat.content = event.target.value; onClick={(event: any) => {
chat.token = calculate_token_length(chat.content); event.stopPropagation();
setChatStore({ ...chatStore });
}}
></textarea>
<div className={"w-full flex justify-center"}>
<button
className={"m-2 p-1 rounded bg-green-500"}
onClick={() => {
setShowEdit(false);
}} }}
> onChange={(event: any) => {
Close chat.content = event.target.value;
</button> chat.token = calculate_token_length(chat.content);
setChatStore({ ...chatStore });
}}
></textarea>
<div className={"w-full flex justify-center"}>
<button
className={"m-2 p-1 rounded bg-green-500"}
onClick={() => {
setShowEdit(false);
}}
>
Close
</button>
</div>
</div> </div>
</div> </div>
)} )}