Fix marvinjs initialization for local marvinjs setup

This commit is contained in:
Martin Artnik 2024-06-20 16:23:14 +02:00
parent 5ff531e9c7
commit cc115f0be8

View file

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