From 9116ef7456b8ed8f23d47663a101b27f43aa5865 Mon Sep 17 00:00:00 2001 From: Andrej Date: Thu, 18 Jul 2024 15:30:18 +0200 Subject: [PATCH] Fix reloading of marvinjs attachments [SCI-10903] --- app/assets/javascripts/sitewide/marvinjs_editor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/sitewide/marvinjs_editor.js b/app/assets/javascripts/sitewide/marvinjs_editor.js index a334bf9f5..2afdc0196 100644 --- a/app/assets/javascripts/sitewide/marvinjs_editor.js +++ b/app/assets/javascripts/sitewide/marvinjs_editor.js @@ -202,10 +202,14 @@ var MarvinJsEditorApi = (function() { } $(marvinJsModal).modal('hide'); - config.editor.focus(); + if (config.editor) config.editor.focus(); + config.button.dataset.inProgress = false; - if (MarvinJsEditor.saveCallback) MarvinJsEditor.saveCallback(); + if (MarvinJsEditor.saveCallback) { + MarvinJsEditor.saveCallback(); + delete MarvinJsEditor.saveCallback; + } }, error: function(response) { if (response.status === 403) { @@ -264,8 +268,8 @@ var MarvinJsEditorApi = (function() { MarvinJsEditor.save(config); } else if (config.mode === 'edit') { config.objectType = 'Asset'; + MarvinJsEditor.saveCallback = (() => window.location.reload()); MarvinJsEditor.update(config); - location.reload(); } else if (config.mode === 'new-tinymce') { config.objectType = 'TinyMceAsset'; MarvinJsEditor.save(config);