Removed function that prevents esc on codeAreaModal
This commit is contained in:
parent
b4aa109b0b
commit
fddfbfe23d
1 changed files with 66 additions and 74 deletions
|
|
@ -146,83 +146,75 @@ export default function CodeAreaModal({
|
||||||
setCode(value);
|
setCode(value);
|
||||||
}, [value, open]);
|
}, [value, open]);
|
||||||
|
|
||||||
const handlePreventEsc = (e: React.KeyboardEvent) => {
|
|
||||||
if (e.key === "Escape") {
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onKeyDown={(e) => handlePreventEsc(e)}>
|
<BaseModal open={open} setOpen={setOpen}>
|
||||||
<BaseModal open={open} setOpen={setOpen}>
|
<BaseModal.Trigger>{children}</BaseModal.Trigger>
|
||||||
<BaseModal.Trigger>{children}</BaseModal.Trigger>
|
<BaseModal.Header description={CODE_PROMPT_DIALOG_SUBTITLE}>
|
||||||
<BaseModal.Header description={CODE_PROMPT_DIALOG_SUBTITLE}>
|
<span className="pr-2"> {EDIT_CODE_TITLE} </span>
|
||||||
<span className="pr-2"> {EDIT_CODE_TITLE} </span>
|
<IconComponent
|
||||||
<IconComponent
|
name="prompts"
|
||||||
name="prompts"
|
className="h-6 w-6 pl-1 text-primary "
|
||||||
className="h-6 w-6 pl-1 text-primary "
|
aria-hidden="true"
|
||||||
aria-hidden="true"
|
/>
|
||||||
/>
|
</BaseModal.Header>
|
||||||
</BaseModal.Header>
|
<BaseModal.Content>
|
||||||
<BaseModal.Content>
|
<Input
|
||||||
<Input
|
value={code}
|
||||||
value={code}
|
readOnly
|
||||||
readOnly
|
className="absolute left-[500%] top-[500%]"
|
||||||
className="absolute left-[500%] top-[500%]"
|
id="codeValue"
|
||||||
id="codeValue"
|
/>
|
||||||
/>
|
<div className="flex h-full w-full flex-col transition-all">
|
||||||
<div className="flex h-full w-full flex-col transition-all">
|
<div className="h-full w-full">
|
||||||
<div className="h-full w-full">
|
<AceEditor
|
||||||
<AceEditor
|
readOnly={readonly}
|
||||||
readOnly={readonly}
|
value={code}
|
||||||
value={code}
|
mode="python"
|
||||||
mode="python"
|
setOptions={{ fontFamily: "monospace" }}
|
||||||
setOptions={{ fontFamily: "monospace" }}
|
height={height ?? "100%"}
|
||||||
height={height ?? "100%"}
|
highlightActiveLine={true}
|
||||||
highlightActiveLine={true}
|
showPrintMargin={false}
|
||||||
showPrintMargin={false}
|
fontSize={14}
|
||||||
fontSize={14}
|
showGutter
|
||||||
showGutter
|
enableLiveAutocompletion
|
||||||
enableLiveAutocompletion
|
theme={dark ? "twilight" : "github"}
|
||||||
theme={dark ? "twilight" : "github"}
|
name="CodeEditor"
|
||||||
name="CodeEditor"
|
onChange={(value) => {
|
||||||
onChange={(value) => {
|
setCode(value);
|
||||||
setCode(value);
|
}}
|
||||||
}}
|
className="h-full w-full rounded-lg border-[1px] border-gray-300 custom-scroll dark:border-gray-600"
|
||||||
className="h-full w-full rounded-lg border-[1px] border-gray-300 custom-scroll dark:border-gray-600"
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
<div
|
||||||
<div
|
className={
|
||||||
className={
|
"whitespace-break-spaces transition-all delay-500" +
|
||||||
"whitespace-break-spaces transition-all delay-500" +
|
(error?.detail?.error !== undefined ? "h-2/6" : "h-0")
|
||||||
(error?.detail?.error !== undefined ? "h-2/6" : "h-0")
|
}
|
||||||
}
|
>
|
||||||
>
|
<div className="mt-1 h-full max-h-[10rem] w-full overflow-y-auto overflow-x-clip text-left custom-scroll">
|
||||||
<div className="mt-1 h-full max-h-[10rem] w-full overflow-y-auto overflow-x-clip text-left custom-scroll">
|
<h1 className="text-lg text-destructive">
|
||||||
<h1 className="text-lg text-destructive">
|
{error?.detail?.error}
|
||||||
{error?.detail?.error}
|
</h1>
|
||||||
</h1>
|
<div className="ml-2 w-full text-sm text-status-red word-break-break-word">
|
||||||
<div className="ml-2 w-full text-sm text-status-red word-break-break-word">
|
<span className="w-full word-break-break-word">
|
||||||
<span className="w-full word-break-break-word">
|
{error?.detail?.traceback}
|
||||||
{error?.detail?.traceback}
|
</span>
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex h-fit w-full justify-end">
|
|
||||||
<Button
|
|
||||||
className="mt-3"
|
|
||||||
onClick={handleClick}
|
|
||||||
type="submit"
|
|
||||||
id="checkAndSaveBtn"
|
|
||||||
disabled={readonly}
|
|
||||||
>
|
|
||||||
Check & Save
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</BaseModal.Content>
|
<div className="flex h-fit w-full justify-end">
|
||||||
</BaseModal>
|
<Button
|
||||||
</div>
|
className="mt-3"
|
||||||
|
onClick={handleClick}
|
||||||
|
type="submit"
|
||||||
|
id="checkAndSaveBtn"
|
||||||
|
disabled={readonly}
|
||||||
|
>
|
||||||
|
Check & Save
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</BaseModal.Content>
|
||||||
|
</BaseModal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue