From f9e09e87d67164f675f13adffdcceb5655b29888 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 7 Nov 2016 21:51:03 +0000 Subject: [PATCH] Hit enter to edit first node in selection --- editor/js/ui/keyboard.js | 17 +++++++---------- editor/js/ui/view.js | 12 ++++++++++++ red/api/locales/en-US/editor.json | 5 +++-- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/editor/js/ui/keyboard.js b/editor/js/ui/keyboard.js index 49f660edf..e70e7d731 100644 --- a/editor/js/ui/keyboard.js +++ b/editor/js/ui/keyboard.js @@ -111,14 +111,11 @@ RED.keyboard = (function() { 'Shift + Click'+RED._("keyboard.selectAllConnected")+''+ 'Ctrl/⌘ + Click'+RED._("keyboard.addRemoveNode")+''+ ' '+ + 'Enter'+RED._("keyboard.editSelected")+''+ + 'Delete / Backspace'+RED._("keyboard.deleteSelected")+''+ + ' '+ 'Ctrl/⌘ + i'+RED._("keyboard.importNode")+''+ 'Ctrl/⌘ + e'+RED._("keyboard.exportNode")+''+ - ' '+ - ' '+RED._("keyboard.nudgeNode")+''+ - 'Shift + '+RED._("keyboard.moveNode")+''+ - 'Shift + '+ - 'Shift + '+ - 'Shift + '+ ''+ ''+ '
'+ @@ -126,10 +123,10 @@ RED.keyboard = (function() { 'Ctrl/⌘ + Space'+RED._("keyboard.toggleSidebar")+''+ 'Ctrl/⌘ + .'+RED._("keyboard.searchBox")+''+ 'Ctrl/⌘ + Shift + p'+RED._("keyboard.managePalette")+''+ - ''+ - 'Delete'+RED._("keyboard.deleteSelected")+''+ - 'Backspace'+ - ''+ + ' '+ + ' '+RED._("keyboard.nudgeNode")+''+ + 'Shift + '+RED._("keyboard.moveNode")+''+ + ' '+ 'Ctrl/⌘ + c'+RED._("keyboard.copyNode")+''+ 'Ctrl/⌘ + x'+RED._("keyboard.cutNode")+''+ 'Ctrl/⌘ + v'+RED._("keyboard.pasteNode")+''+ diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js index 6b2b864d5..51dfd823c 100644 --- a/editor/js/ui/view.js +++ b/editor/js/ui/view.js @@ -385,6 +385,8 @@ RED.view = (function() { RED.keyboard.add("workspace",/* backspace */ 8,function(){deleteSelection();d3.event.preventDefault();}); RED.keyboard.add("workspace",/* delete */ 46,function(){deleteSelection();d3.event.preventDefault();}); + RED.keyboard.add("workspace",/* enter */ 13, function() { editSelection(); d3.event.preventDefault();}); + RED.keyboard.add("workspace",/* c */ 67,{ctrl:true},function(){copySelection();d3.event.preventDefault();}); RED.keyboard.add("workspace",/* x */ 88,{ctrl:true},function(){copySelection();deleteSelection();d3.event.preventDefault();}); @@ -1095,6 +1097,16 @@ RED.view = (function() { redraw(); } } + function editSelection() { + if (moving_set.length > 0) { + var node = moving_set[0].n; + if (node.type === "subflow") { + RED.editor.editSubflow(activeSubflow); + } else { + RED.editor.edit(node); + } + } + } function deleteSelection() { if (moving_set.length > 0 || selected_link != null) { var result; diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json index 0f63fa6f8..8d411459a 100644 --- a/red/api/locales/en-US/editor.json +++ b/red/api/locales/en-US/editor.json @@ -167,11 +167,12 @@ "selectAll": "Select all nodes", "selectAllConnected": "Select all connected nodes", "addRemoveNode": "Add/remove node from selection", + "editSelected": "Edit selected node", "deleteSelected": "Delete selected nodes or link", "importNode": "Import nodes", "exportNode": "Export nodes", - "nudgeNode": "Move selected node(s) by a small amount", - "moveNode": "Move selected node(s) by a large amount", + "nudgeNode": "Move selected nodes (1px)", + "moveNode": "Move selected nodes (20px)", "toggleSidebar": "Toggle sidebar", "deleteNode": "Delete selected nodes or link", "copyNode": "Copy selected nodes",