任务详情编辑脚本支持全屏

This commit is contained in:
whyour 2022-07-04 22:44:51 +08:00
parent 87a265191c
commit a4a76ec235

View File

@ -20,6 +20,7 @@ import {
FileOutlined, FileOutlined,
PlayCircleOutlined, PlayCircleOutlined,
PauseCircleOutlined, PauseCircleOutlined,
FullscreenOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { CrontabStatus } from './index'; import { CrontabStatus } from './index';
import { diffTime } from '@/utils/date'; import { diffTime } from '@/utils/date';
@ -106,7 +107,8 @@ const CronDetailModal = ({
glyphMargin: false, glyphMargin: false,
wordWrap: 'on', wordWrap: 'on',
}} }}
onMount={(editor) => { onMount={(editor, monaco) => {
console.log(monaco);
editorRef.current = editor; editorRef.current = editor;
}} }}
/> />
@ -352,6 +354,11 @@ const CronDetailModal = ({
}); });
}; };
const fullscreen = () => {
const editorElement = editorRef.current._domElement as HTMLElement;
editorElement.parentElement?.requestFullscreen();
};
useEffect(() => { useEffect(() => {
if (cron && cron.id) { if (cron && cron.id) {
setCurrentCron(cron); setCurrentCron(cron);
@ -529,6 +536,7 @@ const CronDetailModal = ({
}} }}
tabBarExtraContent={ tabBarExtraContent={
activeTabKey === 'script' && ( activeTabKey === 'script' && (
<>
<Button <Button
type="primary" type="primary"
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
@ -536,6 +544,12 @@ const CronDetailModal = ({
> >
</Button> </Button>
<Button
type="primary"
icon={<FullscreenOutlined />}
onClick={fullscreen}
/>
</>
) )
} }
> >