Allow setting Set/Get node position in node suggestion menu

This commit is contained in:
kijai 2025-03-15 11:27:21 +02:00
parent c19ad34916
commit 51e792ccdf

View File

@ -49,7 +49,7 @@ app.registerExtension({
},
async setup(app) {
const onChange = (value) => {
if (value) {
if (value!="disabled") {
const valuesToAddToIn = ["GetNode"];
const valuesToAddToOut = ["SetNode"];
@ -59,7 +59,11 @@ app.registerExtension({
if (idx !== -1) {
arr.splice(idx, 1);
}
arr.unshift(valueToAdd);
if (value === "top") {
arr.unshift(valueToAdd);
} else {
arr.push(valueToAdd);
}
}
}
@ -69,7 +73,11 @@ app.registerExtension({
if (idx !== -1) {
arr.splice(idx, 1);
}
arr.unshift(valueToAdd);
if (value === "top") {
arr.unshift(valueToAdd);
} else {
arr.push(valueToAdd);
}
}
}
}
@ -77,9 +85,11 @@ app.registerExtension({
app.ui.settings.addSetting({
id: "KJNodes.SetGetMenu",
name: "KJNodes: Make Set/Get -nodes defaults (turn off and reload to disable)",
defaultValue: false,
type: "boolean",
name: "KJNodes: Make Set/Get -nodes defaults",
tooltip: 'Adds Set/Get nodes to the top or bottom of the list of available node suggestions. Disabling requires a browser reload.',
options: ['disabled', 'top', 'bottom'],
defaultValue: 'disabled',
type: "combo",
onChange: onChange,
});