Fix loading of MarvinJS object (when MarvinJS is disabled) [SCI-10260]

This commit is contained in:
Martin Artnik 2024-02-21 10:58:49 +01:00
parent 425b189742
commit d4f35f51bd

View file

@ -320,13 +320,16 @@ $(document).on('click', '.gene-sequence-edit-button', function() {
});
function initMarvinJs() {
if (typeof (ChemicalizeMarvinJs) === 'undefined') {
setTimeout(initMarvinJs, 100);
return;
if (!window.MarvinJsEditor) {
MarvinJsEditor = MarvinJsEditorApi();
}
MarvinJsEditor = MarvinJsEditorApi();
if (MarvinJsEditor.enabled()) {
if (typeof (ChemicalizeMarvinJs) === 'undefined') {
setTimeout(initMarvinJs, 100);
return;
}
if ($('#marvinjs-editor')[0].dataset.marvinjsMode === 'remote') {
ChemicalizeMarvinJs.createEditor('#marvinjs-sketch').then(function(marvin) {
marvin.setDisplaySettings({ toolbars: 'reporting' });