Unverified Commit 1d97f07d authored by 高岩's avatar 高岩 Committed by GitHub

optimize clear console, add clear console at right click (#1513)

parent 79b4536d
......@@ -27,6 +27,7 @@ export type CodeShowFormProps = {
theme?: string;
options?: any;
code: string;
editorDidMountHandle: any;
};
const CodeShow = (props: CodeShowFormProps) => {
......@@ -44,6 +45,7 @@ const CodeShow = (props: CodeShowFormProps) => {
automaticLayout: true,
},
code,
editorDidMountHandle,
} = props;
return (<>
......@@ -54,6 +56,7 @@ const CodeShow = (props: CodeShowFormProps) => {
value={code}
options={options}
theme='vs-dark'
editorDidMount={editorDidMountHandle}
/>
</>)
};
......
......@@ -22,6 +22,8 @@ import {connect} from "umi";
import React, {useEffect, useState} from "react";
import CodeShow from "@/components/Common/CodeShow";
import {getConsoleInfo} from "@/pages/SettingCenter/ProcessList/service";
import { clearConsole } from "../../StudioEvent/DDL";
import {l} from "@/utils/intl";
const StudioMsg = (props: any) => {
......@@ -45,9 +47,25 @@ const StudioMsg = (props: any) => {
}
}
const editorDidMountHandle = (editor: any, monaco: any) => {
editor.addAction({
id: 'btn-studio-msg-clear', // menu id
label: l('pages.datastudio.editor.clearConsole'), // menu name
contextMenuGroupId: '9_cutcopypaste', // menu group
run: () => {
clearConsole().then((result) => {
setConsoleInfo("")
refreshConsoleInfo()
});
}, // 点击后执行的操作
})
};
return (
<>
<CodeShow code={consoleInfo} language='java' height={height} theme="vs"/>
<CodeShow code={consoleInfo} language='java' height={height} theme="vs" editorDidMountHandle={editorDidMountHandle}/>
</>
);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment