Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] support the console auto scroll #3255

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions dinky-web/src/components/CustomEditor/CodeShow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type CodeShowFormProps = {
showFloatButton?: boolean;
refreshLogCallback?: () => void;
fullScreenBtn?: boolean;
enableAutoScroll?: boolean;
style?: CSSProperties;
};

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -232,7 +232,7 @@ const CodeShow = (props: CodeShowFormProps) => {
value={code ?? ''}
language={language}
options={{
scrollBeyondLastLine: false,
scrollBeyondLastLine: enableAutoScroll,
readOnly: true,
glyphMargin: false,
wordWrap: autoWrap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ const ConsoleContent = (props: ConsoleProps) => {
language={'javalog'}
lineNumbers={'off'}
enableMiniMap
enableAutoScroll
showFloatButton
/>
</Pane>
Expand Down
Loading