-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
I want to add a function to a common button. #288
Comments
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! |
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. 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!
The text was updated successfully, but these errors were encountered: