Skip to content

Commit

Permalink
add style to console editor div, remove styling hook
Browse files Browse the repository at this point in the history
  • Loading branch information
raclim committed Nov 14, 2024
1 parent 0912253 commit a850d5c
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions client/modules/IDE/components/ConsoleInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,8 @@ function ConsoleInput({ theme, fontSize }) {
mode: 'javascript',
inputStyle: 'contenteditable'
});

cmInstance.current.getWrapperElement().style['font-size'] = `${fontSize}px`;
}, []);

useEffect(() => {
if (cmInstance.current) {
cmInstance.current.setOption('theme', `p5-${theme}`);
cmInstance.current.getWrapperElement().style[
'font-size'
] = `${fontSize}px`;
cmInstance.current.refresh();
}
}, [theme, fontSize]);

useEffect(() => {
const handleEnterKey = (cm, e) => {
if (e.key === 'Enter' && !e.shiftKey) {
Expand Down Expand Up @@ -146,7 +134,11 @@ function ConsoleInput({ theme, fontSize }) {
}}
/>
</div>
<div ref={codemirrorContainer} className="console__editor" />
<div
ref={codemirrorContainer}
className="console__editor"
style={{ fontSize: `${fontSize}px` }}
/>
</div>
);
}
Expand Down

0 comments on commit a850d5c

Please sign in to comment.