Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
maniator authored and amitzur committed Oct 5, 2017
1 parent 5850073 commit 568c39d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
1 change: 1 addition & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"transform-flow-strip-types",
"transform-async-to-generator",
"syntax-trailing-function-commas",
"transform-class-properties",

["module-resolver", {
"alias": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"@percy-io/react-percy-storybook": "^1.0.2",
"@storybook/react": "^3.2.5",
"babel-plugin-syntax-trailing-function-commas": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-preset-react": "^6.24.1",
"devtools-license-check": "^0.5.0",
Expand Down
37 changes: 14 additions & 23 deletions src/components/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ class Editor extends PureComponent {
highlightedLineRange: null,
editor: null
};

const self: any = this;
self.closeConditionalPanel = this.closeConditionalPanel.bind(this);
self.onEscape = this.onEscape.bind(this);
self.onGutterClick = this.onGutterClick.bind(this);
self.onGutterContextMenu = this.onGutterContextMenu.bind(this);
self.onSearchAgain = this.onSearchAgain.bind(this);
self.onToggleBreakpoint = this.onToggleBreakpoint.bind(this);
self.toggleConditionalPanel = this.toggleConditionalPanel.bind(this);
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -242,7 +233,7 @@ class Editor extends PureComponent {
}
}

onToggleBreakpoint(key, e) {
onToggleBreakpoint = (key, e) => {
e.preventDefault();
const { codeMirror } = this.state.editor;
const { selectedSource } = this.props;
Expand All @@ -259,7 +250,7 @@ class Editor extends PureComponent {
} else {
this.props.toggleBreakpoint(sourceLine);
}
}
};

onKeyDown(e) {
const { codeMirror } = this.state.editor;
Expand All @@ -284,7 +275,7 @@ class Editor extends PureComponent {
* split console. Restore it here, but preventDefault if and only if there
* is a multiselection.
*/
onEscape(key, e) {
onEscape = (key, e) => {
if (!this.state.editor) {
return;
}
Expand All @@ -294,16 +285,16 @@ class Editor extends PureComponent {
codeMirror.execCommand("singleSelection");
e.preventDefault();
}
}
};

onSearchAgain(_, e) {
onSearchAgain = (_, e) => {
const { query, searchModifiers } = this.props;
const { editor: { codeMirror } } = this.state.editor;
const ctx = { ed: this.state.editor, cm: codeMirror };

const direction = e.shiftKey ? "prev" : "next";
traverseResults(e, ctx, query, direction, searchModifiers.toJS());
}
};

inSelectedFrameSource() {
const { selectedLocation, selectedFrame } = this.props;
Expand Down Expand Up @@ -339,7 +330,7 @@ class Editor extends PureComponent {
});
}

onGutterClick(cm, line, gutter, ev) {
onGutterClick = (cm, line, gutter, ev) => {
const {
selectedSource,
toggleBreakpoint,
Expand Down Expand Up @@ -380,9 +371,9 @@ class Editor extends PureComponent {
toggleBreakpoint(toSourceLine(selectedSource.get("id"), line));
}
}
}
};

onGutterContextMenu(event) {
onGutterContextMenu = event => {
const {
selectedSource,
breakpoints,
Expand Down Expand Up @@ -419,7 +410,7 @@ class Editor extends PureComponent {
isCbPanelOpen: this.isCbPanelOpen(),
closeConditionalPanel: this.closeConditionalPanel
});
}
};

onClick(e: MouseEvent) {
const { selectedLocation, jumpToMappedLocation } = this.props;
Expand All @@ -434,7 +425,7 @@ class Editor extends PureComponent {
}
}

toggleConditionalPanel(line) {
toggleConditionalPanel = line => {
if (this.isCbPanelOpen()) {
return this.closeConditionalPanel();
}
Expand Down Expand Up @@ -467,13 +458,13 @@ class Editor extends PureComponent {
}
);
this.cbPanel.node.querySelector("input").focus();
}
};

closeConditionalPanel() {
closeConditionalPanel = () => {
this.props.toggleConditionalBreakpointPanel(null);
this.cbPanel.clear();
this.cbPanel = null;
}
};

isCbPanelOpen() {
return !!this.cbPanel;
Expand Down

0 comments on commit 568c39d

Please sign in to comment.