mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-29 02:40:16 +02:00
Merge pull request #404 from hansottowirtz/fix_399
Fix preview not rerendering when setting value
This commit is contained in:
commit
7e58a01a35
|
@ -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…
Reference in a new issue