mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-30 21:34:28 -06:00
Fix preview not rerendering when setting value
This commit is contained in:
parent
a1fd3255f9
commit
568da438c6
@ -1896,10 +1896,16 @@ SimpleMDE.prototype.createStatusbar = function(status) {
|
||||
* Get or set the text content.
|
||||
*/
|
||||
SimpleMDE.prototype.value = function(val) {
|
||||
var cm = this.codemirror;
|
||||
if(val === undefined) {
|
||||
return this.codemirror.getValue();
|
||||
return cm.getValue();
|
||||
} else {
|
||||
this.codemirror.getDoc().setValue(val);
|
||||
cm.getDoc().setValue(val);
|
||||
if(this.isPreviewActive()) {
|
||||
var wrapper = cm.getWrapperElement();
|
||||
var preview = wrapper.lastChild;
|
||||
preview.innerHTML = this.options.previewRender(val, preview);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user