Skip to main content

Editor API overview

Editor methods

NameDescription
destructor() Removes a diagram editor instance and releases occupied resources
import()Imports data from an existing diagram into the editor
paint()Repaints the editor
parse()Loads data into the editor from a local data source
serialize()Serializes the data of the editor into an array of JSON objects
zoomIn()Zooms in the diagram
zoomOut()Zooms out the diagram

Editor events

NameDescription
afterGroupMoveFires when a group or swimlane is moved one grid step
afterItemCatchFires after an item is caught
afterItemMoveFires when an item is moved one grid step
afterLineTitleMoveFires when a text element of a line is moved one grid step
afterShapeIconClickFires after clicking a control in the per-item toolbar
afterShapeMoveFires when a shape is moved one grid step
beforeGroupMoveFires before a group or swimlane is moved
beforeItemCatchFires before an item is caught
beforeItemMoveFires before an item is moved
beforeLineTitleMoveFires before a text element of a line is moved
beforeShapeIconClickFires before clicking a control in the per-item toolbar
beforeShapeMoveFires before a shape is moved
groupMoveEndFires after a group or swimlane is moved
itemMoveEndFires after an item is moved
itemTargetFires when the moved item is hovering over the target item
lineTitleMoveEndFires after a text element of a line is moved
shapeMoveEndFires after a shape is moved
shapeResizeFires after a shape has been resized
zoomInFires after the Zoom In button is clicked or the zoomIn() method is called
zoomOutFires after the Zoom Out button is clicked or the zoomOut() method is called

Editor properties

NameDescription
autoplacement Optional. An object with configuration settings for auto-placement of shapes
connectionPointsOptional. Enables/disables an ability to connect shapes using connection controls
defaultsOptional. An object which sets the default configuration of a shape or a line
editModeOptional. Hides/shows the left/right panels of the editor
gridOptional. Enables/disables a grid that is displayed on the editor canvas
gridStepOptional. Sets the size of a grid step that defines the step of moving an item
itemsDraggableOptional. Enables/disables dragging the item from one parent item to another
lineConfigOptional. An object with default configuration for the newly added connector lines
magneticOptional. Defines whether snap lines should be shown when moving a shape. If so, allows configuring their appearance
resizePointsOptional. Enables/disables an ability to resize shapes using resize controls
scaleOptional. Defines the diagram editor scale
shapeToolbar Optional. Defines which controls should be shown in the personal toolbar of diagram items
shapeTypeOptional. The type of the items
typeRequired. Specifies the mode of the diagram editor
viewAn object that configures Toolbar, Shapebar, and Editbar views of the Diagram Editor