Skip to content

Commit

Permalink
Fix the bug that AceEditor in REPL tab is not notified during resize (#…
Browse files Browse the repository at this point in the history
…262)

Fix the bug that the actual code area in AceEditor in REPL tab not resizes with the displayed editor area. Now AceEditor will automatically resize the code area when user drag the resize bar.
  • Loading branch information
larrywang0701 authored Oct 31, 2023
1 parent 62da4a7 commit d320b72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tabs/Repl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const BOX_PADDING_VALUE = 4;
class ProgrammableReplGUI extends React.Component<Props, State> {
public replInstance : ProgrammableRepl;
private editorAreaRect;
private editorInstance;
constructor(data: Props) {
super(data);
this.replInstance = data.programmableReplInstance;
Expand All @@ -50,6 +51,7 @@ class ProgrammableReplGUI extends React.Component<Props, State> {
const height = Math.max(e.clientY - this.editorAreaRect.top - BOX_PADDING_VALUE * 2, MINIMUM_EDITOR_HEIGHT);
this.replInstance.editorHeight = height;
this.setState({ editorHeight: height });
this.editorInstance.resize();
}
};
private onMouseUp = (_e) => {
Expand Down Expand Up @@ -108,7 +110,7 @@ class ProgrammableReplGUI extends React.Component<Props, State> {
border: '2px solid #6f8194',
}}>
<AceEditor
ref={ (e) => this.replInstance.setEditorInstance(e?.editor)}
ref={ (e) => { this.editorInstance = e?.editor; this.replInstance.setEditorInstance(e?.editor); }}

Check warning on line 113 in src/tabs/Repl/index.tsx

View workflow job for this annotation

GitHub Actions / deploy

This line has 2 statements. Maximum allowed is 1
style= { {
width: '100%',
height: `${editorHeight}px`,
Expand Down

0 comments on commit d320b72

Please sign in to comment.