Hi,
I want to disable the copy and paste of my GoJS node using the keyboard shortcuts Ctrl+C and Ctrl+V. But i need this function to happen on click of a button in my context menu.
this.diagram.allowCopy = true; allows duplication with both keyboard and button click .
this.diagram.allowCopy = false; prevents both.
this is my function to duplicate the node via context menu click:
('ContextMenuButton',
{ 'ButtonBorder.fill': 'white', '_buttonFillOver': 'lightgray' },
(go.TextBlock, ‘Duplicate’,
{ margin: 12 }
),
{ click: (e, pt, compInstance) => this.duplicateComponent(compInstance, pt, e) })
duplicateComponent(compInstance, pt, e) {
this.diagram.commandHandler.copySelection();
const point = new go.Point(e[‘Ir’][‘offsetX’] + 20, e[‘Ir’][‘offsetY’] + 20);
this.diagram.commandHandler.pasteSelection(point);
this.propertiesFlagEvent.emit(’’);
this.startAutoSave();
}
How can i prevent just the keyboard shortcuts?