react-codemirror2
Advanced tools
Comparing version 4.3.0 to 5.0.0
@@ -0,1 +1,5 @@ | ||
5.0.0 | ||
================== | ||
* #75 - remove `autoFocus` in favor of codemirror.options.autofocus | ||
4.3.0 | ||
@@ -2,0 +6,0 @@ ================== |
@@ -34,3 +34,2 @@ /// <reference types="codemirror" /> | ||
autoCursor?: boolean; | ||
autoFocus?: boolean; | ||
autoScroll?: boolean; | ||
@@ -37,0 +36,0 @@ className?: string; |
@@ -91,3 +91,3 @@ 'use strict'; | ||
if (props && props.cursor) { | ||
this.delegateCursor(props.cursor, props.autoScroll || false, props.autoFocus || false); | ||
this.delegateCursor(props.cursor, props.autoScroll || false, this.editor.getOption('autofocus') || false); | ||
} | ||
@@ -117,3 +117,3 @@ if (props && props.scroll) { | ||
if (preserved && preserved.cursor) { | ||
this.delegateCursor(preserved.cursor, props.autoScroll || false, props.autoFocus || false); | ||
this.delegateCursor(preserved.cursor, props.autoScroll || false, this.editor.getOption('autofocus') || false); | ||
} | ||
@@ -434,2 +434,5 @@ }; | ||
this.shared.wire(this.props); | ||
if (this.editor.getOption('autofocus')) { | ||
this.editor.focus(); | ||
} | ||
if (this.props.editorDidMount) { | ||
@@ -436,0 +439,0 @@ this.props.editorDidMount(this.editor, this.editor.getValue(), this.initCb); |
{ | ||
"name": "react-codemirror2", | ||
"version": "4.3.0", | ||
"version": "5.0.0", | ||
"description": "a tiny react codemirror component wrapper", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -74,4 +74,3 @@ [](https://travis-ci.org/scniro/react-codemirror2) | ||
|--------------|------------------------|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------| | ||
| `autoCursor` | boolean *`true`* | `Controlled` `UnControlled` | should component cursor position correct when `value` changed | | ||
| `autoFocus` | boolean *`false`* | `Controlled` `UnControlled` | should component focus on mount | | ||
| `autoCursor` | boolean *`true`* | `Controlled` `UnControlled` | should component cursor position correct when `value` changed | | | ||
| `autoScroll` | boolean *`true`* | `Controlled` `UnControlled` | should component scroll cursor position into view when `value` changed | | ||
@@ -138,6 +137,12 @@ | `className` | string | `Controlled` `UnControlled` | pass through class *`class="react-codemirror2 className"`* | | ||
- `onBlur(editor, event)` - *[blur](https://codemirror.net/doc/manual.html#event_blur)* | ||
- `onContextMenu(editor, event)` - *[contextmenu](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onCopy(editor, event)` - *[copy](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onCursor(editor, data)`- *[cursorActivity](https://codemirror.net/doc/manual.html#event_doc_cursorActivity)* | ||
- `onCursorActivity(editor)` - *[cursorActivity](https://codemirror.net/doc/manual.html#event_cursorActivity)* | ||
- `onCut(editor, event)` - *[cut](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onDblClick(editor, event)` - *[dblclick](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onDragEnter(editor, event)` - *[dragenter](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onDragOver(editor, event)` - *[dragover](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onDragLeave(editor, event)` - *[dragleave](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onDragStart(editor, event)` - *[dragstart](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onDrop(editor, event)` - *[drop](https://codemirror.net/doc/manual.html#event_dom)* | ||
@@ -149,4 +154,7 @@ - `onFocus(editor, event)` - *[focus](https://codemirror.net/doc/manual.html#event_focus)* | ||
- `onKeyUp(editor, event)` - *[keyup](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onMouseDown(editor, event)` - *[mousedown](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onPaste(editor, event)` - *[paste](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onScroll(editor, data)` - *[scroll](https://codemirror.net/doc/manual.html#event_scroll)* | ||
- `onSelection(editor, data)` - *[beforeSelectionChange](https://codemirror.net/doc/manual.html#event_doc_beforeSelectionChange)* | ||
- `onTouchStart(editor, event)` - *[touchstart](https://codemirror.net/doc/manual.html#event_dom)* | ||
- `onUpdate(editor, event)` - *[update](https://codemirror.net/doc/manual.html#event_update)* | ||
@@ -153,0 +161,0 @@ - `onViewportChange(editor, from, to)` - *[viewportChange](https://codemirror.net/doc/manual.html#event_viewportChange)* |
41371
716
186