Merge pull request #4883 from node-red/4881-fix-quickAdd-state

Stay in quick-add mode following context menu insert
This commit is contained in:
Nick O'Leary 2024-09-17 13:51:54 +01:00 committed by GitHub
commit 1132d39118
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1209,7 +1209,10 @@ RED.view = (function() {
lasso = null;
}
if (d3.event.touches || d3.event.button === 0) {
if ((mouse_mode === 0 || mouse_mode === RED.state.QUICK_JOINING) && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) {
if (
(mouse_mode === 0 && isControlPressed(d3.event) && !(d3.event.altKey || d3.event.shiftKey)) ||
mouse_mode === RED.state.QUICK_JOINING
) {
// Trigger quick add dialog
d3.event.stopPropagation();
clearSelection();
@ -1285,7 +1288,6 @@ RED.view = (function() {
}
var mainPos = $("#red-ui-main-container").position();
if (mouse_mode !== RED.state.QUICK_JOINING) {
mouse_mode = RED.state.QUICK_JOINING;
$(window).on('keyup',disableQuickJoinEventHandler);
@ -3057,8 +3059,8 @@ RED.view = (function() {
}
function disableQuickJoinEventHandler(evt) {
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari)
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91) {
// Check for ctrl (all browsers), "Meta" (Chrome/FF), keyCode 91 (Safari), or Escape
if (evt.keyCode === 17 || evt.key === "Meta" || evt.keyCode === 91 || evt.keyCode === 27) {
resetMouseVars();
hideDragLines();
redraw();