This commit is contained in:
dengqichen 2024-12-27 13:39:47 +08:00
parent e86ef25e6d
commit 267afbf468
2 changed files with 28 additions and 9 deletions

View File

@ -95,4 +95,24 @@
line-height: 1;
content: '*';
}
.monaco-editor {
border-radius: 2px;
border: 1px solid #d9d9d9;
}
}
.fullscreen-modal {
:global {
.ant-modal {
max-width: 100vw;
margin: 0;
padding: 0;
top: 0 !important;
}
.ant-modal-content {
height: 100vh;
border-radius: 0;
}
}
}

View File

@ -21,7 +21,7 @@ const CodePreviewModal: React.FC<{
}> = ({open, onCancel, code, language = 'shell'}) => {
const [isFullscreen, setIsFullscreen] = useState(false);
// 当模态打开或关闭时重置全屏状态
// 当模态<EFBFBD><EFBFBD>打开或关闭时重置全屏状态
useEffect(() => {
setIsFullscreen(false);
}, [open]);
@ -44,15 +44,14 @@ const CodePreviewModal: React.FC<{
setIsFullscreen(false);
}}
footer={null}
width={isFullscreen ? "100%" : 800}
styles={{
body: { padding: 0 },
content: isFullscreen ? {
width={isFullscreen ? "100vw" : 800}
style={isFullscreen ? {
top: 0,
maxWidth: '100%',
margin: 0,
paddingBottom: 0
} : undefined
} : undefined}
wrapClassName={isFullscreen ? 'fullscreen-modal' : undefined}
styles={{
body: { padding: 0 }
}}
destroyOnClose
>