partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
250 stars 61 forks source link

Copy and Paste in editor. #165

Closed cleblond closed 4 years ago

cleblond commented 4 years ago

One of my users occasionally creates editor/composer content in which the objects can't be exported as molfile's. For example, import the attached json string, then attempt to export/save as molfile. I suspect this is a result of copy/paste operations in composer. There are redundant type: Kekule.ChemObjList objects.

jh_issue_json_simple.txt

partridgejiang commented 4 years ago

Hi @cleblond, the problem of exporting mol file has been fixed now, please check the latest dist files. btw, still wondering when a nested ChemObjList is created by copy/paste operations..., :(

cleblond commented 4 years ago

Unfortunately I tried the new dist files and I'm still unable to export the jh_issue_json_simple.txt as molfile. Attached is the more complex json that caused the issue and can't be exported as molfile's. I believe this user must have been copy/pasting a lot...not sure if that has any impact.

Thank you very much for you help considering the issues our world is facing.

jh_issue_json.txt

partridgejiang commented 4 years ago

Hi cleblond, please check if Kekule.VERSION is '0.9.5.20032500' in your tests, it's a little bewildered since both jh_issue_json and jh_issue_json_simple passed in my own tests. image

cleblond commented 4 years ago

I'm using the dist from master and it says 0.9.5.20022800 Carl

partridgejiang commented 4 years ago

Hi @cleblond, please update with the dist files published yesterday in master branch. Your version seems to be the one published last month.

cleblond commented 4 years ago

Must be something I don't understand about git and/or github I guess.

I'm on branch master and I do a git pull. I then use the files from dist and it says version 0.9.5.20022800. Try again...This time I delete the Kekule.js repo and clone it from your github url and again the dist is 0.9.5.20022800. I've used both kekule.js and kekule.min.js and they say 0.9.5.20022800. What am I missing?

partridgejiang commented 4 years ago

Confused too... Just try the following zip file? Extract it and overwrite existing .min.js: dist.zip

cleblond commented 4 years ago

Ok that shows I'm using '0.9.5.20032500'. I can now export as molfiles, however using composer.exportObjs(Kekule.Molecule) doesn't work.

var mols = composer.exportObjs(Kekule.Molecule); console.log(mols); // mols is empty

partridgejiang commented 4 years ago

Please check the latest dist file (or the zip below), the exportObjs should returns correct array now. dist.zip

cleblond commented 4 years ago

Works! Thanks!