mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 21:55:20 +08:00
Merge pull request #2170 from urbanrotnik/ur-sci-4008-rte-image-download
Fix for downloading image [SCI-4008]
This commit is contained in:
commit
169a381629
2 changed files with 9 additions and 3 deletions
|
@ -24,7 +24,7 @@ tinymce.PluginManager.add('custom_image_toolbar', function(editor) {
|
|||
});
|
||||
|
||||
function isImage(elem) {
|
||||
return editor.dom.is(elem, 'img');
|
||||
return editor.dom.is(elem, 'img') && elem.dataset.mceToken;
|
||||
}
|
||||
function isMarvinJs(elem) {
|
||||
return elem.dataset.sourceType === 'marvinjs';
|
||||
|
|
|
@ -96,8 +96,14 @@ module TinyMceImages
|
|||
|
||||
else
|
||||
# We need implement size and type checks here
|
||||
new_image = URI.parse(image['src']).open
|
||||
new_image_filename = asset.class.generate_unique_secure_token + '.jpg'
|
||||
url = image['src']
|
||||
image_type = FastImage.type(url).to_s
|
||||
next unless image_type
|
||||
|
||||
new_image = URI.parse(url).open
|
||||
next if new_image.size > Rails.configuration.x.file_max_size_mb.megabytes
|
||||
|
||||
new_image_filename = Asset.generate_unique_secure_token + '.' + image_type
|
||||
end
|
||||
|
||||
new_asset = TinyMceAsset.create(
|
||||
|
|
Loading…
Add table
Reference in a new issue