Skip to content

Commit

Permalink
slight cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scniro committed Mar 15, 2018
1 parent dc51765 commit 3ddcad3
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export interface IDoc extends codemirror.Doc {
export interface IInstance extends codemirror.Editor, IDoc {
options: codemirror.EditorConfiguration
}

/* </tshacks> */

export interface ICodeMirror {
Expand Down Expand Up @@ -559,9 +558,7 @@ export class Controlled extends React.Component<IControlledCodeMirror, any> {

let className = this.props.className ? `react-codemirror2 ${this.props.className}` : 'react-codemirror2';

return (
<div className={className} ref={(self) => this.ref = self}/>
)
return <div className={className} ref={self => this.ref = self}/>
}
}

Expand Down Expand Up @@ -723,22 +720,20 @@ export class UnControlled extends React.Component<IUnControlledCodeMirror, any>
/** @internal */
public componentWillReceiveProps(nextProps) {

if(this.detached && (nextProps.detach === false)) {
if (this.detached && (nextProps.detach === false)) {
this.detached = false;
if (this.props.editorDidAttach) {
this.props.editorDidAttach(this.editor);
}
}

if(!this.detached && (nextProps.detach === true)) {
if (!this.detached && (nextProps.detach === true)) {
this.detached = true;
if (this.props.editorDidDetach) {
this.props.editorDidDetach(this.editor);
}
}



if (SERVER_RENDERED || this.detached) return;

let preserved: IPreservedOptions = {cursor: null};
Expand Down Expand Up @@ -794,8 +789,6 @@ export class UnControlled extends React.Component<IUnControlledCodeMirror, any>

let className = this.props.className ? `react-codemirror2 ${this.props.className}` : 'react-codemirror2';

return (
<div className={className} ref={(self) => this.ref = self}/>
)
return <div className={className} ref={self => this.ref = self}/>
}
}

0 comments on commit 3ddcad3

Please sign in to comment.