mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +08:00
Merge pull request #2132 from aignatov-bio/ai-sci-3676-fix-tinymce-import-from-eln
Fix TinyMCE import from .eln [SCI-3972]
This commit is contained in:
commit
4439ffce6c
|
@ -157,10 +157,11 @@ module ProtocolsImporter
|
|||
|
||||
# Decode the file bytes
|
||||
file = StringIO.new(Base64.decode64(tiny_mce_img_json['bytes']))
|
||||
tiny_mce_img.image.attach(io: file,
|
||||
to_blob = ActiveStorage::Blob.create_after_upload!(io: file,
|
||||
filename: tiny_mce_img_json['fileName'],
|
||||
content_type: tiny_mce_img_json['fileType'],
|
||||
metadata: JSON.parse(tiny_mce_img_json['fileMetadata'] || '{}'))
|
||||
tiny_mce_img.image.attach(to_blob)
|
||||
if description.gsub!("data-mce-token=\"#{tiny_mce_img_json['tokenId']}\"",
|
||||
"data-mce-token=\"#{Base62.encode(tiny_mce_img.id)}\"")
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue