mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-19 16:04:28 -06:00
Rebuild
This commit is contained in:
parent
a64f07e1c3
commit
9d0b313320
File diff suppressed because one or more lines are too long
@ -13795,6 +13795,7 @@ SimpleMDE.prototype.render = function(el) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SimpleMDE.prototype.autosave = function() {
|
SimpleMDE.prototype.autosave = function() {
|
||||||
|
if(localStorage) {
|
||||||
var simplemde = this;
|
var simplemde = this;
|
||||||
|
|
||||||
if(this.options.autosave.uniqueId == undefined || this.options.autosave.uniqueId == "") {
|
if(this.options.autosave.uniqueId == undefined || this.options.autosave.uniqueId == "") {
|
||||||
@ -13804,20 +13805,18 @@ SimpleMDE.prototype.autosave = function() {
|
|||||||
|
|
||||||
if(simplemde.element.form != null && simplemde.element.form != undefined) {
|
if(simplemde.element.form != null && simplemde.element.form != undefined) {
|
||||||
simplemde.element.form.addEventListener("submit", function() {
|
simplemde.element.form.addEventListener("submit", function() {
|
||||||
localStorage.setItem(simplemde.options.autosave.uniqueId, "");
|
localStorage.removeItem("smde_" + simplemde.options.autosave.uniqueId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.options.autosave.loaded !== true) {
|
if(this.options.autosave.loaded !== true) {
|
||||||
if(typeof localStorage.getItem(this.options.autosave.uniqueId) == "string" && localStorage.getItem(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(this.options.autosave.uniqueId));
|
this.codemirror.setValue(localStorage.getItem("smde_" + this.options.autosave.uniqueId));
|
||||||
|
|
||||||
this.options.autosave.loaded = true;
|
this.options.autosave.loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(localStorage) {
|
localStorage.setItem("smde_" + this.options.autosave.uniqueId, simplemde.value());
|
||||||
localStorage.setItem(this.options.autosave.uniqueId, simplemde.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
var el = document.getElementById("autosaved");
|
var el = document.getElementById("autosaved");
|
||||||
if(el != null && el != undefined && el != "") {
|
if(el != null && el != undefined && el != "") {
|
||||||
@ -13841,6 +13840,22 @@ SimpleMDE.prototype.autosave = function() {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
simplemde.autosave();
|
simplemde.autosave();
|
||||||
}, this.options.autosave.delay || 10000);
|
}, this.options.autosave.delay || 10000);
|
||||||
|
} else {
|
||||||
|
console.log("SimpleMDE: localStorage not available, cannot autosave");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SimpleMDE.prototype.clearAutosavedValue = function() {
|
||||||
|
if(localStorage) {
|
||||||
|
if(this.options.autosave.uniqueId == undefined || this.options.autosave.uniqueId == "") {
|
||||||
|
console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.removeItem("smde_" + this.options.autosave.uniqueId);
|
||||||
|
} else {
|
||||||
|
console.log("SimpleMDE: localStorage not available, cannot autosave");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SimpleMDE.prototype.createSideBySide = function() {
|
SimpleMDE.prototype.createSideBySide = function() {
|
||||||
|
16
dist/simplemde.min.js
vendored
16
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user