Do not include Junction type in quick-add for virtual links

This commit is contained in:
Nick O'Leary 2024-09-13 14:35:46 +01:00
parent 380d3be819
commit 89839f433b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -335,13 +335,25 @@ RED.typeSearch = (function() {
}
}
function applyFilter(filter,type,def) {
return !def || !filter ||
(
(!filter.spliceMultiple) &&
(!filter.type || type === filter.type) &&
(!filter.input || type === 'junction' || def.inputs > 0) &&
(!filter.output || type === 'junction' || def.outputs > 0)
)
if (!filter) {
// No filter; allow everything
return true
}
if (type === 'junction') {
// Only allow Junction is there's no specific type filter
return !filter.type
}
if (filter.type) {
// Handle explicit type filter
return filter.type === type
}
if (!def) {
// No node definition available - allow it
return true
}
// Check if the filter is for input/outputs and apply
return (!filter.input || def.inputs > 0) &&
(!filter.output || def.outputs > 0)
}
function refreshTypeList(opts) {
var i;