Open chj93 opened 2 years ago
Hi @chj93, it's a pity that some hacks are needed to accomplish the default input/output format before. So some new commits are submitted today. With these new dist files, you may use the following codes:
composer.getEditor().setDefaultInputFormatId(Kekule.IO.DataFormat.SMILES);
composer.getEditor().setDefaultOutputFormatId(Kekule.IO.DataFormat.SMILES);
By the way, the loading SMILES depends on the extra OpenBabel.wasm module, so you need to enable that module first:
Kekule.OpenBabel.enable(function(error){
if (!error)
{
composer.getEditor().setDefaultInputFormatId(Kekule.IO.DataFormat.SMILES);
}
});
Hi @partridgejiang, Thanks for your kind reply! I'm using 'Kekule' by installing it as an npm package. The latest release (v.0.9.7) cannot be used because the new commit history is not reflected. Can I request a new release that reflects the new commits?
Just getting the files in /dist directory of this repo and replacing the ones downloaded with npm should work, :).
With help, in case 1, it works normally. However, in case 2, it does not work because 'Smi' does not exist in the 'Load data' button in the first place. Can you help me with this?? thank you :)
Kekule.OpenBabel.enable(function(error) {
if (!error) {
composer.getEditor().setDefaultInputFormatId(Kekule.IO.DataFormat.SMILES);
}
});
// composer.getEditor().setDefaultInputFormatId(Kekule.IO.DataFormat.SMILES);
composer.getEditor().setDefaultOutputFormatId(Kekule.IO.DataFormat.SMILES);
Hi @chj93, please check if there are errors in the browser console and whether openbabel.wasm is properly loaded when running the following code:
Kekule.OpenBabel.enable(function(error) {
if (!error) {
composer.getEditor().setDefaultInputFormatId(Kekule.IO.DataFormat.SMILES);
}
});
Since the OpenBabel is a web assembly module, the whole page should be launched in a web server with http(s) protocal, and the mime type of .wasm file may also need to be correctly configurated in the web server.
By the way, a small demo page is attached below, you may run it in your own web server, :)
@partridgejiang First off, I am huge fan of the project. Thanks for all the work :)
I am using Kekule.Editor.Composer.
I searched the documentation for a day and couldn't find a way. Is there any easy way to solve it? thank you!