Unverified Commit d94b01b5 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Feature] support the console auto scroll (#3255)

parent 557384e6
......@@ -46,6 +46,7 @@ export type CodeShowFormProps = {
showFloatButton?: boolean;
refreshLogCallback?: () => void;
fullScreenBtn?: boolean;
enableAutoScroll?: boolean;
style?: CSSProperties;
};
......@@ -74,13 +75,12 @@ const CodeShow = (props: CodeShowFormProps) => {
showFloatButton = false,
refreshLogCallback,
fullScreenBtn = false,
enableMiniMap = false
enableMiniMap = false,
enableAutoScroll = false
} = props;
const { ScrollType } = editor;
const [scrollBeyondLastLine] = useState<boolean>(options.scrollBeyondLastLine);
const [loading, setLoading] = useState<boolean>(false);
const [stopping, setStopping] = useState<boolean>(false);
const [autoRefresh, setAutoRefresh] = useState<boolean>(false);
......@@ -180,7 +180,7 @@ const CodeShow = (props: CodeShowFormProps) => {
monacoInstance.current = monaco;
editor.layout();
editor.focus();
if (scrollBeyondLastLine) {
if (enableAutoScroll) {
editor.onDidChangeModelContent(() => {
const lineCount = editor.getModel()?.getLineCount() as number;
if (lineCount > 20) {
......@@ -232,7 +232,7 @@ const CodeShow = (props: CodeShowFormProps) => {
value={code ?? ''}
language={language}
options={{
scrollBeyondLastLine: false,
scrollBeyondLastLine: enableAutoScroll,
readOnly: true,
glyphMargin: false,
wordWrap: autoWrap,
......
......@@ -183,6 +183,7 @@ const ConsoleContent = (props: ConsoleProps) => {
language={'javalog'}
lineNumbers={'off'}
enableMiniMap
enableAutoScroll
showFloatButton
/>
</Pane>
......
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