!diagram.commandHandler.canPasteSelection() || diagram.selection.count === 0)
      ) {
        // Instead of the usual behavior:
        // if (this.canPasteSelection()) this.pasteSelection();
        // let the event bubble up the DOM:
        e.bubbles = true;
      } else {
        go.CommandHandler.prototype.doKeyDown.call(this);
      }
    };

    // handle inserting a new node using text that is in the system clipboard
    document.addEventListener('paste', (e) => {
      const paste = e.clipboardDa