mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 07:31:07 +01:00
Add escape to clear suggested flow
This commit is contained in:
@@ -539,9 +539,10 @@ RED.typeSearch = (function() {
|
||||
}
|
||||
|
||||
return {
|
||||
show: show,
|
||||
show,
|
||||
refresh: refreshTypeList,
|
||||
hide: hide
|
||||
hide,
|
||||
isVisible: () => visible
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -876,6 +876,19 @@ 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();
|
||||
@@ -6613,6 +6626,7 @@ RED.view = (function() {
|
||||
__ghost: true
|
||||
})
|
||||
}
|
||||
$(window).on('keyup',disableSuggestedFlowEventHandler);
|
||||
}
|
||||
if (ghostNode) {
|
||||
if (suggestedNodes.length > 0) {
|
||||
@@ -6625,6 +6639,7 @@ RED.view = (function() {
|
||||
}
|
||||
|
||||
function clearSuggestedFlow () {
|
||||
$(window).off('keyup', disableSuggestedFlowEventHandler)
|
||||
currentSuggestion = null
|
||||
suggestedNodes = []
|
||||
suggestedLinks = []
|
||||
@@ -6670,6 +6685,12 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function disableSuggestedFlowEventHandler(evt) {
|
||||
if (evt.keyCode === 27) { // ESCAPE
|
||||
RED.actions.invoke("core:clear-suggested-flow")
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
init: init,
|
||||
state:function(state) {
|
||||
|
||||
Reference in New Issue
Block a user