DouglasConnect / jsme-react

11 stars 13 forks source link

Can not fetch svg format #7

Open DevanshiShah29 opened 3 years ago

DevanshiShah29 commented 3 years ago

Hi, I’m using jsme-react library in one of my projects. In the project, the aim is to display smiles along with the svg format which I am unable to achieve with library. 

I am able to achieve the desired result by adding the “getMolecularAreaGraphicsString()” method in onChange event as shown in below code snippet:

_defineProperty(_assertThisInitialized(_this), "handleChange", function (jsmeEvent) {
  if (_this.props.onChange) {
    _this.props.onChange(jsmeEvent.src.smiles(),
    _this.jsmeApplet.getMolecularAreaGraphicsString()
    );
  }
});

Are there any other options by which the desired output can be achieved? Any kind of help/suggestions would be appreciated

jsme-editor commented 3 years ago

Just a note or recommendation. It is better to use jsmeEvent.src instead of _this.jsmeApplet. Both point to the same editor, but in case the page has more than one instance of JSME, jsmeEvent.src will provide the right JSME instance that has triggered the event.