import * as DG from 'datagrok-api/dg'; import * as ui from 'datagrok-api/ui'; import * as grok from 'datagrok-api/grok'; import { Subject, Subscription } from 'rxjs'; // @ts-ignore import '../css/style.css'; let chemDrawId = 1; export const _package = new DG.Package(); export let _properties: { [key: string]: any }; const INIT_TIMEOUT_MS = 30000; //tags: init export async function initChemDraw() { _properties = _package.settings; } //name: ChemDraw //tags: moleculeSketcher //output: widget sketcher export function chemDrawSketcher() { return new ChemDrawSketcher(); } class ChemDrawSketcher extends grok.chem.SketcherBase { initialized = new Subject(); _smiles: string | null = null; _molV2000: string | null = null; _molV3000: string | null = null; _smarts: string | null = null; _sketcher: any = null; _importing = false; private _initSub: Subscription | null = null; private _styleEl: HTMLStyleElement | null = null; async init(host: any) { if (!_properties.LicensePath) { this.root.append(ui.divText(`Licence is not available`, 'license-not-available')); return; } const sketchId = `chemdraw-${chemDrawId++}`; const div = ui.div(); div.id = `chemdrawjs-container-${sketchId}`; // Raise ChemDrawJS toolbar pop-overs above the hosting Datagrok dialog/popup; // without this they render *behind* the dialog they're embedded in. The injected //