Skip to content

Commit

Permalink
simpler fix for #30
Browse files Browse the repository at this point in the history
  • Loading branch information
scniro committed Nov 3, 2017
1 parent 18fb180 commit cd0b54f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 65 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ var Shared = (function () {
case 'onSelection':
{
this.editor.on('beforeSelectionChange', function (cm, data) {
var _data = Object.assign({}, data);
_this.props.onSelection(_this.editor, _data);
_this.props.onSelection(_this.editor, data);
});
}
break;
Expand Down
106 changes: 53 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"coveralls": "3.0.0",
"css-loader": "0.28.7",
"enzyme": "3.1.0",
"enzyme-adapter-react-16": "1.0.2",
"enzyme-adapter-react-16": "1.0.3",
"express": "4.16.2",
"gulp": "3.9.1",
"gulp-replace": "0.6.1",
Expand All @@ -89,7 +89,7 @@
"redux": "3.7.2",
"rimraf": "2.6.2",
"sass-loader": "6.0.6",
"sinon": "4.0.2",
"sinon": "4.1.1",
"style-loader": "0.19.0",
"ts-jest": "21.1.4",
"typescript": "2.6.1",
Expand Down
11 changes: 3 additions & 8 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ export interface IGetSelectionOptions {
update: (ranges: Array<ISetSelectionOptions>) => void;
}

/* tshacks: laundry list of incorrect typings in @types/codemirror */
export interface IDoc extends codemirror.Doc {
/* tshack: `setCursor` has incorrect/missing overloaded signature in @types/codemirror */
setCursor: (pos: codemirror.Position, ch?: number, options?: {}) => void;
/* tshack: `setSelections` missing in @types/codemirror */
setSelections: (ranges: Array<ISetSelectionOptions>) => void;
}

Expand Down Expand Up @@ -203,12 +202,8 @@ class Shared implements ICommon {
}
break;
case 'onSelection': {
this.editor.on('beforeSelectionChange', (cm, data) => {

/* tshack: `beforeSelectionChange` return wrong type in @types/codemirror */
let _data = Object.assign<any, any>({}, data) as IGetSelectionOptions;

this.props.onSelection(this.editor, _data);
this.editor.on('beforeSelectionChange', (cm, data: any) => {
this.props.onSelection(this.editor, data);
});
}
break;
Expand Down

0 comments on commit cd0b54f

Please sign in to comment.