Fix marvinjs initialization for local marvinjs setup (#7656)

Co-authored-by: Martin Artnik <martin@scinote.net>
This commit is contained in:
Alex Kriuchykhin 2024-06-21 10:40:36 +02:00 committed by GitHub
parent 5ff531e9c7
commit 3cb610280d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;