diff --git a/app/assets/javascripts/protocols/import_export/import.js.erb b/app/assets/javascripts/protocols/import_export/import.js.erb index 644eb4130..c76a0155c 100644 --- a/app/assets/javascripts/protocols/import_export/import.js.erb +++ b/app/assets/javascripts/protocols/import_export/import.js.erb @@ -232,18 +232,31 @@ function importProtocolFromFile( function displayTinyMceAssetInDescription(node, folder, stepGuid) { if (node.children('descriptionAssets').length === 0) { var description = node.children('description').html(); - return description.replace(/\[~tiny_mce_id:([0-9a-zA-Z]+)\]/, - 'Can\'t import image'); + return $('
').html( + description.replace(/\[~tiny_mce_id:([0-9a-zA-Z]+)\]/, + 'Can\'t import image') + .replace('','') + .replace(' ]]>', '') + ).html(); } var description = node.children('description').html(); node.find('descriptionAssets > tinyMceAsset').each(function(i, element) { var match = '[~tiny_mce_id:' + element.getAttribute('tokenId') + ']'; - var assetBytes = getAssetBytes(folder, stepGuid, element.getAttribute('fileref')); + var assetBytes = getAssetBytes(folder, + stepGuid, + element.getAttribute('fileref')); var image_tag = "" description = description.replace(match, image_tag); // replace the token with image }).bind(this); // I know is crazy but is the only way I found to pass valid HTML - return $('').html(description.replace('','') + .replace(' ]]>', '') + ).html(); } /* Navigation functions */ diff --git a/app/utilities/protocols_exporter.rb b/app/utilities/protocols_exporter.rb index 5c4a98ab9..fec668511 100644 --- a/app/utilities/protocols_exporter.rb +++ b/app/utilities/protocols_exporter.rb @@ -66,7 +66,7 @@ module ProtocolsExporter protocol_xml = "