Skip to content

Commit 9517265

Browse files
committed
Add name prop, deprecate path with warning
1 parent 6614f62 commit 9517265

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Codemirror.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const CodeMirror = createReactClass({
1717
className: PropTypes.any,
1818
codeMirrorInstance: PropTypes.func,
1919
defaultValue: PropTypes.string,
20+
name: PropTypes.string,
2021
onChange: PropTypes.func,
2122
onCursorActivity: PropTypes.func,
2223
onFocusChange: PropTypes.func,
@@ -41,6 +42,9 @@ const CodeMirror = createReactClass({
4142
},
4243
componentWillMount () {
4344
this.componentWillReceiveProps = debounce(this.componentWillReceiveProps, 0);
45+
if (this.props.path) {
46+
console.error('Warning: react-codemirror: the `path` prop has been changed to `name`');
47+
}
4448
},
4549
componentDidMount () {
4650
const codeMirrorInstance = this.getCodeMirrorInstance();
@@ -117,7 +121,7 @@ const CodeMirror = createReactClass({
117121
<div className={editorClassName}>
118122
<textarea
119123
ref={ref => this.textareaNode = ref}
120-
name={this.props.path}
124+
name={this.props.name || this.props.path}
121125
defaultValue={this.props.value}
122126
autoComplete="off"
123127
autoFocus={this.props.autoFocus}

0 commit comments

Comments
 (0)