Skip to content

Commit cd0b54f

Browse files
committed
simpler fix for #30
1 parent 18fb180 commit cd0b54f

File tree

4 files changed

+59
-65
lines changed

4 files changed

+59
-65
lines changed

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ var Shared = (function () {
126126
case 'onSelection':
127127
{
128128
this.editor.on('beforeSelectionChange', function (cm, data) {
129-
var _data = Object.assign({}, data);
130-
_this.props.onSelection(_this.editor, _data);
129+
_this.props.onSelection(_this.editor, data);
131130
});
132131
}
133132
break;

package-lock.json

Lines changed: 53 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"coveralls": "3.0.0",
7272
"css-loader": "0.28.7",
7373
"enzyme": "3.1.0",
74-
"enzyme-adapter-react-16": "1.0.2",
74+
"enzyme-adapter-react-16": "1.0.3",
7575
"express": "4.16.2",
7676
"gulp": "3.9.1",
7777
"gulp-replace": "0.6.1",
@@ -89,7 +89,7 @@
8989
"redux": "3.7.2",
9090
"rimraf": "2.6.2",
9191
"sass-loader": "6.0.6",
92-
"sinon": "4.0.2",
92+
"sinon": "4.1.1",
9393
"style-loader": "0.19.0",
9494
"ts-jest": "21.1.4",
9595
"typescript": "2.6.1",

src/index.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ export interface IGetSelectionOptions {
3232
update: (ranges: Array<ISetSelectionOptions>) => void;
3333
}
3434

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

@@ -203,12 +202,8 @@ class Shared implements ICommon {
203202
}
204203
break;
205204
case 'onSelection': {
206-
this.editor.on('beforeSelectionChange', (cm, data) => {
207-
208-
/* tshack: `beforeSelectionChange` return wrong type in @types/codemirror */
209-
let _data = Object.assign<any, any>({}, data) as IGetSelectionOptions;
210-
211-
this.props.onSelection(this.editor, _data);
205+
this.editor.on('beforeSelectionChange', (cm, data: any) => {
206+
this.props.onSelection(this.editor, data);
212207
});
213208
}
214209
break;

0 commit comments

Comments
 (0)