Skip to content

Commit

Permalink
fix code editor when window is resized
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Sep 28, 2024
1 parent e2f9a11 commit bc8307d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/eez-studio-ui/code-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ export class CodeEditor extends React.Component<CodeEditorProps> {

componentDidMount() {
this.createEditor(this.props);

window.addEventListener("resize", () => {
setTimeout(() => this.resize(), 100);
});
}

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

componentWillUnmount() {
this.destroyEditor(this.props);

window.removeEventListener("resize", this.resize);
}

render() {
Expand Down

0 comments on commit bc8307d

Please sign in to comment.