Skip to content

Commit bc8307d

Browse files
committed
fix code editor when window is resized
1 parent e2f9a11 commit bc8307d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/eez-studio-ui/code-editor.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ export class CodeEditor extends React.Component<CodeEditorProps> {
257257

258258
componentDidMount() {
259259
this.createEditor(this.props);
260+
261+
window.addEventListener("resize", () => {
262+
setTimeout(() => this.resize(), 100);
263+
});
260264
}
261265

262266
componentDidUpdate(prevProps: any) {
@@ -273,6 +277,8 @@ export class CodeEditor extends React.Component<CodeEditorProps> {
273277

274278
componentWillUnmount() {
275279
this.destroyEditor(this.props);
280+
281+
window.removeEventListener("resize", this.resize);
276282
}
277283

278284
render() {

0 commit comments

Comments
 (0)