Now the delete in canvas is happening from the Backspace button as well as the delete button. I want to restrict it with delete button only.
Override CommandHandler.doKeyDown to handle the “Backspace” key to do what you want. That includes doing nothing as demonstrated in this code:
$(go.Diagram, "myDiagramDiv",
{
"commandHandler.doKeyDown": function() {
const e = this.diagram.lastInput;
if (e.key === "Backspace") return; // or do something else?
// otherwise call the super method to get the regular behavior
go.CommandHandler.prototype.doKeyDown.call(this);
})
Thanks.It worked