That’s a bug that has been fixed in the most recent releases.
But the right thing to do is to make sure there’s no context menu shown in the Palette. The easiest way to do that when initializing the Palette is to disable the ContextMenuTool. Something like:
$(go.Palette, . . .,
{ . . .,
"contextMenuTool.isEnabled": false
})
Add below code in showContextMenu() function
if (diagram instanceof go.Palette)
return;
Example:
function showContextMenu(obj, diagram, tool) {
// Show only the relevant buttons given the current state.
var cmd = diagram.commandHandler;
/*
document.getElementById(“cut”).style.display = cmd.canCutSelection() ? “block” : “none”;
document.getElementById(“copy”).style.display = cmd.canCopySelection() ? “block” : “none”;
document.getElementById(“paste”).style.display = cmd.canPasteSelection() ? “block” : “none”;
*/
document.getElementById(“delete”).style.display = (obj !== null && cmd.canDeleteSelection()) ? “block” : “none”;
document.getElementById(“componentConfig”).style.display = (obj !== null ? “block” : “none”);
//more such components
if (obj instanceof go.Node) {
//Setting selected component for further processing
$scope.selectedComponent.category = obj.data.category;
$scope.selectedComponent.key = obj.data.key;
}
if (diagram instanceof go.Palette) //don't show context menu for palette elements
return;
// Now show the ,whole context menu element
cxElement.style.display = "block";
// we don't bother overriding positionContextMenu, we just do it here:
var mousePt = diagram.lastInput.viewPoint;
cxElement.style.left = mousePt.x + "px";
cxElement.style.top = mousePt.y + "px";
}