What Is Ketcher Editor Interface

Q

What is Ketcher Editor interface?

✍: FYIcenter.com

A

Ketcher Editor interface is part of the Ketcher JavaScript API that allows you to interact with Ketcher editor UI elements.

To access Ketcher Editor interface, you need to access the "ketcher" object as a property of the content "window" object of the "iframe" where the Ketcher is loaded. Then you need to access the "editor" object as a property of the "ketcher" object:

lst = document.getElementsByTagName("iframe");
frm = lst[0];
win = frm.contentWindow;
ketcher = win.ketcher;
editor = ketcher.editor;

With the "editor" object, you can access the following main methods provided by the Ketcher Editor interface:

  • editor.alignDescriptors() - Aligns descriptors in the editor.
  • editor.clear() - Clears the editor by removing the structure in the editor.
  • editor.explicitSelected() - Returns selected elements from the editor.
  • editor.options() - Returns current options from the editor.
  • editor.redo() - Re-does the last un-do change. in the editor.
  • editor.setOptions(opts) - Sets options in the editor.
  • editor.setOrigin() - Sets the origin of coordinates in the editor.
  • editor.struct() - Returns the entire structure from the editor.
  • editor.structSelected() - Returns the selected substructure from the editor.
  • editor.undo() - Un-does the last change.
  • editor.zoom(factor) - Zooms in or out the view in the editor.

See next tutorials for examples on how to use these methods.

 

editor.struct() - Get Entire Structure

Ketcher Editor Interface

Ketcher Editor Interface

⇑⇑ Ketcher - Chemical Structure Editor

2023-12-08, 339🔥, 0💬