Add workaround for image caching in fabric js [SCI-2855]

This commit is contained in:
Oleksii Kriuchykhin 2018-11-16 17:01:48 +01:00 committed by Anton Ignatov
parent 80e525fd97
commit feb75f62e1
3 changed files with 9 additions and 5 deletions

View file

@ -18,9 +18,14 @@
}); });
} }
<<<<<<< HEAD:app/assets/javascripts/sitewide/file_preview.js.erb
function initImageEditor(data) { function initImageEditor(data) {
// var ImageEditor = require('tui-image-editor'); // var ImageEditor = require('tui-image-editor');
=======
function initImageEditor(data) {
var imageEditor;
>>>>>>> 50ccdbc6... Add workaround for image caching in fabric js [SCI-2855]:app/assets/javascripts/sitewide/file_preview.js
var blackTheme = { var blackTheme = {
'common.bi.image': '', 'common.bi.image': '',
'common.bisize.width': '0', 'common.bisize.width': '0',
@ -104,10 +109,9 @@
'colorpicker.title.color': '#fff' 'colorpicker.title.color': '#fff'
}; };
var imageEditor = new tui.ImageEditor('#tui-image-editor', { imageEditor = new tui.ImageEditor('#tui-image-editor', {
includeUI: { includeUI: {
loadImage: { loadImage: {
// path: data['large-preview-url'],
path: data['download-url'], path: data['download-url'],
name: data.filename name: data.filename
}, },
@ -146,7 +150,8 @@
} }
}).done(function() { }).done(function() {
animateSpinner(null, false); animateSpinner(null, false);
imageEditor.clearObjects(); imageEditor.destroy();
imageEditor = {};
$('#tui-image-editor').html(''); $('#tui-image-editor').html('');
$('#fileEditModal').modal('hide'); $('#fileEditModal').modal('hide');
}); });

View file

@ -50,7 +50,7 @@ class AssetsController < ApplicationController
'filename' => truncate(@asset.file_file_name, 'filename' => truncate(@asset.file_file_name,
length: length:
Constants::FILENAME_TRUNCATION_LENGTH), Constants::FILENAME_TRUNCATION_LENGTH),
'download-url' => download_asset_path(@asset) 'download-url' => download_asset_path(@asset, timestamp: Time.now.to_i)
} }
if @asset.is_image? if @asset.is_image?

View file

@ -1,7 +1,6 @@
<div id="fileEditModal" <div id="fileEditModal"
class="modal modal-file-edit" class="modal modal-file-edit"
role="dialog" role="dialog"
tabindex="-1"
aria-labelledby="fileEditModal" aria-labelledby="fileEditModal"
aria-hidden="true" aria-hidden="true"
data-backdrop="static" data-backdrop="static"