Pop up context menu on ExternalObjectsDropped

How can i do a pop up context menu on externalobjeindent preformatted text by 4 spacesctsdropped event?
This is what I have:

“ExternalObjectsDropped”: function(e){
console.log(“dropped”)
cxTool.showContextMenu(cxTool, null)

          }

It produces the context menu but I get this error:
go.js:13 Uncaught Error: ContextMenuTool.currentContextMenu value is not an instance of Adornment: ContextMenu Tool

You could do it that way, but it requires some more setup and then running of the ContextMenuTool.

It’s easier just to call CommandHandler.showContextMenu, http://gojs.net/latest/api/symbols/CommandHandler.html#showContextMenu

Hi Thank you for responding.

I did do :

cxTool.showContextMenu(e.targetObject)

But I get the following error:

Uncaught Error: ContextMenuTool.currentContextMenu value is not an instance of Adornment: undefined

cxTool is my commandHandler

I have it working on right click of the node, I want to change it to just dropping onto the pallete pop up contexmenu

Try this “ExternalObjectsDropped” DiagramEvent listener:

    "ExternalObjectsDropped": function(e) {
        setTimeout(function() { e.diagram.commandHandler.showContextMenu(); }, 1);
    },

Thank you it worked!! I guess I was running two functions at the same time, so i couldn’t get the response quick enough. thank you