mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-21 11:17:09 +08:00
Merge pull request #7583 from rekonder/aj_SCI_10719
Fix tinyMCE images for project export [SCI-10719]
This commit is contained in:
commit
43ded7f9f4
5 changed files with 14 additions and 12 deletions
|
@ -14,7 +14,7 @@ module TinyMceImages
|
||||||
before_save :clean_tiny_mce_image_urls
|
before_save :clean_tiny_mce_image_urls
|
||||||
after_create :ensure_extracted_image_object_references
|
after_create :ensure_extracted_image_object_references
|
||||||
|
|
||||||
def prepare_for_report(field)
|
def prepare_for_report(field, export_all: false)
|
||||||
description = self[field]
|
description = self[field]
|
||||||
|
|
||||||
# Check tinymce for old format
|
# Check tinymce for old format
|
||||||
|
@ -29,6 +29,7 @@ module TinyMceImages
|
||||||
)[0]
|
)[0]
|
||||||
next unless tm_asset_to_update
|
next unless tm_asset_to_update
|
||||||
|
|
||||||
|
unless export_all
|
||||||
tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed
|
tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed
|
||||||
|
|
||||||
width_attr = tm_asset_to_update.attributes['width']
|
width_attr = tm_asset_to_update.attributes['width']
|
||||||
|
@ -39,6 +40,7 @@ module TinyMceImages
|
||||||
width_attr.value = tm_asset.image.blob.metadata['width'].to_s
|
width_attr.value = tm_asset.image.blob.metadata['width'].to_s
|
||||||
height_attr.value = tm_asset.image.blob.metadata['height'].to_s
|
height_attr.value = tm_asset.image.blob.metadata['height'].to_s
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
tm_asset_to_update.attributes['src'].value = convert_to_base64(tm_asset.image)
|
tm_asset_to_update.attributes['src'].value = convert_to_base64(tm_asset.image)
|
||||||
description = html_description.css('body').inner_html.to_s
|
description = html_description.css('body').inner_html.to_s
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<% if my_module.description.present? %>
|
<% if my_module.description.present? %>
|
||||||
<%= custom_auto_link(my_module.prepare_for_report(:description),
|
<%= custom_auto_link(my_module.prepare_for_report(:description, export_all: export_all),
|
||||||
team: current_team,
|
team: current_team,
|
||||||
simple_format: false,
|
simple_format: false,
|
||||||
base64_encoded_imgs: true) %>
|
base64_encoded_imgs: true) %>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row module-protocol-description">
|
<div class="row module-protocol-description">
|
||||||
<% if @settings.dig('task', 'protocol', 'description') && protocol.description.present? %>
|
<% if @settings.dig('task', 'protocol', 'description') && protocol.description.present? %>
|
||||||
<%= custom_auto_link(protocol.prepare_for_report(:description),
|
<%= custom_auto_link(protocol.prepare_for_report(:description, export_all: export_all),
|
||||||
team: current_team,
|
team: current_team,
|
||||||
simple_format: false,
|
simple_format: false,
|
||||||
base64_encoded_imgs: true) %>
|
base64_encoded_imgs: true) %>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="text-container ql-editor">
|
<div class="text-container ql-editor">
|
||||||
<%= custom_auto_link(result_text.prepare_for_report(:text),
|
<%= custom_auto_link(result_text.prepare_for_report(:text, export_all: export_all),
|
||||||
team: current_team,
|
team: current_team,
|
||||||
simple_format: false,
|
simple_format: false,
|
||||||
tags: %w(img),
|
tags: %w(img),
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="report-element-body">
|
<div class="report-element-body">
|
||||||
<% if step_text.text.present? %>
|
<% if step_text.text.present? %>
|
||||||
<%= custom_auto_link(step_text.prepare_for_report(:text),
|
<%= custom_auto_link(step_text.prepare_for_report(:text, export_all: export_all),
|
||||||
team: current_team,
|
team: current_team,
|
||||||
simple_format: false,
|
simple_format: false,
|
||||||
tags: %w(img),
|
tags: %w(img),
|
||||||
|
|
Loading…
Add table
Reference in a new issue