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

Fix copy/paste of node into active group

Fixes #2686
This commit is contained in:
Nick O'Leary 2020-09-03 13:12:08 +01:00
parent 3b9065b057
commit d9900d8e4c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -1678,7 +1678,7 @@ RED.view = (function() {
} }
} }
if (ns.length > 0) { if (ns.length > 0 && mouse_mode == RED.state.MOVING_ACTIVE) {
historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()}; historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()};
if (activeSpliceLink) { if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp // TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
@ -2354,6 +2354,10 @@ RED.view = (function() {
mousedown_port_type = null; mousedown_port_type = null;
activeSpliceLink = null; activeSpliceLink = null;
spliceActive = false; spliceActive = false;
if (activeHoverGroup) {
activeHoverGroup.hovered = false;
activeHoverGroup = null;
}
d3.select(".red-ui-flow-link-splice").classed("red-ui-flow-link-splice",false); d3.select(".red-ui-flow-link-splice").classed("red-ui-flow-link-splice",false);
if (spliceTimer) { if (spliceTimer) {
clearTimeout(spliceTimer); clearTimeout(spliceTimer);
@ -2869,7 +2873,7 @@ RED.view = (function() {
//RED.touch.radialMenu.show(d3.select(this),pos); //RED.touch.radialMenu.show(d3.select(this),pos);
if (mouse_mode == RED.state.IMPORT_DRAGGING) { if (mouse_mode == RED.state.IMPORT_DRAGGING) {
RED.keyboard.remove("escape"); RED.keyboard.remove("escape");
var historyEvent = RED.history.peek();
if (activeSpliceLink) { if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp // TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
var spliceLink = d3.select(activeSpliceLink).data()[0]; var spliceLink = d3.select(activeSpliceLink).data()[0];
@ -2886,12 +2890,27 @@ RED.view = (function() {
}; };
RED.nodes.addLink(link1); RED.nodes.addLink(link1);
RED.nodes.addLink(link2); RED.nodes.addLink(link2);
var historyEvent = RED.history.peek();
historyEvent.links = [link1,link2]; historyEvent.links = [link1,link2];
historyEvent.removedLinks = [spliceLink]; historyEvent.removedLinks = [spliceLink];
updateActiveNodes(); updateActiveNodes();
} }
if (activeHoverGroup) {
for (var j=0;j<movingSet.length();j++) {
var n = movingSet.get(j);
RED.group.addToGroup(activeHoverGroup,n.n);
}
historyEvent.addedToGroup = activeHoverGroup;
activeHoverGroup.hovered = false;
enterActiveGroup(activeHoverGroup)
// TODO: check back whether this should add to moving_set
activeGroup.selected = true;
activeHoverGroup = null;
}
updateSelection(); updateSelection();
RED.nodes.dirty(true); RED.nodes.dirty(true);
redraw(); redraw();