nmrium icon indicating copy to clipboard operation
nmrium copied to clipboard

Use encoding custom atom labels to check molecule edition

Open lpatiny opened this issue 3 months ago • 2 comments

Current we check if the molecule was edited by using idCode. However this does not include the custom labels. This means that if they are changed we consider no changes ...

Image

Before edition / after edition the canonized idCode with custom label should be compared

https://cheminfo.github.io/openchemlib-js/classes/Canonizer.html

Code should be something like:

const canonizer = new Canonizer(molecule, {encodeAtomCustomLabels: true});
const idCode = canonizer.getIDCode();

lpatiny avatar Oct 14 '25 12:10 lpatiny

@lpatiny

The issue is that the onChange callback is not triggered in the CanvasMoleculeEditor component from react-ocl.

hamed-musallam avatar Oct 28 '25 09:10 hamed-musallam

Current we check if the molecule was edited by using idCode.

This is wrong. We use molfile v3000 (and we don't check if it changed): https://github.com/cheminfo/nmrium/blob/776deabbee26425d4316414eea5dea232acafbfd/src/component/modal/MoleculeStructureEditorModal.tsx#L56-L62

I updated OCL in https://github.com/cheminfo/nmrium/pull/3805, but unfortunately, your example is not fixed by it. We still don't get any event when you change the carbon like that with the keyboard.

targos avatar Nov 02 '25 09:11 targos