diff --git a/app/models/concerns/tiny_mce_images.rb b/app/models/concerns/tiny_mce_images.rb index 3a2761f9e..0267a17f6 100644 --- a/app/models/concerns/tiny_mce_images.rb +++ b/app/models/concerns/tiny_mce_images.rb @@ -14,7 +14,7 @@ module TinyMceImages before_save :clean_tiny_mce_image_urls after_create :ensure_extracted_image_object_references - def prepare_for_report(field) + def prepare_for_report(field, export_all: false) description = self[field] # Check tinymce for old format @@ -29,15 +29,17 @@ module TinyMceImages )[0] next unless tm_asset_to_update - tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed + unless export_all + tm_asset = tm_asset.image.representation(resize_to_limit: Constants::LARGE_PIC_FORMAT).processed - width_attr = tm_asset_to_update.attributes['width'] - height_attr = tm_asset_to_update.attributes['height'] + width_attr = tm_asset_to_update.attributes['width'] + height_attr = tm_asset_to_update.attributes['height'] - if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] || - height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1]) - width_attr.value = tm_asset.image.blob.metadata['width'].to_s - height_attr.value = tm_asset.image.blob.metadata['height'].to_s + if width_attr && height_attr && (width_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[0] || + height_attr.value.to_i >= Constants::LARGE_PIC_FORMAT[1]) + width_attr.value = tm_asset.image.blob.metadata['width'].to_s + height_attr.value = tm_asset.image.blob.metadata['height'].to_s + end end tm_asset_to_update.attributes['src'].value = convert_to_base64(tm_asset.image) diff --git a/app/views/reports/elements/_my_module_element.html.erb b/app/views/reports/elements/_my_module_element.html.erb index 9f0c30da2..43d9fd665 100644 --- a/app/views/reports/elements/_my_module_element.html.erb +++ b/app/views/reports/elements/_my_module_element.html.erb @@ -51,7 +51,7 @@
<% 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, simple_format: false, base64_encoded_imgs: true) %> diff --git a/app/views/reports/elements/_my_module_protocol_element.html.erb b/app/views/reports/elements/_my_module_protocol_element.html.erb index 864a4af1a..9fd76c321 100644 --- a/app/views/reports/elements/_my_module_protocol_element.html.erb +++ b/app/views/reports/elements/_my_module_protocol_element.html.erb @@ -14,7 +14,7 @@
<% 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, simple_format: false, base64_encoded_imgs: true) %> diff --git a/app/views/reports/elements/_my_module_result_text_element.html.erb b/app/views/reports/elements/_my_module_result_text_element.html.erb index e4b259dc0..b3b96926f 100644 --- a/app/views/reports/elements/_my_module_result_text_element.html.erb +++ b/app/views/reports/elements/_my_module_result_text_element.html.erb @@ -19,7 +19,7 @@
- <%= 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, simple_format: false, tags: %w(img), diff --git a/app/views/reports/elements/_step_text_element.html.erb b/app/views/reports/elements/_step_text_element.html.erb index 927871b0f..01c274f89 100644 --- a/app/views/reports/elements/_step_text_element.html.erb +++ b/app/views/reports/elements/_step_text_element.html.erb @@ -14,7 +14,7 @@
<% 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, simple_format: false, tags: %w(img),