Open FreedomClannad opened 2 years ago
Perhaps you can just import the kekule.min.js
file? Something like the following:
import * as K from 'kekule-dist-dir/kekule.min.js';
console.log(Kekule.VERSION); // the `Kekule` namespace is automatically imported to the global scope
By the way, The latest dist files solves some minor issues with import
and are recommended for your test, :).
thank you very much
@partridgejiang and how to read a smiles string using vue3 + ts. The below script doesn't work, while Kekule.IO.loadFormatData(cmlData, 'cml')
work.
import * as K from 'kekule/dist/kekule.min.js'
let Smiles= "C2=Cc1ccccc1C2"
var mol = Kekule.IO.loadFormatData(Smiles, 'smi')
Hi @ZhitaoTian, the SMILES output is supported natively with Kekule.js, while the input relies on the external OpenBabel module. So you need to manually enable it before load a SMILES format string:
Kekule.OpenBabel.enable(function(error){
if (!error)
{
let mol = Kekule.IO.loadFormatData('C2=Cc1ccccc1C2', 'smi');
}
});
In the environment where I use vue3 + ts, if I want to use this plug-in, I can only use import. I think the document can only be used in the required format. Ask if there are any other solutions.