From 8fc9aca5481f03d9017665d295c9c9ae9b83f5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saray=20Cabrera=20Padr=C3=B3n?= Date: Thu, 26 Aug 2021 12:19:59 +0200 Subject: [PATCH] Disable editor's save button while it is saving After pressing the save button, the saving can take a while. During that time a progress bar appears and the save button should be disabled to avoid getting many save requests and consequently duplicated revisions of the file. --- src/api/app/assets/javascripts/webui/cm2/use-codemirror.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/app/assets/javascripts/webui/cm2/use-codemirror.js b/src/api/app/assets/javascripts/webui/cm2/use-codemirror.js index 7da3bb2b3a3..6e97fad2d3f 100644 --- a/src/api/app/assets/javascripts/webui/cm2/use-codemirror.js +++ b/src/api/app/assets/javascripts/webui/cm2/use-codemirror.js @@ -81,6 +81,7 @@ function use_codemirror(id, read_only, mode, big_editor) { var data = textarea.data('data'); data[data['submit']] = editors[id].getValue(); data['comment'] = $("#comment_" + id).val(); + $(this).prop('disabled', true); $("#loading_" + id).attr('disabled', true).removeClass("d-none"); $.ajax({ url: textarea.data('save-url'),