Skip to content

Commit

Permalink
update: return to the original handling
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Oct 17, 2023
1 parent f8fd3e3 commit d72aa3f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/components/source_editor/BasisText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ class BasisText extends React.Component {
}

// eslint-disable-next-line no-unused-vars
componentDidUpdate(prevProps, prevState, snapshot) {
componentDidUpdate(prevProps, prevState) {
const { content } = this.props;
if (content !== prevProps.content) {
if (prevProps.content !== content) {
const { manualEditStarted } = this.state;
if (!manualEditStarted) {
this.reformatContentAndUpdateStateIfNoManualEdit(content);
}
if (!manualEditStarted) this.reformatContentAndUpdateStateIfNoManualEdit(content);
}
}

Expand Down Expand Up @@ -80,12 +78,6 @@ class BasisText extends React.Component {
});
}

handleBlur = () => {
this.setState({ manualEditStarted: false });
const { content } = this.state;
this.reformatContentAndUpdateStateIfNoManualEdit(content);
};

render() {
const { className, readOnly, codeMirrorOptions } = this.props;
const { content, isContentValidated, message } = this.state;
Expand All @@ -99,7 +91,8 @@ class BasisText extends React.Component {
updateContent={(newContent) => {
this.updateContent(newContent);
}}
onBlur={this.handleBlur}
onFocus={() => this.setState({ manualEditStarted: true })}
onBlur={() => this.setState({ manualEditStarted: false })}
readOnly={readOnly}
options={{
lineNumbers: true,
Expand Down

0 comments on commit d72aa3f

Please sign in to comment.