Fix reloading of marvinjs attachments [SCI-10903]

This commit is contained in:
Andrej 2024-07-18 15:30:18 +02:00
parent 5c9eed307f
commit 9116ef7456

View file

@ -202,10 +202,14 @@ var MarvinJsEditorApi = (function() {
} }
$(marvinJsModal).modal('hide'); $(marvinJsModal).modal('hide');
config.editor.focus(); if (config.editor) config.editor.focus();
config.button.dataset.inProgress = false; config.button.dataset.inProgress = false;
if (MarvinJsEditor.saveCallback) MarvinJsEditor.saveCallback(); if (MarvinJsEditor.saveCallback) {
MarvinJsEditor.saveCallback();
delete MarvinJsEditor.saveCallback;
}
}, },
error: function(response) { error: function(response) {
if (response.status === 403) { if (response.status === 403) {
@ -264,8 +268,8 @@ var MarvinJsEditorApi = (function() {
MarvinJsEditor.save(config); MarvinJsEditor.save(config);
} else if (config.mode === 'edit') { } else if (config.mode === 'edit') {
config.objectType = 'Asset'; config.objectType = 'Asset';
MarvinJsEditor.saveCallback = (() => window.location.reload());
MarvinJsEditor.update(config); MarvinJsEditor.update(config);
location.reload();
} else if (config.mode === 'new-tinymce') { } else if (config.mode === 'new-tinymce') {
config.objectType = 'TinyMceAsset'; config.objectType = 'TinyMceAsset';
MarvinJsEditor.save(config); MarvinJsEditor.save(config);