-
Notifications
You must be signed in to change notification settings - Fork 186
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
#5990 – Extend Ketcher API to allow updating monomers library #6020
#5990 – Extend Ketcher API to allow updating monomers library #6020
Conversation
2f8753f
to
8185dac
Compare
…ate API docs in README
e8de89e
to
97a27ba
Compare
existingMonomerRefIndex | ||
]; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
delete this._monomersLibraryParsedJson![existingMonomerIdToUse]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to write
if (!this._monomersLibraryParsedJson) {
return
}
Than use several times non-null assertion
|
||
if (!editor) { | ||
throw new Error( | ||
'Updating monomer library in small molecules mode is not allowed, please switch to macromolecules mode', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can store libraries somewhere and use them on macro mode initialization stage
public updateMonomersLibrary(rawMonomersData: string | JSON) { | ||
const editor = CoreEditor.provideEditorInstance(); | ||
|
||
ketcherProvider.getKetcher(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this call?
let persistentMonomersLibrary: MonomerItemType[] = []; | ||
let persistentMonomersLibraryParsedJson: IKetMacromoleculesContent | null = | ||
null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we can allow to call api several times and update library several times consequently? In this case we need to store array of libraries
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Check list
#1234 – issue name