mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-18 02:14:32 +08:00
修复 editor 判断语言
This commit is contained in:
@@ -30,7 +30,7 @@ import config from '@/utils/config';
|
||||
import CronLogModal from './logModal';
|
||||
import Editor from '@monaco-editor/react';
|
||||
import IconFont from '@/components/iconfont';
|
||||
import { getCommandScript } from '@/utils';
|
||||
import { getCommandScript, getEditorMode } from '@/utils';
|
||||
import VirtualList from 'rc-virtual-list';
|
||||
import useScrollHeight from '@/hooks/useScrollHeight';
|
||||
|
||||
@@ -46,13 +46,6 @@ const tabList = [
|
||||
tab: intl.get('脚本'),
|
||||
},
|
||||
];
|
||||
const LangMap: any = {
|
||||
'.py': 'python',
|
||||
'.js': 'javascript',
|
||||
'.mjs': 'typescript',
|
||||
'.sh': 'shell',
|
||||
'.ts': 'typescript',
|
||||
};
|
||||
|
||||
interface LogItem {
|
||||
directory: string;
|
||||
@@ -110,7 +103,7 @@ const CronDetailModal = ({
|
||||
),
|
||||
script: scriptInfo.filename && (
|
||||
<Editor
|
||||
language={LangMap[scriptInfo.filename.slice(-3)] || ''}
|
||||
language={getEditorMode(scriptInfo.filename)}
|
||||
theme={theme}
|
||||
value={value}
|
||||
options={{
|
||||
|
||||
Reference in New Issue
Block a user