Skip to content

Commit de1abff

Browse files
author
Grant Ammons
committed
Only update simplemde value if the value has changed
Fixes an issue where react renders because of a change that doesn't involve simpleMDE, and the cursor in simpleMDE would go to the top. Traced it down to this, we should only be setting the `simplemde.value` if the next value does not equal the current value.
1 parent abb3fd3 commit de1abff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = React.createClass({
3333
},
3434

3535
componentWillReceiveProps: function(nextProps) {
36-
if (!this.state.keyChange) {
36+
if (!this.state.keyChange && (nextProps.value !== this.simplemde.value())) {
3737
this.simplemde.value(nextProps.value)
3838
}
3939

0 commit comments

Comments
 (0)