Skip to content

Commit 8c9f26b

Browse files
committed
Fixed view python colateral from previous Monaco fix
1 parent d2e109f commit 8c9f26b

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/components/MonacoEditor.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ type MonacoEditorProps = {
119119
* Language of the current model
120120
*/
121121
language?: string;
122-
/**
123-
* Path of the file
124-
*/
125-
// path?: string,
126122
/**
127123
* Value of the current model
128124
*/
@@ -131,6 +127,8 @@ type MonacoEditorProps = {
131127

132128
const MonacoEditor = ({
133129
name,
130+
width,
131+
height,
134132
language = 'python',
135133
value,
136134
className,
@@ -139,8 +137,8 @@ const MonacoEditor = ({
139137
const containerRef = useRef<HTMLDivElement | null>(null);
140138
const editorRef = useRef<HTMLDivElement | null>(null);
141139
const editor = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);
142-
const [childWidth, setChildWidth] = useState(0);
143-
const [childHeight, setChildHeight] = useState(0);
140+
const [childWidth, setChildWidth] = useState(width);
141+
const [childHeight, setChildHeight] = useState(height);
144142

145143
useEffect(() => {
146144
if (containerRef.current) {
@@ -231,7 +229,7 @@ const MonacoEditor = ({
231229
EditorMgr.getInstance().setSubscription(name);
232230
}
233231

234-
if (editorRef.current && childWidth > 0 && childHeight > 0) {
232+
if (editorRef.current) {
235233
if (editor.current === null) {
236234
updateUserConfiguration(`{
237235
"editor.fontSize": ${Constants.DEFAULT_FONTSIZE},

0 commit comments

Comments
 (0)