prevent autosave when editing content

This commit is contained in:
Diego Najar 2018-10-30 16:17:15 +01:00
parent 2317100a81
commit 507d89e606
1 changed files with 7 additions and 2 deletions

View File

@ -411,13 +411,18 @@ $(document).ready(function() {
// Autosave // Autosave
// Autosave works when the content of the page is bigger than 100 characters // Autosave works when the content of the page is bigger than 100 characters
var currentContent = editorGetContent();
setInterval(function() { setInterval(function() {
var uuid = $("#jsuuid").val(); var uuid = $("#jsuuid").val();
var title = $("#jstitle").val(); var title = $("#jstitle").val();
var content = editorGetContent(); var content = editorGetContent();
var ajax = new bluditAjax(); var ajax = new bluditAjax();
// showAlert is the function to display an alert defined in alert.php // Call autosave only when the user change the content
ajax.autosave(uuid, title, content, showAlert); if (currentContent!=content) {
currentContent = content;
// showAlert is the function to display an alert defined in alert.php
ajax.autosave(uuid, title, content, showAlert);
}
},1000*60*AUTOSAVE_INTERVAL); },1000*60*AUTOSAVE_INTERVAL);
}); });