diff --git a/web/src/components/gva-wfd/behavior/deleteItem.js b/web/src/components/gva-wfd/behavior/deleteItem.js index e7f53f01984084888c21e6346efe27d1e736bd4b..faac4f83fdd4a37f69927720bfd0f8eda7000c55 100644 --- a/web/src/components/gva-wfd/behavior/deleteItem.js +++ b/web/src/components/gva-wfd/behavior/deleteItem.js @@ -1,31 +1,31 @@ /* eslint-disable */ -export default function(G6){ - G6.registerBehavior('deleteItem', { - getEvents() { - return { - 'keydown': 'onKeydown', - 'canvas:mouseleave': 'onCanvasLeave', - 'canvas:mouseenter': 'onCanvasFocus', - } - }, - onKeydown(e){ - const items = this.graph.get('selectedItems'); - const focus = this.graph.get('focusGraphWrapper'); - if(e.keyCode === 8 && items && items.length > 0 && focus){ - if(this.graph.executeCommand) { - this.graph.executeCommand('delete', {}); - }else{ - this.graph.remove(items[0]); +export default function(G6) { + G6.registerBehavior('deleteItem', { + getEvents() { + return { + 'keydown': 'onKeydown', + 'canvas:mouseleave': 'onCanvasLeave', + 'canvas:mouseenter': 'onCanvasFocus', + } + }, + onKeydown(e) { + const items = this.graph.get('selectedItems'); + const focus = this.graph.get('focusGraphWrapper'); + if (e.keyCode === 46 && items && items.length > 0 && focus) { + if (this.graph.executeCommand) { + this.graph.executeCommand('delete', {}); + } else { + this.graph.remove(items[0]); + } + this.graph.set('selectedItems', []); + this.graph.emit('afteritemselected', []); + } + }, + onCanvasLeave(e) { + this.graph.set('focusGraphWrapper', false); + }, + onCanvasFocus() { + this.graph.set('focusGraphWrapper', true); } - this.graph.set('selectedItems',[]); - this.graph.emit('afteritemselected',[]); - } - }, - onCanvasLeave(e){ - this.graph.set('focusGraphWrapper',false); - }, - onCanvasFocus(){ - this.graph.set('focusGraphWrapper',true); - } - }); -} + }); +} \ No newline at end of file