Skip to content

Commit 5f84d92

Browse files
committed
1 parent a9533f8 commit 5f84d92

File tree

10 files changed

+1608
-536
lines changed

10 files changed

+1608
-536
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ coverage
88
docs
99
src
1010
test
11+
gulpfile.js

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
3.0.2
2+
==================
3+
https://github.com/scniro/react-codemirror2/issues/22
4+
5+
3.0.1
6+
==================
7+
* fixes https://github.com/scniro/react-codemirror2/issues/25
8+
19
3.0.0
210
==================
311
* typings
@@ -25,4 +33,4 @@
2533
==================
2634
* [`onValueSet`, `onValueChange`] deprecated, now => [`onSet`, `onChange`];
2735
* add `onBeforeChange` `onBeforeSet`
28-
* add `defineMode`
36+
* add `defineMode`

docs/app.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
let gulp = require('gulp');
2+
let replace = require('gulp-replace');
3+
let rimraf = require('rimraf');
4+
5+
gulp.task('ts-scrub:index', () => {
6+
return gulp.src('./.ts/index.js')
7+
.pipe(replace('var codemirror = require("codemirror");', ''))
8+
.pipe(replace('"', '\''))
9+
.pipe(gulp.dest('.'));
10+
});
11+
12+
gulp.task('ts-scrub:declaration', () => {
13+
return gulp.src('./.ts/index.d.ts')
14+
.pipe(gulp.dest('.'));
15+
});
16+
17+
gulp.task('ts-scrub', ['ts-scrub:index', 'ts-scrub:declaration'], (done) => {
18+
rimraf('./.ts', done);
19+
});

index.d.ts

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,65 @@
33
import * as React from 'react';
44
import * as codemirror from 'codemirror';
55
export interface IDefineModeOptions {
6-
fn: () => codemirror.Mode<any>;
7-
name: string;
6+
fn: () => codemirror.Mode<any>;
7+
name: string;
88
}
99
export interface ISetScrollOptions {
10-
x: number;
11-
y: number;
10+
x: number;
11+
y: number;
1212
}
1313
export interface ISetSelectionOptions {
14-
anchor: codemirror.Position;
15-
head: codemirror.Position;
14+
anchor: codemirror.Position;
15+
head: codemirror.Position;
1616
}
1717
export interface IDoc extends codemirror.Doc {
18-
setCursor: (pos: codemirror.Position, ch?: number, options?: {}) => void;
19-
setSelections: (ranges: Array<ISetSelectionOptions>) => void;
18+
setCursor: (pos: codemirror.Position, ch?: number, options?: {}) => void;
19+
setSelections: (ranges: Array<ISetSelectionOptions>) => void;
2020
}
2121
export interface IInstance extends codemirror.Editor, IDoc {
2222
}
2323
export interface ICodeMirror {
24-
autoCursor?: boolean;
25-
autoFocus?: boolean;
26-
autoScroll?: boolean;
27-
className?: string;
28-
cursor?: codemirror.Position;
29-
defineMode?: IDefineModeOptions;
30-
editorDidConfigure?: (editor: IInstance) => void;
31-
editorDidMount?: (editor: IInstance, value: string, cb: () => void) => void;
32-
editorWillMount?: () => void;
33-
editorWillUnmount?: (lib: any) => void;
34-
onBlur?: (editor: IInstance, event: Event) => void;
35-
onChange?: (editor: IInstance, data: codemirror.EditorChange, value: string) => void;
36-
onCursor?: (editor: IInstance, data: codemirror.Position) => void;
37-
onCursorActivity?: (editor: IInstance) => void;
38-
onDragEnter?: (editor: IInstance, event: Event) => void;
39-
onDragOver?: (editor: IInstance, event: Event) => void;
40-
onDrop?: (editor: IInstance, event: Event) => void;
41-
onFocus?: (editor: IInstance, event: Event) => void;
42-
onGutterClick?: (editor: IInstance, lineNumber: number, gutter: string, event: Event) => void;
43-
onKeyDown?: (editor: IInstance, event: Event) => void;
44-
onKeyPress?: (editor: IInstance, event: Event) => void;
45-
onKeyUp?: (editor: IInstance, event: Event) => void;
46-
onScroll?: (editor: IInstance, data: codemirror.ScrollInfo) => void;
47-
onSelection?: (editor: IInstance, ranges: ISetSelectionOptions) => void;
48-
onUpdate?: (editor: IInstance) => void;
49-
onViewportChange?: (editor: IInstance, start: number, end: number) => void;
50-
options?: codemirror.EditorConfiguration;
51-
selection?: Array<ISetSelectionOptions>;
52-
scroll?: ISetScrollOptions;
53-
autoScrollCursorOnSet?: any;
54-
onBeforeSet?: any;
55-
onSet?: any;
56-
resetCursorOnSet?: any;
24+
autoCursor?: boolean;
25+
autoFocus?: boolean;
26+
autoScroll?: boolean;
27+
className?: string;
28+
cursor?: codemirror.Position;
29+
defineMode?: IDefineModeOptions;
30+
editorDidConfigure?: (editor: IInstance) => void;
31+
editorDidMount?: (editor: IInstance, value: string, cb: () => void) => void;
32+
editorWillMount?: () => void;
33+
editorWillUnmount?: (lib: any) => void;
34+
onBlur?: (editor: IInstance, event: Event) => void;
35+
onChange?: (editor: IInstance, data: codemirror.EditorChange, value: string) => void;
36+
onCursor?: (editor: IInstance, data: codemirror.Position) => void;
37+
onCursorActivity?: (editor: IInstance) => void;
38+
onDragEnter?: (editor: IInstance, event: Event) => void;
39+
onDragOver?: (editor: IInstance, event: Event) => void;
40+
onDrop?: (editor: IInstance, event: Event) => void;
41+
onFocus?: (editor: IInstance, event: Event) => void;
42+
onGutterClick?: (editor: IInstance, lineNumber: number, gutter: string, event: Event) => void;
43+
onKeyDown?: (editor: IInstance, event: Event) => void;
44+
onKeyPress?: (editor: IInstance, event: Event) => void;
45+
onKeyUp?: (editor: IInstance, event: Event) => void;
46+
onScroll?: (editor: IInstance, data: codemirror.ScrollInfo) => void;
47+
onSelection?: (editor: IInstance, ranges: ISetSelectionOptions) => void;
48+
onUpdate?: (editor: IInstance) => void;
49+
onViewportChange?: (editor: IInstance, start: number, end: number) => void;
50+
options?: codemirror.EditorConfiguration;
51+
selection?: Array<ISetSelectionOptions>;
52+
scroll?: ISetScrollOptions;
53+
autoScrollCursorOnSet?: any;
54+
onBeforeSet?: any;
55+
onSet?: any;
56+
resetCursorOnSet?: any;
5757
}
5858
export interface IControlledCodeMirror extends ICodeMirror {
59-
onBeforeChange: (editor: IInstance, data: codemirror.EditorChange, value: string) => void;
60-
value: string;
59+
onBeforeChange: (editor: IInstance, data: codemirror.EditorChange, value: string) => void;
60+
value: string;
6161
}
6262
export interface IUnControlledCodeMirror extends ICodeMirror {
63-
onBeforeChange?: (editor: IInstance, data: codemirror.EditorChange, value: string, next: () => void) => void;
64-
value?: string;
63+
onBeforeChange?: (editor: IInstance, data: codemirror.EditorChange, value: string, next: () => void) => void;
64+
value?: string;
6565
}
6666
export declare class Controlled extends React.Component<IControlledCodeMirror, any> {
6767
}

0 commit comments

Comments
 (0)