Fix bio eddie iframe loading [SCI-6001]

This commit is contained in:
Anton 2021-10-14 13:10:11 +02:00
parent b432b06ab1
commit 451eb97657

View file

@ -15,22 +15,8 @@ var bioEddieEditor = (function() {
}
}
function loadBioEddie() {
BIO_EDDIE = bioEddieIframe.contentWindow.bioEddieEditor;
CHEMAXON = bioEddieIframe.contentWindow.chemaxon;
if (typeof BIO_EDDIE === 'undefined' || typeof CHEMAXON === 'undefined') {
setTimeout(function() {
loadBioEddie();
}, 2000);
} else {
importMolecule();
}
}
function initIframe() {
bioEddieIframe.src = bioEddieIframe.dataset.src;
loadBioEddie();
}
function saveMolecule(svg, structure, scheduleForRegistration) {
@ -103,6 +89,11 @@ 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();
};
bioEddieModal.on('shown.bs.modal', function() {
initIframe();