1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Editor: quick-add when connect to empty.

This commit is contained in:
Bruno Feurer 2022-08-30 15:07:30 +02:00
parent 30ea300f65
commit eb53054f49

View File

@ -1798,22 +1798,15 @@ RED.view = (function() {
return; return;
} }
if (mousedown_node && mouse_mode == RED.state.JOINING) { if (mousedown_node && mouse_mode == RED.state.JOINING) {
var removedLinks = []; // Trigger quick add dialog
for (i=0;i<drag_lines.length;i++) { d3.event.stopPropagation();
if (drag_lines[i].link) { clearSelection();
removedLinks.push(drag_lines[i].link) const point = d3.mouse(this);
} var clickedGroup = getGroupAt(point[0], point[1]);
if (drag_lines.length > 0) {
clickedGroup = clickedGroup || RED.nodes.group(drag_lines[0].node.g)
} }
if (removedLinks.length > 0) { showQuickAddDialog({ position: point, group: clickedGroup });
historyEvent = {
t:"delete",
links: removedLinks,
dirty:RED.nodes.dirty()
};
RED.history.push(historyEvent);
RED.nodes.dirty(true);
}
hideDragLines();
} }
if (lasso) { if (lasso) {
var x = parseInt(lasso.attr("x")); var x = parseInt(lasso.attr("x"));