Delete键会删除节点的问题

当我点击一个节点之后,再按键盘的delete键,就会删除掉这个节点,怎么让它禁止删除

You could set or bind Part.deletable to false. Or disable deleting altogether by setting Diagram.allowDelete to false.

Or override the CommandHandler.canDeleteSelection method. For example, here’s an override when making and initializing a Diagram:

"commandHandler.canDeleteSelection": function() {
  return !this.diagram.selection.any(function(p) {
               return p instanceof go.Node && p.data.key.indexOf("e") >= 0;
            })
         && go.CommandHandler.prototype.canDeleteSelection.call(this);
}

This prevents deleting any selected node whose node.data.key includes the letter “e”.

谢谢沃尔特,现在它正常工作