mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
修复弹框日志样式
This commit is contained in:
parent
fd7153403d
commit
c77e302874
|
@ -6,7 +6,6 @@ import {
|
|||
Loading3QuartersOutlined,
|
||||
CheckCircleOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import Editor from "@monaco-editor/react";
|
||||
|
||||
enum CrontabStatus {
|
||||
'running',
|
||||
|
@ -92,50 +91,40 @@ const CronLogModal = ({
|
|||
setIsPhone(document.body.clientWidth < 768);
|
||||
}, []);
|
||||
|
||||
useEffect(()=>{
|
||||
const media = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
const storageTheme = localStorage.getItem('qinglong_dark_theme');
|
||||
const isDark = (media.matches && storageTheme !== 'light') || storageTheme === 'dark';
|
||||
setTheme(isDark?'vs-dark':'vs');
|
||||
media.addEventListener('change',(e)=>{
|
||||
if(storageTheme === 'auto' || !storageTheme){
|
||||
if(e.matches){
|
||||
setTheme('vs-dark')
|
||||
}else{
|
||||
setTheme('vs');
|
||||
}
|
||||
}
|
||||
})
|
||||
},[])
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={titleElement()}
|
||||
visible={visible}
|
||||
centered
|
||||
// bodyStyle={{
|
||||
// overflowY: 'auto',
|
||||
// maxHeight: 'calc(80vh - var(--vh-offset, 0px))',
|
||||
// }}
|
||||
bodyStyle={{
|
||||
overflowY: 'auto',
|
||||
maxHeight: 'calc(80vh - var(--vh-offset, 0px))',
|
||||
}}
|
||||
forceRender
|
||||
wrapClassName="log-modal"
|
||||
onOk={() => cancel()}
|
||||
onCancel={() => cancel()}
|
||||
>
|
||||
{!loading && value && (
|
||||
<Editor
|
||||
defaultLanguage="shell"
|
||||
value={value}
|
||||
theme={theme}
|
||||
options={{
|
||||
fontSize: 12,
|
||||
minimap: {enabled: false},
|
||||
lineNumbersMinChars: 3,
|
||||
folding: false,
|
||||
fontFamily: 'Source Code Pro',
|
||||
glyphMargin: false
|
||||
}}
|
||||
/>
|
||||
<pre
|
||||
style={
|
||||
!isPhone
|
||||
? {
|
||||
whiteSpace: 'break-spaces',
|
||||
lineHeight: '17px',
|
||||
marginBottom: 0,
|
||||
}
|
||||
: {
|
||||
whiteSpace: 'break-spaces',
|
||||
lineHeight: '17px',
|
||||
marginBottom: 0,
|
||||
fontFamily: 'Source Code Pro',
|
||||
width: 375,
|
||||
zoom: 0.83,
|
||||
}
|
||||
}
|
||||
>
|
||||
{value}
|
||||
</pre>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
|
|
|
@ -91,7 +91,8 @@ const Crontab = () => {
|
|||
lineNumbersMinChars: 3,
|
||||
folding: false,
|
||||
glyphMargin: false,
|
||||
renderSideBySide: width==='100%'
|
||||
renderSideBySide: width==='100%',
|
||||
wordWrap: 'on'
|
||||
}}
|
||||
theme={theme}
|
||||
/>
|
||||
|
|
|
@ -196,8 +196,10 @@ const Log = () => {
|
|||
fontSize: 12,
|
||||
minimap: {enabled: width==='100%'},
|
||||
lineNumbersMinChars: 3,
|
||||
fontFamily: 'Source Code Pro',
|
||||
folding: false,
|
||||
glyphMargin: false
|
||||
glyphMargin: false,
|
||||
wordWrap: 'on'
|
||||
}}
|
||||
onChange={(val, ev) => {setValue(val as string)}}
|
||||
/>
|
||||
|
|
|
@ -172,7 +172,8 @@ const Script = () => {
|
|||
minimap: {enabled: width==='100%'},
|
||||
lineNumbersMinChars: 3,
|
||||
folding: false,
|
||||
glyphMargin: false
|
||||
glyphMargin: false,
|
||||
wordWrap: 'on'
|
||||
}}
|
||||
onChange={(val) => {setValue(val as string)}}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user