From 507d89e606ac8b8e97b9631c00fb84877b95f1d9 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 30 Oct 2018 16:17:15 +0100 Subject: [PATCH] prevent autosave when editing content --- bl-kernel/admin/views/edit-content.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index 992c6443..d63b6744 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -411,13 +411,18 @@ $(document).ready(function() { // Autosave // Autosave works when the content of the page is bigger than 100 characters + var currentContent = editorGetContent(); setInterval(function() { var uuid = $("#jsuuid").val(); var title = $("#jstitle").val(); var content = editorGetContent(); var ajax = new bluditAjax(); - // showAlert is the function to display an alert defined in alert.php - ajax.autosave(uuid, title, content, showAlert); + // Call autosave only when the user change the content + 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); });