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

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