How to prevent "delete" key?


I want to prevent deleting node from pressing “delete” key .

How can I make “delete” key doesn’t work?


To disable the key, set GoView.DisableKeys to include the GoViewDeleteKeys.Delete flag.

Or set GoView.AllowDelete to false.

Thanks for answer.

But I don’t know how to apply GoView.DisableKeys on Diagram.

I just like this. Is this same with your answer?

myDiagram.commandHandler.doKeyDown = function() {
var e = myDiagram.lastInput;
if(e.key == “Del”) return;

You had submitted your question in the GoDiagram category, but now it seems you actually are using GoJS. Is that correct?

What you write is half of the idea. The rest of the time it should call the base method so that the diagram still executes other keyboard commands. Please read

Thank you so much :)