Kekule.js
Kekule.js copied to clipboard
onChange for Kekule Composer?
I'm looking for a way to set an onChange (or similar) event with the widget, there must be something similar in the code for example that enables the undo function?
I'd like to be able to set the smiles string in an external text box every time the design changes affecting the smiles string. Would really appreciate any help on this, I'm using the kekule composer widget.
Thanks in advance!
Quite sorry that I hadn't notice this issue so far... The editObjsUpdated
event can be used here, e.g.:
composer.getEditor().on('editObjsUpdated', function(e){
let mol = Kekule.ChemStructureUtils.getTotalStructFragment(composer.getChemObj());
if (mol)
let smiles = Kekule.IO.saveMimeData(mol, 'chemical/x-daylight-smiles');
});