From 6dea5f17ffb41bce2bd8ae914b863df4536bf288 Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Tue, 2 Nov 2021 10:26:01 +0100 Subject: [PATCH] Fix bioEddie initialization [SCI-6196] (#3624) Co-authored-by: Anton --- app/assets/javascripts/sitewide/bio_eddie.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/sitewide/bio_eddie.js b/app/assets/javascripts/sitewide/bio_eddie.js index 33b3f61d9..d4e42fbdd 100644 --- a/app/assets/javascripts/sitewide/bio_eddie.js +++ b/app/assets/javascripts/sitewide/bio_eddie.js @@ -89,11 +89,13 @@ var bioEddieEditor = (function() { $(document).on('turbolinks:load', function() { bioEddieIframe = document.getElementById('bioEddieIframe'); bioEddieModal = $('#bioEddieModal'); - bioEddieIframe.onload = function() { - BIO_EDDIE = bioEddieIframe.contentWindow.bioEddieEditor; - CHEMAXON = bioEddieIframe.contentWindow.chemaxon; - importMolecule(); - }; + if (bioEddieIframe) { + bioEddieIframe.onload = function() { + BIO_EDDIE = bioEddieIframe.contentWindow.bioEddieEditor; + CHEMAXON = bioEddieIframe.contentWindow.chemaxon; + importMolecule(); + }; + } bioEddieModal.on('shown.bs.modal', function() { initIframe();