Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving Ketcher settings via API #4054

Open
MariaDolotova opened this issue Feb 8, 2024 · 4 comments
Open

Saving Ketcher settings via API #4054

MariaDolotova opened this issue Feb 8, 2024 · 4 comments
Assignees

Comments

@MariaDolotova
Copy link

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
Copy link
Collaborator

rrodionov91 commented Feb 8, 2024

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
Copy link
Collaborator

Dear @MariaDolotova

We would be happy to help you with Ketcher integration into you product. Please reach out to us via email [email protected] to speed up the process.

@MariaDolotova
Copy link
Author

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
Copy link
Collaborator

Hi @MariaDolotova!
This error is fixed in Ketcher 2.17.0-rc.2 in the ticket #3643
Which version of Ketcher are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants