diff --git a/packages/node_modules/@node-red/editor-client/src/js/keymap.json b/packages/node_modules/@node-red/editor-client/src/js/keymap.json index a2a19c94b..4cf28d227 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/keymap.json +++ b/packages/node_modules/@node-red/editor-client/src/js/keymap.json @@ -91,8 +91,7 @@ "alt-shift-w": "core:show-last-hidden-flow", "ctrl-+": "core:zoom-in", "ctrl--": "core:zoom-out", - "ctrl-0": "core:zoom-reset", - "tab": "core:apply-suggested-flow" + "ctrl-0": "core:zoom-reset" }, "red-ui-editor-stack": { "ctrl-enter": "core:confirm-edit-tray", diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index c2aefa499..eee833c31 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -876,19 +876,6 @@ RED.view = (function() { } }) - RED.actions.add("core:apply-suggested-flow", function() { - // TypeSeach will handle this if it is visible; don't want to cause conflicts - if (!RED.typeSearch.isVisible()) { - RED.view.applySuggestedFlow(); - } - }) - RED.actions.add("core:clear-suggested-flow", function() { - // TypeSeach will handle this if it is visible; don't want to cause conflicts - if (!RED.typeSearch.isVisible()) { - RED.view.setSuggestedFlow(null); - } - }) - RED.view.annotations.init(); RED.view.navigator.init(); RED.view.tools.init(); @@ -6526,6 +6513,7 @@ RED.view = (function() { * @param {Object} suggestion - The suggestion object */ function setSuggestedFlow (suggestion) { + $(window).off('keydown.suggestedFlow') if (!currentSuggestion && !suggestion) { // Avoid unnecessary redraws return @@ -6650,7 +6638,22 @@ RED.view = (function() { __ghost: true }) } - $(window).on('keyup',disableSuggestedFlowEventHandler); + if (!RED.typeSearch.isVisible()) { + $(window).on('keydown.suggestedFlow', function (evt) { + console.log('kd') + if (evt.keyCode === 9) { // tab + applySuggestedFlow(); + } else { + clearSuggestedFlow(); + RED.view.redraw(true); + } + }); + } + if (suggestion.clickToApply) { + $(window).on('mousedown.suggestedFlow', function (evnt) { + clearSuggestedFlow(); + }) + } } if (ghostNode) { if (suggestedNodes.length > 0) { @@ -6663,7 +6666,8 @@ RED.view = (function() { } function clearSuggestedFlow () { - $(window).off('keyup', disableSuggestedFlowEventHandler) + $(window).off('mousedown.suggestedFlow'); + $(window).off('keydown.suggestedFlow') currentSuggestion = null suggestedNodes = [] suggestedLinks = [] @@ -6709,12 +6713,6 @@ RED.view = (function() { } } - function disableSuggestedFlowEventHandler(evt) { - if (evt.keyCode === 27) { // ESCAPE - RED.actions.invoke("core:clear-suggested-flow") - } - } - return { init: init, state:function(state) {