epam / ketcher

Web-based molecule sketcher
https://lifescience.opensource.epam.com/ketcher/demo.html
Apache License 2.0
485 stars 165 forks source link

Saving Ketcher settings via API #4054

Open MariaDolotova opened 9 months ago

MariaDolotova commented 9 months ago

Hi! We are now working closely with Ketcher, integrating it to our platform. And there are some questions regarding Ketcehr API, which I want to raise:

1) is there a way to get the Ketcher settings via some API method? image

2) in case we have the settings, is there a way to apply them via API also? At the moment of ketcher creation or after it was created. We are using StandaloneStructServiceProvider to create Ketcher.

Btw, is there some documentation with detailed API description? Thank you very much in advance!

rrodionov91 commented 9 months ago

Hi @MariaDolotova

We are currently working on api documentation. We will provide a link once it will be ready.

You can use a method ketcher.editor.options() to get options and ketcher.editor.setOptions() to set options. F.e: ketcher.editor.setOptions('{"atomColoring": false}')

To use these methods it needs to ketcher be initialised. So you can use it in onInit property of Editor component, as it done in our example/src/App.tsx.

Please let me know if you need something, I will glad to help.

rrodionov91 commented 8 months ago

Dear @MariaDolotova

We would be happy to help you with Ketcher integration into you product. Please reach out to us via email lifescience.opensource@epam.com to speed up the process.

MariaDolotova commented 8 months ago

Hi @rrodionov91! Thank you for the information. I have one question regarding ketcher.editor.setOptions() method. I call it inside onInit method as you suggested. And everything seems to work correctly - the options are applied. But I keep getting the following exception: image Can you please advice how to better handle it?

rrodionov91 commented 8 months ago

Hi @MariaDolotova! This error is fixed in Ketcher 2.17.0-rc.2 in the ticket https://github.com/epam/ketcher/issues/3643 Which version of Ketcher are you using?