@chemaxon/marvin
    Preparing search index...

    Interface Marvin

    Functions supported by Marvin.

    interface Marvin {
        addCustomButton(button: CustomButton): Promise<void>;
        addTemplate(template: TemplateSettings): Promise<void>;
        applySettings(settings: MarvinSettings): Promise<void>;
        center(): void;
        clear(): void;
        clearHistory(): void;
        exportDocument(
            documentType: DocumentType,
            exportOptions?: ExportDocumentOptions,
        ): Promise<ExportDocumentResult>;
        exportImage(
            imageType: ImageType,
            exportOptions?: ExportOptions,
        ): Promise<ExportResult>;
        fitToCanvas(): void;
        focus(): void;
        getSelection(): Promise<string[]>;
        getSettings(): Promise<MarvinSettings>;
        importDocument(
            documentSource: string,
            importOptions?: ImportOptions,
        ): Promise<void>;
        isEmpty(): boolean;
        off(eventType: EventType, eventHandler?: EventHandler): void;
        on(
            eventType: EventType,
            eventHandler: EventHandler,
            eventInit?: ReopenEventInitializer,
        ): void;
        removeTemplate(template: TemplateSettings): void;
        removeUI(): void;
        setSelection(ids: string[]): Promise<void>;
    }
    Index
    • Add a new custom button on the toolbar.

      Parameters

      • button: CustomButton

        the button definition including id, name, icon

      Returns Promise<void>

    • Add a new template to the template list on the left sidebar.

      Parameters

      • template: TemplateSettings

        the template definition including name, structure and icon

      Returns Promise<void>

      error if a structure is invalid or does not contain any molecules or a template with the given name was already added before

    • Applies editor settings.

      Parameters

      • settings: MarvinSettings

        set of settings client would like to apply.

      Returns Promise<void>

    • Moves to drawing center if not empty.

      Returns void

    • Clears canvas.

      Returns void

    • Resets undo stack.

      Returns void

    • Exports the current content of the canvas as a document format.

      Parameters

      • documentType: DocumentType

        the document type in which to export, e.g. CXON, MRV, Mol:V2, Mol:V3, SMILES, CXSMILES, SMARTS, CXSMARTS, InChI, InChIKey, CDX, CDXML, SKC, SDF, RDF, RXN.

      • OptionalexportOptions: ExportDocumentOptions

        optional settings to apply during export.

      Returns Promise<ExportDocumentResult>

      The generated document as a string value.

    • Exports the current content of the canvas as an image.

      Parameters

      • imageType: ImageType

        currently supported image types: JPG, PNG, SVG, WEBP (WebP image format is partially supported on Safari).

      • OptionalexportOptions: ExportOptions

        settings to be used for image export.

      Returns Promise<ExportResult>

      The generated image as a string value.

    • Fits the view around the canvas content by adjusting zoom and pan.

      Returns void

    • Requests focus on the editor canvas. Focus is only acquired if the canvas is freely accessible (no dialog or overlay is currently open).

      Returns void

    • Gets the current selection from the canvas. Selection is returned as a string array containing the CXON ids of the selected atoms.

      Returns Promise<string[]>

    • Imports document. Content is displayed on the previously cleared canvas.

      Parameters

      • documentSource: string

        the document content. Source format determined automatically.

      • OptionalimportOptions: ImportOptions

        to configure import if differ from default. Default values are { clearCanvas: true, select: false, throwError: true, placement: 'TOP_LEFT', scale: 'NONE' }

      Returns Promise<void>

      error if document or its content is invalid

    • Determines whether the canvas is empty or not.

      Returns boolean

      true if nothing on the canvas, else false.

    • Deregister a previously registered event handler.

      Parameters

      • eventType: EventType

        the event type associated to the client event handler.

      • OptionaleventHandler: EventHandler

        the event handler function.

      Returns void

    • Remove a template from the template list on the left sidebar.

      Parameters

      • template: TemplateSettings

        the template definition including name, structure and icon

      Returns void

    • Removes Marvin from the dom.

      Returns void

    • Sets the selection on the canvas. Argument must contain CXON ids of the atoms to be selected.

      Parameters

      • ids: string[]

      Returns Promise<void>