Skip to content

Commit d3d5f45

Browse files
Merge pull request #131 from festim-dev/python-editor-scroll
Python editor scrollable
2 parents 1bbfcdf + bfe5858 commit d3d5f45

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/components/PythonCodeEditor.jsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,27 @@ const PythonCodeEditor = ({
6363
</div>
6464

6565
<div className="editor-container" style={{ height }}>
66-
<CodeMirror value={code} onChange={handleCodeChange} extensions={[python({ python: true })]} theme={vscodeDark} options={{ fontSize: 24 }}/>
66+
<CodeMirror
67+
value={code}
68+
onChange={handleCodeChange}
69+
extensions={[python({ python: true })]}
70+
theme={vscodeDark}
71+
basicSetup={{
72+
lineNumbers: true,
73+
foldGutter: true,
74+
dropCursor: false,
75+
allowMultipleSelections: false,
76+
indentOnInput: true,
77+
bracketMatching: true,
78+
closeBrackets: true,
79+
autocompletion: true,
80+
highlightSelectionMatches: true,
81+
}}
82+
style={{
83+
fontSize: '14px',
84+
height: '100%',
85+
}}
86+
/>
6787
</div>
6888

6989
{executionResult && (

src/styles/PythonCodeEditor.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@
4747
.editor-container {
4848
border-radius: 0 0 8px 8px;
4949
overflow: hidden;
50+
position: relative;
51+
}
52+
53+
.editor-container .cm-editor {
54+
height: 100% !important;
55+
overflow: auto !important;
56+
}
57+
58+
.editor-container .cm-scroller {
59+
overflow: auto !important;
60+
max-height: 100% !important;
61+
}
62+
63+
.editor-container .cm-content {
64+
padding: 8px 0;
65+
min-height: 100% !important;
5066
}
5167

5268
.execution-result {

0 commit comments

Comments
 (0)