fix: code editor readonly can get focus

This commit is contained in:
Joel 2024-03-27 13:49:22 +08:00
parent 9eff8715fb
commit 794c57b938

View File

@ -86,6 +86,7 @@ const CodeEditor: FC<Props> = ({
isFocus={isFocus}
minHeight={200}
>
<>
{/* https://www.npmjs.com/package/@monaco-editor/react */}
<Editor
className='h-full'
@ -107,6 +108,9 @@ const CodeEditor: FC<Props> = ({
}}
onMount={handleEditorDidMount}
/>
{/* mask to disable focus but left space to scroll and resize panel */}
{readOnly && <div className='absolute left-0 top-0 right-[10px] bottom-[12px] z-10'></div>}
</>
</Base>
</div>
)