mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-09 09:22:16 +02:00
Fix initial value overwriting autosaved value
This commit is contained in:
parent
36f97604f4
commit
d30d9b7d00
|
@ -941,7 +941,7 @@ function SimpleMDE(options) {
|
||||||
// The codemirror component is only available after rendering
|
// The codemirror component is only available after rendering
|
||||||
// so, the setter for the initialValue can only run after
|
// so, the setter for the initialValue can only run after
|
||||||
// the element has been rendered
|
// the element has been rendered
|
||||||
if(options.initialValue) {
|
if(options.initialValue && (!this.options.autosave || this.options.autosave.foundSavedValue !== true)) {
|
||||||
this.value(options.initialValue);
|
this.value(options.initialValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1081,8 +1081,10 @@ SimpleMDE.prototype.autosave = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.autosave.loaded !== true) {
|
if(this.options.autosave.loaded !== true) {
|
||||||
if(typeof localStorage.getItem("smde_" + this.options.autosave.uniqueId) == "string" && localStorage.getItem("smde_" + this.options.autosave.uniqueId) != "")
|
if(typeof localStorage.getItem("smde_" + this.options.autosave.uniqueId) == "string" && localStorage.getItem("smde_" + this.options.autosave.uniqueId) != "") {
|
||||||
this.codemirror.setValue(localStorage.getItem("smde_" + this.options.autosave.uniqueId));
|
this.codemirror.setValue(localStorage.getItem("smde_" + this.options.autosave.uniqueId));
|
||||||
|
this.options.autosave.foundSavedValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.options.autosave.loaded = true;
|
this.options.autosave.loaded = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue