✨ (codeAreaModal/index.tsx): add event listener to prevent the Escape key from closing the modal
📝 (codeAreaModal/index.tsx): improve code readability by adding line breaks and indentation for better code organization
This commit is contained in:
parent
ced448c7ae
commit
35198a3abb
1 changed files with 74 additions and 66 deletions
|
|
@ -146,7 +146,14 @@ export default function CodeAreaModal({
|
|||
setCode(value);
|
||||
}, [value, open]);
|
||||
|
||||
const handlePreventEsc = (e: React.KeyboardEvent) => {
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div onKeyDown={(e) => handlePreventEsc(e)}>
|
||||
<BaseModal open={open} setOpen={setOpen}>
|
||||
<BaseModal.Trigger>{children}</BaseModal.Trigger>
|
||||
<BaseModal.Header description={CODE_PROMPT_DIALOG_SUBTITLE}>
|
||||
|
|
@ -216,5 +223,6 @@ export default function CodeAreaModal({
|
|||
</div>
|
||||
</BaseModal.Content>
|
||||
</BaseModal>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue