Skip to content

Commit 3b7ba44

Browse files
committed
cleanup
1 parent c19502e commit 3b7ba44

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/components/CodeEditor/CodeEditor.jsx

+9-8
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ const MONACO_EDITOR_CONFIG = {
3939
};
4040

4141
export const CodeEditor = ({ onRunEvalscriptClick }) => {
42-
const editorDOMRef = useRef();
42+
const monacoEditorDOMRef = useRef();
4343
const editorRef = useRef();
4444
const monacoRef = useRef();
4545
const headerEditorRef = useRef();
46-
const codeEditorRef = useRef();
46+
const editorWindowRef = useRef();
4747
const {
4848
editorPosition,
4949
editorSize,
@@ -53,12 +53,12 @@ export const CodeEditor = ({ onRunEvalscriptClick }) => {
5353
handleResizeMouseDown,
5454
handleFullscreenClick,
5555
handleExitFullscreenClick,
56-
} = useFreeEditor(codeEditorRef, headerEditorRef);
56+
} = useFreeEditor(editorWindowRef, headerEditorRef);
5757

5858
useEffect(() => {
5959
loader.init().then((monaco) => {
6060
const editor = monaco.editor.create(
61-
editorDOMRef.current,
61+
monacoEditorDOMRef.current,
6262
MONACO_EDITOR_CONFIG
6363
);
6464

@@ -117,7 +117,7 @@ export const CodeEditor = ({ onRunEvalscriptClick }) => {
117117

118118
if (isDocked) {
119119
return (
120-
<div ref={codeEditorRef} className="code-editor-window-docked">
120+
<div ref={editorWindowRef} className="code-editor-window-docked">
121121
<div className="code-editor-top-panel" ref={headerEditorRef}>
122122
<button className="editor-button" onClick={handleDockedClick}>
123123
<BiExpand className="code-editor-expand-icon" />
@@ -126,7 +126,7 @@ export const CodeEditor = ({ onRunEvalscriptClick }) => {
126126
<div
127127
style={{ height: "100%" }}
128128
className="code-editor-docked"
129-
ref={(el) => (editorDOMRef.current = el)}
129+
ref={(el) => (monacoEditorDOMRef.current = el)}
130130
></div>
131131
</div>
132132
);
@@ -137,8 +137,9 @@ export const CodeEditor = ({ onRunEvalscriptClick }) => {
137137
style={{
138138
transform: `translate(${editorPosition.x}px, ${editorPosition.y}px)`,
139139
...editorSize,
140+
position: "absolute",
140141
}}
141-
ref={codeEditorRef}
142+
ref={editorWindowRef}
142143
className="code-editor-window"
143144
>
144145
<div
@@ -175,7 +176,7 @@ export const CodeEditor = ({ onRunEvalscriptClick }) => {
175176
<div
176177
style={{ height: editorSize.height - 96 }}
177178
className="code-editor"
178-
ref={(el) => (editorDOMRef.current = el)}
179+
ref={(el) => (monacoEditorDOMRef.current = el)}
179180
></div>
180181
<div
181182
onMouseDown={handleResizeMouseDown}

src/components/CodeEditor/code-editor.css

-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@
7575
cursor: pointer;
7676
}
7777

78-
.code-editor-floating {
79-
position: absolute;
80-
}
81-
8278
.code-editor-header-floating {
8379
cursor: move;
8480
}

0 commit comments

Comments
 (0)