Merge pull request #5195 from node-red/add-splice-to-add-event

Add `splice` property to nodes:add event context
pull/5196/head
Nick O'Leary 2025-06-26 15:07:10 +01:00 committed by GitHub
commit 7f147b97ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -660,7 +660,9 @@ RED.view = (function() {
return;
}
var historyEvent = result.historyEvent;
var nn = RED.nodes.add(result.node, { source: 'palette' });
const linkToSplice = $(ui.helper).data("splice");
var nn = RED.nodes.add(result.node, { source: 'palette', splice: !!linkToSplice });
var showLabel = RED.utils.getMessageProperty(RED.settings.get('editor'),"view.view-node-show-label");
if (showLabel !== undefined && (nn._def.hasOwnProperty("showLabel")?nn._def.showLabel:true) && !nn._def.defaults.hasOwnProperty("l")) {
@ -719,7 +721,6 @@ RED.view = (function() {
nn.y -= gridOffset.y;
}
var linkToSplice = $(ui.helper).data("splice");
if (linkToSplice) {
spliceLink(linkToSplice, nn, historyEvent)
}
@ -1560,7 +1561,7 @@ RED.view = (function() {
if (nn.type === 'junction') {
nn = RED.nodes.addJunction(nn);
} else {
nn = RED.nodes.add(nn, { source: 'typeSearch' });
nn = RED.nodes.add(nn, { source: 'typeSearch', splice: !!linkToSplice });
}
if (quickAddLink) {
var drag_line = quickAddLink;