Fix issue previewing image after edit [SCI-8914] (#5908)

* Fix issue previewing image after edit [SCI-8914]
This commit is contained in:
wandji 2023-08-09 09:38:01 +01:00 committed by GitHub
parent fcd76661c7
commit 6c18a5a622
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
/* global animateSpinner fabric PerfectScrollbar refreshProtocolStatusBar tui Uint8Array*/ /* global animateSpinner fabric PerfectScrollbar refreshProtocolStatusBar tui Uint8Array ActiveStoragePreviews*/
/* eslint-disable no-underscore-dangle */ /* eslint-disable no-underscore-dangle */
var ImageEditorModal = (function() { var ImageEditorModal = (function() {
@ -364,9 +364,14 @@ var ImageEditorModal = (function() {
contentType: false, contentType: false,
processData: false, processData: false,
success: function(res) { success: function(res) {
$(`.asset[data-asset-id=${data.id}] .image-container img`).replaceWith($(res.html).find('.image-container img')); $(`.asset[data-asset-id=${data.id}] .image-container img`)
$(`.asset[data-asset-id=${data.id}] .attachment-preview img`).replaceWith($(res.html).find('attachment-preview img')); .replaceWith($(res.html).find('.image-container img'));
$(`.asset[data-asset-id=${data.id}] .attachment-preview img`)
.replaceWith($(res.html).find('.attachment-preview img'));
$(`.asset[data-asset-id=${data.id}]`).closest('.attachments').trigger('reorder'); $(`.asset[data-asset-id=${data.id}]`).closest('.attachments').trigger('reorder');
$(`.asset[data-asset-id=${data.id}] .attachment-preview img`)
.one('error', (event) => ActiveStoragePreviews.reCheckPreview(event))
.one('load', (event) => ActiveStoragePreviews.showPreview(event));
closeEditor(); closeEditor();
} }
}); });