Questions on Gojs Diagram - Context menu/Create different diagram with drag/drop

  1. showing a context menu automatically after user drops the diagram on a layout from canvas & how to customize that context menu?
  2. How to draw a different diagram from a button drag & drop
    example - I want to show a button in canvas left side and when user drag/drop this button to layout, it should generate a different diagram for that button. Can you please let me know how to achieve this?

Thank you


You can call CommandHandler.showContextMenu at the end of the drop. Something like

myDiagram.addDiagramListener('ExternalObjectsDropped', function(e) {


You could delete the object on drop, or else load an entirely different model on drop, depending on what the node is that you dropped.

myDiagram.addDiagramListener('ExternalObjectsDropped', function(e) {
  // e.subject.first() is a reference to the first object you dropped