Add `splice` property to nodes:add event context

pull/5195/head
Nick O'Leary 2025-06-26 15:01:06 +01:00
parent 3e9106635c
commit c532b55513
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
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;